From ff5e0b312d04daf97b35616b55280ae7f2d17cf7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 3 Oct 2008 22:05:32 +0000 Subject: Finally fix the stupid shell view bootstrapping issue. svn path=/branches/kill-bonobo/; revision=36553 --- shell/e-shell-window-actions.c | 37 +++++++++++++++++++++++-------------- shell/e-shell-window-actions.h | 2 ++ shell/e-shell-window.c | 12 +++--------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 9e7c4aaee7..2e80ab6bf6 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -1673,6 +1673,19 @@ static GtkToggleActionEntry shell_toggle_entries[] = { 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 @@ e_shell_window_actions_init (EShellWindow *shell_window) 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 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window) { 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 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window) * 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 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window) 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); } diff --git a/shell/e-shell-window-actions.h b/shell/e-shell-window-actions.h index 2dae2f73cc..0914abcbc8 100644 --- a/shell/e-shell-window-actions.h +++ b/shell/e-shell-window-actions.h @@ -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) \ diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 5b54b38396..427e1311a0 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -283,6 +283,8 @@ shell_window_init (EShellWindow *shell_window) 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 @@ e_shell_window_set_active_view (EShellWindow *shell_window, 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); } /** -- cgit v1.2.3