[gtk+/wip/otte/gtk4: 82/127] image: Remove GtkIconSet API
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gtk4: 82/127] image: Remove GtkIconSet API
- Date: Sat, 8 Oct 2016 03:39:38 +0000 (UTC)
commit 3ee1d2473f0e49c3f2c974f22a487fe1b30e092f
Author: Timm Bäder <mail baedert org>
Date: Tue Oct 4 17:05:47 2016 +0200
image: Remove GtkIconSet API
docs/reference/gtk/gtk3-sections.txt | 3 -
gtk/gtkiconhelper.c | 48 -----------
gtk/gtkiconhelperprivate.h | 4 -
gtk/gtkimage.c | 143 ----------------------------------
gtk/gtkimage.h | 11 ---
gtk/gtkimagedefinition.c | 43 ----------
gtk/gtkimagedefinitionprivate.h | 2 -
gtk/gtktoolbutton.c | 53 ++----------
tests/testimage.c | 15 ----
9 files changed, 9 insertions(+), 313 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 3da8927..9c378ac 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -1754,7 +1754,6 @@ GtkIconViewPrivate
<TITLE>GtkImage</TITLE>
GtkImage
GtkImageType
-gtk_image_get_icon_set
gtk_image_get_pixbuf
gtk_image_get_stock
gtk_image_get_animation
@@ -1762,7 +1761,6 @@ gtk_image_get_icon_name
gtk_image_get_gicon
gtk_image_get_storage_type
gtk_image_new_from_file
-gtk_image_new_from_icon_set
gtk_image_new_from_pixbuf
gtk_image_new_from_stock
gtk_image_new_from_animation
@@ -1771,7 +1769,6 @@ gtk_image_new_from_gicon
gtk_image_new_from_resource
gtk_image_new_from_surface
gtk_image_set_from_file
-gtk_image_set_from_icon_set
gtk_image_set_from_pixbuf
gtk_image_set_from_stock
gtk_image_set_from_animation
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 0013ede..8a2a91c 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -404,29 +404,6 @@ ensure_surface_from_pixbuf (GtkIconHelper *self,
}
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 *
ensure_surface_for_gicon (GtkIconHelper *self,
GtkCssStyle *style,
GtkTextDirection dir,
@@ -517,7 +494,6 @@ gtk_icon_helper_load_surface (GtkIconHelper *self,
int scale)
{
cairo_surface_t *surface;
- GtkIconSet *icon_set;
GIcon *gicon;
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));
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:
if (self->priv->use_fallback)
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;
- case GTK_IMAGE_ICON_SET:
case GTK_IMAGE_EMPTY:
default:
break;
@@ -688,15 +655,6 @@ _gtk_icon_helper_set_icon_name (GtkIconHelper *self,
_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
_gtk_icon_helper_set_pixbuf (GtkIconHelper *self,
GdkPixbuf *pixbuf)
@@ -805,12 +763,6 @@ _gtk_icon_helper_peek_animation (GtkIconHelper *self)
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 *
_gtk_icon_helper_peek_surface (GtkIconHelper *self)
{
diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h
index d1fdbf4..849aeb1 100644
--- a/gtk/gtkiconhelperprivate.h
+++ b/gtk/gtkiconhelperprivate.h
@@ -88,9 +88,6 @@ void _gtk_icon_helper_set_pixbuf_scale (GtkIconHelper *self,
int scale);
void _gtk_icon_helper_set_animation (GtkIconHelper *self,
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,
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);
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);
cairo_surface_t *_gtk_icon_helper_peek_surface (GtkIconHelper *self);
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index ca41cf5..0a4ad5f 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -32,7 +32,6 @@
#include "gtkcssstylepropertyprivate.h"
#include "gtkiconhelperprivate.h"
#include "gtkimageprivate.h"
-#include "deprecated/gtkiconfactory.h"
#include "gtkicontheme.h"
#include "gtksizerequest.h"
#include "gtkintl.h"
@@ -197,7 +196,6 @@ enum
PROP_PIXBUF,
PROP_SURFACE,
PROP_FILE,
- PROP_ICON_SET,
PROP_ICON_SIZE,
PROP_PIXEL_SIZE,
PROP_PIXBUF_ANIMATION,
@@ -256,20 +254,6 @@ gtk_image_class_init (GtkImageClass *class)
NULL,
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] =
g_param_spec_int ("icon-size",
P_("Icon size"),
@@ -440,11 +424,6 @@ gtk_image_set_property (GObject *object,
case PROP_FILE:
gtk_image_set_from_file (image, g_value_get_string (value));
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:
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:
g_value_set_string (value, priv->filename);
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:
g_value_set_int (value, _gtk_icon_helper_get_icon_size (priv->icon_helper));
break;
@@ -660,44 +634,6 @@ gtk_image_new_from_surface (cairo_surface_t *surface)
}
/**
- * 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:
* @animation: an animation
*
@@ -1021,50 +957,6 @@ gtk_image_set_from_pixbuf (GtkImage *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:
* @image: a #GtkImage
* @animation: the #GdkPixbufAnimation
@@ -1253,38 +1145,6 @@ gtk_image_get_pixbuf (GtkImage *image)
}
/**
- * 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:
* @image: a #GtkImage
*
@@ -1622,9 +1482,6 @@ gtk_image_notify_for_storage_type (GtkImage *image,
case GTK_IMAGE_PIXBUF:
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF]);
break;
- case GTK_IMAGE_ICON_SET:
- g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SET]);
- break;
case GTK_IMAGE_ANIMATION:
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF_ANIMATION]);
break;
diff --git a/gtk/gtkimage.h b/gtk/gtkimage.h
index c793004..ef28c39 100644
--- a/gtk/gtkimage.h
+++ b/gtk/gtkimage.h
@@ -116,9 +116,6 @@ GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_image_new_from_resource (const gchar *resource_path);
GDK_AVAILABLE_IN_ALL
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
GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
GDK_AVAILABLE_IN_ALL
@@ -141,10 +138,6 @@ void gtk_image_set_from_resource (GtkImage *image,
GDK_AVAILABLE_IN_ALL
void gtk_image_set_from_pixbuf (GtkImage *image,
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
void gtk_image_set_from_animation (GtkImage *image,
GdkPixbufAnimation *animation);
@@ -168,10 +161,6 @@ GtkImageType gtk_image_get_storage_type (GtkImage *image);
GDK_AVAILABLE_IN_ALL
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
GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkimagedefinition.c b/gtk/gtkimagedefinition.c
index 1d6e7d4..9a8f50b 100644
--- a/gtk/gtkimagedefinition.c
+++ b/gtk/gtkimagedefinition.c
@@ -19,12 +19,9 @@
#include "gtkimagedefinitionprivate.h"
-#include "deprecated/gtkiconfactory.h"
-
typedef struct _GtkImageDefinitionEmpty GtkImageDefinitionEmpty;
typedef struct _GtkImageDefinitionPixbuf GtkImageDefinitionPixbuf;
typedef struct _GtkImageDefinitionStock GtkImageDefinitionStock;
-typedef struct _GtkImageDefinitionIconSet GtkImageDefinitionIconSet;
typedef struct _GtkImageDefinitionAnimation GtkImageDefinitionAnimation;
typedef struct _GtkImageDefinitionIconName GtkImageDefinitionIconName;
typedef struct _GtkImageDefinitionGIcon GtkImageDefinitionGIcon;
@@ -50,13 +47,6 @@ struct _GtkImageDefinitionStock {
char *id;
};
-struct _GtkImageDefinitionIconSet {
- GtkImageType type;
- gint ref_count;
-
- GtkIconSet *icon_set;
-};
-
struct _GtkImageDefinitionAnimation {
GtkImageType type;
gint ref_count;
@@ -92,7 +82,6 @@ union _GtkImageDefinition
GtkImageDefinitionEmpty empty;
GtkImageDefinitionPixbuf pixbuf;
GtkImageDefinitionStock stock;
- GtkImageDefinitionIconSet icon_set;
GtkImageDefinitionAnimation animation;
GtkImageDefinitionIconName icon_name;
GtkImageDefinitionGIcon gicon;
@@ -114,7 +103,6 @@ gtk_image_definition_alloc (GtkImageType type)
sizeof (GtkImageDefinitionEmpty),
sizeof (GtkImageDefinitionPixbuf),
sizeof (GtkImageDefinitionStock),
- sizeof (GtkImageDefinitionIconSet),
sizeof (GtkImageDefinitionAnimation),
sizeof (GtkImageDefinitionIconName),
sizeof (GtkImageDefinitionGIcon),
@@ -148,22 +136,6 @@ gtk_image_definition_new_pixbuf (GdkPixbuf *pixbuf,
}
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 *
gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
int scale)
{
@@ -252,11 +224,6 @@ gtk_image_definition_unref (GtkImageDefinition *def)
case GTK_IMAGE_SURFACE:
cairo_surface_destroy (def->surface.surface);
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:
g_free (def->icon_name.icon_name);
break;
@@ -283,7 +250,6 @@ gtk_image_definition_get_scale (const GtkImageDefinition *def)
g_assert_not_reached ();
case GTK_IMAGE_EMPTY:
case GTK_IMAGE_SURFACE:
- case GTK_IMAGE_ICON_SET:
case GTK_IMAGE_ICON_NAME:
case GTK_IMAGE_GICON:
return 1;
@@ -303,15 +269,6 @@ gtk_image_definition_get_pixbuf (const GtkImageDefinition *def)
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 *
gtk_image_definition_get_animation (const GtkImageDefinition *def)
{
diff --git a/gtk/gtkimagedefinitionprivate.h b/gtk/gtkimagedefinitionprivate.h
index ab1f601..fdb5426 100644
--- a/gtk/gtkimagedefinitionprivate.h
+++ b/gtk/gtkimagedefinitionprivate.h
@@ -28,7 +28,6 @@ typedef union _GtkImageDefinition GtkImageDefinition;
GtkImageDefinition * gtk_image_definition_new_empty (void);
GtkImageDefinition * gtk_image_definition_new_pixbuf (GdkPixbuf *pixbuf,
int scale);
-GtkImageDefinition * gtk_image_definition_new_icon_set (GtkIconSet *icon_set);
GtkImageDefinition * gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
int scale);
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);
gint gtk_image_definition_get_scale (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);
const gchar * gtk_image_definition_get_icon_name (const GtkImageDefinition *def);
GIcon * gtk_image_definition_get_gicon (const GtkImageDefinition *def);
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index 230952a..186543e 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -773,16 +773,6 @@ clone_image_menu_size (GtkImage *image)
gtk_image_get_icon_name (image, &icon_name, NULL);
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)
{
GIcon *icon;
@@ -953,29 +943,14 @@ gtk_tool_button_update (GtkActivatable *activatable,
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
else if (strcmp (property_name, "gicon") == 0)
{
- const gchar *stock_id = gtk_action_get_stock_id (action);
GIcon *icon = gtk_action_get_gicon (action);
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);
- icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
+ image = gtk_tool_button_get_icon_widget (button);
+ icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
- if (!image)
- image = gtk_image_new ();
- }
+ if (!image)
+ image = gtk_image_new ();
gtk_tool_button_set_icon_widget (button, image);
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;
GIcon *icon;
- const gchar *stock_id;
- GtkIconSet *icon_set = NULL;
parent_activatable_iface->sync_action_properties (activatable, action);
if (!action)
return;
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (!gtk_activatable_get_use_action_appearance (activatable))
return;
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_use_underline (button, TRUE);
gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
- if (stock_id)
- {
- 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)
+ if ((icon = gtk_action_get_gicon (action)) != NULL)
{
GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (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));
else
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
+
+
+ G_GNUC_END_IGNORE_DEPRECATIONS;
}
diff --git a/tests/testimage.c b/tests/testimage.c
index 2752329..b560b8e 100644
--- a/tests/testimage.c
+++ b/tests/testimage.c
@@ -98,8 +98,6 @@ main (int argc, char **argv)
GtkWidget *label, *image, *box;
GtkIconTheme *theme;
GdkPixbuf *pixbuf;
- GtkIconSet *iconset;
- GtkIconSource *iconsource;
gchar *icon_name = "gnome-terminal";
gchar *anim_filename = NULL;
GIcon *icon;
@@ -149,19 +147,6 @@ main (int argc, char **argv)
g_signal_connect (box, "drag_data_received",
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");
gtk_grid_attach (GTK_GRID (grid), label, 0, 4, 1, 1);
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]