[Xfce4-commits] <postler:master> Confirm removing of accounts with a dialogue

Christian Dywan noreply at xfce.org
Tue Nov 30 17:20:05 CET 2010


Updating branch refs/heads/master
         to dc8bafee16bf4beac84a009df9dee9b6f622fd70 (commit)
       from 3062139bebde6db1b2da7f4022372f037adab61a (commit)

commit dc8bafee16bf4beac84a009df9dee9b6f622fd70
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Nov 30 00:11:09 2010 +0100

    Confirm removing of accounts with a dialogue

 postler/postler-folders.vala |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index d4fab10..1afa1ca 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -429,12 +429,24 @@ public class Postler.Folders : Gtk.TreeView {
             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);
-                     accounts.remove_info (account_info);
-                     populate ();
-                 }
+                if (get_selection ().get_selected (null, out iter)) {
+                    AccountInfo? account_info;
+                    store.get (iter, Columns.INFO, out account_info);
+                    var toplevel = get_toplevel () as Gtk.Window;
+                    var dialog = new Gtk.MessageDialog (toplevel, 0,
+                        Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE,
+                        _("You are about to remove the account \"%s\"."),
+                        account_info.name);
+                    dialog.add_buttons (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+                        _("_Remove Account"), Gtk.ResponseType.OK);
+                    dialog.set_default_response (Gtk.ResponseType.CANCEL);
+                    int response = dialog.run ();
+                    dialog.destroy ();
+                    if (response == Gtk.ResponseType.OK) {
+                        accounts.remove_info (account_info);
+                        populate ();
+                    }
+                }
             });
             menu.append (menuitem);
             menuitem = new Gtk.MenuItem.with_mnemonic (_("Account _Properties"));



More information about the Xfce4-commits mailing list