Sun, 24 Jan 2021 05:27:03 -0600
Create a new PidginCredentialsPage and associated widgets for the preferences window
Testing Done:
Compiled and ran locally with the secret service provider from https://reviews.imfreedom.org/r/401/
Reviewed at https://reviews.imfreedom.org/r/402/
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib/gi18n-lib.h> |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include "purplecredentialmanager.h" |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | #include "purpleprivate.h" |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | enum { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | SIG_PROVIDER_REGISTERED, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | SIG_PROVIDER_UNREGISTERED, |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
27 | SIG_ACTIVE_PROVIDER_CHANGED, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | N_SIGNALS, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | }; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | static guint signals[N_SIGNALS] = {0, }; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | typedef struct { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | GHashTable *providers; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | PurpleCredentialProvider *active_provider; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | } PurpleCredentialManagerPrivate; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleCredentialManager, purple_credential_manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | G_TYPE_OBJECT); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | static PurpleCredentialManager *default_manager = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | * Async Callbacks |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | purple_credential_manager_read_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
53 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | gchar *password = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
56 | password = purple_credential_provider_read_password_finish(provider, res, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | &error); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
60 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
62 | g_task_return_pointer(task, password, g_free); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | /* Clean up our initial reference to the task. */ |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
66 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | purple_credential_manager_write_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
76 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | gboolean ret = FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
79 | ret = purple_credential_provider_write_password_finish(provider, res, |
|
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
80 | &error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
83 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
85 | g_task_return_boolean(task, ret); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | /* Clean up our initial reference to the task. */ |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
89 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | purple_credential_manager_clear_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
99 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | gboolean ret = FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
102 | ret = purple_credential_provider_clear_password_finish(provider, res, |
|
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
103 | &error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
106 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
108 | g_task_return_boolean(task, ret); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | /* Clean up our initial reference to the task. */ |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
112 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | * GObject Implementation |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | purple_credential_manager_finalize(GObject *obj) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | PurpleCredentialManager *manager = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | manager = PURPLE_CREDENTIAL_MANAGER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | g_clear_pointer(&priv->providers, g_hash_table_destroy); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | g_clear_object(&priv->active_provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | G_OBJECT_CLASS(purple_credential_manager_parent_class)->finalize(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | purple_credential_manager_init(PurpleCredentialManager *manager) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | priv->providers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | g_object_unref); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | purple_credential_manager_class_init(PurpleCredentialManagerClass *klass) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | obj_class->finalize = purple_credential_manager_finalize; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | /** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | * PurpleCredentialManager::provider-registered: |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | * @manager: The #PurpleCredentialManager instance. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | * @provider: The #PurpleCredentialProvider that was registered. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | * Emitted after @provider has been registered in @manager. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
155 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
156 | * Since: 3.0.0 |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | */ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | signals[SIG_PROVIDER_REGISTERED] = g_signal_new( |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | "provider-registered", |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | G_OBJECT_CLASS_TYPE(klass), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | G_SIGNAL_RUN_LAST, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | G_STRUCT_OFFSET(PurpleCredentialManagerClass, provider_registered), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | G_TYPE_NONE, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | 1, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | /** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | * PurpleCredentialManager::provider-unregistered: |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | * @manager: The #PurpleCredentialManager instance. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | * @provider: The #PurpleCredentialProvider that was unregistered. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | * Emitted after @provider has been unregistered from @manager. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
176 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
177 | * Since: 3.0.0 |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | */ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | signals[SIG_PROVIDER_UNREGISTERED] = g_signal_new( |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | "provider-unregistered", |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | G_OBJECT_CLASS_TYPE(klass), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | G_SIGNAL_RUN_LAST, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | G_STRUCT_OFFSET(PurpleCredentialManagerClass, provider_unregistered), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | G_TYPE_NONE, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | 1, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
190 | |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
191 | /** |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
192 | * PurpleCredentialManager::active-provider-changed: |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
193 | * @manager: The #PurpleCredentialManager instance. |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
194 | * @old: The #PurpleCredentialProvider that was previously active. |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
195 | * @current: The #PurpleCredentialProvider that is now currently active. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
196 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
197 | * Emitted after @provider has become the active provider for @manager. |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
198 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
199 | * Since: 3.0.0 |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
200 | */ |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
201 | signals[SIG_ACTIVE_PROVIDER_CHANGED] = g_signal_new( |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
202 | "active-provider-changed", |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
203 | G_OBJECT_CLASS_TYPE(klass), |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
204 | G_SIGNAL_RUN_LAST, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
205 | G_STRUCT_OFFSET(PurpleCredentialManagerClass, active_provider_changed), |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
206 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
207 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
208 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
209 | G_TYPE_NONE, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
210 | 2, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
211 | PURPLE_TYPE_CREDENTIAL_PROVIDER, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
212 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | * Private API |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | purple_credential_manager_startup(void) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | if(default_manager == NULL) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | default_manager = g_object_new(PURPLE_TYPE_CREDENTIAL_MANAGER, NULL); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | purple_credential_manager_shutdown(void) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | g_clear_object(&default_manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | * Public API |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | PurpleCredentialManager * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | purple_credential_manager_get_default(void) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | return default_manager; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | purple_credential_manager_register_provider(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | PurpleCredentialProvider *provider, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | const gchar *id = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | if(!purple_credential_provider_is_valid(provider, error)) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | /* purple_credential_provider_is_valid sets the error on failure. */ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | id = purple_credential_provider_get_id(provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | if(g_hash_table_lookup(priv->providers, id) != NULL) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | _("provider %s is already registered"), id); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | g_hash_table_insert(priv->providers, g_strdup(id), g_object_ref(provider)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | g_signal_emit(G_OBJECT(manager), signals[SIG_PROVIDER_REGISTERED], 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | purple_credential_manager_unregister_provider(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | PurpleCredentialProvider *provider, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | const gchar *id = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | id = purple_credential_provider_get_id(provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | if(provider == priv->active_provider) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | _("provider %s is currently in use"), id); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | if(g_hash_table_remove(priv->providers, id)) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | g_signal_emit(G_OBJECT(manager), signals[SIG_PROVIDER_UNREGISTERED], 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | _("provider %s is not registered"), id); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | purple_credential_manager_set_active_provider(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | const gchar *id, GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | PurpleCredentialManagerPrivate *priv = NULL; |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
312 | PurpleCredentialProvider *old = NULL, *provider = NULL; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
318 | /* First look up the new provider if we're given one. */ |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
319 | if(id != NULL) { |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
320 | provider = g_hash_table_lookup(priv->providers, id); |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
321 | if(!PURPLE_IS_CREDENTIAL_PROVIDER(provider)) { |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
322 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
323 | "no credential provider found with id %s", id); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
325 | return FALSE; |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
326 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
329 | if(PURPLE_IS_CREDENTIAL_PROVIDER(priv->active_provider)) { |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
330 | old = PURPLE_CREDENTIAL_PROVIDER(g_object_ref(priv->active_provider)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
333 | if(g_set_object(&priv->active_provider, provider)) { |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
334 | g_signal_emit(G_OBJECT(manager), signals[SIG_ACTIVE_PROVIDER_CHANGED], |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
335 | 0, old, priv->active_provider); |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
336 | } |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
337 | |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
338 | g_clear_object(&old); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
343 | PurpleCredentialProvider * |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
344 | purple_credential_manager_get_active_provider(PurpleCredentialManager *manager) |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
345 | { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
346 | PurpleCredentialManagerPrivate *priv = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
347 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
348 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), NULL); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
349 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
350 | priv = purple_credential_manager_get_instance_private(manager); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
351 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
352 | return priv->active_provider; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
353 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
354 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | purple_credential_manager_read_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
362 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
366 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
367 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
368 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
369 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | task = g_task_new(manager, cancellable, callback, data); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
371 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | if(priv->active_provider == NULL) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | GError *error = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | error = g_error_new_literal(PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
376 | _("can not read password, no active " |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
377 | "credential provider")); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
378 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | g_task_return_error(task, error); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
381 | return; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | purple_credential_provider_read_password_async(priv->active_provider, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | purple_credential_manager_read_password_callback, |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
388 | task); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
391 | gchar * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | purple_credential_manager_read_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
394 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), NULL); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
398 | return g_task_propagate_pointer(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | purple_credential_manager_write_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
403 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
404 | const gchar *password, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
409 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
410 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
411 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
412 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
414 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
416 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
417 | task = g_task_new(manager, cancellable, callback, data); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
418 | |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
419 | if(!purple_account_get_remember_password(account)) { |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
420 | GError *error = NULL; |
|
40684
a0c11a532ee7
Fix some broken unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
40680
diff
changeset
|
421 | const gchar *name = purple_account_get_username(account); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
422 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
423 | error = g_error_new(PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
424 | _("account \"%s\" is not marked to be stored"), |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
425 | name); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
426 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
427 | g_task_return_error(task, error); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
428 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
429 | return; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
430 | } |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
431 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
432 | if(priv->active_provider == NULL) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
433 | GError *error = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
434 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
435 | error = g_error_new_literal(PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
436 | _("can not write password, no active " |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
437 | "credential provider")); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
438 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
439 | g_task_return_error(task, error); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
440 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
441 | return; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
442 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
443 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
444 | purple_credential_provider_write_password_async(priv->active_provider, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
445 | account, password, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
446 | cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
447 | purple_credential_manager_write_password_callback, |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
448 | task); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
449 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
450 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
451 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
452 | purple_credential_manager_write_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
453 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
454 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
455 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
456 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
457 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
458 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
459 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
460 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
461 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
462 | purple_credential_manager_clear_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
464 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
465 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
466 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
467 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
468 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
469 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
470 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
471 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
472 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
473 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
474 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
475 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
476 | task = g_task_new(manager, cancellable, callback, data); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
477 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
478 | if(priv->active_provider == NULL) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
479 | GError *error = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
480 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | error = g_error_new_literal(PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
482 | _("can not clear password, no active " |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | "credential provider")); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
485 | g_task_return_error(task, error); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
486 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
487 | return; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
488 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
489 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
490 | purple_credential_provider_clear_password_async(priv->active_provider, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
491 | account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
492 | cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
493 | purple_credential_manager_clear_password_callback, |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
494 | task); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
495 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
496 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
497 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
498 | purple_credential_manager_clear_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
499 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
500 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
501 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
502 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
503 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
504 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
505 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
506 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
507 | PurpleRequestFields * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
508 | purple_credential_manager_read_settings(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
509 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
510 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
511 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
512 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
513 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
514 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
515 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
516 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
517 | if(priv->active_provider == NULL) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
518 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
519 | _("can not read settings, no active credential provider")); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
520 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
521 | return NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
522 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
523 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
524 | return purple_credential_provider_read_settings(priv->active_provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
525 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
526 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
527 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
528 | purple_credential_manager_write_settings(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
529 | PurpleRequestFields *fields, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
530 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
531 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
532 | PurpleCredentialManagerPrivate *priv = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
533 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
534 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
535 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
536 | priv = purple_credential_manager_get_instance_private(manager); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
537 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
538 | if(priv->active_provider == NULL) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
539 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
540 | _("can not write settings, no active credential provider")); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
541 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
542 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
543 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
544 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
545 | return purple_credential_provider_write_settings(priv->active_provider, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
546 | fields); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
547 | } |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
548 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
549 | void |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
550 | purple_credential_manager_foreach_provider(PurpleCredentialManager *manager, |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
551 | PurpleCredentialManagerForeachFunc func, |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
552 | gpointer data) |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
553 | { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
554 | GHashTableIter iter; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
555 | PurpleCredentialManagerPrivate *priv = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
556 | gpointer value; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
557 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
558 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
559 | g_return_if_fail(func != NULL); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
560 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
561 | priv = purple_credential_manager_get_instance_private(manager); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
562 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
563 | g_hash_table_iter_init(&iter, priv->providers); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
564 | while(g_hash_table_iter_next(&iter, NULL, &value)) { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
565 | func(PURPLE_CREDENTIAL_PROVIDER(value), data); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
566 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
567 | } |