Updating branch refs/heads/master to b295c4e6dfd9229c63ddd234b508e6141c93efe6 (commit) from c266328fcee3b82380f82d7a8eebd56438589625 (commit)
commit b295c4e6dfd9229c63ddd234b508e6141c93efe6 Author: Christian Dywan <christ...@twotoasts.de> Date: Fri Jun 4 22:56:50 2010 +0200 Implement a message part pane beside the content postler/postler-bureau.vala | 50 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 49 insertions(+), 1 deletions(-) diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala index c7dbd5a..e27c334 100644 --- a/postler/postler-bureau.vala +++ b/postler/postler-bureau.vala @@ -21,6 +21,7 @@ public class Postler.Bureau : Gtk.Window { Postler.Folders folders; Postler.Messages messages; Postler.Content content; + Gtk.VBox message_parts; const string ui_markup = """ <ui> @@ -169,6 +170,24 @@ public class Postler.Bureau : Gtk.Window { false } }; + static string icon_name_for_mime_type (string mime_type, Gtk.Widget widget) { + var icon_theme = Gtk.IconTheme.get_for_screen (widget.get_screen ()); + var parts = mime_type.split ("/", 2); + string icon_name = parts[0] + "-" + parts[1]; + if (icon_theme.has_icon (icon_name)) + return icon_name; + icon_name = "gnome-mime-" + parts[0] + "-" + parts[1]; + if (icon_theme.has_icon (icon_name)) + return icon_name; + icon_name = parts[0] + "-x-generic"; + if (icon_theme.has_icon (icon_name)) + return icon_name; + icon_name = "gnome-mime-" + parts[0] + "-x-generic"; + if (icon_theme.has_icon (icon_name)) + return icon_name; + return "application-x-executable"; + } + public Bureau () { GLib.Object (icon_name: STOCK_INTERNET_MAIL, title: GLib.Environment.get_application_name ()); @@ -277,9 +296,38 @@ public class Postler.Bureau : Gtk.Window { bool state = content.last_location != null; actions.get_action ("ViewSource").sensitive = state; }); + var content_box = new Gtk.HBox (false, 0); + vpaned.pack2 (content_box, false, true); scrolled = new Postler.ScrolledWindow (content); - vpaned.pack2 (scrolled, false, true); + content_box.pack_start (scrolled, true, true, 0); + message_parts = new Gtk.VBox (false, 0); + content.notify["n-parts"].connect ((object, pspec) => { + var scrollable = message_parts.parent.parent; + if (content.n_parts == 1) { + scrollable.hide (); + return; + } + + var children = message_parts.get_children (); + foreach (var child in children) + child.destroy (); + var parts = content.get_parts (); + foreach (var part in parts) { + 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 (); + button.relief = Gtk.ReliefStyle.NONE; + button.add (icon); + button.set_tooltip_text (part); + message_parts.pack_start (button, false, false, 0); + } + scrollable.show_all (); + }); + scrolled = new Postler.ScrolledWindow (message_parts); + content_box.pack_start (scrolled, false, false, 0); shelf.show_all (); + scrolled.hide (); folders.set_headers_visible (false); messages.set_headers_visible (false); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits