case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
- icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+ icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, 1, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
return GDK_PAINTABLE (icon_info);
icon_theme = gtk_icon_theme_get_default ();
icon = gtk_icon_theme_lookup_icon (icon_theme,
"gtk3-demo",
- 32,
+ 32, 1,
GTK_ICON_LOOKUP_GENERIC_FALLBACK);
texture = gtk_icon_download_texture (icon, NULL);
g_object_unref (icon);
icon_name = gtk_image_get_icon_name (image);
size = gtk_image_get_pixel_size (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
- icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size,
+ icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size, 1,
GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
name = gtk_image_get_icon_name (GTK_IMAGE (data));
- info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, -1, 0);
+ info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, 32, 1, 0);
file = g_file_new_for_path (gtk_icon_get_filename (info));
g_value_set_object (value, file);
g_object_unref (file);
if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
scale = roundf ([[NSScreen mainScreen] backingScaleFactor]);
#endif
- info = gtk_icon_theme_lookup_by_gicon_for_scale (theme, icon, ICON_SIZE, scale, GTK_ICON_LOOKUP_USE_BUILTIN);
+ info = gtk_icon_theme_lookup_by_gicon (theme, icon, ICON_SIZE, scale, GTK_ICON_LOOKUP_USE_BUILTIN);
if (info != NULL)
{
/* fall back to a missing image */
theme = gtk_icon_theme_get_default ();
- icon = gtk_icon_theme_lookup_icon (theme, "image-missing", 16,
+ icon = gtk_icon_theme_lookup_icon (theme, "image-missing", 16, 1,
GTK_ICON_LOOKUP_USE_BUILTIN);
texture = gtk_icon_download_texture (icon, NULL);
pixbuf = gdk_pixbuf_get_from_texture (texture);
drag = gdk_drag_begin (surface, device, content, GDK_ACTION_COPY, start_x, start_y);
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
- icon = gtk_icon_theme_lookup_icon (theme, "text-x-generic", 32, 0);
+ icon = gtk_icon_theme_lookup_icon (theme, "text-x-generic", 32, 1, 0);
gtk_drag_icon_set_from_paintable (drag, GDK_PAINTABLE (icon), 0, 0);
g_clear_object (&icon);
}
else
{
- icon_info = gtk_icon_theme_lookup_icon_for_scale (icon_theme->icon_theme,
- icon_theme->name,
- size,
- icon_theme->scale,
- GTK_ICON_LOOKUP_USE_BUILTIN);
+ icon_info = gtk_icon_theme_lookup_icon (icon_theme->icon_theme,
+ icon_theme->name,
+ size,
+ icon_theme->scale,
+ GTK_ICON_LOOKUP_USE_BUILTIN);
if (icon_info == NULL)
icon_info = gtk_icon_theme_lookup_icon (icon_theme->icon_theme,
"image-missing",
- size,
+ size, icon_theme->scale,
GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
g_assert (icon_info != NULL);
GtkIconTheme *theme;
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
- source->paintable = GDK_PAINTABLE(gtk_icon_theme_lookup_icon (theme, "text-x-generic", 32, 0));
+ source->paintable = GDK_PAINTABLE(gtk_icon_theme_lookup_icon (theme, "text-x-generic", 32, 1, 0));
source->hot_x = 0;
source->hot_y = 0;
}
width = height = gtk_icon_helper_get_size (self);
- info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme,
- gicon,
- MIN (width, height),
- scale, flags);
+ info = gtk_icon_theme_lookup_by_gicon (icon_theme,
+ gicon,
+ MIN (width, height),
+ scale, flags);
if (info == NULL)
info = gtk_icon_theme_lookup_icon (icon_theme,
"image-missing",
- width,
+ width, scale,
flags | GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
*symbolic = gtk_icon_is_symbolic (info);
}
/**
- * gtk_icon_theme_lookup_icon:
- * @self: a #GtkIconTheme
- * @icon_name: the name of the icon to lookup
- * @size: desired icon size
- * @flags: flags modifying the behavior of the icon lookup
- *
- * Looks up a named icon and returns a #GtkIcon containing
- * information such as the filename of the icon. The icon
- * can then be rendered into a pixbuf using
- * gtk_icon_load_icon(). (gtk_icon_theme_load_icon()
- * combines these two steps if all you need is the pixbuf.)
- *
- * When rendering on displays with high pixel densities you should not
- * use a @size multiplied by the scaling factor returned by functions
- * like gdk_surface_get_scale_factor(). Instead, you should use
- * gtk_icon_theme_lookup_icon_for_scale(), as the assets loaded
- * for a given scaling factor may be different.
- *
- * This call is threadsafe, you can safely pass a GtkIconTheme
- * to another thread and call this method on it.
- *
- * Returns: (nullable) (transfer full): a #GtkIcon object
- * containing information about the icon, or %NULL if the
- * icon wasn’t found.
- */
-GtkIcon *
-gtk_icon_theme_lookup_icon (GtkIconTheme *self,
- const gchar *icon_name,
- gint size,
- GtkIconLookupFlags flags)
-{
- g_return_val_if_fail (GTK_IS_ICON_THEME (self), NULL);
- g_return_val_if_fail (icon_name != NULL, NULL);
- g_return_val_if_fail ((flags & GTK_ICON_LOOKUP_NO_SVG) == 0 ||
- (flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
-
- GTK_DISPLAY_NOTE (self->display, ICONTHEME,
- g_message ("looking up icon %s", icon_name));
-
- return gtk_icon_theme_lookup_icon_for_scale (self, icon_name,
- size, 1, flags);
-}
-
-/**
- * gtk_icon_theme_lookup_icon_for_scale:
+ * gtk_icon_theme_lookup_icon_scale:
* @self: a #GtkIconTheme
* @icon_name: the name of the icon to lookup
* @size: desired icon size
* icon wasn’t found.
*/
GtkIcon *
-gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *self,
- const gchar *icon_name,
- gint size,
- gint scale,
- GtkIconLookupFlags flags)
+gtk_icon_theme_lookup_icon (GtkIconTheme *self,
+ const gchar *icon_name,
+ gint size,
+ gint scale,
+ GtkIconLookupFlags flags)
{
GtkIcon *icon;
/**
* gtk_icon_theme_choose_icon:
* @self: a #GtkIconTheme
- * @icon_names: (array zero-terminated=1): %NULL-terminated array of
- * icon names to lookup
- * @size: desired icon size
- * @flags: flags modifying the behavior of the icon lookup
- *
- * Looks up a named icon and returns a #GtkIcon containing
- * information such as the filename of the icon. The icon
- * can then be rendered into a pixbuf using
- * gtk_icon_load_icon(). (gtk_icon_theme_load_icon()
- * combines these two steps if all you need is the pixbuf.)
- *
- * If @icon_names contains more than one name, this function
- * tries them all in the given order before falling back to
- * inherited icon themes.
- *
- * This call is threadsafe, you can safely pass a GtkIconTheme
- * to another thread and call this method on it.
- *
- * Returns: (nullable) (transfer full): a #GtkIcon object
- * containing information about the icon, or %NULL if the icon wasn’t
- * found.
- */
-GtkIcon *
-gtk_icon_theme_choose_icon (GtkIconTheme *self,
- const gchar *icon_names[],
- gint size,
- GtkIconLookupFlags flags)
-{
- GtkIcon *icon;
-
- g_return_val_if_fail (GTK_IS_ICON_THEME (self), NULL);
- g_return_val_if_fail (icon_names != NULL, NULL);
- g_return_val_if_fail ((flags & GTK_ICON_LOOKUP_NO_SVG) == 0 ||
- (flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
- g_warn_if_fail ((flags & GTK_ICON_LOOKUP_GENERIC_FALLBACK) == 0);
-
- gtk_icon_theme_lock (self);
-
- icon = choose_icon (self, icon_names, size, 1, flags, FALSE, NULL);
-
- gtk_icon_theme_unlock (self);
-
- return icon;
-}
-
-/**
- * gtk_icon_theme_choose_icon_for_scale:
- * @self: a #GtkIconTheme
* @icon_names: (array zero-terminated=1): %NULL-terminated
* array of icon names to lookup
* @size: desired icon size
* icon wasn’t found.
*/
GtkIcon *
-gtk_icon_theme_choose_icon_for_scale (GtkIconTheme *self,
- const gchar *icon_names[],
- gint size,
- gint scale,
- GtkIconLookupFlags flags)
+gtk_icon_theme_choose_icon (GtkIconTheme *self,
+ const gchar *icon_names[],
+ gint size,
+ gint scale,
+ GtkIconLookupFlags flags)
{
GtkIcon *icon;
GtkIconTheme *self = GTK_ICON_THEME (source_object);
GtkIcon *icon;
- icon = gtk_icon_theme_choose_icon_for_scale (self,
- (const char **)data->icon_names,
- data->size,
- data->scale,
- data->flags);
+ icon = gtk_icon_theme_choose_icon (self,
+ (const char **)data->icon_names,
+ data->size,
+ data->scale,
+ data->flags);
if (icon)
{
*
* Asynchronously lookup, load, render and scale an icon .
*
- * For more details, see gtk_icon_theme_choose_icon_for_scale() which is the synchronous
+ * For more details, see gtk_icon_theme_choose_icon() which is the synchronous
* version of this call.
*
* Returns: (nullable) (transfer full): a #GtkIcon object
iface->get_intrinsic_height = icon_paintable_get_intrinsic_height;
}
-/**
- * gtk_icon_theme_lookup_by_gicon:
- * @self: a #GtkIconTheme
- * @icon: the #GIcon to look up
- * @size: desired icon size
- * @flags: flags modifying the behavior of the icon lookup
- *
- * Looks up an icon and returns a #GtkIcon containing information
- * such as the filename of the icon. The icon can then be rendered
- * into a pixbuf using gtk_icon_load_icon().
- *
- * When rendering on displays with high pixel densities you should not
- * use a @size multiplied by the scaling factor returned by functions
- * like gdk_surface_get_scale_factor(). Instead, you should use
- * gtk_icon_theme_lookup_by_gicon_for_scale(), as the assets loaded
- * for a given scaling factor may be different.
- *
- * Returns: (nullable) (transfer full): a #GtkIcon containing
- * information about the icon, or %NULL if the icon wasn’t
- * found. Unref with g_object_unref()
- */
-GtkIcon *
-gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
- GIcon *icon,
- gint size,
- GtkIconLookupFlags flags)
-{
- return gtk_icon_theme_lookup_by_gicon_for_scale (self, icon,
- size, 1, flags);
-}
-
static GtkIcon *
gtk_icon_new_for_file (GFile *file,
gint size,
}
/**
- * gtk_icon_theme_lookup_by_gicon_for_scale:
+ * gtk_icon_theme_lookup_by_gicon:
* @self: a #GtkIconTheme
* @icon: the #GIcon to look up
* @size: desired icon size
* found. Unref with g_object_unref()
*/
GtkIcon *
-gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *self,
- GIcon *gicon,
- gint size,
- gint scale,
- GtkIconLookupFlags flags)
+gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
+ GIcon *gicon,
+ gint size,
+ gint scale,
+ GtkIconLookupFlags flags)
{
GtkIcon *icon;
const gchar **names;
names = (const gchar **)g_themed_icon_get_names (G_THEMED_ICON (gicon));
- icon = gtk_icon_theme_choose_icon_for_scale (self, names, size, scale, flags);
+ icon = gtk_icon_theme_choose_icon (self, names, size, scale, flags);
return icon;
}
const gchar *icon_name);
GDK_AVAILABLE_IN_ALL
GtkIcon * gtk_icon_theme_lookup_icon (GtkIconTheme *self,
- const gchar *icon_name,
- gint size,
- GtkIconLookupFlags flags);
-GDK_AVAILABLE_IN_ALL
-GtkIcon * gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *self,
const gchar *icon_name,
gint size,
gint scale,
GtkIconLookupFlags flags);
-
GDK_AVAILABLE_IN_ALL
GtkIcon * gtk_icon_theme_choose_icon (GtkIconTheme *self,
- const gchar *icon_names[],
- gint size,
- GtkIconLookupFlags flags);
-GDK_AVAILABLE_IN_ALL
-GtkIcon * gtk_icon_theme_choose_icon_for_scale (GtkIconTheme *self,
const gchar *icon_names[],
gint size,
gint scale,
GAsyncResult *result,
GError **error);
GDK_AVAILABLE_IN_ALL
-GtkIcon * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
+GtkIcon * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
GIcon *icon,
gint size,
+ gint scale,
GtkIconLookupFlags flags);
GDK_AVAILABLE_IN_ALL
-GtkIcon * gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *self,
- GIcon *icon,
- gint size,
- gint scale,
- GtkIconLookupFlags flags);
-GDK_AVAILABLE_IN_ALL
GList * gtk_icon_theme_list_icons (GtkIconTheme *self,
const gchar *context);
GDK_AVAILABLE_IN_ALL
theme = gtk_css_icon_theme_value_get_icon_theme
(_gtk_style_context_peek_property (gtk_widget_get_style_context (GTK_WIDGET (mount_operation->priv->dialog)),
GTK_CSS_PROPERTY_ICON_THEME));
- info = gtk_icon_theme_lookup_icon (theme, "application-x-executable", 24, 0);
+ info = gtk_icon_theme_lookup_icon (theme, "application-x-executable", 24, 1, 0);
texture = gtk_icon_download_texture (info, NULL);
g_object_unref (info);
}
* fixed size of 48.
*/
if (sizes[i] == -1)
- info = gtk_icon_theme_lookup_icon_for_scale (icon_theme, name,
- 48, priv->scale,
- 0);
+ info = gtk_icon_theme_lookup_icon (icon_theme, name,
+ 48, priv->scale,
+ 0);
else
- info = gtk_icon_theme_lookup_icon_for_scale (icon_theme, name,
- sizes[i], priv->scale,
- 0);
+ info = gtk_icon_theme_lookup_icon (icon_theme, name,
+ sizes[i], priv->scale,
+ 0);
if (info)
{
GdkTexture *texture = gtk_icon_download_texture (info, NULL);
gtk_window_get_icon_for_size (GtkWindow *window,
int size)
{
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
const char *name;
GtkIcon *info;
return NULL;
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
- name, size,
+ name, size, priv->scale,
GTK_ICON_LOOKUP_FORCE_SIZE);
if (info == NULL)
return NULL;
g_value_init (&value, GDK_TYPE_PIXBUF);
icon = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
"utilities-terminal",
- 48, 0);
+ 48, 1, 0);
texture = gtk_icon_download_texture (icon, NULL);
g_value_take_object (&value, gdk_pixbuf_get_from_texture (texture));
g_object_unref (texture);
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
*out_size = width;
- icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, width, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+ icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, width, 1, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info)
texture = gtk_icon_download_texture (icon_info, NULL);
g_object_unref (icon_info);
int size = 48;
icon = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
- icon_name, size, 0);
+ icon_name, size, 1, 0);
switch (hotspot)
{
default:
if (argc >= 6)
scale = atoi (argv[5]);
- icon = gtk_icon_theme_lookup_icon_for_scale (icon_theme, argv[3], size, scale, flags);
+ icon = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, scale, flags);
if (!icon)
{
g_print ("Icon '%s' not found\n", argv[3]);
if (argc >= 6)
scale = atoi (argv[5]);
- icon_info = gtk_icon_theme_lookup_icon_for_scale (icon_theme, argv[3], size, scale, flags);
+ icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, scale, flags);
g_print ("icon for %s at %dx%d@%dx is %s\n", argv[3], size, size, scale,
icon_info ? gtk_icon_get_filename (icon_info) : "<none>");
* icon theme.
* The icon size is randomly chosen.
*/
- info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), icon_name, 16, GTK_ICON_LOOKUP_DIR_LTR);
+ info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), icon_name, 16, 1, GTK_ICON_LOOKUP_DIR_LTR);
if (info == NULL)
{
g_test_message ("Failed to look up icon for \"%s\"", (char *) icon_name);
{
GtkIcon *info;
- info = gtk_icon_theme_lookup_icon (get_test_icontheme (FALSE), icon_name, size, flags);
+ info = gtk_icon_theme_lookup_icon (get_test_icontheme (FALSE), icon_name, size, 1, flags);
if (info == NULL)
{
g_error ("Could not look up an icon for \"%s\" with flags %s at size %d",
{
GtkIcon *info;
- info = gtk_icon_theme_lookup_icon (get_test_icontheme (FALSE), icon_name, size, flags);
+ info = gtk_icon_theme_lookup_icon (get_test_icontheme (FALSE), icon_name, size, 1, flags);
if (info != NULL)
{
g_assert (lookups == NULL);
- info = gtk_icon_theme_lookup_icon (get_test_icontheme (FALSE), icon_name, size, flags);
+ info = gtk_icon_theme_lookup_icon (get_test_icontheme (FALSE), icon_name, size, 1, flags);
if (info)
g_object_unref (info);
icon_theme = gtk_icon_theme_get_default ();
file = g_file_new_for_path (path);
icon = g_file_icon_new (file);
- info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme, icon,
- height, 1, 0);
+ info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon,
+ height, 1, 0);
g_assert_nonnull (info);
g_object_unref (pixbuf);