Mon, 04 Nov 2024 23:42:22 -0600
Add a boolean setting for toggling developer mode
This just gives a simple API method for checking the setting.
Testing Done:
Added a temporary `g_warning` to the end of `Pidgin.Application.startup` to verify the setting after modifying the file by hand.
Bugs closed: PIDGIN-17993
Reviewed at https://reviews.imfreedom.org/r/3647/
|
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 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42592
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:
42592
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:
42592
diff
changeset
|
7 | * source distribution. |
|
40583
28964322556c
Add the new PurpleCredentialManager 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:
42592
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:
42592
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:
42592
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:
42592
diff
changeset
|
12 | * any later version. |
|
40583
28964322556c
Add the new PurpleCredentialManager 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:
42592
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:
42592
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:
42592
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:
42592
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:
42592
diff
changeset
|
18 | * |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42592
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:
42592
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "purplecredentialmanager.h" |
|
42997
368deff13c21
Split purpleprivate.h up into individual files
Gary Kramlich <grim@reaperworld.com>
parents:
42995
diff
changeset
|
26 | #include "purplecredentialmanagerprivate.h" |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
27 | |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
28 | #include "core.h" |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
29 | #include "debug.h" |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
30 | #include "prefs.h" |
|
42997
368deff13c21
Split purpleprivate.h up into individual files
Gary Kramlich <grim@reaperworld.com>
parents:
42995
diff
changeset
|
31 | #include "purplecredentialproviderprivate.h" |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
32 | #include "purplenoopcredentialprovider.h" |
|
42832
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
33 | #include "purplenotification.h" |
|
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
34 | #include "purplenotificationmanager.h" |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
35 | #include "util.h" |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | enum { |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
38 | PROP_0, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
39 | PROP_ITEM_TYPE, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
40 | PROP_N_ITEMS, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
41 | N_PROPERTIES, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
42 | }; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
43 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
44 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
45 | enum { |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
46 | SIG_ADDED, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
47 | SIG_REMOVED, |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
48 | SIG_ACTIVE_CHANGED, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | N_SIGNALS, |
|
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 | static guint signals[N_SIGNALS] = {0, }; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
53 | struct _PurpleCredentialManager { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
54 | GObject parent; |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
55 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
56 | GPtrArray *providers; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
58 | PurpleCredentialProvider *active; |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
59 | |
|
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
60 | GSettings *settings; |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
61 | }; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
63 | static PurpleCredentialManager *default_manager = NULL; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
64 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
65 | /****************************************************************************** |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
66 | * Helpers |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
67 | *****************************************************************************/ |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
68 | static PurpleCredentialProvider * |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
69 | purple_credential_manager_find_provider_with_id(PurpleCredentialManager *manager, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
70 | const char *id, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
71 | guint *position) |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
72 | { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
73 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), NULL); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
75 | for(guint i = 0; i < manager->providers->len; i++) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
76 | PurpleCredentialProvider *provider = NULL; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
77 | const char *provider_id = NULL; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
78 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
79 | provider = g_ptr_array_index(manager->providers, i); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
80 | provider_id = purple_credential_provider_get_id(provider); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
81 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
82 | if(purple_strequal(provider_id, id)) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
83 | if(position != NULL) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
84 | *position = i; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
85 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
86 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
87 | return provider; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
88 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
89 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
90 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
91 | return NULL; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
92 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | * Async Callbacks |
|
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 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | purple_credential_manager_read_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
104 | GTask *task = G_TASK(data); |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
105 | char *password = NULL; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
107 | password = purple_credential_provider_read_password_finish(provider, res, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | &error); |
|
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 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
111 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
113 | g_task_return_pointer(task, password, g_free); |
|
40583
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 | /* Clean up our initial reference to the task. */ |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
117 | g_object_unref(task); |
|
40583
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 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | purple_credential_manager_write_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
127 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | gboolean ret = FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
130 | 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
|
131 | &error); |
|
40583
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 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
134 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
136 | g_task_return_boolean(task, ret); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | } |
|
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 | /* Clean up our initial reference to the task. */ |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
140 | g_object_unref(task); |
|
40583
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_clear_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
150 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | gboolean ret = FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
153 | 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
|
154 | &error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
157 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
159 | g_task_return_boolean(task, ret); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | /* Clean up our initial reference to the task. */ |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
163 | g_object_unref(task); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
166 | /****************************************************************************** |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
167 | * Purple Callbacks |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
168 | *****************************************************************************/ |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
169 | static void |
|
42995
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
170 | purple_credential_manager_ui_started_cb(G_GNUC_UNUSED PurpleUi *ui, |
|
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
171 | gpointer data) |
|
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
172 | { |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
173 | PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(data); |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
174 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
175 | if(!PURPLE_IS_CREDENTIAL_PROVIDER(manager->active)) { |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
176 | GError *error = NULL; |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
177 | char *id = NULL; |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
178 | |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
179 | id = g_settings_get_string(manager->settings, "active-provider"); |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
180 | |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
181 | if(!purple_credential_manager_set_active(manager, id, &error)) { |
|
42832
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
182 | PurpleNotification *notification = NULL; |
|
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
183 | PurpleNotificationManager *manager = NULL; |
|
42931
9e8b9ee3cfbb
Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42861
diff
changeset
|
184 | const char *title = NULL; |
|
42832
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
185 | |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
186 | g_warning("Failed to make %s the active credential provider : %s", |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
187 | id, error != NULL ? error->message : "unknown error"); |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
188 | |
|
42931
9e8b9ee3cfbb
Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42861
diff
changeset
|
189 | title = _("Failed to load the selected credential provider."); |
|
42988
c2357ee36551
Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents:
42931
diff
changeset
|
190 | notification = purple_notification_new(NULL, title); |
|
42931
9e8b9ee3cfbb
Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42861
diff
changeset
|
191 | |
|
9e8b9ee3cfbb
Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42861
diff
changeset
|
192 | title = _("Check your system configuration or select another one " |
|
9e8b9ee3cfbb
Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42861
diff
changeset
|
193 | "in preferences"); |
|
9e8b9ee3cfbb
Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42861
diff
changeset
|
194 | purple_notification_set_subtitle(notification, title); |
|
42832
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
195 | |
|
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
196 | manager = purple_notification_manager_get_default(); |
|
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
197 | purple_notification_manager_add(manager, notification); |
|
4f1a305877aa
Use a notification instead of purple_notify_error when the active credential provider can not be found
Gary Kramlich <grim@reaperworld.com>
parents:
42805
diff
changeset
|
198 | g_clear_object(¬ification); |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
199 | } |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
200 | |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
201 | g_free(id); |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
202 | g_clear_error(&error); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
203 | } |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
204 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | /****************************************************************************** |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
207 | * GListModel Implementation |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
208 | *****************************************************************************/ |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
209 | static GType |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
210 | purple_credential_manager_get_item_type(G_GNUC_UNUSED GListModel *list) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
211 | return PURPLE_TYPE_CREDENTIAL_PROVIDER; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
212 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
213 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
214 | static guint |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
215 | purple_credential_manager_get_n_items(GListModel *list) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
216 | PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(list); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
217 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
218 | return manager->providers->len; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
219 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
220 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
221 | static gpointer |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
222 | purple_credential_manager_get_item(GListModel *list, guint position) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
223 | PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(list); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
224 | PurpleCredentialProvider *provider = NULL; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
225 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
226 | if(position < manager->providers->len) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
227 | provider = g_object_ref(g_ptr_array_index(manager->providers, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
228 | position)); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
229 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
230 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
231 | return provider; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
232 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
233 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
234 | static void |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
235 | pidgin_credential_manager_list_model_iface_init(GListModelInterface *iface) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
236 | iface->get_item_type = purple_credential_manager_get_item_type; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
237 | iface->get_n_items = purple_credential_manager_get_n_items; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
238 | iface->get_item = purple_credential_manager_get_item; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
239 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
240 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
241 | /****************************************************************************** |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | * GObject Implementation |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | *****************************************************************************/ |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
244 | G_DEFINE_FINAL_TYPE_WITH_CODE(PurpleCredentialManager, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
245 | purple_credential_manager, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
246 | G_TYPE_OBJECT, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
247 | G_IMPLEMENT_INTERFACE(G_TYPE_LIST_MODEL, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
248 | pidgin_credential_manager_list_model_iface_init)) |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
249 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | purple_credential_manager_finalize(GObject *obj) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | PurpleCredentialManager *manager = NULL; |
|
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 | manager = PURPLE_CREDENTIAL_MANAGER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
256 | g_clear_pointer(&manager->providers, g_ptr_array_unref); |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
257 | g_clear_object(&manager->active); |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
258 | g_clear_object(&manager->settings); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | G_OBJECT_CLASS(purple_credential_manager_parent_class)->finalize(obj); |
|
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 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | static void |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
264 | purple_credential_manager_get_property(GObject *obj, guint param_id, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
265 | GValue *value, GParamSpec *pspec) |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
266 | { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
267 | GListModel *model = G_LIST_MODEL(obj); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
268 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
269 | switch(param_id) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
270 | case PROP_ITEM_TYPE: |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
271 | g_value_set_gtype(value, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
272 | purple_credential_manager_get_item_type(model)); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
273 | break; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
274 | case PROP_N_ITEMS: |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
275 | g_value_set_uint(value, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
276 | purple_credential_manager_get_n_items(model)); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
277 | break; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
278 | default: |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
279 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
280 | break; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
281 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
282 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
283 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
284 | static void |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | purple_credential_manager_init(PurpleCredentialManager *manager) { |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
286 | manager->providers = g_ptr_array_new_full(1, g_object_unref); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | purple_credential_manager_class_init(PurpleCredentialManagerClass *klass) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
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 | obj_class->finalize = purple_credential_manager_finalize; |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
294 | obj_class->get_property = purple_credential_manager_get_property; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
295 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
296 | /** |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
297 | * PurpleCredentialManager:item-type: |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
298 | * |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
299 | * The type of items. See [vfunc@Gio.ListModel.get_item_type]. |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
300 | * |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
301 | * Since: 3.0 |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
302 | */ |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
303 | properties[PROP_ITEM_TYPE] = g_param_spec_gtype( |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
304 | "item-type", "item-type", |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
305 | "The type of the contained items.", |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
306 | G_TYPE_OBJECT, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
307 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
308 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
309 | /** |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
310 | * PurpleCredentialManager:n-items: |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
311 | * |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
312 | * The number of items. See [vfunc@Gio.ListModel.get_n_items]. |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
313 | * |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
314 | * Since: 3.0 |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
315 | */ |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
316 | properties[PROP_N_ITEMS] = g_param_spec_uint( |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
317 | "n-items", "n-items", |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
318 | "The number of contained items.", |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
319 | 0, G_MAXUINT, 0, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
320 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
321 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
322 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | /** |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
325 | * PurpleCredentialManager::added: |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | * @manager: The #PurpleCredentialManager instance. |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
327 | * @provider: The #PurpleCredentialProvider that was added. |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | * |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
329 | * Emitted after @provider has been added to @manager. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
330 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
331 | * Since: 3.0 |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | */ |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
333 | signals[SIG_ADDED] = g_signal_new_class_handler( |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
334 | "added", |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | G_OBJECT_CLASS_TYPE(klass), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | G_SIGNAL_RUN_LAST, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
337 | NULL, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | G_TYPE_NONE, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | 1, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | /** |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
346 | * PurpleCredentialManager::removed: |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | * @manager: The #PurpleCredentialManager instance. |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
348 | * @provider: The #PurpleCredentialProvider that was removed. |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | * |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
350 | * Emitted after @provider has been removed from @manager. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
351 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
352 | * Since: 3.0 |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | */ |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
354 | signals[SIG_REMOVED] = g_signal_new_class_handler( |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
355 | "removed", |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | G_OBJECT_CLASS_TYPE(klass), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | G_SIGNAL_RUN_LAST, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
358 | NULL, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
362 | G_TYPE_NONE, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | 1, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
365 | |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
366 | /** |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
367 | * PurpleCredentialManager::active-changed: |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
368 | * @manager: The #PurpleCredentialManager instance. |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
369 | * @previous: 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
|
370 | * @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
|
371 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
372 | * 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
|
373 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
374 | * Since: 3.0 |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
375 | */ |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
376 | signals[SIG_ACTIVE_CHANGED] = g_signal_new_class_handler( |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
377 | "active-changed", |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
378 | G_OBJECT_CLASS_TYPE(klass), |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
379 | G_SIGNAL_RUN_LAST, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
380 | NULL, |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
381 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
382 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
383 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
384 | G_TYPE_NONE, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
385 | 2, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
386 | PURPLE_TYPE_CREDENTIAL_PROVIDER, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
387 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | } |
|
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 | * Private API |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | *****************************************************************************/ |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
393 | |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
394 | /* Currently we're auto-registering the noop provider on the default manager, |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
395 | * this may get moved to purple core later, so we just want to keep it all in |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
396 | * one place for now. |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
397 | */ |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
398 | static PurpleCredentialProvider *noop = NULL; |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
399 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | void |
|
42995
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
401 | purple_credential_manager_startup(G_GNUC_UNUSED PurpleCore *core) { |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | if(default_manager == NULL) { |
|
42995
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
403 | PurpleUi *ui = NULL; |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
404 | GError *error = NULL; |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
405 | gpointer backend; |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
406 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | default_manager = g_object_new(PURPLE_TYPE_CREDENTIAL_MANAGER, NULL); |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
408 | |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
409 | backend = purple_core_get_settings_backend(); |
|
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
410 | default_manager->settings = g_settings_new_with_backend("im.pidgin.Purple.Credentials", |
|
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
411 | backend); |
|
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
412 | |
|
42995
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
413 | ui = purple_core_get_ui(); |
|
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
414 | g_signal_connect_object(ui, "started", |
|
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
415 | G_CALLBACK(purple_credential_manager_ui_started_cb), |
|
006b071042ed
Replace the core-initialized signal with Purple.Ui::started
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
416 | default_manager, G_CONNECT_DEFAULT); |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
417 | |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
418 | noop = purple_noop_credential_provider_new(); |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
419 | if(!purple_credential_manager_add(default_manager, noop, &error)) { |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
420 | g_warning("failed to register the noop credential manager: %s", |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
421 | error ? error->message : "unknown"); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
422 | g_clear_error(&error); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
423 | g_clear_object(&noop); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
424 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
425 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
426 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
427 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
428 | void |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
429 | purple_credential_manager_shutdown(G_GNUC_UNUSED PurpleCore *core) { |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
430 | if(PURPLE_IS_CREDENTIAL_MANAGER(default_manager)) { |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
431 | /* If we have an instance of the noop provider we need to unregister |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
432 | * it before continuing. |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
433 | */ |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
434 | if(PURPLE_IS_CREDENTIAL_PROVIDER(noop)) { |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
435 | GError *error = NULL; |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
436 | if(!purple_credential_manager_remove(default_manager, noop, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
437 | &error)) |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
438 | { |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
439 | g_warning("failed to unregister the noop provider: %s", |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
440 | error ? error->message : "unknown"); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
441 | g_clear_error(&error); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
442 | } |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
443 | g_clear_object(&noop); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
444 | } |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
445 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
446 | if(default_manager->providers->len > 0) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
447 | g_warning("purple_credential_manager_shutdown called while %u " |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
448 | "providers were still registered. Skipping shutdown", |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
449 | default_manager->providers->len); |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
450 | } else { |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
451 | g_clear_object(&default_manager); |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
452 | } |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
453 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
454 | } |
|
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 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
457 | * Public API |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
458 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
459 | gboolean |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
460 | purple_credential_manager_add(PurpleCredentialManager *manager, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
461 | PurpleCredentialProvider *provider, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
462 | GError **error) |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | { |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
464 | PurpleCredentialProvider *existing = NULL; |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
465 | const char *id = NULL; |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
466 | guint position = 0; |
|
40583
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 | 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
|
469 | 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
|
470 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
471 | if(!purple_credential_provider_is_valid(provider, error)) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
472 | /* purple_credential_provider_is_valid sets the error on failure. */ |
|
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 | return FALSE; |
|
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 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
477 | id = purple_credential_provider_get_id(provider); |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
478 | existing = purple_credential_manager_find_provider_with_id(manager, id, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
479 | NULL); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
480 | if(PURPLE_IS_CREDENTIAL_PROVIDER(existing)) { |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
482 | _("provider %s has already been added"), id); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
485 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
486 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
487 | /* Store the position to avoid doing math after adding. */ |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
488 | position = manager->providers->len; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
489 | g_ptr_array_add(manager->providers, g_object_ref(provider)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
490 | |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
491 | g_signal_emit(G_OBJECT(manager), signals[SIG_ADDED], 0, provider); |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
492 | g_list_model_items_changed(G_LIST_MODEL(manager), position, 0, 1); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
493 | |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
494 | /* If we don't currently have an active provider, check if the newly |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
495 | * registered provider has the id of the stored provider in preferences. |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
496 | * If it is, go ahead and make it the active provider. |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
497 | */ |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
498 | if(!PURPLE_IS_CREDENTIAL_PROVIDER(manager->active) && |
|
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
499 | G_IS_SETTINGS(manager->settings)) |
|
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
500 | { |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
501 | char *wanted = NULL; |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
502 | |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
503 | wanted = g_settings_get_string(manager->settings, "active-provider"); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
504 | |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
505 | if(purple_strequal(wanted, id)) { |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
506 | purple_credential_manager_set_active(manager, id, error); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
507 | } |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
508 | |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
509 | g_free(wanted); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
510 | } |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
511 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
512 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
513 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
514 | |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
515 | PurpleCredentialManager * |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
516 | purple_credential_manager_get_default(void) { |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
517 | return default_manager; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
518 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
519 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
520 | GListModel * |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
521 | purple_credential_manager_get_default_as_model(void) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
522 | if(PURPLE_IS_CREDENTIAL_MANAGER(default_manager)) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
523 | return G_LIST_MODEL(default_manager); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
524 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
525 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
526 | return NULL; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
527 | } |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
528 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
529 | gboolean |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
530 | purple_credential_manager_set_active(PurpleCredentialManager *manager, |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
531 | const char *id, GError **error) |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
532 | { |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
533 | PurpleCredentialProvider *previous = NULL; |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
534 | PurpleCredentialProvider *provider = NULL; |
|
40583
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 | 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
|
537 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
538 | /* 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
|
539 | if(id != NULL) { |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
540 | provider = purple_credential_manager_find_provider_with_id(manager, id, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
541 | NULL); |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
542 | if(!PURPLE_IS_CREDENTIAL_PROVIDER(provider)) { |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
543 | 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
|
544 | "no credential provider found with id %s", id); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
545 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
546 | return FALSE; |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
547 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
548 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
549 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
550 | if(PURPLE_IS_CREDENTIAL_PROVIDER(manager->active)) { |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
551 | previous = g_object_ref(manager->active); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
552 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
553 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
554 | if(g_set_object(&manager->active, provider)) { |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
555 | if(PURPLE_IS_CREDENTIAL_PROVIDER(previous)) { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
556 | purple_credential_provider_deactivate(previous); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
557 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
558 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
559 | if(PURPLE_IS_CREDENTIAL_PROVIDER(provider)) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
560 | purple_credential_provider_activate(provider); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
561 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
562 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
563 | g_signal_emit(G_OBJECT(manager), signals[SIG_ACTIVE_CHANGED], 0, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
564 | previous, manager->active); |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
565 | } |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
566 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
567 | g_clear_object(&previous); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
568 | |
|
41802
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
569 | /* Finally update the preference if we were given a new id. We assume, that |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
570 | * a NULL id means we're shutting down and thus shouldn't update the |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
571 | * setting. |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
572 | */ |
|
42861
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
573 | if(id != NULL && G_IS_SETTINGS(manager->settings)) { |
|
563d56738460
Change the way the CredentialManager interacts with the core
Gary Kramlich <grim@reaperworld.com>
parents:
42834
diff
changeset
|
574 | g_settings_set_string(manager->settings, "active-provider", id); |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
575 | } |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
576 | |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
577 | purple_debug_info("credential-manager", "set active provider to '%s'", id); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
578 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
579 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
580 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
581 | |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
582 | PurpleCredentialProvider * |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
583 | purple_credential_manager_get_active(PurpleCredentialManager *manager) { |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
584 | 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
|
585 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
586 | return manager->active; |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
587 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
588 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
589 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
590 | purple_credential_manager_read_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
591 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
592 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
593 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
594 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
595 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
596 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
597 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
598 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
599 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
600 | task = g_task_new(manager, cancellable, callback, data); |
|
42591
aa3f777462d8
Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
601 | g_task_set_source_tag(task, purple_credential_manager_read_password_async); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
602 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
603 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
604 | purple_credential_provider_read_password_async(manager->active, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
605 | account, |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
606 | cancellable, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
607 | purple_credential_manager_read_password_callback, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
608 | task); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
609 | } else { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
610 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
611 | _("can not read password, no active " |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
612 | "credential provider")); |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
613 | g_object_unref(task); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
614 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
615 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
616 | |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
617 | char * |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
618 | purple_credential_manager_read_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
619 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
620 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
621 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
622 | 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
|
623 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
624 | return g_task_propagate_pointer(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
625 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
626 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
627 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
628 | purple_credential_manager_write_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
629 | PurpleAccount *account, |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
630 | const char *password, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
631 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
632 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
633 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
634 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
635 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
636 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
637 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
638 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
639 | task = g_task_new(manager, cancellable, callback, data); |
|
42591
aa3f777462d8
Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
640 | g_task_set_source_tag(task, |
|
aa3f777462d8
Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
641 | purple_credential_manager_write_password_async); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
642 | |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
643 | if(!purple_account_get_remember_password(account)) { |
|
42626
c36543f2ec67
Some cleanups for PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
42613
diff
changeset
|
644 | const char *name = NULL; |
|
41976
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41802
diff
changeset
|
645 | |
|
42805
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42725
diff
changeset
|
646 | 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
|
647 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
648 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
649 | _("account \"%s\" is not marked to be stored"), |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
650 | name); |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
651 | g_object_unref(task); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
652 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
653 | return; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
654 | } |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
655 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
656 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
657 | purple_credential_provider_write_password_async(manager->active, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
658 | account, |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
659 | password, cancellable, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
660 | purple_credential_manager_write_password_callback, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
661 | task); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
662 | } else { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
663 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
664 | _("can not write password, no active " |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
665 | "credential provider")); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
666 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
667 | g_object_unref(task); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
668 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
669 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
670 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
671 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
672 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
673 | purple_credential_manager_write_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
674 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
675 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
676 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
677 | 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
|
678 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
679 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
680 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
681 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
682 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
683 | purple_credential_manager_clear_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
684 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
685 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
686 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
687 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
688 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
689 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
690 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
691 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
692 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
693 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
694 | task = g_task_new(manager, cancellable, callback, data); |
|
42591
aa3f777462d8
Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
695 | g_task_set_source_tag(task, |
|
aa3f777462d8
Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
696 | purple_credential_manager_clear_password_async); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
697 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
698 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
699 | purple_credential_provider_clear_password_async(manager->active, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
700 | account, |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
701 | cancellable, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
702 | purple_credential_manager_clear_password_callback, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
703 | task); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
704 | } else { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
705 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
706 | _("can not clear password, no active " |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
707 | "credential provider")); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
708 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42591
diff
changeset
|
709 | g_object_unref(task); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
710 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
711 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
712 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
713 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
714 | purple_credential_manager_clear_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
715 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
716 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
717 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
718 | 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
|
719 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
720 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
721 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
722 | |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
723 | gboolean |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
724 | purple_credential_manager_remove(PurpleCredentialManager *manager, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
725 | PurpleCredentialProvider *provider, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
726 | GError **error) |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
727 | { |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
728 | PurpleCredentialProvider *candidate = NULL; |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
729 | const char *id = NULL; |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
730 | guint position = 0; |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
731 | |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
732 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
733 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE); |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
734 | |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
735 | id = purple_credential_provider_get_id(provider); |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
736 | |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
737 | if(provider == manager->active) { |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
738 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
739 | _("provider %s is currently in use"), id); |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
740 | |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
741 | return FALSE; |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
742 | } |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
743 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
744 | g_object_ref(provider); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
745 | candidate = purple_credential_manager_find_provider_with_id(manager, id, |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
746 | &position); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
747 | if(PURPLE_IS_CREDENTIAL_PROVIDER(candidate)) { |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
748 | g_ptr_array_remove_index(manager->providers, position); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
749 | |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
750 | g_signal_emit(G_OBJECT(manager), signals[SIG_REMOVED], 0, provider); |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
751 | g_list_model_items_changed(G_LIST_MODEL(manager), position, 1, 0); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
752 | |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
753 | g_object_unref(provider); |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
754 | |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
755 | return TRUE; |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
756 | } |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
757 | |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
758 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
759 | _("provider %s has not been added"), id); |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
760 | |
|
43048
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
761 | g_object_unref(provider); |
|
45a4e977eff7
Update Purple.CredentialManager to implement Gio.ListModel
Gary Kramlich <grim@reaperworld.com>
parents:
43027
diff
changeset
|
762 | |
|
43027
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
763 | return FALSE; |
|
581af7cd0603
Rename Purple.CredentialManager.register/unregister to add/remove
Gary Kramlich <grim@reaperworld.com>
parents:
42999
diff
changeset
|
764 | } |