summaryrefslogtreecommitdiff
path: root/gtk/gtkimage.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-11-30 19:06:21 -0500
committerCosimo Cecchi <cosimoc@gnome.org>2011-11-30 19:06:38 -0500
commit772459979f82e78f39a5330dc9c70445c4d86081 (patch)
tree0c7cf986a9b3ff7ed455aa4685e0dfd995333c7c /gtk/gtkimage.c
parentd47e82ffddc4df01e76d3829f25bbc29dc48672b (diff)
downloadgtk+-772459979f82e78f39a5330dc9c70445c4d86081.tar.gz
image: simplify code
We can unconditionally call into the icon helper methods now that we removed the g_return_val_if_fail() checks.
Diffstat (limited to 'gtk/gtkimage.c')
-rw-r--r--gtk/gtkimage.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index f846e9d628..8b49b32363 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -434,37 +434,20 @@ gtk_image_get_property (GObject *object,
{
GtkImage *image = GTK_IMAGE (object);
GtkImagePrivate *priv = image->priv;
- GtkImageType storage_type;
- /* The "getter" functions whine if you try to get the wrong
- * storage type. This function is instead robust against that,
- * so that GUI builders don't have to jump through hoops
- * to avoid g_warning
- */
- storage_type = _gtk_icon_helper_get_storage_type (priv->icon_helper);
-
switch (prop_id)
{
case PROP_PIXBUF:
- if (storage_type != GTK_IMAGE_PIXBUF)
- g_value_set_object (value, NULL);
- else
- g_value_set_object (value, _gtk_icon_helper_peek_pixbuf (priv->icon_helper));
+ g_value_set_object (value, _gtk_icon_helper_peek_pixbuf (priv->icon_helper));
break;
case PROP_FILE:
g_value_set_string (value, priv->filename);
break;
case PROP_STOCK:
- if (storage_type != GTK_IMAGE_STOCK)
- g_value_set_string (value, NULL);
- else
- g_value_set_string (value, _gtk_icon_helper_get_icon_name (priv->icon_helper));
+ g_value_set_string (value, _gtk_icon_helper_get_icon_name (priv->icon_helper));
break;
case PROP_ICON_SET:
- if (storage_type != GTK_IMAGE_ICON_SET)
- g_value_set_boxed (value, NULL);
- else
- g_value_set_boxed (value, _gtk_icon_helper_peek_icon_set (priv->icon_helper));
+ g_value_set_boxed (value, _gtk_icon_helper_peek_icon_set (priv->icon_helper));
break;
case PROP_ICON_SIZE:
g_value_set_int (value, _gtk_icon_helper_get_icon_size (priv->icon_helper));
@@ -473,28 +456,17 @@ gtk_image_get_property (GObject *object,
g_value_set_int (value, _gtk_icon_helper_get_pixel_size (priv->icon_helper));
break;
case PROP_PIXBUF_ANIMATION:
- if (storage_type != GTK_IMAGE_ANIMATION)
- g_value_set_object (value, NULL);
- else
- g_value_set_object (value, _gtk_icon_helper_peek_animation (priv->icon_helper));
+ g_value_set_object (value, _gtk_icon_helper_peek_animation (priv->icon_helper));
break;
case PROP_ICON_NAME:
- if (storage_type != GTK_IMAGE_ICON_NAME)
- g_value_set_string (value, NULL);
- else
- g_value_set_string (value, _gtk_icon_helper_get_icon_name (priv->icon_helper));
+ g_value_set_string (value, _gtk_icon_helper_get_icon_name (priv->icon_helper));
break;
case PROP_GICON:
- if (storage_type != GTK_IMAGE_GICON)
- g_value_set_object (value, NULL);
- else
- g_value_set_object (value, _gtk_icon_helper_peek_gicon (priv->icon_helper));
+ g_value_set_object (value, _gtk_icon_helper_peek_gicon (priv->icon_helper));
break;
-
case PROP_USE_FALLBACK:
g_value_set_boolean (value, _gtk_icon_helper_get_use_fallback (priv->icon_helper));
break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;