[glade3] * gladui/glade-placeholder.c: Made GladePlaceholder Implement GtkScrollable so as to avoid warni
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * gladui/glade-placeholder.c: Made GladePlaceholder Implement GtkScrollable so as to avoid warni
- Date: Mon, 27 Dec 2010 09:16:27 +0000 (UTC)
commit b3c23fe05ba556bfc7bd7874f66612678f9c872d
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Dec 27 18:21:39 2010 +0900
* gladui/glade-placeholder.c: Made GladePlaceholder Implement GtkScrollable so
as to avoid warnings when using placeholders inside scrolled windows.
ChangeLog | 3 ++
gladeui/glade-placeholder.c | 72 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 73 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e467baf..07522a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,9 @@
* gladeui/glade-widget-adaptor.c: Uncommenting some code that for some reason
got "fallout" from the offscreen branches.
+ * gladui/glade-placeholder.c: Made GladePlaceholder Implement GtkScrollable so
+ as to avoid warnings when using placeholders inside scrolled windows.
+
2010-12-26 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-previewer.c: Added include <locale.h> for setlocale() (bug 638035).
diff --git a/gladeui/glade-placeholder.c b/gladeui/glade-placeholder.c
index d0643b1..57ebc48 100644
--- a/gladeui/glade-placeholder.c
+++ b/gladeui/glade-placeholder.c
@@ -52,7 +52,14 @@
#define HEIGHT_REQUISITION 20
static void glade_placeholder_finalize (GObject *object);
-
+static void glade_placeholder_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void glade_placeholder_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void glade_placeholder_realize (GtkWidget *widget);
static void glade_placeholder_unrealize (GtkWidget *widget);
static void glade_placeholder_map (GtkWidget *widget);
@@ -72,7 +79,16 @@ static gboolean glade_placeholder_button_press (GtkWidget *widget,
static gboolean glade_placeholder_popup_menu (GtkWidget *widget);
-G_DEFINE_TYPE (GladePlaceholder, glade_placeholder, GTK_TYPE_WIDGET)
+enum {
+ PROP_0,
+ PROP_HADJUSTMENT,
+ PROP_VADJUSTMENT,
+ PROP_HSCROLL_POLICY,
+ PROP_VSCROLL_POLICY
+};
+
+G_DEFINE_TYPE_WITH_CODE (GladePlaceholder, glade_placeholder, GTK_TYPE_WIDGET,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
static void
glade_placeholder_class_init (GladePlaceholderClass *klass)
@@ -81,6 +97,9 @@ glade_placeholder_class_init (GladePlaceholderClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = glade_placeholder_finalize;
+ object_class->set_property = glade_placeholder_set_property;
+ object_class->get_property = glade_placeholder_get_property;
+
widget_class->realize = glade_placeholder_realize;
widget_class->unrealize = glade_placeholder_unrealize;
widget_class->map = glade_placeholder_map;
@@ -90,6 +109,13 @@ glade_placeholder_class_init (GladePlaceholderClass *klass)
widget_class->motion_notify_event = glade_placeholder_motion_notify_event;
widget_class->button_press_event = glade_placeholder_button_press;
widget_class->popup_menu = glade_placeholder_popup_menu;
+
+
+ /* GtkScrollable implementation */
+ g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
+ g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
+ g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
+ g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
}
static void
@@ -159,6 +185,48 @@ glade_placeholder_finalize (GObject *object)
}
static void
+glade_placeholder_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+
+ switch (prop_id)
+ {
+ case PROP_HADJUSTMENT:
+ case PROP_VADJUSTMENT:
+ case PROP_HSCROLL_POLICY:
+ case PROP_VSCROLL_POLICY:
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+glade_placeholder_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id)
+ {
+ case PROP_HADJUSTMENT:
+ case PROP_VADJUSTMENT:
+ g_value_set_object (value, NULL);
+ break;
+ case PROP_HSCROLL_POLICY:
+ case PROP_VSCROLL_POLICY:
+ g_value_set_enum (value, GTK_SCROLL_MINIMUM);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
glade_placeholder_realize (GtkWidget *widget)
{
GladePlaceholder *placeholder;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]