[Xfce4-commits] <postler:master> Add Bug Tracker and Mailing List search options

Christian Dywan noreply at xfce.org
Sun Jul 10 06:42:05 CEST 2011


Updating branch refs/heads/master
         to 0b70438f009ba519170c4ccaafd90cb3cf796f82 (commit)
       from c9c53a6e10aa3ed74a6ae7107a27646dfb4867d4 (commit)

commit 0b70438f009ba519170c4ccaafd90cb3cf796f82
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jul 10 04:56:44 2011 +0200

    Add Bug Tracker and Mailing List search options

 postler/postler-bureau.vala |   49 +++++++++++++++---------------------------
 1 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index c7a517a..1c2df7f 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -94,8 +94,10 @@ public class Postler.Bureau : Gtk.Window {
                 <toolitem action="SearchAny"/>
                 <toolitem action="SearchSubject"/>
                 <toolitem action="SearchSender"/>
-                <toolitem action="SearchRecipient"/>
-                <toolitem action="SearchBody"/>
+                <toolitem action="SearchRecipients"/>
+                <toolitem action="SearchExcerpt"/>
+                <toolitem action="SearchProject"/>
+                <toolitem action="SearchList"/>
                 <separator expand="true"/>
                 <toolitem action="SaveSearch"/>
             </toolbar>
@@ -173,27 +175,13 @@ public class Postler.Bureau : Gtk.Window {
 
     string get_search_uri () {
         var action = actions.get_action ("SearchSubject") as Gtk.RadioAction;
-        string field;
-        switch (action.get_current_value ()) {
-        case 0:
-            field = "any";
-            break;
-        case 1:
-            field = "subject";
-            break;
-        case 2:
-            field = "sender";
-            break;
-        case 3:
-            field = "recipients";
-            break;
-        case 4:
-            field = "excerpt";
-            break;
-        default:
-            assert_not_reached ();
+        foreach (var the_action in action.get_group ()) {
+            if (the_action.value != action.get_current_value ())
+                continue;
+            string field = ascii_strdown (the_action.name.substring (6));
+            return "search:%s/%s".printf (field, search.get_text ());
         }
-        return "search:%s/%s".printf (field, search.get_text ());
+        assert_not_reached ();
     }
 
     void search_apply () {
@@ -408,11 +396,15 @@ public class Postler.Bureau : Gtk.Window {
           N_("Search messages by subject"), 1 },
         { "SearchSender", null, N_("S_ender"), "",
           N_("Search messages by sender"), 2 },
-        { "SearchRecipient", null, N_("_Recipient"), "",
+        { "SearchRecipients", null, N_("_Recipient"), "",
           N_("Search messages by recipient"), 3 },
         /* i18n: The text contents of a message, when searching */
-        { "SearchBody", null, N_("_Body"), "",
-          N_("Search the full message text"), 4}
+        { "SearchExcerpt", null, N_("_Body"), "",
+          N_("Search the full message text"), 4},
+        { "SearchProject", null, N_("Bug _Tracker"), "",
+          N_("Search bug trackers by that name"), 5},
+        { "SearchList", null, N_("Mailing _List"), "",
+          N_("Search mailing lists by that name"), 6}
     };
 
     void account_check (AccountInfo? account_info) {
@@ -725,16 +717,11 @@ public class Postler.Bureau : Gtk.Window {
         #if HAVE_GTK3
         search_options.get_style_context ().add_class ("secondary-toolbar");
         #endif
-        actions.get_action ("SearchAny").is_important = true;
-        actions.get_action ("SearchSubject").is_important = true;
-        actions.get_action ("SearchSender").is_important = true;
-        actions.get_action ("SearchRecipient").is_important = true;
-        actions.get_action ("SearchBody").is_important = true;
-        actions.get_action ("SaveSearch").is_important = true;
         /* Implement mnemonics for search buttons */
         foreach (var button in search_options.get_children ()) {
             if (button is Gtk.ToolButton) {
                 var toolbutton = button as Gtk.ToolButton;
+                toolbutton.is_important = true;
                 var label = new Gtk.Label.with_mnemonic (toolbutton.label);
                 toolbutton.label_widget = label;
             }



More information about the Xfce4-commits mailing list