# HG changeset patch
# Node ID cf99ec025fab
# Parent  25c83614d93e
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -109,9 +109,8 @@
 	if (GTK_IS_BOX(cont)) {
 		gtk_widget_set_halign(image, GTK_ALIGN_START);
 		gtk_widget_set_valign(image, GTK_ALIGN_START);
-		gtk_box_pack_end(GTK_BOX(cont), image, FALSE, TRUE, 0);
+		gtk_box_append(GTK_BOX(cont), image);
 	}
-	gtk_widget_show(image);
 }
 
 static void
@@ -181,6 +180,8 @@
 static void
 choice_response_cb(GtkDialog *dialog, gint id, PidginRequestData *data)
 {
+#warning please rewrite me
+#if 0
 	GtkWidget *radio = g_object_get_data(G_OBJECT(dialog), "radio");
 	GSList *group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));
 
@@ -195,12 +196,14 @@
 			group = group->next;
 		}
 	purple_request_close(PURPLE_REQUEST_INPUT, data);
+#endif
 }
 
 static gboolean
-field_string_focus_out_cb(GtkWidget *entry, GdkEventFocus *event,
-						  PurpleRequestField *field)
+field_string_focus_out_cb(GtkEventControllerFocus *controller,
+                          PurpleRequestField *field)
 {
+	GtkWidget *entry = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(controller));
 	const char *value;
 
 	if (purple_request_field_string_is_multiline(field))
@@ -244,8 +247,10 @@
 }
 
 static void
-field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field)
+field_choice_option_cb(GtkCheckButton *button, PurpleRequestField *field)
 {
+#warning please rewrite me
+#if 0
 	int active;
 	gpointer *values = g_object_get_data(G_OBJECT(g_object_get_data(
 		G_OBJECT(button), "box")), "values");
@@ -260,6 +265,7 @@
 	g_return_if_fail(active >= 0);
 
 	purple_request_field_choice_set_value(field, values[active]);
+#endif
 }
 
 static void
@@ -432,13 +438,17 @@
 		}
 	}
 
-	img = gtk_image_new_from_icon_name(icon_name, GTK_ICON_SIZE_DIALOG);
-
-	if (img || icon_type == PURPLE_REQUEST_ICON_REQUEST)
+	if(icon_name != NULL) {
+		img = gtk_image_new_from_icon_name(icon_name);
+		gtk_image_set_icon_size(GTK_IMAGE(img), GTK_ICON_SIZE_LARGE);
+
 		return img;
-
-	return gtk_image_new_from_icon_name("dialog-question",
-			GTK_ICON_SIZE_DIALOG);
+	}
+
+	img = gtk_image_new_from_icon_name("dialog-question");
+	gtk_image_set_icon_size(GTK_IMAGE(img), GTK_ICON_SIZE_LARGE);
+
+	return img;
 }
 
 static void
@@ -489,6 +499,7 @@
 	GtkWidget *hbox;
 	GtkLabel *label;
 	GtkWidget *img;
+	GtkWidget *content;
 	char *label_text;
 	char *primary_esc, *secondary_esc;
 
@@ -514,9 +525,17 @@
 					 G_CALLBACK(input_response_cb), data);
 
 	/* Setup the dialog */
-	gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
-	gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                               6);
+	gtk_widget_set_margin_top(dialog, 6);
+	gtk_widget_set_margin_bottom(dialog, 6);
+	gtk_widget_set_margin_start(dialog, 6);
+	gtk_widget_set_margin_end(dialog, 6);
+
+	content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+	gtk_widget_set_margin_top(content, 6);
+	gtk_widget_set_margin_bottom(content, 6);
+	gtk_widget_set_margin_start(content, 6);
+	gtk_widget_set_margin_end(content, 6);
+
 	if (!multiline)
 		gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
 	gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0);
@@ -525,21 +544,21 @@
 
 	/* Setup the main horizontal box */
 	hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                  hbox);
+	gtk_box_append(GTK_BOX(content), hbox);
 
 	/* Dialog icon. */
 	img = pidgin_request_dialog_icon(PURPLE_REQUEST_INPUT, cpar);
 	gtk_widget_set_halign(img, GTK_ALIGN_START);
 	gtk_widget_set_valign(img, GTK_ALIGN_START);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(hbox), img);
 
 	pidgin_request_add_help(GTK_DIALOG(dialog), cpar);
 
 	/* Vertical box */
 	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-
-	gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
+	gtk_widget_set_halign(vbox, GTK_ALIGN_FILL);
+	gtk_widget_set_hexpand(vbox, TRUE);
+	gtk_box_append(GTK_BOX(hbox), vbox);
 
 	pidgin_widget_decorate_account(hbox, purple_request_cpar_get_account(cpar));
 
