Fri, 28 Oct 2022 23:37:16 -0500
Avoid GtkComboBox-isms with PidginAccountChooser
Avoiding the `GtkComboBox` signal for the `PidginAccountChooser` signal will allow moving to newer widgets internally.
Testing Done:
Opened the dialogs that were changed here and verified that the chooser didn't break.
Reviewed at https://reviews.imfreedom.org/r/1991/
--- a/pidgin/gtkprivacy.c Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/gtkprivacy.c Fri Oct 28 23:37:16 2022 -0500 @@ -120,8 +120,10 @@ } static void -select_account_cb(GtkWidget *w, PidginPrivacyDialog *dialog) { - PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(w); +select_account_cb(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec, gpointer data) +{ + PidginPrivacyDialog *dialog = data; + PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(obj); PurpleAccount *account = pidgin_account_chooser_get_selected(chooser); gsize i;
--- a/pidgin/gtkroomlist.c Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/gtkroomlist.c Fri Oct 28 23:37:16 2022 -0500 @@ -315,8 +315,11 @@ } static void -dialog_select_account_cb(G_GNUC_UNUSED GtkWidget *w, PidginRoomlistDialog *dialog) { - PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(w); +dialog_select_account_cb(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec, + gpointer data) +{ + PidginRoomlistDialog *dialog = data; + PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(obj); PurpleAccount *account = pidgin_account_chooser_get_selected(chooser); gboolean change = (account != dialog->account); dialog->account = account;
--- a/pidgin/pidginaddbuddydialog.c Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/pidginaddbuddydialog.c Fri Oct 28 23:37:16 2022 -0500 @@ -198,12 +198,15 @@ } static void -pidgin_add_buddy_dialog_account_changed_cb(GtkComboBox *widget, gpointer data) { +pidgin_add_buddy_dialog_account_changed_cb(GObject *obj, + G_GNUC_UNUSED GParamSpec *pspec, + gpointer data) +{ PidginAddBuddyDialog *dialog = data; PurpleAccount *account = NULL; gboolean message_sensitive = TRUE; - account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(widget)); + account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(obj)); if(PURPLE_IS_ACCOUNT(account)) { PurpleProtocol *protocol = purple_account_get_protocol(account);
--- a/pidgin/pidginaddchatdialog.c Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/pidginaddchatdialog.c Fri Oct 28 23:37:16 2022 -0500 @@ -316,11 +316,14 @@ } static void -pidgin_add_chat_dialog_account_changed_cb(GtkComboBox *widget, gpointer data) { +pidgin_add_chat_dialog_account_changed_cb(GObject *obj, + G_GNUC_UNUSED GParamSpec *pspec, + gpointer data) +{ PidginAddChatDialog *dialog = data; PurpleAccount *account = NULL; - account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(widget)); + account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(obj)); if(PURPLE_IS_ACCOUNT(account)) { PurpleProtocol *protocol = purple_account_get_protocol(account);
--- a/pidgin/plugins/disco/gtkdisco.c Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/plugins/disco/gtkdisco.c Fri Oct 28 23:37:16 2022 -0500 @@ -145,9 +145,11 @@ } static void -dialog_select_account_cb(GtkWidget *chooser, PidginDiscoDialog *dialog) +dialog_select_account_cb(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec, + gpointer data) { - PurpleAccount *account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(chooser)); + PidginDiscoDialog *dialog = data; + PurpleAccount *account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(obj)); gboolean change = (account != dialog->account); dialog->account = account; g_simple_action_set_enabled(dialog->browse_action, account != NULL);
--- a/pidgin/plugins/disco/resources/disco.ui Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/plugins/disco/resources/disco.ui Fri Oct 28 23:37:16 2022 -0500 @@ -78,7 +78,7 @@ <object class="PidginAccountChooser" id="account_chooser"> <property name="model">xmpp_accounts</property> <property name="active">0</property> - <signal name="changed" handler="dialog_select_account_cb" object="PidginDiscoDialog" swapped="no"/> + <signal name="notify::account" handler="dialog_select_account_cb" swapped="no"/> </object> </child> </object>
--- a/pidgin/plugins/xmppconsole/console.ui Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/plugins/xmppconsole/console.ui Fri Oct 28 23:37:16 2022 -0500 @@ -120,7 +120,7 @@ </property> <property name="active">0</property> <property name="hexpand">1</property> - <signal name="changed" handler="dropdown_changed_cb" object="PidginXmppConsole" swapped="no"/> + <signal name="notify::account" handler="dropdown_changed_cb" swapped="no"/> </object> </child> </object>
--- a/pidgin/plugins/xmppconsole/xmppconsole.c Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/plugins/xmppconsole/xmppconsole.c Fri Oct 28 23:37:16 2022 -0500 @@ -482,9 +482,11 @@ } static void -dropdown_changed_cb(GtkComboBox *widget, gpointer data) { +dropdown_changed_cb(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec, + gpointer data) +{ PidginXmppConsole *console = data; - PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(widget); + PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(obj); PurpleAccount *account = NULL; account = pidgin_account_chooser_get_selected(chooser); @@ -592,7 +594,7 @@ pidgin_xmpp_console_init(PidginXmppConsole *console) { gtk_widget_init_template(GTK_WIDGET(console)); - dropdown_changed_cb(console->account_chooser, console); + dropdown_changed_cb(G_OBJECT(console->account_chooser), NULL, console); entry_changed_cb(console->entry_buffer, console); gtk_widget_show(GTK_WIDGET(console));
--- a/pidgin/resources/Dialogs/addbuddy.ui Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/resources/Dialogs/addbuddy.ui Fri Oct 28 23:37:16 2022 -0500 @@ -66,7 +66,7 @@ <object class="PidginAccountChooser" id="account"> <property name="hexpand">1</property> <property name="model">filter</property> - <signal name="changed" handler="pidgin_add_buddy_dialog_account_changed_cb" object="PidginAddBuddyDialog" swapped="no"/> + <signal name="notify::account" handler="pidgin_add_buddy_dialog_account_changed_cb" swapped="no"/> <accessibility> <relation name="labelled-by">label1</relation> </accessibility>
--- a/pidgin/resources/Dialogs/addchat.ui Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/resources/Dialogs/addchat.ui Fri Oct 28 23:37:16 2022 -0500 @@ -67,7 +67,7 @@ <object class="PidginAccountChooser" id="account"> <property name="hexpand">1</property> <property name="model">filter</property> - <signal name="changed" handler="pidgin_add_chat_dialog_account_changed_cb" object="PidginAddChatDialog" swapped="no"/> + <signal name="notify::account" handler="pidgin_add_chat_dialog_account_changed_cb" swapped="no"/> </object> </child> </object>
--- a/pidgin/resources/Privacy/dialog.ui Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/resources/Privacy/dialog.ui Fri Oct 28 23:37:16 2022 -0500 @@ -68,7 +68,7 @@ <property name="hexpand">1</property> <property name="model">connected_account_store</property> <property name="active">0</property> - <signal name="changed" handler="select_account_cb" object="PidginPrivacyDialog" swapped="no"/> + <signal name="notify::account" handler="select_account_cb" swapped="no"/> <accessibility> <relation name="labelled-by">label1</relation> </accessibility>
--- a/pidgin/resources/Roomlist/roomlist.ui Fri Oct 28 22:54:43 2022 -0500 +++ b/pidgin/resources/Roomlist/roomlist.ui Fri Oct 28 23:37:16 2022 -0500 @@ -49,7 +49,7 @@ <property name="can-focus">1</property> <property name="model">accounts</property> <property name="active">0</property> - <signal name="changed" handler="dialog_select_account_cb" object="PidginRoomlistDialog" swapped="no"/> + <signal name="notify::account" handler="dialog_select_account_cb" swapped="no"/> <accessibility> <relation name="labelled-by">label1</relation> </accessibility>