* or stock items, rather than directly, but looking up icons
* directly is also simple. The #GtkIconTheme object acts
* as a database of all the icons in the current theme. You
- * can create new #GtkIconTheme objects, but its much more
+ * can create new #GtkIconTheme objects, but it's much more
* efficient to use the standard icon theme for the #GdkScreen
* so that the icon information is shared with other people
* looking up icons. In the case where the default screen is
g_list_length (priv->info_cache_lru)));
priv->info_cache_lru = g_list_delete_link (priv->info_cache_lru, l);
- gtk_icon_info_free (icon_info);
+ g_object_unref (icon_info);
}
}
ensure_lru_cache_space (icon_theme);
/* prepend new info to LRU */
priv->info_cache_lru = g_list_prepend (priv->info_cache_lru,
- gtk_icon_info_copy (icon_info));
+ g_object_ref (icon_info));
}
static void
g_list_length (priv->info_cache_lru)));
priv->info_cache_lru = g_list_remove (priv->info_cache_lru, icon_info);
- gtk_icon_info_free (icon_info);
+ g_object_unref (icon_info);
}
}
icon_info->key.size, icon_info->key.flags,
g_hash_table_size (priv->info_cache)));
- icon_info = gtk_icon_info_copy (icon_info);
+ icon_info = g_object_ref (icon_info);
remove_from_lru_cache (icon_theme, icon_info);
return icon_info;
* gtk_icon_info_load_icon(). (gtk_icon_theme_load_icon()
* combines these two steps if all you need is the pixbuf.)
*
- * Return value: a #GtkIconInfo structure containing information
- * about the icon, or %NULL if the icon wasn't found. Free with
- * gtk_icon_info_free()
+ * Return value: (transfer full): a #GtkIconInfo object containing information
+ * about the icon, or %NULL if the icon wasn't found.
*
* Since: 2.4
*/
* tries them all in the given order before falling back to
* inherited icon themes.
*
- * Return value: a #GtkIconInfo structure containing information
- * about the icon, or %NULL if the icon wasn't found. Free with
- * gtk_icon_info_free()
+ * Return value: (transfer full): a #GtkIconInfo object containing information
+ * about the icon, or %NULL if the icon wasn't found.
*
* Since: 2.12
*/
}
pixbuf = gtk_icon_info_load_icon (icon_info, error);
- gtk_icon_info_free (icon_info);
+ g_object_unref (icon_info);
return pixbuf;
}
dup->icon_file = g_object_ref (icon_info->icon_file);
if (icon_info->loadable)
dup->loadable = g_object_ref (icon_info->loadable);
+ if (icon_info->pixbuf)
+ dup->pixbuf = g_object_ref (icon_info->pixbuf);
for (l = icon_info->emblem_infos; l != NULL; l = l->next)
{
}
/**
- * gtk_icon_info_copy:
+ * gtk_icon_info_copy: (skip)
* @icon_info: a #GtkIconInfo
*
* Make a copy of a #GtkIconInfo.
* Return value: the new GtkIconInfo
*
* Since: 2.4
+ *
+ * Deprecated: 3.8: Use g_object_ref()
**/
GtkIconInfo *
gtk_icon_info_copy (GtkIconInfo *icon_info)
}
/**
- * gtk_icon_info_free:
+ * gtk_icon_info_free: (skip)
* @icon_info: a #GtkIconInfo
*
* Free a #GtkIconInfo and associated information
*
* Since: 2.4
+ *
+ * Deprecated: 3.8: Use g_object_unref()
**/
void
gtk_icon_info_free (GtkIconInfo *icon_info)
if (icon_info->loadable)
g_object_unref (icon_info->loadable);
- g_slist_free_full (icon_info->emblem_infos, (GDestroyNotify) gtk_icon_info_free);
+ g_slist_free_full (icon_info->emblem_infos, (GDestroyNotify) g_object_unref);
if (icon_info->pixbuf)
g_object_unref (icon_info->pixbuf);
if (icon_info->cache_pixbuf)
if (icon_theme != NULL)
ensure_in_lru_cache (icon_theme, icon_info);
- gtk_icon_info_free (icon_info);
+ g_object_unref (icon_info);
}
/**
gdk_pixbuf_get_height (icon_info->pixbuf),
gdk_pixbuf_get_rowstride (icon_info->pixbuf),
proxy_pixbuf_destroy,
- gtk_icon_info_copy (icon_info));
+ g_object_ref (icon_info));
return icon_info->proxy_pixbuf;
}
if (icon_theme != NULL)
ensure_in_lru_cache (icon_theme, icon_info);
- gtk_icon_info_free (icon_info);
+ g_object_unref (icon_info);
}
static GdkPixbuf *
gdk_pixbuf_get_height (symbolic_cache->pixbuf),
gdk_pixbuf_get_rowstride (symbolic_cache->pixbuf),
proxy_symbolic_pixbuf_destroy,
- gtk_icon_info_copy (icon_info));
+ g_object_ref (icon_info));
return symbolic_cache->proxy_pixbuf;
}
}
/**
- * gtk_icon_info_load_symbolic_async:
+ * gtk_icon_info_load_symbolic_for_context_async:
* @icon_info: a #GtkIconInfo structure from gtk_icon_theme_lookup_icon()
* @context: a #GtkStyleContext
* @cancellable: (allow-none): optional #GCancellable object,
* The icon can then be rendered into a pixbuf using
* gtk_icon_info_load_icon().
*
- * Return value: a #GtkIconInfo structure containing
+ * Return value: (transfer full): a #GtkIconInfo structure containing
* information about the icon, or %NULL if the icon
- * wasn't found. Free with gtk_icon_info_free()
+ * wasn't found. Unref with g_object_unref()
*
* Since: 2.14
*/
{
GIcon *base, *emblem;
GList *list, *l;
- GtkIconInfo *emblem_info;
+ GtkIconInfo *base_info, *emblem_info;
if (GTK_IS_NUMERABLE_ICON (icon))
_gtk_numerable_icon_set_background_icon_size (GTK_NUMERABLE_ICON (icon), size / 2);
base = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (icon));
- info = gtk_icon_theme_lookup_by_gicon (icon_theme, base, size, flags);
- if (info)
+ base_info = gtk_icon_theme_lookup_by_gicon (icon_theme, base, size, flags);
+ if (base_info)
{
+ info = icon_info_dup (base_info);
+ g_object_unref (base_info);
+
list = g_emblemed_icon_get_emblems (G_EMBLEMED_ICON (icon));
for (l = list; l; l = l->next)
{
if (emblem_info)
info->emblem_infos = g_slist_prepend (info->emblem_infos, emblem_info);
}
- }
- return info;
+ return info;
+ }
+ else
+ return NULL;
}
else if (GDK_IS_PIXBUF (icon))
{
*
* Creates a #GtkIconInfo for a #GdkPixbuf.
*
- * Returns: a #GtkIconInfo
+ * Return value: (transfer full): a #GtkIconInfo
*
* Since: 2.14
*/