gnome-terminal r2760 - trunk/src



Author: chpe
Date: Thu May 29 19:51:40 2008
New Revision: 2760
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2760&view=rev

Log:
Fix the tabs menu after the introduction of TerminalScreenContainer.


Modified:
   trunk/src/terminal-tabs-menu.c
   trunk/src/terminal-window.c

Modified: trunk/src/terminal-tabs-menu.c
==============================================================================
--- trunk/src/terminal-tabs-menu.c	(original)
+++ trunk/src/terminal-tabs-menu.c	Thu May 29 19:51:40 2008
@@ -271,6 +271,23 @@
 }
 
 static void
+notebook_page_switch_cb (GtkNotebook *notebook,
+                         GtkNotebookPage *page,
+                         guint position,
+                         TerminalTabsMenu *menu)
+{
+        GtkWidget *container;
+        TerminalScreen *screen;
+        GtkAction *action;
+
+        container = gtk_notebook_get_nth_page (notebook, position);
+        screen = terminal_screen_container_get_screen (container);
+
+	action = g_object_get_data (G_OBJECT (screen), DATA_KEY);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+}
+
+static void
 connect_proxy_cb (GtkActionGroup *action_group,
 		  GtkAction *action,
 		  GtkWidget *proxy,
@@ -289,27 +306,6 @@
 }
 
 static void
-sync_active_tab (TerminalWindow *window,
-		 GParamSpec *pspec,
-		 TerminalTabsMenu *menu)
-{
-	TerminalScreen *screen;
-	GtkAction *action;
-
-	screen = terminal_window_get_active (window);
-	if (screen == NULL) return;
-
-	action = g_object_get_data (G_OBJECT (screen), DATA_KEY);
-	/* happens initially, since the ::active-child comes before
-	* the ::tab-added signal
-	*/
-	/* FIXME that's not true with gtk+ 2.9 anymore */
-	if (action == NULL) return;
-
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-}
-
-static void
 terminal_tabs_menu_set_window (TerminalTabsMenu *menu,
 			   TerminalWindow *window)
 {
@@ -332,9 +328,6 @@
 	g_signal_connect (priv->action_group, "connect-proxy",
 			  G_CALLBACK (connect_proxy_cb), NULL);
 
-	g_signal_connect (window, "notify::active-child",
-			  G_CALLBACK (sync_active_tab), menu);
-
 	notebook = terminal_window_get_notebook (window);
 	g_signal_connect_object (notebook, "page-added",
 				 G_CALLBACK (notebook_page_added_cb), menu, 0);
@@ -342,6 +335,8 @@
 				 G_CALLBACK (notebook_page_removed_cb), menu, 0);
 	g_signal_connect_object (notebook, "page-reordered",
 				 G_CALLBACK (notebook_page_reordered_cb), menu, 0);
+	g_signal_connect_object (notebook, "switch-page",
+				 G_CALLBACK (notebook_page_switch_cb), menu, 0);
 }
 
 static void
@@ -387,7 +382,6 @@
 
 	g_type_class_add_private (object_class, sizeof (TerminalTabsMenuPrivate));
 
-
         /* We don't want to save accels, so skip them */
         gtk_accel_map_add_filter ("<Actions>/TabsActions/JmpTab*");
 }

Modified: trunk/src/terminal-window.c
==============================================================================
--- trunk/src/terminal-window.c	(original)
+++ trunk/src/terminal-window.c	Thu May 29 19:51:40 2008
@@ -1451,7 +1451,6 @@
                        "}\n"
                        "widget \"*.gnome-terminal-tab-close-button\" style \"gnome-terminal-tab-close-button-style\"");
 
-
   gtk_notebook_set_window_creation_hook (handle_tab_droped_on_desktop, NULL, NULL);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]