summaryrefslogtreecommitdiff
path: root/src/images/icon.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/images/icon.vala')
-rw-r--r--src/images/icon.vala18
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.
/////////////////////////////////////////////////////////////////////