New tab button
authoryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 31 Jan 2004 14:51:09 +0000 (14:51 +0000)
committeryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 31 Jan 2004 14:51:09 +0000 (14:51 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@465 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c
ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h
ltt/branches/poly/lttv/modules/gui/main/src/interface.c

index 4e6c01d5c7722ecbdd7136ebcaf883583accb712..2d0417193bfdbb9900427d58d3d9d7fa0dfdfe12 100644 (file)
@@ -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,
index 9d48e0294e2e38745039fa9fdd0bcb48586bf04a..95c57c3b45dcea860c8c46bc9ae08d601f4c400e 100644 (file)
@@ -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);
index 5de418a5f05cef8095cd2097b788c88ae69e715c..0011cda76bd44bbd82a839fc6614bb6511404847 100644 (file)
@@ -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");
This page took 0.027865 seconds and 4 git commands to generate.