summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2022-01-12 01:28:20 -0500
committerLogan Rathbone <poprocks@gmail.com>2022-01-12 01:28:20 -0500
commitc686bdb1b45e95acf010efd9ca0c75527fbb4dea (patch)
treee282c7e781d10d5e4a2fcfcf4cddccb6a9dac20c /src/util.c
parentf139f34c514baa09100f3fd9ad556428c7d33e6f (diff)
downloadzenity-c686bdb1b45e95acf010efd9ca0c75527fbb4dea.tar.gz
Icon handling improvements.
Update manpage to reflect proper usage of --icon. Add handling of zenity3 --window-icon option, with deprecation warning.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index dfd54ee..ec60ba3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -48,6 +48,30 @@
#define ZENITY_EXTRA_DEFAULT 127
#define ZENITY_UI_RESOURCE_PATH RESOURCE_BASE_PATH "/zenity.ui"
+GIcon *
+zenity_util_gicon_from_string (const char *str)
+{
+ GIcon *icon = NULL;
+ g_autoptr(GFile) icon_file = NULL;
+
+ if (str)
+ {
+ icon_file = g_file_new_for_path (str);
+
+ if (g_file_query_exists (icon_file, NULL))
+ {
+ icon = g_file_icon_new (icon_file);
+ }
+ else
+ {
+ g_debug (_("Icon filename %s not found; trying theme icon."), str);
+ icon = g_themed_icon_new_with_default_fallbacks (str);
+ }
+ }
+
+ return icon;
+}
+
GtkBuilder *
zenity_util_load_ui_file (const char *root_widget, ...)
{