good transient for background computation msg
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 16 Sep 2005 00:29:49 +0000 (00:29 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 16 Sep 2005 00:29:49 +0000 (00:29 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1205 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.h
ltt/branches/poly/lttv/modules/gui/statistics/statistics.c

index e2a42d4fea5a5fa6c4a718c5b17387f448572d9c..1149e1b915553d7d54cd8722e3f3b213f574b750 100644 (file)
@@ -139,7 +139,8 @@ static void request_background_data(ControlFlowData *control_flow_data)
          * starts.
          */
         if(!lttvwindowtraces_background_request_find(trace, "state"))
-          lttvwindowtraces_background_request_queue(trace, "state");
+          lttvwindowtraces_background_request_queue(
+              main_window_get_widget(control_flow_data->tab), trace, "state");
         lttvwindowtraces_background_notify_queue(control_flow_data,
                                                  trace,
                                                  ltt_time_infinite,
index db9005f7bc1b38b0cf9e883267a78da79365ec14..53684d28c2c844da86393ed274dcec7514c91cfe 100644 (file)
@@ -562,7 +562,8 @@ static void request_background_data(EventViewerData *event_viewer_data)
          * starts.
          */
         if(!lttvwindowtraces_background_request_find(trace, "state"))
-          lttvwindowtraces_background_request_queue(trace, "state");
+          lttvwindowtraces_background_request_queue(
+              main_window_get_widget(event_viewer_data->tab), trace, "state");
         lttvwindowtraces_background_notify_queue(event_viewer_data,
                                                  trace,
                                                  ltt_time_infinite,
index c1df4513c5816753138439679b7f1f08dcbe390c..76992022167afc01054e5d9ba87e151332708922 100644 (file)
@@ -38,7 +38,9 @@
 #include <lttv/tracecontext.h>
 #include <lttvwindow/lttvwindowtraces.h>
 #include <lttvwindow/lttvwindow.h> // for CHUNK_NUM_EVENTS
+#include <lttvwindow/mainwindow-private.h> /* 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 {
@@ -306,13 +309,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)
+                     (GtkWidget *widget, LttvTrace *trace, gchar *module_name)
 {
   BackgroundRequest *bg_req;
   LttvAttribute *attribute = lttv_trace_attribute(trace);
@@ -359,14 +363,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);
 }
 
@@ -932,6 +943,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
  * 
@@ -1297,11 +1314,24 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
             
             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);
index 1d21a577fd789a1fea9df963c2b78d713533728b..2345030896de616fda79aef715733e7235b6dcf7 100644 (file)
@@ -70,6 +70,7 @@
 
 #include <ltt/time.h>
 #include <glib.h>
+#include <gtk/gtk.h>
 
 typedef GQuark LttvTraceInfo;
 
@@ -131,13 +132,14 @@ void lttvwindowtraces_remove_trace(LttvTrace *trace);
  *
  * The memory allocated for the request will be managed by the API.
  * 
+ * @param tab parent 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);
+                     (GtkWidget *widget, LttvTrace *trace, gchar *module_name);
 
 /**
  * Remove a background request from a trace.
index 87a3e762f74f22fa2736e0eb4efcf86e0fcf451c..9f63a9e7742a0269601f1c80b1a394f10a626db0 100644 (file)
@@ -169,7 +169,8 @@ static void request_background_data(StatisticViewerData *svd)
          * starts.
          */
         if(!lttvwindowtraces_background_request_find(trace, "stats"))
-          lttvwindowtraces_background_request_queue(trace, "stats");
+          lttvwindowtraces_background_request_queue(
+              main_window_get_widget(svd->tab), trace, "stats");
         lttvwindowtraces_background_notify_queue(svd,
                                                  trace,
                                                  ltt_time_infinite,
This page took 0.029156 seconds and 4 git commands to generate.