pidgin/pidgincredentialspage.c

Sat, 30 Jan 2021 22:33:58 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 30 Jan 2021 22:33:58 -0600
changeset 40749
b7ee9469eccc
parent 40730
12b38cca63d7
child 40790
e92d5c060155
permissions
-rw-r--r--

g_task_return_* refs a task so we need to make sure we remove our reference when we're done with the task.

Testing Done:
Compiled and connected to bonjour and xmpp locally.

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

40730
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <purple.h>
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "pidgincredentialspage.h"
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "pidgincredentialproviderstore.h"
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 struct _PidginCredentialsPage {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 GtkBox parent;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 GtkWidget *combo;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 };
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 G_DEFINE_TYPE(PidginCredentialsPage, pidgin_credentials_page,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 GTK_TYPE_BOX)
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 /******************************************************************************
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 * Helpers
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 *****************************************************************************/
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 static void
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 pidgin_credentials_page_combo_changed_cb(GtkComboBox *widget, gpointer data) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 PidginCredentialsPage *page = PIDGIN_CREDENTIALS_PAGE(data);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 GtkTreeIter iter;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(page->combo), &iter)) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 PurpleCredentialManager *manager = NULL;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 GError *error = NULL;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 GtkTreeModel *model = NULL;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 gchar *id = NULL;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 model = gtk_combo_box_get_model(GTK_COMBO_BOX(page->combo));
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 gtk_tree_model_get(model, &iter,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 PIDGIN_CREDENTIAL_PROVIDER_STORE_COLUMN_ID, &id,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 -1);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 manager = purple_credential_manager_get_default();
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 if(purple_credential_manager_set_active_provider(manager, id, &error)) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 purple_prefs_set_string("/purple/credentials/active-provider", id);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 g_free(id);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 return;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 purple_debug_warning("credentials-page", "failed to set the active "
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 "credential provider to '%s': %s",
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 id,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 error ? error->message : "unknown error");
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 g_free(id);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 g_clear_error(&error);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 static void
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 pidgin_credentials_page_set_active_provider(PidginCredentialsPage *page,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 const gchar *new_id)
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 GtkTreeIter iter;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 GtkTreeModel *model = NULL;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 model = gtk_combo_box_get_model(GTK_COMBO_BOX(page->combo));
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 if(gtk_tree_model_get_iter_first(model, &iter)) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 do {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 gchar *id = NULL;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 gtk_tree_model_get(model, &iter,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 PIDGIN_CREDENTIAL_PROVIDER_STORE_COLUMN_ID, &id,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 -1);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 if(purple_strequal(new_id, id)) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 g_signal_handlers_block_by_func(page->combo,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 pidgin_credentials_page_combo_changed_cb,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 page);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(page->combo),
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 &iter);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 g_signal_handlers_unblock_by_func(page->combo,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 pidgin_credentials_page_combo_changed_cb,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 page);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 g_free(id);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 return;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 g_free(id);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 } while(gtk_tree_model_iter_next(model, &iter));
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 static void
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 pidgin_credentials_page_active_provider_changed_cb(const gchar *name,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 PurplePrefType type,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 gconstpointer value,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 gpointer data)
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 PidginCredentialsPage *page = PIDGIN_CREDENTIALS_PAGE(data);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 pidgin_credentials_page_set_active_provider(page, (const gchar *)value);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 /******************************************************************************
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 * GObjectImplementation
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 *****************************************************************************/
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 static void
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 pidgin_credentials_page_finalize(GObject *obj) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 purple_prefs_disconnect_by_handle(obj);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 G_OBJECT_CLASS(pidgin_credentials_page_parent_class)->finalize(obj);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 static void
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 pidgin_credentials_page_init(PidginCredentialsPage *page) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 const gchar *active = NULL;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 gtk_widget_init_template(GTK_WIDGET(page));
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 purple_prefs_add_none("/purple/credentials");
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 purple_prefs_add_string("/purple/credentials/active-provider", NULL);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 purple_prefs_connect_callback(page, "/purple/credentials/active-provider",
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 pidgin_credentials_page_active_provider_changed_cb,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 page);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 g_signal_connect(G_OBJECT(page->combo), "changed",
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 G_CALLBACK(pidgin_credentials_page_combo_changed_cb),
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 page);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 active = purple_prefs_get_string("/purple/credentials/active-provider");
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 if(active != NULL) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 pidgin_credentials_page_set_active_provider(page, active);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 static void
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 pidgin_credentials_page_class_init(PidginCredentialsPageClass *klass) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 obj_class->finalize = pidgin_credentials_page_finalize;
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 gtk_widget_class_set_template_from_resource(
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 widget_class,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 "/im/pidgin/Pidgin/Prefs/credentials.ui"
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 );
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 gtk_widget_class_bind_template_child(widget_class, PidginCredentialsPage,
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 combo);
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 }
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 /******************************************************************************
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 * API
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 *****************************************************************************/
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 GtkWidget *
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 pidgin_credentials_page_new(void) {
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CREDENTIALS_PAGE, NULL));
12b38cca63d7 Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 }

mercurial