[Xfce4-commits] <postler:master> Allow clicking status icon to toggle read/ unread
Christian Dywan
noreply at xfce.org
Sat Nov 6 21:02:01 CET 2010
Updating branch refs/heads/master
to 4a357d8431f68c9ae2ec882b3bcc181e6d0727f1 (commit)
from 89124c4b9a06c63d6e34d65eae398062fdf650cb (commit)
commit 4a357d8431f68c9ae2ec882b3bcc181e6d0727f1
Author: Christian Dywan <christian at twotoasts.de>
Date: Sat Nov 6 21:00:07 2010 +0100
Allow clicking status icon to toggle read/ unread
postler/postler-messages.vala | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 76d5919..94ca777 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -190,6 +190,17 @@ public class Postler.Messages : Gtk.TreeView {
toggle_message_flag (sort_iter, ref location, 'F');
}
+ void renderer_status_toggled (Gtk.CellRendererToggle renderer,
+ string path) {
+ Gtk.TreeIter sort_iter = Gtk.TreeIter ();
+ if (!sort.get_iter_from_string (out sort_iter, path))
+ return;
+
+ string location;
+ sort.get (sort_iter, Columns.LOCATION, out location);
+ toggle_message_flag (sort_iter, ref location, 'S');
+ }
+
public Messages (Accounts accounts) {
this.accounts = accounts;
store = new Gtk.TreeStore (9, typeof (bool), typeof (string),
@@ -208,8 +219,10 @@ public class Postler.Messages : Gtk.TreeView {
column.add_attribute (renderer_flag, "active", Columns.FLAGGED);
renderer_flag.toggled.connect (renderer_flag_toggled);
insert_column (column, -1);
+ var renderer_status = new Postler.CellRendererToggle ();
insert_column_with_attributes (-1, _("Status"),
- new Gtk.CellRendererPixbuf (), "stock-id", Columns.STATUS);
+ renderer_status, "stock-id", Columns.STATUS);
+ renderer_status.toggled.connect (renderer_status_toggled);
column = new Gtk.TreeViewColumn ();
column.set_title (_("Subject"));
var renderer_text = new Gtk.CellRendererText ();
@@ -828,8 +841,15 @@ public class Postler.Messages : Gtk.TreeView {
GLib.List<Gtk.TreePath> paths = get_selection ().get_selected_rows (null);
Gtk.TreeIter sort_iter = Gtk.TreeIter ();
var path = paths.nth_data (0);
- if (path != null && sort.get_iter (out sort_iter, path))
- display_message (sort_iter);
+ if (path != null && sort.get_iter (out sort_iter, path)) {
+ Gtk.TreeViewColumn column;
+ get_path_at_pos ((int)event.x, (int)event.y, null,
+ out column, null, null);
+ unowned string title = column.get_title ();
+ /* Clickable icons should not display/ mark as read */
+ if (title != _("Status") && title != _("Flagged"))
+ display_message (sort_iter);
+ }
return base.button_release_event (event);
}
More information about the Xfce4-commits
mailing list