diff options
-rw-r--r-- | gtk/gtktearoffmenuitem.c | 22 | ||||
-rw-r--r-- | gtk/gtktearoffmenuitem.h | 4 |
2 files changed, 22 insertions, 4 deletions
diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c index a2a346cd46..0a1de9a587 100644 --- a/gtk/gtktearoffmenuitem.c +++ b/gtk/gtktearoffmenuitem.c @@ -34,6 +34,11 @@ #define TEAR_LENGTH 5 #define BORDER_SPACING 3 +struct _GtkTearoffMenuItemPriv +{ + guint torn_off : 1; +}; + static void gtk_tearoff_menu_item_size_request (GtkWidget *widget, GtkRequisition *requisition); static gint gtk_tearoff_menu_item_expose (GtkWidget *widget, @@ -64,12 +69,21 @@ gtk_tearoff_menu_item_class_init (GtkTearoffMenuItemClass *klass) widget_class->parent_set = gtk_tearoff_menu_item_parent_set; menu_item_class->activate = gtk_tearoff_menu_item_activate; + + g_type_class_add_private (klass, sizeof (GtkTearoffMenuItemPriv)); } static void gtk_tearoff_menu_item_init (GtkTearoffMenuItem *tearoff_menu_item) { - tearoff_menu_item->torn_off = FALSE; + GtkTearoffMenuItemPriv *priv; + + tearoff_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (tearoff_menu_item, + GTK_TYPE_TEAROFF_MENU_ITEM, + GtkTearoffMenuItemPriv); + priv = tearoff_menu_item->priv; + + priv->torn_off = FALSE; } static void @@ -227,8 +241,9 @@ tearoff_state_changed (GtkMenu *menu, gpointer data) { GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (data); + GtkTearoffMenuItemPriv *priv = tearoff_menu_item->priv; - tearoff_menu_item->torn_off = gtk_menu_get_tearoff_state (menu); + priv->torn_off = gtk_menu_get_tearoff_state (menu); } static void @@ -236,6 +251,7 @@ gtk_tearoff_menu_item_parent_set (GtkWidget *widget, GtkWidget *previous) { GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (widget); + GtkTearoffMenuItemPriv *priv = tearoff_menu_item->priv; GtkMenu *menu = GTK_IS_MENU (widget->parent) ? GTK_MENU (widget->parent) : NULL; if (previous) @@ -245,7 +261,7 @@ gtk_tearoff_menu_item_parent_set (GtkWidget *widget, if (menu) { - tearoff_menu_item->torn_off = gtk_menu_get_tearoff_state (menu); + priv->torn_off = gtk_menu_get_tearoff_state (menu); g_signal_connect (menu, "notify::tearoff-state", G_CALLBACK (tearoff_state_changed), tearoff_menu_item); diff --git a/gtk/gtktearoffmenuitem.h b/gtk/gtktearoffmenuitem.h index 3fa32a613c..2b84059638 100644 --- a/gtk/gtktearoffmenuitem.h +++ b/gtk/gtktearoffmenuitem.h @@ -46,13 +46,15 @@ G_BEGIN_DECLS typedef struct _GtkTearoffMenuItem GtkTearoffMenuItem; +typedef struct _GtkTearoffMenuItemPriv GtkTearoffMenuItemPriv; typedef struct _GtkTearoffMenuItemClass GtkTearoffMenuItemClass; struct _GtkTearoffMenuItem { GtkMenuItem menu_item; - guint GSEAL (torn_off) : 1; + /* <private> */ + GtkTearoffMenuItemPriv *priv; }; struct _GtkTearoffMenuItemClass |