[evolution/wip/gsettings] Bug 633471 - EAttachmentStore store folder name where uri is expected



commit c1d818a53f552468e704cd51a066e8df12fd4ff1
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Oct 29 16:41:06 2010 -0400

    Bug 633471 - EAttachmentStore store folder name where uri is expected

 doc/reference/shell/tmpl/e-attachment-store.sgml |   18 -------
 doc/reference/shell/tmpl/eshell-unused.sgml      |   16 ++++++
 widgets/misc/e-attachment-store.c                |   59 ++++++++++++----------
 widgets/misc/e-attachment-store.h                |    4 +-
 4 files changed, 50 insertions(+), 47 deletions(-)
---
diff --git a/doc/reference/shell/tmpl/e-attachment-store.sgml b/doc/reference/shell/tmpl/e-attachment-store.sgml
index 09e877c..5c8ffe9 100644
--- a/doc/reference/shell/tmpl/e-attachment-store.sgml
+++ b/doc/reference/shell/tmpl/e-attachment-store.sgml
@@ -75,24 +75,6 @@ e-attachment-store
 @Returns: 
 
 
-<!-- ##### FUNCTION e_attachment_store_get_current_folder ##### -->
-<para>
-
-</para>
-
- store: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_attachment_store_set_current_folder ##### -->
-<para>
-
-</para>
-
- store: 
- current_folder: 
-
-
 <!-- ##### FUNCTION e_attachment_store_get_num_attachments ##### -->
 <para>
 
diff --git a/doc/reference/shell/tmpl/eshell-unused.sgml b/doc/reference/shell/tmpl/eshell-unused.sgml
index 4c9b60d..2b172b2 100644
--- a/doc/reference/shell/tmpl/eshell-unused.sgml
+++ b/doc/reference/shell/tmpl/eshell-unused.sgml
@@ -347,6 +347,22 @@ e-shell-window.sgml
 @dialog: 
 @Returns: 
 
+<!-- ##### FUNCTION e_attachment_store_get_current_folder ##### -->
+<para>
+
+</para>
+
+ store: 
+ Returns: 
+
+<!-- ##### FUNCTION e_attachment_store_set_current_folder ##### -->
+<para>
+
+</para>
+
+ store: 
+ current_folder: 
+
 <!-- ##### FUNCTION e_binding_new ##### -->
 <para>
 
