[gedit] Correctly sync the window name



commit b64740a32b4f4b07da1f59e63d1a0e67b7203eeb
Author: Garrett Regier <alias301 gmail com>
Date:   Wed Jun 23 02:28:51 2010 -0700

    Correctly sync the window name

 gedit/gedit-window.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index b98057a..c4ba23c 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2962,8 +2962,10 @@ sync_name (GeditTab    *tab,
 	gchar *tab_name;
 	gchar *escaped_name;
 	gchar *tip;
-	gint n;
 	GeditDocument *doc;
+	gint page_num;
+	GeditNotebook *active_notebook;
+	gboolean is_active;
 
 	if (tab == gedit_window_get_active_tab (window))
 	{
@@ -2977,8 +2979,25 @@ sync_name (GeditTab    *tab,
 	}
 
 	/* sync the item in the documents list menu */
-	n = gedit_multi_notebook_get_page_num (window->priv->multi_notebook, tab);
-	action_name = g_strdup_printf ("Tab_%d", n);
+	
+	active_notebook = gedit_multi_notebook_get_active_notebook (window->priv->multi_notebook);
+	page_num = gtk_notebook_page_num (GTK_NOTEBOOK (active_notebook),
+					  GTK_WIDGET (tab));
+
+	is_active = (page_num != -1);
+
+	page_num = gedit_multi_notebook_get_page_num (window->priv->multi_notebook,
+						      tab);
+
+	/* get the action name related with the page number */
+	if (is_active)
+	{
+		action_name = g_strdup_printf ("Active_Tab_%d", page_num);
+	}
+	else
+	{
+		action_name = g_strdup_printf ("Inactive_Tab_%d", page_num);
+	}
 	action = gtk_action_group_get_action (window->priv->documents_list_action_group,
 					      action_name);
 	g_return_if_fail (action != NULL);



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