[Xfce4-commits] <postler:master> Add a menu item to remove the selected account
Christian Dywan
noreply at xfce.org
Sat Jun 19 06:50:03 CEST 2010
Updating branch refs/heads/master
to 15d30a403870a6d6f9caa07b9b951a5f0e725ed5 (commit)
from fbdbf66fbbf8fd19f5b3a43022c1cf855e2d0a6e (commit)
commit 15d30a403870a6d6f9caa07b9b951a5f0e725ed5
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Jun 17 21:12:17 2010 +0200
Add a menu item to remove the selected account
postler/postler-accounts.vala | 5 +++++
postler/postler-folders.vala | 22 ++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/postler/postler-accounts.vala b/postler/postler-accounts.vala
index 87e4b7f..677f793 100644
--- a/postler/postler-accounts.vala
+++ b/postler/postler-accounts.vala
@@ -164,6 +164,11 @@ public class Postler.Accounts : GLib.Object {
/* TODO: Update accountrc file */
}
+ public void remove_info (AccountInfo info) {
+ infos.remove (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-folders.vala b/postler/postler-folders.vala
index a9feaf2..8f2199c 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -295,6 +295,28 @@ public class Postler.Folders : Gtk.TreeView {
});
menu.append (menuitem);
+ bool is_account = false;
+ Gtk.TreeIter selected_iter;
+ if (get_selection ().get_selected (null, out selected_iter)) {
+ Gtk.TreeIter iter;
+ if (!store.iter_parent (out iter, selected_iter))
+ is_account = true;
+ }
+ if (is_account) {
+ menu.append (new Gtk.SeparatorMenuItem ());
+ menuitem = new Gtk.MenuItem.with_mnemonic (_("_Remove Account"));
+ menuitem.activate.connect ((menuitem) => {
+ Gtk.TreeIter iter;
+ if (get_selection ().get_selected (null, out iter)) {
+ AccountInfo? account_info;
+ store.get (iter, Columns.INFO, out account_info, -1);
+ accounts.remove_info (account_info);
+ populate ();
+ }
+ });
+ menu.append (menuitem);
+ }
+
menu.show_all ();
var event = Gtk.get_current_event ();
More information about the Xfce4-commits
mailing list