[gtk+/refactor: 65/106] GtkInvisible: move public members to private structure
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/refactor: 65/106] GtkInvisible: move public members to private structure
- Date: Tue, 13 Jul 2010 17:35:28 +0000 (UTC)
commit 6e80685bf887931e8022655a3d4a9d732382e55e
Author: Javier Jardón <jjardon gnome org>
Date: Thu Jun 24 02:58:49 2010 +0200
GtkInvisible: move public members to private structure
gtk/gtkinvisible.c | 49 ++++++++++++++++++++++++++++++++++---------------
gtk/gtkinvisible.h | 5 +++--
2 files changed, 37 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c
index 08e65f3..2d8bd65 100644
--- a/gtk/gtkinvisible.c
+++ b/gtk/gtkinvisible.c
@@ -30,6 +30,12 @@
#include "gtkprivate.h"
#include "gtkintl.h"
+struct _GtkInvisiblePriv
+{
+ GdkScreen *screen;
+ gboolean has_user_ref_count;
+};
+
enum {
PROP_0,
PROP_SCREEN,
@@ -86,21 +92,29 @@ gtk_invisible_class_init (GtkInvisibleClass *class)
P_("The screen where this window will be displayed"),
GDK_TYPE_SCREEN,
GTK_PARAM_READWRITE));
+
+ g_type_class_add_private (class, sizeof (GtkInvisiblePriv));
}
static void
gtk_invisible_init (GtkInvisible *invisible)
{
+ GtkInvisiblePriv *priv;
GdkColormap *colormap;
-
+
+ invisible->priv = G_TYPE_INSTANCE_GET_PRIVATE (invisible,
+ GTK_TYPE_INVISIBLE,
+ GtkInvisiblePriv);
+ priv = invisible->priv;
+
gtk_widget_set_has_window (GTK_WIDGET (invisible), TRUE);
_gtk_widget_set_is_toplevel (GTK_WIDGET (invisible), TRUE);
g_object_ref_sink (invisible);
- invisible->has_user_ref_count = TRUE;
- invisible->screen = gdk_screen_get_default ();
-
+ priv->has_user_ref_count = TRUE;
+ priv->screen = gdk_screen_get_default ();
+
colormap = _gtk_widget_peek_colormap ();
if (colormap)
gtk_widget_set_colormap (GTK_WIDGET (invisible), colormap);
@@ -110,10 +124,11 @@ static void
gtk_invisible_destroy (GtkObject *object)
{
GtkInvisible *invisible = GTK_INVISIBLE (object);
-
- if (invisible->has_user_ref_count)
+ GtkInvisiblePriv *priv = invisible->priv;
+
+ if (priv->has_user_ref_count)
{
- invisible->has_user_ref_count = FALSE;
+ priv->has_user_ref_count = FALSE;
g_object_unref (invisible);
}
@@ -165,25 +180,28 @@ void
gtk_invisible_set_screen (GtkInvisible *invisible,
GdkScreen *screen)
{
+ GtkInvisiblePriv *priv;
GtkWidget *widget;
GdkScreen *previous_screen;
gboolean was_realized;
-
+
g_return_if_fail (GTK_IS_INVISIBLE (invisible));
g_return_if_fail (GDK_IS_SCREEN (screen));
- if (screen == invisible->screen)
+ priv = invisible->priv;
+
+ if (screen == priv->screen)
return;
widget = GTK_WIDGET (invisible);
- previous_screen = invisible->screen;
+ previous_screen = priv->screen;
was_realized = gtk_widget_get_realized (widget);
if (was_realized)
gtk_widget_unrealize (widget);
-
- invisible->screen = screen;
+
+ priv->screen = screen;
if (screen != previous_screen)
_gtk_widget_propagate_screen_changed (widget, previous_screen);
g_object_notify (G_OBJECT (invisible), "screen");
@@ -206,8 +224,8 @@ GdkScreen *
gtk_invisible_get_screen (GtkInvisible *invisible)
{
g_return_val_if_fail (GTK_IS_INVISIBLE (invisible), NULL);
-
- return invisible->screen;
+
+ return invisible->priv->screen;
}
static void
@@ -289,11 +307,12 @@ gtk_invisible_get_property (GObject *object,
GParamSpec *pspec)
{
GtkInvisible *invisible = GTK_INVISIBLE (object);
+ GtkInvisiblePriv *priv = invisible->priv;
switch (prop_id)
{
case PROP_SCREEN:
- g_value_set_object (value, invisible->screen);
+ g_value_set_object (value, priv->screen);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/gtk/gtkinvisible.h b/gtk/gtkinvisible.h
index 2f38905..9cda19d 100644
--- a/gtk/gtkinvisible.h
+++ b/gtk/gtkinvisible.h
@@ -44,14 +44,15 @@ G_BEGIN_DECLS
typedef struct _GtkInvisible GtkInvisible;
+typedef struct _GtkInvisiblePriv GtkInvisiblePriv;
typedef struct _GtkInvisibleClass GtkInvisibleClass;
struct _GtkInvisible
{
GtkWidget widget;
- gboolean GSEAL (has_user_ref_count);
- GdkScreen *GSEAL (screen);
+ /* <private> */
+ GtkInvisiblePriv *priv;
};
struct _GtkInvisibleClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]