aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@src.gnome.org>2008-04-12 02:52:39 +0800
committerSuman Manjunath <msuman@src.gnome.org>2008-04-12 02:52:39 +0800
commit8873c47ed16aa9babd88312672a72ea56dcca471 (patch)
treec5d5de26da2ada6c5bcb2633cc3b2ac9b563e7a4 /calendar
parentfe0495c2bdae62a38f23f7c3d86eb4db3c741157 (diff)
downloadgsoc2013-evolution-8873c47ed16aa9babd88312672a72ea56dcca471.tar
gsoc2013-evolution-8873c47ed16aa9babd88312672a72ea56dcca471.tar.gz
gsoc2013-evolution-8873c47ed16aa9babd88312672a72ea56dcca471.tar.bz2
gsoc2013-evolution-8873c47ed16aa9babd88312672a72ea56dcca471.tar.lz
gsoc2013-evolution-8873c47ed16aa9babd88312672a72ea56dcca471.tar.xz
gsoc2013-evolution-8873c47ed16aa9babd88312672a72ea56dcca471.tar.zst
gsoc2013-evolution-8873c47ed16aa9babd88312672a72ea56dcca471.zip
Fix for bug #517134 : Extend the 'Insert' menu (in editors) to show a "Recent Documents" submenu (to quickly add them as attachments).
M configure.in M ChangeLog M composer/evolution-composer.ui M composer/ChangeLog M composer/e-composer-actions.c M composer/e-composer-private.c M widgets/misc/ChangeLog M widgets/misc/e-attachment-bar.c M widgets/misc/e-attachment-bar.h M calendar/gui/dialogs/comp-editor.c M calendar/ChangeLog M ui/ChangeLog M ui/evolution-editor.xml svn path=/trunk/; revision=35354
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/dialogs/comp-editor.c70
2 files changed, 65 insertions, 15 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index fd7e79f3d7..cbd1b88f75 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,13 @@
+2008-04-11 Suman Manjunath <msuman@novell.com>
+
+ ** Fix for bug #517134
+
+ * gui/dialogs/comp-editor.c: (add_to_bar),
+ (menu_insert_attachment_cb), (menu_insert_attach_recent_docs_cb),
+ (comp_editor_init): Code re-factoring. Extend the 'Insert' menu to
+ show a "Recent Documents" submenu (to quickly add them as
+ attachments). New callback to handle these actions.
+
2008-04-07 Ondrej Jirman <megous@megous.com>
** Fix for bug #525234
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index a5b2232a0b..f1308365cf 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -1432,35 +1432,70 @@ menu_edit_cut_cb (BonoboUIComponent *uic,
}
static void
+add_to_bar (CompEditor *editor, GPtrArray *file_list, int is_inline)
+{
+ CompEditorPrivate *priv = editor->priv;
+ int i;
+
+ for (i = 0; i < file_list->len; i++) {
+ CamelURL *url;
+
+ if (!(url = camel_url_new (file_list->pdata[i], NULL)))
+ continue;
+
+ if (!g_ascii_strcasecmp (url->protocol, "file")) {
+ e_attachment_bar_attach((EAttachmentBar *)priv->attachment_bar, url->path, is_inline ? "inline" : "attachment");
+ } else {
+ e_attachment_bar_attach_remote_file ((EAttachmentBar *)priv->attachment_bar, file_list->pdata[i], is_inline ? "inline" : "attachment");
+ }
+
+ camel_url_free (url);
+ }
+}
+
+static void
menu_insert_attachment_cb (BonoboUIComponent *uic,
void *data,
const char *path)
{
CompEditor *editor = (CompEditor *) data;
- EAttachmentBar *bar = (EAttachmentBar *)editor->priv->attachment_bar;
GPtrArray *file_list;
gboolean is_inline = FALSE;
int i;
file_list = comp_editor_select_file_attachments (editor, &is_inline);
- /*TODO add a good implementation here */
- if (!file_list)
- return;
- for (i = 0; i < file_list->len; i++) {
- CamelURL *url;
- url = camel_url_new (file_list->pdata[i], NULL);
- if (url == NULL)
- continue;
+ if (file_list) {
+ add_to_bar (editor, file_list, is_inline);
- if (!g_ascii_strcasecmp (url->protocol, "file"))
- e_attachment_bar_attach (bar, url->path, is_inline ? "inline" : "attachment");
- else
- e_attachment_bar_attach_remote_file (bar, file_list->pdata[i], is_inline ? "inline" : "attachment");
- g_free (file_list->pdata[i]);
- camel_url_free (url);
+ for (i = 0; i < file_list->len; i++)
+ g_free (file_list->pdata[i]);
+
+ g_ptr_array_free (file_list, TRUE);
}
+}
+
+static void
+menu_insert_attach_recent_docs_cb (BonoboUIComponent *uic,
+ gpointer user_data,
+ const char *cname)
+{
+ CompEditor *editor = (CompEditor *) user_data;
+ gchar *command = NULL, *uri = NULL;
+ GPtrArray *file_list = g_ptr_array_new ();
+ int i;
+ command = g_strdup_printf ("/commands/%s", cname);
+ uri = bonobo_ui_component_get_prop (editor->uic, command, "uri", NULL);
+ g_free (command);
+
+ if (uri && *uri) {
+ g_ptr_array_add (file_list, uri);
+ add_to_bar (editor, file_list, FALSE);
+ }
+
+ for (i = 0; i < file_list->len; i++)
+ g_free (file_list->pdata[i]);
g_ptr_array_free (file_list, TRUE);
}
@@ -1636,6 +1671,11 @@ comp_editor_init (CompEditor *editor)
bonobo_ui_component_set_prop (editor->uic, "/commands/FileSave", "sensitive", "0", NULL);
+ /* FIXME: this should have been setup_widgets, but editor->uic is uninitialized then */
+ e_attachment_bar_bonobo_ui_populate_with_recent (editor->uic, "/menu/Insert/RecentDocsPlaceholder",
+ E_ATTACHMENT_BAR (priv->attachment_bar),
+ menu_insert_attach_recent_docs_cb, editor);
+
/* DND support */
gtk_drag_dest_set (GTK_WIDGET (editor), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY|GDK_ACTION_ASK|GDK_ACTION_MOVE);
g_signal_connect(editor, "drag_data_received", G_CALLBACK (drag_data_received), NULL);