[Xfce4-commits] <postler:master> Add a button 'Save Search' to save the current search
Christian Dywan
noreply at xfce.org
Mon Jun 14 23:50:02 CEST 2010
Updating branch refs/heads/master
to 3934f0ebb5bb655ee5ff579faa415ec768d2ebc7 (commit)
from 374debf58090a1bbc3f1d28ddf0945d7c8dfef47 (commit)
commit 3934f0ebb5bb655ee5ff579faa415ec768d2ebc7
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Jun 13 23:24:23 2010 +0200
Add a button 'Save Search' to save the current search
postler/postler-accounts.vala | 5 +++++
postler/postler-bureau.vala | 30 ++++++++++++++++++++++++++++++
postler/postler-folders.vala | 4 +++-
3 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/postler/postler-accounts.vala b/postler/postler-accounts.vala
index 650d3ca..9335017 100644
--- a/postler/postler-accounts.vala
+++ b/postler/postler-accounts.vala
@@ -145,6 +145,11 @@ public class Postler.Accounts : GLib.Object {
return infos;
}
+ public void add_info (AccountInfo info) {
+ infos.append (info);
+ /* TODO: Update accountrc file */
+ }
+
string? get_tool_configuration_filename (AccountInfo info) throws GLib.FileError {
unowned string cache_dir = Environment.get_user_cache_dir ();
string cache_path = cache_dir + "/postler/mail";
diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index d72cd74..91bfc38 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -81,6 +81,8 @@ public class Postler.Bureau : Gtk.Window {
<toolitem action="SearchSubject"/>
<toolitem action="SearchSender"/>
<toolitem action="SearchRecipient"/>
+ <separator expand="true"/>
+ <toolitem action="SaveSearch"/>
</toolbar>
</ui>
""";
@@ -143,6 +145,31 @@ public class Postler.Bureau : Gtk.Window {
search_options.show ();
}
+ void action_save_search () {
+ var account_info = new AccountInfo ();
+ account_info.name = search.text;
+ account_info.type = AccountType.SEARCH;
+
+ unowned string header;
+ var action = actions.get_action ("SearchSubject") as Gtk.RadioAction;
+ switch (action.get_current_value ()) {
+ case 0:
+ header = "subject";
+ break;
+ case 1:
+ header = "from";
+ break;
+ case 2:
+ header = "to";
+ break;
+ default:
+ assert_not_reached ();
+ }
+ account_info.path = "search:" + header + "/" + search.text;
+ accounts.add_info (account_info);
+ folders.populate ();
+ }
+
void action_view_source () {
Postler.App.spawn_module ("source", content.last_location);
}
@@ -192,6 +219,8 @@ public class Postler.Bureau : Gtk.Window {
{ "Edit", null, N_("_Edit") },
{ "Search", Gtk.STOCK_FIND, null, "<Ctrl>s",
N_("Search the selected folder"), action_search },
+ { "SaveSearch", null, N_("Save Search"), "<Ctrl><Shift>s",
+ N_("Save the current search"), action_save_search },
{ "ViewSource", null, N_("View _Source"), "<Ctrl><Alt>u",
N_("View the source of the message"), action_view_source },
{ "Preferences", Gtk.STOCK_PREFERENCES, null, "<Ctrl><Alt>p",
@@ -315,6 +344,7 @@ public class Postler.Bureau : Gtk.Window {
actions.get_action ("SearchSubject").is_important = true;
actions.get_action ("SearchSender").is_important = true;
actions.get_action ("SearchRecipient").is_important = true;
+ actions.get_action ("SaveSearch").is_important = true;
messages_box.pack_start (search_options, false, false, 0);
messages = new Postler.Messages (accounts);
messages.notify["selected-location"].connect ((object, pspec) => {
diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index 59fa6fa..59c1b54 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -80,7 +80,9 @@ public class Postler.Folders : Gtk.TreeView {
}
}
- bool populate () {
+ public bool populate () {
+ store.clear ();
+
unread_monitors = {};
unread_monitors_count = 0;
/* TODO: Monitor folders for changes */
More information about the Xfce4-commits
mailing list