pidgin/pidgin

Remove pidgin_dialog* helper functions

2021-09-27, Elliott Sales de Andrade
18f3ea2e7e6d
Parents 0a4177bbb1c4
Children 26cbce8851e5
Remove pidgin_dialog* helper functions

Since `homogeneous` on boxes is `FALSE` by default, I didn't bother setting it.

Testing Done:
Compile-only, mostly. I did check the Accounts windows, but requests are harder to check.

Reviewed at https://reviews.imfreedom.org/r/949/
--- a/ChangeLog.API Sun Sep 26 00:25:14 2021 -0500
+++ b/ChangeLog.API Mon Sep 27 20:42:30 2021 -0500
@@ -793,6 +793,10 @@
* pidgin_create_status_icon
* pidgin_create_window, use pidgin_window_new instead.
* PIDGIN_DIALOG
+ * pidgin_dialog_add_button
+ * pidgin_dialog_get_action_area
+ * pidgin_dialog_get_vbox
+ * pidgin_dialog_get_vbox_with_properties
* pidgin_dialogs_alias_contact
* pidgin_make_mini_dialog_with_custom_icon; use
pidgin_mini_dialog_new_with_custom_icon instead.
--- a/pidgin/gtkaccount.c Sun Sep 26 00:25:14 2021 -0500
+++ b/pidgin/gtkaccount.c Mon Sep 27 20:42:30 2021 -0500
@@ -1572,7 +1572,8 @@
dialog);
/* Setup the vbox */
- main_vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 6);
+ main_vbox = gtk_dialog_get_content_area(GTK_DIALOG(win));
+ 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);
@@ -2393,7 +2394,8 @@
accounts_window);
/* Setup the vbox */
- vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 12);
+ vbox = gtk_dialog_get_content_area(GTK_DIALOG(win));
+ gtk_box_set_spacing(GTK_BOX(vbox), 12);
/* Setup the scrolled window that will contain the list of accounts. */
sw = create_accounts_list(dialog);
--- a/pidgin/gtkrequest.c Sun Sep 26 00:25:14 2021 -0500
+++ b/pidgin/gtkrequest.c Mon Sep 27 20:42:30 2021 -0500
@@ -923,8 +923,9 @@
gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
/* Cancel button */
- button = pidgin_dialog_add_button(GTK_DIALOG(dialog), _("Cancel"),
- G_CALLBACK(wait_cancel_cb), data);
+ 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 */
@@ -1925,7 +1926,8 @@
/* Setup the main horizontal box */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_container_add(GTK_CONTAINER(pidgin_dialog_get_vbox(GTK_DIALOG(win))), hbox);
+ gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(win))),
+ hbox);
gtk_widget_show(hbox);
/* Dialog icon. */
@@ -1937,16 +1939,19 @@
pidgin_request_add_help(GTK_DIALOG(win), cpar);
+ i = 0;
for (GSList *it = extra_actions; it != NULL; it = it->next) {
PurpleKeyValuePair *extra_action = it->data;
- button = pidgin_dialog_add_button(GTK_DIALOG(win), extra_action->key,
+ button = gtk_dialog_add_button(GTK_DIALOG(win), extra_action->key, i++);
+ g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(multifield_extra_cb), data);
g_object_set_data(G_OBJECT(button), "extra-cb", extra_action->value);
}
/* Cancel button */
- button = pidgin_dialog_add_button(GTK_DIALOG(win), cancel_text,
+ 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);
@@ -1954,7 +1959,8 @@
if (!ok_btn) {
gtk_window_set_default(GTK_WINDOW(win), button);
} else {
- button = pidgin_dialog_add_button(GTK_DIALOG(win), ok_text,
+ 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);
--- a/pidgin/gtksavedstatuses.c Sun Sep 26 00:25:14 2021 -0500
+++ b/pidgin/gtksavedstatuses.c Mon Sep 27 20:42:30 2021 -0500
@@ -571,7 +571,8 @@
g_signal_connect(win, "response", G_CALLBACK(response_cb), dialog);
/* Setup the vbox */
- vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 12);
+ vbox = gtk_dialog_get_content_area(GTK_DIALOG(win));
+ gtk_box_set_spacing(GTK_BOX(vbox), 12);
/* List of saved status states */
list = create_saved_status_list(dialog);
@@ -1117,7 +1118,8 @@
dialog);
/* Setup the vbox */
- vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 12);
+ vbox = gtk_dialog_get_content_area(GTK_DIALOG(win));
+ gtk_box_set_spacing(GTK_BOX(vbox), 12);
sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
@@ -1416,7 +1418,8 @@
dialog);
/* Setup the vbox */
- vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 12);
+ vbox = gtk_dialog_get_content_area(GTK_DIALOG(win));
+ gtk_box_set_spacing(GTK_BOX(vbox), 12);
sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
--- a/pidgin/gtkutils.c Sun Sep 26 00:25:14 2021 -0500
+++ b/pidgin/gtkutils.c Mon Sep 27 20:42:30 2021 -0500
@@ -119,37 +119,6 @@
/******************************************************************************
* Code
*****************************************************************************/
-GtkWidget *
-pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing)
-{
- GtkBox *vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
- gtk_box_set_homogeneous(vbox, homogeneous);
- gtk_box_set_spacing(vbox, spacing);
- return GTK_WIDGET(vbox);
-}
-
-GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog)
-{
- return gtk_dialog_get_content_area(GTK_DIALOG(dialog));
-}
-
-GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog)
-{
- return gtk_dialog_get_action_area(GTK_DIALOG(dialog));
-}
-
-GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
- GCallback callback, gpointer callbackdata)
-{
- GtkWidget *button = gtk_button_new_with_mnemonic(label);
- GtkWidget *bbox = pidgin_dialog_get_action_area(dialog);
-
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- if (callback)
- g_signal_connect(G_OBJECT(button), "clicked", callback, callbackdata);
- gtk_widget_show(button);
- return button;
-}
GtkWidget *pidgin_separator(GtkWidget *menu)
{
--- a/pidgin/gtkutils.h Sun Sep 26 00:25:14 2021 -0500
+++ b/pidgin/gtkutils.h Mon Sep 27 20:42:30 2021 -0500
@@ -64,52 +64,6 @@
G_BEGIN_DECLS
/**
- * pidgin_dialog_get_vbox_with_properties:
- * @dialog: The dialog window
- * @homogeneous: TRUE if all children are to be given equal space allotments.
- * @spacing: the number of pixels to place by default between children
- *
- * Retrieves the main content box (vbox) from a pidgin dialog window
- *
- * Returns: (transfer none): The main vbox from @dialog.
- */
-GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing);
-
-/**
- * pidgin_dialog_get_vbox:
- * @dialog: The dialog window
- *
- * Retrieves the main content box (vbox) from a pidgin dialog window
- *
- * Returns: (transfer none): the main vbox from @dialog.
- */
-GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog);
-
-/**
- * pidgin_dialog_add_button:
- * @dialog: The dialog window
- * @label: The label for the button
- * @callback: (scope call): The callback function for the button
- * @callbackdata: The user data for the callback function
- *
- * Add a button to a dialog created by #pidgin_create_dialog.
- *
- * Returns: (transfer full): The created button.
- */
-GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
- GCallback callback, gpointer callbackdata);
-
-/**
- * pidgin_dialog_get_action_area:
- * @dialog: The dialog window
- *
- * Retrieves the action area (button box) from a pidgin dialog window
- *
- * Returns: (transfer none): The action area (button box) from @dialog.
- */
-GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog);
-
-/**
* pidgin_separator:
* @menu: The menu to add a separator to.
*