forked from AuroraMiddleware/gtk
icon-theme: Drop the _for_scale() versions and always take scale
This commit is contained in:
parent
e2f778602b
commit
b087f9ca51
@ -107,7 +107,7 @@ get_image_paintable (GtkImage *image)
|
||||
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);
|
||||
|
@ -135,7 +135,7 @@ insert_text (GtkTextBuffer *buffer)
|
||||
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);
|
||||
|
@ -359,7 +359,7 @@ get_image_paintable (GtkImage *image)
|
||||
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;
|
||||
@ -410,7 +410,7 @@ get_file (GValue *value,
|
||||
|
||||
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);
|
||||
|
@ -300,7 +300,7 @@ icon_loaded (GObject *object,
|
||||
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)
|
||||
{
|
||||
|
@ -2167,7 +2167,7 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
/* 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);
|
||||
|
@ -2604,7 +2604,7 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
|
||||
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);
|
||||
|
||||
|
@ -61,15 +61,15 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
|
||||
}
|
||||
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);
|
||||
|
@ -486,7 +486,7 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
|
||||
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;
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ ensure_paintable_for_gicon (GtkIconHelper *self,
|
||||
|
||||
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);
|
||||
|
@ -2071,51 +2071,7 @@ choose_icon (GtkIconTheme *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -2136,11 +2092,11 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self,
|
||||
* 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;
|
||||
|
||||
@ -2224,54 +2180,6 @@ gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *self,
|
||||
/**
|
||||
* 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
|
||||
@ -2296,11 +2204,11 @@ gtk_icon_theme_choose_icon (GtkIconTheme *self,
|
||||
* 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;
|
||||
|
||||
@ -2358,11 +2266,11 @@ choose_icon_thread (GTask *task,
|
||||
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)
|
||||
{
|
||||
@ -2415,7 +2323,7 @@ load_icon_thread (GTask *task,
|
||||
*
|
||||
* 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
|
||||
@ -4101,37 +4009,6 @@ icon_paintable_init (GdkPaintableInterface *iface)
|
||||
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,
|
||||
@ -4189,7 +4066,7 @@ gtk_icon_new_for_pixbuf (GtkIconTheme *icon_theme,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -4205,11 +4082,11 @@ gtk_icon_new_for_pixbuf (GtkIconTheme *icon_theme,
|
||||
* 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;
|
||||
|
||||
@ -4281,7 +4158,7 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *self,
|
||||
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;
|
||||
}
|
||||
|
@ -147,23 +147,12 @@ gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme
|
||||
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,
|
||||
@ -182,17 +171,12 @@ GtkIcon * gtk_icon_theme_choose_icon_finish (GtkIconTheme
|
||||
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
|
||||
|
@ -1174,7 +1174,7 @@ add_pid_to_process_list_store (GtkMountOperation *mount_operation,
|
||||
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);
|
||||
}
|
||||
|
@ -4027,13 +4027,13 @@ icon_list_from_theme (GtkWindow *window,
|
||||
* 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);
|
||||
@ -4100,6 +4100,7 @@ GdkPaintable *
|
||||
gtk_window_get_icon_for_size (GtkWindow *window,
|
||||
int size)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
const char *name;
|
||||
GtkIcon *info;
|
||||
|
||||
@ -4111,7 +4112,7 @@ gtk_window_get_icon_for_size (GtkWindow *window,
|
||||
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;
|
||||
|
@ -288,7 +288,7 @@ get_button_list (GdkClipboard *clipboard,
|
||||
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);
|
||||
|
@ -25,7 +25,7 @@ get_image_texture (GtkImage *image,
|
||||
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);
|
||||
@ -228,7 +228,7 @@ update_source_icon (GtkDragSource *source,
|
||||
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:
|
||||
|
@ -107,7 +107,7 @@ main (int argc, char *argv[])
|
||||
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]);
|
||||
@ -184,7 +184,7 @@ main (int argc, char *argv[])
|
||||
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>");
|
||||
|
||||
|
@ -79,7 +79,7 @@ test_icon_existence (gconstpointer icon_name)
|
||||
* 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);
|
||||
|
@ -57,7 +57,7 @@ assert_icon_lookup_size (const 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",
|
||||
@ -110,7 +110,7 @@ assert_icon_lookup_fails (const 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)
|
||||
{
|
||||
@ -173,7 +173,7 @@ assert_lookup_order (const char *icon_name,
|
||||
|
||||
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);
|
||||
|
||||
@ -690,8 +690,8 @@ test_nonsquare_symbolic (void)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user