diff -r 225d5c9642d1 -r f85e2e6fb6ed pidgin/gtkrequest.c --- a/pidgin/gtkrequest.c Thu Sep 12 17:29:03 2013 +0200 +++ b/pidgin/gtkrequest.c Fri Sep 13 11:11:29 2013 +0200 @@ -1061,9 +1061,10 @@ GList *l; gpointer *values = g_new(gpointer, num_labels); gpointer default_value; + gboolean default_found = FALSE; int i; - default_value = purple_request_field_choice_get_default_value(field); + default_value = purple_request_field_choice_get_value(field); if (num_labels > 5 || purple_request_cpar_is_compact(cpar)) { int default_index = 0; @@ -1082,8 +1083,10 @@ l = g_list_next(l); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), text); - if (value == default_value) + if (value == default_value) { default_index = i; + default_found = TRUE; + } values[i++] = value; } @@ -1128,8 +1131,10 @@ if (first_radio == NULL) first_radio = radio; - if (value == default_value) + if (value == default_value) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE); + default_found = TRUE; + } values[i++] = value; gtk_box_pack_start(GTK_BOX(box), radio, TRUE, TRUE, 0); @@ -1140,6 +1145,9 @@ } } + if (!default_found && i > 0) + purple_request_field_choice_set_value(field, values[0]); + g_object_set_data_full(G_OBJECT(widget), "values", values, g_free); return widget; @@ -1890,26 +1898,34 @@ return (void *)data; } -#ifdef _WIN32 - -/* Not needed (yet) for non-win32, but should work everywhere. */ +/* if request callback issues another request, it should be attached to the + * primary request parent */ static void -pidgin_window_detach_children(GtkWindow* parent) +pidgin_window_detach_children(GtkWindow* win) { GList *it; + GtkWindow *par; - g_return_if_fail(parent != NULL); + g_return_if_fail(win != NULL); + par = gtk_window_get_transient_for(win); it = gtk_window_list_toplevels(); for (it = g_list_first(it); it != NULL; it = g_list_next(it)) { - GtkWindow *win = GTK_WINDOW(it->data); - if (gtk_window_get_transient_for(win) == parent) - gtk_window_set_transient_for(win, NULL); + GtkWindow *child = GTK_WINDOW(it->data); + if (gtk_window_get_transient_for(child) != win) + continue; + if (gtk_window_get_destroy_with_parent(child)) { +#ifdef _WIN32 + /* XXX test/verify it: Win32 gtk ignores + * gtk_window_set_destroy_with_parent(..., FALSE). */ + gtk_window_set_transient_for(child, NULL); +#endif + continue; + } + gtk_window_set_transient_for(child, par); } } -#endif - static void pidgin_close_request(PurpleRequestType type, void *ui_handle) { @@ -1917,10 +1933,7 @@ g_free(data->cbs); -#ifdef _WIN32 - /* Win32 gtk ignores gtk_window_set_destroy_with_parent(..., FALSE). */ pidgin_window_detach_children(GTK_WINDOW(data->dialog)); -#endif gtk_widget_destroy(data->dialog);