--- a/pidgin/pidginaddchatdialog.c Mon Nov 07 21:51:11 2022 -0600
+++ b/pidgin/pidginaddchatdialog.c Mon Nov 07 23:27:06 2022 -0600
@@ -37,14 +37,13 @@
const gchar *default_name;
- GtkWidget *dynamic_box;
+ GtkWidget *dynamic_group;
G_DEFINE_TYPE(PidginAddChatDialog, pidgin_add_chat_dialog, GTK_TYPE_DIALOG)
@@ -58,18 +57,23 @@
pidgin_add_chat_dialog_validate_input(gpointer data, gpointer user_data) {
gboolean *valid = user_data;
+ gboolean required = FALSE; - if(!g_object_get_data(data, "integer")) {
- gboolean required = FALSE;
+ required = GPOINTER_TO_INT(g_object_get_data(data, "required")); + const gchar *value = gtk_editable_get_text(GTK_EDITABLE(data)); - required = GPOINTER_TO_INT(g_object_get_data(data, "required"));
- const gchar *value = NULL;
+ if(value == NULL || *value == '\0') { + } else if(g_object_get_data(data, "integer")) { + gint int_value = atoi(value); + char *str_value = g_strdup_printf("%d", int_value); - value = gtk_editable_get_text(GTK_EDITABLE(data));
- if(value == NULL || *value == '\0') {
+ if(!purple_strequal(value, str_value)) { @@ -81,7 +85,7 @@
/* The callback should only set valid to FALSE if a field is invalid and
* not set valid if the field is valid.
- g_list_foreach(dialog->inputs,
+ g_list_foreach(dialog->rows, pidgin_add_chat_dialog_validate_input,
@@ -94,16 +98,16 @@
PurpleAccount *account = NULL;
PurpleConnection *connection = NULL;
PurpleProtocol *protocol = NULL;
- GtkWidget *child = NULL;
GHashTable *defaults = NULL;
gboolean focus_set = FALSE;
- /* Clean up the dynamic box and our list of entires. */
- while((child = gtk_widget_get_first_child(dialog->dynamic_box)) != NULL) {
- gtk_box_remove(GTK_BOX(dialog->dynamic_box), child);
+ /* Clean up the dynamic group and our list of rows. */ + while(dialog->rows != NULL) { + adw_preferences_group_remove(ADW_PREFERENCES_GROUP(dialog->dynamic_group), + dialog->rows = g_list_delete_link(dialog->rows, dialog->rows); - g_clear_pointer(&dialog->inputs, g_list_free);
account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(dialog->account));
if(!PURPLE_IS_ACCOUNT(account)) {
@@ -119,57 +123,48 @@
- GtkWidget *box = NULL, *label = NULL, *input = NULL;
PurpleProtocolChatEntry *pce = info->data;
- GtkAdjustment *adjustment = gtk_adjustment_new(pce->min, pce->min,
- input = gtk_spin_button_new(adjustment, 1, 0);
+ row = adw_entry_row_new(); + adw_entry_row_set_input_purpose(ADW_ENTRY_ROW(row), + GTK_INPUT_PURPOSE_NUMBER); + } else if(pce->secret) { + row = adw_password_entry_row_new();
- input = gtk_entry_new();
- g_signal_connect(input, "changed",
- G_CALLBACK(pidgin_add_chat_dialog_input_changed_cb),
- value = g_hash_table_lookup(defaults, pce->identifier);
- gtk_editable_set_text(GTK_EDITABLE(input), value);
- gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
- gtk_entry_set_input_purpose(GTK_ENTRY(input),
- GTK_INPUT_PURPOSE_PASSWORD);
+ row = adw_entry_row_new(); - box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_box_append(GTK_BOX(dialog->dynamic_box), box);
+ value = g_hash_table_lookup(defaults, pce->identifier); + gtk_editable_set_text(GTK_EDITABLE(row), value); + g_signal_connect(row, "changed", + G_CALLBACK(pidgin_add_chat_dialog_input_changed_cb), - label = gtk_label_new_with_mnemonic(pce->label);
- gtk_label_set_xalign(GTK_LABEL(label), 0.0f);
- gtk_label_set_yalign(GTK_LABEL(label), 0.0f);
- gtk_box_append(GTK_BOX(box), label);
- gtk_size_group_add_widget(dialog->sg, label);
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), pce->label); + adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE); - gtk_widget_set_hexpand(input, TRUE);
- gtk_box_append(GTK_BOX(box), input);
+ adw_preferences_group_add(ADW_PREFERENCES_GROUP(dialog->dynamic_group), - gtk_widget_grab_focus(input);
+ gtk_widget_grab_focus(row); - g_object_set_data(G_OBJECT(input), "identifier",
+ g_object_set_data(G_OBJECT(row), "identifier", (gpointer)pce->identifier);
- g_object_set_data(G_OBJECT(input), "integer",
+ g_object_set_data(G_OBJECT(row), "integer", GINT_TO_POINTER(pce->is_int));
- g_object_set_data(G_OBJECT(input), "required",
+ g_object_set_data(G_OBJECT(row), "required", GINT_TO_POINTER(pce->required));
- dialog->inputs = g_list_append(dialog->inputs, input);
+ dialog->rows = g_list_append(dialog->rows, row); @@ -210,7 +205,8 @@
identifier = g_strdup(g_object_get_data(data, "identifier"));
if(g_object_get_data(data, "integer")) {
- gint int_value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data));
+ const char *str_value = gtk_editable_get_text(GTK_EDITABLE(data)); + gint int_value = atoi(str_value); value = g_strdup_printf("%d", int_value);
@@ -263,7 +259,7 @@
components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
- g_list_foreach(acdialog->inputs,
+ g_list_foreach(acdialog->rows, pidgin_add_chat_dialog_add_input_to_components,
@@ -287,11 +283,11 @@
purple_blist_add_chat(chat, group, NULL);
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(acdialog->autojoin))) {
+ if(gtk_switch_get_active(GTK_SWITCH(acdialog->autojoin))) { purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat),
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(acdialog->persistent))) {
+ if(gtk_switch_get_active(GTK_SWITCH(acdialog->persistent))) { purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat),
@@ -357,7 +353,7 @@
pidgin_add_chat_dialog_finalize(GObject *obj) {
PidginAddChatDialog *dialog = PIDGIN_ADD_CHAT_DIALOG(obj);
- g_list_free(dialog->inputs);
+ g_list_free(dialog->rows); G_OBJECT_CLASS(pidgin_add_chat_dialog_parent_class)->finalize(obj);
@@ -394,7 +390,7 @@
gtk_widget_class_bind_template_child(widget_class, PidginAddChatDialog,
gtk_widget_class_bind_template_child(widget_class, PidginAddChatDialog,
gtk_widget_class_bind_template_child(widget_class, PidginAddChatDialog,
gtk_widget_class_bind_template_child(widget_class, PidginAddChatDialog,
@@ -403,8 +399,6 @@
gtk_widget_class_bind_template_child(widget_class, PidginAddChatDialog,
- gtk_widget_class_bind_template_child(widget_class, PidginAddChatDialog,
gtk_widget_class_bind_template_callback(widget_class,
pidgin_add_chat_dialog_response_cb);
--- a/pidgin/resources/Dialogs/addbuddy.ui Mon Nov 07 21:51:11 2022 -0600
+++ b/pidgin/resources/Dialogs/addbuddy.ui Mon Nov 07 23:27:06 2022 -0600
@@ -31,28 +31,27 @@
<signal name="response" handler="pidgin_add_buddy_dialog_response_cb" swapped="no"/>
<child internal-child="content_area">
+ <property name="margin-bottom">24</property> + <property name="margin-end">24</property> + <property name="margin-start">24</property> + <property name="margin-top">24</property> <property name="orientation">vertical</property>
- <property name="spacing">12</property>
+ <property name="spacing">24</property> <object class="GtkLabel">
- <property name="label" translatable="1">Add a buddy.</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
+ <property name="css-classes">title-1</property> + <property name="label" translatable="1">Add a buddy</property> - <object class="GtkLabel" id="spacer"/>
- <property name="spacing">5</property>
+ <property name="spacing">6</property> <object class="GtkLabel" id="label1">
<property name="label" translatable="1">A_ccount:</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">account</property>
<property name="xalign">0</property>
- <property name="yalign">0</property>
@@ -77,95 +76,42 @@
- <object class="GtkBox">
- <property name="spacing">5</property>
+ <object class="AdwPreferencesGroup"> + <property name="title" translatable="1">Buddy information</property> - <object class="GtkLabel" id="label2">
- <property name="label" translatable="1">Buddy's _username:</property>
+ <object class="AdwEntryRow" id="username"> + <property name="title" translatable="1">Buddy's _username</property> <property name="use-underline">1</property>
- <property name="mnemonic-widget">username</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
+ <property name="activates-default">1</property> + <signal name="changed" handler="pidgin_add_buddy_dialog_username_changed_cb" object="PidginAddBuddyDialog" swapped="no"/> - <object class="GtkEntry" id="username">
- <property name="hexpand">1</property>
- <property name="focusable">1</property>
- <property name="activates-default">1</property>
- <signal name="changed" handler="pidgin_add_buddy_dialog_username_changed_cb" object="PidginAddBuddyDialog" swapped="no"/>
- <relation name="labelled-by">label2</relation>
- <object class="GtkBox">
- <property name="spacing">5</property>
- <object class="GtkLabel" id="label3">
- <property name="label" translatable="1">(Optional) A_lias:</property>
+ <object class="AdwEntryRow" id="alias"> + <property name="title" translatable="1">(Optional) A_lias</property> <property name="use-underline">1</property>
- <property name="mnemonic-widget">alias</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <object class="GtkEntry" id="alias">
- <property name="hexpand">1</property>
- <property name="focusable">1</property>
- <relation name="labelled-by">label3</relation>
- <object class="GtkBox">
- <property name="spacing">5</property>
- <object class="GtkLabel" id="label4">
- <property name="label" translatable="1">(Optional) _Invite message:</property>
+ <object class="AdwEntryRow" id="message"> + <property name="title" translatable="1">(Optional) _Invite message</property> <property name="use-underline">1</property>
- <property name="mnemonic-widget">message</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
+ <property name="sensitive">0</property> - <object class="GtkEntry" id="message">
- <property name="hexpand">1</property>
- <property name="sensitive">0</property>
- <property name="focusable">1</property>
- <relation name="labelled-by">label4</relation>
- <object class="GtkBox">
- <property name="spacing">5</property>
- <object class="GtkLabel" id="label5">
- <property name="label" translatable="1">Add buddy to _group:</property>
+ <object class="AdwActionRow"> + <property name="activatable-widget">group</property> + <property name="focusable">0</property> + <property name="title" translatable="1">Add buddy to _group</property> <property name="use-underline">1</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <object class="GtkComboBoxText" id="group">
- <property name="hexpand">1</property>
- <property name="has-entry">1</property>
- <relation name="labelled-by">label5</relation>
+ <object class="GtkComboBoxText" id="group"> + <property name="hexpand">1</property> + <property name="has-entry">1</property> + <property name="valign">center</property> @@ -186,21 +132,13 @@
<object class="GtkButton" id="button2">
+ <property name="css-classes">suggested-action</property> + <property name="focusable">1</property> <property name="label" translatable="1">_Add</property>
+ <property name="receives-default">1</property> <property name="sensitive">0</property>
- <property name="focusable">1</property>
- <property name="receives-default">1</property>
<property name="use-underline">1</property>
- <object class="GtkSizeGroup">
- <widget name="label1"/>
- <widget name="label2"/>
- <widget name="label3"/>
- <widget name="label4"/>
- <widget name="label5"/>
--- a/pidgin/resources/Dialogs/addchat.ui Mon Nov 07 21:51:11 2022 -0600
+++ b/pidgin/resources/Dialogs/addchat.ui Mon Nov 07 23:27:06 2022 -0600
@@ -31,20 +31,19 @@
<signal name="response" handler="pidgin_add_chat_dialog_response_cb" swapped="no"/>
<child internal-child="content_area">
+ <property name="margin-bottom">24</property> + <property name="margin-end">24</property> + <property name="margin-start">24</property> + <property name="margin-top">24</property> <property name="orientation">vertical</property>
- <property name="spacing">12</property>
+ <property name="spacing">24</property> <object class="GtkLabel">
- <property name="label" translatable="1">Please enter an alias, and the appropriate information about the chat you would like to add to your buddy list.</property>
- <property name="wrap">1</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
+ <property name="css-classes">title-1</property> + <property name="label" translatable="1">Add a chat</property> - <object class="GtkLabel" id="spacer"/>
<property name="spacing">5</property>
@@ -53,7 +52,6 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">account</property>
<property name="xalign">0</property>
- <property name="yalign">0</property>
@@ -70,73 +68,69 @@
<signal name="notify::account" handler="pidgin_add_chat_dialog_account_changed_cb" swapped="no"/>
+ <relation name="labelled-by">label1</relation> - <object class="GtkBox" id="dynamic_box">
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <property name="hexpand">1</property>
- <object class="GtkBox">
- <property name="spacing">5</property>
- <object class="GtkLabel" id="label4">
- <property name="label" translatable="1">A_lias:</property>
- <property name="use-underline">1</property>
- <property name="mnemonic-widget">alias</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <object class="GtkEntry" id="alias">
- <property name="hexpand">1</property>
- <property name="focusable">1</property>
+ <object class="AdwPreferencesGroup" id="dynamic_group"> + <property name="title" translatable="1">Chat information</property> + <property name="description" translatable="1">Please enter the appropriate information about the chat you would like to add to your buddy list.</property> - <object class="GtkBox">
- <property name="spacing">5</property>
+ <object class="AdwPreferencesGroup"> + <property name="title" translatable="1">Local information</property> + <object class="AdwEntryRow" id="alias"> + <property name="title" translatable="1">A_lias</property> + <property name="use-underline">1</property> - <object class="GtkLabel" id="label5">
- <property name="label" translatable="1">_Group:</property>
+ <object class="AdwActionRow"> + <property name="activatable-widget">group</property> + <property name="focusable">0</property> + <property name="title" translatable="1">_Group</property> <property name="use-underline">1</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
+ <object class="GtkComboBoxText" id="group"> + <property name="hexpand">1</property> + <property name="has-entry">1</property> + <property name="valign">center</property> - <object class="GtkComboBoxText" id="group">
- <property name="hexpand">1</property>
- <property name="has-entry">1</property>
+ <object class="AdwActionRow"> + <property name="activatable-widget">autojoin</property> + <property name="focusable">0</property> + <property name="title" translatable="1">Automatically _join when account connects</property> + <property name="use-underline">1</property> + <object class="GtkSwitch" id="autojoin"> + <property name="valign">center</property>
- <object class="GtkCheckButton" id="autojoin">
- <property name="label" translatable="1">Automatically _join when account connects</property>
- <property name="focusable">1</property>
- <property name="halign">start</property>
- <property name="use-underline">1</property>
- <object class="GtkCheckButton" id="persistent">
- <property name="label" translatable="1">_Remain in chat after window is closed</property>
- <property name="focusable">1</property>
- <property name="halign">start</property>
- <property name="use-underline">1</property>
+ <object class="AdwActionRow"> + <property name="activatable-widget">persistent</property> + <property name="focusable">0</property> + <property name="title" translatable="1">_Remain in chat after window is closed</property> + <property name="use-underline">1</property> + <object class="GtkSwitch" id="persistent"> + <property name="valign">center</property> @@ -171,11 +165,4 @@
<action-widget response="ok">button2</action-widget>
- <object class="GtkSizeGroup" id="sg">
- <widget name="label1"/>
- <widget name="label4"/>
- <widget name="label5"/>