# HG changeset patch
# Node ID e6ab004f53b7
# Parent  e5fb73cc6322
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -174,7 +174,9 @@ set_dialog_icon(AccountPrefsDialog *dial
 	{
 		/* Show a placeholder icon */
 		gtk_image_set_from_icon_name(GTK_IMAGE(dialog->icon_entry),
-				"select-avatar", GTK_ICON_SIZE_LARGE_TOOLBAR);
+		                             "select-avatar");
+		gtk_image_set_icon_size(GTK_IMAGE(dialog->icon_entry),
+		                        GTK_ICON_SIZE_LARGE);
 	} else {
 		gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_entry), pixbuf);
 		g_object_unref(G_OBJECT(pixbuf));
@@ -279,13 +281,19 @@ icon_filesel_choose_cb(GtkWidget *widget
 	AccountPrefsDialog *dialog = data;
 
 	if (response == GTK_RESPONSE_ACCEPT) {
+		GFile *file = NULL;
 		gchar *filename = NULL;
 		gpointer data = NULL;
 		size_t len = 0;
 
-		filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
+		file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(widget));
+		filename = g_file_get_path(file);
+
 		data = pidgin_convert_buddy_icon(dialog->protocol, filename, &len);
 		set_dialog_icon(dialog, data, len, filename);
+
+		g_free(filename);
+		g_object_unref(file);
 	}
 
 	g_clear_object(&dialog->icon_filesel);
@@ -375,11 +383,12 @@ add_login_options(AccountPrefsDialog *di
 	{
 		g_object_ref(G_OBJECT(dialog->protocol_menu));
 		hbox = g_object_get_data(G_OBJECT(dialog->protocol_menu), "container");
-		gtk_container_remove(GTK_CONTAINER(hbox), dialog->protocol_menu);
+		gtk_box_remove(GTK_BOX(hbox), dialog->protocol_menu);
 	}
 
-	if (dialog->login_frame != NULL)
-		gtk_widget_destroy(dialog->login_frame);
+	if (dialog->login_frame != NULL) {
+		gtk_widget_unparent(dialog->login_frame);
+	}
 
 	/* Build the login options frame. */
 	frame = pidgin_make_frame(parent, _("Login Options"));
@@ -387,13 +396,11 @@ add_login_options(AccountPrefsDialog *di
 	/* cringe */
 	dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
 
-	gtk_box_reorder_child(GTK_BOX(parent), dialog->login_frame, 0);
-	gtk_widget_show(dialog->login_frame);
+	gtk_box_reorder_child_after(GTK_BOX(parent), dialog->login_frame, NULL);
 
 	/* Main vbox */
 	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
-	gtk_widget_show(vbox);
+	gtk_box_append(GTK_BOX(frame), vbox);
 
 	/* Protocol */
 	if(dialog->protocol_menu == NULL) {
@@ -402,7 +409,6 @@ add_login_options(AccountPrefsDialog *di
 		                                        dialog->protocol_id);
 		g_signal_connect(G_OBJECT(dialog->protocol_menu), "changed",
 		                 G_CALLBACK(set_account_protocol_cb), dialog);
-		gtk_widget_show(dialog->protocol_menu);
 		g_object_ref(G_OBJECT(dialog->protocol_menu));
 	}
 
@@ -540,20 +546,20 @@ add_user_options(AccountPrefsDialog *dia
 	GtkWidget *button;
 	GtkWidget *label;
 
-	if (dialog->user_frame != NULL)
-		gtk_widget_destroy(dialog->user_frame);
+	if (dialog->user_frame != NULL) {
+		gtk_widget_unparent(dialog->user_frame);
+	}
 
 	/* Build the user options frame. */
 	frame = pidgin_make_frame(parent, _("User Options"));
 	dialog->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
 
-	gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1);
-	gtk_widget_show(dialog->user_frame);
+	gtk_box_reorder_child_after(GTK_BOX(parent), dialog->user_frame,
+	                            gtk_widget_get_first_child(parent));
 
 	/* Main vbox */
 	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
-	gtk_widget_show(vbox);
+	gtk_box_append(GTK_BOX(frame), vbox);
 
 	/* Alias */
 	dialog->alias_entry = gtk_entry_new();
@@ -562,27 +568,22 @@ add_user_options(AccountPrefsDialog *dia
 	/* Buddy icon */
 	dialog->icon_check = gtk_check_button_new_with_mnemonic(_("Use this buddy _icon for this account:"));
 	g_signal_connect(G_OBJECT(dialog->icon_check), "toggled", G_CALLBACK(icon_check_cb), dialog);
-	gtk_widget_show(dialog->icon_check);
-	gtk_box_pack_start(GTK_BOX(vbox), dialog->icon_check, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(vbox), dialog->icon_check);
 
 	dialog->icon_hbox = hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
 	gtk_widget_set_sensitive(hbox, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)));
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
+	gtk_box_append(GTK_BOX(vbox), hbox);
 
 	label = gtk_label_new("    ");
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	gtk_widget_show(label);
+	gtk_box_append(GTK_BOX(hbox), label);
 
 	button = gtk_button_new();
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_widget_show(button);
+	gtk_box_append(GTK_BOX(hbox), button);
 	g_signal_connect(G_OBJECT(button), "clicked",
 	                 G_CALLBACK(icon_select_cb), dialog);
 
 	dialog->icon_entry = gtk_image_new();
-	gtk_container_add(GTK_CONTAINER(button), dialog->icon_entry);
-	gtk_widget_show(dialog->icon_entry);
+	gtk_button_set_child(GTK_BUTTON(button), dialog->icon_entry);
 	/* TODO: Uh, isn't this next line pretty useless? */
 	pidgin_set_accessible_label(dialog->icon_entry, GTK_LABEL(label));
 	if (dialog->icon_img) {
@@ -591,18 +592,19 @@ add_user_options(AccountPrefsDialog *dia
 	}
 
 	vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0);
-	gtk_widget_show(vbox2);
+	gtk_widget_set_hexpand(vbox2, TRUE);
+	gtk_widget_set_halign(vbox2, GTK_ALIGN_FILL);
+	gtk_box_append(GTK_BOX(hbox), vbox2);
 
 	hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-	gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, FALSE, 12);
