filter in separate window
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 5 Sep 2005 16:49:50 +0000 (16:49 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 5 Sep 2005 16:49:50 +0000 (16:49 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1131 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/filter/filter.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h

index c21239e5eb74852c7c9831853d1f4c153a4035a5..7e0cde2390b1f35aff4a7dbb638e770a47a4d760 100644 (file)
@@ -103,6 +103,8 @@ struct _FilterViewerDataLine {
 struct _FilterViewerData {
   Tab *tab;                             /**< current tab of module */
 
+  GtkWidget *f_window;                  /**< filter window */
+  
   GtkWidget *f_main_box;                /**< main container */
 
   GtkWidget *f_expression_field;        /**< entire expression (GtkEntry) */
@@ -119,7 +121,8 @@ struct _FilterViewerData {
   GPtrArray *f_math_op_options;         /**< array of operators types for math_op box */
   
   GtkWidget *f_add_button;              /**< add expression to current expression (GtkButton) */
-  
+  gchar *name;                          /**< Name of the window in the main window */
 };
 
 /**
@@ -206,6 +209,8 @@ gui_filter(Tab *tab)
   g_ptr_array_add(fvd->f_math_op_options,(gpointer) g_string_new(">="));
   
 
+  fvd->f_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
   /* 
    * Initiating GtkTable layout 
    * starts with 2 rows and 5 columns and 
@@ -215,6 +220,8 @@ gui_filter(Tab *tab)
   gtk_table_set_row_spacings(GTK_TABLE(fvd->f_main_box),5);
   gtk_table_set_col_spacings(GTK_TABLE(fvd->f_main_box),5);
   
+  gtk_container_add(GTK_CONTAINER(fvd->f_window), GTK_WIDGET(fvd->f_main_box));
+  
   /*
    *  First half of the filter window
    *  - textual entry of filter expression
@@ -273,6 +280,7 @@ gui_filter(Tab *tab)
    * show main container 
    */
   gtk_widget_show(fvd->f_main_box);
+  gtk_widget_show(fvd->f_window);
   
   
   g_object_set_data_full(
@@ -417,6 +425,10 @@ gui_filter_destructor(FilterViewerData *fvd)
   lttvwindowtraces_background_notify_remove(fvd);
   
   g_filter_list = g_slist_remove(g_filter_list, fvd);
+  main_window_remove_child_window(tab, fvd->name);
+  
+  g_free(fvd->name);
   
   g_free(fvd);
 }
@@ -436,10 +448,14 @@ GtkWidget *
 h_guifilter(Tab *tab)
 {
   FilterViewerData* f = gui_filter(tab) ;
+  f->name = g_new(gchar, 256);
+
+  snprintf(f->name, 256, "guifilter %p", f);
 
   if(f)
-    return guifilter_get_widget(f);
-  else return NULL;
+    main_window_add_child_window(tab, f,
+        f->name, (GDestroyNotify)gui_filter_destructor);
+  return NULL;
   
 }
 
index d76ce1545b792d2d4121220a45e789c0e8a83ac7..225104c780a5f7b27b12c9f9f8e090c800e99253 100644 (file)
@@ -1122,3 +1122,19 @@ void events_request_free(EventsRequest *events_request)
 }
 
 
+void main_window_add_child_window(Tab *tab, gpointer data,
+    const gchar *name, GDestroyNotify destroy_fct)
+{
+  g_object_set_data_full(G_OBJECT(tab->mw->mwindow),
+      name,
+      data,
+      destroy_fct);
+}
+
+void main_window_remove_child_window(Tab *tab,
+    const gchar *name)
+{
+  /* Might return NULL if called from the descructor upon main window close */
+  g_object_steal_data(G_OBJECT(tab->mw->mwindow), name);
+}
+
index f7c7441f4010acb4f2e34985bf352bdb24d31d54..d0a97c07d07cb02cec2dd3dc9f4c1e690675cfe4 100644 (file)
@@ -792,7 +792,19 @@ void set_time_window(Tab *tab, const TimeWindow *time_window);
 
 void set_current_time(Tab *tab, const LttTime *current_time);
 
-
 void events_request_free(EventsRequest *events_request);
 
+/* main_window_add_child_window
+ *
+ * Add the widget as a data to the main window : it will close a floating window
+ * with its main window by calling the destroy_fct.
+ */
+
+void main_window_add_child_window(Tab *tab, gpointer data,
+    const gchar *name, GDestroyNotify descroy_fct);
+
+
+void main_window_remove_child_window(Tab *tab,
+    const gchar *name);
+
 #endif //LTTVWINDOW_H
This page took 0.026769 seconds and 4 git commands to generate.