@@ -557,10 +576,10 @@
 	label = GTK_LABEL(gtk_label_new(NULL));
 
 	gtk_label_set_markup(label, label_text);
-	gtk_label_set_line_wrap(label, TRUE);
+	gtk_label_set_wrap(label, TRUE);
 	gtk_label_set_xalign(label, 0);
 	gtk_label_set_yalign(label, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(label), FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(vbox), GTK_WIDGET(label));
 
 	g_free(label_text);
 
@@ -568,8 +587,6 @@
 	data->u.input.multiline = multiline;
 	data->u.input.hint = g_strdup(hint);
 
-	gtk_widget_show_all(hbox);
-
 	if(multiline || purple_strequal(data->u.input.hint, "html")) {
 		GtkWidget *editor = talkatu_editor_new();
 		GtkWidget *input = talkatu_editor_get_input(TALKATU_EDITOR(editor));
@@ -577,8 +594,9 @@
 
 		gtk_widget_set_size_request(input, 320, 130);
 		gtk_widget_set_name(input, "pidgin_request_input");
-		gtk_box_pack_start(GTK_BOX(vbox), editor, TRUE, TRUE, 0);
-		gtk_widget_show(editor);
+		gtk_widget_set_valign(editor, GTK_ALIGN_FILL);
+		gtk_widget_set_vexpand(editor, TRUE);
+		gtk_box_append(GTK_BOX(vbox), editor);
 
 		if (purple_strequal(data->u.input.hint, "html")) {
 			buffer = talkatu_html_buffer_new();
@@ -601,7 +619,7 @@
 		GtkWidget *entry = gtk_entry_new();
 
 		gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-		gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
+		gtk_box_append(GTK_BOX(vbox), entry);
 
 		if(default_value != NULL) {
 			gtk_editable_set_text(GTK_EDITABLE(entry), default_value);
@@ -614,8 +632,6 @@
 		data->u.input.entry = entry;
 	}
 
-	gtk_widget_show_all(vbox);
-
 	pidgin_set_accessible_label(data->u.input.entry, label);
 
 	pidgin_auto_parent_window(dialog);
@@ -638,7 +654,8 @@
 	GtkWidget *hbox;
 	GtkWidget *label;
 	GtkWidget *img;
-	GtkWidget *radio = NULL;
+	GtkWidget *first_radio = NULL;
+	GtkWidget *content;
 	char *label_text;
 	char *radio_text;
 	char *primary_esc, *secondary_esc;
@@ -668,23 +685,28 @@
 			 G_CALLBACK(choice_response_cb), data);
 
 	/* Setup the dialog */
-	gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
-	gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                               6);
+	gtk_widget_set_margin_top(dialog, 6);
+	gtk_widget_set_margin_bottom(dialog, 6);
+	gtk_widget_set_margin_start(dialog, 6);
+	gtk_widget_set_margin_end(dialog, 6);
 	gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
-	gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                    12);
+
+	content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+	gtk_widget_set_margin_top(content, 6);
+	gtk_widget_set_margin_bottom(content, 6);
+	gtk_widget_set_margin_start(content, 6);
+	gtk_widget_set_margin_end(content, 6);
+	gtk_box_set_spacing(GTK_BOX(content), 12);
 
 	/* Setup the main horizontal box */
 	hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                  hbox);
+	gtk_box_append(GTK_BOX(content), hbox);
 
 	/* Dialog icon. */
 	img = pidgin_request_dialog_icon(PURPLE_REQUEST_CHOICE, cpar);
 	gtk_widget_set_halign(img, GTK_ALIGN_START);
 	gtk_widget_set_valign(img, GTK_ALIGN_START);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(hbox), img);
 
 	pidgin_widget_decorate_account(hbox, purple_request_cpar_get_account(cpar));
 
@@ -692,7 +714,7 @@
 
 	/* Vertical box */
 	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-	gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(hbox), vbox);
 
 	/* Descriptive label */
 	primary_esc = pidgin_request_escape(cpar, primary);
@@ -708,30 +730,43 @@
 	label = gtk_label_new(NULL);
 
 	gtk_label_set_markup(GTK_LABEL(label), label_text);
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_label_set_wrap(GTK_LABEL(label), TRUE);
 	gtk_label_set_xalign(GTK_LABEL(label), 0);
 	gtk_label_set_yalign(GTK_LABEL(label), 0);
