From: yangxx Date: Sat, 31 Jan 2004 14:51:09 +0000 (+0000) Subject: New tab button X-Git-Tag: v0.12.20~3024 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2901f3148ea8fca148245713db2e3b4498f3fcb3;p=lttv.git New tab button git-svn-id: http://ltt.polymtl.ca/svn@465 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c index 4e6c01d5..2d041719 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c @@ -641,14 +641,10 @@ on_clone_traceset_activate (GtkMenuItem *menuitem, create_new_window((GtkWidget*)menuitem, user_data, TRUE); } - -void -on_tab_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ +void create_new_tab(GtkWidget* widget, gpointer user_data){ gchar label[PATH_LENGTH]; - MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem); - GtkNotebook * notebook = (GtkNotebook *)lookup_widget((GtkWidget*)menuitem, "MNotebook"); + MainWindow * mw_data = get_window_data_struct(widget); + GtkNotebook * notebook = (GtkNotebook *)lookup_widget(widget, "MNotebook"); if(notebook == NULL){ g_printf("Notebook does not exist\n"); return; @@ -660,6 +656,13 @@ on_tab_activate (GtkMenuItem *menuitem, create_tab (mw_data, mw_data, notebook, label); } +void +on_tab_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + create_new_tab((GtkWidget*)menuitem, user_data); +} + void on_open_activate (GtkMenuItem *menuitem, @@ -1016,6 +1019,12 @@ on_button_new_clicked (GtkButton *button, create_new_window((GtkWidget*)button, user_data, FALSE); } +void +on_button_new_tab_clicked (GtkButton *button, + gpointer user_data) +{ + create_new_tab((GtkWidget*)button, user_data); +} void on_button_open_clicked (GtkButton *button, diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h index 9d48e029..95c57c3b 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h +++ b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h @@ -165,7 +165,9 @@ on_about_activate (GtkMenuItem *menuitem, void on_button_new_clicked (GtkButton *button, gpointer user_data); - +void +on_button_new_tab_clicked (GtkButton *button, + gpointer user_data); void on_button_open_clicked (GtkButton *button, gpointer user_data); diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/interface.c b/ltt/branches/poly/lttv/modules/gui/main/src/interface.c index 5de418a5..0011cda7 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/interface.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/interface.c @@ -113,6 +113,7 @@ create_MWindow (void) GtkWidget *MToolbar1; GtkWidget *tmp_toolbar_icon; GtkWidget *tlbEmptyTraceset; + GtkWidget *tlbTab; // GtkWidget *tlbOpenTraceset; GtkWidget *tlbAddTrace; GtkWidget *tlbRemoveTrace; @@ -405,6 +406,18 @@ create_MWindow (void) gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE); gtk_widget_show (tlbEmptyTraceset); gtk_container_set_border_width (GTK_CONTAINER (tlbEmptyTraceset), 1); + + tmp_toolbar_icon = create_pixmap (MWindow, "filenew.png"); + tlbTab = gtk_toolbar_append_element (GTK_TOOLBAR (MToolbar1), + GTK_TOOLBAR_CHILD_BUTTON, + NULL, + "", + "New tab", NULL, + tmp_toolbar_icon, NULL, NULL); + gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE); + gtk_widget_show (tlbTab); + gtk_container_set_border_width (GTK_CONTAINER (tlbTab), 1); + /* tmp_toolbar_icon = create_pixmap (MWindow, "fileopen.png"); tlbOpenTraceset = gtk_toolbar_append_element (GTK_TOOLBAR (MToolbar1), @@ -696,6 +709,9 @@ create_MWindow (void) g_signal_connect ((gpointer) tlbEmptyTraceset, "clicked", G_CALLBACK (on_button_new_clicked), NULL); + g_signal_connect ((gpointer) tlbTab, "clicked", + G_CALLBACK (on_button_new_tab_clicked), + NULL); /* g_signal_connect ((gpointer) tlbOpenTraceset, "clicked", G_CALLBACK (on_button_open_clicked), @@ -811,6 +827,7 @@ create_MWindow (void) GLADE_HOOKUP_OBJECT (MWindow, About, "About"); GLADE_HOOKUP_OBJECT (MWindow, MToolbar1, "MToolbar1"); GLADE_HOOKUP_OBJECT (MWindow, tlbEmptyTraceset, "tlbEmptyTraceset"); + GLADE_HOOKUP_OBJECT (MWindow, tlbTab, "tlbTab"); // GLADE_HOOKUP_OBJECT (MWindow, tlbOpenTraceset, "tlbOpenTraceset"); GLADE_HOOKUP_OBJECT (MWindow, tlbAddTrace, "tlbAddTrace"); GLADE_HOOKUP_OBJECT (MWindow, tlbRemoveTrace, "tlbRemoveTrace");