From 24368cf92dd5eaae1b41b3f191a25e2cbc45e824 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Thu, 25 May 2006 06:04:48 +0000 Subject: Added code to save/attach files/mails/events to/from remote shares svn path=/trunk/; revision=32023 --- composer/ChangeLog | 8 ++++++++ composer/e-msg-composer-select-file.c | 16 ++++++++++------ composer/e-msg-composer.c | 15 +++++++++++++-- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 16c04468f2..a78ee2da77 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,11 @@ +2006-05-25 Srinivasa Ragavan + + Added support to attach from remote shares + + * e-msg-composer-select-file.c: (get_selector), + (select_attach_response): + * e-msg-composer.c: (add_to_bar), (drop_action): + 2006-03-09 Sam Yang ** Fixes #333971 diff --git a/composer/e-msg-composer-select-file.c b/composer/e-msg-composer-select-file.c index 97b686ef7e..430bcb003a 100644 --- a/composer/e-msg-composer-select-file.c +++ b/composer/e-msg-composer-select-file.c @@ -83,6 +83,7 @@ get_selector(struct _EMsgComposer *composer, const char *title, guint32 flags) NULL); gtk_dialog_set_default_response (GTK_DIALOG (selection), GTK_RESPONSE_OK); + gtk_file_chooser_set_local_only (selection, FALSE); if ((flags & SELECTOR_MODE_SAVE) == 0) gtk_file_chooser_set_select_multiple ((GtkFileChooser *) selection, (flags & SELECTOR_MODE_MULTI)); @@ -192,14 +193,16 @@ select_attach_response(GtkWidget *selector, guint response, struct _EMsgComposer GSList *names; EMsgComposerSelectAttachFunc func = g_object_get_data((GObject *)selector, "callback"); GtkToggleButton *showinline = g_object_get_data((GObject *)selector, "show-inline"); - char *path; + char *path = NULL; #ifdef USE_GTKFILECHOOSER - char *filename; - names = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (selector)); + char *filename = NULL; + names = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (selector)); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector)); - path = g_path_get_dirname (filename); - g_free (filename); + if (!filename) { + path = g_path_get_dirname (filename); + g_free (filename); + } #else char **files; int i; @@ -215,7 +218,8 @@ select_attach_response(GtkWidget *selector, guint response, struct _EMsgComposer path = g_path_get_dirname (gtk_file_selection_get_filename (GTK_FILE_SELECTION (selector))); #endif - g_object_set_data_full ((GObject *) composer, "attach_path", path, g_free); + if (path) + g_object_set_data_full ((GObject *) composer, "attach_path", path, g_free); func(composer, names, gtk_toggle_button_get_active(showinline)); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index e4bc7dbbde..fe66322c43 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1782,8 +1782,19 @@ add_to_bar (EMsgComposer *composer, GSList *names, int is_inline) EMsgComposerPrivate *p = composer->priv; while (names) { - e_attachment_bar_attach((EAttachmentBar *)p->attachment_bar, names->data, is_inline ? "inline" : "attachment"); + CamelURL *url; + + url = camel_url_new (names->data, NULL); + if (url == NULL) + continue; + + if (!g_ascii_strcasecmp (url->protocol, "file")) { + e_attachment_bar_attach((EAttachmentBar *)p->attachment_bar, url->path, is_inline ? "inline" : "attachment"); + } else { + e_attachment_bar_attach_remote_file ((EAttachmentBar *)p->attachment_bar, names->data, is_inline ? "inline" : "attachment"); + } names = g_slist_next(names); + camel_url_free (url); } } @@ -2969,7 +2980,7 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk } else { e_attachment_bar_attach_remote_file (E_ATTACHMENT_BAR (p->attachment_bar), - str); + str, "attachment"); } g_free (str); camel_url_free (url); -- cgit v1.2.3