Sat, 27 Feb 2021 18:03:38 -0600
Add a description to PurpleCredentialProvider and show it in the preferences selector
Testing Done:
Compiled and ran locally.
Reviewed at https://reviews.imfreedom.org/r/539/
|
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; |
|
40790
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
33 | GtkCellRenderer *renderer; |
|
40730
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 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | 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
|
37 | GTK_TYPE_BOX) |
|
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 | /****************************************************************************** |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | * Helpers |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | *****************************************************************************/ |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | static void |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | 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
|
44 | 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
|
45 | GtkTreeIter iter; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | 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
|
48 | PurpleCredentialManager *manager = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | GError *error = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | GtkTreeModel *model = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | gchar *id = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | 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
|
54 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | 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
|
56 | 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
|
57 | -1); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | 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
|
60 | 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
|
61 | 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
|
62 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | g_free(id); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | return; |
|
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 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | 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
|
69 | "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
|
70 | id, |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | 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
|
72 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | g_free(id); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | g_clear_error(&error); |
|
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 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | static void |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | 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
|
80 | const gchar *new_id) |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | GtkTreeIter iter; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | GtkTreeModel *model = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | 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
|
86 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | 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
|
88 | do { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | gchar *id = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | 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
|
92 | 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
|
93 | -1); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | 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
|
96 | 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
|
97 | 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
|
98 | page); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | 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
|
101 | &iter); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | 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
|
104 | 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
|
105 | page); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | g_free(id); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | return; |
|
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 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | g_free(id); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | } 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
|
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 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | static void |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | 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
|
119 | PurplePrefType type, |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | gconstpointer value, |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | gpointer data) |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | 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
|
124 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | 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
|
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 | /****************************************************************************** |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | * GObjectImplementation |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | *****************************************************************************/ |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | static void |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | 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
|
133 | 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
|
134 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | 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
|
136 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | static void |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | 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
|
140 | const gchar *active = NULL; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | 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
|
143 | |
|
40790
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
144 | /* Set some constant properties on the renderer. This stuff is kind of |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
145 | * dodgy, but it does stop the dialog from growing to fit a long |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
146 | * description. |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
147 | */ |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
148 | g_object_set(G_OBJECT(page->renderer), |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
149 | "width-chars", 40, |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
150 | "wrap-mode", PANGO_WRAP_WORD_CHAR, |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
151 | NULL); |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
152 | |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | 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
|
154 | 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
|
155 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | 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
|
157 | 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
|
158 | page); |
|
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 | 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
|
161 | 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
|
162 | page); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | 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
|
165 | if(active != NULL) { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | 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
|
167 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | static void |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | 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
|
172 | 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
|
173 | 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
|
174 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | 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
|
176 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | 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
|
178 | widget_class, |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | "/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
|
180 | ); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | 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
|
183 | combo); |
|
40790
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
184 | gtk_widget_class_bind_template_child(widget_class, PidginCredentialsPage, |
|
e92d5c060155
Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
185 | renderer); |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | /****************************************************************************** |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | * API |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | *****************************************************************************/ |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | GtkWidget * |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | 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
|
193 | 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
|
194 | } |