aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/dialogs/comp-editor.c41
2 files changed, 35 insertions, 16 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 5b4947683d..b1843f6cfc 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,13 @@
+2005-08-11 Carsten Guenther <carsten.guenther@scalix.com>
+
+ * gui/dialogs/comp-editor.c: (get_attachment_list),
+ (attachment_bar_icon_clicked_cb): Use g_build_path
+ instead of g_strconcat to build the pathname to the
+ attachment file.
+ (set_attachment_list): Fixed how mime filename gets
+ extracted from attachments pathname.
+
+
2005-08-10 Tor Lillqvist <tml@novell.com>
* importers/Makefile.am: Use privsolib instead of privlib (they
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 304c0d13d5..6bb39cdb81 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -614,6 +614,7 @@ get_attachment_list (CompEditor *editor)
CamelStream *stream;
char *attach_file_url;
char *safe_fname;
+ char *filename;
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (p->data));
@@ -621,10 +622,12 @@ get_attachment_list (CompEditor *editor)
* as a mime part file into the directory denoting the
* calendar source */
safe_fname = camel_file_util_safe_filename(camel_mime_part_get_filename ((CamelMimePart *)p->data));
- attach_file_url = g_strconcat (local_store,
- comp_uid, "-",
- safe_fname,
- NULL);
+
+ filename = g_strdup_printf ("%s-%s", comp_uid, safe_fname);
+
+ attach_file_url = g_build_path (G_DIR_SEPARATOR_S, local_store, filename, NULL);
+
+ g_free (filename);
g_free (safe_fname);
stream = camel_stream_fs_new_with_name((const char *) attach_file_url+7, O_RDWR|O_CREAT|O_TRUNC, 0600);
@@ -1000,7 +1003,8 @@ attachment_bar_icon_clicked_cb (EAttachmentBar *bar, GdkEvent *event, CompEditor
if (p) {
EAttachment *attachment;
GSList *list;
- const char *comp_uid= NULL;
+ const char *comp_uid = NULL;
+ char *filename = NULL;
const char *local_store = e_cal_get_local_attachment_store (editor->priv->client);
e_cal_component_get_uid (editor->priv->comp, &comp_uid);
@@ -1008,19 +1012,21 @@ attachment_bar_icon_clicked_cb (EAttachmentBar *bar, GdkEvent *event, CompEditor
list = e_attachment_bar_get_attachment (bar, num);
attachment = list->data;
g_slist_free (list);
+
+ filename = g_strdup_printf ("%s-%s",
+ comp_uid,
+ camel_mime_part_get_filename(attachment->body));
+
+ attach_file_url = g_build_path (G_DIR_SEPARATOR_S, local_store, filename, NULL);
- attach_file_url = g_strconcat (local_store,
- comp_uid,
- "-",
- camel_mime_part_get_filename(attachment->body),
- NULL);
-
/* launch the url now */
/* TODO should send GError and handle error conditions
* here */
gnome_url_show (attach_file_url, &error);
if (error)
- g_message ("DEBUG: Launch failed :(\n");
+ g_message ("DEBUG: gnome_url_show(%s) failed\n", attach_file_url);
+
+ g_free (filename);
g_free (attach_file_url); }
return TRUE;
} else
@@ -1153,7 +1159,6 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
EAttachmentBar *bar = (EAttachmentBar *)widget;
GnomeIconList *icon_list = GNOME_ICON_LIST(widget);
int icon_number;
- printf("dd\n");
if (event->button != 3)
return FALSE;
@@ -2083,9 +2088,13 @@ set_attachment_list (CompEditor *editor, GSList *attach_list)
camel_mime_part_set_disposition (part, "attachment");
- camel_mime_part_set_filename (part,
- attach_filename + strlen (local_store)+
- strlen (comp_uid) + 1);
+ char *ptr = strstr (attach_filename, comp_uid);
+ if (ptr) {
+ ptr += strlen(comp_uid);
+ if (*ptr++ == '-')
+ camel_mime_part_set_filename (part, ptr);
+ }
+
e_attachment_bar_attach_mime_part ((EAttachmentBar *) editor->priv->attachment_bar, part);
camel_object_unref (part);