gtk/gtkdialog.c: Use accessor functions to access GtkWindow

This commit is contained in:
Javier Jardón 2010-08-17 15:08:04 +02:00
parent 595b27e22d
commit 014fc1f73a

View File

@ -407,13 +407,15 @@ gtk_dialog_delete_event_handler (GtkWidget *widget,
static void static void
gtk_dialog_map (GtkWidget *widget) gtk_dialog_map (GtkWidget *widget)
{ {
GtkWidget *default_widget, *focus;
GtkWindow *window = GTK_WINDOW (widget); GtkWindow *window = GTK_WINDOW (widget);
GtkDialog *dialog = GTK_DIALOG (widget); GtkDialog *dialog = GTK_DIALOG (widget);
GtkDialogPriv *priv = dialog->priv; GtkDialogPriv *priv = dialog->priv;
GTK_WIDGET_CLASS (gtk_dialog_parent_class)->map (widget); GTK_WIDGET_CLASS (gtk_dialog_parent_class)->map (widget);
if (!window->focus_widget) focus = gtk_window_get_focus (window);
if (!focus)
{ {
GList *children, *tmp_list; GList *children, *tmp_list;
GtkWidget *first_focus = NULL; GtkWidget *first_focus = NULL;
@ -422,14 +424,15 @@ gtk_dialog_map (GtkWidget *widget)
{ {
g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD); 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 = window->focus_widget; first_focus = focus;
else if (first_focus == window->focus_widget) else if (first_focus == focus)
break; break;
if (!GTK_IS_LABEL (window->focus_widget)) if (!GTK_IS_LABEL (focus))
break; break;
if (!gtk_label_get_current_uri (GTK_LABEL (window->focus_widget))) if (!gtk_label_get_current_uri (GTK_LABEL (focus)))
gtk_label_select_region (GTK_LABEL (window->focus_widget), 0, 0); gtk_label_select_region (GTK_LABEL (focus), 0, 0);
} }
while (TRUE); while (TRUE);
@ -438,13 +441,13 @@ gtk_dialog_map (GtkWidget *widget)
while (tmp_list) while (tmp_list)
{ {
GtkWidget *child = tmp_list->data; GtkWidget *child = tmp_list->data;
if ((window->focus_widget == NULL || default_widget = gtk_window_get_default_widget (window);
child == window->focus_widget) && if ((focus == NULL || child == focus) &&
child != window->default_widget && child != default_widget &&
window->default_widget) default_widget)
{ {
gtk_widget_grab_focus (window->default_widget); gtk_widget_grab_focus (default_widget);
break; break;
} }
@ -1073,7 +1076,7 @@ gtk_dialog_run (GtkDialog *dialog)
g_object_ref (dialog); g_object_ref (dialog);
was_modal = GTK_WINDOW (dialog)->modal; was_modal = gtk_window_get_modal (GTK_WINDOW (dialog));
if (!was_modal) if (!was_modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);