From 6a4f1205696729eff6a0d06b789d2adaac0ce0e5 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 5 Sep 2005 16:49:50 +0000 Subject: [PATCH] filter in separate window git-svn-id: http://ltt.polymtl.ca/svn@1131 04897980-b3bd-0310-b5e0-8ef037075253 --- .../poly/lttv/modules/gui/filter/filter.c | 22 ++++++++++++++++--- .../gui/lttvwindow/lttvwindow/lttvwindow.c | 16 ++++++++++++++ .../gui/lttvwindow/lttvwindow/lttvwindow.h | 14 +++++++++++- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/filter/filter.c b/ltt/branches/poly/lttv/modules/gui/filter/filter.c index c21239e5..7e0cde23 100644 --- a/ltt/branches/poly/lttv/modules/gui/filter/filter.c +++ b/ltt/branches/poly/lttv/modules/gui/filter/filter.c @@ -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; } diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index d76ce154..225104c7 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -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); +} + diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index f7c7441f..d0a97c07 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -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 -- 2.34.1