[Xfce4-commits] <postler:master> Use g_content_type_get_icon for attachment icons

Christian Dywan noreply at xfce.org
Tue Feb 15 00:34:01 CET 2011


Updating branch refs/heads/master
         to 40bec2e857e111c28a92baae61d5a25e52fe60b1 (commit)
       from f5c394902a44b6b950c53732d796b436f6ccd17c (commit)

commit 40bec2e857e111c28a92baae61d5a25e52fe60b1
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Feb 14 23:59:17 2011 +0100

    Use g_content_type_get_icon for attachment icons

 postler/postler-attachments.vala |   21 +--------------------
 1 files changed, 1 insertions(+), 20 deletions(-)

diff --git a/postler/postler-attachments.vala b/postler/postler-attachments.vala
index d1a6555..97cefcb 100644
--- a/postler/postler-attachments.vala
+++ b/postler/postler-attachments.vala
@@ -116,24 +116,6 @@ public class Postler.Attachments : Gtk.IconView {
         } while (model.iter_next (ref iter));
     }
 
-    string icon_name_for_mime_type (string mime_type) {
-        var icon_theme = Gtk.IconTheme.get_for_screen (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";
-    }
-
     void render_pixbuf (Gtk.CellLayout layout, Gtk.CellRenderer cell,
         Gtk.TreeModel model, Gtk.TreeIter iter) {
 
@@ -144,8 +126,7 @@ public class Postler.Attachments : Gtk.IconView {
         MessagePart part;
         model.get (iter, 0, out part);
 
-        string icon_name = icon_name_for_mime_type (part.mime_type);
-        cell.set ("icon-name", icon_name,
+        cell.set ("gicon", g_content_type_get_icon (part.mime_type),
                   "stock-size", attachment_icon_size);
     }
 



More information about the Xfce4-commits mailing list