evolution r36553 - branches/kill-bonobo/shell



Author: mbarnes
Date: Fri Oct  3 22:05:32 2008
New Revision: 36553
URL: http://svn.gnome.org/viewvc/evolution?rev=36553&view=rev

Log:
Finally fix the stupid shell view bootstrapping issue.


Modified:
   branches/kill-bonobo/shell/e-shell-window-actions.c
   branches/kill-bonobo/shell/e-shell-window-actions.h
   branches/kill-bonobo/shell/e-shell-window.c

Modified: branches/kill-bonobo/shell/e-shell-window-actions.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.c	Fri Oct  3 22:05:32 2008
@@ -1673,6 +1673,19 @@
 	  TRUE }
 };
 
+static GtkRadioActionEntry shell_switcher_entries[] = {
+
+	/* This action represents the initial active shell view.
+	 * It should not be visible in the UI, nor should it be
+	 * possible to switch to it from another shell view. */
+	{ "switcher-initial",
+	  NULL,
+	  NULL,
+	  NULL,
+	  NULL,
+	  -1 }
+};
+
 static GtkRadioActionEntry shell_switcher_style_entries[] = {
 
 	{ "switcher-style-icons",
@@ -1868,9 +1881,13 @@
 	gtk_action_group_set_translation_domain (action_group, domain);
 	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
 
-	/* Switcher Actions (empty) */
+	/* Switcher Actions */
 	action_group = shell_window->priv->switcher_actions;
 	gtk_action_group_set_translation_domain (action_group, domain);
+	gtk_action_group_add_radio_actions (
+		action_group, shell_switcher_entries,
+		G_N_ELEMENTS (shell_switcher_entries),
+		-1, G_CALLBACK (action_switcher_cb), shell_window);
 	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
 }
 
@@ -1952,10 +1969,10 @@
 {
 	GType *children;
 	GSList *group = NULL;
+	GtkRadioAction *action;
 	GtkActionGroup *action_group;
 	GtkUIManager *ui_manager;
 	EShellSwitcher *switcher;
-	GList *list;
 	guint n_children, ii;
 	guint merge_id;
 
@@ -1972,9 +1989,12 @@
 	 * actions are manifested as switcher buttons and View->Window
 	 * menu items. */
 
+	action = GTK_RADIO_ACTION (ACTION (SWITCHER_INITIAL));
+	gtk_radio_action_set_group (action, group);
+	group = gtk_radio_action_get_group (action);
+
 	for (ii = 0; ii < n_children; ii++) {
 		EShellViewClass *class;
-		GtkRadioAction *action;
 		const gchar *view_name;
 		gchar *accelerator;
 		gchar *action_name;
@@ -2043,17 +2063,6 @@
 		g_type_class_unref (class);
 	}
 
-	list = gtk_action_group_list_actions (action_group);
-	if (list != NULL) {
-		GtkRadioAction *action = list->data;
-
-		g_signal_connect (
-			action, "changed",
-			G_CALLBACK (action_switcher_cb),
-			shell_window);
-		g_list_free (list);
-	}
-
 	g_free (children);
 }
 

Modified: branches/kill-bonobo/shell/e-shell-window-actions.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.h	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.h	Fri Oct  3 22:05:32 2008
@@ -81,6 +81,8 @@
 	E_SHELL_WINDOW_ACTION ((window), "show-toolbar")
 #define E_SHELL_WINDOW_ACTION_SUBMIT_BUG(window) \
 	E_SHELL_WINDOW_ACTION ((window), "submit-bug")
+#define E_SHELL_WINDOW_ACTION_SWITCHER_INITIAL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "switcher-initial")
 #define E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_BOTH(window) \
 	E_SHELL_WINDOW_ACTION ((window), "switcher-style-both")
 #define E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_ICONS(window) \

Modified: branches/kill-bonobo/shell/e-shell-window.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window.c	Fri Oct  3 22:05:32 2008
@@ -283,6 +283,8 @@
 
 	shell_window->priv = E_SHELL_WINDOW_GET_PRIVATE (shell_window);
 
+	gtk_window_set_title (GTK_WINDOW (shell_window), _("Evolution"));
+
 	e_shell_window_private_init (shell_window);
 
 	ui_manager = e_shell_window_get_ui_manager (shell_window);
@@ -598,15 +600,7 @@
 	g_return_if_fail (shell_view != NULL);
 
 	action = e_shell_view_get_action (shell_view);
-
-	/* XXX Radio actions refuse to activate if they're already active.
-	 *     This causes problems during intialization if we're trying to
-	 *     switch to the shell view whose corresponding radio action is
-	 *     already active.  This works around the problem. */
-	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
-		e_shell_window_switch_to_view (shell_window, view_name);
-	else
-		gtk_action_activate (action);
+	gtk_action_activate (action);
 }
 
 /**



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