diff options
author | Logan Rathbone <poprocks@gmail.com> | 2022-01-12 01:28:20 -0500 |
---|---|---|
committer | Logan Rathbone <poprocks@gmail.com> | 2022-01-12 01:28:20 -0500 |
commit | c686bdb1b45e95acf010efd9ca0c75527fbb4dea (patch) | |
tree | e282c7e781d10d5e4a2fcfcf4cddccb6a9dac20c /src/util.c | |
parent | f139f34c514baa09100f3fd9ad556428c7d33e6f (diff) | |
download | zenity-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.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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, ...) { |