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) */
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 */
};
/**
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
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
* show main container
*/
gtk_widget_show(fvd->f_main_box);
+ gtk_widget_show(fvd->f_window);
g_object_set_data_full(
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);
}
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;
}
}
+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);
+}
+
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