forked from AuroraMiddleware/gtk
GtkMenuBar: Use private pointer instead GET_PRIV() macro all the time
This commit is contained in:
parent
a3b039d317
commit
4d7ecabaf0
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user