Make the initial focus in dialogs work as intended

We had code that tried to prevent selecting the text in the label
if we end up focusing a label, but it didn't take effect, because
we were moving the focus into the label again afterwards.
This commit is contained in:
Matthias Clasen 2010-08-25 00:43:16 -04:00
parent e1143c2d45
commit 586bbc9b13

View File

@ -419,25 +419,28 @@ gtk_dialog_map (GtkWidget *widget)
{
GList *children, *tmp_list;
GtkWidget *first_focus = NULL;
do
{
g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD);
do
{
g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD);
focus = gtk_window_get_focus (window);
if (first_focus == NULL)
if (first_focus == NULL)
first_focus = focus;
else if (first_focus == focus)
else if (first_focus == focus)
{
if (GTK_IS_LABEL (focus) &&
!gtk_label_get_current_uri (GTK_LABEL (focus)))
gtk_label_select_region (GTK_LABEL (focus), 0, 0);
break;
}
if (!GTK_IS_LABEL (focus))
break;
if (!GTK_IS_LABEL (focus))
break;
if (!gtk_label_get_current_uri (GTK_LABEL (focus)))
gtk_label_select_region (GTK_LABEL (focus), 0, 0);
}
}
while (TRUE);
tmp_list = children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
while (tmp_list)
{
GtkWidget *child = tmp_list->data;