[glide] Add slide property to slide button
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Add slide property to slide button
- Date: Thu, 29 Apr 2010 08:41:26 +0000 (UTC)
commit a7a087fa32b5d6a72d4bc22f08f30467c5fc043c
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu Apr 29 02:35:04 2010 -0400
Add slide property to slide button
src/glide-slide-button-priv.h | 2 +-
src/glide-slide-button.c | 70 +++++++++++++++++++++++++++++++++++++++++
src/glide-slide-button.h | 4 ++
3 files changed, 75 insertions(+), 1 deletions(-)
---
diff --git a/src/glide-slide-button-priv.h b/src/glide-slide-button-priv.h
index 330ea14..fe6cff9 100644
--- a/src/glide-slide-button-priv.h
+++ b/src/glide-slide-button-priv.h
@@ -26,7 +26,7 @@ G_BEGIN_DECLS
struct _GlideSlideButtonPrivate
{
- gpointer fill;
+ GlideSlide *slide;
};
G_END_DECLS
diff --git a/src/glide-slide-button.c b/src/glide-slide-button.c
index 8e195b3..9c44f9a 100644
--- a/src/glide-slide-button.c
+++ b/src/glide-slide-button.c
@@ -23,6 +23,50 @@
G_DEFINE_TYPE(GlideSlideButton, glide_slide_button, GTK_TYPE_BUTTON);
+enum {
+ PROP_O,
+ PROP_SLIDE
+};
+
+static void
+glide_slide_button_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GlideSlideButton *button = GLIDE_SLIDE_BUTTON (object);
+
+ switch (prop_id)
+ {
+ case PROP_SLIDE:
+ g_value_set_object (value, button->priv->slide);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+glide_slide_button_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GlideSlideButton *button = GLIDE_SLIDE_BUTTON (object);
+
+ switch (prop_id)
+ {
+ case PROP_SLIDE:
+ glide_slide_button_set_slide (button, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
static void
glide_slide_button_finalize (GObject *object)
{
@@ -41,6 +85,18 @@ glide_slide_button_class_init (GlideSlideButtonClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = glide_slide_button_finalize;
+
+ object_class->get_property = glide_slide_button_get_property;
+ object_class->set_property = glide_slide_button_set_property;
+
+ g_object_class_install_property (object_class,
+ PROP_SLIDE,
+ g_param_spec_object ("slide",
+ "Slide",
+ "The slide the button should display",
+ GLIDE_TYPE_SLIDE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
g_type_class_add_private (object_class, sizeof(GlideSlideButtonPrivate));
}
@@ -49,3 +105,17 @@ glide_slide_button_new ()
{
return (GtkWidget *)g_object_new (GLIDE_TYPE_SLIDE_BUTTON, NULL);
}
+
+GlideSlide *
+glide_slide_button_get_slide (GlideSlideButton *button)
+{
+ return button->priv->slide;
+}
+
+void
+glide_slide_button_set_slide (GlideSlideButton *button,
+ GlideSlide *slide)
+{
+ button->priv->slide = slide;
+ g_object_notify (G_OBJECT (button), "slide");
+}
diff --git a/src/glide-slide-button.h b/src/glide-slide-button.h
index 93786fe..c7af93e 100644
--- a/src/glide-slide-button.h
+++ b/src/glide-slide-button.h
@@ -20,6 +20,7 @@
#define __GLIDE_SLIDE_BUTTON_H__
#include <gtk/gtk.h>
+#include "glide-slide.h"
G_BEGIN_DECLS
@@ -52,6 +53,9 @@ struct _GlideSlideButtonClass
GType glide_slide_button_get_type (void) G_GNUC_CONST;
GtkWidget *glide_slide_button_new (void);
+GlideSlide *glide_slide_button_get_slide (GlideSlideButton *button);
+void glide_slide_button_set_slide (GlideSlideButton *button, GlideSlide *slide);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]