summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Riemann <[email protected]>2011-06-04 21:41:00 +0200
committerraveit65 <[email protected]>2018-07-08 12:19:44 +0200
commit63a6313edf251919487047f47ad1f08228e7ba8d (patch)
tree0ce1e4904839807b945f891d39cdd7fd38223c7a /src
parentcfc83b480d4a4577f8b6fcec818a4d63f6b2bb7e (diff)
downloadeom-63a6313edf251919487047f47ad1f08228e7ba8d.tar.bz2
eom-63a6313edf251919487047f47ad1f08228e7ba8d.tar.xz
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
Diffstat (limited to 'src')
-rw-r--r--src/eom-scroll-view.c42
-rw-r--r--src/eom-scroll-view.h1
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);