From: compudj Date: Thu, 24 Jun 2004 20:59:26 +0000 (+0000) Subject: added X to tabs X-Git-Tag: v0.12.20~2877 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=27a559b9b1ddb82a0c8452046366cde8112a6a98;p=lttv.git added X to tabs git-svn-id: http://ltt.polymtl.ca/svn@612 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 1e678444..412f9298 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -1554,14 +1554,14 @@ on_close_activate (GtkMenuItem *menuitem, */ void -on_close_tab_activate (GtkMenuItem *menuitem, +on_close_tab_activate (GtkWidget *widget, gpointer user_data) { gint page_num; GtkWidget * notebook; GtkWidget * page; - MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem); - notebook = lookup_widget((GtkWidget*)menuitem, "MNotebook"); + MainWindow * mw_data = get_window_data_struct(widget); + notebook = lookup_widget(widget, "MNotebook"); if(notebook == NULL){ g_printf("Notebook does not exist\n"); return; @@ -1573,6 +1573,22 @@ on_close_tab_activate (GtkMenuItem *menuitem, } +void +on_close_tab_X_clicked (GtkWidget *widget, + gpointer user_data) +{ + gint page_num; + GtkWidget *notebook = lookup_widget(widget, "MNotebook"); + if(notebook == NULL){ + g_printf("Notebook does not exist\n"); + return; + } + + if((page_num = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), widget)) != -1) + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), page_num); + +} + void on_add_trace_activate (GtkMenuItem *menuitem, @@ -2600,6 +2616,7 @@ void construct_main_window(MainWindow * parent) g_printf("Notebook does not exist\n"); return; } + gtk_notebook_popup_enable (GTK_NOTEBOOK(notebook)); //for now there is no name field in LttvTraceset structure //Use "Traceset" as the label for the default tab if(parent) { @@ -2743,10 +2760,33 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, tab->multi_vpaned = (GtkMultiVPaned*)gtk_multi_vpaned_new(); gtk_widget_show((GtkWidget*)tab->multi_vpaned); tab->mw = mw; + + { + /* Display a label with a X */ + GtkWidget *w_hbox = gtk_hbox_new(FALSE, 4); + GtkWidget *w_label = gtk_label_new (label); + GtkWidget *pixmap = create_pixmap(GTK_WIDGET(notebook), "close.png"); + GtkWidget *w_button = gtk_button_new (); + gtk_container_add(GTK_CONTAINER(w_button), pixmap); + //GtkWidget *w_button = gtk_button_new_with_label("x"); + + gtk_button_set_relief(GTK_BUTTON(w_button), GTK_RELIEF_NONE); + + gtk_box_pack_start(GTK_BOX(w_hbox), w_label, TRUE, TRUE, 0); + gtk_box_pack_end(GTK_BOX(w_hbox), w_button, FALSE, + FALSE, 0); - tab->label = gtk_label_new (label); - gtk_widget_show (tab->label); + g_signal_connect_swapped (w_button, "clicked", + G_CALLBACK (on_close_tab_X_clicked), + tab->multi_vpaned); + gtk_widget_show (w_label); + gtk_widget_show (pixmap); + gtk_widget_show (w_button); + gtk_widget_show (w_hbox); + + tab->label = w_hbox; + } /* Start with empty events requests list */ tab->events_requests = NULL; tab->events_request_pending = FALSE; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h index 31589b38..81425a3d 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h @@ -54,7 +54,11 @@ on_close_activate (GtkMenuItem *menuitem, gpointer user_data); void -on_close_tab_activate (GtkMenuItem *menuitem, +on_close_tab_X_clicked (GtkWidget *widget, + gpointer user_data); + +void +on_close_tab_activate (GtkWidget *widget, gpointer user_data); void diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am index eb375f40..4cde1ff3 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am @@ -24,4 +24,5 @@ EXTRA_DIST = \ stock_zoom_out_24.png\ stock_stop_24.png\ stock_redo_24.png\ - stock_refresh_24.png + stock_refresh_24.png\ + close.png diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png new file mode 100644 index 00000000..3506f4b7 Binary files /dev/null and b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png differ