[evolution-kolab/ek-wip-gui: 13/16] EPlugin: moved mail folder tree code portion into separate function



commit 34ab035f90f3782aad6ec102d5c06052b0da9d81
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Thu Feb 16 14:41:23 2012 +0100

    EPlugin: moved mail folder tree code portion into separate function
    
    * moved code for checking whether a selected
      mail view tree entry is a kolab account
      node or kolab folder into a separate function
      (we'll need this in other places as well)

 src/eplugin/e-kolab-plugin-ui.c |   39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index 54e0520..0a37865 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -232,23 +232,17 @@ kolab_plugin_ui_enable_actions (GtkActionGroup *action_group,
 	}
 }
 
-static void
-kolab_plugin_ui_update_mail_entries_cb (EShellView *shell_view,
-                                        GtkActionEntry *entries)
+static gchar*
+kolab_plugin_ui_get_selected_path (EShellView *shell_view,
+                                   gboolean *is_kolab_account_node,
+                                   gboolean *is_kolab_folder_node)
 {
-	EShellWindow *shell_window = NULL;
-	GtkActionGroup *action_group = NULL;
-	GtkUIManager *ui_manager = NULL;
 	EShellSidebar *shell_sidebar = NULL;
 	EMFolderTree *folder_tree = NULL;
 	CamelStore *selected_store = NULL;
 	gchar *selected_path = NULL;
-	gboolean is_kolab_account_node = FALSE;
-	gboolean is_kolab_folder_node = FALSE;
-	gboolean is_online = FALSE;
 
 	g_assert (E_IS_SHELL_VIEW (shell_view));
-	g_assert (entries != NULL);
 
 	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
 	g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
@@ -258,8 +252,8 @@ kolab_plugin_ui_update_mail_entries_cb (EShellView *shell_view,
 			CamelProvider *provider = camel_service_get_provider (CAMEL_SERVICE (selected_store));
 
 			if (provider && g_ascii_strcasecmp (provider->protocol, KOLAB_CAMEL_PROVIDER_PROTOCOL) == 0) {
-				is_kolab_account_node = !selected_path || !*selected_path;
-				is_kolab_folder_node = !is_kolab_account_node;
+				*is_kolab_account_node = !selected_path || !*selected_path;
+				*is_kolab_folder_node = !*is_kolab_account_node;
 			}
 
 			g_object_unref (selected_store);
@@ -267,6 +261,27 @@ kolab_plugin_ui_update_mail_entries_cb (EShellView *shell_view,
 	}
 	g_object_unref (folder_tree);
 
+	return selected_path;
+}
+
+static void
+kolab_plugin_ui_update_mail_entries_cb (EShellView *shell_view,
+                                        GtkActionEntry *entries)
+{
+	EShellWindow *shell_window = NULL;
+	GtkActionGroup *action_group = NULL;
+	GtkUIManager *ui_manager = NULL;
+	gchar *selected_path = NULL;
+	gboolean is_kolab_account_node = FALSE;
+	gboolean is_kolab_folder_node = FALSE;
+	gboolean is_online = FALSE;
+
+	g_assert (E_IS_SHELL_VIEW (shell_view));
+	g_assert (entries != NULL);
+
+	selected_path = kolab_plugin_ui_get_selected_path (shell_view,
+	                                                   &is_kolab_account_node,
+	                                                   &is_kolab_folder_node);
 	g_free (selected_path);
 
 	shell_window = e_shell_view_get_shell_window (shell_view);



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