[Xfce4-commits] <postler:master> Implement deleting attachments with Delete key

Christian Dywan noreply at xfce.org
Sat Dec 4 04:18:01 CET 2010


Updating branch refs/heads/master
         to 6707d355d897d6d252a509aafae84b902500dc48 (commit)
       from 6a6407b9d699e59e852bf71f5e0c68e58371be55 (commit)

commit 6707d355d897d6d252a509aafae84b902500dc48
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Dec 4 01:40:09 2010 +0100

    Implement deleting attachments with Delete key

 postler/postler-composer.vala |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 29600ca..3c9504e 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -280,8 +280,7 @@ public class Postler.Composer : Gtk.Window {
         attachments.get_iter_first (out att_iter);
     }
 
-    void remove_attachment (Gtk.CellRendererToggle renderer,
-                            string                 path) {
+    void remove_attachment (string path) {
         Gtk.TreeIter att_iter = Gtk.TreeIter ();
         if (!attachments.get_iter_from_string (out att_iter, path))
             return;
@@ -403,9 +402,21 @@ public class Postler.Composer : Gtk.Window {
             new Gtk.CellRendererText (), "text", 0);
         att_view.insert_column_with_attributes (1, "", attachment_del, "stock-id", 0);
         att_view.get_column (0).expand = true;
-        attachment_del.toggled.connect (remove_attachment);
+        attachment_del.toggled.connect ((renderer, path) => {
+            remove_attachment (path);
+        });
         att_view.set_model (attachments);
         att_view.set_no_show_all (true);
+        att_view.key_press_event.connect ((event) => {
+            if (event.keyval == Gdk.keyval_from_name ("Delete")) {
+                var paths = att_view.get_selection ().get_selected_rows (null);
+                var path = paths.nth_data (0);
+                if (path != null)
+                    remove_attachment (path.to_string ());
+                return true;
+            }
+            return false;
+        });
         shelf.pack_start (att_view, true, true, 0);
         shelf.show_all ();
 



More information about the Xfce4-commits mailing list