[gtk+] gtk/gtkseparator: Do not use GET_PRIVATE macro all the time
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk/gtkseparator: Do not use GET_PRIVATE macro all the time
- Date: Thu, 26 Aug 2010 16:00:49 +0000 (UTC)
commit c6a44d849424ac77c478d56ff727ebc742d054b0
Author: Javier Jardón <jjardon gnome org>
Date: Thu Aug 26 18:00:09 2010 +0200
gtk/gtkseparator: Do not use GET_PRIVATE macro all the time
Use a private pointer instead
gtk/gtkseparator.c | 36 ++++++++++++++++++++----------------
gtk/gtkseparator.h | 3 +++
2 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index 45e93f3..db293c9 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -42,21 +42,16 @@
*/
-enum {
- PROP_0,
- PROP_ORIENTATION
-};
-
-
-typedef struct _GtkSeparatorPrivate GtkSeparatorPrivate;
-
-struct _GtkSeparatorPrivate
+struct _GtkSeparatorPriv
{
GtkOrientation orientation;
};
-#define GTK_SEPARATOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_SEPARATOR, GtkSeparatorPrivate))
+enum {
+ PROP_0,
+ PROP_ORIENTATION
+};
static void gtk_separator_set_property (GObject *object,
guint prop_id,
@@ -94,14 +89,19 @@ gtk_separator_class_init (GtkSeparatorClass *class)
PROP_ORIENTATION,
"orientation");
- g_type_class_add_private (object_class, sizeof (GtkSeparatorPrivate));
+ g_type_class_add_private (object_class, sizeof (GtkSeparatorPriv));
}
static void
gtk_separator_init (GtkSeparator *separator)
{
GtkWidget *widget = GTK_WIDGET (separator);
- GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (separator);
+ GtkSeparatorPriv *private;
+
+ separator->priv = G_TYPE_INSTANCE_GET_PRIVATE (separator,
+ GTK_TYPE_SEPARATOR,
+ GtkSeparatorPriv);
+ private = separator->priv;
gtk_widget_set_has_window (GTK_WIDGET (separator), FALSE);
@@ -117,7 +117,8 @@ gtk_separator_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (object);
+ GtkSeparator *separator = GTK_SEPARATOR (object);
+ GtkSeparatorPriv *private = separator->priv;
switch (prop_id)
{
@@ -137,7 +138,8 @@ gtk_separator_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (object);
+ GtkSeparator *separator = GTK_SEPARATOR (object);
+ GtkSeparatorPriv *private = separator->priv;
switch (prop_id)
{
@@ -154,7 +156,8 @@ static void
gtk_separator_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (widget);
+ GtkSeparator *separator = GTK_SEPARATOR (widget);
+ GtkSeparatorPriv *private = separator->priv;
gboolean wide_separators;
gint separator_width;
gint separator_height;
@@ -188,7 +191,8 @@ static gboolean
gtk_separator_expose (GtkWidget *widget,
GdkEventExpose *event)
{
- GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (widget);
+ GtkSeparator *separator = GTK_SEPARATOR (widget);
+ GtkSeparatorPriv *private = separator->priv;
gboolean wide_separators;
gint separator_width;
gint separator_height;
diff --git a/gtk/gtkseparator.h b/gtk/gtkseparator.h
index 6b3e519..b1a4167 100644
--- a/gtk/gtkseparator.h
+++ b/gtk/gtkseparator.h
@@ -46,11 +46,14 @@ G_BEGIN_DECLS
typedef struct _GtkSeparator GtkSeparator;
+typedef struct _GtkSeparatorPriv GtkSeparatorPriv;
typedef struct _GtkSeparatorClass GtkSeparatorClass;
struct _GtkSeparator
{
GtkWidget widget;
+
+ GtkSeparatorPriv *priv;
};
struct _GtkSeparatorClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]