[gtk+] Finish conversion of pixbuf cell renderer icon size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Finish conversion of pixbuf cell renderer icon size
- Date: Fri, 1 Dec 2017 21:42:32 +0000 (UTC)
commit 4930153413546ddbf0c9fd3a83ac9a961fa87a62
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Dec 1 10:26:51 2017 -0500
Finish conversion of pixbuf cell renderer icon size
Change the name of the property from stock-size to icon-size,
and make it an enum property instead of uint. This makes it
impossible to specify invalid numeric values in ui files, and
at the same time makes it possible to refer to the existing
values by their nick.
Fix up the callers.
demos/widget-factory/widget-factory.c | 6 +++---
gtk/gtkcellrendererpixbuf.c | 27 ++++++++++++---------------
2 files changed, 15 insertions(+), 18 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 016ee9d..47dba4c 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1546,7 +1546,7 @@ increase_icon_size (GtkWidget *iv)
cell = cells->data;
g_list_free (cells);
- g_object_set (cell, "stock-size", GTK_ICON_SIZE_LARGE, NULL);
+ g_object_set (cell, "icon-size", GTK_ICON_SIZE_LARGE, NULL);
update_buttons (iv, GTK_ICON_SIZE_LARGE);
@@ -1563,7 +1563,7 @@ decrease_icon_size (GtkWidget *iv)
cell = cells->data;
g_list_free (cells);
- g_object_set (cell, "stock-size", GTK_ICON_SIZE_NORMAL, NULL);
+ g_object_set (cell, "icon-size", GTK_ICON_SIZE_NORMAL, NULL);
update_buttons (iv, GTK_ICON_SIZE_NORMAL);
@@ -1580,7 +1580,7 @@ reset_icon_size (GtkWidget *iv)
cell = cells->data;
g_list_free (cells);
- g_object_set (cell, "stock-size", GTK_ICON_SIZE_INHERIT, NULL);
+ g_object_set (cell, "icon-size", GTK_ICON_SIZE_INHERIT, NULL);
update_buttons (iv, GTK_ICON_SIZE_INHERIT);
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index b9cce68..d6a610c 100644
--- a/gtk/gtkcellrendererpixbuf.c
+++ b/gtk/gtkcellrendererpixbuf.c
@@ -77,8 +77,7 @@ enum {
PROP_PIXBUF_EXPANDER_CLOSED,
PROP_SURFACE,
PROP_TEXTURE,
- PROP_STOCK_SIZE,
- PROP_STOCK_DETAIL,
+ PROP_ICON_SIZE,
PROP_ICON_NAME,
PROP_GICON
};
@@ -186,19 +185,18 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
GTK_PARAM_READWRITE));
/**
- * GtkCellRendererPixbuf:stock-size:
+ * GtkCellRendererPixbuf:icon-size:
*
* The #GtkIconSize value that specifies the size of the rendered icon.
*
- * Since: 2.2
+ * Since: 3.94
*/
g_object_class_install_property (object_class,
- PROP_STOCK_SIZE,
- g_param_spec_uint ("stock-size",
- P_("Size"),
+ PROP_ICON_SIZE,
+ g_param_spec_enum ("icon-size",
+ P_("Icon Size"),
P_("The GtkIconSize value that specifies the size of
the rendered icon"),
- 0,
- G_MAXUINT,
+ GTK_TYPE_ICON_SIZE,
GTK_ICON_SIZE_INHERIT,
GTK_PARAM_READWRITE));
@@ -206,8 +204,7 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
* GtkCellRendererPixbuf:icon-name:
*
* The name of the themed icon to display.
- * This property only has an effect if not overridden by "stock_id"
- * or "pixbuf" properties.
+ * This property only has an effect if not overridden by the "pixbuf" property.
*
* Since: 2.8
*/
@@ -278,8 +275,8 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
case PROP_TEXTURE:
g_value_set_object (value, gtk_image_definition_get_texture (priv->image_def));
break;
- case PROP_STOCK_SIZE:
- g_value_set_uint (value, priv->icon_size);
+ case PROP_ICON_SIZE:
+ g_value_set_enum (value, priv->icon_size);
break;
case PROP_ICON_NAME:
g_value_set_string (value, gtk_image_definition_get_icon_name (priv->image_def));
@@ -375,8 +372,8 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
case PROP_TEXTURE:
take_image_definition (cellpixbuf, gtk_image_definition_new_texture (g_value_get_object (value)));
break;
- case PROP_STOCK_SIZE:
- priv->icon_size = g_value_get_uint (value);
+ case PROP_ICON_SIZE:
+ priv->icon_size = g_value_get_enum (value);
break;
case PROP_ICON_NAME:
take_image_definition (cellpixbuf, gtk_image_definition_new_icon_name (g_value_get_string (value)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]