-	gtk_widget_show(hbox2);
+	gtk_widget_set_margin_top(hbox2, 12);
+	gtk_widget_set_margin_bottom(hbox2, 12);
+	gtk_box_append(GTK_BOX(vbox2), hbox2);
 
 	button = gtk_button_new_with_mnemonic(_("_Remove"));
 	g_signal_connect(G_OBJECT(button), "clicked",
 			 G_CALLBACK(icon_reset_cb), dialog);
-	gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 0);
-	gtk_widget_show(button);
+	gtk_box_append(GTK_BOX(hbox2), button);
 
 	if (dialog->protocol != NULL) {
 		PurpleBuddyIconSpec *icon_spec = purple_protocol_get_icon_spec(dialog->protocol);
@@ -702,10 +704,8 @@ add_account_options(AccountPrefsDialog *
 
 	/* Main vbox */
 	dialog->protocol_frame = vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
 	gtk_notebook_insert_page(GTK_NOTEBOOK(dialog->notebook), vbox,
 			gtk_label_new_with_mnemonic(_("Ad_vanced")), 1);
-	gtk_widget_show(vbox);
 
 	for (l = opts; l != NULL; l = l->next)
 	{
@@ -738,8 +738,7 @@ add_account_options(AccountPrefsDialog *
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 											 bool_value);
 
-				gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
-				gtk_widget_show(check);
+				gtk_box_append(GTK_BOX(vbox), check);
 				break;
 
 			case PURPLE_PREF_INT:
@@ -793,10 +792,18 @@ add_account_options(AccountPrefsDialog *
 						gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(entry),
 						                               hint);
 					}
+					if (str_value != NULL) {
+						GtkWidget *real_entry = NULL;
+						real_entry = gtk_combo_box_get_child(GTK_COMBO_BOX(entry));
+						gtk_editable_set_text(GTK_EDITABLE(real_entry),
+						                      str_value);
+					}
+				} else {
+					entry = gtk_entry_new();
+					gtk_editable_set_text(GTK_EDITABLE(entry),
+					                      str_value ? str_value : "");
 				}
-				else
-					entry = gtk_entry_new();
-				
+
 				opt_entry->widget = entry;
 				if (purple_account_option_string_get_masked(option) && str_hints)
 					g_warn_if_reached();
@@ -805,13 +812,6 @@ add_account_options(AccountPrefsDialog *
 					gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
 				}
 
-				if (str_value != NULL && str_hints) {
-					gtk_editable_set_text(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(entry))),
-					                      str_value);
-				} else {
-					gtk_editable_set_text(GTK_EDITABLE(entry), str_value ? str_value : "");
-				}
-
 				title = g_strdup_printf("_%s:",
 						purple_account_option_get_text(option));
 				add_pref_box(dialog, vbox, title, entry);
