pidgin/prefs/pidgincredentialprefs.c

Fri, 14 Feb 2025 13:10:24 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 14 Feb 2025 13:10:24 -0600
changeset 43177
595a5f31003a
parent 43049
a39744d00ece
permissions
-rw-r--r--

Annotate Pidgin constructors that return base types

In that case, annotating the actual type will help bindings use the correct type.

Testing Done:
Compared the gir before and after, and types were more specific:
```diff
--- Pidgin-3.0.gir 2025-02-14 01:13:40.813791641 -0500
+++ build/pidgin/Pidgin-3.0.gir 2025-02-14 03:05:58.968098262 -0500
@@ -54,8 +54,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginabout.h"
- line="58">A new instance of the about dialog.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="58">The new about dialog.</doc>
+ <type name="AboutDialog" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="application"
@@ -100,12 +100,13 @@
<doc xml:space="preserve"
filename="pidgin/pidginaccountchooser.h"
line="52">Creates a combo box filled with accounts.</doc>
- <source-position filename="pidgin/pidginaccountchooser.h" line="62"/>
+ <source-position filename="pidgin/pidginaccountchooser.h" line="63"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginaccountchooser.h"
- line="57">The account chooser combo box.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="57">The new account
+ chooser combo box.</doc>
+ <type name="AccountChooser" c:type="GtkWidget*"/>
</return-value>
</constructor>
<method name="get_filter"
@@ -258,12 +259,13 @@
<doc xml:space="preserve"
filename="pidgin/pidginaccountdisplay.h"
line="52">Creates a display for an account.</doc>
- <source-position filename="pidgin/pidginaccountdisplay.h" line="63"/>
+ <source-position filename="pidgin/pidginaccountdisplay.h" line="64"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginaccountdisplay.h"
- line="58">The account display.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="58">The new account
+ display.</doc>
+ <type name="AccountDisplay" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="account" transfer-ownership="none">
@@ -371,8 +373,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginaccounteditor.h"
- line="61">The new instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="61">The new account editor.</doc>
+ <type name="AccountEditor" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="account"
@@ -542,8 +544,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginaccountfilterconnected.h"
- line="60">The new #PidginAccountFilterConnected instance.</doc>
- <type name="Gtk.Filter" c:type="GtkFilter*"/>
+ line="60">The new filter.</doc>
+ <type name="AccountFilterConnected" c:type="GtkFilter*"/>
</return-value>
</constructor>
</class>
@@ -585,8 +587,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginaccountfilterprotocol.h"
- line="61">The new #PidginAccountFilterProtocol instance.</doc>
- <type name="Gtk.Filter" c:type="GtkFilter*"/>
+ line="61">The new filter.</doc>
+ <type name="AccountFilterProtocol" c:type="GtkFilter*"/>
</return-value>
<parameters>
<parameter name="protocol_id" transfer-ownership="none">
@@ -673,7 +675,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginaccountmanager.h"
line="58">The dialog.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="AccountManager" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="application"
@@ -770,7 +772,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginaccountmanagerrow.h"
line="58">The new account row.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="AccountManagerRow" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="account"
@@ -887,7 +889,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginaccountrow.h"
line="62">The new instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="AccountRow" c:type="GtkWidget*"/>
</return-value>
</constructor>
<method name="get_account"
@@ -1056,8 +1058,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginaccountsdisabledmenu.h"
- line="60">The new menu instance.</doc>
- <type name="Gio.MenuModel" c:type="GMenuModel*"/>
+ line="60">The new instance.</doc>
+ <type name="AccountsDisabledMenu" c:type="GMenuModel*"/>
</return-value>
</constructor>
</class>
@@ -1097,8 +1099,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginaccountsenabledmenu.h"
- line="60">The new menu instance.</doc>
- <type name="Gio.MenuModel" c:type="GMenuModel*"/>
+ line="60">The new instance.</doc>
+ <type name="AccountsEnabledMenu" c:type="GMenuModel*"/>
</return-value>
</constructor>
</class>
@@ -1137,8 +1139,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginapplication.h"
- line="59">The new #PidginApplication instance.</doc>
- <type name="Gio.Application" c:type="GApplication*"/>
+ line="59">The new instance.</doc>
+ <type name="Application" c:type="GApplication*"/>
</return-value>
</constructor>
<method name="add_action_group"
@@ -1237,8 +1239,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginautoadjustment.h"
- line="61">The new #PidginAutoAdjustment instance.</doc>
- <type name="Gtk.Adjustment" c:type="GtkAdjustment*"/>
+ line="61">The new instance.</doc>
+ <type name="AutoAdjustment" c:type="GtkAdjustment*"/>
</return-value>
</constructor>
<method name="decrement"
@@ -1314,8 +1316,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginavatar.h"
- line="59">The new #PidginAvatar instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="59">The new instance.</doc>
+ <type name="Avatar" c:type="GtkWidget*"/>
</return-value>
</constructor>
<method name="get_animate"
@@ -1544,8 +1546,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/prefs/pidginawayprefs.h"
- line="58">The new #PidginAwayPrefs instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="58">The new instance.</doc>
+ <type name="AwayPrefs" c:type="GtkWidget*"/>
</return-value>
</constructor>
</class>
@@ -1583,7 +1585,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginbadges.h"
line="59">The new widget.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="Badges" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="badges" transfer-ownership="none">
@@ -1696,8 +1698,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginchanneljoindialog.h"
- line="56">The widget.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="56">The new widget.</doc>
+ <type name="ChannelJoinDialog" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="application"
@@ -1750,8 +1752,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidgincontactlist.h"
- line="62">The new #PidginContactList instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="62">The new instance.</doc>
+ <type name="ContactList" c:type="GtkWidget*"/>
</return-value>
</constructor>
</class>
@@ -1791,7 +1793,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginconversation.h"
line="62">The new widget.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="Conversation" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="conversation" transfer-ownership="none">
@@ -1914,12 +1916,13 @@
filename="pidgin/pidginconversationmember.h"
line="52">Creates a display for a conversation member.</doc>
<source-position filename="pidgin/pidginconversationmember.h"
- line="63"/>
+ line="64"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginconversationmember.h"
- line="58">The conversation member display.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="58">The conversation
+ member display.</doc>
+ <type name="ConversationMember" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="conversation_member" transfer-ownership="none">
@@ -2033,8 +2036,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/prefs/pidginconversationprefs.h"
- line="58">The new #PidginConversationPrefs instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="58">The new instance.</doc>
+ <type name="ConversationPrefs" c:type="GtkWidget*"/>
</return-value>
</constructor>
</class>
@@ -2077,8 +2080,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/prefs/pidgincredentialprefs.h"
- line="66">The new #PidginCredentialPrefs instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="66">The new instance.</doc>
+ <type name="CredentialPrefs" c:type="GtkWidget*"/>
</return-value>
</constructor>
</class>
@@ -2116,20 +2119,21 @@
version="3.0">
<doc xml:space="preserve"
filename="pidgin/prefs/pidgincredentialproviderrow.h"
- line="63">Creates a new #PidginCredentialProviderRow instance.</doc>
+ line="65">Creates a new #PidginCredentialProviderRow instance.</doc>
<source-position filename="pidgin/prefs/pidgincredentialproviderrow.h"
- line="74"/>
+ line="77"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/prefs/pidgincredentialproviderrow.h"
- line="69">The new #PidginCredentialProviderRow instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="71">The new
+ instance.</doc>
+ <type name="CredentialProviderRow" c:type="GtkWidget*"/>
</return-value>
@@ -2835,8 +2839,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidgindisplaywindow.h"
- line="60">The new #PidginDisplayWindow instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="60">The new instance.</doc>
+ <type name="DisplayWindow" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="application"
@@ -3163,8 +3167,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidgininfopane.h"
- line="60">The new #PidginInfoPane instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="60">The new instance.</doc>
+ <type name="InfoPane" c:type="GtkWidget*"/>
</return-value>
</constructor>
<method name="get_child"
@@ -3395,7 +3399,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginkeypad.h"
line="57">The new instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="Keypad" c:type="GtkWidget*"/>
</return-value>
</constructor>
<method name="set_key_capture_widget"
@@ -3478,7 +3482,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginmessage.h"
line="59">The new instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="Message" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="message"
@@ -3586,8 +3590,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/prefs/pidginnetworkprefs.h"
- line="58">The new #PidginNetworkPrefs instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="58">The new instance.</doc>
+ <type name="NetworkPrefs" c:type="GtkWidget*"/>
</return-value>
</constructor>
</class>
@@ -3735,7 +3739,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginnotification.h"
line="74">The new instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="Notification" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="notification" transfer-ownership="none">
@@ -3885,9 +3889,9 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginnotificationaddcontact.h"
- line="66">The new #PidginNotificationAddContact
+ line="66">The new
instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="NotificationAddContact" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="notification" transfer-ownership="none">
@@ -3941,9 +3945,9 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginnotificationauthorizationrequest.h"
- line="66">The new #PidginNotificationAuthorizationRequest
- instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="66">The
+ new instance.</doc>
+ <type name="NotificationAuthorizationRequest" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="notification" transfer-ownership="none">
@@ -4006,12 +4010,13 @@
line="60">Creates a new #PidginNotificationConnectionError instance that will display
@notification.</doc>
<source-position filename="pidgin/pidginnotificationconnectionerror.h"
- line="72"/>
+ line="73"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginnotificationconnectionerror.h"
- line="67">The new instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="67">The new
+ instance.</doc>
+ <type name="NotificationConnectionError" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="notification" transfer-ownership="none">
@@ -4063,8 +4068,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginnotificationlink.h"
- line="64">The new #PidginNotificationLink instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="64">The new instance.</doc>
+ <type name="NotificationLink" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="notification" transfer-ownership="none">
@@ -4114,8 +4119,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginnotificationlist.h"
- line="59">The new #PidginNotificationList instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="59">The new instance.</doc>
+ <type name="NotificationList" c:type="GtkWidget*"/>
</return-value>
</constructor>
</class>
@@ -4161,8 +4166,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginpluginsmenu.h"
- line="56">The new #PidginPluginsMenu instance.</doc>
- <type name="Gio.MenuModel" c:type="GMenuModel*"/>
+ line="56">The new instance.</doc>
+ <type name="PluginsMenu" c:type="GMenuModel*"/>
</return-value>
</constructor>
</class>
@@ -4232,7 +4237,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginpresenceicon.h"
line="61">The new presence icon.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="PresenceIcon" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="presence"
@@ -4475,12 +4480,13 @@
<doc xml:space="preserve"
filename="pidgin/pidginprotocolchooser.h"
line="54">Creates a drop down for a user to select a protocol from.</doc>
- <source-position filename="pidgin/pidginprotocolchooser.h" line="64"/>
+ <source-position filename="pidgin/pidginprotocolchooser.h" line="65"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/pidginprotocolchooser.h"
- line="59">The protocol chooser drop down.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="59">The protocol chooser
+ drop down.</doc>
+ <type name="ProtocolChooser" c:type="GtkWidget*"/>
</return-value>
</constructor>
<method name="get_protocol"
@@ -4581,8 +4587,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="pidgin/prefs/pidginproxyprefs.h"
- line="58">The new #PidginProxyPrefs instance.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ line="58">The new instance.</doc>
+ <type name="ProxyPrefs" c:type="GtkWidget*"/>
</return-value>
</constructor>
</class>
@@ -4624,7 +4630,7 @@
<doc xml:space="preserve"
filename="pidgin/pidgintypinglabel.h"
line="60">The new widget.</doc>
- <type name="Gtk.Widget" c:type="GtkWidget*"/>
+ <type name="TypingLabel" c:type="GtkWidget*"/>
</return-value>
<parameters>
<parameter name="conversation" transfer-ownership="none">
@@ -4745,7 +4751,7 @@
<doc xml:space="preserve"
filename="pidgin/pidginui.h"
line="60">The new instance.</doc>
- <type name="Purple.Ui" c:type="PurpleUi*"/>
+ <type name="Ui" c:type="PurpleUi*"/>
</return-value>
</constructor>
</class>
```

