[Xfce4-commits] <postler:master> Add Remove icon to attachment treeview in composer
Christian Dywan
noreply at xfce.org
Thu Dec 2 04:26:05 CET 2010
Updating branch refs/heads/master
to 6a6407b9d699e59e852bf71f5e0c68e58371be55 (commit)
from 5ed41e952b42a88e1a6957de148b6896b312f59e (commit)
commit 6a6407b9d699e59e852bf71f5e0c68e58371be55
Author: Bernd Prünster <bernd.pruenster at gmail.com>
Date: Thu Dec 2 02:30:56 2010 +0100
Add Remove icon to attachment treeview in composer
postler/postler-composer.vala | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 695bb56..29600ca 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -280,6 +280,16 @@ public class Postler.Composer : Gtk.Window {
attachments.get_iter_first (out att_iter);
}
+ void remove_attachment (Gtk.CellRendererToggle renderer,
+ string path) {
+ Gtk.TreeIter att_iter = Gtk.TreeIter ();
+ if (!attachments.get_iter_from_string (out att_iter, path))
+ return;
+
+ attachments.remove (att_iter);
+ if (attachments.length == 0)
+ att_view.visible = false;
+ }
void action_insert_emoticon (Gtk.Action action) {
unowned string name = action.name;
string emoticon;
@@ -384,9 +394,16 @@ public class Postler.Composer : Gtk.Window {
var scrolled = new Postler.ScrolledWindow (content);
shelf.pack_start (scrolled, true, true, 0);
att_view = new Gtk.TreeView ();
- attachments = new Gtk.ListStore (2, typeof (string), typeof (long));
+ var attachment_del = new Postler.CellRendererToggle ();
+ attachment_del.stock_id = Gtk.STOCK_REMOVE;
+ attachment_del.prelight_stock_id = Gtk.STOCK_REMOVE;
+ attachment_del.width = 32;
+ attachments = new Gtk.ListStore (2, typeof (string), typeof (ulong));
att_view.insert_column_with_attributes (-1, "Attachments",
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);
att_view.set_model (attachments);
att_view.set_no_show_all (true);
shelf.pack_start (att_view, true, true, 0);
More information about the Xfce4-commits
mailing list