aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-30 04:41:06 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 04:41:06 +0800
commit83627486d54d307e7bf80885757247880eab1d26 (patch)
tree9d66758d826aca6ecfb1c84a0c52ea3f28707197 /widgets/misc
parent52fbacb68d758a5ba054f88c4f64432ab713f71e (diff)
downloadgsoc2013-evolution-83627486d54d307e7bf80885757247880eab1d26.tar
gsoc2013-evolution-83627486d54d307e7bf80885757247880eab1d26.tar.gz
gsoc2013-evolution-83627486d54d307e7bf80885757247880eab1d26.tar.bz2
gsoc2013-evolution-83627486d54d307e7bf80885757247880eab1d26.tar.lz
gsoc2013-evolution-83627486d54d307e7bf80885757247880eab1d26.tar.xz
gsoc2013-evolution-83627486d54d307e7bf80885757247880eab1d26.tar.zst
gsoc2013-evolution-83627486d54d307e7bf80885757247880eab1d26.zip
Bug 633471 - EAttachmentStore store folder name where uri is expected
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-attachment-store.c59
-rw-r--r--widgets/misc/e-attachment-store.h4
2 files changed, 34 insertions, 29 deletions
diff --git a/widgets/misc/e-attachment-store.c b/widgets/misc/e-attachment-store.c
index 009049025e..8e2ad2ec23 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 07175f151c..49980ea3b1 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