-	gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
+	gtk_widget_set_valign(label, GTK_ALIGN_FILL);
+	gtk_widget_set_vexpand(label, TRUE);
+	gtk_box_append(GTK_BOX(vbox), label);
 
 	g_free(label_text);
 
 	vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-	gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(vbox), vbox2);
 	while ((radio_text = va_arg(args, char*))) {
-		       gpointer resp = va_arg(args, gpointer);
-		       radio = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio), radio_text);
-		       gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0);
-		       g_object_set_data(G_OBJECT(radio), "choice_value", resp);
-		       if (resp == default_value)
-			       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE);
+		GtkWidget *radio = NULL;
+		gpointer resp = va_arg(args, gpointer);
+
+		radio = gtk_check_button_new_with_label(radio_text);
+
+		if(first_radio == NULL) {
+			first_radio = radio;
+		} else {
+			gtk_check_button_set_group(GTK_CHECK_BUTTON(radio),
+			                           GTK_CHECK_BUTTON(first_radio));
+		}
+
+		gtk_box_append(GTK_BOX(vbox2), radio);
+
+		g_object_set_data(G_OBJECT(radio), "choice_value", resp);
+		if (resp == default_value)
+		   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE);
 	}
 
-	g_object_set_data(G_OBJECT(dialog), "radio", radio);
+	g_object_set_data(G_OBJECT(dialog), "radio", first_radio);
 
 	/* Show everything. */
 	pidgin_auto_parent_window(dialog);
 
-	gtk_widget_show_all(dialog);
+	gtk_widget_show(dialog);
 
 	return data;
 }
@@ -748,6 +783,7 @@
 	GtkWidget *hbox;
 	GtkWidget *label;
 	GtkWidget *img = NULL;
+	GtkWidget *content;
 	void **buttons;
 	char *label_text;
 	char *primary_esc, *secondary_esc;
@@ -792,26 +828,31 @@
 					 G_CALLBACK(action_response_cb), data);
 
 	/* Setup the dialog */
-	gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
-	gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                               6);
+	gtk_widget_set_margin_top(dialog, 6);
+	gtk_widget_set_margin_bottom(dialog, 6);
+	gtk_widget_set_margin_start(dialog, 6);
+	gtk_widget_set_margin_end(dialog, 6);
 	gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
-	gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                    12);
+
+	content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+	gtk_widget_set_margin_top(content, 6);
+	gtk_widget_set_margin_bottom(content, 6);
+	gtk_widget_set_margin_start(content, 6);
+	gtk_widget_set_margin_end(content, 6);
+	gtk_box_set_spacing(GTK_BOX(content), 12);
 
 	/* Setup the main horizontal box */
 	hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                  hbox);
+	gtk_box_append(GTK_BOX(content), hbox);
 
 	img = pidgin_request_dialog_icon(PURPLE_REQUEST_ACTION, cpar);
 	gtk_widget_set_halign(img, GTK_ALIGN_START);
 	gtk_widget_set_valign(img, GTK_ALIGN_START);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(hbox), img);
 
 	/* Vertical box */
 	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-	gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(hbox), vbox);
 
 	pidgin_widget_decorate_account(hbox,
 		purple_request_cpar_get_account(cpar));
@@ -832,31 +873,29 @@
 	label = gtk_label_new(NULL);
 
 	gtk_label_set_markup(GTK_LABEL(label), label_text);
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_label_set_wrap(GTK_LABEL(label), TRUE);
 	gtk_label_set_xalign(GTK_LABEL(label), 0);
 	gtk_label_set_yalign(GTK_LABEL(label), 0);
 	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
-	gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
+	gtk_widget_set_valign(label, GTK_ALIGN_FILL);
+	gtk_widget_set_vexpand(label, TRUE);
+	gtk_box_append(GTK_BOX(vbox), label);
 
 	g_free(label_text);
 
 
-	if (default_action == PURPLE_DEFAULT_ACTION_NONE) {
-		gtk_widget_set_can_default(img, TRUE);
-		gtk_widget_set_can_focus(img, TRUE);
-		gtk_widget_grab_focus(img);
-		gtk_widget_grab_default(img);
-	} else
+	if (default_action != PURPLE_DEFAULT_ACTION_NONE) {
 		/*
 		 * Need to invert the default_action number because the
 		 * buttons are added to the dialog in reverse order.
 		 */
 		gtk_dialog_set_default_response(GTK_DIALOG(dialog), action_count - 1 - default_action);
+	}
 
 	/* Show everything. */
 	pidgin_auto_parent_window(dialog);
 
-	gtk_widget_show_all(dialog);
+	gtk_widget_show(dialog);
 
 	return data;
 }
