[gtk+/refactor: 71/106] GtkMenuBar: Use private pointer instead GET_PRIV() macro all the time
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/refactor: 71/106] GtkMenuBar: Use private pointer instead GET_PRIV() macro all the time
- Date: Tue, 13 Jul 2010 17:48:01 +0000 (UTC)
commit 4d7ecabaf0fbc0dd248d46031e01c50cdc93d201
Author: Javier Jardón <jjardon gnome org>
Date: Mon Jun 28 23:21:58 2010 +0200
GtkMenuBar: Use private pointer instead GET_PRIV() macro all the time
gtk/gtkmenubar.c | 31 +++++++++++--------------------
gtk/gtkmenubar.h | 8 ++++++--
2 files changed, 17 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index a06304e..a34d1d3 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -48,16 +48,12 @@ enum {
PROP_CHILD_PACK_DIRECTION
};
-typedef struct _GtkMenuBarPrivate GtkMenuBarPrivate;
struct _GtkMenuBarPrivate
{
GtkPackDirection pack_direction;
GtkPackDirection child_pack_direction;
};
-#define GTK_MENU_BAR_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_MENU_BAR, GtkMenuBarPrivate))
-
static void gtk_menu_bar_set_property (GObject *object,
guint prop_id,
@@ -212,12 +208,15 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
0,
GTK_PARAM_READWRITE));
- g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate));
+ g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate));
}
static void
-gtk_menu_bar_init (GtkMenuBar *object)
+gtk_menu_bar_init (GtkMenuBar *menu_bar)
{
+ menu_bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (menu_bar,
+ GTK_TYPE_MENU_BAR,
+ GtkMenuBarPrivate);
}
GtkWidget*
@@ -294,7 +293,7 @@ gtk_menu_bar_size_request (GtkWidget *widget,
{
menu_bar = GTK_MENU_BAR (widget);
menu_shell = GTK_MENU_SHELL (widget);
- priv = GTK_MENU_BAR_GET_PRIVATE (menu_bar);
+ priv = menu_bar->priv;
nchildren = 0;
children = menu_shell->children;
@@ -374,7 +373,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
menu_bar = GTK_MENU_BAR (widget);
menu_shell = GTK_MENU_SHELL (widget);
- priv = GTK_MENU_BAR_GET_PRIVATE (menu_bar);
+ priv = menu_bar->priv;
direction = gtk_widget_get_direction (widget);
@@ -841,14 +840,10 @@ gtk_menu_bar_move_current (GtkMenuShell *menu_shell,
GtkPackDirection
gtk_menu_bar_get_pack_direction (GtkMenuBar *menubar)
{
- GtkMenuBarPrivate *priv;
-
g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
GTK_PACK_DIRECTION_LTR);
-
- priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
- return priv->pack_direction;
+ return menubar->priv->pack_direction;
}
/**
@@ -869,7 +864,7 @@ gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
- priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
+ priv = menubar->priv;
if (priv->pack_direction != pack_dir)
{
@@ -898,14 +893,10 @@ gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
GtkPackDirection
gtk_menu_bar_get_child_pack_direction (GtkMenuBar *menubar)
{
- GtkMenuBarPrivate *priv;
-
g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
GTK_PACK_DIRECTION_LTR);
-
- priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
- return priv->child_pack_direction;
+ return menubar->priv->child_pack_direction;
}
/**
@@ -926,7 +917,7 @@ gtk_menu_bar_set_child_pack_direction (GtkMenuBar *menubar,
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
- priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
+ priv = menubar->priv;
if (priv->child_pack_direction != child_pack_dir)
{
diff --git a/gtk/gtkmenubar.h b/gtk/gtkmenubar.h
index 050fb48..2120945 100644
--- a/gtk/gtkmenubar.h
+++ b/gtk/gtkmenubar.h
@@ -45,12 +45,16 @@ G_BEGIN_DECLS
#define GTK_IS_MENU_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_BAR))
#define GTK_MENU_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_BAR, GtkMenuBarClass))
-typedef struct _GtkMenuBar GtkMenuBar;
-typedef struct _GtkMenuBarClass GtkMenuBarClass;
+typedef struct _GtkMenuBar GtkMenuBar;
+typedef struct _GtkMenuBarPrivate GtkMenuBarPrivate;
+typedef struct _GtkMenuBarClass GtkMenuBarClass;
struct _GtkMenuBar
{
GtkMenuShell menu_shell;
+
+ /* <private> */
+ GtkMenuBarPrivate *priv;
};
struct _GtkMenuBarClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]