Non-exported _gtk_menu_select_first() function that selects the first item

Sat Feb  2 20:16:04 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkmenushell.c (_gtk_menu_shell_select_first):
        Non-exported _gtk_menu_select_first() function that
        selects the first item of the menu in a standard
        way. (Skipping tearoffs.)

        * gtk/gtkmenushell.c gtk/gtkentry.c gtk/gtktextview.c
        gtkmenuitem.c: Use _gtk_menu_shell_select_first().

        * gtk/gtkmenuitem.c (gtk_real_menu_item_select): Remember
        if we are starting the timeout from a keypress so
        we can set menushell->ignore_enter properly.

        * gtk/gtknotebook.c (focus_child_in): Return something
        meaningful if there are no children.

        * gtk/gtkmenu.c (gtk_menu_key_press): Fix precendence
        problem.
This commit is contained in:
Owen Taylor
2002-02-03 01:25:32 +00:00
committed by Owen Taylor
parent 0ed21b67d9
commit ae7521bd9d
15 changed files with 203 additions and 68 deletions

View File

@ -6273,28 +6273,6 @@ unichar_chosen_func (const char *text,
gtk_text_view_commit_text (text_view, text);
}
static void
menu_select_first_child (GtkMenu *menu)
{
GList *children = gtk_container_get_children (GTK_CONTAINER (menu));
GList *tmp_list = children;
while (tmp_list)
{
GtkWidget *child = tmp_list->data;
if (GTK_WIDGET_VISIBLE (child))
{
gtk_menu_shell_select_item (GTK_MENU_SHELL (menu), child);
break;
}
tmp_list = tmp_list->next;
}
g_list_free (children);
}
static void
popup_targets_received (GtkClipboard *clipboard,
GtkSelectionData *data,
@ -6381,7 +6359,7 @@ popup_targets_received (GtkClipboard *clipboard,
gtk_menu_popup (GTK_MENU (text_view->popup_menu), NULL, NULL,
popup_position_func, text_view,
0, gtk_get_current_event_time ());
menu_select_first_child (GTK_MENU (text_view->popup_menu));
_gtk_menu_shell_select_first (GTK_MENU_SHELL (text_view->popup_menu));
}
}