@@ -879,7 +918,7 @@
 	void *user_data)
 {
 	PidginRequestData *data;
-	GtkWidget *dialog;
+	GtkWidget *dialog, *content;
 	GtkWidget *hbox, *vbox, *img, *label, *button;
 	gchar *primary_esc, *secondary_esc, *label_text;
 
@@ -901,32 +940,36 @@
 		gtk_window_set_title(GTK_WINDOW(dialog), _("Please wait"));
 
 	/* Setup the dialog */
-	gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
-	gtk_container_set_border_width(GTK_CONTAINER(
-		gtk_dialog_get_content_area(GTK_DIALOG(dialog))), 6);
+	gtk_widget_set_margin_top(dialog, 6);
+	gtk_widget_set_margin_bottom(dialog, 6);
+	gtk_widget_set_margin_start(dialog, 6);
+	gtk_widget_set_margin_end(dialog, 6);
 	gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
-	gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(
-		GTK_DIALOG(dialog))), 12);
+
+	content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+	gtk_widget_set_margin_top(content, 6);
+	gtk_widget_set_margin_bottom(content, 6);
+	gtk_widget_set_margin_start(content, 6);
+	gtk_widget_set_margin_end(content, 6);
+	gtk_box_set_spacing(GTK_BOX(content), 12);
 
 	/* Setup the main horizontal box */
 	hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(
-		GTK_DIALOG(dialog))), hbox);
+	gtk_box_append(GTK_BOX(content), hbox);
 
 	img = pidgin_request_dialog_icon(PURPLE_REQUEST_WAIT, cpar);
 	gtk_widget_set_halign(img, GTK_ALIGN_START);
 	gtk_widget_set_valign(img, GTK_ALIGN_START);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(hbox), img);
 
 	/* Cancel button */
 	button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("Cancel"), GTK_RESPONSE_CANCEL);
 	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(wait_cancel_cb), data);
-	gtk_widget_set_can_default(button, FALSE);
 
 	/* Vertical box */
 	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-	gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+	gtk_box_append(GTK_BOX(hbox), vbox);
 
 	pidgin_widget_decorate_account(hbox,
 		purple_request_cpar_get_account(cpar));
@@ -947,11 +990,13 @@
 	label = gtk_label_new(NULL);
 
 	gtk_label_set_markup(GTK_LABEL(label), label_text);
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_label_set_wrap(GTK_LABEL(label), TRUE);
 	gtk_label_set_xalign(GTK_LABEL(label), 0);
 	gtk_label_set_yalign(GTK_LABEL(label), 0);
 	gtk_label_set_selectable(GTK_LABEL(label), FALSE);
-	gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
+	gtk_widget_set_valign(label, GTK_ALIGN_FILL);
+	gtk_widget_set_vexpand(label, TRUE);
+	gtk_box_append(GTK_BOX(vbox), label);
 
 	g_free(label_text);
 
@@ -961,20 +1006,13 @@
 		bar = data->u.wait.progress_bar =
 			GTK_PROGRESS_BAR(gtk_progress_bar_new());
 		gtk_progress_bar_set_fraction(bar, 0);
-		gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(bar),
-			FALSE, FALSE, 0);
+		gtk_box_append(GTK_BOX(vbox), GTK_WIDGET(bar));
 	}
 
-	/* Move focus out of cancel button. */
-	gtk_widget_set_can_default(img, TRUE);
-	gtk_widget_set_can_focus(img, TRUE);
-	gtk_widget_grab_focus(img);
-	gtk_widget_grab_default(img);
-
 	/* Show everything. */
 	pidgin_auto_parent_window(dialog);
 
-	gtk_widget_show_all(dialog);
+	gtk_widget_show(dialog);
 
 	return data;
 }
@@ -1113,6 +1151,7 @@
 	if (purple_request_field_string_is_multiline(field))
 	{
 		GtkWidget *textview;
+		GtkEventController *controller;
 
 		textview = gtk_text_view_new();
 		gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
@@ -1120,8 +1159,6 @@
 		gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview),
 									GTK_WRAP_WORD_CHAR);
 
-		gtk_widget_show(textview);
-
 		if (value != NULL)
 		{
 			GtkTextBuffer *buffer;
@@ -1135,7 +1172,9 @@
 
 		gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), is_editable);
 