diff --git a/widgets/misc/e-attachment-store.c b/widgets/misc/e-attachment-store.c
index 0090490..8e2ad2e 100644
--- a/widgets/misc/e-attachment-store.c
+++ b/widgets/misc/e-attachment-store.c
@@ -35,14 +35,14 @@
 
 struct _EAttachmentStorePrivate {
 	GHashTable *attachment_index;
-	gchar *current_folder;
+	gchar *current_folder_uri;
 
 	guint ignore_row_changed : 1;
 };
 
 enum {
 	PROP_0,
-	PROP_CURRENT_FOLDER,
+	PROP_CURRENT_FOLDER_URI,
 	PROP_NUM_ATTACHMENTS,
 	PROP_NUM_LOADING,
 	PROP_TOTAL_SIZE
@@ -60,8 +60,8 @@ attachment_store_set_property (GObject *object,
                                GParamSpec *pspec)
 {
 	switch (property_id) {
-		case PROP_CURRENT_FOLDER:
-			e_attachment_store_set_current_folder (
+		case PROP_CURRENT_FOLDER_URI:
+			e_attachment_store_set_current_folder_uri (
 				E_ATTACHMENT_STORE (object),
 				g_value_get_string (value));
 			return;
@@ -77,10 +77,10 @@ attachment_store_get_property (GObject *object,
                                GParamSpec *pspec)
 {
 	switch (property_id) {
-		case PROP_CURRENT_FOLDER:
+		case PROP_CURRENT_FOLDER_URI:
 			g_value_set_string (
 				value,
-				e_attachment_store_get_current_folder (
+				e_attachment_store_get_current_folder_uri (
 				E_ATTACHMENT_STORE (object)));
 			return;
 
@@ -131,7 +131,7 @@ attachment_store_finalize (GObject *object)
 
 	g_hash_table_destroy (priv->attachment_index);
 
-	g_free (priv->current_folder);
+	g_free (priv->current_folder_uri);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_attachment_store_parent_class)->finalize (object);
@@ -146,7 +146,7 @@ attachment_store_constructed (GObject *object)
 	bridge = gconf_bridge_get ();
 
 	key = "/apps/evolution/shell/file_chooser_folder";
-	gconf_bridge_bind_property (bridge, key, object, "current-folder");
+	gconf_bridge_bind_property (bridge, key, object, "current-folder-uri");
 }
 
 static void
@@ -165,10 +165,10 @@ e_attachment_store_class_init (EAttachmentStoreClass *class)
 
 	g_object_class_install_property (
 		object_class,
-		PROP_CURRENT_FOLDER,
+		PROP_CURRENT_FOLDER_URI,
 		g_param_spec_string (
-			"current-folder",
-			"Current Folder",
+			"current-folder-uri",
+			"Current Folder URI",
 			NULL,
 			NULL,
 			G_PARAM_READWRITE |
@@ -381,26 +381,31 @@ e_attachment_store_get_attachments (EAttachmentStore *store)
 }
 
 const gchar *
-e_attachment_store_get_current_folder (EAttachmentStore *store)
+e_attachment_store_get_current_folder_uri (EAttachmentStore *store)
 {
 	g_return_val_if_fail (E_IS_ATTACHMENT_STORE (store), NULL);
 
-	return store->priv->current_folder;
+	return store->priv->current_folder_uri;
 }
 
 void
-e_attachment_store_set_current_folder (EAttachmentStore *store,
-                                       const gchar *current_folder)
+e_attachment_store_set_current_folder_uri (EAttachmentStore *store,
+                                           const gchar *current_folder_uri)
 {
+	gchar *allocated;
+
 	g_return_if_fail (E_IS_ATTACHMENT_STORE (store));
 
-	if (current_folder == NULL)
-		current_folder = g_get_home_dir ();
+	if (current_folder_uri == NULL) {
+		const gchar *home_dir = g_get_home_dir ();
+		allocated = g_filename_to_uri (home_dir, NULL, NULL);
+	} else
+		allocated = g_strdup (current_folder_uri);
 
-	g_free (store->priv->current_folder);
-	store->priv->current_folder = g_strdup (current_folder);
+	g_free (store->priv->current_folder_uri);
+	store->priv->current_folder_uri = allocated;
 
-	g_object_notify (G_OBJECT (store), "current-folder");
+	g_object_notify (G_OBJECT (store), "current-folder-uri");
 }
 
 guint
@@ -465,15 +470,15 @@ e_attachment_store_run_file_chooser_dialog (EAttachmentStore *store,
 {
 	GtkFileChooser *file_chooser;
 	gint response = GTK_RESPONSE_NONE;
-	const gchar *current_folder;
+	const gchar *current_uri;
 	gboolean update_folder;
 
 	g_return_val_if_fail (E_IS_ATTACHMENT_STORE (store), response);
 	g_return_val_if_fail (GTK_IS_FILE_CHOOSER_DIALOG (dialog), response);
 
 	file_chooser = GTK_FILE_CHOOSER (dialog);
-	current_folder = e_attachment_store_get_current_folder (store);
-	gtk_file_chooser_set_current_folder (file_chooser, current_folder);
+	current_uri = e_attachment_store_get_current_folder_uri (store);
+	gtk_file_chooser_set_current_folder_uri (file_chooser, current_uri);
 
 	response = gtk_dialog_run (GTK_DIALOG (dialog));
 
@@ -484,11 +489,11 @@ e_attachment_store_run_file_chooser_dialog (EAttachmentStore *store,
 		(response == GTK_RESPONSE_APPLY);
 
 	if (update_folder) {
-		gchar *folder;
+		gchar *uri;
 
-		folder = gtk_file_chooser_get_current_folder (file_chooser);
-		e_attachment_store_set_current_folder (store, folder);
-		g_free (folder);
+		uri = gtk_file_chooser_get_current_folder_uri (file_chooser);
+		e_attachment_store_set_current_folder_uri (store, uri);
+		g_free (uri);
 	}
 
 	return response;
diff --git a/widgets/misc/e-attachment-store.h b/widgets/misc/e-attachment-store.h
index 07175f1..49980ea 100644
--- a/widgets/misc/e-attachment-store.h
+++ b/widgets/misc/e-attachment-store.h
@@ -86,9 +86,9 @@ void		e_attachment_store_add_to_multipart
 						 const gchar *default_charset);
 GList *		e_attachment_store_get_attachments
 						(EAttachmentStore *store);
-const gchar *	e_attachment_store_get_current_folder
+const gchar *	e_attachment_store_get_current_folder_uri
 						(EAttachmentStore *store);
-void		e_attachment_store_set_current_folder
+void		e_attachment_store_set_current_folder_uri
 						(EAttachmentStore *store,
 						 const gchar *current_folder);
 guint		e_attachment_store_get_num_attachments



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