Reviewed at https://reviews.imfreedom.org/r/3838/

40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <purple.h>
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
41520
a5dd595361b4 Replace libhandy with libadwaita
Gary Kramlich <grim@reaperworld.com>
parents: 41375
diff changeset
25 #include <adwaita.h>
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
26
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
27 #include "pidgincredentialprefs.h"
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
29 #include "pidgincredentialproviderrow.h"
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
31 struct _PidginCredentialPrefs {
41520
a5dd595361b4 Replace libhandy with libadwaita
Gary Kramlich <grim@reaperworld.com>
parents: 41375
diff changeset
32 AdwPreferencesPage parent;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
34 GtkWidget *credential_list;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 };
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36
42575
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
37 G_DEFINE_FINAL_TYPE(PidginCredentialPrefs, pidgin_credential_prefs,
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
38 ADW_TYPE_PREFERENCES_PAGE)
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 /******************************************************************************
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 * Helpers
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 *****************************************************************************/
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
43 static GtkWidget *
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
44 pidgin_credential_prefs_create_row(GObject *item,
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
45 G_GNUC_UNUSED gpointer data)
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
46 {
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
47 return pidgin_credential_provider_row_new(PURPLE_CREDENTIAL_PROVIDER(item));
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
48 }
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
50 static int
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
51 pidgin_credential_prefs_sort_rows(gconstpointer a, gconstpointer b,
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
52 G_GNUC_UNUSED gpointer user_data)
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
53 {
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
54 PurpleCredentialProvider *provider_a = (gpointer)a;
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
55 PurpleCredentialProvider *provider_b = (gpointer)b;
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
56 const char *id1 = NULL;
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
57 gboolean is_noop1 = FALSE;
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
58 const char *id2 = NULL;
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
59 gboolean is_noop2 = FALSE;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
61 id1 = purple_credential_provider_get_id(provider_a);
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
62 is_noop1 = purple_strequal(id1, "noop-provider");
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
64 id2 = purple_credential_provider_get_id(provider_b);
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
65 is_noop2 = purple_strequal(id2, "noop-provider");
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
67 /* Sort None provider after everything else. */
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
68 if (is_noop1 && is_noop2) {
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
69 return 0;
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
70 } else if (is_noop1 && !is_noop2) {
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
71 return 1;
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
72 } else if (!is_noop1 && is_noop2) {
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
73 return -1;
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
74 }
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
75
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
76 /* Sort normally by ID. */
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
77 return g_strcmp0(id1, id2);
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
78 }
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
80 static void
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41659
diff changeset
81 pidgin_credential_prefs_list_row_activated_cb(G_GNUC_UNUSED GtkListBox *box,
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
82 GtkListBoxRow *row,
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
83 G_GNUC_UNUSED gpointer data)
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
84 {
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
85 PurpleCredentialManager *manager = NULL;
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
86 PurpleCredentialProvider *provider = NULL;
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
87 const char *id = NULL;
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
88 GError *error = NULL;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
90 provider = pidgin_credential_provider_row_get_provider(
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
91 PIDGIN_CREDENTIAL_PROVIDER_ROW(row));
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
92 id = purple_credential_provider_get_id(provider);
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
93
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
94 manager = purple_credential_manager_get_default();
40987
671f2442e50e Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents: 40886
diff changeset
95 if(purple_credential_manager_set_active(manager, id, &error)) {
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
96 return;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 }
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
98
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
99 purple_debug_warning("credential-prefs", "failed to set the active "
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
100 "credential provider to '%s': %s",
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
101 id, error ? error->message : "unknown error");
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
102
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
103 g_clear_error(&error);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 static void
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
107 pidgin_credential_prefs_set_active_provider(PidginCredentialPrefs *prefs,
41659
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
108 PurpleCredentialProvider *active)
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 {
41535
0dee7089dc5a Convert Pidgin credentials prefs page to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41520
diff changeset
110 GtkWidget *child = NULL;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111
41535
0dee7089dc5a Convert Pidgin credentials prefs page to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41520
diff changeset
112 for (child = gtk_widget_get_first_child(prefs->credential_list);
0dee7089dc5a Convert Pidgin credentials prefs page to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41520
diff changeset
113 child;
0dee7089dc5a Convert Pidgin credentials prefs page to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41520
diff changeset
114 child = gtk_widget_get_next_sibling(child))
0dee7089dc5a Convert Pidgin credentials prefs page to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41520
diff changeset
115 {
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
116 PidginCredentialProviderRow *row = NULL;
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
117 PurpleCredentialProvider *provider = NULL;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118
41535
0dee7089dc5a Convert Pidgin credentials prefs page to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41520
diff changeset
119 row = PIDGIN_CREDENTIAL_PROVIDER_ROW(child);
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
120 provider = pidgin_credential_provider_row_get_provider(row);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121
41659
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
122 pidgin_credential_provider_row_set_active(row, provider == active);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 static void
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41659
diff changeset
127 pidgin_credential_prefs_active_provider_changed_cb(G_GNUC_UNUSED PurpleCredentialManager *manager,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41659
diff changeset
128 G_GNUC_UNUSED PurpleCredentialProvider *previous,
41659
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
129 PurpleCredentialProvider *current,
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 gpointer data)
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 {
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
132 PidginCredentialPrefs *prefs = PIDGIN_CREDENTIAL_PREFS(data);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
41659
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
134 pidgin_credential_prefs_set_active_provider(prefs, current);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 /******************************************************************************
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
138 * GObject Implementation
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 *****************************************************************************/
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 static void
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
141 pidgin_credential_prefs_init(PidginCredentialPrefs *prefs) {
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
142 PurpleCredentialManager *manager = NULL;
41659
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
143 PurpleCredentialProvider *active = NULL;
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
144 GtkCustomSorter *sorter = NULL;
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
145 GtkSortListModel *sorted = NULL;
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
146 GListModel *model = NULL;
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
148 gtk_widget_init_template(GTK_WIDGET(prefs));
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149
43049
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
150 sorter = gtk_custom_sorter_new(pidgin_credential_prefs_sort_rows, NULL,
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
151 NULL);
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
152
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
153 model = purple_credential_manager_get_default_as_model();
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
154 sorted = gtk_sort_list_model_new(model, GTK_SORTER(sorter));
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
155 gtk_list_box_bind_model(GTK_LIST_BOX(prefs->credential_list),
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
156 G_LIST_MODEL(sorted),
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
157 (GtkListBoxCreateWidgetFunc)pidgin_credential_prefs_create_row,
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
158 prefs->credential_list, NULL);
a39744d00ece Update Pidgin for the Purple.CredentialManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
159
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
160 manager = purple_credential_manager_get_default();
41659
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
161 g_signal_connect_object(manager, "active-changed",
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
162 G_CALLBACK(pidgin_credential_prefs_active_provider_changed_cb),
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
163 prefs, 0);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164
41659
c6edf4d87185 Use Credential Manager API for Pidgin prefs page
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41535
diff changeset
165 active = purple_credential_manager_get_active(manager);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 if(active != NULL) {
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
167 pidgin_credential_prefs_set_active_provider(prefs, active);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 static void
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
172 pidgin_credential_prefs_class_init(PidginCredentialPrefsClass *klass) {
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 gtk_widget_class_set_template_from_resource(
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 widget_class,
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
177 "/im/pidgin/Pidgin3/Prefs/credentials.ui"
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 );
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
180 gtk_widget_class_bind_template_child(widget_class, PidginCredentialPrefs,
40873
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
181 credential_list);
68c7ef6c5320 Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40790
diff changeset
182 gtk_widget_class_bind_template_callback(widget_class,
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
183 pidgin_credential_prefs_list_row_activated_cb);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 /******************************************************************************
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 * API
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 *****************************************************************************/
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 GtkWidget *
41375
e7f3a586b63f Rename PidginCredentialsPage to PidginCredentialPrefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41128
diff changeset
190 pidgin_credential_prefs_new(void) {
42592
6b65c0e4ba15 Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
191 return g_object_new(PIDGIN_TYPE_CREDENTIAL_PREFS, NULL);
40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 }

mercurial