-		g_signal_connect(G_OBJECT(textview), "focus-out-event",
+		controller = gtk_event_controller_focus_new();
+		gtk_widget_add_controller(textview, controller);
+		g_signal_connect(controller, "leave",
 						 G_CALLBACK(field_string_focus_out_cb), field);
 
 	    if (purple_request_field_is_required(field))
@@ -1149,6 +1188,8 @@
 	}
 	else
 	{
+		GtkEventController *controller = NULL;
+
 		widget = gtk_entry_new();
 
 		setup_entry_field(widget, field);
@@ -1166,7 +1207,9 @@
 
 		gtk_editable_set_editable(GTK_EDITABLE(widget), is_editable);
 
-		g_signal_connect(G_OBJECT(widget), "focus-out-event",
+		controller = gtk_event_controller_focus_new();
+		gtk_widget_add_controller(widget, controller);
+		g_signal_connect(controller, "leave",
 						 G_CALLBACK(field_string_focus_out_cb), field);
 	}
 
@@ -1222,6 +1265,8 @@
 create_choice_field(PurpleRequestField *field,
 	PurpleRequestCommonParameters *cpar)
 {
+#warning please rewrite me
+#if 0
 	GtkWidget *widget;
 	GList *elements = purple_request_field_choice_get_elements(field);
 	guint num_labels = g_list_length(elements);
@@ -1261,11 +1306,15 @@
 		GtkWidget *box;
 		GtkWidget *first_radio = NULL;
 		GtkWidget *radio;
-
-		if (num_labels == 2)
+		GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL;
+
+		if(num_labels == 2) {
+			orientation = GTK_ORIENTATION_HORIZONTAL;
 			box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-		else
+		} else {
+			orientation = GTK_ORIENTATION_VERTICAL;
 			box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+		}
 
 		widget = box;
 
@@ -1276,12 +1325,15 @@
 		{
 			PurpleKeyValuePair *choice = l->data;
 
-			radio = gtk_radio_button_new_with_label_from_widget(
-				GTK_RADIO_BUTTON(first_radio), choice->key);
+			radio = gtk_check_button_new_with_label(choice->key);
 			g_object_set_data(G_OBJECT(radio), "box", box);
 
-			if (first_radio == NULL)
+			if(first_radio == NULL) {
 				first_radio = radio;
+			} else {
+				gtk_check_button_set_group(GTK_CHECK_BUTTON(radio),
+				                           GTK_CHECK_BUTTON(first_radio));
+			}
 
 			if (choice->value == default_value) {
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE);
@@ -1289,8 +1341,15 @@
 			}
 			values[i++] = choice->value;
 
-			gtk_box_pack_start(GTK_BOX(box), radio, TRUE, TRUE, 0);
-			gtk_widget_show(radio);
+			if(orientation == GTK_ORIENTATION_VERTICAL) {
+				gtk_widget_set_valign(radio, GTK_ALIGN_FILL);
+				gtk_widget_set_vexpand(radio, TRUE);
+			} else if(orientation == GTK_ORIENTATION_HORIZONTAL) {
+				gtk_widget_set_halign(radio, GTK_ALIGN_FILL);
+				gtk_widget_set_hexpand(radio, TRUE);
+			}
+
+			gtk_box_append(GTK_BOX(box), radio);
 
 			g_signal_connect(G_OBJECT(radio), "toggled",
 							 G_CALLBACK(field_choice_option_cb), field);
@@ -1303,6 +1362,9 @@
 	g_object_set_data_full(G_OBJECT(widget), "values", values, g_free);
 
 	return widget;
+#endif
+
+	return NULL;
 }
 
 static GtkWidget *
@@ -1367,7 +1429,6 @@
 	gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
 	g_signal_connect(widget, "changed",
 		G_CALLBACK(req_field_changed_cb), field);
-	gtk_widget_show(widget);
 
 	return widget;
 }
@@ -1482,8 +1543,6 @@
 	g_signal_connect(G_OBJECT(sel), "changed",
 					 G_CALLBACK(list_field_select_changed_cb), field);
 
-	gtk_widget_show(treeview);
-
 	return pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, -1, -1);
 }
 
@@ -1600,6 +1659,7 @@
 static void
 datasheet_selection_changed(GtkWidget *sheet_widget)
 {
+#if 0
 	gpointer buttons_box;
 
 	g_return_if_fail(sheet_widget != NULL);
@@ -1607,6 +1667,7 @@
 	buttons_box = g_object_get_data(G_OBJECT(sheet_widget), "buttons");
 	gtk_container_foreach(GTK_CONTAINER(buttons_box),
 		datasheet_button_check_sens, sheet_widget);
+#endif
 }
 
 static void
@@ -1826,18 +1887,18 @@
 
 	gtk_widget_set_size_request(GTK_WIDGET(view), 400, 250);
 
