[pan2] show/hide signature



commit 6ad7c2424c9fc8111dcabecb53fd1f21b17f62c8
Author: Heinrich MÃller <henmull src gnome org>
Date:   Thu May 31 00:08:28 2012 +0200

    show/hide signature

 pan/gui/actions.cc   |    9 +++++----
 pan/gui/body-pane.cc |   25 +++++++++++++++++++++++--
 pan/gui/pan.ui.h     |    2 ++
 pan/gui/pan.ui.ssl.h |    2 ++
 4 files changed, 32 insertions(+), 6 deletions(-)
---
diff --git a/pan/gui/actions.cc b/pan/gui/actions.cc
index c2ec1e4..1419708 100644
--- a/pan/gui/actions.cc
+++ b/pan/gui/actions.cc
@@ -683,13 +683,14 @@ namespace pan
   GtkToggleActionEntry toggle_entries[] =
   {
     { "thread-headers",           NULL, N_("_Thread Headers"),                NULL, NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
-    { "wrap-article-body",GTK_STOCK_JUSTIFY_FILL, N_("_Wrap Article Body"),    "W", NULL, G_CALLBACK(prefs_toggle_callback_impl), false },
-    { "mute-quoted-text",         NULL, N_("Mute _Quoted Text"),               "Q", NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
-    { "show-all-headers",         NULL, N_("Show All _Headers in Body Pane"),  "H", NULL, G_CALLBACK(prefs_toggle_callback_impl), false },
+    { "wrap-article-body",GTK_STOCK_JUSTIFY_FILL, N_("Wrap Article Body"),    "W", NULL, G_CALLBACK(prefs_toggle_callback_impl), false },
+    { "show-article-sig",GTK_STOCK_EDIT, N_("Show Article Signature"),        "I", NULL, G_CALLBACK(prefs_toggle_callback_impl), false },
+    { "mute-quoted-text",         NULL, N_("Mute _Quoted Text"),              "Q", NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
+    { "show-all-headers",         NULL, N_("Show All _Headers in Body Pane"), "H", NULL, G_CALLBACK(prefs_toggle_callback_impl), false },
     { "show-smilies-as-graphics", NULL, N_("Show _Smilies as Graphics"),      NULL, NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
     { "show-text-markup",         NULL, N_("Show *Bold*, __Underlined__, and /Italic/"), NULL, NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
     { "size-pictures-to-fit",     NULL, N_("Size Pictures to _Fit"),          NULL, NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
-    { "monospace-font-enabled",   NULL, N_("Use _Monospace Font"),             "C", NULL, G_CALLBACK(prefs_toggle_callback_impl), false },
+    { "monospace-font-enabled",   NULL, N_("Use _Monospace Font"),            "C", NULL, G_CALLBACK(prefs_toggle_callback_impl), false },
     { "focus-on-image",           NULL, N_("Set Focus to Images"),            NULL, NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
     { "highlight-urls",           NULL, N_("Highlight _URLs"),                 NULL, NULL, G_CALLBACK(prefs_toggle_callback_impl), true },
 
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index b158bbf..3f73e4e 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -671,6 +671,21 @@ namespace
   }
 
   void
+  show_signature (GtkTextBuffer      * buffer,
+                    GtkTextMark        * mark,
+                    std::string        & body,
+                    bool                show)
+  {
+    GtkTextTagTable * tags (gtk_text_buffer_get_tag_table (buffer));
+    if (tags)
+    {
+      GtkTextTag * sig_tag (gtk_text_tag_table_lookup (tags, "signature"));
+      if (sig_tag)
+        g_object_set (sig_tag, "invisible", !show, NULL);
+    }
+  }
+
+  void
   replace_emoticon_text_with_pixbuf (GtkTextBuffer      * buffer,
                                      GtkTextMark        * mark,
                                      std::string        & body,
@@ -715,6 +730,7 @@ namespace
                              const StringView    & body_in,
                              bool                  mute_quotes,
                              bool                  show_smilies,
+                             bool                  show_sig,
                              bool                  do_markup,
                              bool                  do_urls)
   {
@@ -854,6 +870,8 @@ namespace
         replace_emoticon_text_with_pixbuf (buffer, mark, body, it->first, it->second);
     }
 
+    show_signature (buffer, mark, body, show_sig);
+
     gtk_text_buffer_delete_mark (buffer, mark);
   }
 
@@ -1001,7 +1019,8 @@ BodyPane :: append_part (GMimeObject * parent, GMimeObject * obj, GtkAllocation
     const bool do_smilies (_prefs.get_flag ("show-smilies-as-graphics", true));
     const bool do_markup (_prefs.get_flag ("show-text-markup", true));
     const bool do_urls (_prefs.get_flag ("highlight-urls", true));
-    append_text_buffer_nolock (&_tm, _buffer, str, do_mute, do_smilies, do_markup, do_urls);
+    const bool do_sig(_prefs.get_flag ("show-article-sig", true));
+    append_text_buffer_nolock (&_tm, _buffer, str, do_mute, do_smilies, do_sig, do_markup, do_urls);
     is_done = true;
   }
 
@@ -2050,7 +2069,9 @@ BodyPane :: on_prefs_flag_changed (const StringView& key, bool value G_GNUC_UNUS
       (key=="mute-signature") ||
       (key=="show-smilies-as-graphics") || (key=="show-all-headers") ||
       (key=="size-pictures-to-fit") || (key=="show-text-markup") ||
-      (key=="highlight-urls") )
+      (key=="highlight-urls") ||
+      (key=="show-article-sig")
+     )
     refresh ();
 }
 
diff --git a/pan/gui/pan.ui.h b/pan/gui/pan.ui.h
index d9904c1..64a0fbd 100644
--- a/pan/gui/pan.ui.h
+++ b/pan/gui/pan.ui.h
@@ -62,6 +62,7 @@ const char * fallback_ui_file =
 "      </menu>\n"
 "      <menu action='view-body-pane-menu'>\n"
 "        <menuitem action='wrap-article-body' />\n"
+"        <menuitem action='show-article-sig' />\n"
 "        <menuitem action='mute-quoted-text' />\n"
 "        <menuitem action='show-all-headers' />\n"
 "        <menuitem action='monospace-font-enabled' />\n"
@@ -182,6 +183,7 @@ const char * fallback_ui_file =
 "    <toolitem action='match-only-watched-articles' />\n"
 "    <separator />\n"
 "    <toolitem action='wrap-article-body' />\n"
+"    <toolitem action='show-article-sig' />\n"
 "  </toolbar>\n"
 "\n"
 "  <popup name='header-pane-popup'>\n"
diff --git a/pan/gui/pan.ui.ssl.h b/pan/gui/pan.ui.ssl.h
index 2867de5..ce1e573 100644
--- a/pan/gui/pan.ui.ssl.h
+++ b/pan/gui/pan.ui.ssl.h
@@ -63,6 +63,7 @@ const char * fallback_ui_file =
 "      </menu>\n"
 "      <menu action='view-body-pane-menu'>\n"
 "        <menuitem action='wrap-article-body' />\n"
+"        <menuitem action='show-article-sig' />\n"
 "        <menuitem action='mute-quoted-text' />\n"
 "        <menuitem action='show-all-headers' />\n"
 "        <menuitem action='monospace-font-enabled' />\n"
@@ -183,6 +184,7 @@ const char * fallback_ui_file =
 "    <toolitem action='match-only-watched-articles' />\n"
 "    <separator />\n"
 "    <toolitem action='wrap-article-body' />\n"
+"    <toolitem action='show-article-sig' />\n"
 "  </toolbar>\n"
 "\n"
 "  <popup name='header-pane-popup'>\n"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]