[gtk+] image: simplify code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] image: simplify code
- Date: Thu, 1 Dec 2011 00:18:02 +0000 (UTC)
commit 772459979f82e78f39a5330dc9c70445c4d86081
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Nov 30 19:06:21 2011 -0500
image: simplify code
We can unconditionally call into the icon helper methods now that we
removed the g_return_val_if_fail() checks.
gtk/gtkimage.c | 40 ++++++----------------------------------
1 files changed, 6 insertions(+), 34 deletions(-)
---
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index f846e9d..8b49b32 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]