[evolution] Bug 624285 - When replying, ignore text selection if preview is hidden
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 624285 - When replying, ignore text selection if preview is hidden
- Date: Tue, 13 Jul 2010 23:30:55 +0000 (UTC)
commit a972d9ab59660d7137fdf0918133b2e3f1c41545
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jul 13 19:27:18 2010 -0400
Bug 624285 - When replying, ignore text selection if preview is hidden
mail/e-mail-browser.c | 20 ++++++++++++++
mail/e-mail-reader-utils.c | 3 ++
mail/e-mail-reader.c | 42 +++++++++++++++++++++++++++++-
mail/e-mail-reader.h | 5 +++
modules/mail/e-mail-shell-content.c | 20 ++++++++++++++
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 86cc929..7ddfe00 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 a1e0ebb..f10702d 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 e0a9fdb..04acb93 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 f85aeec..16e5e4f 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 e7fb20d..7cfa678 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 4aac007..50cad27 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. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]