mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 04:10:13 +00:00
GtkIconInfo: add gtk_icon_info_is_symbolic()
https://bugzilla.gnome.org/show_bug.cgi?id=710351
This commit is contained in:
parent
146f3a988d
commit
fd13713230
@ -6679,6 +6679,7 @@ gtk_icon_info_set_raw_coordinates
|
|||||||
gtk_icon_info_get_embedded_rect
|
gtk_icon_info_get_embedded_rect
|
||||||
gtk_icon_info_get_attach_points
|
gtk_icon_info_get_attach_points
|
||||||
gtk_icon_info_get_display_name
|
gtk_icon_info_get_display_name
|
||||||
|
gtk_icon_info_is_symbolic
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GtkIconThemeClass
|
GtkIconThemeClass
|
||||||
GTK_ICON_THEME
|
GTK_ICON_THEME
|
||||||
|
@ -3544,6 +3544,36 @@ gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info)
|
|||||||
return icon_info->cache_pixbuf;
|
return icon_info->cache_pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_icon_info_is_symbolic:
|
||||||
|
* @icon_info: a #GtkIconInfo structure
|
||||||
|
*
|
||||||
|
* Checks if the icon is symbolic or not. This currently uses only
|
||||||
|
* the file name and not the file contents for determining this.
|
||||||
|
* This behaviour may change in the future.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the icon is symbolic, %FALSE otherwise.
|
||||||
|
*
|
||||||
|
* Since: 3.12
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
gtk_icon_info_is_symbolic (GtkIconInfo *icon_info)
|
||||||
|
{
|
||||||
|
gchar *icon_uri;
|
||||||
|
gboolean is_symbolic;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GTK_IS_ICON_INFO (icon_info), FALSE);
|
||||||
|
|
||||||
|
icon_uri = NULL;
|
||||||
|
if (icon_info->icon_file)
|
||||||
|
icon_uri = g_file_get_uri (icon_info->icon_file);
|
||||||
|
|
||||||
|
is_symbolic = (icon_uri != NULL) && (g_str_has_suffix (icon_uri, "-symbolic.svg"));
|
||||||
|
g_free (icon_uri);
|
||||||
|
|
||||||
|
return is_symbolic;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean icon_info_ensure_scale_and_pixbuf (GtkIconInfo*, gboolean);
|
static gboolean icon_info_ensure_scale_and_pixbuf (GtkIconInfo*, gboolean);
|
||||||
|
|
||||||
/* Combine the icon with all emblems, the first emblem is placed
|
/* Combine the icon with all emblems, the first emblem is placed
|
||||||
@ -4329,18 +4359,12 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
|
|||||||
gboolean *was_symbolic,
|
gboolean *was_symbolic,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gchar *icon_uri;
|
|
||||||
gboolean is_symbolic;
|
gboolean is_symbolic;
|
||||||
|
|
||||||
g_return_val_if_fail (icon_info != NULL, NULL);
|
g_return_val_if_fail (icon_info != NULL, NULL);
|
||||||
g_return_val_if_fail (fg != NULL, NULL);
|
g_return_val_if_fail (fg != NULL, NULL);
|
||||||
|
|
||||||
icon_uri = NULL;
|
is_symbolic = gtk_icon_info_is_symbolic (icon_info);
|
||||||
if (icon_info->icon_file)
|
|
||||||
icon_uri = g_file_get_uri (icon_info->icon_file);
|
|
||||||
|
|
||||||
is_symbolic = (icon_uri != NULL) && (g_str_has_suffix (icon_uri, "-symbolic.svg"));
|
|
||||||
g_free (icon_uri);
|
|
||||||
|
|
||||||
if (was_symbolic)
|
if (was_symbolic)
|
||||||
*was_symbolic = is_symbolic;
|
*was_symbolic = is_symbolic;
|
||||||
@ -4396,18 +4420,12 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
|
|||||||
GdkRGBA error_color;
|
GdkRGBA error_color;
|
||||||
GdkRGBA *error_colorp;
|
GdkRGBA *error_colorp;
|
||||||
GtkStateFlags state;
|
GtkStateFlags state;
|
||||||
gchar *icon_uri;
|
|
||||||
gboolean is_symbolic;
|
gboolean is_symbolic;
|
||||||
|
|
||||||
g_return_val_if_fail (icon_info != NULL, NULL);
|
g_return_val_if_fail (icon_info != NULL, NULL);
|
||||||
g_return_val_if_fail (context != NULL, NULL);
|
g_return_val_if_fail (context != NULL, NULL);
|
||||||
|
|
||||||
icon_uri = NULL;
|
is_symbolic = gtk_icon_info_is_symbolic (icon_info);
|
||||||
if (icon_info->icon_file)
|
|
||||||
icon_uri = g_file_get_uri (icon_info->icon_file);
|
|
||||||
|
|
||||||
is_symbolic = (icon_uri != NULL) && (g_str_has_suffix (icon_uri, "-symbolic.svg"));
|
|
||||||
g_free (icon_uri);
|
|
||||||
|
|
||||||
if (was_symbolic)
|
if (was_symbolic)
|
||||||
*was_symbolic = is_symbolic;
|
*was_symbolic = is_symbolic;
|
||||||
@ -4542,7 +4560,6 @@ gtk_icon_info_load_symbolic_async (GtkIconInfo *icon_info,
|
|||||||
{
|
{
|
||||||
GTask *task;
|
GTask *task;
|
||||||
AsyncSymbolicData *data;
|
AsyncSymbolicData *data;
|
||||||
gchar *icon_uri;
|
|
||||||
SymbolicPixbufCache *symbolic_cache;
|
SymbolicPixbufCache *symbolic_cache;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
@ -4554,12 +4571,7 @@ gtk_icon_info_load_symbolic_async (GtkIconInfo *icon_info,
|
|||||||
data = g_slice_new0 (AsyncSymbolicData);
|
data = g_slice_new0 (AsyncSymbolicData);
|
||||||
g_task_set_task_data (task, data, (GDestroyNotify) async_symbolic_data_free);
|
g_task_set_task_data (task, data, (GDestroyNotify) async_symbolic_data_free);
|
||||||
|
|
||||||
icon_uri = NULL;
|
data->is_symbolic = gtk_icon_info_is_symbolic (icon_info);
|
||||||
if (icon_info->icon_file)
|
|
||||||
icon_uri = g_file_get_uri (icon_info->icon_file);
|
|
||||||
|
|
||||||
data->is_symbolic = (icon_uri != NULL) && (g_str_has_suffix (icon_uri, "-symbolic.svg"));
|
|
||||||
g_free (icon_uri);
|
|
||||||
|
|
||||||
if (!data->is_symbolic)
|
if (!data->is_symbolic)
|
||||||
{
|
{
|
||||||
@ -4814,18 +4826,12 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
|
|||||||
GdkRGBA *warning_colorp;
|
GdkRGBA *warning_colorp;
|
||||||
GdkRGBA error_color;
|
GdkRGBA error_color;
|
||||||
GdkRGBA *error_colorp;
|
GdkRGBA *error_colorp;
|
||||||
gchar *icon_uri;
|
|
||||||
gboolean is_symbolic;
|
gboolean is_symbolic;
|
||||||
|
|
||||||
g_return_val_if_fail (icon_info != NULL, NULL);
|
g_return_val_if_fail (icon_info != NULL, NULL);
|
||||||
g_return_val_if_fail (style != NULL, NULL);
|
g_return_val_if_fail (style != NULL, NULL);
|
||||||
|
|
||||||
icon_uri = NULL;
|
is_symbolic = gtk_icon_info_is_symbolic (icon_info);
|
||||||
if (icon_info->icon_file)
|
|
||||||
icon_uri = g_file_get_uri (icon_info->icon_file);
|
|
||||||
|
|
||||||
is_symbolic = (icon_uri != NULL) && (g_str_has_suffix (icon_uri, "-symbolic.svg"));
|
|
||||||
g_free (icon_uri);
|
|
||||||
|
|
||||||
if (was_symbolic)
|
if (was_symbolic)
|
||||||
*was_symbolic = is_symbolic;
|
*was_symbolic = is_symbolic;
|
||||||
|
@ -267,6 +267,8 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
const gchar * gtk_icon_info_get_filename (GtkIconInfo *icon_info);
|
const gchar * gtk_icon_info_get_filename (GtkIconInfo *icon_info);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
|
GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
|
||||||
|
GDK_AVAILABLE_IN_3_12
|
||||||
|
gboolean gtk_icon_info_is_symbolic (GtkIconInfo *icon_info);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
|
GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
Loading…
Reference in New Issue
Block a user