[gnome-shell] [ShellEmbeddedWindow] Set window type in g_object_new
- From: Florian Müllner <fmuellner src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] [ShellEmbeddedWindow] Set window type in g_object_new
- Date: Mon, 8 Feb 2010 17:43:39 +0000 (UTC)
commit fb7ed1ee28723130c43063831d34196e10c4aab5
Author: Florian Müllner <fmuellner src gnome org>
Date: Sun Feb 7 00:38:02 2010 +0100
[ShellEmbeddedWindow] Set window type in g_object_new
As of 2a78adc5e3, gobject no longer allows for setting construct-only
properties via g_object_set() during object initialization; set the
properties in a custom constructor instead.
https://bugzilla.gnome.org/show_bug.cgi?id=608802
src/shell-embedded-window.c | 39 ++++++++++++++++++++++++++++-----------
1 files changed, 28 insertions(+), 11 deletions(-)
---
diff --git a/src/shell-embedded-window.c b/src/shell-embedded-window.c
index a12d7d6..fbc7bbe 100644
--- a/src/shell-embedded-window.c
+++ b/src/shell-embedded-window.c
@@ -138,14 +138,42 @@ shell_embedded_window_check_resize (GtkContainer *container)
clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor));
}
+static GObject *
+shell_embedded_window_constructor (GType gtype,
+ guint n_properties,
+ GObjectConstructParam *properties)
+{
+ GObject *object;
+ GObjectClass *parent_class;
+
+ parent_class = G_OBJECT_CLASS (shell_embedded_window_parent_class);
+ object = parent_class->constructor (gtype, n_properties, properties);
+
+ /* Setting the resize mode to immediate means that calling queue_resize()
+ * on a widget within the window will immmediately call check_resize()
+ * to be called, instead of having it queued to an idle. From our perspective,
+ * this is ideal since we just are going to queue a resize to Clutter's
+ * idle resize anyways.
+ */
+ g_object_set (object,
+ "resize-mode", GTK_RESIZE_IMMEDIATE,
+ "type", GTK_WINDOW_POPUP,
+ NULL);
+
+ return object;
+}
+
static void
shell_embedded_window_class_init (ShellEmbeddedWindowClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
g_type_class_add_private (klass, sizeof (ShellEmbeddedWindowPrivate));
+ object_class->constructor = shell_embedded_window_constructor;
+
widget_class->show = shell_embedded_window_show;
widget_class->hide = shell_embedded_window_hide;
widget_class->realize = shell_embedded_window_realize;
@@ -159,17 +187,6 @@ shell_embedded_window_init (ShellEmbeddedWindow *window)
{
window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, SHELL_TYPE_EMBEDDED_WINDOW,
ShellEmbeddedWindowPrivate);
-
- /* Setting the resize mode to immediate means that calling queue_resize()
- * on a widget within the window will immmediately call check_resize()
- * to be called, instead of having it queued to an idle. From our perspective,
- * this is ideal since we just are going to queue a resize to Clutter's
- * idle resize anyways.
- */
- g_object_set (G_OBJECT (window),
- "resize-mode", GTK_RESIZE_IMMEDIATE,
- "type", GTK_WINDOW_POPUP,
- NULL);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]