forked from AuroraMiddleware/gtk
check menu item: Drop the priv pointer
This commit is contained in:
parent
5e4512d4c7
commit
be305d6dab
@ -60,6 +60,8 @@
|
|||||||
* with name check, which gets the .left or .right style class.
|
* with name check, which gets the .left or .right style class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef struct _GtkCheckMenuItemPrivate GtkCheckMenuItemPrivate;
|
||||||
|
|
||||||
struct _GtkCheckMenuItemPrivate
|
struct _GtkCheckMenuItemPrivate
|
||||||
{
|
{
|
||||||
GtkWidget *indicator_widget;
|
GtkWidget *indicator_widget;
|
||||||
@ -111,7 +113,7 @@ gtk_check_menu_item_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkAllocation indicator_alloc;
|
GtkAllocation indicator_alloc;
|
||||||
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
||||||
GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
gint toggle_size;
|
gint toggle_size;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
|
GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
|
||||||
@ -147,7 +149,8 @@ gtk_check_menu_item_size_allocate (GtkWidget *widget,
|
|||||||
static void
|
static void
|
||||||
gtk_check_menu_item_finalize (GObject *object)
|
gtk_check_menu_item_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv = GTK_CHECK_MENU_ITEM (object)->priv;
|
GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (object);
|
||||||
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (item);
|
||||||
|
|
||||||
gtk_widget_unparent (priv->indicator_widget);
|
gtk_widget_unparent (priv->indicator_widget);
|
||||||
|
|
||||||
@ -286,12 +289,10 @@ void
|
|||||||
gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
||||||
gboolean is_active)
|
gboolean is_active)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
||||||
|
|
||||||
priv = check_menu_item->priv;
|
|
||||||
|
|
||||||
is_active = is_active != 0;
|
is_active = is_active != 0;
|
||||||
|
|
||||||
if (priv->active != is_active)
|
if (priv->active != is_active)
|
||||||
@ -310,21 +311,23 @@ gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item)
|
gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item)
|
||||||
{
|
{
|
||||||
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
||||||
|
|
||||||
return check_menu_item->priv->active;
|
return priv->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_check_menu_item_toggle_size_request (GtkMenuItem *menu_item,
|
gtk_check_menu_item_toggle_size_request (GtkMenuItem *menu_item,
|
||||||
gint *requisition)
|
gint *requisition)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItem *check_menu_item;
|
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
|
||||||
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
|
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
|
||||||
|
|
||||||
check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
|
gtk_widget_measure (priv->indicator_widget,
|
||||||
gtk_widget_measure (check_menu_item->priv->indicator_widget,
|
|
||||||
GTK_ORIENTATION_HORIZONTAL,
|
GTK_ORIENTATION_HORIZONTAL,
|
||||||
-1,
|
-1,
|
||||||
requisition, NULL,
|
requisition, NULL,
|
||||||
@ -346,7 +349,7 @@ gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item)
|
|||||||
static void
|
static void
|
||||||
update_node_state (GtkCheckMenuItem *check_menu_item)
|
update_node_state (GtkCheckMenuItem *check_menu_item)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
GtkStateFlags state;
|
GtkStateFlags state;
|
||||||
|
|
||||||
state = gtk_widget_get_state_flags (GTK_WIDGET (check_menu_item));
|
state = gtk_widget_get_state_flags (GTK_WIDGET (check_menu_item));
|
||||||
@ -379,12 +382,10 @@ void
|
|||||||
gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
|
gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
|
||||||
gboolean setting)
|
gboolean setting)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
||||||
|
|
||||||
priv = check_menu_item->priv;
|
|
||||||
|
|
||||||
setting = setting != FALSE;
|
setting = setting != FALSE;
|
||||||
|
|
||||||
if (setting != priv->inconsistent)
|
if (setting != priv->inconsistent)
|
||||||
@ -407,9 +408,11 @@ gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item)
|
gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item)
|
||||||
{
|
{
|
||||||
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
||||||
|
|
||||||
return check_menu_item->priv->inconsistent;
|
return priv->inconsistent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -423,13 +426,11 @@ void
|
|||||||
gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item,
|
gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item,
|
||||||
gboolean draw_as_radio)
|
gboolean draw_as_radio)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
GtkCssNode *indicator_node;
|
GtkCssNode *indicator_node;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
||||||
|
|
||||||
priv = check_menu_item->priv;
|
|
||||||
|
|
||||||
draw_as_radio = draw_as_radio != FALSE;
|
draw_as_radio = draw_as_radio != FALSE;
|
||||||
|
|
||||||
if (draw_as_radio != priv->draw_as_radio)
|
if (draw_as_radio != priv->draw_as_radio)
|
||||||
@ -458,17 +459,18 @@ gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item)
|
gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item)
|
||||||
{
|
{
|
||||||
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
||||||
|
|
||||||
return check_menu_item->priv->draw_as_radio;
|
return priv->draw_as_radio;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
|
gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
priv = check_menu_item->priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
|
||||||
priv->active = FALSE;
|
priv->active = FALSE;
|
||||||
|
|
||||||
priv->indicator_widget = gtk_icon_new ("check");
|
priv->indicator_widget = gtk_icon_new ("check");
|
||||||
@ -479,10 +481,8 @@ gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
|
|||||||
static void
|
static void
|
||||||
gtk_check_menu_item_activate (GtkMenuItem *menu_item)
|
gtk_check_menu_item_activate (GtkMenuItem *menu_item)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv;
|
|
||||||
|
|
||||||
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
|
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
|
||||||
priv = check_menu_item->priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
priv->active = !priv->active;
|
priv->active = !priv->active;
|
||||||
|
|
||||||
@ -511,11 +511,11 @@ static void
|
|||||||
gtk_check_menu_item_direction_changed (GtkWidget *widget,
|
gtk_check_menu_item_direction_changed (GtkWidget *widget,
|
||||||
GtkTextDirection previous_dir)
|
GtkTextDirection previous_dir)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv = GTK_CHECK_MENU_ITEM (widget)->priv;
|
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
||||||
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->indicator_widget);
|
context = gtk_widget_get_style_context (priv->indicator_widget);
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||||
@ -548,8 +548,8 @@ gtk_check_menu_item_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
|
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (object);
|
||||||
GtkCheckMenuItemPrivate *priv = checkitem->priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -608,7 +608,7 @@ void
|
|||||||
_gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
_gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
||||||
gboolean is_active)
|
gboolean is_active)
|
||||||
{
|
{
|
||||||
GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
priv->active = is_active;
|
priv->active = is_active;
|
||||||
update_node_state (check_menu_item);
|
update_node_state (check_menu_item);
|
||||||
@ -617,5 +617,7 @@ _gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
|||||||
GtkWidget *
|
GtkWidget *
|
||||||
_gtk_check_menu_item_get_indicator_widget (GtkCheckMenuItem *check_menu_item)
|
_gtk_check_menu_item_get_indicator_widget (GtkCheckMenuItem *check_menu_item)
|
||||||
{
|
{
|
||||||
return check_menu_item->priv->indicator_widget;
|
GtkCheckMenuItemPrivate *priv = gtk_check_menu_item_get_instance_private (check_menu_item);
|
||||||
|
|
||||||
|
return priv->indicator_widget;
|
||||||
}
|
}
|
||||||
|
@ -44,15 +44,11 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
|
|
||||||
typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
|
typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
|
||||||
typedef struct _GtkCheckMenuItemPrivate GtkCheckMenuItemPrivate;
|
|
||||||
typedef struct _GtkCheckMenuItemClass GtkCheckMenuItemClass;
|
typedef struct _GtkCheckMenuItemClass GtkCheckMenuItemClass;
|
||||||
|
|
||||||
struct _GtkCheckMenuItem
|
struct _GtkCheckMenuItem
|
||||||
{
|
{
|
||||||
GtkMenuItem menu_item;
|
GtkMenuItem menu_item;
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
GtkCheckMenuItemPrivate *priv;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user