forked from AuroraMiddleware/gtk
image: Remove GtkIconSet API
This commit is contained in:
parent
efffa3b6bd
commit
627a824cab
@ -1754,7 +1754,6 @@ GtkIconViewPrivate
|
|||||||
<TITLE>GtkImage</TITLE>
|
<TITLE>GtkImage</TITLE>
|
||||||
GtkImage
|
GtkImage
|
||||||
GtkImageType
|
GtkImageType
|
||||||
gtk_image_get_icon_set
|
|
||||||
gtk_image_get_pixbuf
|
gtk_image_get_pixbuf
|
||||||
gtk_image_get_stock
|
gtk_image_get_stock
|
||||||
gtk_image_get_animation
|
gtk_image_get_animation
|
||||||
@ -1762,7 +1761,6 @@ gtk_image_get_icon_name
|
|||||||
gtk_image_get_gicon
|
gtk_image_get_gicon
|
||||||
gtk_image_get_storage_type
|
gtk_image_get_storage_type
|
||||||
gtk_image_new_from_file
|
gtk_image_new_from_file
|
||||||
gtk_image_new_from_icon_set
|
|
||||||
gtk_image_new_from_pixbuf
|
gtk_image_new_from_pixbuf
|
||||||
gtk_image_new_from_stock
|
gtk_image_new_from_stock
|
||||||
gtk_image_new_from_animation
|
gtk_image_new_from_animation
|
||||||
@ -1771,7 +1769,6 @@ gtk_image_new_from_gicon
|
|||||||
gtk_image_new_from_resource
|
gtk_image_new_from_resource
|
||||||
gtk_image_new_from_surface
|
gtk_image_new_from_surface
|
||||||
gtk_image_set_from_file
|
gtk_image_set_from_file
|
||||||
gtk_image_set_from_icon_set
|
|
||||||
gtk_image_set_from_pixbuf
|
gtk_image_set_from_pixbuf
|
||||||
gtk_image_set_from_stock
|
gtk_image_set_from_stock
|
||||||
gtk_image_set_from_animation
|
gtk_image_set_from_animation
|
||||||
|
@ -403,29 +403,6 @@ ensure_surface_from_pixbuf (GtkIconHelper *self,
|
|||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *
|
|
||||||
ensure_surface_for_icon_set (GtkIconHelper *self,
|
|
||||||
GtkCssStyle *style,
|
|
||||||
GtkTextDirection direction,
|
|
||||||
gint scale,
|
|
||||||
GtkIconSet *icon_set)
|
|
||||||
{
|
|
||||||
cairo_surface_t *surface;
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
|
|
||||||
pixbuf = gtk_icon_set_render_icon_pixbuf_for_scale (icon_set,
|
|
||||||
style,
|
|
||||||
direction,
|
|
||||||
self->priv->icon_size,
|
|
||||||
scale);
|
|
||||||
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf,
|
|
||||||
scale,
|
|
||||||
gtk_widget_get_window (gtk_css_gadget_get_owner (GTK_CSS_GADGET (self))));
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
|
|
||||||
return surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cairo_surface_t *
|
static cairo_surface_t *
|
||||||
ensure_surface_for_gicon (GtkIconHelper *self,
|
ensure_surface_for_gicon (GtkIconHelper *self,
|
||||||
GtkCssStyle *style,
|
GtkCssStyle *style,
|
||||||
@ -517,7 +494,6 @@ gtk_icon_helper_load_surface (GtkIconHelper *self,
|
|||||||
int scale)
|
int scale)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
GtkIconSet *icon_set;
|
|
||||||
GIcon *gicon;
|
GIcon *gicon;
|
||||||
|
|
||||||
switch (gtk_image_definition_get_storage_type (self->priv->def))
|
switch (gtk_image_definition_get_storage_type (self->priv->def))
|
||||||
@ -534,14 +510,6 @@ gtk_icon_helper_load_surface (GtkIconHelper *self,
|
|||||||
gtk_image_definition_get_scale (self->priv->def));
|
gtk_image_definition_get_scale (self->priv->def));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_IMAGE_ICON_SET:
|
|
||||||
icon_set = gtk_image_definition_get_icon_set (self->priv->def);
|
|
||||||
surface = ensure_surface_for_icon_set (self,
|
|
||||||
gtk_css_node_get_style (gtk_css_gadget_get_node (GTK_CSS_GADGET (self))),
|
|
||||||
gtk_widget_get_direction (gtk_css_gadget_get_owner (GTK_CSS_GADGET (self))),
|
|
||||||
scale, icon_set);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GTK_IMAGE_ICON_NAME:
|
case GTK_IMAGE_ICON_NAME:
|
||||||
if (self->priv->use_fallback)
|
if (self->priv->use_fallback)
|
||||||
gicon = g_themed_icon_new_with_default_fallbacks (gtk_image_definition_get_icon_name (self->priv->def));
|
gicon = g_themed_icon_new_with_default_fallbacks (gtk_image_definition_get_icon_name (self->priv->def));
|
||||||
@ -633,7 +601,6 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_IMAGE_ICON_SET:
|
|
||||||
case GTK_IMAGE_EMPTY:
|
case GTK_IMAGE_EMPTY:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -688,15 +655,6 @@ _gtk_icon_helper_set_icon_name (GtkIconHelper *self,
|
|||||||
_gtk_icon_helper_set_icon_size (self, icon_size);
|
_gtk_icon_helper_set_icon_size (self, icon_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_icon_helper_set_icon_set (GtkIconHelper *self,
|
|
||||||
GtkIconSet *icon_set,
|
|
||||||
GtkIconSize icon_size)
|
|
||||||
{
|
|
||||||
gtk_icon_helper_take_definition (self, gtk_image_definition_new_icon_set (icon_set));
|
|
||||||
_gtk_icon_helper_set_icon_size (self, icon_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_icon_helper_set_pixbuf (GtkIconHelper *self,
|
_gtk_icon_helper_set_pixbuf (GtkIconHelper *self,
|
||||||
GdkPixbuf *pixbuf)
|
GdkPixbuf *pixbuf)
|
||||||
@ -805,12 +763,6 @@ _gtk_icon_helper_peek_animation (GtkIconHelper *self)
|
|||||||
return gtk_image_definition_get_animation (self->priv->def);
|
return gtk_image_definition_get_animation (self->priv->def);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkIconSet *
|
|
||||||
_gtk_icon_helper_peek_icon_set (GtkIconHelper *self)
|
|
||||||
{
|
|
||||||
return gtk_image_definition_get_icon_set (self->priv->def);
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_surface_t *
|
cairo_surface_t *
|
||||||
_gtk_icon_helper_peek_surface (GtkIconHelper *self)
|
_gtk_icon_helper_peek_surface (GtkIconHelper *self)
|
||||||
{
|
{
|
||||||
|
@ -88,9 +88,6 @@ void _gtk_icon_helper_set_pixbuf_scale (GtkIconHelper *self,
|
|||||||
int scale);
|
int scale);
|
||||||
void _gtk_icon_helper_set_animation (GtkIconHelper *self,
|
void _gtk_icon_helper_set_animation (GtkIconHelper *self,
|
||||||
GdkPixbufAnimation *animation);
|
GdkPixbufAnimation *animation);
|
||||||
void _gtk_icon_helper_set_icon_set (GtkIconHelper *self,
|
|
||||||
GtkIconSet *icon_set,
|
|
||||||
GtkIconSize icon_size);
|
|
||||||
|
|
||||||
void _gtk_icon_helper_set_icon_name (GtkIconHelper *self,
|
void _gtk_icon_helper_set_icon_name (GtkIconHelper *self,
|
||||||
const gchar *icon_name,
|
const gchar *icon_name,
|
||||||
@ -112,7 +109,6 @@ gboolean _gtk_icon_helper_get_use_fallback (GtkIconHelper *self);
|
|||||||
|
|
||||||
GdkPixbuf *_gtk_icon_helper_peek_pixbuf (GtkIconHelper *self);
|
GdkPixbuf *_gtk_icon_helper_peek_pixbuf (GtkIconHelper *self);
|
||||||
GIcon *_gtk_icon_helper_peek_gicon (GtkIconHelper *self);
|
GIcon *_gtk_icon_helper_peek_gicon (GtkIconHelper *self);
|
||||||
GtkIconSet *_gtk_icon_helper_peek_icon_set (GtkIconHelper *self);
|
|
||||||
GdkPixbufAnimation *_gtk_icon_helper_peek_animation (GtkIconHelper *self);
|
GdkPixbufAnimation *_gtk_icon_helper_peek_animation (GtkIconHelper *self);
|
||||||
cairo_surface_t *_gtk_icon_helper_peek_surface (GtkIconHelper *self);
|
cairo_surface_t *_gtk_icon_helper_peek_surface (GtkIconHelper *self);
|
||||||
|
|
||||||
|
143
gtk/gtkimage.c
143
gtk/gtkimage.c
@ -32,7 +32,6 @@
|
|||||||
#include "gtkcssstylepropertyprivate.h"
|
#include "gtkcssstylepropertyprivate.h"
|
||||||
#include "gtkiconhelperprivate.h"
|
#include "gtkiconhelperprivate.h"
|
||||||
#include "gtkimageprivate.h"
|
#include "gtkimageprivate.h"
|
||||||
#include "deprecated/gtkiconfactory.h"
|
|
||||||
#include "gtkicontheme.h"
|
#include "gtkicontheme.h"
|
||||||
#include "gtksizerequest.h"
|
#include "gtksizerequest.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
@ -197,7 +196,6 @@ enum
|
|||||||
PROP_PIXBUF,
|
PROP_PIXBUF,
|
||||||
PROP_SURFACE,
|
PROP_SURFACE,
|
||||||
PROP_FILE,
|
PROP_FILE,
|
||||||
PROP_ICON_SET,
|
|
||||||
PROP_ICON_SIZE,
|
PROP_ICON_SIZE,
|
||||||
PROP_PIXEL_SIZE,
|
PROP_PIXEL_SIZE,
|
||||||
PROP_PIXBUF_ANIMATION,
|
PROP_PIXBUF_ANIMATION,
|
||||||
@ -256,20 +254,6 @@ gtk_image_class_init (GtkImageClass *class)
|
|||||||
NULL,
|
NULL,
|
||||||
GTK_PARAM_READWRITE);
|
GTK_PARAM_READWRITE);
|
||||||
|
|
||||||
/**
|
|
||||||
* GtkImage:icon-set:
|
|
||||||
*
|
|
||||||
* Deprecated: 3.10: Use #GtkImage:icon-name instead.
|
|
||||||
*/
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
image_props[PROP_ICON_SET] =
|
|
||||||
g_param_spec_boxed ("icon-set",
|
|
||||||
P_("Icon set"),
|
|
||||||
P_("Icon set to display"),
|
|
||||||
GTK_TYPE_ICON_SET,
|
|
||||||
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
image_props[PROP_ICON_SIZE] =
|
image_props[PROP_ICON_SIZE] =
|
||||||
g_param_spec_int ("icon-size",
|
g_param_spec_int ("icon-size",
|
||||||
P_("Icon size"),
|
P_("Icon size"),
|
||||||
@ -440,11 +424,6 @@ gtk_image_set_property (GObject *object,
|
|||||||
case PROP_FILE:
|
case PROP_FILE:
|
||||||
gtk_image_set_from_file (image, g_value_get_string (value));
|
gtk_image_set_from_file (image, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
case PROP_ICON_SET:
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
gtk_image_set_from_icon_set (image, g_value_get_boxed (value), icon_size);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
break;
|
|
||||||
case PROP_ICON_SIZE:
|
case PROP_ICON_SIZE:
|
||||||
if (_gtk_icon_helper_set_icon_size (priv->icon_helper, g_value_get_int (value)))
|
if (_gtk_icon_helper_set_icon_size (priv->icon_helper, g_value_get_int (value)))
|
||||||
{
|
{
|
||||||
@ -499,11 +478,6 @@ gtk_image_get_property (GObject *object,
|
|||||||
case PROP_FILE:
|
case PROP_FILE:
|
||||||
g_value_set_string (value, priv->filename);
|
g_value_set_string (value, priv->filename);
|
||||||
break;
|
break;
|
||||||
case PROP_ICON_SET:
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
g_value_set_boxed (value, _gtk_icon_helper_peek_icon_set (priv->icon_helper));
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
break;
|
|
||||||
case PROP_ICON_SIZE:
|
case PROP_ICON_SIZE:
|
||||||
g_value_set_int (value, _gtk_icon_helper_get_icon_size (priv->icon_helper));
|
g_value_set_int (value, _gtk_icon_helper_get_icon_size (priv->icon_helper));
|
||||||
break;
|
break;
|
||||||
@ -659,44 +633,6 @@ gtk_image_new_from_surface (cairo_surface_t *surface)
|
|||||||
return GTK_WIDGET (image);
|
return GTK_WIDGET (image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_image_new_from_icon_set:
|
|
||||||
* @icon_set: a #GtkIconSet
|
|
||||||
* @size: (type int): a stock icon size (#GtkIconSize)
|
|
||||||
*
|
|
||||||
* Creates a #GtkImage displaying an icon set. Sample stock sizes are
|
|
||||||
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_SMALL_TOOLBAR. Instead of using
|
|
||||||
* this function, usually it’s better to create a #GtkIconFactory, put
|
|
||||||
* your icon sets in the icon factory, add the icon factory to the
|
|
||||||
* list of default factories with gtk_icon_factory_add_default(), and
|
|
||||||
* then use gtk_image_new_from_stock(). This will allow themes to
|
|
||||||
* override the icon you ship with your application.
|
|
||||||
*
|
|
||||||
* The #GtkImage does not assume a reference to the
|
|
||||||
* icon set; you still need to unref it if you own references.
|
|
||||||
* #GtkImage will add its own reference rather than adopting yours.
|
|
||||||
*
|
|
||||||
* Returns: a new #GtkImage
|
|
||||||
*
|
|
||||||
* Deprecated: 3.10: Use gtk_image_new_from_icon_name() instead.
|
|
||||||
**/
|
|
||||||
GtkWidget*
|
|
||||||
gtk_image_new_from_icon_set (GtkIconSet *icon_set,
|
|
||||||
GtkIconSize size)
|
|
||||||
{
|
|
||||||
GtkImage *image;
|
|
||||||
|
|
||||||
image = g_object_new (GTK_TYPE_IMAGE, NULL);
|
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
gtk_image_set_from_icon_set (image, icon_set, size);
|
|
||||||
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
return GTK_WIDGET (image);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_image_new_from_animation:
|
* gtk_image_new_from_animation:
|
||||||
* @animation: an animation
|
* @animation: an animation
|
||||||
@ -1020,50 +956,6 @@ gtk_image_set_from_pixbuf (GtkImage *image,
|
|||||||
g_object_thaw_notify (G_OBJECT (image));
|
g_object_thaw_notify (G_OBJECT (image));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_image_set_from_icon_set:
|
|
||||||
* @image: a #GtkImage
|
|
||||||
* @icon_set: a #GtkIconSet
|
|
||||||
* @size: (type int): a stock icon size (#GtkIconSize)
|
|
||||||
*
|
|
||||||
* See gtk_image_new_from_icon_set() for details.
|
|
||||||
*
|
|
||||||
* Deprecated: 3.10: Use gtk_image_set_from_icon_name() instead.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
gtk_image_set_from_icon_set (GtkImage *image,
|
|
||||||
GtkIconSet *icon_set,
|
|
||||||
GtkIconSize size)
|
|
||||||
{
|
|
||||||
GtkImagePrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
|
||||||
|
|
||||||
priv = image->priv;
|
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (image));
|
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
if (icon_set)
|
|
||||||
gtk_icon_set_ref (icon_set);
|
|
||||||
|
|
||||||
gtk_image_clear (image);
|
|
||||||
|
|
||||||
if (icon_set)
|
|
||||||
{
|
|
||||||
_gtk_icon_helper_set_icon_set (priv->icon_helper, icon_set, size);
|
|
||||||
gtk_icon_set_unref (icon_set);
|
|
||||||
}
|
|
||||||
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SET]);
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]);
|
|
||||||
|
|
||||||
g_object_thaw_notify (G_OBJECT (image));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_image_set_from_animation:
|
* gtk_image_set_from_animation:
|
||||||
* @image: a #GtkImage
|
* @image: a #GtkImage
|
||||||
@ -1252,38 +1144,6 @@ gtk_image_get_pixbuf (GtkImage *image)
|
|||||||
return _gtk_icon_helper_peek_pixbuf (image->priv->icon_helper);
|
return _gtk_icon_helper_peek_pixbuf (image->priv->icon_helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_image_get_icon_set:
|
|
||||||
* @image: a #GtkImage
|
|
||||||
* @icon_set: (out) (transfer none) (allow-none): location to store a
|
|
||||||
* #GtkIconSet, or %NULL
|
|
||||||
* @size: (out) (allow-none) (type int): location to store a stock
|
|
||||||
* icon size (#GtkIconSize), or %NULL
|
|
||||||
*
|
|
||||||
* Gets the icon set and size being displayed by the #GtkImage.
|
|
||||||
* The storage type of the image must be %GTK_IMAGE_EMPTY or
|
|
||||||
* %GTK_IMAGE_ICON_SET (see gtk_image_get_storage_type()).
|
|
||||||
*
|
|
||||||
* Deprecated: 3.10: Use gtk_image_get_icon_name() instead.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
gtk_image_get_icon_set (GtkImage *image,
|
|
||||||
GtkIconSet **icon_set,
|
|
||||||
GtkIconSize *size)
|
|
||||||
{
|
|
||||||
GtkImagePrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
|
||||||
|
|
||||||
priv = image->priv;
|
|
||||||
|
|
||||||
if (icon_set)
|
|
||||||
*icon_set = _gtk_icon_helper_peek_icon_set (priv->icon_helper);
|
|
||||||
|
|
||||||
if (size)
|
|
||||||
*size = _gtk_icon_helper_get_icon_size (priv->icon_helper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_image_get_animation:
|
* gtk_image_get_animation:
|
||||||
* @image: a #GtkImage
|
* @image: a #GtkImage
|
||||||
@ -1622,9 +1482,6 @@ gtk_image_notify_for_storage_type (GtkImage *image,
|
|||||||
case GTK_IMAGE_PIXBUF:
|
case GTK_IMAGE_PIXBUF:
|
||||||
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF]);
|
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF]);
|
||||||
break;
|
break;
|
||||||
case GTK_IMAGE_ICON_SET:
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SET]);
|
|
||||||
break;
|
|
||||||
case GTK_IMAGE_ANIMATION:
|
case GTK_IMAGE_ANIMATION:
|
||||||
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF_ANIMATION]);
|
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF_ANIMATION]);
|
||||||
break;
|
break;
|
||||||
|
@ -116,9 +116,6 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GtkWidget* gtk_image_new_from_resource (const gchar *resource_path);
|
GtkWidget* gtk_image_new_from_resource (const gchar *resource_path);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
|
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
|
||||||
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_new_from_icon_name)
|
|
||||||
GtkWidget* gtk_image_new_from_icon_set (GtkIconSet *icon_set,
|
|
||||||
GtkIconSize size);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
|
GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
@ -141,10 +138,6 @@ void gtk_image_set_from_resource (GtkImage *image,
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_image_set_from_pixbuf (GtkImage *image,
|
void gtk_image_set_from_pixbuf (GtkImage *image,
|
||||||
GdkPixbuf *pixbuf);
|
GdkPixbuf *pixbuf);
|
||||||
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_set_from_icon_name)
|
|
||||||
void gtk_image_set_from_icon_set (GtkImage *image,
|
|
||||||
GtkIconSet *icon_set,
|
|
||||||
GtkIconSize size);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_image_set_from_animation (GtkImage *image,
|
void gtk_image_set_from_animation (GtkImage *image,
|
||||||
GdkPixbufAnimation *animation);
|
GdkPixbufAnimation *animation);
|
||||||
@ -168,10 +161,6 @@ GtkImageType gtk_image_get_storage_type (GtkImage *image);
|
|||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image);
|
GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image);
|
||||||
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_get_icon_name)
|
|
||||||
void gtk_image_get_icon_set (GtkImage *image,
|
|
||||||
GtkIconSet **icon_set,
|
|
||||||
GtkIconSize *size);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
|
GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
@ -19,12 +19,9 @@
|
|||||||
|
|
||||||
#include "gtkimagedefinitionprivate.h"
|
#include "gtkimagedefinitionprivate.h"
|
||||||
|
|
||||||
#include "deprecated/gtkiconfactory.h"
|
|
||||||
|
|
||||||
typedef struct _GtkImageDefinitionEmpty GtkImageDefinitionEmpty;
|
typedef struct _GtkImageDefinitionEmpty GtkImageDefinitionEmpty;
|
||||||
typedef struct _GtkImageDefinitionPixbuf GtkImageDefinitionPixbuf;
|
typedef struct _GtkImageDefinitionPixbuf GtkImageDefinitionPixbuf;
|
||||||
typedef struct _GtkImageDefinitionStock GtkImageDefinitionStock;
|
typedef struct _GtkImageDefinitionStock GtkImageDefinitionStock;
|
||||||
typedef struct _GtkImageDefinitionIconSet GtkImageDefinitionIconSet;
|
|
||||||
typedef struct _GtkImageDefinitionAnimation GtkImageDefinitionAnimation;
|
typedef struct _GtkImageDefinitionAnimation GtkImageDefinitionAnimation;
|
||||||
typedef struct _GtkImageDefinitionIconName GtkImageDefinitionIconName;
|
typedef struct _GtkImageDefinitionIconName GtkImageDefinitionIconName;
|
||||||
typedef struct _GtkImageDefinitionGIcon GtkImageDefinitionGIcon;
|
typedef struct _GtkImageDefinitionGIcon GtkImageDefinitionGIcon;
|
||||||
@ -50,13 +47,6 @@ struct _GtkImageDefinitionStock {
|
|||||||
char *id;
|
char *id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkImageDefinitionIconSet {
|
|
||||||
GtkImageType type;
|
|
||||||
gint ref_count;
|
|
||||||
|
|
||||||
GtkIconSet *icon_set;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkImageDefinitionAnimation {
|
struct _GtkImageDefinitionAnimation {
|
||||||
GtkImageType type;
|
GtkImageType type;
|
||||||
gint ref_count;
|
gint ref_count;
|
||||||
@ -92,7 +82,6 @@ union _GtkImageDefinition
|
|||||||
GtkImageDefinitionEmpty empty;
|
GtkImageDefinitionEmpty empty;
|
||||||
GtkImageDefinitionPixbuf pixbuf;
|
GtkImageDefinitionPixbuf pixbuf;
|
||||||
GtkImageDefinitionStock stock;
|
GtkImageDefinitionStock stock;
|
||||||
GtkImageDefinitionIconSet icon_set;
|
|
||||||
GtkImageDefinitionAnimation animation;
|
GtkImageDefinitionAnimation animation;
|
||||||
GtkImageDefinitionIconName icon_name;
|
GtkImageDefinitionIconName icon_name;
|
||||||
GtkImageDefinitionGIcon gicon;
|
GtkImageDefinitionGIcon gicon;
|
||||||
@ -114,7 +103,6 @@ gtk_image_definition_alloc (GtkImageType type)
|
|||||||
sizeof (GtkImageDefinitionEmpty),
|
sizeof (GtkImageDefinitionEmpty),
|
||||||
sizeof (GtkImageDefinitionPixbuf),
|
sizeof (GtkImageDefinitionPixbuf),
|
||||||
sizeof (GtkImageDefinitionStock),
|
sizeof (GtkImageDefinitionStock),
|
||||||
sizeof (GtkImageDefinitionIconSet),
|
|
||||||
sizeof (GtkImageDefinitionAnimation),
|
sizeof (GtkImageDefinitionAnimation),
|
||||||
sizeof (GtkImageDefinitionIconName),
|
sizeof (GtkImageDefinitionIconName),
|
||||||
sizeof (GtkImageDefinitionGIcon),
|
sizeof (GtkImageDefinitionGIcon),
|
||||||
@ -147,22 +135,6 @@ gtk_image_definition_new_pixbuf (GdkPixbuf *pixbuf,
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkImageDefinition *
|
|
||||||
gtk_image_definition_new_icon_set (GtkIconSet *icon_set)
|
|
||||||
{
|
|
||||||
GtkImageDefinition *def;
|
|
||||||
|
|
||||||
if (icon_set == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
def = gtk_image_definition_alloc (GTK_IMAGE_ICON_SET);
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
def->icon_set.icon_set = gtk_icon_set_ref (icon_set);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkImageDefinition *
|
GtkImageDefinition *
|
||||||
gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
|
gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
|
||||||
int scale)
|
int scale)
|
||||||
@ -252,11 +224,6 @@ gtk_image_definition_unref (GtkImageDefinition *def)
|
|||||||
case GTK_IMAGE_SURFACE:
|
case GTK_IMAGE_SURFACE:
|
||||||
cairo_surface_destroy (def->surface.surface);
|
cairo_surface_destroy (def->surface.surface);
|
||||||
break;
|
break;
|
||||||
case GTK_IMAGE_ICON_SET:
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
gtk_icon_set_unref (def->icon_set.icon_set);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
break;
|
|
||||||
case GTK_IMAGE_ICON_NAME:
|
case GTK_IMAGE_ICON_NAME:
|
||||||
g_free (def->icon_name.icon_name);
|
g_free (def->icon_name.icon_name);
|
||||||
break;
|
break;
|
||||||
@ -283,7 +250,6 @@ gtk_image_definition_get_scale (const GtkImageDefinition *def)
|
|||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
case GTK_IMAGE_EMPTY:
|
case GTK_IMAGE_EMPTY:
|
||||||
case GTK_IMAGE_SURFACE:
|
case GTK_IMAGE_SURFACE:
|
||||||
case GTK_IMAGE_ICON_SET:
|
|
||||||
case GTK_IMAGE_ICON_NAME:
|
case GTK_IMAGE_ICON_NAME:
|
||||||
case GTK_IMAGE_GICON:
|
case GTK_IMAGE_GICON:
|
||||||
return 1;
|
return 1;
|
||||||
@ -303,15 +269,6 @@ gtk_image_definition_get_pixbuf (const GtkImageDefinition *def)
|
|||||||
return def->pixbuf.pixbuf;
|
return def->pixbuf.pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkIconSet *
|
|
||||||
gtk_image_definition_get_icon_set (const GtkImageDefinition *def)
|
|
||||||
{
|
|
||||||
if (def->type != GTK_IMAGE_ICON_SET)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return def->icon_set.icon_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkPixbufAnimation *
|
GdkPixbufAnimation *
|
||||||
gtk_image_definition_get_animation (const GtkImageDefinition *def)
|
gtk_image_definition_get_animation (const GtkImageDefinition *def)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,6 @@ typedef union _GtkImageDefinition GtkImageDefinition;
|
|||||||
GtkImageDefinition * gtk_image_definition_new_empty (void);
|
GtkImageDefinition * gtk_image_definition_new_empty (void);
|
||||||
GtkImageDefinition * gtk_image_definition_new_pixbuf (GdkPixbuf *pixbuf,
|
GtkImageDefinition * gtk_image_definition_new_pixbuf (GdkPixbuf *pixbuf,
|
||||||
int scale);
|
int scale);
|
||||||
GtkImageDefinition * gtk_image_definition_new_icon_set (GtkIconSet *icon_set);
|
|
||||||
GtkImageDefinition * gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
|
GtkImageDefinition * gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
|
||||||
int scale);
|
int scale);
|
||||||
GtkImageDefinition * gtk_image_definition_new_icon_name (const char *icon_name);
|
GtkImageDefinition * gtk_image_definition_new_icon_name (const char *icon_name);
|
||||||
@ -41,7 +40,6 @@ void gtk_image_definition_unref (GtkImageDefinit
|
|||||||
GtkImageType gtk_image_definition_get_storage_type (const GtkImageDefinition *def);
|
GtkImageType gtk_image_definition_get_storage_type (const GtkImageDefinition *def);
|
||||||
gint gtk_image_definition_get_scale (const GtkImageDefinition *def);
|
gint gtk_image_definition_get_scale (const GtkImageDefinition *def);
|
||||||
GdkPixbuf * gtk_image_definition_get_pixbuf (const GtkImageDefinition *def);
|
GdkPixbuf * gtk_image_definition_get_pixbuf (const GtkImageDefinition *def);
|
||||||
GtkIconSet * gtk_image_definition_get_icon_set (const GtkImageDefinition *def);
|
|
||||||
GdkPixbufAnimation * gtk_image_definition_get_animation (const GtkImageDefinition *def);
|
GdkPixbufAnimation * gtk_image_definition_get_animation (const GtkImageDefinition *def);
|
||||||
const gchar * gtk_image_definition_get_icon_name (const GtkImageDefinition *def);
|
const gchar * gtk_image_definition_get_icon_name (const GtkImageDefinition *def);
|
||||||
GIcon * gtk_image_definition_get_gicon (const GtkImageDefinition *def);
|
GIcon * gtk_image_definition_get_gicon (const GtkImageDefinition *def);
|
||||||
|
@ -773,16 +773,6 @@ clone_image_menu_size (GtkImage *image)
|
|||||||
gtk_image_get_icon_name (image, &icon_name, NULL);
|
gtk_image_get_icon_name (image, &icon_name, NULL);
|
||||||
return gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
return gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||||
}
|
}
|
||||||
else if (storage_type == GTK_IMAGE_ICON_SET)
|
|
||||||
{
|
|
||||||
GtkWidget *widget;
|
|
||||||
GtkIconSet *icon_set;
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
gtk_image_get_icon_set (image, &icon_set, NULL);
|
|
||||||
widget = gtk_image_new_from_icon_set (icon_set, GTK_ICON_SIZE_MENU);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
else if (storage_type == GTK_IMAGE_GICON)
|
else if (storage_type == GTK_IMAGE_GICON)
|
||||||
{
|
{
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
@ -953,29 +943,14 @@ gtk_tool_button_update (GtkActivatable *activatable,
|
|||||||
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
|
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
|
||||||
else if (strcmp (property_name, "gicon") == 0)
|
else if (strcmp (property_name, "gicon") == 0)
|
||||||
{
|
{
|
||||||
const gchar *stock_id = gtk_action_get_stock_id (action);
|
|
||||||
GIcon *icon = gtk_action_get_gicon (action);
|
GIcon *icon = gtk_action_get_gicon (action);
|
||||||
GtkIconSize icon_size = GTK_ICON_SIZE_BUTTON;
|
GtkIconSize icon_size = GTK_ICON_SIZE_BUTTON;
|
||||||
GtkIconSet *icon_set = NULL;
|
|
||||||
|
|
||||||
if (stock_id)
|
|
||||||
{
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
icon_set = gtk_icon_factory_lookup_default (stock_id);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
}
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
if (icon_set != NULL || !icon)
|
|
||||||
image = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
image = gtk_tool_button_get_icon_widget (button);
|
image = gtk_tool_button_get_icon_widget (button);
|
||||||
icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
||||||
|
|
||||||
if (!image)
|
if (!image)
|
||||||
image = gtk_image_new ();
|
image = gtk_image_new ();
|
||||||
}
|
|
||||||
|
|
||||||
gtk_tool_button_set_icon_widget (button, image);
|
gtk_tool_button_set_icon_widget (button, image);
|
||||||
gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size);
|
gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size);
|
||||||
@ -993,36 +968,23 @@ gtk_tool_button_sync_action_properties (GtkActivatable *activatable,
|
|||||||
{
|
{
|
||||||
GtkToolButton *button;
|
GtkToolButton *button;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
const gchar *stock_id;
|
|
||||||
GtkIconSet *icon_set = NULL;
|
|
||||||
|
|
||||||
parent_activatable_iface->sync_action_properties (activatable, action);
|
parent_activatable_iface->sync_action_properties (activatable, action);
|
||||||
|
|
||||||
if (!action)
|
if (!action)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||||
if (!gtk_activatable_get_use_action_appearance (activatable))
|
if (!gtk_activatable_get_use_action_appearance (activatable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
button = GTK_TOOL_BUTTON (activatable);
|
button = GTK_TOOL_BUTTON (activatable);
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
stock_id = gtk_action_get_stock_id (action);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
|
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
|
||||||
gtk_tool_button_set_use_underline (button, TRUE);
|
gtk_tool_button_set_use_underline (button, TRUE);
|
||||||
gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
|
gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
|
||||||
|
|
||||||
if (stock_id)
|
if ((icon = gtk_action_get_gicon (action)) != NULL)
|
||||||
{
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
icon_set = gtk_icon_factory_lookup_default (stock_id);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (icon_set != NULL)
|
|
||||||
gtk_tool_button_set_icon_widget (button, NULL);
|
|
||||||
else if ((icon = gtk_action_get_gicon (action)) != NULL)
|
|
||||||
{
|
{
|
||||||
GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
||||||
GtkWidget *image = gtk_tool_button_get_icon_widget (button);
|
GtkWidget *image = gtk_tool_button_get_icon_widget (button);
|
||||||
@ -1040,6 +1002,9 @@ gtk_tool_button_sync_action_properties (GtkActivatable *activatable,
|
|||||||
gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
|
gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
|
||||||
else
|
else
|
||||||
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
|
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
|
||||||
|
|
||||||
|
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,8 +98,6 @@ main (int argc, char **argv)
|
|||||||
GtkWidget *label, *image, *box;
|
GtkWidget *label, *image, *box;
|
||||||
GtkIconTheme *theme;
|
GtkIconTheme *theme;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GtkIconSet *iconset;
|
|
||||||
GtkIconSource *iconsource;
|
|
||||||
gchar *icon_name = "gnome-terminal";
|
gchar *icon_name = "gnome-terminal";
|
||||||
gchar *anim_filename = NULL;
|
gchar *anim_filename = NULL;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
@ -149,19 +147,6 @@ main (int argc, char **argv)
|
|||||||
g_signal_connect (box, "drag_data_received",
|
g_signal_connect (box, "drag_data_received",
|
||||||
G_CALLBACK (drag_data_received), image);
|
G_CALLBACK (drag_data_received), image);
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
label = gtk_label_new ("GTK_IMAGE_ICON_SET");
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
|
|
||||||
|
|
||||||
iconsource = gtk_icon_source_new ();
|
|
||||||
gtk_icon_source_set_icon_name (iconsource, icon_name);
|
|
||||||
iconset = gtk_icon_set_new ();
|
|
||||||
gtk_icon_set_add_source (iconset, iconsource);
|
|
||||||
image = gtk_image_new_from_icon_set (iconset, GTK_ICON_SIZE_DIALOG);
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), image, 1, 3, 1, 1);
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
||||||
|
|
||||||
label = gtk_label_new ("GTK_IMAGE_ICON_NAME");
|
label = gtk_label_new ("GTK_IMAGE_ICON_NAME");
|
||||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 4, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), label, 0, 4, 1, 1);
|
||||||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
|
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
|
||||||
|
Loading…
Reference in New Issue
Block a user