@@ -893,7 +893,7 @@ add_voice_options(AccountPrefsDialog *di
 {
 	if (!dialog->protocol || !PURPLE_PROTOCOL_IMPLEMENTS(dialog->protocol, MEDIA, initiate_session)) {
 		if (dialog->voice_frame) {
-			gtk_widget_destroy(dialog->voice_frame);
+			gtk_widget_unparent(dialog->voice_frame);
 			dialog->voice_frame = NULL;
 			dialog->suppression_check = NULL;
 		}
@@ -902,16 +902,13 @@ add_voice_options(AccountPrefsDialog *di
 
 	if (!dialog->voice_frame) {
 		dialog->voice_frame = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-		gtk_container_set_border_width(GTK_CONTAINER(dialog->voice_frame), 12);
 
 		dialog->suppression_check =
 				gtk_check_button_new_with_mnemonic(_("Use _silence suppression"));
-		gtk_box_pack_start(GTK_BOX(dialog->voice_frame), dialog->suppression_check,
-				FALSE, FALSE, 0);
+		gtk_box_append(GTK_BOX(dialog->voice_frame), dialog->suppression_check);
 
 		gtk_notebook_append_page(GTK_NOTEBOOK(dialog->notebook),
 				dialog->voice_frame, gtk_label_new_with_mnemonic(_("_Voice and Video")));
-		gtk_widget_show_all(dialog->voice_frame);
 	}
 
 	if (dialog->account) {
@@ -926,7 +923,7 @@ static gboolean
 account_win_destroy_cb(GtkWidget *w, GdkEvent *event,
 					   AccountPrefsDialog *dialog)
 {
-	gtk_widget_destroy(dialog->window);
+	gtk_window_destroy(GTK_WINDOW(dialog->window));
 
 	g_list_free(dialog->user_split_entries);
 	g_list_free_full(dialog->protocol_opt_entries, (GDestroyNotify)protocol_opt_entry_free);
@@ -1224,15 +1221,12 @@ pidgin_account_dialog_show(PidginAccount
 	gtk_box_set_spacing(GTK_BOX(main_vbox), 6);
 
 	dialog->notebook = notebook = gtk_notebook_new();
-	gtk_box_pack_start(GTK_BOX(main_vbox), notebook, FALSE, FALSE, 0);
-	gtk_widget_show(GTK_WIDGET(notebook));
+	gtk_box_append(GTK_BOX(main_vbox), notebook);
 
 	/* Setup the inner vbox */
 	dialog->top_vbox = vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
 	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
 			gtk_label_new_with_mnemonic(_("_Basic")));
-	gtk_widget_show(vbox);
 
 	/* Setup the top frames. */
 	add_login_options(dialog, vbox);
@@ -1240,8 +1234,7 @@ pidgin_account_dialog_show(PidginAccount
 
 	button = gtk_check_button_new_with_mnemonic(
 		_("Create _this new account on the server"));
-	gtk_box_pack_start(GTK_BOX(main_vbox), button, FALSE, FALSE, 0);
-	gtk_widget_show(button);
+	gtk_box_append(GTK_BOX(main_vbox), button);
 	dialog->register_button = button;
 	g_signal_connect(G_OBJECT(dialog->register_button), "toggled", G_CALLBACK(register_button_cb), dialog);
 	if (dialog->account == NULL)
@@ -1261,7 +1254,6 @@ pidgin_account_dialog_show(PidginAccount
 	}
 	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dialog->proxy_options,
 	                         gtk_label_new_with_mnemonic(_("Proxy")));
-	gtk_widget_show(dialog->proxy_options);
 
 	add_voice_options(dialog);
 
@@ -1573,7 +1565,7 @@ pidgin_accounts_request_authorization(Pu
 static void
 pidgin_accounts_request_close(void *ui_handle)
 {
-	gtk_widget_destroy(GTK_WIDGET(ui_handle));
+	gtk_widget_unparent(GTK_WIDGET(ui_handle));
 }
 
 static PurpleAccountUiOps ui_ops =