-	scrollable = pidgin_make_scrollable(GTK_WIDGET(view),
-		GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, -1, -1);
-	gtk_widget_show(GTK_WIDGET(view));
+	scrollable = gtk_scrolled_window_new();
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollable),
+	                               GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+	gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(scrollable),
+	                              GTK_WIDGET(view));
+	gtk_widget_set_halign(scrollable, GTK_ALIGN_FILL);
+	gtk_widget_set_hexpand(scrollable, TRUE);
+	gtk_box_append(GTK_BOX(main_box), scrollable);
 
 	buttons_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
 	gtk_size_group_add_widget(buttons_sg, buttons_box);
-
-	gtk_box_pack_start(GTK_BOX(main_box), scrollable, TRUE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(main_box), buttons_box,
-		FALSE, FALSE, 0);
-	gtk_widget_show(scrollable);
-	gtk_widget_show(buttons_box);
+	gtk_box_append(GTK_BOX(main_box), buttons_box);
 
 	it = purple_request_datasheet_get_actions(sheet);
 	for (; it != NULL; it = g_list_next(it)) {
@@ -1854,9 +1915,7 @@
 		g_signal_connect(G_OBJECT(btn), "clicked",
 			G_CALLBACK(datasheet_action_clicked), act);
 
-		gtk_box_pack_start(GTK_BOX(buttons_box), GTK_WIDGET(btn),
-			FALSE, FALSE, 0);
-		gtk_widget_show(GTK_WIDGET(btn));
+		gtk_box_append(GTK_BOX(buttons_box), GTK_WIDGET(btn));
 	}
 
 	g_object_set_data(G_OBJECT(main_box), "view", view);
@@ -1891,6 +1950,7 @@
 	GtkWidget *grid;
 	GtkWidget *button;
 	GtkWidget *img;
+	GtkWidget *content;
 	GtkSizeGroup *sg, *datasheet_buttons_sg;
 	GList *gl, *fl;
 	PurpleRequestFieldGroup *group;
@@ -1925,17 +1985,15 @@
 					 G_CALLBACK(destroy_multifield_cb), data);
 
 	/* Setup the main horizontal box */
+	content = gtk_dialog_get_content_area(GTK_DIALOG(win));
 	hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(win))),
-	                  hbox);
-	gtk_widget_show(hbox);
+	gtk_box_append(GTK_BOX(content), hbox);
 
 	/* Dialog icon. */
 	img = pidgin_request_dialog_icon(PURPLE_REQUEST_FIELDS, cpar);
 	gtk_widget_set_halign(img, GTK_ALIGN_START);
 	gtk_widget_set_valign(img, GTK_ALIGN_START);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
-	gtk_widget_show(img);
+	gtk_box_append(GTK_BOX(hbox), img);
 
 	pidgin_request_add_help(GTK_DIALOG(win), cpar);
 
@@ -1953,18 +2011,16 @@
 	button = gtk_dialog_add_button(GTK_DIALOG(win), cancel_text, GTK_RESPONSE_CANCEL);
 	g_signal_connect(G_OBJECT(button), "clicked",
 			G_CALLBACK(multifield_cancel_cb), data);
-	gtk_widget_set_can_default(button, TRUE);
 
 	/* OK button */
 	if (!ok_btn) {
-		gtk_window_set_default(GTK_WINDOW(win), button);
+		gtk_window_set_default_widget(GTK_WINDOW(win), button);
 	} else {
 		button = gtk_dialog_add_button(GTK_DIALOG(win), ok_text, GTK_RESPONSE_OK);
 		g_signal_connect(G_OBJECT(button), "clicked",
 				G_CALLBACK(multifield_ok_cb), data);
 		data->ok_button = button;
-		gtk_widget_set_can_default(button, TRUE);
-		gtk_window_set_default(GTK_WINDOW(win), button);
+		gtk_window_set_default_widget(GTK_WINDOW(win), button);
 	}
 
 	pidgin_widget_decorate_account(hbox,
@@ -1972,8 +2028,9 @@
 
 	/* Setup the vbox */
 	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-	gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
-	gtk_widget_show(vbox);
+	gtk_widget_set_halign(vbox, GTK_ALIGN_FILL);
+	gtk_widget_set_hexpand(vbox, TRUE);
+	gtk_box_append(GTK_BOX(hbox), vbox);
 
 	sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 	datasheet_buttons_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
@@ -1986,11 +2043,10 @@
 		label = gtk_label_new(NULL);
 
 		gtk_label_set_markup(GTK_LABEL(label), label_text);
-		gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+		gtk_label_set_wrap(GTK_LABEL(label), TRUE);
 		gtk_label_set_xalign(GTK_LABEL(label), 0);
 		gtk_label_set_yalign(GTK_LABEL(label), 0);
-		gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-		gtk_widget_show(label);
+		gtk_box_append(GTK_BOX(vbox), label);
 		g_free(label_text);
 	}
 
