diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-05 19:57:30 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-05 19:57:30 +0800 |
commit | 4ec46cc05fcb94d181fb9c2412984a1446647c85 (patch) | |
tree | d16ce30e77dd539c03509237dd4c723d46aea97a /composer | |
parent | 5ea7e23aef0c239af2600c95419ba0bda0f08b3c (diff) | |
parent | 19163c2b71e6128fc9b32287b99b1f4422324c2d (diff) | |
download | gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.gz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.bz2 gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.lz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.xz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.zst gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.zip |
Merge from master
Diffstat (limited to 'composer')
-rw-r--r-- | composer/Makefile.am | 8 | ||||
-rw-r--r-- | composer/e-composer-from-header.h | 4 | ||||
-rw-r--r-- | composer/e-composer-header-table.c | 7 | ||||
-rw-r--r-- | composer/e-composer-header-table.h | 5 | ||||
-rw-r--r-- | composer/e-composer-header.c | 48 | ||||
-rw-r--r-- | composer/e-composer-header.h | 2 | ||||
-rw-r--r-- | composer/e-composer-name-header.c | 10 | ||||
-rw-r--r-- | composer/e-composer-name-header.h | 5 | ||||
-rw-r--r-- | composer/e-composer-post-header.h | 2 | ||||
-rw-r--r-- | composer/e-composer-private.c | 5 | ||||
-rw-r--r-- | composer/e-composer-private.h | 3 | ||||
-rw-r--r-- | composer/e-composer-text-header.c | 18 | ||||
-rw-r--r-- | composer/e-composer-text-header.h | 12 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 49 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 2 | ||||
-rw-r--r-- | composer/mail-composer.error.xml | 2 |
16 files changed, 109 insertions, 73 deletions
diff --git a/composer/Makefile.am b/composer/Makefile.am index 5cd2eab05c..013d04c8bd 100644 --- a/composer/Makefile.am +++ b/composer/Makefile.am @@ -37,8 +37,9 @@ libcomposer_la_CPPFLAGS = \ -DEVOLUTION_UIDIR=\"$(uidir)\" \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"composer\" \ + $(EVOLUTION_DATA_SERVER_CFLAGS) \ $(GNOME_PLATFORM_CFLAGS) \ - $(EVOLUTION_MAIL_CFLAGS) + $(GTKHTML_CFLAGS) libcomposer_la_SOURCES = \ $(libcomposerinclude_HEADERS) \ @@ -62,8 +63,9 @@ libcomposer_la_LIBADD = \ $(top_builddir)/em-format/libemformat.la \ $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \ $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \ - $(EVOLUTION_MAIL_LIBS) \ - $(GNOME_PLATFORM_LIBS) + $(EVOLUTION_DATA_SERVER_LIBS) \ + $(GNOME_PLATFORM_LIBS) \ + $(GTKHTML_LIBS) ui_DATA = evolution-composer.ui diff --git a/composer/e-composer-from-header.h b/composer/e-composer-from-header.h index d2603bd664..182a75134b 100644 --- a/composer/e-composer-from-header.h +++ b/composer/e-composer-from-header.h @@ -21,13 +21,11 @@ #ifndef E_COMPOSER_FROM_HEADER_H #define E_COMPOSER_FROM_HEADER_H -#include "e-composer-common.h" - #include <libedataserver/e-account.h> #include <libedataserver/e-account-list.h> #include <misc/e-account-combo-box.h> -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_FROM_HEADER \ diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index 7fe1399dbe..2dd94eb875 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -21,7 +21,6 @@ #include "e-composer-header-table.h" -#include <string.h> #include <glib/gi18n-lib.h> #include <libedataserverui/e-name-selector.h> @@ -81,10 +80,9 @@ g_value_set_destinations (GValue *value, EDestination **destinations) { GValueArray *value_array; - GValue element; + GValue element = G_VALUE_INIT; gint ii; - memset (&element, 0, sizeof (GValue)); g_value_init (&element, E_TYPE_DESTINATION); /* Preallocate some reasonable number. */ @@ -122,9 +120,8 @@ g_value_set_string_list (GValue *value, GList *list) { GValueArray *value_array; - GValue element; + GValue element = G_VALUE_INIT; - memset (&element, 0, sizeof (GValue)); g_value_init (&element, G_TYPE_STRING); value_array = g_value_array_new (g_list_length (list)); diff --git a/composer/e-composer-header-table.h b/composer/e-composer-header-table.h index 856a8e2158..f7edec0b14 100644 --- a/composer/e-composer-header-table.h +++ b/composer/e-composer-header-table.h @@ -18,8 +18,6 @@ #ifndef E_COMPOSER_HEADER_TABLE_H #define E_COMPOSER_HEADER_TABLE_H -#include "e-composer-common.h" - #include <libedataserver/e-account.h> #include <libedataserver/e-account-list.h> #include <libebook/e-destination.h> @@ -27,8 +25,7 @@ #include <shell/e-shell.h> #include <e-util/e-signature.h> #include <e-util/e-signature-list.h> - -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_HEADER_TABLE \ diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c index d6a270a73b..29a9a5c790 100644 --- a/composer/e-composer-header.c +++ b/composer/e-composer-header.c @@ -26,21 +26,12 @@ #include "e-composer-header.h" -#include <glib/gi18n.h> - -enum { - PROP_0, - PROP_BUTTON, - PROP_LABEL, - PROP_SENSITIVE, - PROP_VISIBLE -}; +#include <config.h> +#include <glib/gi18n-lib.h> -enum { - CHANGED, - CLICKED, - LAST_SIGNAL -}; +#define E_COMPOSER_HEADER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_COMPOSER_HEADER, EComposerHeaderPrivate)) struct _EComposerHeaderPrivate { gchar *label; @@ -56,6 +47,20 @@ struct _EComposerHeaderPrivate { guint visible : 1; }; +enum { + PROP_0, + PROP_BUTTON, + PROP_LABEL, + PROP_SENSITIVE, + PROP_VISIBLE +}; + +enum { + CHANGED, + CLICKED, + LAST_SIGNAL +}; + static guint signal_ids[LAST_SIGNAL]; G_DEFINE_ABSTRACT_TYPE ( @@ -98,7 +103,8 @@ composer_header_constructor (GType type, label = gtk_bin_get_child (GTK_BIN (widget)); } else { widget = gtk_label_new_with_mnemonic (header->priv->label); - gtk_label_set_mnemonic_widget (GTK_LABEL (widget), header->input_widget); + gtk_label_set_mnemonic_widget ( + GTK_LABEL (widget), header->input_widget); label = widget; } @@ -227,7 +233,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, FALSE, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -238,7 +245,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, NULL, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -248,7 +256,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, NULL, FALSE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -258,7 +267,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, NULL, FALSE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); signal_ids[CHANGED] = g_signal_new ( "changed", diff --git a/composer/e-composer-header.h b/composer/e-composer-header.h index 971b55968c..08db97a2d4 100644 --- a/composer/e-composer-header.h +++ b/composer/e-composer-header.h @@ -18,7 +18,7 @@ #ifndef E_COMPOSER_HEADER_H #define E_COMPOSER_HEADER_H -#include "e-composer-common.h" +#include <composer/e-composer-common.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_HEADER \ diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c index a99f1cd949..b17cb4a75a 100644 --- a/composer/e-composer-name-header.c +++ b/composer/e-composer-name-header.c @@ -276,11 +276,11 @@ e_composer_name_header_new (const gchar *label, { g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL); - return g_object_new (E_TYPE_COMPOSER_NAME_HEADER, - "label", label, - "button", TRUE, - "name-selector", name_selector, - NULL); + return g_object_new ( + E_TYPE_COMPOSER_NAME_HEADER, + "label", label, "button", TRUE, + "name-selector", name_selector, + NULL); } ENameSelector * diff --git a/composer/e-composer-name-header.h b/composer/e-composer-name-header.h index 785f7d11e8..e2f5e0044c 100644 --- a/composer/e-composer-name-header.h +++ b/composer/e-composer-name-header.h @@ -18,12 +18,10 @@ #ifndef E_COMPOSER_NAME_HEADER_H #define E_COMPOSER_NAME_HEADER_H -#include "e-composer-common.h" - #include <libebook/e-destination.h> #include <libedataserverui/e-name-selector.h> -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_NAME_HEADER \ @@ -62,7 +60,6 @@ struct _EComposerNameHeaderClass { GType e_composer_name_header_get_type (void); EComposerHeader * e_composer_name_header_new (const gchar *label, ENameSelector *name_selector); - ENameSelector * e_composer_name_header_get_name_selector (EComposerNameHeader *header); EDestination ** e_composer_name_header_get_destinations diff --git a/composer/e-composer-post-header.h b/composer/e-composer-post-header.h index c38bfe2d17..c6fff3e751 100644 --- a/composer/e-composer-post-header.h +++ b/composer/e-composer-post-header.h @@ -23,7 +23,7 @@ #include <libedataserver/e-account.h> -#include "e-composer-text-header.h" +#include <composer/e-composer-text-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_POST_HEADER \ diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c index 693fd959f5..bd7b46a4ee 100644 --- a/composer/e-composer-private.c +++ b/composer/e-composer-private.c @@ -198,7 +198,8 @@ e_composer_private_constructed (EMsgComposer *composer) gtk_widget_hide (widget); #endif widget = gtkhtml_editor_get_managed_widget (editor, "/main-toolbar"); - gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ); + gtk_toolbar_set_style ( + GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ); gtk_widget_hide (widget); } @@ -318,7 +319,7 @@ e_composer_private_constructed (EMsgComposer *composer) /* Construct the attachment paned. */ if (small_screen_mode) { - /* short attachment bar for Anjal */ + /* Short attachment bar for Anjal. */ e_attachment_paned_set_default_height (75); e_attachment_icon_view_set_default_icon_size (GTK_ICON_SIZE_BUTTON); } diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h index 229897756f..35eb26696b 100644 --- a/composer/e-composer-private.h +++ b/composer/e-composer-private.h @@ -33,12 +33,13 @@ #include <gconf/gconf.h> #include <gconf/gconf-client.h> +#include <libebackend/e-extensible.h> + #include "e-composer-actions.h" #include "e-composer-activity.h" #include "e-composer-header-table.h" #include "e-util/e-alert-sink.h" #include "e-util/e-charset.h" -#include "e-util/e-extensible.h" #include "e-util/e-marshal.h" #include "e-util/e-mktemp.h" #include "e-util/e-plugin-ui.h" diff --git a/composer/e-composer-text-header.c b/composer/e-composer-text-header.c index 28df51ec87..39279237ab 100644 --- a/composer/e-composer-text-header.c +++ b/composer/e-composer-text-header.c @@ -89,19 +89,19 @@ e_composer_text_header_init (EComposerTextHeader *header) EComposerHeader * e_composer_text_header_new_label (const gchar *label) { - return g_object_new (E_TYPE_COMPOSER_TEXT_HEADER, - "label", label, - "button", FALSE, - NULL); + return g_object_new ( + E_TYPE_COMPOSER_TEXT_HEADER, + "label", label, "button", FALSE, + NULL); } EComposerHeader * e_composer_text_header_new_button (const gchar *label) { - return g_object_new (E_TYPE_COMPOSER_TEXT_HEADER, - "label", label, - "button", TRUE, - NULL); + return g_object_new ( + E_TYPE_COMPOSER_TEXT_HEADER, + "label", label, "button", TRUE, + NULL); } const gchar * @@ -112,6 +112,7 @@ e_composer_text_header_get_text (EComposerTextHeader *header) g_return_val_if_fail (E_IS_COMPOSER_TEXT_HEADER (header), NULL); entry = E_COMPOSER_TEXT_HEADER_GET_ENTRY (header); + return gtk_entry_get_text (entry); } @@ -124,5 +125,6 @@ e_composer_text_header_set_text (EComposerTextHeader *header, g_return_if_fail (E_IS_COMPOSER_TEXT_HEADER (header)); entry = E_COMPOSER_TEXT_HEADER_GET_ENTRY (header); + gtk_entry_set_text (entry, (text != NULL) ? text : ""); } diff --git a/composer/e-composer-text-header.h b/composer/e-composer-text-header.h index 278b2b1116..860fcc3c61 100644 --- a/composer/e-composer-text-header.h +++ b/composer/e-composer-text-header.h @@ -21,8 +21,7 @@ #ifndef E_COMPOSER_TEXT_HEADER_H #define E_COMPOSER_TEXT_HEADER_H -#include "e-composer-common.h" -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_TEXT_HEADER \ @@ -57,13 +56,12 @@ struct _EComposerTextHeaderClass { }; GType e_composer_text_header_get_type (void); - EComposerHeader * -e_composer_text_header_new_label (const gchar *label); - + e_composer_text_header_new_label + (const gchar *label); EComposerHeader * -e_composer_text_header_new_button (const gchar *label); - + e_composer_text_header_new_button + (const gchar *label); const gchar * e_composer_text_header_get_text (EComposerTextHeader *header); void e_composer_text_header_set_text (EComposerTextHeader *header, const gchar *text); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index c41c4019b3..e58fd6fdf4 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -128,6 +128,8 @@ static void handle_multipart_signed (EMsgComposer *composer, static void e_msg_composer_alert_sink_init (EAlertSinkInterface *interface); +gboolean check_blacklisted_file (gchar *filename); + G_DEFINE_TYPE_WITH_CODE ( EMsgComposer, e_msg_composer, @@ -522,6 +524,7 @@ build_message_headers (EMsgComposer *composer, if (account != NULL) { CamelMedium *medium; CamelInternetAddress *addr; + const gchar *header_name; const gchar *name = account->id->name; const gchar *address = account->id->address; gchar *transport_uid; @@ -542,18 +545,18 @@ build_message_headers (EMsgComposer *composer, g_object_unref (addr); /* X-Evolution-Account */ - camel_medium_set_header ( - medium, "X-Evolution-Account", account->uid); + header_name = "X-Evolution-Account"; + camel_medium_set_header (medium, header_name, account->uid); /* X-Evolution-Fcc */ - camel_medium_set_header ( - medium, "X-Evolution-Fcc", account->sent_folder_uri); + header_name = "X-Evolution-Fcc"; + camel_medium_set_header (medium, header_name, account->sent_folder_uri); /* X-Evolution-Transport */ + header_name = "X-Evolution-Transport"; transport_uid = g_strconcat ( account->uid, "-transport", NULL); - camel_medium_set_header ( - medium, "X-Evolution-Transport", transport_uid); + camel_medium_set_header (medium, header_name, transport_uid); g_free (transport_uid); } @@ -1102,7 +1105,8 @@ composer_build_message (EMsgComposer *composer, /* Disposition-Notification-To */ if (flags & COMPOSER_FLAG_REQUEST_READ_RECEIPT) { gchar *mdn_address = account->id->reply_to; - if (!mdn_address || !*mdn_address) + + if (mdn_address == NULL || *mdn_address == '\0') mdn_address = account->id->address; camel_medium_add_header ( @@ -1501,7 +1505,8 @@ is_top_signature (EMsgComposer *composer) shell = e_msg_composer_get_shell (composer); shell_settings = e_shell_get_shell_settings (shell); - return e_shell_settings_get_boolean (shell_settings, "composer-top-signature"); + return e_shell_settings_get_boolean ( + shell_settings, "composer-top-signature"); } static gboolean @@ -4003,6 +4008,28 @@ merge_always_cc_and_bcc (EComposerHeaderTable *table, e_destination_freev (addrv); } +static const gchar *blacklisted_files [] = {".", "etc", ".."}; + +gboolean check_blacklisted_file (gchar *filename) +{ + gboolean blacklisted = FALSE; + gint i,j,len; + gchar **filename_part; + + filename_part = g_strsplit (filename, G_DIR_SEPARATOR_S, -1); + len = g_strv_length(filename_part); + for(i = 0; !blacklisted && i < G_N_ELEMENTS(blacklisted_files); i++) + { + for (j = 0; !blacklisted && j < len;j++) + if (g_str_has_prefix (filename_part[j], blacklisted_files[i])) + blacklisted = TRUE; + } + + g_strfreev(filename_part); + + return blacklisted; +} + static void handle_mailto (EMsgComposer *composer, const gchar *mailto) @@ -4094,8 +4121,14 @@ handle_mailto (EMsgComposer *composer, } else if (!g_ascii_strcasecmp (header, "attach") || !g_ascii_strcasecmp (header, "attachment")) { EAttachment *attachment; + gboolean check = FALSE; camel_url_decode (content); + check = check_blacklisted_file(content); + if(check) + e_alert_submit ( + E_ALERT_SINK (composer), + "mail:blacklisted-file", content, NULL); if (g_ascii_strncasecmp (content, "file:", 5) == 0) attachment = e_attachment_new_for_uri (content); else diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 296bb35a2f..258d260e3f 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -33,7 +33,7 @@ #include <misc/e-web-view.h> #include <shell/e-shell.h> -#include "e-composer-header-table.h" +#include <composer/e-composer-header-table.h> /* Standard GObject macros */ #define E_TYPE_MSG_COMPOSER \ diff --git a/composer/mail-composer.error.xml b/composer/mail-composer.error.xml index 7398f17442..0f6f11d429 100644 --- a/composer/mail-composer.error.xml +++ b/composer/mail-composer.error.xml @@ -35,7 +35,7 @@ <button _label="_Send" response="GTK_RESPONSE_YES"/> </error> - <error id="exit-unsaved" type="warning" default="GTK_RESPONSE_YES"> + <error id="exit-unsaved" type="warning" default="GTK_RESPONSE_CANCEL"> <_primary>Are you sure you want to discard the message, titled '{0}', you are composing?</_primary> <_secondary>Closing this composer window will discard the message permanently, unless you choose to save the message in your Drafts folder. This will allow you to continue the message at a later date.</_secondary> <button _label="_Discard Changes" response="GTK_RESPONSE_NO"/> |