From 31b5261fdbe2c98e7f4f71e908e5d9b58609de94 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 4 Jul 2013 11:04:51 -0400 Subject: EShellView: Add a "view-instance" property. EShellView now holds a reference to the active GalViewInstance. Where applicable, the EShellView subclass is responsible for keeping this up to date when the sidebar selection changes. Holding a reference allows EShellView to implement common actions like "Save Current View" directly instead pushing it on to subclasses. New functions: e_shell_view_get_view_instance e_shell_view_set_view_instance --- shell/e-shell-window-actions.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'shell/e-shell-window-actions.c') diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 3dcaa73585..8dffb10399 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -231,6 +231,20 @@ action_gal_view_cb (GtkRadioAction *action, * * Main menu item: View -> Current View -> Save Custom View... **/ +static void +action_gal_save_custom_view_cb (GtkAction *action, + EShellWindow *shell_window) +{ + EShellView *shell_view; + GalViewInstance *view_instance; + const gchar *view_name; + + view_name = e_shell_window_get_active_view (shell_window); + shell_view = e_shell_window_get_shell_view (shell_window, view_name); + view_instance = e_shell_view_get_view_instance (shell_view); + + gal_view_instance_save_as (view_instance); +} /** * E_SHELL_WINDOW_ACTION_IMPORT: @@ -1181,7 +1195,7 @@ static GtkActionEntry shell_gal_view_entries[] = { N_("Save Custom View..."), NULL, N_("Save current custom view"), - NULL }, /* Handled by subclasses. */ + G_CALLBACK (action_gal_save_custom_view_cb) }, /*** Menus ***/ -- cgit v1.2.3