[evolution-kolab/ek-wip-gui: 8/16] EPlugin: plugin UI code minor cleanup



commit 27dcd7ee10dcc4df44ddd4ea493f455a4b2d0c62
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Feb 14 11:49:45 2012 +0100

    EPlugin: plugin UI code minor cleanup
    
    * since we're having the same number of context menu
      entries for mail as well as for all PIM types,
      we can use a common #define for that

 src/eplugin/e-kolab-plugin-ui.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index 43e93a2..4156235 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -52,7 +52,7 @@
 
 /* how many menu entries are defined; all calendar/tasks/memos/contacts
    actions should have same count */
-#define KOLAB_ESOURCE_NUM_ENTRIES 2
+#define KOLAB_CONTEXT_NUM_ENTRIES 2
 
 static void kolab_plugin_ui_action_folder_permissions_cb (GtkAction *action, EShellView *shell_view);
 static void kolab_plugin_ui_action_folder_metadata_cb (GtkAction *action, EShellView *shell_view);
@@ -249,7 +249,7 @@ kolab_plugin_ui_update_mail_entries_cb (EShellView *shell_view,
 
 	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);
 	if (em_folder_tree_get_selected (folder_tree, &selected_store, &selected_path) ||
@@ -288,7 +288,7 @@ kolab_plugin_ui_update_mail_entries_cb (EShellView *shell_view,
 
 	kolab_plugin_ui_enable_actions (action_group,
 	                                mail_folder_context_entries,
-	                                G_N_ELEMENTS (mail_folder_context_entries),
+	                                KOLAB_CONTEXT_NUM_ENTRIES,
 	                                is_kolab_folder_node,
 	                                is_online);
 }
@@ -330,7 +330,7 @@ kolab_plugin_ui_update_source_entries_cb (EShellView *shell_view,
 
 	kolab_plugin_ui_enable_actions (action_group,
 	                                entries,
-	                                KOLAB_ESOURCE_NUM_ENTRIES,
+	                                KOLAB_CONTEXT_NUM_ENTRIES,
 	                                is_kolab_source,
 	                                is_online);
 
@@ -344,6 +344,7 @@ kolab_plugin_ui_setup_mail_actions (EShellView *shell_view)
 	GtkActionGroup *action_group;
 
 	g_assert (E_IS_SHELL_VIEW (shell_view));
+	g_return_if_fail (G_N_ELEMENTS (mail_folder_context_entries) == KOLAB_CONTEXT_NUM_ENTRIES);
 
 	shell_window = e_shell_view_get_shell_window (shell_view);
 	action_group = e_shell_window_get_action_group (shell_window, "mail");
@@ -352,7 +353,7 @@ kolab_plugin_ui_setup_mail_actions (EShellView *shell_view)
 	e_action_group_add_actions_localized (action_group,
 	                                      GETTEXT_PACKAGE,
 	                                      mail_folder_context_entries,
-	                                      G_N_ELEMENTS (mail_folder_context_entries),
+	                                      KOLAB_CONTEXT_NUM_ENTRIES,
 	                                      shell_view);
 
 	/* Decide whether we want this option to be visible or not */
@@ -375,7 +376,7 @@ kolab_plugin_ui_setup_source_actions (EShellView *shell_view,
 	g_assert (E_IS_SHELL_VIEW (shell_view));
 	g_return_if_fail (entries != NULL);
 	g_return_if_fail (n_entries > 0);
-	g_return_if_fail (n_entries == KOLAB_ESOURCE_NUM_ENTRIES);
+	g_return_if_fail (n_entries == KOLAB_CONTEXT_NUM_ENTRIES);
 
 	if (strstr (entries->name, "calendar"))
 		group = "calendar";
@@ -393,7 +394,7 @@ kolab_plugin_ui_setup_source_actions (EShellView *shell_view,
 	e_action_group_add_actions_localized (e_shell_window_get_action_group (shell_window, group),
 	                                      GETTEXT_PACKAGE,
 	                                      entries,
-	                                      KOLAB_ESOURCE_NUM_ENTRIES,
+	                                      KOLAB_CONTEXT_NUM_ENTRIES,
 	                                      shell_view);
 
 	g_signal_connect (shell_view,



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