Updating branch refs/heads/master to ecbf352d113eb5dedb5c7d0714ca9020a280f44d (commit) from 411cb0c636c71afdd290087f38645f81fbd6c138 (commit)
commit ecbf352d113eb5dedb5c7d0714ca9020a280f44d Author: Christian Dywan <christ...@twotoasts.de> Date: Tue Nov 23 22:28:43 2010 +0100 Use toggle buttons for message parts postler/postler-content.vala | 3 ++- postler/postler-viewer.vala | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/postler/postler-content.vala b/postler/postler-content.vala index 9f5e376..f17d512 100644 --- a/postler/postler-content.vala +++ b/postler/postler-content.vala @@ -28,7 +28,7 @@ public class Postler.Content : WebKit.WebView { public string default_charset { get; set; default = "ISO-8859-1"; } public string? last_location { get; set; } - public uint? current_part { get; set; } + public uint? current_part { get; private set; } public string? sender { get; set; } public string? recipient { get; set; } public string? subject { get; set; } @@ -808,6 +808,7 @@ public class Postler.Content : WebKit.WebView { display_error (_("Failed to display message part \"%s\": %s").printf ( mime_type, contents_error.message)); } + current_part = part; } void display_error (string message) { diff --git a/postler/postler-viewer.vala b/postler/postler-viewer.vala index f019220..3e90d62 100644 --- a/postler/postler-viewer.vala +++ b/postler/postler-viewer.vala @@ -13,6 +13,7 @@ public class Postler.Viewer : Gtk.VBox { Gtk.InfoBar infobar; Postler.Content content; Gtk.VBox message_parts; + Gtk.ToggleButton last_button; Gtk.Toolbar findbar; Gtk.Entry find_entry; @@ -119,15 +120,21 @@ public class Postler.Viewer : Gtk.VBox { string icon_name = icon_name_for_mime_type (part, this); var icon = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.BUTTON); - var button = new Gtk.Button (); + var button = new Gtk.ToggleButton (); button.relief = Gtk.ReliefStyle.NONE; button.add (icon); button.set_tooltip_text (part); button.set_data ("index", index); + if (index == content.current_part) { + last_button = button; + button.active = true; + } button.clicked.connect ((button) => { + last_button.active = false; + last_button = button as Gtk.ToggleButton; uint current_part = button.get_data ("index"); - content.current_part = current_part; - content.display_part (content.current_part); }); + content.display_part (current_part); + }); message_parts.pack_start (button, false, false, 0); index++; } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits