diff options
author | Alexander Larsson <alexl@redhat.com> | 2020-02-06 17:33:19 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2020-02-06 17:47:57 +0100 |
commit | a772bf75178f886c324ce48dfd1e2616ec7bda82 (patch) | |
tree | 3b904e7e52cc517331e5ccf2f1d33367f6470c07 | |
parent | 57ecb2829a725b8ece788e70cd68c228cbe455b7 (diff) | |
download | gtk+-a772bf75178f886c324ce48dfd1e2616ec7bda82.tar.gz |
Add gtk_icon_paintable_get_resource_path()
Also, return NULL from gtk_icon_paintable_get_filename() if the path
is really a resource path.
-rw-r--r-- | docs/reference/gtk/gtk4-sections.txt | 1 | ||||
-rw-r--r-- | gtk/gtkicontheme.c | 23 | ||||
-rw-r--r-- | gtk/gtkicontheme.h | 8 |
3 files changed, 28 insertions, 4 deletions
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 3316829a80..aa7726bb53 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -5010,6 +5010,7 @@ gtk_icon_theme_lookup_by_gicon gtk_icon_theme_list_icons gtk_icon_theme_get_icon_sizes gtk_icon_paintable_get_filename +gtk_icon_paintable_get_resource_path gtk_icon_paintable_get_icon_name gtk_icon_paintable_is_symbolic <SUBSECTION Standard> diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 65459be8e3..5c4ce8160c 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -3130,7 +3130,28 @@ gtk_icon_paintable_get_filename (GtkIconPaintable *icon) { g_return_val_if_fail (icon != NULL, NULL); - return icon->filename; + if (!icon->is_resource) + return icon->filename; + return NULL; +} + +/** + * gtk_icon_paintable_get_resource_path: + * @self: a #GtkIcon + * + * Gets the resource path for the icon. + * + * Returns: (nullable) (type filename): the resource for the icon, or %NULL + * if the icon is not represented by a resource. + */ +const gchar * +gtk_icon_paintable_get_resource_path (GtkIconPaintable *icon) +{ + g_return_val_if_fail (icon != NULL, NULL); + + if (icon->is_resource) + return icon->filename; + return NULL; } /** diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h index 2a3366b7d5..afc79e5a18 100644 --- a/gtk/gtkicontheme.h +++ b/gtk/gtkicontheme.h @@ -137,11 +137,13 @@ GDK_AVAILABLE_IN_ALL GType gtk_icon_paintable_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL -const gchar * gtk_icon_paintable_get_filename (GtkIconPaintable *self); +const gchar * gtk_icon_paintable_get_filename (GtkIconPaintable *self); GDK_AVAILABLE_IN_ALL -const gchar * gtk_icon_paintable_get_icon_name (GtkIconPaintable *self); +const gchar * gtk_icon_paintable_get_resource_path (GtkIconPaintable *self); GDK_AVAILABLE_IN_ALL -gboolean gtk_icon_paintable_is_symbolic (GtkIconPaintable *self); +const gchar * gtk_icon_paintable_get_icon_name (GtkIconPaintable *self); +GDK_AVAILABLE_IN_ALL +gboolean gtk_icon_paintable_is_symbolic (GtkIconPaintable *self); G_END_DECLS |