diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
commit | 98f3ef2689de06e8ab8b46a91acfa7dd2056a3a6 (patch) | |
tree | b98e438ac1082925e12af6dfec6d9ebeb4e3035e /src/images/icon.vala | |
parent | a824c3e5bdab686901b02667609282e7d596a6af (diff) |
Imported Upstream version 0.5.1
Diffstat (limited to 'src/images/icon.vala')
-rw-r--r-- | src/images/icon.vala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/images/icon.vala b/src/images/icon.vala index 81eb2d9..e942e7c 100644 --- a/src/images/icon.vala +++ b/src/images/icon.vala @@ -75,6 +75,24 @@ public class Icon : Image { } ///////////////////////////////////////////////////////////////////// + /// Returns the icon name for a given GLib.Icon. + ///////////////////////////////////////////////////////////////////// + + public static string get_icon_name(GLib.Icon? icon) { + if (icon != null) { + var icon_names = icon.to_string().split(" "); + + foreach (var icon_name in icon_names) { + if (Gtk.IconTheme.get_default().has_icon(icon_name)) { + return icon_name; + } + } + } + + return ""; + } + + ///////////////////////////////////////////////////////////////////// /// Returns the filename for a given system icon. ///////////////////////////////////////////////////////////////////// |