[evolution-patches] Patch to attachmentbar
- From: Srinivasa Ragavan <sragavan novell com>
- To: Evolution Patches <evolution-patches gnome org>
- Subject: [evolution-patches] Patch to attachmentbar
- Date: Thu, 06 Oct 2005 12:12:33 +0530
Hi,
This patch would provide support to get the attachment bar from a
e-plugin. This is required when we want to write a e-plugin for showing
menu items for save all attachments and any other thing we need in
future. It also has code to save all attachments in a temporary location
for the plugin use.
-Srini
Index: em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.132
diff -u -p -r1.132 em-folder-view.c
--- em-folder-view.c 28 Sep 2005 10:34:18 -0000 1.132
+++ em-folder-view.c 6 Oct 2005 06:31:15 -0000
@@ -1830,6 +1830,7 @@ emfv_enable_menus(EMFolderView *emfv)
EMMenuTargetSelect *t;
t = em_menu_target_new_select(emfv->menu, emfv->folder, emfv->folder_uri, message_list_get_selected(emfv->list));
+ t->target.widget = emfv;
e_menu_update_target((EMenu *)emfv->menu, t);
}
}
Index: em-format-html-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.c,v
retrieving revision 1.79
diff -u -p -r1.79 em-format-html-display.c
--- em-format-html-display.c 28 Sep 2005 10:39:48 -0000 1.79
+++ em-format-html-display.c 6 Oct 2005 06:31:16 -0000
@@ -419,6 +419,12 @@ void em_format_html_display_set_caret_mo
gtk_html_set_caret_mode(((EMFormatHTML *)efhd)->html, state);
}
+EAttachmentBar *
+em_format_html_display_get_bar (EMFormatHTMLDisplay *efhd)
+{
+ return efhd->priv->attachment_bar;
+}
+
void
em_format_html_display_set_search(EMFormatHTMLDisplay *efhd, int type, GSList *strings)
{
Index: em-format-html-display.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.h,v
retrieving revision 1.6
diff -u -p -r1.6 em-format-html-display.h
--- em-format-html-display.h 19 Aug 2005 05:38:22 -0000 1.6
+++ em-format-html-display.h 6 Oct 2005 06:31:16 -0000
@@ -7,6 +7,7 @@
#define _EM_FORMAT_HTML_DISPLAY_H
#include "mail/em-format-html.h"
+#include "e-attachment-bar.h"
typedef struct _EMFormatHTMLDisplay EMFormatHTMLDisplay;
typedef struct _EMFormatHTMLDisplayClass EMFormatHTMLDisplayClass;
@@ -58,6 +59,7 @@ void em_format_html_display_paste (EMFor
void em_format_html_display_zoom_in (EMFormatHTMLDisplay *efhd);
void em_format_html_display_zoom_out (EMFormatHTMLDisplay *efhd);
void em_format_html_display_zoom_reset (EMFormatHTMLDisplay *efhd);
+EAttachmentBar * em_format_html_display_get_bar (EMFormatHTMLDisplay *efhd);
gboolean em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd);
Index: em-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.c,v
retrieving revision 1.67
diff -u -p -r1.67 em-utils.c
--- em-utils.c 7 Aug 2005 21:18:18 -0000 1.67
+++ em-utils.c 6 Oct 2005 06:31:16 -0000
@@ -64,6 +64,7 @@
#include "em-composer-utils.h"
#include "em-format-quote.h"
#include "em-account-editor.h"
+#include "e-attachment.h"
static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data);
@@ -115,6 +116,44 @@ em_utils_prompt_user(GtkWindow *parent,
gtk_widget_destroy(mbox);
return button == GTK_RESPONSE_YES;
+}
+
+
+char *
+em_utils_temp_save_attachments (GSList *attachments)
+{
+ char *path = NULL;
+ GSList *selected;
+
+ path = e_mkdtemp("evolution-attachments-XXXXXX");
+
+ for ( selected = attachments; selected != NULL; selected = selected->next) {
+ const char *file_name;
+ char *safe_name = NULL;
+ char *file_path;
+ CamelMimePart *part = (CamelMimePart *)((EAttachment *)selected->data)->body;
+
+ file_name = camel_mime_part_get_filename(part);
+ if (file_name == NULL) {
+ file_name = _("attachment");
+ } else {
+ safe_name = g_strdup(file_name);
+ e_filename_make_safe(safe_name);
+ file_name = safe_name;
+ }
+
+ file_path = g_build_filename (path, file_name, NULL);
+
+ if (!g_file_test(file_path, (G_FILE_TEST_EXISTS)))
+ mail_save_part(part, file_path, NULL, NULL);
+ else
+ g_warning ("Could not save %s. File already exists", file_path);
+
+ g_free (file_path);
+ g_free (safe_name);
+ }
+
+ return path;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]