[gtk+] Remove sealed members from GtkMenuShell
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Remove sealed members from GtkMenuShell
- Date: Thu, 23 Dec 2010 23:22:21 +0000 (UTC)
commit 2ed81aa57c54dc72936e9284cedffa4a5057fa9c
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 23 18:21:53 2010 -0500
Remove sealed members from GtkMenuShell
gtk/Makefile.am | 1 +
gtk/gtkcombobox.c | 25 +-
gtk/gtklabel.c | 1 +
gtk/gtkmenu.c | 166 ++++----
gtk/gtkmenubar.c | 49 ++-
gtk/gtkmenuitem.c | 9 +-
gtk/gtkmenushell.c | 1033 ++++++++++++++++++++++-----------------------
gtk/gtkmenushell.h | 128 +++----
gtk/gtkmenushellprivate.h | 82 ++++
gtk/gtkuimanager.c | 11 +-
gtk/gtkwindow.c | 1 -
11 files changed, 761 insertions(+), 745 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 4c83357..ba61960 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -400,6 +400,7 @@ gtk_private_h_sources = \
gtkintl.h \
gtkkeyhash.h \
gtkmenuprivate.h \
+ gtkmenushellprivate.h \
gtkmnemonichash.h \
gtkmodifierstyle.h \
gtkmountoperationprivate.h \
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 509927a..2de10eb 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -31,6 +31,7 @@
#include "gtkliststore.h"
#include "gtkmain.h"
#include "gtkmenuprivate.h"
+#include "gtkmenushellprivate.h"
#include "gtkscrolledwindow.h"
#include "gtkseparatormenuitem.h"
#include "gtktearoffmenuitem.h"
@@ -1874,7 +1875,7 @@ gtk_combo_box_menu_position_over (GtkMenu *menu,
menu_ypos -= child_allocation.height / 2;
}
- children = GTK_MENU_SHELL (combo_box->priv->popup_widget)->children;
+ children = GTK_MENU_SHELL (combo_box->priv->popup_widget)->priv->children;
while (children)
{
child = children->data;
@@ -1924,15 +1925,15 @@ gtk_combo_box_menu_position (GtkMenu *menu,
GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *menu_item;
- if (priv->wrap_width > 0 || priv->cell_view == NULL)
+ if (priv->wrap_width > 0 || priv->cell_view == NULL)
gtk_combo_box_menu_position_below (menu, x, y, push_in, user_data);
else
{
/* FIXME handle nested menus better */
menu_item = gtk_menu_get_active (GTK_MENU (priv->popup_widget));
if (menu_item)
- gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->popup_widget),
- menu_item);
+ gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->popup_widget),
+ menu_item);
gtk_combo_box_menu_position_over (menu, x, y, push_in, user_data);
}
@@ -3189,13 +3190,13 @@ gtk_combo_box_menu_fill (GtkComboBox *combo_box)
GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
gtk_widget_show (tearoff);
-
+
if (priv->wrap_width)
- gtk_menu_attach (GTK_MENU (menu), tearoff, 0, priv->wrap_width, 0, 1);
+ gtk_menu_attach (GTK_MENU (menu), tearoff, 0, priv->wrap_width, 0, 1);
else
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
}
-
+
gtk_combo_box_menu_fill_level (combo_box, menu, NULL);
}
@@ -3342,11 +3343,11 @@ menu_occupied (GtkMenu *menu,
{
GList *i;
- for (i = GTK_MENU_SHELL (menu)->children; i; i = i->next)
+ for (i = GTK_MENU_SHELL (menu)->priv->children; i; i = i->next)
{
guint l, r, b, t;
- gtk_container_child_get (GTK_CONTAINER (menu),
+ gtk_container_child_get (GTK_CONTAINER (menu),
i->data,
"left-attach", &l,
"right-attach", &r,
@@ -3375,12 +3376,12 @@ gtk_combo_box_relayout_item (GtkComboBox *combo_box,
if (!GTK_IS_MENU_SHELL (menu))
return;
-
+
if (priv->col_column == -1 &&
priv->row_column == -1 &&
last)
{
- gtk_container_child_get (GTK_CONTAINER (menu),
+ gtk_container_child_get (GTK_CONTAINER (menu),
last,
"right-attach", ¤t_col,
"top-attach", ¤t_row,
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index ba74055..6e1be9b 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -42,6 +42,7 @@
#include "gtkseparatormenuitem.h"
#include "gtktextutil.h"
#include "gtkmenuitem.h"
+#include "gtkmenushellprivate.h"
#include "gtknotebook.h"
#include "gtkstock.h"
#include "gtkbindings.h"
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index c6ba098..0e5b612 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -35,6 +35,7 @@
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenuprivate.h"
+#include "gtkmenushellprivate.h"
#include "gtktearoffmenuitem.h"
#include "gtkwindow.h"
#include "gtkhbox.h"
@@ -328,7 +329,7 @@ menu_ensure_layout (GtkMenu *menu)
GList *l;
gchar *row_occupied;
gint current_row;
- gint max_right_attach;
+ gint max_right_attach;
gint max_bottom_attach;
/* Find extents of gridded portion
@@ -336,7 +337,7 @@ menu_ensure_layout (GtkMenu *menu)
max_right_attach = 1;
max_bottom_attach = 0;
- for (l = menu_shell->children; l; l = l->next)
+ for (l = menu_shell->priv->children; l; l = l->next)
{
GtkWidget *child = l->data;
AttachInfo *ai = get_attach_info (child);
@@ -351,7 +352,7 @@ menu_ensure_layout (GtkMenu *menu)
/* Find empty rows */
row_occupied = g_malloc0 (max_bottom_attach);
- for (l = menu_shell->children; l; l = l->next)
+ for (l = menu_shell->priv->children; l; l = l->next)
{
GtkWidget *child = l->data;
AttachInfo *ai = get_attach_info (child);
@@ -368,7 +369,7 @@ menu_ensure_layout (GtkMenu *menu)
/* Lay non-grid-items out in those rows
*/
current_row = 0;
- for (l = menu_shell->children; l; l = l->next)
+ for (l = menu_shell->priv->children; l; l = l->next)
{
GtkWidget *child = l->data;
AttachInfo *ai = get_attach_info (child);
@@ -876,7 +877,7 @@ gtk_menu_get_property (GObject *object,
switch (prop_id)
{
case PROP_ACTIVE:
- g_value_set_int (value, g_list_index (GTK_MENU_SHELL (menu)->children, gtk_menu_get_active (menu)));
+ g_value_set_int (value, g_list_index (GTK_MENU_SHELL (menu)->priv->children, gtk_menu_get_active (menu)));
break;
case PROP_ACCEL_GROUP:
g_value_set_object (value, gtk_menu_get_accel_group (menu));
@@ -1432,7 +1433,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
keyboard = gdk_device_get_associated_device (device);
}
- menu_shell->parent_menu_shell = parent_menu_shell;
+ menu_shell->priv->parent_menu_shell = parent_menu_shell;
priv->seen_item_enter = FALSE;
@@ -1458,7 +1459,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
if (viewable)
xgrab_shell = parent;
- parent = GTK_MENU_SHELL (parent)->parent_menu_shell;
+ parent = GTK_MENU_SHELL (parent)->priv->parent_menu_shell;
}
/* We want to receive events generated when we map the menu;
@@ -1489,7 +1490,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
if (popup_grab_on_window (gtk_widget_get_window (xgrab_shell), keyboard, pointer, activate_time))
{
_gtk_menu_shell_set_grab_device (GTK_MENU_SHELL (xgrab_shell), pointer);
- GTK_MENU_SHELL (xgrab_shell)->have_xgrab = TRUE;
+ GTK_MENU_SHELL (xgrab_shell)->priv->have_xgrab = TRUE;
}
}
else
@@ -1501,24 +1502,24 @@ gtk_menu_popup_for_device (GtkMenu *menu,
if (popup_grab_on_window (transfer_window, keyboard, pointer, activate_time))
{
_gtk_menu_shell_set_grab_device (GTK_MENU_SHELL (xgrab_shell), pointer);
- GTK_MENU_SHELL (xgrab_shell)->have_xgrab = TRUE;
+ GTK_MENU_SHELL (xgrab_shell)->priv->have_xgrab = TRUE;
}
}
- if (!GTK_MENU_SHELL (xgrab_shell)->have_xgrab)
+ if (!GTK_MENU_SHELL (xgrab_shell)->priv->have_xgrab)
{
/* We failed to make our pointer/keyboard grab.
* Rather than leaving the user with a stuck up window,
* we just abort here. Presumably the user will try again.
*/
- menu_shell->parent_menu_shell = NULL;
+ menu_shell->priv->parent_menu_shell = NULL;
menu_grab_transfer_window_destroy (menu);
return;
}
_gtk_menu_shell_set_grab_device (GTK_MENU_SHELL (menu), pointer);
- menu_shell->active = TRUE;
- menu_shell->button = button;
+ menu_shell->priv->active = TRUE;
+ menu_shell->priv->button = button;
/* If we are popping up the menu from something other than, a button
* press then, as a heuristic, we ignore enter events for the menu
@@ -1530,12 +1531,12 @@ gtk_menu_popup_for_device (GtkMenu *menu,
{
if ((current_event->type != GDK_BUTTON_PRESS) &&
(current_event->type != GDK_ENTER_NOTIFY))
- menu_shell->ignore_enter = TRUE;
+ menu_shell->priv->ignore_enter = TRUE;
gdk_event_free (current_event);
}
else
- menu_shell->ignore_enter = TRUE;
+ menu_shell->priv->ignore_enter = TRUE;
if (priv->torn_off)
{
@@ -1563,7 +1564,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
priv->position_func = func;
priv->position_func_data = data;
priv->position_func_data_destroy = destroy;
- menu_shell->activate_time = activate_time;
+ menu_shell->priv->activate_time = activate_time;
/* We need to show the menu here rather in the init function
* because code expects to be able to tell if the menu is onscreen
@@ -1600,7 +1601,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
gtk_menu_scroll_to (menu, priv->scroll_offset);
/* if no item is selected, select the first one */
- if (!menu_shell->active_menu_item)
+ if (!menu_shell->priv->active_menu_item)
{
gboolean touchscreen_mode;
@@ -1627,7 +1628,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
keyboard_mode = _gtk_menu_shell_get_keyboard_mode (GTK_MENU_SHELL (parent_menu_shell));
_gtk_menu_shell_set_keyboard_mode (menu_shell, keyboard_mode);
}
- else if (menu_shell->button == 0) /* a keynav-activated context menu */
+ else if (menu_shell->priv->button == 0) /* a keynav-activated context menu */
_gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
_gtk_menu_shell_update_mnemonics (menu_shell);
@@ -1697,20 +1698,20 @@ gtk_menu_popdown (GtkMenu *menu)
menu_shell = GTK_MENU_SHELL (menu);
priv = menu->priv;
- menu_shell->parent_menu_shell = NULL;
- menu_shell->active = FALSE;
- menu_shell->ignore_enter = FALSE;
+ menu_shell->priv->parent_menu_shell = NULL;
+ menu_shell->priv->active = FALSE;
+ menu_shell->priv->ignore_enter = FALSE;
priv->have_position = FALSE;
gtk_menu_stop_scrolling (menu);
gtk_menu_stop_navigating_submenu (menu);
- if (menu_shell->active_menu_item)
+ if (menu_shell->priv->active_menu_item)
{
if (priv->old_active_menu_item)
g_object_unref (priv->old_active_menu_item);
- priv->old_active_menu_item = menu_shell->active_menu_item;
+ priv->old_active_menu_item = menu_shell->priv->active_menu_item;
g_object_ref (priv->old_active_menu_item);
}
@@ -1740,7 +1741,7 @@ gtk_menu_popdown (GtkMenu *menu)
/* We popped up the menu from the tearoff, so we need to
* release the grab - we aren't actually hiding the menu.
*/
- if (menu_shell->have_xgrab && pointer)
+ if (menu_shell->priv->have_xgrab && pointer)
{
GdkDevice *keyboard;
@@ -1763,7 +1764,7 @@ gtk_menu_popdown (GtkMenu *menu)
else
gtk_widget_hide (GTK_WIDGET (menu));
- menu_shell->have_xgrab = FALSE;
+ menu_shell->priv->have_xgrab = FALSE;
if (pointer)
gtk_device_grab_remove (GTK_WIDGET (menu), pointer);
@@ -1785,7 +1786,7 @@ gtk_menu_get_active (GtkMenu *menu)
if (!priv->old_active_menu_item)
{
child = NULL;
- children = GTK_MENU_SHELL (menu)->children;
+ children = GTK_MENU_SHELL (menu)->priv->children;
while (children)
{
@@ -1815,7 +1816,7 @@ gtk_menu_set_active (GtkMenu *menu,
g_return_if_fail (GTK_IS_MENU (menu));
- tmp_list = g_list_nth (GTK_MENU_SHELL (menu)->children, index);
+ tmp_list = g_list_nth (GTK_MENU_SHELL (menu)->priv->children, index);
if (tmp_list)
{
child = tmp_list->data;
@@ -2266,10 +2267,10 @@ gtk_menu_reorder_child (GtkMenu *menu,
menu_shell = GTK_MENU_SHELL (menu);
- if (g_list_find (menu_shell->children, child))
+ if (g_list_find (menu_shell->priv->children, child))
{
- menu_shell->children = g_list_remove (menu_shell->children, child);
- menu_shell->children = g_list_insert (menu_shell->children, child, position);
+ menu_shell->priv->children = g_list_remove (menu_shell->priv->children, child);
+ menu_shell->priv->children = g_list_insert (menu_shell->priv->children, child, position);
menu_queue_resize (menu);
}
@@ -2434,7 +2435,7 @@ gtk_menu_realize (GtkWidget *widget)
&attributes, attributes_mask);
gdk_window_set_user_data (priv->bin_window, menu);
- children = GTK_MENU_SHELL (menu)->children;
+ children = GTK_MENU_SHELL (menu)->priv->children;
while (children)
{
child = children->data;
@@ -2447,9 +2448,9 @@ gtk_menu_realize (GtkWidget *widget)
gtk_style_context_set_background (context, priv->view_window);
gtk_style_context_set_background (context, window);
- if (GTK_MENU_SHELL (widget)->active_menu_item)
+ if (GTK_MENU_SHELL (widget)->priv->active_menu_item)
gtk_menu_scroll_item_visible (GTK_MENU_SHELL (widget),
- GTK_MENU_SHELL (widget)->active_menu_item);
+ GTK_MENU_SHELL (widget)->priv->active_menu_item);
gdk_window_show (priv->bin_window);
gdk_window_show (priv->view_window);
@@ -2564,7 +2565,7 @@ calculate_line_heights (GtkMenu *menu,
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
avail_width -= (border_width + horizontal_padding + gtk_widget_get_style (widget)->xthickness) * 2;
- for (children = menu_shell->children; children; children = children->next)
+ for (children = menu_shell->priv->children; children; children = children->next)
{
gint part;
gint toggle_size;
@@ -2658,7 +2659,7 @@ gtk_menu_size_allocate (GtkWidget *widget,
height = allocation->height - (2 * (border_width + vertical_padding)) -
border.top - border.bottom;
- if (menu_shell->active)
+ if (menu_shell->priv->active)
gtk_menu_scroll_to (menu, priv->scroll_offset);
if (!priv->tearoff_active)
@@ -2683,11 +2684,11 @@ gtk_menu_size_allocate (GtkWidget *widget,
gdk_window_move_resize (priv->view_window, x, y, width, height);
}
- if (menu_shell->children)
+ if (menu_shell->priv->children)
{
gint base_width = width / gtk_menu_get_n_columns (menu);
- children = menu_shell->children;
+ children = menu_shell->priv->children;
while (children)
{
child = children->data;
@@ -3011,7 +3012,7 @@ gtk_menu_get_preferred_width (GtkWidget *widget,
max_toggle_size = 0;
max_accel_width = 0;
- children = menu_shell->children;
+ children = menu_shell->priv->children;
while (children)
{
gint part;
@@ -3238,8 +3239,8 @@ pointer_in_menu_window (GtkWidget *widget,
menu_shell = GTK_MENU_SHELL (widget);
- if (GTK_IS_MENU (menu_shell->parent_menu_shell))
- return pointer_in_menu_window (menu_shell->parent_menu_shell,
+ if (GTK_IS_MENU (menu_shell->priv->parent_menu_shell))
+ return pointer_in_menu_window (menu_shell->priv->parent_menu_shell,
x_root, y_root);
}
@@ -3303,8 +3304,8 @@ gtk_menu_button_release (GtkWidget *widget,
* next button_press/button_release in GtkMenuShell.
* See bug #449371.
*/
- if (GTK_MENU_SHELL (widget)->active)
- GTK_MENU_SHELL (widget)->button = 0;
+ if (GTK_MENU_SHELL (widget)->priv->active)
+ GTK_MENU_SHELL (widget)->priv->button = 0;
return TRUE;
}
@@ -3434,12 +3435,12 @@ gtk_menu_key_press (GtkWidget *widget,
/* Modify the accelerators */
if (can_change_accels &&
- menu_shell->active_menu_item &&
- gtk_bin_get_child (GTK_BIN (menu_shell->active_menu_item)) && /* no separators */
- GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL && /* no submenus */
+ menu_shell->priv->active_menu_item &&
+ gtk_bin_get_child (GTK_BIN (menu_shell->priv->active_menu_item)) && /* no separators */
+ GTK_MENU_ITEM (menu_shell->priv->active_menu_item)->submenu == NULL && /* no submenus */
(delete || gtk_accelerator_valid (accel_key, accel_mods)))
{
- GtkWidget *menu_item = menu_shell->active_menu_item;
+ GtkWidget *menu_item = menu_shell->priv->active_menu_item;
gboolean locked, replace_accels = TRUE;
const gchar *path;
@@ -3566,9 +3567,9 @@ gtk_menu_motion_notify (GtkWidget *widget,
menu = GTK_MENU (menu_shell);
if (definitely_within_item (menu_item, event->x, event->y))
- menu_shell->activate_time = 0;
+ menu_shell->priv->activate_time = 0;
- need_enter = (gtk_menu_has_navigation_triangle (menu) || menu_shell->ignore_enter);
+ need_enter = (gtk_menu_has_navigation_triangle (menu) || menu_shell->priv->ignore_enter);
/* Check to see if we are within an active submenu's navigation region
*/
@@ -3592,7 +3593,7 @@ gtk_menu_motion_notify (GtkWidget *widget,
/* The menu is now sensitive to enter events on its items, but
* was previously sensitive. So we fake an enter event.
*/
- menu_shell->ignore_enter = FALSE;
+ menu_shell->priv->ignore_enter = FALSE;
if (event->x >= 0 && event->x < gdk_window_get_width (event->window) &&
event->y >= 0 && event->y < gdk_window_get_height (event->window))
@@ -3721,7 +3722,7 @@ gtk_menu_do_timeout_scroll (GtkMenu *menu,
* this would cause the uncovered menu item to be activated on button
* release. Therefore we need to ignore button release here
*/
- GTK_MENU_SHELL (menu)->ignore_enter = TRUE;
+ GTK_MENU_SHELL (menu)->priv->ignore_enter = TRUE;
priv->ignore_button_release = TRUE;
}
}
@@ -4162,7 +4163,7 @@ gtk_menu_enter_notify (GtkWidget *widget,
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
- if (!menu_shell->ignore_enter)
+ if (!menu_shell->priv->ignore_enter)
gtk_menu_handle_scrolling (GTK_MENU (widget),
event->x_root, event->y_root, TRUE, TRUE);
}
@@ -4182,7 +4183,7 @@ gtk_menu_enter_notify (GtkWidget *widget,
* on this menu. This means a release should always
* mean activate.
*/
- menu_shell->activate_time = 0;
+ menu_shell->priv->activate_time = 0;
}
else if ((event->detail != GDK_NOTIFY_NONLINEAR &&
event->detail != GDK_NOTIFY_NONLINEAR_VIRTUAL))
@@ -4195,7 +4196,7 @@ gtk_menu_enter_notify (GtkWidget *widget,
* far enough away from the enter point. (see
* gtk_menu_motion_notify())
*/
- menu_shell->activate_time = 0;
+ menu_shell->priv->activate_time = 0;
}
}
@@ -4248,16 +4249,16 @@ gtk_menu_leave_notify (GtkWidget *widget,
/* Here we check to see if we're leaving an active menu item
* with a submenu, in which case we enter submenu navigation mode.
*/
- if (menu_shell->active_menu_item != NULL
+ if (menu_shell->priv->active_menu_item != NULL
&& menu_item->submenu != NULL
&& menu_item->submenu_placement == GTK_LEFT_RIGHT)
{
- if (GTK_MENU_SHELL (menu_item->submenu)->active)
+ if (GTK_MENU_SHELL (menu_item->submenu)->priv->active)
{
gtk_menu_set_submenu_navigation_region (menu, menu_item, event);
return TRUE;
}
- else if (menu_item == GTK_MENU_ITEM (menu_shell->active_menu_item))
+ else if (menu_item == GTK_MENU_ITEM (menu_shell->priv->active_menu_item))
{
/* We are leaving an active menu item with nonactive submenu.
* Deselect it so we don't surprise the user with by popping
@@ -4467,9 +4468,9 @@ gtk_menu_deactivate (GtkMenuShell *menu_shell)
g_return_if_fail (GTK_IS_MENU (menu_shell));
- parent = menu_shell->parent_menu_shell;
+ parent = menu_shell->priv->parent_menu_shell;
- menu_shell->activate_time = 0;
+ menu_shell->priv->activate_time = 0;
gtk_menu_popdown (GTK_MENU (menu_shell));
if (parent)
@@ -4675,7 +4676,7 @@ gtk_menu_position (GtkMenu *menu,
/* FIXME: should this be done in the various position_funcs ? */
x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width));
- if (GTK_MENU_SHELL (menu)->active)
+ if (GTK_MENU_SHELL (menu)->priv->active)
{
priv->have_position = TRUE;
priv->position_x = x;
@@ -4700,10 +4701,10 @@ gtk_menu_position (GtkMenu *menu,
scroll_offset += arrow_border.top;
}
- gtk_window_move (GTK_WINDOW (GTK_MENU_SHELL (menu)->active ? priv->toplevel : priv->tearoff_window),
+ gtk_window_move (GTK_WINDOW (GTK_MENU_SHELL (menu)->priv->active ? priv->toplevel : priv->tearoff_window),
x, y);
- if (!GTK_MENU_SHELL (menu)->active)
+ if (!GTK_MENU_SHELL (menu)->priv->active)
{
gtk_window_resize (GTK_WINDOW (priv->tearoff_window),
requisition.width, requisition.height);
@@ -5012,7 +5013,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
/* Ignore the enter event we might get if the pointer
* is on the menu
*/
- menu_shell->ignore_enter = TRUE;
+ menu_shell->priv->ignore_enter = TRUE;
gtk_menu_scroll_to (menu, child_offset);
}
else
@@ -5041,7 +5042,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
/* Ignore the enter event we might get if the pointer
* is on the menu
*/
- menu_shell->ignore_enter = TRUE;
+ menu_shell->priv->ignore_enter = TRUE;
gtk_menu_scroll_to (menu, y);
}
}
@@ -5204,7 +5205,7 @@ gtk_menu_attach (GtkMenu *menu,
ai->top_attach = top_attach;
ai->bottom_attach = bottom_attach;
- menu_shell->children = g_list_append (menu_shell->children, child);
+ menu_shell->priv->children = g_list_append (menu_shell->priv->children, child);
gtk_widget_set_parent (child, GTK_WIDGET (menu));
@@ -5245,7 +5246,7 @@ find_child_containing (GtkMenuShell *menu_shell,
/* find a child which includes the area given by
* left, right, top, bottom.
*/
- for (list = menu_shell->children; list; list = list->next)
+ for (list = menu_shell->priv->children; list; list = list->next)
{
gint l, r, t, b;
@@ -5285,9 +5286,9 @@ gtk_menu_move_current (GtkMenuShell *menu_shell,
}
/* use special table menu key bindings */
- if (menu_shell->active_menu_item && gtk_menu_get_n_columns (menu) > 1)
+ if (menu_shell->priv->active_menu_item && gtk_menu_get_n_columns (menu) > 1)
{
- get_effective_child_attach (menu_shell->active_menu_item, &l, &r, &t, &b);
+ get_effective_child_attach (menu_shell->priv->active_menu_item, &l, &r, &t, &b);
if (direction == GTK_MENU_DIR_NEXT)
{
@@ -5341,11 +5342,11 @@ gtk_menu_move_current (GtkMenuShell *menu_shell,
if (!match)
{
- GtkWidget *parent = menu_shell->parent_menu_shell;
+ GtkWidget *parent = menu_shell->priv->parent_menu_shell;
if (!parent
- || g_list_length (GTK_MENU_SHELL (parent)->children) <= 1)
- match = menu_shell->active_menu_item;
+ || g_list_length (GTK_MENU_SHELL (parent)->priv->children) <= 1)
+ match = menu_shell->priv->active_menu_item;
}
}
else if (direction == GTK_MENU_DIR_CHILD)
@@ -5356,12 +5357,12 @@ gtk_menu_move_current (GtkMenuShell *menu_shell,
if (!match)
{
- GtkWidget *parent = menu_shell->parent_menu_shell;
+ GtkWidget *parent = menu_shell->priv->parent_menu_shell;
- if (! GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu &&
+ if (! GTK_MENU_ITEM (menu_shell->priv->active_menu_item)->submenu &&
(!parent ||
- g_list_length (GTK_MENU_SHELL (parent)->children) <= 1))
- match = menu_shell->active_menu_item;
+ g_list_length (GTK_MENU_SHELL (parent)->priv->children) <= 1))
+ match = menu_shell->priv->active_menu_item;
}
}
@@ -5420,7 +5421,7 @@ child_at (GtkMenu *menu,
lower = priv->scroll_offset;
upper = priv->scroll_offset + menu_height;
- for (children = menu_shell->children; children; children = children->next)
+ for (children = menu_shell->priv->children; children; children = children->next)
{
if (gtk_widget_get_visible (children->data))
{
@@ -5497,16 +5498,16 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
else
step = page_size;
- if (menu_shell->active_menu_item)
+ if (menu_shell->priv->active_menu_item)
{
gint child_height;
- compute_child_offset (menu, menu_shell->active_menu_item,
+ compute_child_offset (menu, menu_shell->priv->active_menu_item,
&child_offset, &child_height, NULL);
child_offset += child_height / 2;
}
- menu_shell->ignore_enter = TRUE;
+ menu_shell->priv->ignore_enter = TRUE;
old_upper_arrow_visible = priv->upper_arrow_visible && !priv->tearoff_active;
old_offset = priv->scroll_offset;
@@ -5515,12 +5516,11 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
gtk_menu_scroll_to (menu, new_offset);
- if (menu_shell->active_menu_item)
+ if (menu_shell->priv->active_menu_item)
{
GtkWidget *new_child;
gboolean new_upper_arrow_visible = priv->upper_arrow_visible && !priv->tearoff_active;
GtkBorder arrow_border;
-
get_arrows_border (menu, &arrow_border);
if (priv->scroll_offset != old_offset)
@@ -5536,13 +5536,13 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
break;
case GTK_SCROLL_START:
/* Ignore the enter event we might get if the pointer is on the menu */
- menu_shell->ignore_enter = TRUE;
+ menu_shell->priv->ignore_enter = TRUE;
gtk_menu_scroll_to (menu, 0);
gtk_menu_shell_select_first (menu_shell, TRUE);
break;
case GTK_SCROLL_END:
/* Ignore the enter event we might get if the pointer is on the menu */
- menu_shell->ignore_enter = TRUE;
+ menu_shell->priv->ignore_enter = TRUE;
gtk_menu_scroll_to (menu, end_position - page_size);
_gtk_menu_shell_select_last (menu_shell, TRUE);
break;
@@ -5647,7 +5647,7 @@ gtk_menu_grab_notify (GtkWidget *widget,
group = gtk_window_get_group (GTK_WINDOW (toplevel));
grab = gtk_window_group_get_current_device_grab (group, pointer);
- if (GTK_MENU_SHELL (widget)->active && !GTK_IS_MENU_SHELL (grab))
+ if (GTK_MENU_SHELL (widget)->priv->active && !GTK_IS_MENU_SHELL (grab))
gtk_menu_shell_cancel (GTK_MENU_SHELL (widget));
}
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index bb48284..b7c3636 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -34,6 +34,7 @@
#include "gtkmarshalers.h"
#include "gtkmenuitem.h"
#include "gtkmenuprivate.h"
+#include "gtkmenushellprivate.h"
#include "gtksettings.h"
#include "gtksizerequest.h"
#include "gtkwindow.h"
@@ -301,7 +302,7 @@ gtk_menu_bar_size_request (GtkWidget *widget,
priv = menu_bar->priv;
nchildren = 0;
- children = menu_shell->children;
+ children = menu_shell->priv->children;
while (children)
{
@@ -425,7 +426,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
- if (menu_shell->children)
+ if (menu_shell->priv->children)
{
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
child_allocation.x = (border_width +
@@ -454,15 +455,15 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
priv->pack_direction == GTK_PACK_DIRECTION_RTL)
{
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
-
- offset = child_allocation.x; /* Window edge to menubar start */
- ltr_x = child_allocation.x;
-
- children = menu_shell->children;
- while (children)
- {
- gint toggle_size;
-
+
+ offset = child_allocation.x; /* Window edge to menubar start */
+ ltr_x = child_allocation.x;
+
+ children = menu_shell->priv->children;
+ while (children)
+ {
+ gint toggle_size;
+
child = children->data;
children = children->next;
@@ -504,15 +505,15 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
else
{
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
-
- offset = child_allocation.y; /* Window edge to menubar start */
- ltr_y = child_allocation.y;
-
- children = menu_shell->children;
- while (children)
- {
- gint toggle_size;
-
+
+ offset = child_allocation.y; /* Window edge to menubar start */
+ ltr_y = child_allocation.y;
+
+ children = menu_shell->priv->children;
+ while (children)
+ {
+ gint toggle_size;
+
child = children->data;
children = children->next;
@@ -766,8 +767,8 @@ _gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
if (current && current->next)
{
GtkMenuShell *new_menushell = GTK_MENU_SHELL (current->next->data);
- if (new_menushell->children)
- to_activate = new_menushell->children->data;
+ if (new_menushell->priv->children)
+ to_activate = new_menushell->priv->children->data;
}
}
@@ -912,7 +913,7 @@ gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
gtk_widget_queue_resize (GTK_WIDGET (menubar));
- for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
+ for (l = GTK_MENU_SHELL (menubar)->priv->children; l; l = l->next)
gtk_widget_queue_resize (GTK_WIDGET (l->data));
g_object_notify (G_OBJECT (menubar), "pack-direction");
@@ -965,7 +966,7 @@ gtk_menu_bar_set_child_pack_direction (GtkMenuBar *menubar,
gtk_widget_queue_resize (GTK_WIDGET (menubar));
- for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
+ for (l = GTK_MENU_SHELL (menubar)->priv->children; l; l = l->next)
gtk_widget_queue_resize (GTK_WIDGET (l->data));
g_object_notify (G_OBJECT (menubar), "child-pack-direction");
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 08eba1e..826200e 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -31,6 +31,7 @@
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenuprivate.h"
+#include "gtkmenushellprivate.h"
#include "gtkmenubar.h"
#include "gtkmenuprivate.h"
#include "gtkseparatormenuitem.h"
@@ -1656,7 +1657,7 @@ gtk_menu_item_mnemonic_activate (GtkWidget *widget,
if (group_cycling &&
parent &&
GTK_IS_MENU_SHELL (parent) &&
- GTK_MENU_SHELL (parent)->active)
+ GTK_MENU_SHELL (parent)->priv->active)
{
gtk_menu_shell_select_item (GTK_MENU_SHELL (parent),
widget);
@@ -1816,7 +1817,7 @@ gtk_menu_item_real_popup_submenu (GtkWidget *widget,
widget,
menu_position_func,
menu_item,
- GTK_MENU_SHELL (parent)->button,
+ GTK_MENU_SHELL (parent)->priv->button,
0);
}
@@ -1836,12 +1837,12 @@ gtk_menu_item_popup_timeout (gpointer data)
parent = gtk_widget_get_parent (GTK_WIDGET (menu_item));
- if ((GTK_IS_MENU_SHELL (parent) && GTK_MENU_SHELL (parent)->active) ||
+ if ((GTK_IS_MENU_SHELL (parent) && GTK_MENU_SHELL (parent)->priv->active) ||
(GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off))
{
gtk_menu_item_real_popup_submenu (GTK_WIDGET (menu_item), TRUE);
if (menu_item->timer_from_keypress && menu_item->submenu)
- GTK_MENU_SHELL (menu_item->submenu)->ignore_enter = TRUE;
+ GTK_MENU_SHELL (menu_item->submenu)->priv->ignore_enter = TRUE;
}
menu_item->timer = 0;
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 03793d4..20e12dc 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -31,10 +31,9 @@
#include "gtklabel.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
-#include "gtkmenuprivate.h"
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
-#include "gtkmenushell.h"
+#include "gtkmenushellprivate.h"
#include "gtkmenuprivate.h"
#include "gtkmnemonichash.h"
#include "gtktearoffmenuitem.h"
@@ -124,24 +123,6 @@ enum {
* Cancels the current selection
*/
-#define GTK_MENU_SHELL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellPrivate))
-
-typedef struct _GtkMenuShellPrivate GtkMenuShellPrivate;
-
-struct _GtkMenuShellPrivate
-{
- GtkMnemonicHash *mnemonic_hash;
- GtkKeyHash *key_hash;
-
- GdkDevice *grab_pointer;
-
- guint take_focus : 1;
- guint activated_submenu : 1;
- /* This flag is a crutch to keep mnemonics in the same menu
- * if the user moves the mouse over an unselectable menuitem.
- */
- guint in_unselectable_item : 1;
-};
static void gtk_menu_shell_set_property (GObject *object,
guint prop_id,
@@ -155,53 +136,53 @@ static void gtk_menu_shell_realize (GtkWidget *widget);
static void gtk_menu_shell_finalize (GObject *object);
static void gtk_menu_shell_dispose (GObject *object);
static gint gtk_menu_shell_button_press (GtkWidget *widget,
- GdkEventButton *event);
+ GdkEventButton *event);
static gint gtk_menu_shell_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_menu_shell_key_press (GtkWidget *widget,
- GdkEventKey *event);
+ GdkEventButton *event);
+static gint gtk_menu_shell_key_press (GtkWidget *widget,
+ GdkEventKey *event);
static gint gtk_menu_shell_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event);
+ GdkEventCrossing *event);
static gint gtk_menu_shell_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event);
+ GdkEventCrossing *event);
static void gtk_menu_shell_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen);
+ GdkScreen *previous_screen);
static gboolean gtk_menu_shell_grab_broken (GtkWidget *widget,
- GdkEventGrabBroken *event);
+ GdkEventGrabBroken *event);
static void gtk_menu_shell_add (GtkContainer *container,
- GtkWidget *widget);
+ GtkWidget *widget);
static void gtk_menu_shell_remove (GtkContainer *container,
- GtkWidget *widget);
+ GtkWidget *widget);
static void gtk_menu_shell_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
static void gtk_menu_shell_real_insert (GtkMenuShell *menu_shell,
- GtkWidget *child,
- gint position);
+ GtkWidget *child,
+ gint position);
static void gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell);
static gint gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
- GtkWidget *child);
+ GtkWidget *child);
static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
- GdkEvent *event);
+ GdkEvent *event);
static GType gtk_menu_shell_child_type (GtkContainer *container);
static void gtk_menu_shell_real_select_item (GtkMenuShell *menu_shell,
- GtkWidget *menu_item);
+ GtkWidget *menu_item);
static gboolean gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell);
static void gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
- GtkMenuDirectionType direction);
+ GtkMenuDirectionType direction);
static void gtk_real_menu_shell_activate_current (GtkMenuShell *menu_shell,
- gboolean force_hide);
+ gboolean force_hide);
static void gtk_real_menu_shell_cancel (GtkMenuShell *menu_shell);
static void gtk_real_menu_shell_cycle_focus (GtkMenuShell *menu_shell,
- GtkDirectionType dir);
+ GtkDirectionType dir);
static void gtk_menu_shell_reset_key_hash (GtkMenuShell *menu_shell);
static gboolean gtk_menu_shell_activate_mnemonic (GtkMenuShell *menu_shell,
- GdkEventKey *event);
+ GdkEventKey *event);
static gboolean gtk_menu_shell_real_move_selected (GtkMenuShell *menu_shell,
- gint distance);
+ gint distance);
static guint menu_shell_signals[LAST_SIGNAL] = { 0 };
@@ -251,50 +232,50 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
menu_shell_signals[DEACTIVATE] =
g_signal_new (I_("deactivate"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkMenuShellClass, deactivate),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkMenuShellClass, deactivate),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
menu_shell_signals[SELECTION_DONE] =
g_signal_new (I_("selection-done"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkMenuShellClass, selection_done),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkMenuShellClass, selection_done),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
menu_shell_signals[MOVE_CURRENT] =
g_signal_new (I_("move-current"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkMenuShellClass, move_current),
- NULL, NULL,
- _gtk_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- GTK_TYPE_MENU_DIRECTION_TYPE);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkMenuShellClass, move_current),
+ NULL, NULL,
+ _gtk_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_MENU_DIRECTION_TYPE);
menu_shell_signals[ACTIVATE_CURRENT] =
g_signal_new (I_("activate-current"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkMenuShellClass, activate_current),
- NULL, NULL,
- _gtk_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1,
- G_TYPE_BOOLEAN);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkMenuShellClass, activate_current),
+ NULL, NULL,
+ _gtk_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1,
+ G_TYPE_BOOLEAN);
menu_shell_signals[CANCEL] =
g_signal_new (I_("cancel"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkMenuShellClass, cancel),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkMenuShellClass, cancel),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
menu_shell_signals[CYCLE_FOCUS] =
g_signal_new_class_handler (I_("cycle-focus"),
@@ -320,50 +301,50 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
*/
menu_shell_signals[MOVE_SELECTED] =
g_signal_new (I_("move-selected"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkMenuShellClass, move_selected),
- _gtk_boolean_handled_accumulator, NULL,
- _gtk_marshal_BOOLEAN__INT,
- G_TYPE_BOOLEAN, 1,
- G_TYPE_INT);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkMenuShellClass, move_selected),
+ _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__INT,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_INT);
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_Escape, 0,
- "cancel", 0);
+ GDK_KEY_Escape, 0,
+ "cancel", 0);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_Return, 0,
- "activate-current", 1,
- G_TYPE_BOOLEAN,
- TRUE);
+ GDK_KEY_Return, 0,
+ "activate-current", 1,
+ G_TYPE_BOOLEAN,
+ TRUE);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_ISO_Enter, 0,
- "activate-current", 1,
- G_TYPE_BOOLEAN,
- TRUE);
+ GDK_KEY_ISO_Enter, 0,
+ "activate-current", 1,
+ G_TYPE_BOOLEAN,
+ TRUE);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_KP_Enter, 0,
- "activate-current", 1,
- G_TYPE_BOOLEAN,
- TRUE);
+ GDK_KEY_KP_Enter, 0,
+ "activate-current", 1,
+ G_TYPE_BOOLEAN,
+ TRUE);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_space, 0,
- "activate-current", 1,
- G_TYPE_BOOLEAN,
- FALSE);
+ GDK_KEY_space, 0,
+ "activate-current", 1,
+ G_TYPE_BOOLEAN,
+ FALSE);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_KP_Space, 0,
- "activate-current", 1,
- G_TYPE_BOOLEAN,
- FALSE);
+ GDK_KEY_KP_Space, 0,
+ "activate-current", 1,
+ G_TYPE_BOOLEAN,
+ FALSE);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_F10, 0,
- "cycle-focus", 1,
+ GDK_KEY_F10, 0,
+ "cycle-focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_FORWARD);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_F10, GDK_SHIFT_MASK,
- "cycle-focus", 1,
+ GDK_KEY_F10, GDK_SHIFT_MASK,
+ "cycle-focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
/**
@@ -378,16 +359,16 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
g_object_class_install_property (object_class,
PROP_TAKE_FOCUS,
g_param_spec_boolean ("take-focus",
- P_("Take Focus"),
- P_("A boolean that determines whether the menu grabs the keyboard focus"),
- TRUE,
- GTK_PARAM_READWRITE));
+ P_("Take Focus"),
+ P_("A boolean that determines whether the menu grabs the keyboard focus"),
+ TRUE,
+ GTK_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (GtkMenuShellPrivate));
}
static GType
-gtk_menu_shell_child_type (GtkContainer *container)
+gtk_menu_shell_child_type (GtkContainer *container)
{
return GTK_TYPE_MENU_ITEM;
}
@@ -395,21 +376,13 @@ gtk_menu_shell_child_type (GtkContainer *container)
static void
gtk_menu_shell_init (GtkMenuShell *menu_shell)
{
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
-
- menu_shell->children = NULL;
- menu_shell->active_menu_item = NULL;
- menu_shell->parent_menu_shell = NULL;
- menu_shell->active = FALSE;
- menu_shell->have_grab = FALSE;
- menu_shell->have_xgrab = FALSE;
- menu_shell->button = 0;
- menu_shell->activate_time = 0;
-
- priv->mnemonic_hash = NULL;
- priv->key_hash = NULL;
+ GtkMenuShellPrivate *priv;
+
+ priv = G_TYPE_INSTANCE_GET_PRIVATE (menu_shell,
+ GTK_TYPE_MENU_SHELL,
+ GtkMenuShellPrivate);
+ menu_shell->priv = priv;
priv->take_focus = TRUE;
- priv->activated_submenu = FALSE;
}
static void
@@ -432,10 +405,10 @@ gtk_menu_shell_set_property (GObject *object,
}
static void
-gtk_menu_shell_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+gtk_menu_shell_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
@@ -454,7 +427,7 @@ static void
gtk_menu_shell_finalize (GObject *object)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
if (priv->mnemonic_hash)
_gtk_mnemonic_hash_free (priv->mnemonic_hash);
@@ -465,34 +438,32 @@ gtk_menu_shell_finalize (GObject *object)
}
-static void
-gtk_menu_shell_dispose (GObject *object)
+static void
+gtk_menu_shell_dispose (GObject *object)
{
- GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
-
- gtk_menu_shell_deactivate (menu_shell);
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL (object));
G_OBJECT_CLASS (gtk_menu_shell_parent_class)->dispose (object);
}
void
gtk_menu_shell_append (GtkMenuShell *menu_shell,
- GtkWidget *child)
+ GtkWidget *child)
{
gtk_menu_shell_insert (menu_shell, child, -1);
}
void
gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
- GtkWidget *child)
+ GtkWidget *child)
{
gtk_menu_shell_insert (menu_shell, child, 0);
}
void
gtk_menu_shell_insert (GtkMenuShell *menu_shell,
- GtkWidget *child,
- gint position)
+ GtkWidget *child,
+ gint position)
{
GtkMenuShellClass *class;
@@ -507,10 +478,12 @@ gtk_menu_shell_insert (GtkMenuShell *menu_shell,
static void
gtk_menu_shell_real_insert (GtkMenuShell *menu_shell,
- GtkWidget *child,
- gint position)
+ GtkWidget *child,
+ gint position)
{
- menu_shell->children = g_list_insert (menu_shell->children, child, position);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
+
+ priv->children = g_list_insert (priv->children, child, position);
gtk_widget_set_parent (child, GTK_WIDGET (menu_shell));
}
@@ -544,11 +517,11 @@ gtk_menu_shell_realize (GtkWidget *widget)
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_KEY_PRESS_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_KEY_PRESS_MASK |
+ GDK_ENTER_NOTIFY_MASK |
+ GDK_LEAVE_NOTIFY_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
@@ -564,7 +537,9 @@ gtk_menu_shell_realize (GtkWidget *widget)
void
_gtk_menu_shell_activate (GtkMenuShell *menu_shell)
{
- if (!menu_shell->active)
+ GtkMenuShellPrivate *priv = menu_shell->priv;
+
+ if (!priv->active)
{
GdkDevice *device;
@@ -573,16 +548,17 @@ _gtk_menu_shell_activate (GtkMenuShell *menu_shell)
_gtk_menu_shell_set_grab_device (menu_shell, device);
gtk_device_grab_add (GTK_WIDGET (menu_shell), device, TRUE);
- menu_shell->have_grab = TRUE;
- menu_shell->active = TRUE;
+ priv->have_grab = TRUE;
+ priv->active = TRUE;
}
}
static gint
gtk_menu_shell_button_press (GtkWidget *widget,
- GdkEventButton *event)
+ GdkEventButton *event)
{
GtkMenuShell *menu_shell;
+ GtkMenuShellPrivate *priv;
GtkWidget *menu_item;
GtkWidget *parent;
@@ -590,9 +566,10 @@ gtk_menu_shell_button_press (GtkWidget *widget,
return FALSE;
menu_shell = GTK_MENU_SHELL (widget);
+ priv = menu_shell->priv;
- if (menu_shell->parent_menu_shell)
- return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
+ if (priv->parent_menu_shell)
+ return gtk_widget_event (priv->parent_menu_shell, (GdkEvent*) event);
menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent *)event);
@@ -600,7 +577,7 @@ gtk_menu_shell_button_press (GtkWidget *widget,
{
parent = gtk_widget_get_parent (menu_item);
- if (menu_item != GTK_MENU_SHELL (parent)->active_menu_item)
+ if (menu_item != GTK_MENU_SHELL (parent)->priv->active_menu_item)
{
/* select the menu item *before* activating the shell, so submenus
* which might be open are closed the friendly way. If we activate
@@ -614,24 +591,24 @@ gtk_menu_shell_button_press (GtkWidget *widget,
}
}
- if (!menu_shell->active || !menu_shell->button)
+ if (!priv->active || !priv->button)
{
- gboolean initially_active = menu_shell->active;
+ gboolean initially_active = priv->active;
- menu_shell->button = event->button;
+ priv->button = event->button;
if (menu_item)
{
if (_gtk_menu_item_is_selectable (menu_item) &&
gtk_widget_get_parent (menu_item) == widget &&
- menu_item != menu_shell->active_menu_item)
+ menu_item != priv->active_menu_item)
{
_gtk_menu_shell_activate (menu_shell);
- menu_shell->button = event->button;
+ priv->button = event->button;
if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement == GTK_TOP_BOTTOM)
{
- menu_shell->activate_time = event->time;
+ priv->activate_time = event->time;
gtk_menu_shell_select_item (menu_shell, menu_item);
}
}
@@ -662,21 +639,17 @@ gtk_menu_shell_button_press (GtkWidget *widget,
{
widget = gtk_get_event_widget ((GdkEvent*) event);
if (widget == GTK_WIDGET (menu_shell))
- {
- gtk_menu_shell_deactivate (menu_shell);
- g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
- }
+ {
+ gtk_menu_shell_deactivate (menu_shell);
+ g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
+ }
}
if (menu_item && _gtk_menu_item_is_selectable (menu_item) &&
GTK_MENU_ITEM (menu_item)->submenu != NULL &&
!gtk_widget_get_visible (GTK_MENU_ITEM (menu_item)->submenu))
{
- GtkMenuShellPrivate *priv;
-
_gtk_menu_item_popup_submenu (menu_item, FALSE);
-
- priv = GTK_MENU_SHELL_GET_PRIVATE (gtk_widget_get_parent (menu_item));
priv->activated_submenu = TRUE;
}
@@ -685,17 +658,15 @@ gtk_menu_shell_button_press (GtkWidget *widget,
static gboolean
gtk_menu_shell_grab_broken (GtkWidget *widget,
- GdkEventGrabBroken *event)
+ GdkEventGrabBroken *event)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
- if (menu_shell->have_xgrab && event->grab_window == NULL)
+ if (priv->have_xgrab && event->grab_window == NULL)
{
- /* Unset the active menu item so gtk_menu_popdown() doesn't see it.
- */
-
+ /* Unset the active menu item so gtk_menu_popdown() doesn't see it. */
gtk_menu_shell_deselect (menu_shell);
-
gtk_menu_shell_deactivate (menu_shell);
g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
}
@@ -705,29 +676,29 @@ gtk_menu_shell_grab_broken (GtkWidget *widget,
static gint
gtk_menu_shell_button_release (GtkWidget *widget,
- GdkEventButton *event)
+ GdkEventButton *event)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (widget);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
- if (menu_shell->active)
+ if (priv->active)
{
GtkWidget *menu_item;
gboolean deactivate = TRUE;
- if (menu_shell->button && (event->button != menu_shell->button))
- {
- menu_shell->button = 0;
- if (menu_shell->parent_menu_shell)
- return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- }
+ if (priv->button && (event->button != priv->button))
+ {
+ priv->button = 0;
+ if (priv->parent_menu_shell)
+ return gtk_widget_event (priv->parent_menu_shell, (GdkEvent*) event);
+ }
- menu_shell->button = 0;
+ priv->button = 0;
menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent*) event);
- if ((event->time - menu_shell->activate_time) > MENU_SHELL_TIMEOUT)
+ if ((event->time - priv->activate_time) > MENU_SHELL_TIMEOUT)
{
- if (menu_item && (menu_shell->active_menu_item == menu_item) &&
+ if (menu_item && (priv->active_menu_item == menu_item) &&
_gtk_menu_item_is_selectable (menu_item))
{
GtkWidget *submenu = GTK_MENU_ITEM (menu_item)->submenu;
@@ -735,7 +706,6 @@ gtk_menu_shell_button_release (GtkWidget *widget,
if (submenu == NULL)
{
gtk_menu_shell_activate_item (menu_shell, menu_item, TRUE);
-
deactivate = FALSE;
}
else if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM ||
@@ -767,10 +737,10 @@ gtk_menu_shell_button_release (GtkWidget *widget,
"gtk-menu-exact-popup-time", NULL);
}
- /* only close the submenu on click if we opened the
- * menu explicitely (usec_since_popup == 0) or
- * enough time has passed since it was opened by
- * GtkMenuItem's timeout (usec_since_popup > delay).
+ /* Only close the submenu on click if we opened the
+ * menu explicitely (usec_since_popup == 0) or
+ * enough time has passed since it was opened by
+ * GtkMenuItem's timeout (usec_since_popup > delay).
*/
if (!priv->activated_submenu &&
(usec_since_popup == 0 ||
@@ -792,16 +762,16 @@ gtk_menu_shell_button_release (GtkWidget *widget,
{
deactivate = FALSE;
}
- else if (menu_shell->parent_menu_shell)
+ else if (priv->parent_menu_shell)
{
- menu_shell->active = TRUE;
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
+ priv->active = TRUE;
+ gtk_widget_event (priv->parent_menu_shell, (GdkEvent*) event);
deactivate = FALSE;
}
- /* If we ended up on an item with a submenu, leave the menu up.
- */
- if (menu_item && (menu_shell->active_menu_item == menu_item) &&
+ /* If we ended up on an item with a submenu, leave the menu up. */
+ if (menu_item &&
+ (priv->active_menu_item == menu_item) &&
GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM)
{
deactivate = FALSE;
@@ -816,7 +786,7 @@ gtk_menu_shell_button_release (GtkWidget *widget,
* the chances of that happening are ~1/10^6, without
* serious harm if we lose.
*/
- menu_shell->activate_time = 0;
+ priv->activate_time = 0;
deactivate = FALSE;
}
@@ -836,13 +806,13 @@ void
_gtk_menu_shell_set_keyboard_mode (GtkMenuShell *menu_shell,
gboolean keyboard_mode)
{
- menu_shell->keyboard_mode = keyboard_mode;
+ menu_shell->priv->keyboard_mode = keyboard_mode;
}
gboolean
_gtk_menu_shell_get_keyboard_mode (GtkMenuShell *menu_shell)
{
- return menu_shell->keyboard_mode;
+ return menu_shell->priv->keyboard_mode;
}
void
@@ -854,7 +824,8 @@ _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
gboolean mnemonics_visible;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
- "gtk-auto-mnemonics", &auto_mnemonics, NULL);
+ "gtk-auto-mnemonics", &auto_mnemonics,
+ NULL);
if (!auto_mnemonics)
return;
@@ -863,7 +834,7 @@ _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
found = FALSE;
while (target)
{
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (target);
+ GtkMenuShellPrivate *priv = target->priv;
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (target));
/* The idea with keyboard mode is that once you start using
@@ -872,8 +843,8 @@ _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
* the keyboard mode upwards in the menu hierarchy here.
* Also see gtk_menu_popup, where we inherit it downwards.
*/
- if (menu_shell->keyboard_mode)
- target->keyboard_mode = TRUE;
+ if (menu_shell->priv->keyboard_mode)
+ target->priv->keyboard_mode = TRUE;
/* While navigating menus, the first parent menu with an active
* item is the one where mnemonics are effective, as can be seen
@@ -882,10 +853,10 @@ _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
* necessary to ensure we remove underlines from menu bars when
* dismissing menus.
*/
- mnemonics_visible = target->keyboard_mode &&
- (((target->active_menu_item || priv->in_unselectable_item) && !found) ||
+ mnemonics_visible = target->priv->keyboard_mode &&
+ (((target->priv->active_menu_item || priv->in_unselectable_item) && !found) ||
(target == menu_shell &&
- !target->parent_menu_shell &&
+ !target->priv->parent_menu_shell &&
gtk_widget_has_grab (GTK_WIDGET (target))));
/* While menus are up, only show underlines inside the menubar,
@@ -900,32 +871,33 @@ _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
else
gtk_window_set_mnemonics_visible (GTK_WINDOW (toplevel), mnemonics_visible);
- if (target->active_menu_item || priv->in_unselectable_item)
+ if (target->priv->active_menu_item || priv->in_unselectable_item)
found = TRUE;
- target = GTK_MENU_SHELL (target->parent_menu_shell);
+ target = GTK_MENU_SHELL (target->priv->parent_menu_shell);
}
}
static gint
gtk_menu_shell_key_press (GtkWidget *widget,
- GdkEventKey *event)
+ GdkEventKey *event)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
gboolean enable_mnemonics;
- menu_shell->keyboard_mode = TRUE;
+ priv->keyboard_mode = TRUE;
- if (!(menu_shell->active_menu_item || priv->in_unselectable_item) && menu_shell->parent_menu_shell)
- return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent *)event);
+ if (!(priv->active_menu_item || priv->in_unselectable_item) &&
+ priv->parent_menu_shell)
+ return gtk_widget_event (priv->parent_menu_shell, (GdkEvent *)event);
if (gtk_bindings_activate_event (G_OBJECT (widget), event))
return TRUE;
g_object_get (gtk_widget_get_settings (widget),
- "gtk-enable-mnemonics", &enable_mnemonics,
- NULL);
+ "gtk-enable-mnemonics", &enable_mnemonics,
+ NULL);
if (enable_mnemonics)
return gtk_menu_shell_activate_mnemonic (menu_shell, event);
@@ -935,16 +907,17 @@ gtk_menu_shell_key_press (GtkWidget *widget,
static gint
gtk_menu_shell_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event)
+ GdkEventCrossing *event)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
if (event->mode == GDK_CROSSING_GTK_GRAB ||
event->mode == GDK_CROSSING_GTK_UNGRAB ||
event->mode == GDK_CROSSING_STATE_CHANGED)
return TRUE;
- if (menu_shell->active)
+ if (priv->active)
{
GtkWidget *menu_item;
GtkWidget *parent;
@@ -957,24 +930,20 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
if (GTK_IS_MENU_ITEM (menu_item) &&
!_gtk_menu_item_is_selectable (menu_item))
{
- GtkMenuShellPrivate *priv;
-
- priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
priv->in_unselectable_item = TRUE;
-
return TRUE;
}
parent = gtk_widget_get_parent (menu_item);
if (parent == widget &&
- GTK_IS_MENU_ITEM (menu_item))
- {
- if (menu_shell->ignore_enter)
- return TRUE;
+ GTK_IS_MENU_ITEM (menu_item))
+ {
+ if (priv->ignore_enter)
+ return TRUE;
- if (event->detail != GDK_NOTIFY_INFERIOR)
+ if (event->detail != GDK_NOTIFY_INFERIOR)
{
- if (gtk_widget_get_state (menu_item) != GTK_STATE_PRELIGHT)
+ if (gtk_widget_get_state (menu_item) != GTK_STATE_PRELIGHT)
gtk_menu_shell_select_item (menu_shell, menu_item);
/* If any mouse button is down, and there is a submenu
@@ -985,13 +954,10 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
* entering a menu item where we wouldn't want to show
* its submenu.
*/
- if ((event->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
+ if ((event->state & (GDK_BUTTON1_MASK|GDK_BUTTON2_MASK|GDK_BUTTON3_MASK)) &&
GTK_MENU_ITEM (menu_item)->submenu != NULL)
{
- GtkMenuShellPrivate *priv;
-
- priv = GTK_MENU_SHELL_GET_PRIVATE (parent);
- priv->activated_submenu = TRUE;
+ GTK_MENU_SHELL (parent)->priv->activated_submenu = TRUE;
if (!gtk_widget_get_visible (GTK_MENU_ITEM (menu_item)->submenu))
{
@@ -1005,12 +971,12 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
_gtk_menu_item_popup_submenu (menu_item, TRUE);
}
}
- }
- }
- else if (menu_shell->parent_menu_shell)
- {
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- }
+ }
+ }
+ else if (priv->parent_menu_shell)
+ {
+ gtk_widget_event (priv->parent_menu_shell, (GdkEvent*) event);
+ }
}
return TRUE;
@@ -1018,7 +984,7 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
static gint
gtk_menu_shell_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event)
+ GdkEventCrossing *event)
{
if (event->mode == GDK_CROSSING_GTK_GRAB ||
event->mode == GDK_CROSSING_GTK_GRAB ||
@@ -1028,37 +994,34 @@ gtk_menu_shell_leave_notify (GtkWidget *widget,
if (gtk_widget_get_visible (widget))
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkWidget *event_widget = gtk_get_event_widget ((GdkEvent*) event);
GtkMenuItem *menu_item;
if (!event_widget || !GTK_IS_MENU_ITEM (event_widget))
- return TRUE;
+ return TRUE;
menu_item = GTK_MENU_ITEM (event_widget);
if (!_gtk_menu_item_is_selectable (event_widget))
{
- GtkMenuShellPrivate *priv;
-
- priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
priv->in_unselectable_item = TRUE;
-
return TRUE;
}
- if ((menu_shell->active_menu_item == event_widget) &&
- (menu_item->submenu == NULL))
- {
- if ((event->detail != GDK_NOTIFY_INFERIOR) &&
- (gtk_widget_get_state (GTK_WIDGET (menu_item)) != GTK_STATE_NORMAL))
- {
- gtk_menu_shell_deselect (menu_shell);
- }
- }
- else if (menu_shell->parent_menu_shell)
- {
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- }
+ if ((priv->active_menu_item == event_widget) &&
+ (menu_item->submenu == NULL))
+ {
+ if ((event->detail != GDK_NOTIFY_INFERIOR) &&
+ (gtk_widget_get_state (GTK_WIDGET (menu_item)) != GTK_STATE_NORMAL))
+ {
+ gtk_menu_shell_deselect (menu_shell);
+ }
+ }
+ else if (priv->parent_menu_shell)
+ {
+ gtk_widget_event (priv->parent_menu_shell, (GdkEvent*) event);
+ }
}
return TRUE;
@@ -1066,37 +1029,38 @@ gtk_menu_shell_leave_notify (GtkWidget *widget,
static void
gtk_menu_shell_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen)
+ GdkScreen *previous_screen)
{
gtk_menu_shell_reset_key_hash (GTK_MENU_SHELL (widget));
}
static void
gtk_menu_shell_add (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *widget)
{
gtk_menu_shell_append (GTK_MENU_SHELL (container), widget);
}
static void
gtk_menu_shell_remove (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *widget)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (container);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
gint was_visible;
was_visible = gtk_widget_get_visible (widget);
- menu_shell->children = g_list_remove (menu_shell->children, widget);
-
- if (widget == menu_shell->active_menu_item)
+ priv->children = g_list_remove (priv->children, widget);
+
+ if (widget == priv->active_menu_item)
{
- g_signal_emit_by_name (menu_shell->active_menu_item, "deselect");
- menu_shell->active_menu_item = NULL;
+ g_signal_emit_by_name (priv->active_menu_item, "deselect");
+ priv->active_menu_item = NULL;
}
gtk_widget_unparent (widget);
-
- /* queue resize regardless of gtk_widget_get_visible (container),
+
+ /* Queue resize regardless of gtk_widget_get_visible (container),
* since that's what is needed by toplevels.
*/
if (was_visible)
@@ -1105,15 +1069,15 @@ gtk_menu_shell_remove (GtkContainer *container,
static void
gtk_menu_shell_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (container);
GtkWidget *child;
GList *children;
- children = menu_shell->children;
+ children = menu_shell->priv->children;
while (children)
{
child = children->data;
@@ -1127,27 +1091,28 @@ gtk_menu_shell_forall (GtkContainer *container,
static void
gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell)
{
- if (menu_shell->active)
+ GtkMenuShellPrivate *priv = menu_shell->priv;
+
+ if (priv->active)
{
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
- menu_shell->button = 0;
- menu_shell->active = FALSE;
- menu_shell->activate_time = 0;
+ priv->button = 0;
+ priv->active = FALSE;
+ priv->activate_time = 0;
- if (menu_shell->active_menu_item)
- {
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
- menu_shell->active_menu_item = NULL;
- }
+ if (priv->active_menu_item)
+ {
+ gtk_menu_item_deselect (GTK_MENU_ITEM (priv->active_menu_item));
+ priv->active_menu_item = NULL;
+ }
- if (menu_shell->have_grab)
- {
- menu_shell->have_grab = FALSE;
+ if (priv->have_grab)
+ {
+ priv->have_grab = FALSE;
gtk_device_grab_remove (GTK_WIDGET (menu_shell), priv->grab_pointer);
- }
- if (menu_shell->have_xgrab)
- {
+ }
+ if (priv->have_xgrab)
+ {
GdkDevice *keyboard;
gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
@@ -1156,10 +1121,10 @@ gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell)
if (keyboard)
gdk_device_ungrab (keyboard, GDK_CURRENT_TIME);
- menu_shell->have_xgrab = FALSE;
- }
+ priv->have_xgrab = FALSE;
+ }
- menu_shell->keyboard_mode = FALSE;
+ priv->keyboard_mode = FALSE;
_gtk_menu_shell_set_grab_device (menu_shell, NULL);
_gtk_menu_shell_update_mnemonics (menu_shell);
@@ -1168,7 +1133,7 @@ gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell)
static gint
gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
- GtkWidget *child)
+ GtkWidget *child)
{
GtkWidget *parent;
@@ -1179,8 +1144,8 @@ gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
while (GTK_IS_MENU_SHELL (parent))
{
if (parent == (GtkWidget*) menu_shell)
- return TRUE;
- parent = GTK_MENU_SHELL (parent)->parent_menu_shell;
+ return TRUE;
+ parent = GTK_MENU_SHELL (parent)->priv->parent_menu_shell;
}
return FALSE;
@@ -1188,12 +1153,12 @@ gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
static GtkWidget*
gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
- GdkEvent *event)
+ GdkEvent *event)
{
GtkWidget *menu_item;
menu_item = gtk_get_event_widget ((GdkEvent*) event);
-
+
while (menu_item && !GTK_IS_MENU_ITEM (menu_item))
menu_item = gtk_widget_get_parent (menu_item);
@@ -1207,8 +1172,9 @@ gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
void
gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
- GtkWidget *menu_item)
+ GtkWidget *menu_item)
{
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkMenuShellClass *class;
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
@@ -1217,71 +1183,71 @@ gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
class = GTK_MENU_SHELL_GET_CLASS (menu_shell);
if (class->select_item &&
- !(menu_shell->active &&
- menu_shell->active_menu_item == menu_item))
+ !(priv->active &&
+ priv->active_menu_item == menu_item))
class->select_item (menu_shell, menu_item);
}
void _gtk_menu_item_set_placement (GtkMenuItem *menu_item,
- GtkSubmenuPlacement placement);
+ GtkSubmenuPlacement placement);
static void
gtk_menu_shell_real_select_item (GtkMenuShell *menu_shell,
- GtkWidget *menu_item)
+ GtkWidget *menu_item)
{
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkPackDirection pack_dir = PACK_DIRECTION (menu_shell);
- if (menu_shell->active_menu_item)
+ if (priv->active_menu_item)
{
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
- menu_shell->active_menu_item = NULL;
+ gtk_menu_item_deselect (GTK_MENU_ITEM (priv->active_menu_item));
+ priv->active_menu_item = NULL;
}
if (!_gtk_menu_item_is_selectable (menu_item))
{
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
-
priv->in_unselectable_item = TRUE;
_gtk_menu_shell_update_mnemonics (menu_shell);
-
return;
}
- menu_shell->active_menu_item = menu_item;
+ priv->active_menu_item = menu_item;
if (pack_dir == GTK_PACK_DIRECTION_TTB || pack_dir == GTK_PACK_DIRECTION_BTT)
- _gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
- GTK_LEFT_RIGHT);
+ _gtk_menu_item_set_placement (GTK_MENU_ITEM (priv->active_menu_item),
+ GTK_LEFT_RIGHT);
else
- _gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
- GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement);
- gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
+ _gtk_menu_item_set_placement (GTK_MENU_ITEM (priv->active_menu_item),
+ GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement);
+ gtk_menu_item_select (GTK_MENU_ITEM (priv->active_menu_item));
_gtk_menu_shell_update_mnemonics (menu_shell);
/* This allows the bizarre radio buttons-with-submenus-display-history
* behavior
*/
- if (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu)
- gtk_widget_activate (menu_shell->active_menu_item);
+ if (GTK_MENU_ITEM (priv->active_menu_item)->submenu)
+ gtk_widget_activate (priv->active_menu_item);
}
void
gtk_menu_shell_deselect (GtkMenuShell *menu_shell)
{
+ GtkMenuShellPrivate *priv = menu_shell->priv;
+
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
- if (menu_shell->active_menu_item)
+ if (priv->active_menu_item)
{
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
- menu_shell->active_menu_item = NULL;
+ gtk_menu_item_deselect (GTK_MENU_ITEM (priv->active_menu_item));
+ priv->active_menu_item = NULL;
_gtk_menu_shell_update_mnemonics (menu_shell);
}
}
void
-gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
- GtkWidget *menu_item,
- gboolean force_deactivate)
+gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
+ GtkWidget *menu_item,
+ gboolean force_deactivate)
{
GSList *slist, *shells = NULL;
gboolean deactivate = force_deactivate;
@@ -1300,17 +1266,17 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
GtkMenuShell *parent_menu_shell = menu_shell;
do
- {
- g_object_ref (parent_menu_shell);
- shells = g_slist_prepend (shells, parent_menu_shell);
- parent_menu_shell = (GtkMenuShell*) parent_menu_shell->parent_menu_shell;
- }
+ {
+ g_object_ref (parent_menu_shell);
+ shells = g_slist_prepend (shells, parent_menu_shell);
+ parent_menu_shell = (GtkMenuShell*) parent_menu_shell->priv->parent_menu_shell;
+ }
while (parent_menu_shell);
shells = g_slist_reverse (shells);
gtk_menu_shell_deactivate (menu_shell);
-
- /* flush the x-queue, so any grabs are removed and
+
+ /* Flush the x-queue, so any grabs are removed and
* the menu is actually taken down
*/
gdk_display_sync (gtk_widget_get_display (menu_item));
@@ -1331,13 +1297,14 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
/* Distance should be +/- 1 */
static gboolean
-gtk_menu_shell_real_move_selected (GtkMenuShell *menu_shell,
- gint distance)
+gtk_menu_shell_real_move_selected (GtkMenuShell *menu_shell,
+ gint distance)
{
- if (menu_shell->active_menu_item)
+ GtkMenuShellPrivate *priv = menu_shell->priv;
+
+ if (priv->active_menu_item)
{
- GList *node = g_list_find (menu_shell->children,
- menu_shell->active_menu_item);
+ GList *node = g_list_find (priv->children, priv->active_menu_item);
GList *start_node = node;
gboolean wrap_around;
@@ -1346,42 +1313,42 @@ gtk_menu_shell_real_move_selected (GtkMenuShell *menu_shell,
NULL);
if (distance > 0)
- {
- node = node->next;
- while (node != start_node &&
- (!node || !_gtk_menu_item_is_selectable (node->data)))
- {
- if (node)
- node = node->next;
+ {
+ node = node->next;
+ while (node != start_node &&
+ (!node || !_gtk_menu_item_is_selectable (node->data)))
+ {
+ if (node)
+ node = node->next;
else if (wrap_around)
- node = menu_shell->children;
+ node = priv->children;
else
{
gtk_widget_error_bell (GTK_WIDGET (menu_shell));
break;
}
- }
- }
+ }
+ }
else
- {
- node = node->prev;
- while (node != start_node &&
- (!node || !_gtk_menu_item_is_selectable (node->data)))
- {
- if (node)
- node = node->prev;
+ {
+ node = node->prev;
+ while (node != start_node &&
+ (!node || !_gtk_menu_item_is_selectable (node->data)))
+ {
+ if (node)
+ node = node->prev;
else if (wrap_around)
- node = g_list_last (menu_shell->children);
+ node = g_list_last (priv->children);
else
{
gtk_widget_error_bell (GTK_WIDGET (menu_shell));
break;
}
- }
- }
+ }
+ }
if (node)
- gtk_menu_shell_select_item (menu_shell, node->data);
+ gtk_menu_shell_select_item (menu_shell, node->data);
}
return TRUE;
@@ -1389,13 +1356,13 @@ gtk_menu_shell_real_move_selected (GtkMenuShell *menu_shell,
/* Distance should be +/- 1 */
static void
-gtk_menu_shell_move_selected (GtkMenuShell *menu_shell,
- gint distance)
+gtk_menu_shell_move_selected (GtkMenuShell *menu_shell,
+ gint distance)
{
gboolean handled = FALSE;
g_signal_emit (menu_shell, menu_shell_signals[MOVE_SELECTED], 0,
- distance, &handled);
+ distance, &handled);
}
/**
@@ -1406,33 +1373,34 @@ gtk_menu_shell_move_selected (GtkMenuShell *menu_shell,
* the first item isn't sensitive. This
* should be %FALSE if the menu is being
* popped up initially.
- *
+ *
* Select the first visible or selectable child of the menu shell;
* don't select tearoff items unless the only item is a tearoff
* item.
*
* Since: 2.2
- **/
+ */
void
gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
- gboolean search_sensitive)
+ gboolean search_sensitive)
{
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkWidget *to_select = NULL;
GList *tmp_list;
- tmp_list = menu_shell->children;
+ tmp_list = priv->children;
while (tmp_list)
{
GtkWidget *child = tmp_list->data;
-
+
if ((!search_sensitive && gtk_widget_get_visible (child)) ||
- _gtk_menu_item_is_selectable (child))
- {
- to_select = child;
- if (!GTK_IS_TEAROFF_MENU_ITEM (child))
- break;
- }
-
+ _gtk_menu_item_is_selectable (child))
+ {
+ to_select = child;
+ if (!GTK_IS_TEAROFF_MENU_ITEM (child))
+ break;
+ }
+
tmp_list = tmp_list->next;
}
@@ -1442,24 +1410,25 @@ gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
void
_gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
- gboolean search_sensitive)
+ gboolean search_sensitive)
{
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkWidget *to_select = NULL;
GList *tmp_list;
- tmp_list = g_list_last (menu_shell->children);
+ tmp_list = g_list_last (priv->children);
while (tmp_list)
{
GtkWidget *child = tmp_list->data;
-
+
if ((!search_sensitive && gtk_widget_get_visible (child)) ||
- _gtk_menu_item_is_selectable (child))
- {
- to_select = child;
- if (!GTK_IS_TEAROFF_MENU_ITEM (child))
- break;
- }
-
+ _gtk_menu_item_is_selectable (child))
+ {
+ to_select = child;
+ if (!GTK_IS_TEAROFF_MENU_ITEM (child))
+ break;
+ }
+
tmp_list = tmp_list->prev;
}
@@ -1468,21 +1437,22 @@ _gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
}
static gboolean
-gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell)
+gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell)
{
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkMenuItem *menu_item;
- if (menu_shell->active_menu_item == NULL)
+ if (priv->active_menu_item == NULL)
return FALSE;
- menu_item = GTK_MENU_ITEM (menu_shell->active_menu_item);
-
+ menu_item = GTK_MENU_ITEM (priv->active_menu_item);
+
if (menu_item->submenu)
{
_gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item), FALSE);
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu_item->submenu), TRUE);
- if (GTK_MENU_SHELL (menu_item->submenu)->active_menu_item)
- return TRUE;
+ if (GTK_MENU_SHELL (menu_item->submenu)->priv->active_menu_item)
+ return TRUE;
}
return FALSE;
@@ -1490,43 +1460,42 @@ gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell)
static void
gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
- GtkMenuDirectionType direction)
+ GtkMenuDirectionType direction)
{
- GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkMenuShell *parent_menu_shell = NULL;
gboolean had_selection;
gboolean touchscreen_mode;
priv->in_unselectable_item = FALSE;
- had_selection = menu_shell->active_menu_item != NULL;
+ had_selection = priv->active_menu_item != NULL;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
- if (menu_shell->parent_menu_shell)
- parent_menu_shell = GTK_MENU_SHELL (menu_shell->parent_menu_shell);
+ if (priv->parent_menu_shell)
+ parent_menu_shell = GTK_MENU_SHELL (priv->parent_menu_shell);
switch (direction)
{
case GTK_MENU_DIR_PARENT:
if (touchscreen_mode &&
- menu_shell->active_menu_item &&
- GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu &&
- gtk_widget_get_visible (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu))
+ priv->active_menu_item &&
+ GTK_MENU_ITEM (priv->active_menu_item)->submenu &&
+ gtk_widget_get_visible (GTK_MENU_ITEM (priv->active_menu_item)->submenu))
{
/* if we are on a menu item that has an open submenu but the
* focus is not in that submenu (e.g. because it's empty or
- * has only insensitive items), close that submenu instead
- * of running into the code below which would close *this*
- * menu.
+ * has only insensitive items), close that submenu instead of
+ * running into the code below which would close *this* menu.
*/
- _gtk_menu_item_popdown_submenu (menu_shell->active_menu_item);
+ _gtk_menu_item_popdown_submenu (priv->active_menu_item);
_gtk_menu_shell_update_mnemonics (menu_shell);
}
else if (parent_menu_shell)
- {
+ {
if (touchscreen_mode)
{
/* close menu when returning from submenu. */
@@ -1535,117 +1504,119 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
break;
}
- if (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
+ if (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement)
- gtk_menu_shell_deselect (menu_shell);
- else
- {
- if (PACK_DIRECTION (parent_menu_shell) == GTK_PACK_DIRECTION_LTR)
- gtk_menu_shell_move_selected (parent_menu_shell, -1);
- else
- gtk_menu_shell_move_selected (parent_menu_shell, 1);
- gtk_menu_shell_select_submenu_first (parent_menu_shell);
- }
- }
+ gtk_menu_shell_deselect (menu_shell);
+ else
+ {
+ if (PACK_DIRECTION (parent_menu_shell) == GTK_PACK_DIRECTION_LTR)
+ gtk_menu_shell_move_selected (parent_menu_shell, -1);
+ else
+ gtk_menu_shell_move_selected (parent_menu_shell, 1);
+ gtk_menu_shell_select_submenu_first (parent_menu_shell);
+ }
+ }
/* If there is no parent and the submenu is in the opposite direction
* to the menu, then make the PARENT direction wrap around to
* the bottom of the submenu.
*/
- else if (menu_shell->active_menu_item &&
- _gtk_menu_item_is_selectable (menu_shell->active_menu_item) &&
- GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu)
- {
- GtkMenuShell *submenu = GTK_MENU_SHELL (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu);
-
- if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement !=
- GTK_MENU_SHELL_GET_CLASS (submenu)->submenu_placement)
- _gtk_menu_shell_select_last (submenu, TRUE);
- }
+ else if (priv->active_menu_item &&
+ _gtk_menu_item_is_selectable (priv->active_menu_item) &&
+ GTK_MENU_ITEM (priv->active_menu_item)->submenu)
+ {
+ GtkMenuShell *submenu = GTK_MENU_SHELL (GTK_MENU_ITEM (priv->active_menu_item)->submenu);
+
+ if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement !=
+ GTK_MENU_SHELL_GET_CLASS (submenu)->submenu_placement)
+ _gtk_menu_shell_select_last (submenu, TRUE);
+ }
break;
case GTK_MENU_DIR_CHILD:
- if (menu_shell->active_menu_item &&
- _gtk_menu_item_is_selectable (menu_shell->active_menu_item) &&
- GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu)
- {
- if (gtk_menu_shell_select_submenu_first (menu_shell))
- break;
- }
+ if (priv->active_menu_item &&
+ _gtk_menu_item_is_selectable (priv->active_menu_item) &&
+ GTK_MENU_ITEM (priv->active_menu_item)->submenu)
+ {
+ if (gtk_menu_shell_select_submenu_first (menu_shell))
+ break;
+ }
/* Try to find a menu running the opposite direction */
while (parent_menu_shell &&
- (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
- GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement))
- {
- parent_menu_shell = GTK_MENU_SHELL (parent_menu_shell->parent_menu_shell);
- }
+ (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
+ GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement))
+ {
+ parent_menu_shell = GTK_MENU_SHELL (parent_menu_shell->priv->parent_menu_shell);
+ }
if (parent_menu_shell)
- {
- if (PACK_DIRECTION (parent_menu_shell) == GTK_PACK_DIRECTION_LTR)
- gtk_menu_shell_move_selected (parent_menu_shell, 1);
- else
- gtk_menu_shell_move_selected (parent_menu_shell, -1);
-
- gtk_menu_shell_select_submenu_first (parent_menu_shell);
- }
+ {
+ if (PACK_DIRECTION (parent_menu_shell) == GTK_PACK_DIRECTION_LTR)
+ gtk_menu_shell_move_selected (parent_menu_shell, 1);
+ else
+ gtk_menu_shell_move_selected (parent_menu_shell, -1);
+
+ gtk_menu_shell_select_submenu_first (parent_menu_shell);
+ }
break;
case GTK_MENU_DIR_PREV:
gtk_menu_shell_move_selected (menu_shell, -1);
if (!had_selection &&
- !menu_shell->active_menu_item &&
- menu_shell->children)
- _gtk_menu_shell_select_last (menu_shell, TRUE);
+ !priv->active_menu_item &&
+ priv->children)
+ _gtk_menu_shell_select_last (menu_shell, TRUE);
break;
case GTK_MENU_DIR_NEXT:
gtk_menu_shell_move_selected (menu_shell, 1);
if (!had_selection &&
- !menu_shell->active_menu_item &&
- menu_shell->children)
- gtk_menu_shell_select_first (menu_shell, TRUE);
+ !priv->active_menu_item &&
+ priv->children)
+ gtk_menu_shell_select_first (menu_shell, TRUE);
break;
}
}
static void
-gtk_real_menu_shell_activate_current (GtkMenuShell *menu_shell,
- gboolean force_hide)
+gtk_real_menu_shell_activate_current (GtkMenuShell *menu_shell,
+ gboolean force_hide)
{
- if (menu_shell->active_menu_item &&
- _gtk_menu_item_is_selectable (menu_shell->active_menu_item))
+ GtkMenuShellPrivate *priv = menu_shell->priv;
+
+ if (priv->active_menu_item &&
+ _gtk_menu_item_is_selectable (priv->active_menu_item))
{
- if (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL)
+ if (GTK_MENU_ITEM (priv->active_menu_item)->submenu == NULL)
gtk_menu_shell_activate_item (menu_shell,
- menu_shell->active_menu_item,
- force_hide);
+ priv->active_menu_item,
+ force_hide);
else
- _gtk_menu_item_popup_submenu (menu_shell->active_menu_item, FALSE);
+ _gtk_menu_item_popup_submenu (priv->active_menu_item, FALSE);
}
}
static void
-gtk_real_menu_shell_cancel (GtkMenuShell *menu_shell)
+gtk_real_menu_shell_cancel (GtkMenuShell *menu_shell)
{
- /* Unset the active menu item so gtk_menu_popdown() doesn't see it.
- */
+ /* Unset the active menu item so gtk_menu_popdown() doesn't see it. */
gtk_menu_shell_deselect (menu_shell);
-
gtk_menu_shell_deactivate (menu_shell);
g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
}
static void
-gtk_real_menu_shell_cycle_focus (GtkMenuShell *menu_shell,
- GtkDirectionType dir)
+gtk_real_menu_shell_cycle_focus (GtkMenuShell *menu_shell,
+ GtkDirectionType dir)
{
+ GtkMenuShellPrivate *priv = menu_shell->priv;
+
while (menu_shell && !GTK_IS_MENU_BAR (menu_shell))
{
- if (menu_shell->parent_menu_shell)
- menu_shell = GTK_MENU_SHELL (menu_shell->parent_menu_shell);
+ if (priv->parent_menu_shell)
+ menu_shell = GTK_MENU_SHELL (priv->parent_menu_shell);
else
- menu_shell = NULL;
+ menu_shell = NULL;
}
if (menu_shell)
@@ -1665,11 +1636,11 @@ _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell)
{
gint popup_delay;
GtkWidget *widget = GTK_WIDGET (menu_shell);
-
+
g_object_get (gtk_widget_get_settings (widget),
- "gtk-menu-popup-delay", &popup_delay,
- NULL);
-
+ "gtk-menu-popup-delay", &popup_delay,
+ NULL);
+
return popup_delay;
}
}
@@ -1677,9 +1648,9 @@ _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell)
/**
* gtk_menu_shell_cancel:
* @menu_shell: a #GtkMenuShell
- *
- * Cancels the selection within the menu shell.
- *
+ *
+ * Cancels the selection within the menu shell.
+ *
* Since: 2.4
*/
void
@@ -1692,20 +1663,20 @@ gtk_menu_shell_cancel (GtkMenuShell *menu_shell)
static GtkMnemonicHash *
gtk_menu_shell_get_mnemonic_hash (GtkMenuShell *menu_shell,
- gboolean create)
+ gboolean create)
{
- GtkMenuShellPrivate *private = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
- if (!private->mnemonic_hash && create)
- private->mnemonic_hash = _gtk_mnemonic_hash_new ();
+ if (!priv->mnemonic_hash && create)
+ priv->mnemonic_hash = _gtk_mnemonic_hash_new ();
- return private->mnemonic_hash;
+ return priv->mnemonic_hash;
}
static void
-menu_shell_add_mnemonic_foreach (guint keyval,
- GSList *targets,
- gpointer data)
+menu_shell_add_mnemonic_foreach (guint keyval,
+ GSList *targets,
+ gpointer data)
{
GtkKeyHash *key_hash = data;
@@ -1714,45 +1685,45 @@ menu_shell_add_mnemonic_foreach (guint keyval,
static GtkKeyHash *
gtk_menu_shell_get_key_hash (GtkMenuShell *menu_shell,
- gboolean create)
+ gboolean create)
{
- GtkMenuShellPrivate *private = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
GtkWidget *widget = GTK_WIDGET (menu_shell);
- if (!private->key_hash && create && gtk_widget_has_screen (widget))
+ if (!priv->key_hash && create && gtk_widget_has_screen (widget))
{
GtkMnemonicHash *mnemonic_hash = gtk_menu_shell_get_mnemonic_hash (menu_shell, FALSE);
GdkScreen *screen = gtk_widget_get_screen (widget);
GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_screen_get_display (screen));
if (!mnemonic_hash)
- return NULL;
-
- private->key_hash = _gtk_key_hash_new (keymap, NULL);
+ return NULL;
+
+ priv->key_hash = _gtk_key_hash_new (keymap, NULL);
_gtk_mnemonic_hash_foreach (mnemonic_hash,
- menu_shell_add_mnemonic_foreach,
- private->key_hash);
+ menu_shell_add_mnemonic_foreach,
+ priv->key_hash);
}
-
- return private->key_hash;
+
+ return priv->key_hash;
}
static void
gtk_menu_shell_reset_key_hash (GtkMenuShell *menu_shell)
{
- GtkMenuShellPrivate *private = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
+ GtkMenuShellPrivate *priv = menu_shell->priv;
- if (private->key_hash)
+ if (priv->key_hash)
{
- _gtk_key_hash_free (private->key_hash);
- private->key_hash = NULL;
+ _gtk_key_hash_free (priv->key_hash);
+ priv->key_hash = NULL;
}
}
static gboolean
gtk_menu_shell_activate_mnemonic (GtkMenuShell *menu_shell,
- GdkEventKey *event)
+ GdkEventKey *event)
{
GtkMnemonicHash *mnemonic_hash;
GtkKeyHash *key_hash;
@@ -1766,43 +1737,43 @@ gtk_menu_shell_activate_mnemonic (GtkMenuShell *menu_shell,
key_hash = gtk_menu_shell_get_key_hash (menu_shell, TRUE);
if (!key_hash)
return FALSE;
-
+
entries = _gtk_key_hash_lookup (key_hash,
- event->hardware_keycode,
- event->state,
- gtk_accelerator_get_default_mod_mask (),
- event->group);
+ event->hardware_keycode,
+ event->state,
+ gtk_accelerator_get_default_mod_mask (),
+ event->group);
if (entries)
result = _gtk_mnemonic_hash_activate (mnemonic_hash,
- GPOINTER_TO_UINT (entries->data));
+ GPOINTER_TO_UINT (entries->data));
return result;
}
void
_gtk_menu_shell_add_mnemonic (GtkMenuShell *menu_shell,
- guint keyval,
- GtkWidget *target)
+ guint keyval,
+ GtkWidget *target)
{
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
g_return_if_fail (GTK_IS_WIDGET (target));
_gtk_mnemonic_hash_add (gtk_menu_shell_get_mnemonic_hash (menu_shell, TRUE),
- keyval, target);
+ keyval, target);
gtk_menu_shell_reset_key_hash (menu_shell);
}
void
_gtk_menu_shell_remove_mnemonic (GtkMenuShell *menu_shell,
- guint keyval,
- GtkWidget *target)
+ guint keyval,
+ GtkWidget *target)
{
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
g_return_if_fail (GTK_IS_WIDGET (target));
-
+
_gtk_mnemonic_hash_remove (gtk_menu_shell_get_mnemonic_hash (menu_shell, TRUE),
- keyval, target);
+ keyval, target);
gtk_menu_shell_reset_key_hash (menu_shell);
}
@@ -1810,12 +1781,10 @@ void
_gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
GdkDevice *device)
{
- GtkMenuShellPrivate *priv;
+ GtkMenuShellPrivate *priv = menu_shell->priv;
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
- g_return_if_fail (!device || GDK_IS_DEVICE (device));
-
- priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
+ g_return_if_fail (device == NULL || GDK_IS_DEVICE (device));
if (!device)
priv->grab_pointer = NULL;
@@ -1826,15 +1795,11 @@ _gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
}
GdkDevice *
-_gtk_menu_shell_get_grab_device (GtkMenuShell *menu_shell)
+_gtk_menu_shell_get_grab_device (GtkMenuShell *menu_shell)
{
- GtkMenuShellPrivate *priv;
-
g_return_val_if_fail (GTK_IS_MENU_SHELL (menu_shell), NULL);
- priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
-
- return priv->grab_pointer;
+ return menu_shell->priv->grab_pointer;
}
/**
@@ -1846,37 +1811,35 @@ _gtk_menu_shell_get_grab_device (GtkMenuShell *menu_shell)
* Returns: %TRUE if the menu shell will take the keyboard focus on popup.
*
* Since: 2.8
- **/
+ */
gboolean
gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell)
{
- GtkMenuShellPrivate *priv;
-
g_return_val_if_fail (GTK_IS_MENU_SHELL (menu_shell), FALSE);
- priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
-
- return priv->take_focus;
+ return menu_shell->priv->take_focus;
}
/**
* gtk_menu_shell_set_take_focus:
* @menu_shell: a #GtkMenuShell
- * @take_focus: %TRUE if the menu shell should take the keyboard focus on popup.
+ * @take_focus: %TRUE if the menu shell should take the keyboard
+ * focus on popup
*
- * If @take_focus is %TRUE (the default) the menu shell will take the keyboard
- * focus so that it will receive all keyboard events which is needed to enable
- * keyboard navigation in menus.
+ * If @take_focus is %TRUE (the default) the menu shell will take
+ * the keyboard focus so that it will receive all keyboard events
+ * which is needed to enable keyboard navigation in menus.
*
* Setting @take_focus to %FALSE is useful only for special applications
* like virtual keyboard implementations which should not take keyboard
* focus.
*
- * The @take_focus state of a menu or menu bar is automatically propagated
- * to submenus whenever a submenu is popped up, so you don't have to worry
- * about recursively setting it for your entire menu hierarchy. Only when
- * programmatically picking a submenu and popping it up manually, the
- * @take_focus property of the submenu needs to be set explicitely.
+ * The @take_focus state of a menu or menu bar is automatically
+ * propagated to submenus whenever a submenu is popped up, so you
+ * don't have to worry about recursively setting it for your entire
+ * menu hierarchy. Only when programmatically picking a submenu and
+ * popping it up manually, the @take_focus property of the submenu
+ * needs to be set explicitely.
*
* Note that setting it to %FALSE has side-effects:
*
@@ -1891,17 +1854,15 @@ gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell)
* See also gdk_keyboard_grab()
*
* Since: 2.8
- **/
+ */
void
gtk_menu_shell_set_take_focus (GtkMenuShell *menu_shell,
gboolean take_focus)
{
- GtkMenuShellPrivate *priv;
+ GtkMenuShellPrivate *priv = menu_shell->priv;
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
- priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
-
if (priv->take_focus != take_focus)
{
priv->take_focus = take_focus;
diff --git a/gtk/gtkmenushell.h b/gtk/gtkmenushell.h
index ee09a84..9e7d97d 100644
--- a/gtk/gtkmenushell.h
+++ b/gtk/gtkmenushell.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -37,59 +37,48 @@
G_BEGIN_DECLS
-#define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ())
-#define GTK_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell))
-#define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
-#define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_SHELL))
-#define GTK_IS_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL))
+#define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ())
+#define GTK_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell))
+#define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
+#define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_SHELL))
+#define GTK_IS_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL))
#define GTK_MENU_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
-typedef struct _GtkMenuShell GtkMenuShell;
-typedef struct _GtkMenuShellClass GtkMenuShellClass;
+typedef struct _GtkMenuShell GtkMenuShell;
+typedef struct _GtkMenuShellClass GtkMenuShellClass;
+typedef struct _GtkMenuShellPrivate GtkMenuShellPrivate;
struct _GtkMenuShell
{
GtkContainer container;
- GList *GSEAL (children);
- GtkWidget *GSEAL (active_menu_item);
- GtkWidget *GSEAL (parent_menu_shell);
-
- guint GSEAL (button);
- guint32 GSEAL (activate_time);
-
- guint GSEAL (active) : 1;
- guint GSEAL (have_grab) : 1;
- guint GSEAL (have_xgrab) : 1;
- guint GSEAL (ignore_leave) : 1; /* unused */
- guint GSEAL (menu_flag) : 1; /* unused */
- guint GSEAL (ignore_enter) : 1;
- guint GSEAL (keyboard_mode) : 1;
+ /*< private >*/
+ GtkMenuShellPrivate *priv;
};
struct _GtkMenuShellClass
{
GtkContainerClass parent_class;
-
+
guint submenu_placement : 1;
-
- void (*deactivate) (GtkMenuShell *menu_shell);
- void (*selection_done) (GtkMenuShell *menu_shell);
-
- void (*move_current) (GtkMenuShell *menu_shell,
- GtkMenuDirectionType direction);
- void (*activate_current) (GtkMenuShell *menu_shell,
- gboolean force_hide);
- void (*cancel) (GtkMenuShell *menu_shell);
- void (*select_item) (GtkMenuShell *menu_shell,
- GtkWidget *menu_item);
- void (*insert) (GtkMenuShell *menu_shell,
- GtkWidget *child,
- gint position);
- gint (*get_popup_delay) (GtkMenuShell *menu_shell);
- gboolean (*move_selected) (GtkMenuShell *menu_shell,
- gint distance);
+
+ void (*deactivate) (GtkMenuShell *menu_shell);
+ void (*selection_done) (GtkMenuShell *menu_shell);
+
+ void (*move_current) (GtkMenuShell *menu_shell,
+ GtkMenuDirectionType direction);
+ void (*activate_current) (GtkMenuShell *menu_shell,
+ gboolean force_hide);
+ void (*cancel) (GtkMenuShell *menu_shell);
+ void (*select_item) (GtkMenuShell *menu_shell,
+ GtkWidget *menu_item);
+ void (*insert) (GtkMenuShell *menu_shell,
+ GtkWidget *child,
+ gint position);
+ gint (*get_popup_delay) (GtkMenuShell *menu_shell);
+ gboolean (*move_selected) (GtkMenuShell *menu_shell,
+ gint distance);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
@@ -99,50 +88,29 @@ struct _GtkMenuShellClass
};
-GType gtk_menu_shell_get_type (void) G_GNUC_CONST;
-void gtk_menu_shell_append (GtkMenuShell *menu_shell,
- GtkWidget *child);
-void gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
- GtkWidget *child);
-void gtk_menu_shell_insert (GtkMenuShell *menu_shell,
- GtkWidget *child,
- gint position);
-void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
-void gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
- GtkWidget *menu_item);
-void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
-void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
- GtkWidget *menu_item,
- gboolean force_deactivate);
-void gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
- gboolean search_sensitive);
-void _gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
- gboolean search_sensitive);
-void _gtk_menu_shell_activate (GtkMenuShell *menu_shell);
-gint _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell);
-
-void _gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
- GdkDevice *device);
-GdkDevice * _gtk_menu_shell_get_grab_device (GtkMenuShell *menu_shell);
-
-void gtk_menu_shell_cancel (GtkMenuShell *menu_shell);
-
-void _gtk_menu_shell_add_mnemonic (GtkMenuShell *menu_shell,
- guint keyval,
- GtkWidget *target);
-void _gtk_menu_shell_remove_mnemonic (GtkMenuShell *menu_shell,
- guint keyval,
- GtkWidget *target);
-
+GType gtk_menu_shell_get_type (void) G_GNUC_CONST;
+
+void gtk_menu_shell_append (GtkMenuShell *menu_shell,
+ GtkWidget *child);
+void gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
+ GtkWidget *child);
+void gtk_menu_shell_insert (GtkMenuShell *menu_shell,
+ GtkWidget *child,
+ gint position);
+void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
+void gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
+ GtkWidget *menu_item);
+void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
+void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
+ GtkWidget *menu_item,
+ gboolean force_deactivate);
+void gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
+ gboolean search_sensitive);
+void gtk_menu_shell_cancel (GtkMenuShell *menu_shell);
gboolean gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell);
void gtk_menu_shell_set_take_focus (GtkMenuShell *menu_shell,
gboolean take_focus);
-void _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell);
-void _gtk_menu_shell_set_keyboard_mode (GtkMenuShell *menu_shell,
- gboolean keyboard_mode);
-gboolean _gtk_menu_shell_get_keyboard_mode (GtkMenuShell *menu_shell);
-
G_END_DECLS
#endif /* __GTK_MENU_SHELL_H__ */
diff --git a/gtk/gtkmenushellprivate.h b/gtk/gtkmenushellprivate.h
new file mode 100644
index 0000000..6015f0c
--- /dev/null
+++ b/gtk/gtkmenushellprivate.h
@@ -0,0 +1,82 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_MENU_SHELL_PRIVATE_H__
+#define __GTK_MENU_SHELL_PRIVATE_H__
+
+
+#include <gtk/gtkmenushell.h>
+#include <gtk/gtkmnemonichash.h>
+#include <gtk/gtkkeyhash.h>
+
+
+G_BEGIN_DECLS
+
+struct _GtkMenuShellPrivate
+{
+ GList *children;
+ GtkWidget *active_menu_item;
+ GtkWidget *parent_menu_shell;
+
+ guint button;
+ guint32 activate_time;
+
+ guint active : 1;
+ guint have_grab : 1;
+ guint have_xgrab : 1;
+ guint ignore_enter : 1;
+ guint keyboard_mode : 1;
+
+ guint take_focus : 1;
+ guint activated_submenu : 1;
+ guint in_unselectable_item : 1; /* This flag is a crutch to keep
+ * mnemonics in the same menu if
+ * the user moves the mouse over
+ * an unselectable menuitem.
+ */
+ GtkMnemonicHash *mnemonic_hash;
+ GtkKeyHash *key_hash;
+
+ GdkDevice *grab_pointer;
+};
+
+void _gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
+ gboolean search_sensitive);
+void _gtk_menu_shell_activate (GtkMenuShell *menu_shell);
+gint _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell);
+void _gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
+ GdkDevice *device);
+GdkDevice *_gtk_menu_shell_get_grab_device (GtkMenuShell *menu_shell);
+
+void _gtk_menu_shell_add_mnemonic (GtkMenuShell *menu_shell,
+ guint keyval,
+ GtkWidget *target);
+void _gtk_menu_shell_remove_mnemonic (GtkMenuShell *menu_shell,
+ guint keyval,
+ GtkWidget *target);
+
+void _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell);
+void _gtk_menu_shell_set_keyboard_mode (GtkMenuShell *menu_shell,
+ gboolean keyboard_mode);
+gboolean _gtk_menu_shell_get_keyboard_mode (GtkMenuShell *menu_shell);
+
+
+G_END_DECLS
+
+#endif /* __GTK_MENU_SHELL_PRIVATE_H__ */
diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c
index 4b0b0db..7162f77 100644
--- a/gtk/gtkuimanager.c
+++ b/gtk/gtkuimanager.c
@@ -38,6 +38,7 @@
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkmenu.h"
+#include "gtkmenushellprivate.h"
#include "gtkmenubar.h"
#include "gtkmenutoolbutton.h"
#include "gtkseparatormenuitem.h"
@@ -1955,9 +1956,9 @@ get_action_by_name (GtkUIManager *merge,
}
static gboolean
-find_menu_position (GNode *node,
- GtkWidget **menushell_p,
- gint *pos_p)
+find_menu_position (GNode *node,
+ GtkWidget **menushell_p,
+ gint *pos_p)
{
GtkWidget *menushell;
gint pos = 0;
@@ -1998,7 +1999,7 @@ find_menu_position (GNode *node,
case NODE_TYPE_MENU_PLACEHOLDER:
menushell = gtk_widget_get_parent (NODE_INFO (parent)->proxy);
g_return_val_if_fail (GTK_IS_MENU_SHELL (menushell), FALSE);
- pos = g_list_index (GTK_MENU_SHELL (menushell)->children,
+ pos = g_list_index (GTK_MENU_SHELL (menushell)->priv->children,
NODE_INFO (parent)->proxy) + 1;
break;
default:
@@ -2025,7 +2026,7 @@ find_menu_position (GNode *node,
if (!GTK_IS_MENU_SHELL (menushell))
return FALSE;
- pos = g_list_index (GTK_MENU_SHELL (menushell)->children, prev_child) + 1;
+ pos = g_list_index (GTK_MENU_SHELL (menushell)->priv->children, prev_child) + 1;
}
if (menushell_p)
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index da8e0c7..0cfd5ba 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5173,7 +5173,6 @@ gtk_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkWindow *window = GTK_WINDOW (widget);
- GtkWindowPrivate *priv = window->priv;
GtkAllocation child_allocation;
GtkWidget *child;
guint border_width;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]