libpurple/purplecredentialprovider.c

Fri, 04 Oct 2024 00:48:33 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 04 Oct 2024 00:48:33 -0500
changeset 42997
368deff13c21
parent 42767
8cf1d11b59c1
child 43071
071588186662
permissions
-rw-r--r--

Split purpleprivate.h up into individual files

purpleprivate.h got over used and was poorly maintained previously. By breaking
it up to separate files they will be easier to maintain and should be less
likely to be included when they're not necessary.

Testing Done:
Called in the turtles and ran in a devenv.

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

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(
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 "id", "id", "The identifier of the provider",
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(
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 "name", "name", "The name of the provider",
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(
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
231 "description", "description", "The description of the provider",
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(
42565
c035e2eba80d Fix several minor typos
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42303
diff changeset
245 "settings", "settings",
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
246 "The GSettings for the provider",
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
247 G_TYPE_SETTINGS,
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
248 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
249
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 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
251 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 /******************************************************************************
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
254 * Private API
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
255 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
256 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
257 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
258 PurpleCredentialProviderClass *klass = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
259
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
260 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
261 if(klass && klass->activate) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
262 klass->activate(provider);
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
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
266 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
267 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
268 PurpleCredentialProviderClass *klass = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
269
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
270 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
271 if(klass && klass->deactivate) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
272 klass->deactivate(provider);
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
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
276 /******************************************************************************
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 * Public API
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 *****************************************************************************/
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 const gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 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
281 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 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
284
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 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
286
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 return priv->id;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 const gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 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
292 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 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
295
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 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
297
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 return priv->name;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
301 const gchar *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
302 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
303 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
304
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
305 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
306
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
307 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
308
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
309 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
310 }
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
311
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 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
314 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 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
319
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 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
321 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
322 "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
323
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 return FALSE;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 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
328 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
329 "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
330
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 return FALSE;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 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
335
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 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
337 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
338 "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
339
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 return FALSE;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 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
344 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
345 "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
346
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 return FALSE;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 return TRUE;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 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
355 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361
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_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 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
364
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 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
366 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
367 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
368 data);
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372 gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 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
374 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
378
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(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
380 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
381
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382 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
383 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
384 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
385 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 return NULL;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 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
392 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 const gchar *password,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399
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_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401 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
402
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
403 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
404 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
405 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
406 callback, data);
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
411 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
412 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
415 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
416
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(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
418 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
419
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
420 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
421 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
422 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
423 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
425 return FALSE;
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
428 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
429 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
430 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
431 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
432 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
433 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
434 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
435 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
436
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_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
438 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
439
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
440 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
441 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
442 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
443 data);
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
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
447 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
448 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
449 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
450 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
451 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
452 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
453
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(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
455 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
456
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
457 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
458 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
459 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
460 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
461
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
462 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
463 }
41985
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
464
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
465 GSettings *
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
466 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
467 PurpleCredentialProviderPrivate *priv = NULL;
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
468
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
469 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
470
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
471 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
472
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
473 return priv->settings;
08b6b45431c9 Add a settings property to PurpleCredentialProvider that is a GSettings object
Gary Kramlich <grim@reaperworld.com>
parents: 41982
diff changeset
474 }

mercurial