@@ -2010,10 +2066,12 @@
 
 		for (i = 0; i < tab_count; i++) {
 			pages[i] = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-			gtk_container_set_border_width(GTK_CONTAINER(pages[i]), 12);
+			gtk_widget_set_margin_top(pages[i], 12);
+			gtk_widget_set_margin_bottom(pages[i], 12);
+			gtk_widget_set_margin_start(pages[i], 12);
+			gtk_widget_set_margin_end(pages[i], 12);
 			gtk_notebook_append_page(notebook, pages[i], NULL);
 			gtk_notebook_set_tab_label_text(notebook, pages[i], tab_names[i]);
-			gtk_widget_show(pages[i]);
 		}
 	}
 
@@ -2031,31 +2089,32 @@
 		}
 
 		if(total_fields > 9) {
-			GtkWidget *hbox_for_spacing, *vbox_for_spacing;
-
-			gtk_container_set_border_width(
-				GTK_CONTAINER(pages[i]), 0);
-
-			hbox_for_spacing =
-				gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-			gtk_box_pack_start(GTK_BOX(pages[i]),
-				pidgin_make_scrollable(hbox_for_spacing,
-					GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC,
-					-1, 200),
-				TRUE, TRUE, 0);
-			gtk_widget_show(hbox_for_spacing);
-
-			vbox_for_spacing =
-				gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-			gtk_box_pack_start(GTK_BOX(hbox_for_spacing),
-				vbox_for_spacing, TRUE, TRUE,
-				6);
-			gtk_widget_show(vbox_for_spacing);
-
-			pages[i] = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-			gtk_box_pack_start(GTK_BOX(vbox_for_spacing),
-				pages[i], TRUE, TRUE, 6);
-			gtk_widget_show(pages[i]);
+			GtkWidget *hbox_for_spacing, *vbox_for_spacing, *scrollable;
+
+			gtk_widget_set_margin_top(pages[i], 0);
+			gtk_widget_set_margin_bottom(pages[i], 0);
+			gtk_widget_set_margin_start(pages[i], 0);
+			gtk_widget_set_margin_end(pages[i], 0);
+
+			scrollable = gtk_scrolled_window_new();
+			gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollable),
+			                               GTK_POLICY_NEVER,
+			                               GTK_POLICY_AUTOMATIC);
+			gtk_widget_set_size_request(scrollable, -1, 200);
+			gtk_widget_set_valign(scrollable, GTK_ALIGN_FILL);
+			gtk_widget_set_vexpand(scrollable, TRUE);
+			gtk_box_append(GTK_BOX(pages[i]), scrollable);
+
+			hbox_for_spacing = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
+			gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(scrollable),
+			                              hbox_for_spacing);
+
+			vbox_for_spacing = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
+			gtk_widget_set_halign(vbox_for_spacing, GTK_ALIGN_FILL);
+			gtk_widget_set_hexpand(vbox_for_spacing, TRUE);
+			gtk_widget_set_margin_start(vbox_for_spacing, 6);
+			gtk_widget_set_margin_end(vbox_for_spacing, 6);
+			gtk_box_append(GTK_BOX(hbox_for_spacing), vbox_for_spacing);
 		}
 
 		if (notebook == NULL)
@@ -2068,17 +2127,20 @@
 
 		gtk_label_set_markup(GTK_LABEL(label), secondary_esc);
 		g_free(secondary_esc);
-		gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+		gtk_label_set_wrap(GTK_LABEL(label), TRUE);
 		gtk_label_set_xalign(GTK_LABEL(label), 0);
 		gtk_label_set_yalign(GTK_LABEL(label), 0);
