Use _gtk_menu_item_popup_submenu() to make keynav into submenus work

2004-12-15  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkmenushell.c (gtk_menu_shell_select_submenu_first)
	(gtk_real_menu_shell_activate_current): Use
	_gtk_menu_item_popup_submenu() to make keynav into submenus work
	instantaneously, independent of the popup delay.  (#161140)

	* gtk/gtkmenuitem.[hc]: _-prefix gtk_menu_item_popup_submenu() and
	make it non-static.

	* gtk/gtkmenuitem.c (gtk_menu_item_paint): Remove unused variables.
This commit is contained in:
Matthias Clasen 2004-12-15 16:27:30 +00:00 committed by Matthias Clasen
parent b418bf3aa4
commit 8b927c6f58
10 changed files with 74 additions and 80 deletions

View File

@ -1,3 +1,15 @@
2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkmenushell.c (gtk_menu_shell_select_submenu_first)
(gtk_real_menu_shell_activate_current): Use
_gtk_menu_item_popup_submenu() to make keynav into submenus work
instantaneously, independent of the popup delay. (#161140)
* gtk/gtkmenuitem.[hc]: _-prefix gtk_menu_item_popup_submenu() and
make it non-static.
* gtk/gtkmenuitem.c (gtk_menu_item_paint): Remove unused variables.
2004-12-15 James M. Cape <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate)

View File

@ -1,3 +1,15 @@
2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkmenushell.c (gtk_menu_shell_select_submenu_first)
(gtk_real_menu_shell_activate_current): Use
_gtk_menu_item_popup_submenu() to make keynav into submenus work
instantaneously, independent of the popup delay. (#161140)
* gtk/gtkmenuitem.[hc]: _-prefix gtk_menu_item_popup_submenu() and
make it non-static.
* gtk/gtkmenuitem.c (gtk_menu_item_paint): Remove unused variables.
2004-12-15 James M. Cape <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate)

View File

@ -1,3 +1,15 @@
2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkmenushell.c (gtk_menu_shell_select_submenu_first)
(gtk_real_menu_shell_activate_current): Use
_gtk_menu_item_popup_submenu() to make keynav into submenus work
instantaneously, independent of the popup delay. (#161140)
* gtk/gtkmenuitem.[hc]: _-prefix gtk_menu_item_popup_submenu() and
make it non-static.
* gtk/gtkmenuitem.c (gtk_menu_item_paint): Remove unused variables.
2004-12-15 James M. Cape <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate)

View File

@ -1,3 +1,15 @@
2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkmenushell.c (gtk_menu_shell_select_submenu_first)
(gtk_real_menu_shell_activate_current): Use
_gtk_menu_item_popup_submenu() to make keynav into submenus work
instantaneously, independent of the popup delay. (#161140)
* gtk/gtkmenuitem.[hc]: _-prefix gtk_menu_item_popup_submenu() and
make it non-static.
* gtk/gtkmenuitem.c (gtk_menu_item_paint): Remove unused variables.
2004-12-15 James M. Cape <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate)

View File

@ -288,8 +288,6 @@ gtk_cell_view_new_with_text
gtk_cell_view_set_background_color
gtk_cell_view_set_displayed_row
gtk_cell_view_set_model
gtk_cell_view_set_value
gtk_cell_view_set_values
gtk_check_button_get_type G_GNUC_CONST
gtk_check_button_new
gtk_check_button_new_with_label

View File

@ -76,9 +76,10 @@ static void gtk_cell_view_size_allocate (GtkWidget *wid
GtkAllocation *allocation);
static gboolean gtk_cell_view_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_cell_view_set_valuesv (GtkCellView *cellview,
GtkCellRenderer *renderer,
va_list args);
static void gtk_cell_view_set_value (GtkCellView *cell_view,
GtkCellRenderer *renderer,
gchar *property,
GValue *value);
static GtkCellViewCellInfo *gtk_cell_view_get_cell_info (GtkCellView *cellview,
GtkCellRenderer *renderer);
static void gtk_cell_view_set_cell_data (GtkCellView *cell_view);
@ -795,7 +796,7 @@ gtk_cell_view_new_with_text (const gchar *text)
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, text);
gtk_cell_view_set_values (cellview, renderer, "text", &value, NULL);
gtk_cell_view_set_value (cellview, renderer, "text", &value);
g_value_unset (&value);
return GTK_WIDGET (cellview);
@ -829,7 +830,7 @@ gtk_cell_view_new_with_markup (const gchar *markup)
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, markup);
gtk_cell_view_set_values (cellview, renderer, "markup", &value, NULL);
gtk_cell_view_set_value (cellview, renderer, "markup", &value);
g_value_unset (&value);
return GTK_WIDGET (cellview);
@ -861,7 +862,7 @@ gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
g_value_init (&value, GDK_TYPE_PIXBUF);
g_value_set_object (&value, pixbuf);
gtk_cell_view_set_values (cellview, renderer, "pixbuf", &value, NULL);
gtk_cell_view_set_value (cellview, renderer, "pixbuf", &value);
g_value_unset (&value);
return GTK_WIDGET (cellview);
@ -879,7 +880,7 @@ gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
*
* Since: 2.6
*/
void
static void
gtk_cell_view_set_value (GtkCellView *cell_view,
GtkCellRenderer *renderer,
gchar *property,
@ -895,52 +896,6 @@ gtk_cell_view_set_value (GtkCellView *cell_view,
gtk_widget_queue_draw (GTK_WIDGET (cell_view));
}
static void
gtk_cell_view_set_valuesv (GtkCellView *cell_view,
GtkCellRenderer *renderer,
va_list args)
{
gchar *attribute;
GValue *value;
attribute = va_arg (args, gchar *);
while (attribute)
{
value = va_arg (args, GValue *);
gtk_cell_view_set_value (cell_view, renderer, attribute, value);
attribute = va_arg (args, gchar *);
}
}
/**
* gtk_cell_view_set_values:
* @cell_view: a #GtkCellView widget
* @renderer: one of the renderers of @cell_view
* @Varargs: a list of pairs of property names and #GValue<!-- -->s,
* finished by %NULL
*
* Sets multiple properties of a cell renderer of @cell_view, and
* makes sure the display of @cell_view is updated.
*
* Since: 2.6
*/
void
gtk_cell_view_set_values (GtkCellView *cell_view,
GtkCellRenderer *renderer,
...)
{
va_list args;
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
g_return_if_fail (gtk_cell_view_get_cell_info (cell_view, renderer));
va_start (args, renderer);
gtk_cell_view_set_valuesv (cell_view, renderer, args);
va_end (args);
}
/**
* gtk_cell_view_set_model:
* @cell_view: a #GtkCellView

View File

@ -56,15 +56,6 @@ GtkWidget *gtk_cell_view_new_with_text (const gchar *text);
GtkWidget *gtk_cell_view_new_with_markup (const gchar *markup);
GtkWidget *gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf);
void gtk_cell_view_set_value (GtkCellView *cell_view,
GtkCellRenderer *renderer,
gchar *property,
GValue *value);
void gtk_cell_view_set_values (GtkCellView *cell_view,
GtkCellRenderer *renderer,
...);
void gtk_cell_view_set_model (GtkCellView *cell_view,
GtkTreeModel *model);
void gtk_cell_view_set_displayed_row (GtkCellView *cell_view,

View File

@ -80,7 +80,6 @@ static gboolean gtk_menu_item_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
static gint gtk_menu_item_select_timeout (gpointer data);
static void gtk_menu_item_popup_submenu (gpointer data);
static void gtk_menu_item_position_menu (GtkMenu *menu,
gint *x,
gint *y,
@ -199,7 +198,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
g_signal_new ("toggle_size_allocate",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkMenuItemClass, toggle_size_allocate),
G_STRUCT_OFFSET (GtkMenuItemClass, toggle_size_allocate),
NULL, NULL,
_gtk_marshal_NONE__INT,
G_TYPE_NONE, 1,
@ -718,7 +717,6 @@ gtk_menu_item_paint (GtkWidget *widget,
if (menu_item->submenu && menu_item->show_submenu_indicator)
{
GtkRequisition child_requisition;
gint arrow_x, arrow_y;
gint arrow_size;
gint arrow_extent;
@ -728,7 +726,6 @@ gtk_menu_item_paint (GtkWidget *widget,
PangoContext *context;
PangoFontMetrics *metrics;
gint ascent, descent;
PangoLayout *layout;
direction = gtk_widget_get_direction (widget);
@ -871,7 +868,7 @@ gtk_real_menu_item_select (GtkItem *item)
gdk_event_free (event);
}
else
gtk_menu_item_popup_submenu (menu_item);
_gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item));
}
gtk_widget_set_state (GTK_WIDGET (menu_item), GTK_STATE_PRELIGHT);
@ -944,7 +941,7 @@ gtk_real_menu_item_activate_item (GtkMenuItem *menu_item)
_gtk_menu_shell_activate (menu_shell);
gtk_menu_shell_select_item (GTK_MENU_SHELL (widget->parent), widget);
gtk_menu_item_popup_submenu (widget);
_gtk_menu_item_popup_submenu (widget);
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu_item->submenu), TRUE);
submenu = GTK_MENU_SHELL (menu_item->submenu);
@ -984,7 +981,7 @@ gtk_menu_item_select_timeout (gpointer data)
if ((GTK_IS_MENU_SHELL (parent) && GTK_MENU_SHELL (parent)->active) ||
(GTK_IS_MENU (parent) && GTK_MENU (parent)->torn_off))
{
gtk_menu_item_popup_submenu (data);
_gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item));
if (menu_item->timer_from_keypress && menu_item->submenu)
GTK_MENU_SHELL (menu_item->submenu)->ignore_enter = TRUE;
}
@ -994,13 +991,11 @@ gtk_menu_item_select_timeout (gpointer data)
return FALSE;
}
static void
gtk_menu_item_popup_submenu (gpointer data)
void
_gtk_menu_item_popup_submenu (GtkWidget *widget)
{
GtkWidget *widget;
GtkMenuItem *menu_item;
widget = GTK_WIDGET (data);
menu_item = GTK_MENU_ITEM (widget);
if (menu_item->timer)

View File

@ -121,6 +121,7 @@ void _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
GtkAccelGroup *accel_group,
gboolean group_changed);
gboolean _gtk_menu_item_is_selectable (GtkWidget *menu_item);
void _gtk_menu_item_popup_submenu (GtkWidget *menu_item);
#ifndef GTK_DISABLE_DEPRECATED
#define gtk_menu_item_right_justify(menu_item) gtk_menu_item_set_right_justified ((menu_item), TRUE)

View File

@ -1070,7 +1070,10 @@ gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell)
menu_item = GTK_MENU_ITEM (menu_shell->active_menu_item);
if (menu_item->submenu)
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu_item->submenu), TRUE);
{
_gtk_menu_item_popup_submenu (menu_item);
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu_item->submenu), TRUE);
}
}
static void
@ -1190,13 +1193,16 @@ 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) &&
GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL)
{
_gtk_menu_item_is_selectable (menu_shell->active_menu_item))
{
if (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL)
gtk_menu_shell_activate_item (menu_shell,
menu_shell->active_menu_item,
force_hide);
}
else
_gtk_menu_item_popup_submenu (menu_shell->active_menu_item);
}
}
static void