X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Flttvwindowtraces.c;h=eb449f03f964daf94242d0ab39a2caa41c4122a1;hb=a7804dbc9bd7727d426e78c977511c36bfc6af1c;hp=c1df4513c5816753138439679b7f1f08dcbe390c;hpb=93ac601b7487eba4b0733f44117f45fa9dd0baee;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c index c1df4513..eb449f03 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c @@ -38,7 +38,9 @@ #include #include #include // for CHUNK_NUM_EVENTS +#include /* for main window structure */ +extern GSList * g_main_window_list; typedef struct _BackgroundRequest { LttvAttributeName module_name; /* Hook path in global attributes, @@ -46,6 +48,7 @@ typedef struct _BackgroundRequest { i.e. modulename */ LttvTrace *trace; /* trace concerned */ GtkWidget *dialog; /* Dialog linked with the request, may be NULL */ + GtkWidget *parent_window; /* Parent window the dialog must be transient for */ } BackgroundRequest; typedef struct _BackgroundNotify { @@ -69,7 +72,7 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace); * NULL is returned if the trace is not present */ -LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path) +__EXPORT LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path) { guint i; @@ -94,19 +97,21 @@ LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path) /* Get a trace by its number identifier */ -LttvTrace *lttvwindowtraces_get_trace(guint num) +__EXPORT LttvTrace *lttvwindowtraces_get_trace(guint num) { LttvAttribute *g_attribute = lttv_global_attributes(); LttvAttribute *attribute; LttvAttributeType type; LttvAttributeName name; LttvAttributeValue value; + gboolean is_named; g_assert(attribute = LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute), LTTV_TRACES))); - type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), num, &name, &value); + type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), num, &name, &value, + &is_named); if(type == LTTV_POINTER) { return (LttvTrace *)*(value.v_pointer); @@ -117,7 +122,7 @@ LttvTrace *lttvwindowtraces_get_trace(guint num) /* Total number of traces */ -guint lttvwindowtraces_get_number() +__EXPORT guint lttvwindowtraces_get_number() { LttvAttribute *g_attribute = lttv_global_attributes(); LttvAttribute *attribute; @@ -206,7 +211,6 @@ void lttvwindowtraces_add_trace(LttvTrace *trace) value = lttv_attribute_add(attribute, LTTV_NOTIFY_CURRENT, LTTV_POINTER); - } /* Remove a trace from the global attributes */ @@ -306,13 +310,14 @@ static void destroy_dialog(BackgroundRequest *bg_req) * * The memory allocated for the request will be managed by the API. * + * @param widget the current Window * @param trace the trace to compute * @param module_name the name of the module which registered global computation * hooks. */ -void lttvwindowtraces_background_request_queue - (LttvTrace *trace, gchar *module_name) +__EXPORT void lttvwindowtraces_background_request_queue + (GtkWidget *widget, LttvTrace *trace, gchar *module_name) { BackgroundRequest *bg_req; LttvAttribute *attribute = lttv_trace_attribute(trace); @@ -359,14 +364,21 @@ void lttvwindowtraces_background_request_queue g_info("Background computation for %s started for trace %p", module_name, trace); GtkWidget *dialog = - gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, + gtk_message_dialog_new( + GTK_WINDOW(widget), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Background computation for %s started for trace %s", module_name, g_quark_to_string(ltt_trace_name(lttv_trace(trace)))); + gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(widget)); g_signal_connect_swapped (dialog, "response", G_CALLBACK (destroy_dialog), bg_req); bg_req->dialog = dialog; + /* the parent window might vanish : only use this pointer for a + * comparison with existing windows */ + bg_req->parent_window = gtk_widget_get_toplevel(widget); gtk_widget_show(dialog); } @@ -421,7 +433,7 @@ void lttvwindowtraces_background_request_remove * */ -gboolean lttvwindowtraces_background_request_find +__EXPORT gboolean lttvwindowtraces_background_request_find (LttvTrace *trace, gchar *module_name) { LttvAttribute *attribute = lttv_trace_attribute(trace); @@ -459,7 +471,7 @@ gboolean lttvwindowtraces_background_request_find * @param notify Hook to call when the notify position is passed */ -void lttvwindowtraces_background_notify_queue +__EXPORT void lttvwindowtraces_background_notify_queue (gpointer owner, LttvTrace *trace, LttTime notify_time, @@ -513,7 +525,7 @@ void lttvwindowtraces_background_notify_queue * @param notify Hook to call when the notify position is passed */ -void lttvwindowtraces_background_notify_current +__EXPORT void lttvwindowtraces_background_notify_current (gpointer owner, LttvTrace *trace, LttTime notify_time, @@ -574,7 +586,7 @@ static void notify_request_free(BackgroundNotify *notify_req) * @param owner owner of the background notification */ -void lttvwindowtraces_background_notify_remove(gpointer owner) +__EXPORT void lttvwindowtraces_background_notify_remove(gpointer owner) { guint i; @@ -860,7 +872,7 @@ void lttvwindowtraces_unset_in_progress(LttvAttributeName module_name, LTTV_IN_PROGRESS); } -gboolean lttvwindowtraces_get_in_progress(LttvAttributeName module_name, +__EXPORT gboolean lttvwindowtraces_get_in_progress(LttvAttributeName module_name, LttvTrace *trace) { LttvAttribute *attribute = lttv_trace_attribute(trace); @@ -911,7 +923,7 @@ void lttvwindowtraces_unset_ready(LttvAttributeName module_name, LTTV_READY); } -gboolean lttvwindowtraces_get_ready(LttvAttributeName module_name, +__EXPORT gboolean lttvwindowtraces_get_ready(LttvAttributeName module_name, LttvTrace *trace) { LttvAttribute *attribute = lttv_trace_attribute(trace); @@ -932,6 +944,12 @@ gboolean lttvwindowtraces_get_ready(LttvAttributeName module_name, return TRUE; } +static gint find_window_widget(MainWindow *a, GtkWidget *b) +{ + if(a->mwindow == b) return 0; + else return -1; +} + /* lttvwindowtraces_process_pending_requests * @@ -956,6 +974,8 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) if(trace == NULL) return FALSE; + + if(lttvwindow_preempt_count > 0) return TRUE; attribute = lttv_trace_attribute(trace); @@ -1292,16 +1312,34 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) &value); g_assert(type == LTTV_POINTER); LttvHooks *after_request = (LttvHooks*)*(value.v_pointer); - - if(after_request != NULL) lttv_hooks_call(after_request, tsc); + { + struct sum_traceset_closure t_closure; + t_closure.tss = (LttvTracesetStats*)tsc; + t_closure.current_time = ltt_time_infinite; + if(after_request != NULL) lttv_hooks_call(after_request, + &t_closure); + } if(bg_req->dialog != NULL) gtk_widget_destroy(bg_req->dialog); + GtkWidget *parent_window; + if(g_slist_find_custom(g_main_window_list, + bg_req->parent_window, + (GCompareFunc)find_window_widget)) + parent_window = GTK_WIDGET(bg_req->parent_window); + else + parent_window = NULL; + GtkWidget *dialog = - gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, + gtk_message_dialog_new(GTK_WINDOW(parent_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Background computation %s finished for trace %s", g_quark_to_string(bg_req->module_name), g_quark_to_string(ltt_trace_name(lttv_trace(bg_req->trace)))); + if(parent_window != NULL) + gtk_window_set_transient_for(GTK_WINDOW(dialog), + GTK_WINDOW(parent_window)); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);