-		gtk_box_pack_start(GTK_BOX(vbox), label, (notebook == NULL),
-			(notebook == NULL), 0);
-		gtk_widget_show(label);
+		if(notebook == NULL) {
+			gtk_widget_set_valign(label, GTK_ALIGN_FILL);
+			gtk_widget_set_vexpand(label, TRUE);
+		}
+		gtk_box_append(GTK_BOX(vbox), label);
 	}
 
 	if (notebook != NULL) {
-		gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(notebook), TRUE, TRUE, 0);
-		gtk_widget_show(GTK_WIDGET(notebook));
+		gtk_widget_set_valign(GTK_WIDGET(notebook), GTK_ALIGN_FILL);
+		gtk_widget_set_vexpand(GTK_WIDGET(notebook), TRUE);
+		gtk_box_append(GTK_BOX(vbox), GTK_WIDGET(notebook));
 	}
 
 	for (gl = purple_request_fields_get_groups(fields);
@@ -2174,8 +2236,22 @@
 		gtk_grid_set_column_spacing(GTK_GRID(grid), 6);
 
 		frame_fill = (notebook == NULL || contains_resizable);
-		gtk_box_pack_start(GTK_BOX(frame), grid, frame_fill, frame_fill, 0);
-		gtk_widget_show(grid);
+
+		/* This box could be setup in a number of ways, so just set everything
+		 * instead of only setting the bare minimums.
+		 */
+		g_object_set(G_OBJECT(grid),
+		             "hexpand", frame_fill,
+		             "vexpand", frame_fill,
+		             NULL);
+
+		if(frame_fill) {
+			g_object_set(G_OBJECT(grid),
+			             "halign", GTK_ALIGN_FILL,
+			             "valign", GTK_ALIGN_FILL,
+			             NULL);
+		}
+		gtk_box_append(GTK_BOX(frame), grid);
 
 		for (row_num = 0, fl = field_list;
 			 row_num < rows && fl != NULL;
@@ -2259,7 +2335,6 @@
 							col_offset, row_num, 1, 1);
 					}
 
-					gtk_widget_show(label);
 					g_free(field_label);
 				}
 
@@ -2322,8 +2397,6 @@
 						1, row_num, 2 * cols - 1, 1);
 				}
 
-				gtk_widget_show(widget);
-
 				purple_request_field_set_ui_data(field, widget);
 			}
 		}
@@ -2350,7 +2423,7 @@
 static void
 file_ok_check_if_exists_cb(GtkWidget *widget, gint response, PidginRequestData *data)
 {
-	gchar *current_folder;
+	GFile *current_path;
 
 	if (response != GTK_RESPONSE_ACCEPT) {
 		if (data->cbs[0] != NULL)
@@ -2359,9 +2432,10 @@
 		return;
 	}
 
-	data->u.file.name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(data->dialog));
-	current_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(data->dialog));
-	if (current_folder != NULL) {
+	data->u.file.name = gtk_file_chooser_get_current_name(GTK_FILE_CHOOSER(data->dialog));
+	current_path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(data->dialog));
+	if (current_path != NULL) {
+		gchar *current_folder = g_file_get_path(current_path);
 		if (data->u.file.savedialog) {
 			purple_prefs_set_path(PIDGIN_PREFS_ROOT "/filelocations/last_save_folder", current_folder);
 		} else {
@@ -2373,6 +2447,8 @@
 		((PurpleRequestFileCb)data->cbs[1])(data->user_data, data->u.file.name);
 	}
 	purple_request_close(data->type, data);
+
+	g_clear_object(&current_path);
 }
 
 static void *
@@ -2403,14 +2479,17 @@
 	        savedialog ? GTK_FILE_CHOOSER_ACTION_SAVE
 	                   : GTK_FILE_CHOOSER_ACTION_OPEN,
 	        savedialog ? _("_Save") : _("_Open"), _("_Cancel"));
-	gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(filesel),
-	                                               TRUE);
 
 	if ((filename != NULL) && (*filename != '\0')) {
-		if (savedialog)
-			gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(filesel), filename);
-		else if (g_file_test(filename, G_FILE_TEST_EXISTS))
-			gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(filesel), filename);
+		GFile *path = g_file_new_for_path(filename);
+
+		if(savedialog) {
+			gtk_file_chooser_set_file(GTK_FILE_CHOOSER(filesel), path, NULL);
+		} else if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
+			gtk_file_chooser_set_file(GTK_FILE_CHOOSER(filesel), path, NULL);
+		}
+
+		g_object_unref(path);
 	}
 
 #ifdef _WIN32
@@ -2472,8 +2551,14 @@
 	        title ? title : _("Select Folder..."), NULL,
 	        GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, _("_OK"), _("_Cancel"));
 
-	if ((dirname != NULL) && (*dirname != '\0'))
-		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dirsel), dirname);
+	if ((dirname != NULL) && (*dirname != '\0')) {
+		GFile *path = g_file_new_for_path(dirname);
+
+		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dirsel), path,
+		                                    NULL);
+
+		g_object_unref(path);
+	}
 
 	g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(dirsel)), "response",
 						G_CALLBACK(file_ok_check_if_exists_cb), data);
@@ -2530,7 +2615,7 @@
 	} else {
 		pidgin_window_detach_children(GTK_WINDOW(data->dialog));
 
-		gtk_widget_destroy(data->dialog);
+		gtk_window_destroy(GTK_WINDOW(data->dialog));
 	}
 
 	if (type == PURPLE_REQUEST_FIELDS)
