[evolution-kolab] EPlugin: pass on name of selected source to subdialogs



commit 784e952aa02d9653332e4c3105cfcca19aaf7c97
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Wed Jun 6 16:52:44 2012 +0200

    EPlugin: pass on name of selected source to subdialogs
    
    * alongside the name of the selected folder,
      pass on also the name of the selected source,
      if in PIM context, and display it
    * if in email context, only the folder name
      is displayed (no change there)

 src/eplugin/e-kolab-folder-metadata.c    |    2 ++
 src/eplugin/e-kolab-folder-metadata.h    |    1 +
 src/eplugin/e-kolab-folder-permissions.c |    5 ++++-
 src/eplugin/e-kolab-folder-permissions.h |    1 +
 src/eplugin/e-kolab-plugin-ui.c          |   27 ++++++++++++++++++++++++++-
 5 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-metadata.c b/src/eplugin/e-kolab-folder-metadata.c
index 218c35f..f9a95c5 100644
--- a/src/eplugin/e-kolab-folder-metadata.c
+++ b/src/eplugin/e-kolab-folder-metadata.c
@@ -115,6 +115,8 @@ e_kolab_folder_metadata_ui_free (KolabFolderMetaUIData *uidata)
 	kolab_data_folder_metadata_free (uidata->metadata);
 	if (uidata->selected_folder != NULL)
 		g_free (uidata->selected_folder);
+	if (uidata->selected_source != NULL)
+		g_free (uidata->selected_source);
 
 	g_free (uidata);
 }
diff --git a/src/eplugin/e-kolab-folder-metadata.h b/src/eplugin/e-kolab-folder-metadata.h
index 3151936..f94840a 100644
--- a/src/eplugin/e-kolab-folder-metadata.h
+++ b/src/eplugin/e-kolab-folder-metadata.h
@@ -55,6 +55,7 @@ struct _KolabFolderMetaUIData {
 	KolabFolderMetaUIWidgets *widgets;
 	KolabDataFolderMetadata *metadata;
 	gchar *selected_folder;
+	gchar *selected_source;
 };
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index e222902..4e461d6 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -93,7 +93,8 @@ kolab_folder_permissions_ui_edit_dialog_cb (KolabFolderPermUIData *uidata)
 	content = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 	gtk_container_set_border_width (GTK_CONTAINER (content), 6);
 
-	widget = e_kolab_plugin_util_ui_selected_folder_widget (uidata->selected_folder);
+	widget = e_kolab_plugin_util_ui_selected_folder_widget (uidata->selected_folder,
+	                                                        uidata->selected_source);
 	gtk_container_add (GTK_CONTAINER (content), widget);
 
 	widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
@@ -390,6 +391,8 @@ e_kolab_folder_permissions_ui_free (KolabFolderPermUIData *uidata)
 	kolab_data_folder_permissions_free (uidata->permissions);
 	if (uidata->selected_folder != NULL)
 		g_free (uidata->selected_folder);
+	if (uidata->selected_source != NULL)
+		g_free (uidata->selected_source);
 
 	g_free (uidata);
 }
diff --git a/src/eplugin/e-kolab-folder-permissions.h b/src/eplugin/e-kolab-folder-permissions.h
index aa26b17..7160c91 100644
--- a/src/eplugin/e-kolab-folder-permissions.h
+++ b/src/eplugin/e-kolab-folder-permissions.h
@@ -66,6 +66,7 @@ struct _KolabFolderPermUIData {
 	KolabFolderPermUIWidgets *widgets;
 	KolabDataFolderPermissions *permissions;
 	gchar *selected_folder;
+	gchar *selected_source;
 };
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index 7319388..6c8ab77 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -125,6 +125,7 @@ struct _KolabFolderPropUIData {
 	KolabFolderPermUIData *perm_ui_data;
 	KolabDataImapAccount *account;
 	gchar *selected_folder;
+	gchar *selected_source;
 };
 
 static void
@@ -149,6 +150,7 @@ kolab_folder_prop_ui_data_new ()
 	uidata->perm_ui_data = NULL;
 	uidata->account = NULL;
 	uidata->selected_folder = NULL;
+	uidata->selected_source = NULL;
 
 	return uidata;
 }
@@ -170,6 +172,8 @@ kolab_folder_prop_ui_data_free (KolabFolderPropUIData *uidata)
 	kolab_data_imap_account_free (uidata->account);
 	if (uidata->selected_folder != NULL)
 		g_free (uidata->selected_folder);
+	if (uidata->selected_source != NULL)
+		g_free (uidata->selected_source);
 
 	g_free (uidata);
 }
@@ -393,7 +397,9 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
 	GObject *dialog = NULL;
 	GtkWidget *content = NULL;
 	GtkNotebook *notebook = NULL;
+	const gchar *view_name = NULL;
 	gchar *foldername = NULL;
+	gchar *sourcename = NULL;
 
 	foldername = kolab_plugin_ui_selected_folder_name (action,
 	                                                   shell_view);
@@ -410,11 +416,28 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
 		return;
 	}
 
+	view_name = e_shell_view_get_name (shell_view);
+
+	if (g_strcmp0 (view_name, "mail") != 0) {
+		/* get the sourcename for display in dialogs
+		 * if we're in a PIM shell_view
+		 */
+		ESource *source = NULL;
+		gboolean is_source = FALSE;
+
+		is_source = kolab_plugin_ui_get_selected_source (shell_view,
+		                                                 &source);
+		if (is_source)
+			sourcename = g_strdup (e_source_peek_name (source));
+	}
+
 	uidata = kolab_folder_prop_ui_data_new ();
 
 	uidata->widgets->selected_folder =
-		e_kolab_plugin_util_ui_selected_folder_widget (foldername);
+		e_kolab_plugin_util_ui_selected_folder_widget (foldername,
+		                                               sourcename);
 	uidata->selected_folder = foldername;
+	uidata->selected_source = sourcename;
 
 	uidata->widgets->dialog =
 		gtk_dialog_new_with_buttons (_("Edit Kolab Folder Properties..."),
@@ -427,9 +450,11 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
 
 	uidata->meta_ui_data = e_kolab_folder_metadata_ui_new ();
 	uidata->meta_ui_data->selected_folder = g_strdup (foldername);
+	uidata->meta_ui_data->selected_source = g_strdup (sourcename);
 
 	uidata->perm_ui_data = e_kolab_folder_permissions_ui_new ();
 	uidata->perm_ui_data->selected_folder = g_strdup (foldername);
+	uidata->perm_ui_data->selected_source = g_strdup (sourcename);
 
 	/* FIXME get account data here */
 	uidata->account = kolab_data_imap_account_new ();



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