Modified cal-attachment-bar to allow the path to the local attachment
* gui/dialogs/cal-attachment-bar.[ch]: (destroy), (init), (cal_attachment_bar_set_local_attachment_store), (cal_attachment_bar_get_attachment_list), (cal_attachment_bar_get_nth_attachment_filename), (cal_attachment_bar_set_attachment_list): Modified cal-attachment-bar to allow the path to the local attachment store be set externally, thereby hiding the storage policy of different backends from it. * gui/dialogs/comp-editor.c: * (real_edit_comp): set the local attachment store after obtaining it from the calendar. svn path=/trunk/; revision=28311
This commit is contained in:
@ -1,3 +1,17 @@
|
||||
2005-01-10 Harish Krishnaswamy <kharish@novell.com>
|
||||
|
||||
* gui/dialogs/cal-attachment-bar.[ch]: (destroy), (init),
|
||||
(cal_attachment_bar_set_local_attachment_store),
|
||||
(cal_attachment_bar_get_attachment_list),
|
||||
(cal_attachment_bar_get_nth_attachment_filename),
|
||||
(cal_attachment_bar_set_attachment_list):
|
||||
Modified cal-attachment-bar to allow the path to
|
||||
the local attachment store be set externally, thereby
|
||||
hiding the storage policy of different backends from it.
|
||||
* gui/dialogs/comp-editor.c: (real_edit_comp):
|
||||
set the local attachment store after obtaining it from
|
||||
the calendar.
|
||||
|
||||
2005-01-09 JP Rosevear <jpr@novell.com>
|
||||
|
||||
* gui/calendar-component.c (impl_handleURI): handle calendar://
|
||||
|
||||
@ -74,9 +74,9 @@ struct _CalAttachmentBarPrivate {
|
||||
guint num_attachments;
|
||||
/* The persistent copies of the attachments
|
||||
* derive their location and name from the
|
||||
* source_url and the comp_uid.
|
||||
* local_attachment_store and the comp_uid.
|
||||
*/
|
||||
char *source_url;
|
||||
char *local_attachment_store;
|
||||
char *comp_uid;
|
||||
};
|
||||
|
||||
@ -540,8 +540,8 @@ destroy (GtkObject *object)
|
||||
|
||||
/* TODO leaking this here to prevent a crash */
|
||||
/*
|
||||
if (bar->priv->source_url)
|
||||
g_free (bar->priv->source_url);
|
||||
if (bar->priv->local_attachment_store)
|
||||
g_free (bar->priv->local_attachment_store);
|
||||
if (bar->priv->comp_uid)
|
||||
g_free (bar->priv->comp_uid);
|
||||
*/
|
||||
@ -635,7 +635,7 @@ init (CalAttachmentBar *bar)
|
||||
|
||||
priv->attachments = NULL;
|
||||
priv->num_attachments = 0;
|
||||
priv->source_url = NULL;
|
||||
priv->local_attachment_store = NULL;
|
||||
priv->comp_uid = NULL;
|
||||
|
||||
bar->priv = priv;
|
||||
@ -729,11 +729,13 @@ get_default_charset (void)
|
||||
}
|
||||
|
||||
void
|
||||
cal_attachment_bar_set_source_url (CalAttachmentBar *bar, char *source_url)
|
||||
cal_attachment_bar_set_local_attachment_store (CalAttachmentBar *bar,
|
||||
const char *attachment_store)
|
||||
{
|
||||
if (bar->priv->source_url)
|
||||
g_free (bar->priv->source_url);
|
||||
bar->priv->source_url = source_url;
|
||||
if (bar->priv->local_attachment_store)
|
||||
g_free (bar->priv->local_attachment_store);
|
||||
bar->priv->local_attachment_store =
|
||||
g_strconcat (attachment_store, "/", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -796,9 +798,7 @@ cal_attachment_bar_get_attachment_list (CalAttachmentBar *bar)
|
||||
/* Extract the content from the stream and write it down
|
||||
* as a mime part file into the directory denoting the
|
||||
* calendar source */
|
||||
/* TODO convert it into a generic path using the source
|
||||
* uri and use content-id to generate filename */
|
||||
attach_file_url = g_strconcat (priv->source_url,
|
||||
attach_file_url = g_strconcat (priv->local_attachment_store,
|
||||
priv->comp_uid, "-",
|
||||
camel_file_util_safe_filename
|
||||
(camel_mime_part_get_filename (attachment->body)), NULL);
|
||||
@ -831,7 +831,7 @@ cal_attachment_bar_get_nth_attachment_filename (CalAttachmentBar *bar, int n)
|
||||
g_return_val_if_fail (E_IS_CAL_ATTACHMENT_BAR (bar), 0);
|
||||
|
||||
attach = g_slist_nth_data (bar->priv->attachments, n);
|
||||
return g_strconcat (bar->priv->source_url, bar->priv->comp_uid, "-", camel_mime_part_get_filename
|
||||
return g_strconcat (bar->priv->local_attachment_store, bar->priv->comp_uid, "-", camel_mime_part_get_filename
|
||||
(attach->body), NULL);
|
||||
}
|
||||
|
||||
@ -870,7 +870,7 @@ cal_attachment_bar_set_attachment_list (CalAttachmentBar *bar, GSList *attach_li
|
||||
attach = g_slist_nth_data (priv->attachments,
|
||||
priv->num_attachments-1);
|
||||
camel_mime_part_set_filename (attach->body,
|
||||
attach_filename + strlen (priv->source_url)+
|
||||
attach_filename + strlen (priv->local_attachment_store)+
|
||||
strlen (priv->comp_uid) + 1);
|
||||
update (bar);
|
||||
}
|
||||
|
||||
@ -73,7 +73,8 @@ GSList *cal_attachment_bar_get_attachment_list (CalAttachmentBar *bar);
|
||||
char * cal_attachment_bar_get_nth_attachment_filename (CalAttachmentBar *bar, int n);
|
||||
GSList *cal_attachment_bar_get_mime_attach_list (CalAttachmentBar *bar);
|
||||
void cal_attachment_bar_set_attachment_list (CalAttachmentBar *bar, GSList *attach_list);
|
||||
void cal_attachment_bar_set_source_url (CalAttachmentBar *bar, char *source_url);
|
||||
void cal_attachment_bar_set_local_attachment_store (CalAttachmentBar *bar,
|
||||
const char *attachment_store);
|
||||
void cal_attachment_bar_set_comp_uid (CalAttachmentBar *bar, char *comp_uid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -1241,7 +1241,6 @@ static void
|
||||
real_edit_comp (CompEditor *editor, ECalComponent *comp)
|
||||
{
|
||||
CompEditorPrivate *priv;
|
||||
char *source_url;
|
||||
const char *uid;
|
||||
|
||||
g_return_if_fail (editor != NULL);
|
||||
@ -1264,10 +1263,8 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp)
|
||||
set_title_from_comp (editor);
|
||||
set_icon_from_comp (editor);
|
||||
e_cal_component_get_uid (comp, &uid);
|
||||
source_url = g_strconcat (e_cal_get_uri (priv->client), "/", NULL);
|
||||
/* The source_url and uid will be preserved by the callee and freed when
|
||||
* the latter gets destroyed */
|
||||
cal_attachment_bar_set_source_url (priv->attachment_bar, source_url);
|
||||
cal_attachment_bar_set_local_attachment_store (priv->attachment_bar,
|
||||
e_cal_get_local_attachment_store (priv->client));
|
||||
cal_attachment_bar_set_comp_uid (priv->attachment_bar, g_strdup (uid));
|
||||
|
||||
fill_widgets (editor);
|
||||
|
||||
Reference in New Issue
Block a user