Focus Save button

This commit is contained in:
Yevgen Muntyan 2010-07-13 04:51:34 -07:00
parent 91faf6a108
commit fcfe1cf30e

View File

@ -320,6 +320,27 @@ files_treeview_get_to_save (GtkTreeView *treeview)
}
static GtkWidget *
find_widget_for_response (GtkDialog *dialog,
int response)
{
GList *l, *children;
GtkWidget *ret = NULL;
children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
for (l = children; ret == NULL && l != NULL; l = l->next)
{
GtkWidget *widget = l->data;
int response_here = gtk_dialog_get_response_for_widget (dialog, widget);
if (response_here == response)
ret = widget;
}
g_list_free (children);
return ret;
}
MooSaveChangesDialogResponse
_moo_edit_save_multiple_changes_dialog (GSList *docs,
GSList **to_save)
@ -371,6 +392,12 @@ _moo_edit_save_multiple_changes_dialog (GSList *docs,
files_treeview_init (xml->treeview, dialog, docs);
{
GtkWidget *button;
button = find_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
gtk_widget_grab_focus (button);
}
response = gtk_dialog_run (GTK_DIALOG (dialog));
switch (response)