libpurple/purplecredentialprovider.c

Thu, 24 Apr 2025 21:42:59 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 24 Apr 2025 21:42:59 -0500
changeset 43241
e41969a43e42
parent 43071
071588186662
permissions
-rw-r--r--

Add Purple.Contact.is_own_account

This checks to see if a Purple.Contact shares the Purple.ContactInfo with the
account it is tied to.

Testing Done:
Ran the unit tests under valgrind and called in the turtles.

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

40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
40651
8737840a09b7 Fix some file headers for the credential provider api
Gary Kramlich <grim@reaperworld.com>
parents: 40548
diff changeset
2 * Purple - Internet Messaging Library
8737840a09b7 Fix some file headers for the credential provider api
Gary Kramlich <grim@reaperworld.com>
parents: 40548
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
7 * source distribution.
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
12 * any later version.
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
17 * more details.
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
18 *
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "purplecredentialprovider.h"
42997
368deff13c21 Split purpleprivate.h up into individual files
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
24 #include "purplecredentialproviderprivate.h"
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
25
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 typedef struct {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 gchar *id;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 gchar *name;
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
29 gchar *description;
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
30
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
31 GSettings *settings;
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 } PurpleCredentialProviderPrivate;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 enum {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 PROP_0,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 PROP_ID,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 PROP_NAME,
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
38 PROP_DESCRIPTION,
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
39 PROP_SETTINGS,
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 N_PROPERTIES,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 };
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PurpleCredentialProvider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 purple_credential_provider, G_TYPE_OBJECT)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 /******************************************************************************
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 * Helpers
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 *****************************************************************************/
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 purple_credential_provider_set_id(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 const gchar *id)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
58 if(g_set_str(&priv->id, id)) {
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
59 g_object_notify_by_pspec(G_OBJECT(provider), properties[PROP_ID]);
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
60 }
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 purple_credential_provider_set_name(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 const gchar *name)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
71 if(g_set_str(&priv->name, name)) {
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
72 g_object_notify_by_pspec(G_OBJECT(provider), properties[PROP_NAME]);
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
73 }
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
76 static void
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
77 purple_credential_provider_set_description(PurpleCredentialProvider *provider,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
78 const gchar *description)
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
79 {
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
80 PurpleCredentialProviderPrivate *priv = NULL;
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
81
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
82 priv = purple_credential_provider_get_instance_private(provider);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
83
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
84 if(g_set_str(&priv->description, description)) {
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
85 g_object_notify_by_pspec(G_OBJECT(provider), properties[PROP_DESCRIPTION]);
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
86 }
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
87 }
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
88
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
89 static void
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
90 purple_credential_provider_set_settings(PurpleCredentialProvider *provider,
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
91 GSettings *settings)
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
92 {
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
93 PurpleCredentialProviderPrivate *priv = NULL;
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
94
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
95 g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
96
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
97 priv = purple_credential_provider_get_instance_private(provider);
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
98
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
99 if(g_set_object(&priv->settings, settings)) {
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
100 g_object_notify_by_pspec(G_OBJECT(provider),
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
101 properties[PROP_SETTINGS]);
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
102 }
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
103 }
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
104
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 /******************************************************************************
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 * GObject Implementation
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 *****************************************************************************/
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 purple_credential_provider_get_property(GObject *obj, guint param_id,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 GValue *value, GParamSpec *pspec)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 switch(param_id) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 case PROP_ID:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 g_value_set_string(value,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 purple_credential_provider_get_id(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 case PROP_NAME:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 g_value_set_string(value,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 purple_credential_provider_get_name(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 break;
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
123 case PROP_DESCRIPTION:
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
124 g_value_set_string(value,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
125 purple_credential_provider_get_description(provider));
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
126 break;
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
127 case PROP_SETTINGS:
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
128 g_value_set_object(value,
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
129 purple_credential_provider_get_settings(provider));
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
130 break;
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 default:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 purple_credential_provider_set_property(GObject *obj, guint param_id,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 const GValue *value, GParamSpec *pspec)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 switch(param_id) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 case PROP_ID:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 purple_credential_provider_set_id(provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 g_value_get_string(value));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 case PROP_NAME:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 purple_credential_provider_set_name(provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 g_value_get_string(value));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 break;
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
152 case PROP_DESCRIPTION:
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
153 purple_credential_provider_set_description(provider,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
154 g_value_get_string(value));
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
155 break;
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
156 case PROP_SETTINGS:
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
157 purple_credential_provider_set_settings(provider,
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
158 g_value_get_object(value));
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
159 break;
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 default:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 purple_credential_provider_finalize(GObject *obj) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 PurpleCredentialProvider *provider = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 provider = PURPLE_CREDENTIAL_PROVIDER(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 g_clear_pointer(&priv->id, g_free);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 g_clear_pointer(&priv->name, g_free);
41149
c357390f7c22 Fix a number of memory leaks
Gary Kramlich <grim@reaperworld.com>
parents: 40823
diff changeset
176 g_clear_pointer(&priv->description, g_free);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
178 g_clear_object(&priv->settings);
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
179
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 G_OBJECT_CLASS(purple_credential_provider_parent_class)->finalize(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 static void
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41149
diff changeset
184 purple_credential_provider_init(G_GNUC_UNUSED PurpleCredentialProvider *provider)
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41149
diff changeset
185 {
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 purple_credential_provider_class_init(PurpleCredentialProviderClass *klass) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 obj_class->get_property = purple_credential_provider_get_property;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 obj_class->set_property = purple_credential_provider_set_property;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 obj_class->finalize = purple_credential_provider_finalize;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 /**
42303
52c26807d91a Fix a number of issues with the documentation for properties
Gary Kramlich <grim@reaperworld.com>
parents: 41985
diff changeset
197 * PurpleCredentialProvider:id:
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 * The ID of the provider. Used for preferences and other things that need
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 * to address it.
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
201 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
202 * Since: 3.0
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 */
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 properties[PROP_ID] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42997
diff changeset
205 "id", NULL, NULL,
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 NULL,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 );
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 /**
42303
52c26807d91a Fix a number of issues with the documentation for properties
Gary Kramlich <grim@reaperworld.com>
parents: 41985
diff changeset
211 * PurpleCredentialProvider:name:
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 * The name of the provider which will be displayed to the user.
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
214 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
215 * Since: 3.0
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 */
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 properties[PROP_NAME] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42997
diff changeset
218 "name", NULL, NULL,
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 NULL,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 );
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
223 /**
42303
52c26807d91a Fix a number of issues with the documentation for properties
Gary Kramlich <grim@reaperworld.com>
parents: 41985
diff changeset
224 * PurpleCredentialProvider:description:
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
225 *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
226 * The description of the provider which will be displayed to the user.
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
227 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
228 * Since: 3.0
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
229 */
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
230 properties[PROP_DESCRIPTION] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42997
diff changeset
231 "description", NULL, NULL,
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
232 NULL,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
233 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
234 );
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
235
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
236 /**
42303
52c26807d91a Fix a number of issues with the documentation for properties
Gary Kramlich <grim@reaperworld.com>
parents: 41985
diff changeset
237 * PurpleCredentialProvider:settings:
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
238 *
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
239 * The [class@Gio.Settings] used to configure the provider. This may be
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
240 * %NULL.
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
241 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
242 * Since: 3.0
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
243 */
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
244 properties[PROP_SETTINGS] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42997
diff changeset
245 "settings", NULL, NULL,
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
246 G_TYPE_SETTINGS,
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
247 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
248
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 /******************************************************************************
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
253 * Private API
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
254 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
255 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
256 purple_credential_provider_activate(PurpleCredentialProvider *provider) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
257 PurpleCredentialProviderClass *klass = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
258
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
259 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
260 if(klass && klass->activate) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
261 klass->activate(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
262 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
263 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
264
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
265 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
266 purple_credential_provider_deactivate(PurpleCredentialProvider *provider) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
267 PurpleCredentialProviderClass *klass = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
268
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
269 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
270 if(klass && klass->deactivate) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
271 klass->deactivate(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
272 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
273 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
274
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
275 /******************************************************************************
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 * Public API
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 *****************************************************************************/
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 const gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 purple_credential_provider_get_id(PurpleCredentialProvider *provider) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 return priv->id;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 const gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 purple_credential_provider_get_name(PurpleCredentialProvider *provider) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 return priv->name;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
300 const gchar *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
301 purple_credential_provider_get_description(PurpleCredentialProvider *provider) {
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
302 PurpleCredentialProviderPrivate *priv = NULL;
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
303
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
304 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
305
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
306 priv = purple_credential_provider_get_instance_private(provider);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
307
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
308 return priv->description;
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
309 }
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
310
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 purple_credential_provider_is_valid(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 if(purple_credential_provider_get_id(provider) == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 0,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 "provider has no id");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 if(purple_credential_provider_get_name(provider) == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 1,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 "provider has no name");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 if(klass->read_password_async == NULL || klass->read_password_finish == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 2,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 "provider can not read passwords");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 if(klass->write_password_async == NULL || klass->write_password_finish == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 3,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 "provider can not write passwords");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 return TRUE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 purple_credential_provider_read_password_async(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 if(klass && klass->read_password_async) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 klass->read_password_async(provider, account, cancellable, callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 data);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371 gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372 purple_credential_provider_read_password_finish(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
378 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382 if(klass && klass->read_password_finish) {
40679
062a4574af3e Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents: 40651
diff changeset
383 return klass->read_password_finish(provider, result, error);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
384 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386 return NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 purple_credential_provider_write_password_async(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 const gchar *password,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399 g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
403 if(klass && klass->write_password_async) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
404 klass->write_password_async(provider, account, password, cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
405 callback, data);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
406 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
407 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
408
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
409 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410 purple_credential_provider_write_password_finish(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
411 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
412 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
415
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
416 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
417 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
418
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
420 if(klass && klass->write_password_finish) {
40679
062a4574af3e Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents: 40651
diff changeset
421 return klass->write_password_finish(provider, result, error);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
422 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
423
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
425 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
426
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
427 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
428 purple_credential_provider_clear_password_async(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
429 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
430 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
431 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
432 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
433 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
434 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
435
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
436 g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
437 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
438
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
439 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
440 if(klass && klass->clear_password_async) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
441 klass->clear_password_async(provider, account, cancellable, callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
442 data);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
443 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
444 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
445
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
446 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
447 purple_credential_provider_clear_password_finish(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
448 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
449 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
450 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
451 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
452
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
453 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
454 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
455
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
456 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
457 if(klass && klass->clear_password_finish) {
40679
062a4574af3e Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents: 40651
diff changeset
458 return klass->clear_password_finish(provider, result, error);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
459 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
460
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
461 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
462 }
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
463
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
464 GSettings *
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
465 purple_credential_provider_get_settings(PurpleCredentialProvider *provider) {
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
466 PurpleCredentialProviderPrivate *priv = NULL;
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
467
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
468 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
469
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
470 priv = purple_credential_provider_get_instance_private(provider);
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
471
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
472 return priv->settings;
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
473 }

mercurial