From 4b140a897f1b45515ac9987e0b2d343c12f02f1c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 27 Jan 2009 05:22:57 +0000 Subject: Make action group management in shell windows more elegant. svn path=/branches/kill-bonobo/; revision=37137 --- calendar/modules/e-cal-shell-view-actions.c | 20 ++++++++------------ calendar/modules/e-cal-shell-view-actions.h | 6 ++++-- calendar/modules/e-cal-shell-view-memopad.c | 4 +--- calendar/modules/e-cal-shell-view-private.c | 10 +++++----- calendar/modules/e-cal-shell-view-private.h | 5 ----- calendar/modules/e-cal-shell-view-taskpad.c | 4 +--- calendar/modules/e-memo-shell-view-actions.c | 12 ++++-------- calendar/modules/e-memo-shell-view-actions.h | 2 ++ calendar/modules/e-memo-shell-view-private.c | 10 +++++----- calendar/modules/e-memo-shell-view-private.h | 5 ----- calendar/modules/e-task-shell-view-actions.c | 12 ++++-------- calendar/modules/e-task-shell-view-actions.h | 2 ++ calendar/modules/e-task-shell-view-private.c | 10 +++++----- calendar/modules/e-task-shell-view-private.h | 5 ----- 14 files changed, 41 insertions(+), 66 deletions(-) (limited to 'calendar/modules') 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. */ -- cgit v1.2.3