diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-27 13:22:57 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-27 13:22:57 +0800 |
commit | 4b140a897f1b45515ac9987e0b2d343c12f02f1c (patch) | |
tree | f6059f221bc93189d894659a96324a80a4da1f00 | |
parent | 98d262b594caefd053a2d075e2d8482b2d8a12c8 (diff) | |
download | gsoc2013-evolution-4b140a897f1b45515ac9987e0b2d343c12f02f1c.tar gsoc2013-evolution-4b140a897f1b45515ac9987e0b2d343c12f02f1c.tar.gz gsoc2013-evolution-4b140a897f1b45515ac9987e0b2d343c12f02f1c.tar.bz2 gsoc2013-evolution-4b140a897f1b45515ac9987e0b2d343c12f02f1c.tar.lz gsoc2013-evolution-4b140a897f1b45515ac9987e0b2d343c12f02f1c.tar.xz gsoc2013-evolution-4b140a897f1b45515ac9987e0b2d343c12f02f1c.tar.zst gsoc2013-evolution-4b140a897f1b45515ac9987e0b2d343c12f02f1c.zip |
Make action group management in shell windows more elegant.
svn path=/branches/kill-bonobo/; revision=37137
32 files changed, 145 insertions, 192 deletions
diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c index a264f7f84b..ed88b54855 100644 --- a/addressbook/gui/component/e-book-shell-view-actions.c +++ b/addressbook/gui/component/e-book-shell-view-actions.c @@ -839,21 +839,16 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) EShellView *shell_view; EShellWindow *shell_window; GtkActionGroup *action_group; - GtkUIManager *ui_manager; GConfBridge *bridge; GtkAction *action; GObject *object; - const gchar *domain; const gchar *key; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; /* Contact Actions */ - action_group = book_shell_view->priv->contact_actions; - gtk_action_group_set_translation_domain (action_group, domain); + action_group = ACTION_GROUP (CONTACTS); gtk_action_group_add_actions ( action_group, contact_entries, G_N_ELEMENTS (contact_entries), book_shell_view); @@ -868,12 +863,6 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) G_N_ELEMENTS (contact_search_entries), CONTACT_SEARCH_NAME_CONTAINS, NULL, NULL); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); - - /* Filter Actions (empty) */ - action_group = book_shell_view->priv->filter_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -909,8 +898,9 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) void e_book_shell_view_update_search_filter (EBookShellView *book_shell_view) { - EShellContent *shell_content; EShellView *shell_view; + EShellContent *shell_content; + EShellWindow *shell_window; GtkActionGroup *action_group; GtkRadioAction *radio_action; GList *list, *iter; @@ -919,8 +909,9 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view) shell_view = E_SHELL_VIEW (book_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); - action_group = book_shell_view->priv->filter_actions; + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = ACTION_GROUP (CONTACTS_FILTER); e_action_group_remove_all_actions (action_group); /* Add the standard filter actions. */ diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c index 509547c6c0..c41e0672b4 100644 --- a/addressbook/gui/component/e-book-shell-view-private.c +++ b/addressbook/gui/component/e-book-shell-view-private.c @@ -420,8 +420,6 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view, (GDestroyNotify) g_free); priv->source_list = g_object_ref (source_list); - priv->contact_actions = gtk_action_group_new ("contacts"); - priv->filter_actions = gtk_action_group_new ("contacts-filter"); priv->uid_to_view = uid_to_view; priv->uid_to_editor = uid_to_editor; @@ -448,6 +446,9 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view) shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); + e_shell_window_add_action_group (shell_window, "contacts"); + e_shell_window_add_action_group (shell_window, "contacts-filter"); + /* Cache these to avoid lots of awkward casting. */ priv->book_shell_content = g_object_ref (shell_content); priv->book_shell_sidebar = g_object_ref (shell_sidebar); @@ -491,9 +492,6 @@ e_book_shell_view_private_dispose (EBookShellView *book_shell_view) DISPOSE (priv->source_list); - DISPOSE (priv->contact_actions); - DISPOSE (priv->filter_actions); - DISPOSE (priv->book_shell_content); DISPOSE (priv->book_shell_sidebar); diff --git a/addressbook/gui/component/e-book-shell-view-private.h b/addressbook/gui/component/e-book-shell-view-private.h index 050c13d6eb..6f0d0af147 100644 --- a/addressbook/gui/component/e-book-shell-view-private.h +++ b/addressbook/gui/component/e-book-shell-view-private.h @@ -96,11 +96,6 @@ struct _EBookShellViewPrivate { ESourceList *source_list; - /*** UI Management ***/ - - GtkActionGroup *contact_actions; - GtkActionGroup *filter_actions; - /*** Other Stuff ***/ /* These are just for convenience. */ diff --git a/calendar/modules/e-cal-shell-view-actions.c b/calendar/modules/e-cal-shell-view-actions.c index 105b4a3e7d..53898ffe12 100644 --- a/calendar/modules/e-cal-shell-view-actions.c +++ b/calendar/modules/e-cal-shell-view-actions.c @@ -1030,18 +1030,13 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) EShellView *shell_view; EShellWindow *shell_window; GtkActionGroup *action_group; - GtkUIManager *ui_manager; GtkAction *action; - const gchar *domain; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; /* Calendar Actions */ - action_group = cal_shell_view->priv->calendar_actions; - gtk_action_group_set_translation_domain (action_group, domain); + action_group = ACTION_GROUP (CALENDAR); gtk_action_group_add_actions ( action_group, calendar_entries, G_N_ELEMENTS (calendar_entries), cal_shell_view); @@ -1057,7 +1052,6 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) G_N_ELEMENTS (calendar_search_entries), CALENDAR_SEARCH_SUMMARY_CONTAINS, NULL, NULL); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -1070,11 +1064,11 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) /* Fine tuning. */ - action = ACTION (CALENDAR_GO_TODAY); - g_object_set (action, "short-label", _("Today"), NULL); + action = ACTION (CALENDAR_GO_TODAY); + g_object_set (action, "short-label", _("Today"), NULL); - action = ACTION (CALENDAR_JUMP_TO); - g_object_set (action, "short-label", _("Go To"), NULL); + action = ACTION (CALENDAR_JUMP_TO); + g_object_set (action, "short-label", _("Go To"), NULL); action = ACTION (EVENT_DELETE); g_object_set (action, "short-label", _("Delete"), NULL); @@ -1096,6 +1090,7 @@ void e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) { EShellContent *shell_content; + EShellWindow *shell_window; EShellView *shell_view; GtkActionGroup *action_group; GtkRadioAction *radio_action; @@ -1105,8 +1100,9 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) shell_view = E_SHELL_VIEW (cal_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); - action_group = cal_shell_view->priv->filter_actions; + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = ACTION_GROUP (CALENDAR_FILTER); e_action_group_remove_all_actions (action_group); /* Add the standard filter actions. */ diff --git a/calendar/modules/e-cal-shell-view-actions.h b/calendar/modules/e-cal-shell-view-actions.h index 9d75b002a8..1ad6aa7d51 100644 --- a/calendar/modules/e-cal-shell-view-actions.h +++ b/calendar/modules/e-cal-shell-view-actions.h @@ -145,7 +145,9 @@ E_SHELL_WINDOW_ACTION ((window), "calendar-search-summary-contains") /* Action Groups */ -#define E_SHELL_WINDOW_ACTION_GROUP_CALS(window) \ - E_SHELL_WINDOW_ACTION_GROUP ((window), "calendars") +#define E_SHELL_WINDOW_ACTION_GROUP_CALENDAR(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "calendar") +#define E_SHELL_WINDOW_ACTION_GROUP_CALENDAR_FILTER(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "calendar-filter") #endif /* E_CAL_SHELL_VIEW_ACTIONS_H */ diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c index dc3c384888..f5988dc125 100644 --- a/calendar/modules/e-cal-shell-view-memopad.c +++ b/calendar/modules/e-cal-shell-view-memopad.c @@ -341,14 +341,12 @@ e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view) EShellView *shell_view; EShellWindow *shell_window; GtkActionGroup *action_group; - GtkUIManager *ui_manager; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); /* Calendar Actions */ - action_group = cal_shell_view->priv->calendar_actions; + action_group = ACTION_GROUP (CALENDAR); gtk_action_group_add_actions ( action_group, calendar_memopad_entries, G_N_ELEMENTS (calendar_memopad_entries), cal_shell_view); diff --git a/calendar/modules/e-cal-shell-view-private.c b/calendar/modules/e-cal-shell-view-private.c index 561ff4a2b0..def3ba07e4 100644 --- a/calendar/modules/e-cal-shell-view-private.c +++ b/calendar/modules/e-cal-shell-view-private.c @@ -229,8 +229,6 @@ e_cal_shell_view_private_init (ECalShellView *cal_shell_view, g_return_if_fail (E_IS_SOURCE_LIST (source_list)); priv->source_list = g_object_ref (source_list); - priv->calendar_actions = gtk_action_group_new ("calendars"); - priv->filter_actions = gtk_action_group_new ("calendars-filter"); if (!gal_view_collection_loaded (shell_view_class->view_collection)) cal_shell_view_load_view_collection (shell_view_class); @@ -248,6 +246,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) ECalShellSidebar *cal_shell_sidebar; EShellContent *shell_content; EShellSidebar *shell_sidebar; + EShellWindow *shell_window; EShellView *shell_view; GnomeCalendar *calendar; ECalendar *mini_calendar; @@ -259,6 +258,10 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) shell_view = E_SHELL_VIEW (cal_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + e_shell_window_add_action_group (shell_window, "calendar"); + e_shell_window_add_action_group (shell_window, "calendar-filter"); /* Cache these to avoid lots of awkward casting. */ priv->cal_shell_content = g_object_ref (shell_content); @@ -360,9 +363,6 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view) DISPOSE (priv->source_list); - DISPOSE (priv->calendar_actions); - DISPOSE (priv->filter_actions); - DISPOSE (priv->cal_shell_content); DISPOSE (priv->cal_shell_sidebar); diff --git a/calendar/modules/e-cal-shell-view-private.h b/calendar/modules/e-cal-shell-view-private.h index 87f816d746..af492618e9 100644 --- a/calendar/modules/e-cal-shell-view-private.h +++ b/calendar/modules/e-cal-shell-view-private.h @@ -94,11 +94,6 @@ struct _ECalShellViewPrivate { ESourceList *source_list; - /*** UI Management ***/ - - GtkActionGroup *calendar_actions; - GtkActionGroup *filter_actions; - /* These are just for convenience. */ ECalShellContent *cal_shell_content; ECalShellSidebar *cal_shell_sidebar; diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c index 9962ed62b0..49b7f3635f 100644 --- a/calendar/modules/e-cal-shell-view-taskpad.c +++ b/calendar/modules/e-cal-shell-view-taskpad.c @@ -429,14 +429,12 @@ e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view) EShellView *shell_view; EShellWindow *shell_window; GtkActionGroup *action_group; - GtkUIManager *ui_manager; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); /* Calendar Actions */ - action_group = cal_shell_view->priv->calendar_actions; + action_group = ACTION_GROUP (CALENDAR); gtk_action_group_add_actions ( action_group, calendar_taskpad_entries, G_N_ELEMENTS (calendar_taskpad_entries), cal_shell_view); diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c index d5ae8c967d..2d0837afc1 100644 --- a/calendar/modules/e-memo-shell-view-actions.c +++ b/calendar/modules/e-memo-shell-view-actions.c @@ -770,21 +770,16 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) EShellView *shell_view; EShellWindow *shell_window; GtkActionGroup *action_group; - GtkUIManager *ui_manager; GConfBridge *bridge; GtkAction *action; GObject *object; - const gchar *domain; const gchar *key; shell_view = E_SHELL_VIEW (memo_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; /* Memo Actions */ - action_group = memo_shell_view->priv->memo_actions; - gtk_action_group_set_translation_domain (action_group, domain); + action_group = ACTION_GROUP (MEMOS); gtk_action_group_add_actions ( action_group, memo_entries, G_N_ELEMENTS (memo_entries), memo_shell_view); @@ -799,7 +794,6 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) G_N_ELEMENTS (memo_search_entries), MEMO_SEARCH_SUMMARY_CONTAINS, NULL, NULL); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -836,6 +830,7 @@ void e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view) { EShellContent *shell_content; + EShellWindow *shell_window; EShellView *shell_view; GtkActionGroup *action_group; GtkRadioAction *radio_action; @@ -845,8 +840,9 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view) shell_view = E_SHELL_VIEW (memo_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); - action_group = memo_shell_view->priv->filter_actions; + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = ACTION_GROUP (MEMOS_FILTER); e_action_group_remove_all_actions (action_group); /* Add the standard filter actions. */ diff --git a/calendar/modules/e-memo-shell-view-actions.h b/calendar/modules/e-memo-shell-view-actions.h index 28b8b3cfe7..97fd9a6c2b 100644 --- a/calendar/modules/e-memo-shell-view-actions.h +++ b/calendar/modules/e-memo-shell-view-actions.h @@ -81,5 +81,7 @@ /* Action Groups */ #define E_SHELL_WINDOW_ACTION_GROUP_MEMOS(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "memos") +#define E_SHELL_WINDOW_ACTION_GROUP_MEMOS_FILTER(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "memos-filter") #endif /* E_MEMO_SHELL_VIEW_ACTIONS_H */ diff --git a/calendar/modules/e-memo-shell-view-private.c b/calendar/modules/e-memo-shell-view-private.c index 10b20c1827..a945415b03 100644 --- a/calendar/modules/e-memo-shell-view-private.c +++ b/calendar/modules/e-memo-shell-view-private.c @@ -160,8 +160,6 @@ e_memo_shell_view_private_init (EMemoShellView *memo_shell_view, g_return_if_fail (E_IS_SOURCE_LIST (source_list)); priv->source_list = g_object_ref (source_list); - priv->memo_actions = gtk_action_group_new ("memos"); - priv->filter_actions = gtk_action_group_new ("memos-filter"); if (!gal_view_collection_loaded (shell_view_class->view_collection)) memo_shell_view_load_view_collection (shell_view_class); @@ -180,6 +178,7 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view) EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; + EShellWindow *shell_window; EMemoTable *memo_table; ECalModel *model; ETable *table; @@ -188,6 +187,10 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view) shell_view = E_SHELL_VIEW (memo_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + e_shell_window_add_action_group (shell_window, "memos"); + e_shell_window_add_action_group (shell_window, "memos-filter"); /* Cache these to avoid lots of awkward casting. */ priv->memo_shell_content = g_object_ref (shell_content); @@ -284,9 +287,6 @@ e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view) DISPOSE (priv->source_list); - DISPOSE (priv->memo_actions); - DISPOSE (priv->filter_actions); - DISPOSE (priv->memo_shell_content); DISPOSE (priv->memo_shell_sidebar); diff --git a/calendar/modules/e-memo-shell-view-private.h b/calendar/modules/e-memo-shell-view-private.h index 8ed9ba1837..9667bc5ec7 100644 --- a/calendar/modules/e-memo-shell-view-private.h +++ b/calendar/modules/e-memo-shell-view-private.h @@ -88,11 +88,6 @@ struct _EMemoShellViewPrivate { ESourceList *source_list; - /*** UI Management ***/ - - GtkActionGroup *memo_actions; - GtkActionGroup *filter_actions; - /*** Other Stuff ***/ /* These are just for convenience. */ diff --git a/calendar/modules/e-task-shell-view-actions.c b/calendar/modules/e-task-shell-view-actions.c index 35c4ccbacf..c1810beee5 100644 --- a/calendar/modules/e-task-shell-view-actions.c +++ b/calendar/modules/e-task-shell-view-actions.c @@ -972,21 +972,16 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) EShellView *shell_view; EShellWindow *shell_window; GtkActionGroup *action_group; - GtkUIManager *ui_manager; GConfBridge *bridge; GtkAction *action; GObject *object; - const gchar *domain; const gchar *key; shell_view = E_SHELL_VIEW (task_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; /* Task Actions */ - action_group = task_shell_view->priv->task_actions; - gtk_action_group_set_translation_domain (action_group, domain); + action_group = ACTION_GROUP (TASKS); gtk_action_group_add_actions ( action_group, task_entries, G_N_ELEMENTS (task_entries), task_shell_view); @@ -1001,7 +996,6 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) G_N_ELEMENTS (task_search_entries), TASK_SEARCH_SUMMARY_CONTAINS, NULL, NULL); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -1038,6 +1032,7 @@ void e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) { EShellContent *shell_content; + EShellWindow *shell_window; EShellView *shell_view; GtkActionGroup *action_group; GtkRadioAction *radio_action; @@ -1047,8 +1042,9 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) shell_view = E_SHELL_VIEW (task_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); - action_group = task_shell_view->priv->filter_actions; + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = ACTION_GROUP (TASKS_FILTER); e_action_group_remove_all_actions (action_group); /* Add the standard filter actions. */ diff --git a/calendar/modules/e-task-shell-view-actions.h b/calendar/modules/e-task-shell-view-actions.h index 0d6465435c..163a6400cd 100644 --- a/calendar/modules/e-task-shell-view-actions.h +++ b/calendar/modules/e-task-shell-view-actions.h @@ -99,5 +99,7 @@ /* Action Groups */ #define E_SHELL_WINDOW_ACTION_GROUP_TASKS(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "tasks") +#define E_SHELL_WINDOW_ACTION_GROUP_TASKS_FILTER(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "tasks-filter") #endif /* E_TASK_SHELL_VIEW_ACTIONS_H */ diff --git a/calendar/modules/e-task-shell-view-private.c b/calendar/modules/e-task-shell-view-private.c index 47692fd037..b57e8dd815 100644 --- a/calendar/modules/e-task-shell-view-private.c +++ b/calendar/modules/e-task-shell-view-private.c @@ -223,8 +223,6 @@ e_task_shell_view_private_init (ETaskShellView *task_shell_view, g_return_if_fail (E_IS_SOURCE_LIST (source_list)); priv->source_list = g_object_ref (source_list); - priv->task_actions = gtk_action_group_new ("tasks"); - priv->filter_actions = gtk_action_group_new ("tasks-filter"); if (!gal_view_collection_loaded (shell_view_class->view_collection)) task_shell_view_load_view_collection (shell_view_class); @@ -243,6 +241,7 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view) EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; + EShellWindow *shell_window; ECalendarTable *task_table; ECalModel *model; ETable *table; @@ -252,6 +251,10 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view) shell_view = E_SHELL_VIEW (task_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + e_shell_window_add_action_group (shell_window, "tasks"); + e_shell_window_add_action_group (shell_window, "tasks-filter"); /* Cache these to avoid lots of awkward casting. */ priv->task_shell_content = g_object_ref (shell_content); @@ -381,9 +384,6 @@ e_task_shell_view_private_dispose (ETaskShellView *task_shell_view) DISPOSE (priv->source_list); - DISPOSE (priv->task_actions); - DISPOSE (priv->filter_actions); - DISPOSE (priv->task_shell_content); DISPOSE (priv->task_shell_sidebar); diff --git a/calendar/modules/e-task-shell-view-private.h b/calendar/modules/e-task-shell-view-private.h index ccf7e00521..415363730a 100644 --- a/calendar/modules/e-task-shell-view-private.h +++ b/calendar/modules/e-task-shell-view-private.h @@ -97,11 +97,6 @@ struct _ETaskShellViewPrivate { ESourceList *source_list; - /*** UI Management ***/ - - GtkActionGroup *task_actions; - GtkActionGroup *filter_actions; - /*** Other Stuff ***/ /* These are just for convenience. */ diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt index ef017b742f..79575ed74d 100644 --- a/doc/reference/shell/eshell-sections.txt +++ b/doc/reference/shell/eshell-sections.txt @@ -266,6 +266,7 @@ e_shell_window_get_active_view e_shell_window_set_active_view e_shell_window_get_safe_mode e_shell_window_set_safe_mode +e_shell_window_add_action_group e_shell_window_register_new_item_actions e_shell_window_register_new_source_actions <SUBSECTION Standard> @@ -336,6 +337,7 @@ E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE E_SHELL_WINDOW_ACTION_GROUP_CUSTOM_RULES E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW +E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_APPLICATION_HANDLERS E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_SAVE_TO_DISK diff --git a/doc/reference/shell/tmpl/action-groups.sgml b/doc/reference/shell/tmpl/action-groups.sgml index 6b8e165c89..5fe62d7ebb 100644 --- a/doc/reference/shell/tmpl/action-groups.sgml +++ b/doc/reference/shell/tmpl/action-groups.sgml @@ -65,6 +65,14 @@ Action Groups @window: +<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_APPLICATION_HANDLERS ##### --> +<para> + +</para> + +@window: + + <!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING ##### --> <para> diff --git a/doc/reference/shell/tmpl/e-shell-window.sgml b/doc/reference/shell/tmpl/e-shell-window.sgml index 0d083b2220..f1bbeac5e7 100644 --- a/doc/reference/shell/tmpl/e-shell-window.sgml +++ b/doc/reference/shell/tmpl/e-shell-window.sgml @@ -157,6 +157,15 @@ EShellWindow @safe_mode: +<!-- ##### FUNCTION e_shell_window_add_action_group ##### --> +<para> + +</para> + +@shell_window: +@group_name: + + <!-- ##### FUNCTION e_shell_window_register_new_item_actions ##### --> <para> diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index 5019d234bc..7b91ae1934 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -37,6 +37,7 @@ #include "e-mail-reader.h" #include "e-mail-shell-module.h" +#include "e-mail-shell-view-actions.h" #define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -431,7 +432,7 @@ mail_shell_content_get_action_group (EMailReader *reader) shell_view = e_shell_content_get_shell_view (shell_content); shell_window = e_shell_view_get_shell_window (shell_view); - return e_shell_window_get_action_group (shell_window, "mail"); + return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window); } static gboolean diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index c0e08f4270..3c3cae101c 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -1011,21 +1011,17 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) EShellView *shell_view; EShellWindow *shell_window; GtkActionGroup *action_group; - GtkUIManager *ui_manager; GConfBridge *bridge; GObject *object; GObject *src_object; GObject *dst_object; - const gchar *domain; const gchar *key; shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; - action_group = mail_shell_view->priv->mail_actions; - gtk_action_group_set_translation_domain (action_group, domain); + /* Mail Actions */ + action_group = ACTION_GROUP (MAIL); gtk_action_group_add_actions ( action_group, mail_entries, G_N_ELEMENTS (mail_entries), mail_shell_view); @@ -1049,7 +1045,6 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) G_N_ELEMENTS (mail_scope_entries), MAIL_SCOPE_CURRENT_FOLDER, NULL, NULL); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Bind GObject properties for GConf keys. */ diff --git a/mail/e-mail-shell-view-actions.h b/mail/e-mail-shell-view-actions.h index 7e144ad4d7..3760b39da9 100644 --- a/mail/e-mail-shell-view-actions.h +++ b/mail/e-mail-shell-view-actions.h @@ -255,5 +255,7 @@ /* Action Groups */ #define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail") +#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_FILTER(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-filter") #endif /* E_MAIL_SHELL_VIEW_ACTIONS_H */ diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c index 160e1b8828..b9fe7ab4fd 100644 --- a/mail/e-mail-shell-view-private.c +++ b/mail/e-mail-shell-view-private.c @@ -141,13 +141,6 @@ void e_mail_shell_view_private_init (EMailShellView *mail_shell_view, EShellViewClass *shell_view_class) { - EMailShellViewPrivate *priv = mail_shell_view->priv; - - /* Note: EMailShellContent retrieves the "mail" action group - * by name to satisfy its EMailReader interface. */ - priv->mail_actions = gtk_action_group_new ("mail"); - priv->filter_actions = gtk_action_group_new ("mail-filter"); - if (!gal_view_collection_loaded (shell_view_class->view_collection)) mail_shell_view_load_view_collection (shell_view_class); @@ -164,6 +157,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; + EShellWindow *shell_window; EMFolderTreeModel *folder_tree_model; EMFolderTree *folder_tree; MessageList *message_list; @@ -173,6 +167,10 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) shell_view = E_SHELL_VIEW (mail_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + e_shell_window_add_action_group (shell_window, "mail"); + e_shell_window_add_action_group (shell_window, "mail-filter"); /* Cache these to avoid lots of awkward casting. */ priv->mail_shell_content = g_object_ref (shell_content); @@ -237,9 +235,6 @@ e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view) { EMailShellViewPrivate *priv = mail_shell_view->priv; - DISPOSE (priv->mail_actions); - DISPOSE (priv->filter_actions); - DISPOSE (priv->mail_shell_content); DISPOSE (priv->mail_shell_sidebar); } diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h index a6f493216b..87c300213b 100644 --- a/mail/e-mail-shell-view-private.h +++ b/mail/e-mail-shell-view-private.h @@ -113,11 +113,6 @@ enum { struct _EMailShellViewPrivate { - /*** UI Management ***/ - - GtkActionGroup *mail_actions; - GtkActionGroup *filter_actions; - /*** Other Stuff ***/ /* These are just for convenience. */ diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index f944d88eb6..50749a7698 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -1806,18 +1806,15 @@ e_shell_window_actions_init (EShellWindow *shell_window) { GtkActionGroup *action_group; GtkUIManager *ui_manager; - const gchar *domain; g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); ui_manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; e_load_ui_definition (ui_manager, "evolution-shell.ui"); /* Shell Actions */ - action_group = shell_window->priv->shell_actions; - gtk_action_group_set_translation_domain (action_group, domain); + action_group = ACTION_GROUP (SHELL); gtk_action_group_add_actions ( action_group, shell_entries, G_N_ELEMENTS (shell_entries), shell_window); @@ -1836,55 +1833,20 @@ e_shell_window_actions_init (EShellWindow *shell_window) action_group, shell_gal_view_radio_entries, G_N_ELEMENTS (shell_gal_view_radio_entries), 0, G_CALLBACK (action_gal_view_cb), shell_window); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); - - /* GAL View Actions (empty) */ - action_group = shell_window->priv->gal_view_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); - - /* New Item Actions (empty) */ - action_group = shell_window->priv->new_item_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); - - /* New Source Actions (empty) */ - action_group = shell_window->priv->new_source_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); - - /* Custom Rule Actions (empty) */ - action_group = shell_window->priv->custom_rule_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Switcher Actions */ - action_group = shell_window->priv->switcher_actions; - gtk_action_group_set_translation_domain (action_group, domain); + action_group = ACTION_GROUP (SWITCHER); 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); - - /* Lockdown Printing Actions */ - action_group = shell_window->priv->lockdown_printing; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Lockdown Print Setup Actions */ - action_group = shell_window->priv->lockdown_print_setup; - gtk_action_group_set_translation_domain (action_group, domain); + action_group = ACTION_GROUP (LOCKDOWN_PRINT_SETUP); gtk_action_group_add_actions ( action_group, shell_lockdown_print_setup_entries, G_N_ELEMENTS (shell_lockdown_print_setup_entries), shell_window); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); - - /* Lockdown Save-to-Disk Actions */ - action_group = shell_window->priv->lockdown_save_to_disk; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Fine tuning. */ @@ -1903,13 +1865,13 @@ e_shell_window_create_new_menu (EShellWindow *shell_window) /* Get sorted lists of "new item" and "new source" actions. */ - action_group = shell_window->priv->new_item_actions; + action_group = ACTION_GROUP (NEW_ITEM); new_item_actions = g_list_sort ( gtk_action_group_list_actions (action_group), (GCompareFunc) e_action_compare_by_label); - action_group = shell_window->priv->new_source_actions; + action_group = ACTION_GROUP (NEW_SOURCE); new_source_actions = g_list_sort ( gtk_action_group_list_actions (action_group), @@ -1979,7 +1941,7 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window) g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); - action_group = shell_window->priv->switcher_actions; + action_group = ACTION_GROUP (SWITCHER); switcher = E_SHELL_SWITCHER (shell_window->priv->switcher); ui_manager = e_shell_window_get_ui_manager (shell_window); merge_id = gtk_ui_manager_new_merge_id (ui_manager); @@ -2106,7 +2068,7 @@ e_shell_window_update_view_menu (EShellWindow *shell_window) view_id = e_shell_view_get_view_id (shell_view); g_return_if_fail (view_collection != NULL); - action_group = shell_window->priv->gal_view_actions; + action_group = ACTION_GROUP (GAL_VIEW); merge_id = shell_window->priv->gal_view_merge_id; /* Unmerge the previous menu. */ @@ -2213,7 +2175,7 @@ e_shell_window_update_search_menu (EShellWindow *shell_window) /* Add custom rules to the Search menu. */ - action_group = shell_window->priv->custom_rule_actions; + action_group = ACTION_GROUP (CUSTOM_RULES); merge_id = shell_window->priv->custom_rule_merge_id; /* Unmerge the previous menu. */ diff --git a/shell/e-shell-window-actions.h b/shell/e-shell-window-actions.h index ca7e783a86..87ae13221c 100644 --- a/shell/e-shell-window-actions.h +++ b/shell/e-shell-window-actions.h @@ -103,6 +103,8 @@ E_SHELL_WINDOW_ACTION_GROUP ((window), "custom-rules") #define E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "gal-view") +#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_APPLICATION_HANDLERS(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-application-handlers") #define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-printing") #define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP(window) \ diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index 2c2ebc5564..987c0ab9fb 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -189,22 +189,21 @@ e_shell_window_private_init (EShellWindow *shell_window) signal_handler_ids = g_array_new (FALSE, FALSE, sizeof (gulong)); priv->ui_manager = gtk_ui_manager_new (); - priv->shell_actions = gtk_action_group_new ("shell"); - priv->gal_view_actions = gtk_action_group_new ("gal-view"); - priv->new_item_actions = gtk_action_group_new ("new-item"); - priv->new_source_actions = gtk_action_group_new ("new-source"); - priv->custom_rule_actions = gtk_action_group_new ("custom-rules"); - priv->switcher_actions = gtk_action_group_new ("switcher"); - priv->lockdown_printing = - gtk_action_group_new ("lockdown-printing"); - priv->lockdown_print_setup = - gtk_action_group_new ("lockdown-print-setup"); - priv->lockdown_save_to_disk = - gtk_action_group_new ("lockdown-save-to-disk"); priv->loaded_views = loaded_views; priv->active_view = "unknown"; priv->signal_handler_ids = signal_handler_ids; + e_shell_window_add_action_group (shell_window, "shell"); + e_shell_window_add_action_group (shell_window, "gal-view"); + e_shell_window_add_action_group (shell_window, "new-item"); + e_shell_window_add_action_group (shell_window, "new-source"); + e_shell_window_add_action_group (shell_window, "custom-rules"); + e_shell_window_add_action_group (shell_window, "switcher"); + e_shell_window_add_action_group (shell_window, "lockdown-application-handlers"); + e_shell_window_add_action_group (shell_window, "lockdown-printing"); + e_shell_window_add_action_group (shell_window, "lockdown-print-setup"); + e_shell_window_add_action_group (shell_window, "lockdown-save-to-disk"); + merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager); priv->custom_rule_merge_id = merge_id; @@ -422,17 +421,7 @@ e_shell_window_private_dispose (EShellWindow *shell_window) } DISPOSE (priv->shell); - DISPOSE (priv->ui_manager); - DISPOSE (priv->shell_actions); - DISPOSE (priv->gal_view_actions); - DISPOSE (priv->new_item_actions); - DISPOSE (priv->new_source_actions); - DISPOSE (priv->custom_rule_actions); - DISPOSE (priv->switcher_actions); - DISPOSE (priv->lockdown_printing); - DISPOSE (priv->lockdown_print_setup); - DISPOSE (priv->lockdown_save_to_disk); g_hash_table_remove_all (priv->loaded_views); diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h index ff8e5afcb2..3d0d913863 100644 --- a/shell/e-shell-window-private.h +++ b/shell/e-shell-window-private.h @@ -70,15 +70,6 @@ struct _EShellWindowPrivate { /*** UI Management ***/ GtkUIManager *ui_manager; - GtkActionGroup *shell_actions; - GtkActionGroup *gal_view_actions; - GtkActionGroup *new_item_actions; - GtkActionGroup *new_source_actions; - GtkActionGroup *custom_rule_actions; - GtkActionGroup *switcher_actions; - GtkActionGroup *lockdown_printing; - GtkActionGroup *lockdown_print_setup; - GtkActionGroup *lockdown_save_to_disk; guint custom_rule_merge_id; guint gal_view_merge_id; diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 53074d2352..3272b524e7 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -754,6 +754,35 @@ e_shell_window_set_safe_mode (EShellWindow *shell_window, } /** + * e_shell_window_add_action_group: + * @shell_window: an #EShellWindow + * @group_name: the name of the new action group + * + * Creates a new #GtkActionGroup and adds it to @shell_window<!-- -->'s + * user interface manager. This also takes care of details like setting + * the translation domain. + **/ +void +e_shell_window_add_action_group (EShellWindow *shell_window, + const gchar *group_name) +{ + GtkActionGroup *action_group; + GtkUIManager *ui_manager; + const gchar *domain; + + g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); + g_return_if_fail (group_name != NULL); + + ui_manager = e_shell_window_get_ui_manager (shell_window); + domain = GETTEXT_PACKAGE; + + action_group = gtk_action_group_new (group_name); + gtk_action_group_set_translation_domain (action_group, domain); + gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + g_object_unref (action_group); +} + +/** * e_shell_window_register_new_item_actions: * @shell_window: an #EShellWindow * @module_name: name of an #EShellModule @@ -788,7 +817,7 @@ e_shell_window_register_new_item_actions (EShellWindow *shell_window, g_return_if_fail (module_name != NULL); g_return_if_fail (entries != NULL); - action_group = shell_window->priv->new_item_actions; + action_group = ACTION_GROUP (NEW_ITEM); ui_manager = e_shell_window_get_ui_manager (shell_window); accel_group = gtk_ui_manager_get_accel_group (ui_manager); module_name = g_intern_string (module_name); @@ -877,7 +906,7 @@ e_shell_window_register_new_source_actions (EShellWindow *shell_window, g_return_if_fail (module_name != NULL); g_return_if_fail (entries != NULL); - action_group = shell_window->priv->new_source_actions; + action_group = ACTION_GROUP (NEW_SOURCE); ui_manager = e_shell_window_get_ui_manager (shell_window); accel_group = gtk_ui_manager_get_accel_group (ui_manager); module_name = g_intern_string (module_name); diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h index 7543413a5c..f9cdb60cf4 100644 --- a/shell/e-shell-window.h +++ b/shell/e-shell-window.h @@ -97,6 +97,8 @@ void e_shell_window_set_active_view (EShellWindow *shell_window, gboolean e_shell_window_get_safe_mode (EShellWindow *shell_window); void e_shell_window_set_safe_mode (EShellWindow *shell_window, gboolean safe_mode); +void e_shell_window_add_action_group (EShellWindow *shell_window, + const gchar *group_name); /* These should be called from the shell module's window_created() handler. */ diff --git a/shell/e-shell.c b/shell/e-shell.c index a2ac783cb8..02c9627448 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -689,6 +689,14 @@ shell_class_init (EShellClass *class) e_shell_settings_install_property ( g_param_spec_boolean ( + "disable-application-handlers", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_install_property ( + g_param_spec_boolean ( "disable-command-line", NULL, NULL, @@ -749,6 +757,10 @@ shell_init (EShell *shell) G_CALLBACK (shell_notify_online_mode_cb), NULL); e_shell_settings_bind_to_gconf ( + shell->priv->settings, "disable-application-handlers", + "/desktop/gnome/lockdown/disable_application_handlers"); + + e_shell_settings_bind_to_gconf ( shell->priv->settings, "disable-command-line", "/desktop/gnome/lockdown/disable_command_line"); |