[geary/wip/712895-sigs: 3/5] Second patch from Gustavo Rubio
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/712895-sigs: 3/5] Second patch from Gustavo Rubio
- Date: Thu, 29 May 2014 22:41:58 +0000 (UTC)
commit 4a2c31c59cbc5d46921a0239b9e040af13f593e5
Author: Jim Nelson <jim yorba org>
Date: Thu May 29 15:13:34 2014 -0700
Second patch from Gustavo Rubio
src/client/accounts/add-edit-page.vala | 13 ++-
src/client/composer/composer-window.vala | 33 +++++++-
ui/login.glade | 132 +++++++++++++++++-------------
3 files changed, 112 insertions(+), 66 deletions(-)
---
diff --git a/src/client/accounts/add-edit-page.vala b/src/client/accounts/add-edit-page.vala
index cf7e09b..fed758c 100644
--- a/src/client/accounts/add-edit-page.vala
+++ b/src/client/accounts/add-edit-page.vala
@@ -165,7 +165,8 @@ public class AddEditPage : Gtk.Box {
private Gtk.CheckButton check_remember_password;
private Gtk.CheckButton check_save_sent_mail;
- //Signature
+ //Composer settings widgets
+ private Gtk.Box composer_container;
private Gtk.CheckButton check_use_email_signature;
private Gtk.TextView textview_email_signature;
@@ -229,11 +230,7 @@ public class AddEditPage : Gtk.Box {
entry_password = (Gtk.Entry) builder.get_object("entry: password");
check_remember_password = (Gtk.CheckButton) builder.get_object("check: remember_password");
check_save_sent_mail = (Gtk.CheckButton) builder.get_object("check: save_sent_mail");
- check_use_email_signature = (Gtk.CheckButton) builder.get_object("check: use_email_signature");
- textview_email_signature = (Gtk.TextView) builder.get_object("textview: email_signature");
-
label_error = (Gtk.Label) builder.get_object("label: error");
-
other_info = (Gtk.Alignment) builder.get_object("container: other_info");
// Storage options.
@@ -249,6 +246,11 @@ public class AddEditPage : Gtk.Box {
combo_storage_length.append("1461", _("4 years back"));
combo_storage_length.append(".", "."); // Separator
combo_storage_length.append("-1", _("Everything"));
+
+ //composer options
+ composer_container = (Gtk.Box) builder.get_object("composer container");
+ check_use_email_signature = (Gtk.CheckButton) builder.get_object("check: use_email_signature");
+ textview_email_signature = (Gtk.TextView) builder.get_object("textview: email_signature");
// IMAP info widgets.
entry_imap_host = (Gtk.Entry) builder.get_object("entry: imap host");
@@ -661,6 +663,7 @@ public class AddEditPage : Gtk.Box {
entry_nickname.visible = label_nickname.visible = mode != PageMode.WELCOME;
storage_container.visible = mode == PageMode.EDIT;
check_save_sent_mail.visible = mode == PageMode.EDIT;
+ composer_container.visible = mode == PageMode.EDIT;
if (get_service_provider() == Geary.ServiceProvider.OTHER) {
// Display all options for custom providers.
diff --git a/src/client/composer/composer-window.vala b/src/client/composer/composer-window.vala
index a171dc6..490199e 100644
--- a/src/client/composer/composer-window.vala
+++ b/src/client/composer/composer-window.vala
@@ -673,16 +673,43 @@ public class ComposerWindow : Gtk.Window {
private void add_signature() {
- string signature = account.information.email_signature;
- signature = Geary.HTML.escape_markup(signature);
+ string signature = null;
+
+ //If use signature is enabled but no contents are on settings then we'll use ~/.signature, if any
+ //otherwise use whatever the user has input in settings dialog
+ if(account.information.use_email_signature &&
Geary.String.is_empty_or_whitespace(account.information.email_signature)) {
+
+ File signature_file = File.new_for_path(Environment.get_home_dir()).get_child(".signature");
+ if (!signature_file.query_exists()) {
+ return;
+ }
+
+ try
+ {
+ FileUtils.get_contents(signature_file.get_path(), out signature);
+ if (Geary.String.is_empty_or_whitespace(signature)) {
+ return;
+ }
+ } catch (Error error) {
+ debug("Error reading signature file %s: %s", signature_file.get_path(), error.message);
+ return;
+ }
+ } else {
+
+ signature = account.information.email_signature;
+ if(Geary.String.is_empty_or_whitespace(signature))
+ return;
+ }
+
+ signature = Geary.HTML.escape_markup(signature);
if (body_html == null)
{
body_html = Geary.HTML.preserve_whitespace("\n\n" + signature);
}
else
{
- body_html = body_html + Geary.HTML.preserve_whitespace("\n\n" + signature);
+ body_html = Geary.HTML.preserve_whitespace("\n\n" + signature) + body_html;
}
}
diff --git a/ui/login.glade b/ui/login.glade
index 1aa9f6d..cf8f640 100644
--- a/ui/login.glade
+++ b/ui/login.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Thu May 8 15:52:51 2014 -->
+<!-- Generated with glade 3.16.0 on Wed May 28 11:26:36 2014 -->
<interface>
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkAdjustment" id="adjustment1">
@@ -280,63 +280,6 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label: email_signature">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Signature:</property>
- <property name="selectable">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">7</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="check: use_email_signature">
- <property name="label" translatable="yes">_Use email signature</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">7</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTextView" id="textview: email_signature">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="wrap_mode">word</property>
- <property name="buffer">buffer: email_signature</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">8</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<placeholder/>
</child>
<child>
@@ -913,5 +856,78 @@
<property name="position">4</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox" id="composer container">
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">10</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label: composer">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">8</property>
+ <property name="xalign">0</property>
+ <property name="xpad">4</property>
+ <property name="ypad">6</property>
+ <property name="label" translatable="yes">Composer</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="check: use_email_signature">
+ <property name="label" translatable="yes">_Use the following signature for this
account</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="margin_left">12</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="margin_left">12</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTextView" id="textview: email_signature">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="wrap_mode">word</property>
+ <property name="buffer">buffer: email_signature</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]