diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-07-14 07:27:18 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-07-14 07:30:20 +0800 |
commit | a972d9ab59660d7137fdf0918133b2e3f1c41545 (patch) | |
tree | 962a40a7418ca5b2de32d11ceacee47bd7f0e9c5 | |
parent | dba7eededd03ad2de3c126301e9d048390bb6f43 (diff) | |
download | gsoc2013-evolution-a972d9ab59660d7137fdf0918133b2e3f1c41545.tar gsoc2013-evolution-a972d9ab59660d7137fdf0918133b2e3f1c41545.tar.gz gsoc2013-evolution-a972d9ab59660d7137fdf0918133b2e3f1c41545.tar.bz2 gsoc2013-evolution-a972d9ab59660d7137fdf0918133b2e3f1c41545.tar.lz gsoc2013-evolution-a972d9ab59660d7137fdf0918133b2e3f1c41545.tar.xz gsoc2013-evolution-a972d9ab59660d7137fdf0918133b2e3f1c41545.tar.zst gsoc2013-evolution-a972d9ab59660d7137fdf0918133b2e3f1c41545.zip |
Bug 624285 - When replying, ignore text selection if preview is hidden
-rw-r--r-- | mail/e-mail-browser.c | 20 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.c | 3 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 42 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 5 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 20 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 6 |
6 files changed, 95 insertions, 1 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index 86cc929182..7ddfe005ed 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -64,6 +64,7 @@ enum { PROP_0, PROP_FOCUS_TRACKER, PROP_GROUP_BY_THREADS, + PROP_QUOTE_FROM_SELECTION, PROP_SHELL_BACKEND, PROP_SHOW_DELETED, PROP_UI_MANAGER @@ -357,6 +358,11 @@ mail_browser_set_property (GObject *object, g_value_get_boolean (value)); return; + case PROP_QUOTE_FROM_SELECTION: + e_mail_reader_set_quote_from_selection ( + E_MAIL_READER (object), + g_value_get_boolean (value)); + case PROP_SHELL_BACKEND: mail_browser_set_shell_backend ( E_MAIL_BROWSER (object), @@ -392,6 +398,12 @@ mail_browser_get_property (GObject *object, E_MAIL_READER (object))); return; + case PROP_QUOTE_FROM_SELECTION: + g_value_set_boolean ( + value, e_mail_reader_get_quote_from_selection ( + E_MAIL_READER (object))); + return; + case PROP_SHELL_BACKEND: g_value_set_object ( value, e_mail_reader_get_shell_backend ( @@ -545,6 +557,8 @@ mail_browser_constructed (GObject *object) e_mail_reader_init (reader); + e_mail_reader_set_quote_from_selection (reader, TRUE); + action_group = priv->action_group; gtk_action_group_set_translation_domain (action_group, domain); gtk_action_group_add_actions ( @@ -791,6 +805,12 @@ mail_browser_class_init (EMailBrowserClass *class) PROP_GROUP_BY_THREADS, "group-by-threads"); + /* Inherited from EMailReader */ + g_object_class_override_property ( + object_class, + PROP_QUOTE_FROM_SELECTION, + "quote-from-selection"); + g_object_class_install_property ( object_class, PROP_SHELL_BACKEND, diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index a1e0ebbc52..f10702ddd3 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -382,6 +382,9 @@ e_mail_reader_reply_to_message (EMailReader *reader, uid = MESSAGE_LIST (message_list)->cursor_uid; g_return_if_fail (uid != NULL); + if (!e_mail_reader_get_quote_from_selection (reader)) + goto whole_message; + if (!e_web_view_is_selection_active (web_view)) goto whole_message; diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index e0a9fdb299..04acb93386 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -78,7 +78,8 @@ struct _EMailReaderPrivate { guint folder_was_just_selected : 1; guint restoring_message_selection : 1; - guint group_by_threads : 1; + guint group_by_threads : 1; + guint quote_from_selection : 1; }; enum { @@ -2492,6 +2493,15 @@ mail_reader_class_init (EMailReaderIface *iface) FALSE, G_PARAM_READWRITE)); + g_object_interface_install_property ( + iface, + g_param_spec_boolean ( + "quote-from-selection", + "Quote From Selection", + "Quote selected text when replying", + FALSE, + G_PARAM_READWRITE)); + signals[CHANGED] = g_signal_new ( "changed", G_OBJECT_CLASS_TYPE (iface), @@ -3144,6 +3154,36 @@ e_mail_reader_set_group_by_threads (EMailReader *reader, g_object_notify (G_OBJECT (reader), "group-by-threads"); } +gboolean +e_mail_reader_get_quote_from_selection (EMailReader *reader) +{ + EMailReaderPrivate *priv; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE); + + priv = E_MAIL_READER_GET_PRIVATE (reader); + + return priv->quote_from_selection; +} + +void +e_mail_reader_set_quote_from_selection (EMailReader *reader, + gboolean quote_from_selection) +{ + EMailReaderPrivate *priv; + + g_return_if_fail (E_IS_MAIL_READER (reader)); + + priv = E_MAIL_READER_GET_PRIVATE (reader); + + if (quote_from_selection == priv->quote_from_selection) + return; + + priv->quote_from_selection = quote_from_selection; + + g_object_notify (G_OBJECT (reader), "quote-from-selection"); +} + void e_mail_reader_create_charset_menu (EMailReader *reader, GtkUIManager *ui_manager, diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index f85aeec65f..16e5e4feb1 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -137,6 +137,11 @@ gboolean e_mail_reader_get_group_by_threads void e_mail_reader_set_group_by_threads (EMailReader *reader, gboolean group_by_threads); +gboolean e_mail_reader_get_quote_from_selection + (EMailReader *reader); +void e_mail_reader_set_quote_from_selection + (EMailReader *reader, + gboolean quote_from_selection); void e_mail_reader_create_charset_menu (EMailReader *reader, GtkUIManager *ui_manager, diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index e7fb20d1cf..7cfa678aff 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -78,6 +78,7 @@ enum { PROP_GROUP_BY_THREADS, PROP_ORIENTATION, PROP_PREVIEW_VISIBLE, + PROP_QUOTE_FROM_SELECTION, PROP_SHOW_DELETED }; @@ -292,6 +293,12 @@ mail_shell_content_set_property (GObject *object, g_value_get_boolean (value)); return; + case PROP_QUOTE_FROM_SELECTION: + e_mail_reader_set_quote_from_selection ( + E_MAIL_READER (object), + g_value_get_boolean (value)); + return; + case PROP_SHOW_DELETED: e_mail_shell_content_set_show_deleted ( E_MAIL_SHELL_CONTENT (object), @@ -330,6 +337,13 @@ mail_shell_content_get_property (GObject *object, E_MAIL_SHELL_CONTENT (object))); return; + case PROP_QUOTE_FROM_SELECTION: + g_value_set_boolean ( + value, + e_mail_reader_get_quote_from_selection ( + E_MAIL_READER (object))); + return; + case PROP_SHOW_DELETED: g_value_set_boolean ( value, @@ -723,6 +737,12 @@ mail_shell_content_class_init (EMailShellContentClass *class) TRUE, G_PARAM_READWRITE)); + /* Inherited from EMailReader */ + g_object_class_override_property ( + object_class, + PROP_QUOTE_FROM_SELECTION, + "quote-from-selection"); + g_object_class_install_property ( object_class, PROP_SHOW_DELETED, diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 4aac0075f8..50cad27444 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -579,6 +579,12 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) e_mail_shell_view_actions_init (mail_shell_view); e_mail_shell_view_update_search_filter (mail_shell_view); + /* When replying, only quote from selected + * text if the message preview is visible. */ + e_binding_new ( + reader, "preview-visible", + reader, "quote-from-selection"); + /* Populate built-in rules for search entry popup menu. * Keep the assertions, please. If the conditions aren't * met we're going to crash anyway, just more mysteriously. */ |