diff options
-rw-r--r-- | src/eom-scroll-view.c | 42 | ||||
-rw-r--r-- | src/eom-scroll-view.h | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c index 69e9b99..7be50e2 100644 --- a/src/eom-scroll-view.c +++ b/src/eom-scroll-view.c @@ -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); } @@ -2034,6 +2066,16 @@ eom_scroll_view_class_init (EomScrollViewClass *klass) 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: * * This is the color used to fill the transparent parts of an image diff --git a/src/eom-scroll-view.h b/src/eom-scroll-view.h index 69a57a4..2dffec3 100644 --- a/src/eom-scroll-view.h +++ b/src/eom-scroll-view.h @@ -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); |