Skip to content
Permalink
Browse files

Make the displayed EomImage a property of EomScrollView

Besides the more obvious object orientation it also allows watch the
property for changes. Might be useful for plugins.

https://bugzilla.gnome.org/show_bug.cgi?id=544068

origin commit:
https://git.gnome.org/browse/eog/commit/?h=gnome-3-4&id=4c0b5c8
  • Loading branch information...
Felix Riemann authored and raveit65 committed Jun 4, 2011
1 parent cfc83b4 commit 63a6313edf251919487047f47ad1f08228e7ba8d
Showing with 43 additions and 0 deletions.
  1. +42 −0 src/eom-scroll-view.c
  2. +1 −0 src/eom-scroll-view.h
@@ -73,6 +73,7 @@ enum {
PROP_ANTIALIAS_IN,
PROP_ANTIALIAS_OUT,
PROP_BACKGROUND_COLOR,
PROP_IMAGE,
PROP_SCROLLWHEEL_ZOOM,
PROP_TRANSP_COLOR,
PROP_TRANSPARENCY_STYLE,
@@ -1671,6 +1672,31 @@ eom_scroll_view_set_image (EomScrollView *view, EomImage *image)
}

priv->image = image;

g_object_notify (G_OBJECT (view), "image");
}

/**
* eom_scroll_view_get_image:
* @view: An #EomScrollView.
*
* Gets the the currently displayed #EomImage.
*
* Returns: (transfer full): An #EomImage.
**/
EomImage*
eom_scroll_view_get_image (EomScrollView *view)
{
EomImage *img;

g_return_val_if_fail (EOM_IS_SCROLL_VIEW (view), NULL);

img = view->priv->image;

if (img != NULL)
g_object_ref (img);

return img;
}

gboolean
@@ -1920,6 +1946,9 @@ eom_scroll_view_get_property (GObject *object, guint property_id,
case PROP_ZOOM_MULTIPLIER:
g_value_set_double (value, priv->zoom_multiplier);
break;
case PROP_IMAGE:
g_value_set_object (value, priv->image);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -1963,6 +1992,9 @@ eom_scroll_view_set_property (GObject *object, guint property_id,
case PROP_ZOOM_MULTIPLIER:
eom_scroll_view_set_zoom_multiplier (view, g_value_get_double (value));
break;
case PROP_IMAGE:
eom_scroll_view_set_image (view, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -2033,6 +2065,16 @@ eom_scroll_view_class_init (EomScrollViewClass *klass)
g_param_spec_boolean ("scrollwheel-zoom", NULL, NULL, TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME));

/**
* EomScrollView:image:
*
* This is the currently display #EomImage.
*/
g_object_class_install_property (
gobject_class, PROP_IMAGE,
g_param_spec_object ("image", NULL, NULL, EOM_TYPE_IMAGE,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME));

/**
* EomScrollView:transparency-color:
*
@@ -40,6 +40,7 @@ GtkWidget* eom_scroll_view_new (void);

/* loading stuff */
void eom_scroll_view_set_image (EomScrollView *view, EomImage *image);
EomImage* eom_scroll_view_get_image (EomScrollView *view);

/* general properties */
void eom_scroll_view_set_scroll_wheel_zoom (EomScrollView *view, gboolean scroll_wheel_zoom);

0 comments on commit 63a6313

Please sign in to comment.
You can’t perform that action at this time.