[eog] Make the displayed EogImage a property of EogScrollView
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Make the displayed EogImage a property of EogScrollView
- Date: Sat, 4 Jun 2011 19:43:38 +0000 (UTC)
commit 4c0b5c84dc4c5a6fce6285f492d5f3c1a8724f45
Author: Felix Riemann <friemann gnome org>
Date: Sat Jun 4 21:41:00 2011 +0200
Make the displayed EogImage a property of EogScrollView
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
src/eog-scroll-view.c | 42 ++++++++++++++++++++++++++++++++++++++++++
src/eog-scroll-view.h | 2 ++
2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index 522c3b9..f7542a5 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -77,6 +77,7 @@ enum {
PROP_ANTIALIAS_IN,
PROP_ANTIALIAS_OUT,
PROP_BACKGROUND_COLOR,
+ PROP_IMAGE,
PROP_SCROLLWHEEL_ZOOM,
PROP_TRANSP_COLOR,
PROP_TRANSPARENCY_STYLE,
@@ -2349,6 +2350,31 @@ eog_scroll_view_set_image (EogScrollView *view, EogImage *image)
}
priv->image = image;
+
+ g_object_notify (G_OBJECT (view), "image");
+}
+
+/**
+ * eog_scroll_view_get_image:
+ * @view: An #EogScrollView.
+ *
+ * Gets the the currently displayed #EogImage.
+ *
+ * Returns: (transfer full): An #EogImage.
+ **/
+EogImage*
+eog_scroll_view_get_image (EogScrollView *view)
+{
+ EogImage *img;
+
+ g_return_val_if_fail (EOG_IS_SCROLL_VIEW (view), NULL);
+
+ img = view->priv->image;
+
+ if (img != NULL)
+ g_object_ref (img);
+
+ return img;
}
gboolean
@@ -2614,6 +2640,9 @@ eog_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);
}
@@ -2660,6 +2689,9 @@ eog_scroll_view_set_property (GObject *object, guint property_id,
case PROP_ZOOM_MULTIPLIER:
eog_scroll_view_set_zoom_multiplier (view, g_value_get_double (value));
break;
+ case PROP_IMAGE:
+ eog_scroll_view_set_image (view, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -2742,6 +2774,16 @@ eog_scroll_view_class_init (EogScrollViewClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
/**
+ * EogScrollView:image:
+ *
+ * This is the currently display #EogImage.
+ */
+ g_object_class_install_property (
+ gobject_class, PROP_IMAGE,
+ g_param_spec_object ("image", NULL, NULL, EOG_TYPE_IMAGE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
+
+ /**
* EogScrollView:transparency-color:
*
* This is the color used to fill the transparent parts of an image
diff --git a/src/eog-scroll-view.h b/src/eog-scroll-view.h
index 09b0b2e..f8c51aa 100644
--- a/src/eog-scroll-view.h
+++ b/src/eog-scroll-view.h
@@ -64,6 +64,8 @@ GtkWidget* eog_scroll_view_new (void);
/* loading stuff */
void eog_scroll_view_set_image (EogScrollView *view, EogImage *image);
+EogImage* eog_scroll_view_get_image (EogScrollView *view);
+
/* general properties */
void eog_scroll_view_set_scroll_wheel_zoom (EogScrollView *view, gboolean scroll_wheel_zoom);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]