Thu, 27 Jun 2024 00:46:27 -0500
Update pidgin to use get id and username directly on PurpleAccount
This is part of making PurpleAccount have a PurpleContactInfo instead of being
one.
Testing Done:
Ran the turtles, connected some accounts, disabled one via the menu and re-enabled it.
Reviewed at https://reviews.imfreedom.org/r/3273/
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
25 | #include <adwaita.h> |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
26 | |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include "pidginaccounteditor.h" |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
29 | #include "pidginprotocolchooser.h" |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | struct _PidginAccountEditor { |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
32 | AdwPreferencesPage parent; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | PurpleAccount *account; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
36 | gboolean valid; |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
37 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
38 | /* Login Options */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
39 | GtkWidget *login_options; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
40 | GtkWidget *protocol; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
41 | GtkWidget *username; |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
42 | GtkWidget *user_splits; |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
43 | GtkWidget *require_password_row; |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
44 | GtkWidget *require_password; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
45 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
46 | GList *user_split_rows; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
47 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
48 | /* User Options */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
49 | GtkWidget *alias; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
50 | |
|
42352
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
51 | GtkFileDialog *avatar_dialog; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
52 | GdkPixbuf *avatar_pixbuf; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
53 | GtkWidget *avatar_row; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
54 | GtkWidget *use_custom_avatar; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
55 | GtkWidget *avatar; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
56 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
57 | /* Advanced Options */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
58 | GtkWidget *advanced_group; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
59 | GtkWidget *advanced_toggle; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
60 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
61 | GList *advanced_entries; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
62 | GList *advanced_rows; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
63 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
64 | /* Proxy Options */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
65 | GtkWidget *proxy_type; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | GtkWidget *proxy_options; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
67 | GtkWidget *proxy_host; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
68 | GtkWidget *proxy_port; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
69 | GtkWidget *proxy_username; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
70 | GtkWidget *proxy_password; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | }; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | enum { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | PROP_0, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | PROP_ACCOUNT, |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
76 | PROP_VALID, |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | N_PROPERTIES, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | }; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
81 | /****************************************************************************** |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
82 | * Prototypes |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
83 | *****************************************************************************/ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
84 | static void pidgin_account_editor_connection_changed_cb(GObject *obj, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
85 | GParamSpec *pspec, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
86 | gpointer data); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
87 | |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | /****************************************************************************** |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | * Helpers |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | *****************************************************************************/ |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | static void |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
92 | pidgin_account_editor_set_valid(PidginAccountEditor *editor, gboolean valid) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
93 | g_return_if_fail(PIDGIN_IS_ACCOUNT_EDITOR(editor)); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
94 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
95 | if(editor->valid != valid) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
96 | editor->valid = valid; |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
97 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
98 | g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_VALID]); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
99 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
100 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
101 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
102 | static void |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
103 | pidgin_account_editor_add_user_split(gpointer data, gpointer user_data) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
104 | PurpleAccountUserSplit *split = data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
105 | PidginAccountEditor *editor = user_data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
106 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
107 | if(!purple_account_user_split_is_constant(split)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
108 | GtkWidget *row = NULL; |
|
42255
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
109 | gboolean sensitive = TRUE; |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
110 | |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
111 | if(PURPLE_IS_ACCOUNT(editor->account)) { |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
112 | if(purple_account_is_connected(editor->account)) { |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
113 | sensitive = FALSE; |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
114 | } |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
115 | } |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
116 | |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
117 | row = adw_entry_row_new(); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
118 | editor->user_split_rows = g_list_append(editor->user_split_rows, row); |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
119 | gtk_list_box_append(GTK_LIST_BOX(editor->user_splits), row); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
120 | |
|
41780
1247cc856233
Remove extra focus targets from Account Editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41779
diff
changeset
|
121 | gtk_widget_set_focusable(row, FALSE); |
|
42255
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
122 | if(!sensitive) { |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
123 | gtk_widget_set_sensitive(row, sensitive); |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
124 | } |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
125 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
126 | adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
127 | purple_account_user_split_get_text(split)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
128 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
129 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
130 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
131 | static gboolean |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
132 | pidgin_account_editor_update_login_options(PidginAccountEditor *editor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
133 | PurpleProtocol *protocol) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
134 | { |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
135 | PurpleProtocolOptions options; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
136 | GList *user_splits = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
137 | GList *split_item = NULL; |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
138 | GList *row_item = NULL; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
139 | gchar *username = NULL; |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
140 | gboolean require_password = FALSE; |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
141 | gboolean ret = FALSE; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
142 | |
|
42255
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
143 | /* Make the username field sensitive as it may have previously be made |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
144 | * insensitive. |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
145 | */ |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
146 | gtk_widget_set_sensitive(editor->username, TRUE); |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
147 | |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
148 | /* If we have an account, populate its values. */ |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
149 | if(PURPLE_IS_ACCOUNT(editor->account)) { |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
150 | /* The username will be split apart below and eventually set as the |
|
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
151 | * text in the username entry. |
|
42255
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
152 | */ |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
153 | username = g_strdup(purple_account_get_username(editor->account)); |
|
42255
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
154 | require_password = purple_account_get_require_password(editor->account); |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
155 | |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
156 | if(purple_account_is_connected(editor->account)) { |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
157 | gtk_widget_set_sensitive(editor->username, FALSE); |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
158 | } |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
159 | } |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
160 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
161 | /* Now remove the rows we added to the preference group for each non |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
162 | * constant user split. |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
163 | */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
164 | while(editor->user_split_rows != NULL) { |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
165 | gtk_list_box_remove(GTK_LIST_BOX(editor->user_splits), |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
166 | editor->user_split_rows->data); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
167 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
168 | editor->user_split_rows = g_list_delete_link(editor->user_split_rows, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
169 | editor->user_split_rows); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
170 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
171 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
172 | /* Add the user splits for the protocol. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
173 | user_splits = purple_protocol_get_user_splits(protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
174 | g_list_foreach(user_splits, pidgin_account_editor_add_user_split, editor); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
175 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
176 | /* Filling out the user splits is a pain. If we have an account, we created |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
177 | * a copy of the username above. We then iterate the user splits backwards |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
178 | * so we can insert a null terminator at the start of each split we find in |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
179 | * the username. |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
180 | */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
181 | split_item = g_list_last(user_splits); |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
182 | row_item = g_list_last(editor->user_split_rows); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
183 | while(split_item != NULL && row_item != NULL) { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
184 | GtkWidget *row = row_item->data; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
185 | PurpleAccountUserSplit *split = split_item->data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
186 | gchar *ptr = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
187 | const gchar *value = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
188 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
189 | if(username != NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
190 | gchar sep = purple_account_user_split_get_separator(split); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
191 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
192 | if(purple_account_user_split_get_reverse(split)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
193 | ptr = strrchr(username, sep); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
194 | } else { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
195 | ptr = strchr(username, sep); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
196 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
197 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
198 | if(ptr != NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
199 | /* Insert a null terminator in place of the separator. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
200 | *ptr = '\0'; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
201 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
202 | /* Set the value to the first byte after the separator. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
203 | value = ptr + 1; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
204 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
205 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
206 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
207 | if(value == NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
208 | value = purple_account_user_split_get_default_value(split); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
209 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
210 | |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
211 | if(value != NULL && GTK_IS_EDITABLE(row)) { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
212 | gtk_editable_set_text(GTK_EDITABLE(row), value); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
213 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
214 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
215 | split_item = split_item->prev; |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
216 | row_item = row_item->prev; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
217 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
218 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
219 | /* Free the user splits. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
220 | g_list_free_full(user_splits, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
221 | (GDestroyNotify)purple_account_user_split_destroy); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
222 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
223 | /* Set the username entry to the remaining text in username and free our |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
224 | * copy of said username. |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
225 | */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
226 | if(username != NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
227 | gtk_editable_set_text(GTK_EDITABLE(editor->username), username); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
228 | g_free(username); |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
229 | ret = TRUE; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
230 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
231 | |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
232 | options = purple_protocol_get_options(protocol); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
233 | gtk_widget_set_visible(editor->require_password_row, |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
234 | options & OPT_PROTO_PASSWORD_OPTIONAL); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
235 | |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
236 | gtk_switch_set_active(GTK_SWITCH(editor->require_password), |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
237 | require_password); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
238 | |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
239 | return ret; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
240 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
241 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
242 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
243 | pidgin_account_editor_update_user_options(PidginAccountEditor *editor, |
|
42723
3761ba966eed
Stop using PurpleBuddy in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42700
diff
changeset
|
244 | G_GNUC_UNUSED PurpleProtocol *protocol) |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
245 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
246 | PurpleImage *image = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
247 | gboolean show_avatar_opts = TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
248 | const gchar *svalue = ""; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
249 | gboolean use_global = TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
250 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
251 | /* Check if the protocol supports avatars. */ |
|
42723
3761ba966eed
Stop using PurpleBuddy in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42700
diff
changeset
|
252 | show_avatar_opts = FALSE; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
253 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
254 | gtk_widget_set_visible(editor->avatar_row, show_avatar_opts); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
255 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
256 | /* Determine our values. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
257 | if(editor->account != NULL) { |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
258 | PurpleContactInfo *info = NULL; |
|
41971
b03ca9889e90
Fix some Pidgin account deprecations I missed on my first pass
Gary Kramlich <grim@reaperworld.com>
parents:
41962
diff
changeset
|
259 | |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
260 | info = purple_account_get_contact_info(editor->account); |
|
41971
b03ca9889e90
Fix some Pidgin account deprecations I missed on my first pass
Gary Kramlich <grim@reaperworld.com>
parents:
41962
diff
changeset
|
261 | svalue = purple_contact_info_get_alias(info); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
262 | use_global = purple_account_get_bool(editor->account, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
263 | "use-global-buddyicon", TRUE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
264 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
265 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
266 | if(svalue == NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
267 | svalue = ""; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
268 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
269 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
270 | gtk_editable_set_text(GTK_EDITABLE(editor->alias), svalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
271 | gtk_switch_set_active(GTK_SWITCH(editor->use_custom_avatar), !use_global); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
272 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
273 | g_clear_object(&editor->avatar_pixbuf); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
274 | if(PURPLE_IS_IMAGE(image)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
275 | editor->avatar_pixbuf = purple_gdk_pixbuf_from_image(image); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
276 | gtk_image_set_from_pixbuf(GTK_IMAGE(editor->avatar), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
277 | editor->avatar_pixbuf); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
278 | } else { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
279 | gtk_image_set_from_icon_name(GTK_IMAGE(editor->avatar), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
280 | "select-avatar"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
281 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
282 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
283 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
284 | static gboolean |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
285 | pidgin_account_editor_advanced_option_use_default(PidginAccountEditor *editor) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
286 | PurpleProtocol *protocol = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
287 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
288 | /* If this is the new dialog, use the default value. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
289 | if(!PURPLE_IS_ACCOUNT(editor->account)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
290 | return TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
291 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
292 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
293 | /* If we have an existing account, check if the protocol has changed. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
294 | protocol = pidgin_protocol_chooser_get_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
295 | if(protocol != purple_account_get_protocol(editor->account)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
296 | return TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
297 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
298 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
299 | return FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
300 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
301 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
302 | static GtkWidget * |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
303 | pidgin_account_editor_add_advanced_boolean(PidginAccountEditor *editor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
304 | PurpleAccountOption *option) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
305 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
306 | GtkWidget *row = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
307 | GtkWidget *toggle = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
308 | gboolean value = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
309 | gchar *title = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
310 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
311 | if(pidgin_account_editor_advanced_option_use_default(editor)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
312 | value = purple_account_option_get_default_bool(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
313 | } else { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
314 | const gchar *setting = purple_account_option_get_setting(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
315 | gboolean def_value = purple_account_option_get_default_bool(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
316 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
317 | value = purple_account_get_bool(editor->account, setting, def_value); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
318 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
319 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
320 | /* Create the row and set its title with a mnemonic. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
321 | row = adw_action_row_new(); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
322 | g_object_bind_property(editor->advanced_toggle, "active", row, "visible", |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
323 | G_BINDING_SYNC_CREATE); |
|
41780
1247cc856233
Remove extra focus targets from Account Editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41779
diff
changeset
|
324 | gtk_widget_set_focusable(row, FALSE); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
325 | adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
326 | title = g_strdup_printf("_%s", purple_account_option_get_text(option)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
327 | adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
328 | g_free(title); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
329 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
330 | adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
331 | row); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
332 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
333 | /* Add the row to the editor's list of advanced rows. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
334 | editor->advanced_rows = g_list_append(editor->advanced_rows, row); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
335 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
336 | /* Create the input widget. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
337 | toggle = gtk_switch_new(); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
338 | gtk_switch_set_active(GTK_SWITCH(toggle), value); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
339 | gtk_widget_set_valign(toggle, GTK_ALIGN_CENTER); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
340 | adw_action_row_add_suffix(ADW_ACTION_ROW(row), toggle); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
341 | adw_action_row_set_activatable_widget(ADW_ACTION_ROW(row), toggle); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
342 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
343 | return toggle; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
344 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
345 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
346 | static GtkWidget * |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
347 | pidgin_account_editor_add_advanced_int(PidginAccountEditor *editor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
348 | PurpleAccountOption *option) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
349 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
350 | GtkWidget *row = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
351 | gint value = 0; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
352 | gchar *title = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
353 | gchar *svalue = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
354 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
355 | if(pidgin_account_editor_advanced_option_use_default(editor)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
356 | value = purple_account_option_get_default_int(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
357 | } else { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
358 | const gchar *setting = purple_account_option_get_setting(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
359 | gint def_value = purple_account_option_get_default_int(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
360 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
361 | value = purple_account_get_int(editor->account, setting, def_value); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
362 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
363 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
364 | /* Create the row and set its title with a mnemonic. */ |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
365 | row = adw_entry_row_new(); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
366 | g_object_bind_property(editor->advanced_toggle, "active", row, "visible", |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
367 | G_BINDING_SYNC_CREATE); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
368 | gtk_widget_set_focusable(row, FALSE); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
369 | adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
370 | adw_entry_row_set_input_purpose(ADW_ENTRY_ROW(row), |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
371 | GTK_INPUT_PURPOSE_NUMBER); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
372 | title = g_strdup_printf("_%s", purple_account_option_get_text(option)); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
373 | adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
374 | g_free(title); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
375 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
376 | adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group), |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
377 | row); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
378 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
379 | /* Add the row to the editor's list of advanced rows. */ |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
380 | editor->advanced_rows = g_list_append(editor->advanced_rows, row); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
381 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
382 | /* Set the default value. */ |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
383 | svalue = g_strdup_printf("%d", value); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
384 | gtk_editable_set_text(GTK_EDITABLE(row), svalue); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
385 | g_free(svalue); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
386 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
387 | return row; |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
388 | } |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
389 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
390 | static GtkWidget * |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
391 | pidgin_account_editor_add_advanced_string(PidginAccountEditor *editor, |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
392 | PurpleAccountOption *option) |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
393 | { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
394 | GtkWidget *row = NULL; |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
395 | gchar *title = NULL; |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
396 | const gchar *value = NULL; |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
397 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
398 | if(pidgin_account_editor_advanced_option_use_default(editor)) { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
399 | value = purple_account_option_get_default_string(option); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
400 | } else { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
401 | const gchar *setting = purple_account_option_get_setting(option); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
402 | const gchar *def_value = NULL; |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
403 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
404 | def_value = purple_account_option_get_default_string(option); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
405 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
406 | value = purple_account_get_string(editor->account, setting, def_value); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
407 | } |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
408 | |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
409 | /* Create the row depending on the masked hint. */ |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
410 | if(purple_account_option_string_get_masked(option)) { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
411 | row = adw_password_entry_row_new(); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
412 | } else { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
413 | row = adw_entry_row_new(); |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
414 | } |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
415 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
416 | g_object_bind_property(editor->advanced_toggle, "active", row, "visible", |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
417 | G_BINDING_SYNC_CREATE); |
|
41780
1247cc856233
Remove extra focus targets from Account Editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41779
diff
changeset
|
418 | gtk_widget_set_focusable(row, FALSE); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
419 | adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
420 | title = g_strdup_printf("_%s", purple_account_option_get_text(option)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
421 | adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
422 | g_free(title); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
423 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
424 | adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
425 | row); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
426 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
427 | /* Add the row to the editor's list of advanced rows. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
428 | editor->advanced_rows = g_list_append(editor->advanced_rows, row); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
429 | |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
430 | if(value != NULL) { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
431 | gtk_editable_set_text(GTK_EDITABLE(row), value); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
432 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
433 | |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
434 | return row; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
435 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
436 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
437 | static GtkWidget * |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
438 | pidgin_account_editor_add_advanced_list(PidginAccountEditor *editor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
439 | PurpleAccountOption *option) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
440 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
441 | GtkWidget *row = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
442 | GtkStringList *model = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
443 | GList *data = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
444 | GList *items = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
445 | gchar *title = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
446 | const gchar *value = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
447 | guint index = 0; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
448 | guint position = 0; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
449 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
450 | if(pidgin_account_editor_advanced_option_use_default(editor)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
451 | value = purple_account_option_get_default_list_value(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
452 | } else { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
453 | const gchar *setting = purple_account_option_get_setting(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
454 | const gchar *def_value = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
455 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
456 | def_value = purple_account_option_get_default_list_value(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
457 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
458 | value = purple_account_get_string(editor->account, setting, def_value); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
459 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
460 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
461 | /* Create the row and set its title with a mnemonic. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
462 | row = adw_combo_row_new(); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
463 | g_object_bind_property(editor->advanced_toggle, "active", row, "visible", |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
464 | G_BINDING_SYNC_CREATE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
465 | adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
466 | adw_combo_row_set_use_subtitle(ADW_COMBO_ROW(row), TRUE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
467 | title = g_strdup_printf("_%s", purple_account_option_get_text(option)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
468 | adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
469 | g_free(title); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
470 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
471 | adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
472 | row); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
473 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
474 | /* Add the row to the editor's list of advanced rows. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
475 | editor->advanced_rows = g_list_append(editor->advanced_rows, row); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
476 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
477 | /* Create the model and data for the expression. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
478 | items = purple_account_option_get_list(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
479 | model = gtk_string_list_new(NULL); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
480 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
481 | for(GList *l = items; l != NULL; l = l->next) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
482 | PurpleKeyValuePair *kvp = l->data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
483 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
484 | if(kvp != NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
485 | if(purple_strequal(kvp->value, value)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
486 | position = index; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
487 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
488 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
489 | data = g_list_append(data, kvp->value); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
490 | gtk_string_list_append(model, kvp->key); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
491 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
492 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
493 | index++; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
494 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
495 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
496 | adw_combo_row_set_model(ADW_COMBO_ROW(row), G_LIST_MODEL(model)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
497 | adw_combo_row_set_selected(ADW_COMBO_ROW(row), position); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
498 | g_object_set_data_full(G_OBJECT(row), "keys", data, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
499 | (GDestroyNotify)g_list_free); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
500 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
501 | return row; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
502 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
503 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
504 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
505 | pidgin_account_editor_add_advanced_option(PidginAccountEditor *editor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
506 | PurpleAccountOption *option) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
507 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
508 | PurplePrefType type; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
509 | GtkWidget *widget = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
510 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
511 | type = purple_account_option_get_pref_type(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
512 | switch(type) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
513 | case PURPLE_PREF_BOOLEAN: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
514 | widget = pidgin_account_editor_add_advanced_boolean(editor, option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
515 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
516 | case PURPLE_PREF_INT: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
517 | widget = pidgin_account_editor_add_advanced_int(editor, option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
518 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
519 | case PURPLE_PREF_STRING: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
520 | widget = pidgin_account_editor_add_advanced_string(editor, option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
521 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
522 | case PURPLE_PREF_STRING_LIST: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
523 | widget = pidgin_account_editor_add_advanced_list(editor, option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
524 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
525 | default: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
526 | purple_debug_error("PidginAccountEditor", |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
527 | "Invalid Account Option pref type (%d)", type); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
528 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
529 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
530 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
531 | if(GTK_IS_WIDGET(widget)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
532 | g_object_set_data_full(G_OBJECT(widget), "option", option, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
533 | (GDestroyNotify)purple_account_option_destroy); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
534 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
535 | editor->advanced_entries = g_list_append(editor->advanced_entries, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
536 | widget); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
537 | } else { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
538 | purple_account_option_destroy(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
539 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
540 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
541 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
542 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
543 | pidgin_account_editor_update_advanced_options(PidginAccountEditor *editor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
544 | PurpleProtocol *protocol) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
545 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
546 | GList *options = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
547 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
548 | g_clear_pointer(&editor->advanced_entries, g_list_free); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
549 | while(editor->advanced_rows != NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
550 | adw_preferences_group_remove(ADW_PREFERENCES_GROUP(editor->advanced_group), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
551 | GTK_WIDGET(editor->advanced_rows->data)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
552 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
553 | editor->advanced_rows = g_list_delete_link(editor->advanced_rows, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
554 | editor->advanced_rows); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
555 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
556 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
557 | if(!PURPLE_IS_PROTOCOL(protocol)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
558 | gtk_widget_set_visible(editor->advanced_group, FALSE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
559 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
560 | return; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
561 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
562 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
563 | options = purple_protocol_get_account_options(protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
564 | if(options == NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
565 | gtk_widget_set_visible(editor->advanced_group, FALSE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
566 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
567 | return; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
568 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
569 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
570 | /* Iterate the options and call our helper which will take ownership of the |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
571 | * option itself, but we'll delete the list item as we go. |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
572 | */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
573 | while(options != NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
574 | pidgin_account_editor_add_advanced_option(editor, options->data); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
575 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
576 | options = g_list_delete_link(options, options); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
577 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
578 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
579 | gtk_widget_set_visible(editor->advanced_group, TRUE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
580 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
581 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
582 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
583 | pidgin_account_editor_update_proxy_options(PidginAccountEditor *editor) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
584 | PurpleProxyInfo *info = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
585 | GListModel *model = NULL; |
|
41858
38e61d11b89f
Migrate the static fields in PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41816
diff
changeset
|
586 | char *str = NULL; |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
587 | const char *type = "global"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
588 | const char *hostname = NULL; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
589 | const char *username = NULL; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
590 | const char *password = NULL; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
591 | int port = 8080; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
592 | guint position = 0; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
593 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
594 | if(!PURPLE_IS_ACCOUNT(editor->account)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
595 | return; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
596 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
597 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
598 | info = purple_account_get_proxy_info(editor->account); |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
599 | if(PURPLE_IS_PROXY_INFO(info)) { |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
600 | switch(purple_proxy_info_get_proxy_type(info)) { |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
601 | case PURPLE_PROXY_TYPE_USE_GLOBAL: |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
602 | type = "global"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
603 | break; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
604 | case PURPLE_PROXY_TYPE_NONE: |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
605 | type = "none"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
606 | break; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
607 | case PURPLE_PROXY_TYPE_SOCKS4: |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
608 | type = "socks4"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
609 | break; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
610 | case PURPLE_PROXY_TYPE_SOCKS5: |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
611 | type = "socks5"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
612 | break; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
613 | case PURPLE_PROXY_TYPE_TOR: |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
614 | type = "tor"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
615 | break; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
616 | case PURPLE_PROXY_TYPE_HTTP: |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
617 | type = "http"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
618 | break; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
619 | case PURPLE_PROXY_TYPE_USE_ENVVAR: |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
620 | type = "envvar"; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
621 | break; |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
622 | } |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
623 | |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
624 | hostname = purple_proxy_info_get_hostname(info); |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
625 | port = purple_proxy_info_get_port(info); |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
626 | username = purple_proxy_info_get_username(info); |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
627 | password = purple_proxy_info_get_password(info); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
628 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
629 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
630 | model = adw_combo_row_get_model(ADW_COMBO_ROW(editor->proxy_type)); |
|
42179
b8bb444799a4
Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42174
diff
changeset
|
631 | for(guint index = 0; index < g_list_model_get_n_items(model); index++) { |
|
b8bb444799a4
Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42174
diff
changeset
|
632 | const char *value = gtk_string_list_get_string(GTK_STRING_LIST(model), |
|
b8bb444799a4
Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42174
diff
changeset
|
633 | index); |
|
b8bb444799a4
Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42174
diff
changeset
|
634 | |
|
b8bb444799a4
Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42174
diff
changeset
|
635 | if(purple_strequal(type, value)) { |
|
b8bb444799a4
Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42174
diff
changeset
|
636 | position = index; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
637 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
638 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
639 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
640 | adw_combo_row_set_selected(ADW_COMBO_ROW(editor->proxy_type), position); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
641 | |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
642 | if(hostname == NULL) { |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
643 | hostname = ""; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
644 | } |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
645 | gtk_editable_set_text(GTK_EDITABLE(editor->proxy_host), hostname); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
646 | |
|
41858
38e61d11b89f
Migrate the static fields in PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41816
diff
changeset
|
647 | |
|
38e61d11b89f
Migrate the static fields in PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41816
diff
changeset
|
648 | str = g_strdup_printf("%d", port); |
|
38e61d11b89f
Migrate the static fields in PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41816
diff
changeset
|
649 | gtk_editable_set_text(GTK_EDITABLE(editor->proxy_port), str); |
|
38e61d11b89f
Migrate the static fields in PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41816
diff
changeset
|
650 | g_free(str); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
651 | |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
652 | if(username == NULL) { |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
653 | username = ""; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
654 | } |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
655 | gtk_editable_set_text(GTK_EDITABLE(editor->proxy_username), username); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
656 | |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
657 | if(password == NULL) { |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
658 | password = ""; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
659 | } |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
660 | gtk_editable_set_text(GTK_EDITABLE(editor->proxy_password), password); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
661 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
662 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
663 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
664 | pidgin_account_editor_update(PidginAccountEditor *editor) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
665 | PurpleProtocol *protocol = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
666 | gboolean sensitive = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
667 | |
|
42255
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
668 | /* Reset the sensitivity of the protocol chooser to sensitive. */ |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
669 | gtk_widget_set_sensitive(editor->protocol, TRUE); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
670 | if(PURPLE_IS_ACCOUNT(editor->account)) { |
|
42255
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
671 | if(purple_account_is_connected(editor->account)) { |
|
642478e32820
Fix a number of bugs in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
42246
diff
changeset
|
672 | /* If the account is connected, disable the protocol chooser. */ |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
673 | gtk_widget_set_sensitive(editor->protocol, FALSE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
674 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
675 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
676 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
677 | protocol = pidgin_protocol_chooser_get_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
678 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
679 | sensitive = pidgin_account_editor_update_login_options(editor, protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
680 | pidgin_account_editor_update_user_options(editor, protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
681 | pidgin_account_editor_update_advanced_options(editor, protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
682 | pidgin_account_editor_update_proxy_options(editor); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
683 | |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
684 | pidgin_account_editor_set_valid(editor, sensitive); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
685 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
686 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
687 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
688 | pidgin_account_editor_login_options_update_editable(PidginAccountEditor *editor) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
689 | { |
|
41779
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
690 | PidginProtocolChooser *chooser = NULL; |
|
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
691 | PurpleProtocol *selected_protocol = NULL; |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
692 | PurpleProtocolOptions options; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
693 | gboolean editable = TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
694 | |
|
41779
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
695 | chooser = PIDGIN_PROTOCOL_CHOOSER(editor->protocol); |
|
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
696 | selected_protocol = pidgin_protocol_chooser_get_protocol(chooser); |
|
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
697 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
698 | if(PURPLE_IS_ACCOUNT(editor->account)) { |
|
41779
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
699 | PurpleConnection *connection = NULL; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
700 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
701 | connection = purple_account_get_connection(editor->account); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
702 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
703 | /* If we have an active connection, we need to disable everything |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
704 | * related to the protocol and username. |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
705 | */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
706 | if(PURPLE_IS_CONNECTION(connection)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
707 | PurpleProtocol *connected_protocol = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
708 | editable = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
709 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
710 | /* Check if the user changed the protocol. If they did, switch it |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
711 | * back and update the editor to reflect what settings are active. |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
712 | */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
713 | connected_protocol = purple_connection_get_protocol(connection); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
714 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
715 | if(connected_protocol != selected_protocol) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
716 | pidgin_protocol_chooser_set_protocol(chooser, connected_protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
717 | pidgin_account_editor_update(editor); |
|
41779
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
718 | selected_protocol = connected_protocol; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
719 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
720 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
721 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
722 | |
|
41779
4e2314e70a03
Fix warnings when adding new account
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41776
diff
changeset
|
723 | options = purple_protocol_get_options(selected_protocol); |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
724 | gtk_widget_set_visible(editor->require_password_row, |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
725 | options & OPT_PROTO_PASSWORD_OPTIONAL); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
726 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
727 | gtk_widget_set_sensitive(editor->protocol, editable); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
728 | gtk_editable_set_editable(GTK_EDITABLE(editor->username), editable); |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
729 | for(GList *l = editor->user_split_rows; l != NULL; l = l->next) { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
730 | GtkWidget *row = l->data; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
731 | |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
732 | gtk_editable_set_editable(GTK_EDITABLE(row), editable); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
733 | } |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
734 | gtk_widget_set_sensitive(editor->require_password, editable); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
735 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
736 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
737 | static gboolean |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
738 | pidgin_account_editor_save_login_options(PidginAccountEditor *editor) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
739 | PurpleProtocol *protocol = NULL; |
|
42796
96d1ed6df91c
Fix memory leak when creating an IRCv3 account
Markus Fischer <ivanhoe@fiscari.de>
parents:
42788
diff
changeset
|
740 | GList *user_splits = NULL; |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
741 | GList *split_item = NULL; |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
742 | GList *row_item = NULL; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
743 | GString *username = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
744 | const gchar *protocol_id = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
745 | gboolean new_account = FALSE; |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
746 | gboolean require_password = FALSE; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
747 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
748 | protocol = pidgin_protocol_chooser_get_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
749 | protocol_id = purple_protocol_get_id(protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
750 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
751 | username = g_string_new(gtk_editable_get_text(GTK_EDITABLE(editor->username))); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
752 | |
|
42796
96d1ed6df91c
Fix memory leak when creating an IRCv3 account
Markus Fischer <ivanhoe@fiscari.de>
parents:
42788
diff
changeset
|
753 | user_splits = purple_protocol_get_user_splits(protocol); |
|
96d1ed6df91c
Fix memory leak when creating an IRCv3 account
Markus Fischer <ivanhoe@fiscari.de>
parents:
42788
diff
changeset
|
754 | split_item = g_list_first(user_splits); |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
755 | row_item = editor->user_split_rows; |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
756 | while(split_item != NULL && row_item != NULL) { |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
757 | PurpleAccountUserSplit *split = split_item->data; |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
758 | GtkWidget *row = row_item->data; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
759 | const gchar *value = ""; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
760 | gchar sep = '\0'; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
761 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
762 | sep = purple_account_user_split_get_separator(split); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
763 | g_string_append_c(username, sep); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
764 | |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
765 | if(GTK_IS_EDITABLE(row)) { |
|
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
766 | value = gtk_editable_get_text(GTK_EDITABLE(row)); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
767 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
768 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
769 | if(value == NULL || *value == '\0') { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
770 | value = purple_account_user_split_get_default_value(split); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
771 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
772 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
773 | g_string_append(username, value); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
774 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
775 | split_item = split_item->next; |
|
41863
0067a0ff5b74
Convert the dynamic fields of PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41858
diff
changeset
|
776 | row_item = row_item->next; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
777 | } |
|
42796
96d1ed6df91c
Fix memory leak when creating an IRCv3 account
Markus Fischer <ivanhoe@fiscari.de>
parents:
42788
diff
changeset
|
778 | g_list_free_full(user_splits, |
|
96d1ed6df91c
Fix memory leak when creating an IRCv3 account
Markus Fischer <ivanhoe@fiscari.de>
parents:
42788
diff
changeset
|
779 | (GDestroyNotify)purple_account_user_split_destroy); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
780 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
781 | if(!PURPLE_IS_ACCOUNT(editor->account)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
782 | editor->account = purple_account_new(username->str, protocol_id); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
783 | new_account = TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
784 | } else { |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
785 | purple_account_set_username(editor->account, username->str); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
786 | purple_account_set_protocol_id(editor->account, protocol_id); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
787 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
788 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
789 | g_string_free(username, TRUE); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
790 | |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
791 | require_password = gtk_switch_get_active(GTK_SWITCH(editor->require_password)); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
792 | purple_account_set_require_password(editor->account, require_password); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
793 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
794 | return new_account; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
795 | } |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
796 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
797 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
798 | pidgin_account_editor_save_user_options(PidginAccountEditor *editor) { |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
799 | PurpleContactInfo *info = NULL; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
800 | const gchar *svalue = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
801 | gboolean bvalue = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
802 | |
|
41946
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
803 | purple_account_freeze_notify_settings(editor->account); |
|
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
804 | |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
805 | info = purple_account_get_contact_info(editor->account); |
|
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42796
diff
changeset
|
806 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
807 | /* Set the alias. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
808 | svalue = gtk_editable_get_text(GTK_EDITABLE(editor->alias)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
809 | if(*svalue == '\0') { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
810 | svalue = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
811 | } |
|
41971
b03ca9889e90
Fix some Pidgin account deprecations I missed on my first pass
Gary Kramlich <grim@reaperworld.com>
parents:
41962
diff
changeset
|
812 | purple_contact_info_set_alias(info, svalue); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
813 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
814 | /* Set whether or not to use the global avatar. */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
815 | bvalue = gtk_switch_get_active(GTK_SWITCH(editor->use_custom_avatar)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
816 | purple_account_set_bool(editor->account, "use-global-buddyicon", !bvalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
817 | |
|
42724
2794bb8587d3
Remove buddy icons from Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42723
diff
changeset
|
818 | #pragma message("implement this when buddy icons do not suck so bad.") |
|
41946
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
819 | |
|
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
820 | purple_account_thaw_notify_settings(editor->account); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
821 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
822 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
823 | static void |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
824 | pidgin_account_editor_save_advanced_options(PidginAccountEditor *editor) { |
|
41946
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
825 | purple_account_freeze_notify_settings(editor->account); |
|
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
826 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
827 | for(GList *l = editor->advanced_entries; l != NULL; l = l->next) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
828 | GtkWidget *widget = l->data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
829 | PurpleAccountOption *option = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
830 | GList *keys = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
831 | const gchar *setting = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
832 | const gchar *svalue = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
833 | gboolean bvalue = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
834 | gint ivalue = 0; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
835 | guint selected = 0; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
836 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
837 | option = g_object_get_data(G_OBJECT(widget), "option"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
838 | setting = purple_account_option_get_setting(option); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
839 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
840 | switch(purple_account_option_get_pref_type(option)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
841 | case PURPLE_PREF_STRING: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
842 | svalue = gtk_editable_get_text(GTK_EDITABLE(widget)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
843 | purple_account_set_string(editor->account, setting, svalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
844 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
845 | case PURPLE_PREF_INT: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
846 | svalue = gtk_editable_get_text(GTK_EDITABLE(widget)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
847 | ivalue = atoi(svalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
848 | purple_account_set_int(editor->account, setting, ivalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
849 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
850 | case PURPLE_PREF_BOOLEAN: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
851 | bvalue = gtk_switch_get_active(GTK_SWITCH(widget)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
852 | purple_account_set_bool(editor->account, setting, bvalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
853 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
854 | case PURPLE_PREF_STRING_LIST: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
855 | keys = g_object_get_data(G_OBJECT(widget), "keys"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
856 | selected = adw_combo_row_get_selected(ADW_COMBO_ROW(widget)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
857 | svalue = g_list_nth_data(keys, selected); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
858 | purple_account_set_string(editor->account, setting, svalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
859 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
860 | default: |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
861 | break; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
862 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
863 | } |
|
41946
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
864 | |
|
0fb3b0e7122f
Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41928
diff
changeset
|
865 | purple_account_thaw_notify_settings(editor->account); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
866 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
867 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
868 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
869 | pidgin_account_editor_save_proxy(PidginAccountEditor *editor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
870 | gboolean new_account) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
871 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
872 | PurpleProxyInfo *info = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
873 | PurpleProxyType type = PURPLE_PROXY_TYPE_NONE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
874 | GObject *item = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
875 | const gchar *svalue = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
876 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
877 | /* Build the ProxyInfo object */ |
|
41816
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
878 | if(!new_account) { |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
879 | info = purple_account_get_proxy_info(editor->account); |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
880 | } |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
881 | |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
882 | /* If this is a new account, or the account's proxy info is null, create a |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
883 | * new instance, and set it on the account. |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
884 | */ |
|
f6baa88826a7
Fix a bunch of g_warnings in the account editor
Gary Kramlich <grim@reaperworld.com>
parents:
41780
diff
changeset
|
885 | if(new_account || !PURPLE_IS_PROXY_INFO(info)) { |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
886 | info = purple_proxy_info_new(); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
887 | purple_account_set_proxy_info(editor->account, info); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
888 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
889 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
890 | item = adw_combo_row_get_selected_item(ADW_COMBO_ROW(editor->proxy_type)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
891 | svalue = gtk_string_object_get_string(GTK_STRING_OBJECT(item)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
892 | if(purple_strequal(svalue, "global")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
893 | type = PURPLE_PROXY_TYPE_USE_GLOBAL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
894 | } else if(purple_strequal(svalue, "none")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
895 | type = PURPLE_PROXY_TYPE_NONE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
896 | } else if(purple_strequal(svalue, "socks4")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
897 | type = PURPLE_PROXY_TYPE_SOCKS4; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
898 | } else if(purple_strequal(svalue, "socks5")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
899 | type = PURPLE_PROXY_TYPE_SOCKS5; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
900 | } else if(purple_strequal(svalue, "tor")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
901 | type = PURPLE_PROXY_TYPE_TOR; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
902 | } else if(purple_strequal(svalue, "http")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
903 | type = PURPLE_PROXY_TYPE_HTTP; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
904 | } else if(purple_strequal(svalue, "envvar")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
905 | type = PURPLE_PROXY_TYPE_USE_ENVVAR; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
906 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
907 | purple_proxy_info_set_proxy_type(info, type); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
908 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
909 | svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_host)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
910 | purple_proxy_info_set_hostname(info, svalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
911 | |
|
41858
38e61d11b89f
Migrate the static fields in PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41816
diff
changeset
|
912 | svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_port)); |
|
38e61d11b89f
Migrate the static fields in PidginAccountEditor to AdwEntryRow
Gary Kramlich <grim@reaperworld.com>
parents:
41816
diff
changeset
|
913 | purple_proxy_info_set_port(info, atoi(svalue)); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
914 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
915 | svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_username)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
916 | purple_proxy_info_set_username(info, svalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
917 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
918 | svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_password)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
919 | purple_proxy_info_set_password(info, svalue); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
920 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
921 | |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
922 | /****************************************************************************** |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
923 | * Callbacks |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
924 | *****************************************************************************/ |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
925 | static void |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
926 | pidgin_account_editor_connection_changed_cb(G_GNUC_UNUSED GObject *obj, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
927 | G_GNUC_UNUSED GParamSpec *pspec, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
928 | gpointer data) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
929 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
930 | PidginAccountEditor *editor = data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
931 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
932 | pidgin_account_editor_login_options_update_editable(editor); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
933 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
934 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
935 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
936 | pidgin_account_editor_protocol_changed_cb(G_GNUC_UNUSED GObject *obj, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
937 | G_GNUC_UNUSED GParamSpec *pspec, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
938 | gpointer data) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
939 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
940 | pidgin_account_editor_update(data); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
941 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
942 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
943 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
944 | pidgin_account_editor_username_changed_cb(GtkEditable *self, gpointer data) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
945 | PidginAccountEditor *editor = data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
946 | const gchar *text = gtk_editable_get_text(self); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
947 | gboolean sensitive = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
948 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
949 | if(text != NULL && *text != '\0') { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
950 | sensitive = TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
951 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
952 | |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
953 | pidgin_account_editor_set_valid(editor, sensitive); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
954 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
955 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
956 | static void |
|
42352
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
957 | pidgin_account_editor_avatar_response_cb(GObject *obj, GAsyncResult *result, |
|
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
958 | gpointer data) |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
959 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
960 | PidginAccountEditor *editor = data; |
|
42352
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
961 | GFile *file = NULL; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
962 | |
|
42352
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
963 | file = gtk_file_dialog_open_finish(GTK_FILE_DIALOG(obj), result, NULL); |
|
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
964 | if(file != NULL) { |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
965 | GError *error = NULL; |
|
42352
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
966 | char *filename = NULL; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
967 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
968 | filename = g_file_get_path(file); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
969 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
970 | g_clear_object(&editor->avatar_pixbuf); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
971 | editor->avatar_pixbuf = gdk_pixbuf_new_from_file(filename, &error); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
972 | if(error != NULL) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
973 | g_warning("Failed to create pixbuf from file %s: %s", filename, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
974 | error->message); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
975 | g_clear_error(&error); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
976 | } else { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
977 | gtk_image_set_from_pixbuf(GTK_IMAGE(editor->avatar), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
978 | editor->avatar_pixbuf); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
979 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
980 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
981 | g_free(filename); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
982 | g_object_unref(file); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
983 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
984 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
985 | g_clear_object(&editor->avatar_dialog); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
986 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
987 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
988 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
989 | pidgin_account_editor_avatar_set_clicked_cb(G_GNUC_UNUSED GtkButton *self, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
990 | gpointer data) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
991 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
992 | PidginAccountEditor *editor = data; |
|
42352
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
993 | GtkRoot *root = NULL; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
994 | |
|
42352
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
995 | root = gtk_widget_get_root(GTK_WIDGET(editor)); |
|
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
996 | editor->avatar_dialog = gtk_file_dialog_new(); |
|
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
997 | gtk_file_dialog_set_title(editor->avatar_dialog, _("Buddy Icon")); |
|
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
998 | gtk_file_dialog_set_modal(editor->avatar_dialog, TRUE); |
|
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
999 | gtk_file_dialog_open(editor->avatar_dialog, GTK_WINDOW(root), NULL, |
|
1c53950f9052
Migrate from GtkFileChooserNative to GtkFileDialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42303
diff
changeset
|
1000 | pidgin_account_editor_avatar_response_cb, editor); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1001 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1002 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1003 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1004 | pidgin_account_editor_avatar_remove_clicked_cb(G_GNUC_UNUSED GtkButton *self, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1005 | gpointer data) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1006 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1007 | PidginAccountEditor *editor = data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1008 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1009 | gtk_image_set_from_icon_name(GTK_IMAGE(editor->avatar), "select-avatar"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1010 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1011 | g_clear_object(&editor->avatar_pixbuf); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1012 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1013 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1014 | static gchar * |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1015 | pidgin_account_editor_proxy_type_expression_cb(GObject *self, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1016 | G_GNUC_UNUSED gpointer data) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1017 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1018 | const gchar *text = ""; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1019 | const gchar *value = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1020 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1021 | value = gtk_string_object_get_string(GTK_STRING_OBJECT(self)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1022 | if(purple_strequal(value, "global")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1023 | text = _("Use Global Proxy Settings"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1024 | } else if(purple_strequal(value, "none")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1025 | text = _("No proxy"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1026 | } else if(purple_strequal(value, "socks4")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1027 | text = _("SOCKS 4"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1028 | } else if(purple_strequal(value, "socks5")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1029 | text = _("SOCKS 5"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1030 | } else if(purple_strequal(value, "tor")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1031 | text = _("Tor/Privacy (SOCKS 5)"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1032 | } else if(purple_strequal(value, "http")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1033 | text = _("HTTP"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1034 | } else if(purple_strequal(value, "envvar")) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1035 | text = _("Use Environmental Settings"); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1036 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1037 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1038 | return g_strdup(text); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1039 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1040 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1041 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1042 | pidgin_account_editor_proxy_type_changed_cb(G_GNUC_UNUSED GObject *obj, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1043 | G_GNUC_UNUSED GParamSpec *pspec, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1044 | gpointer data) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1045 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1046 | PidginAccountEditor *editor = data; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1047 | GObject *selected = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1048 | gboolean show_options = TRUE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1049 | const gchar *value = NULL; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1050 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1051 | selected = adw_combo_row_get_selected_item(ADW_COMBO_ROW(editor->proxy_type)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1052 | value = gtk_string_object_get_string(GTK_STRING_OBJECT(selected)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1053 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1054 | if(purple_strequal(value, "global") || purple_strequal(value, "none") || |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1055 | purple_strequal(value, "envvar")) |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1056 | { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1057 | show_options = FALSE; |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1058 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1059 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1060 | gtk_widget_set_visible(editor->proxy_options, show_options); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1061 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1062 | |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1063 | /****************************************************************************** |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1064 | * GObject Implementation |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1065 | *****************************************************************************/ |
|
42575
580339aa47cc
Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42440
diff
changeset
|
1066 | G_DEFINE_FINAL_TYPE(PidginAccountEditor, pidgin_account_editor, |
|
580339aa47cc
Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42440
diff
changeset
|
1067 | ADW_TYPE_PREFERENCES_PAGE) |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1068 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1069 | static void |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1070 | pidgin_account_editor_get_property(GObject *obj, guint param_id, GValue *value, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1071 | GParamSpec *pspec) |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1072 | { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1073 | PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1074 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1075 | switch(param_id) { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1076 | case PROP_ACCOUNT: |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1077 | g_value_set_object(value, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1078 | pidgin_account_editor_get_account(editor)); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1079 | break; |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1080 | case PROP_VALID: |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1081 | g_value_set_boolean(value, |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1082 | pidgin_account_editor_get_is_valid(editor)); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1083 | break; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1084 | default: |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1085 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1086 | break; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1087 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1088 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1089 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1090 | static void |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1091 | pidgin_account_editor_set_property(GObject *obj, guint param_id, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1092 | const GValue *value, GParamSpec *pspec) |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1093 | { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1094 | PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1095 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1096 | switch(param_id) { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1097 | case PROP_ACCOUNT: |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1098 | pidgin_account_editor_set_account(editor, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1099 | g_value_get_object(value)); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1100 | break; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1101 | default: |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1102 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1103 | break; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1104 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1105 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1106 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1107 | static void |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1108 | pidgin_account_editor_dispose(GObject *obj) { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1109 | PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1110 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1111 | g_clear_object(&editor->account); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1112 | g_clear_object(&editor->avatar_dialog); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1113 | g_clear_object(&editor->avatar_pixbuf); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1114 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1115 | G_OBJECT_CLASS(pidgin_account_editor_parent_class)->dispose(obj); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1116 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1117 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1118 | static void |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1119 | pidgin_account_editor_init(PidginAccountEditor *editor) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1120 | GtkWidget *widget = GTK_WIDGET(editor); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1121 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1122 | gtk_widget_init_template(widget); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1123 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1124 | pidgin_account_editor_proxy_type_changed_cb(NULL, NULL, editor); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1125 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1126 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1127 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1128 | pidgin_account_editor_constructed(GObject *obj) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1129 | PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1130 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1131 | G_OBJECT_CLASS(pidgin_account_editor_parent_class)->constructed(obj); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1132 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1133 | if(PURPLE_IS_ACCOUNT(editor->account)) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1134 | pidgin_protocol_chooser_set_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol), |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1135 | purple_account_get_protocol(editor->account)); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1136 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1137 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1138 | pidgin_account_editor_update(editor); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1139 | pidgin_account_editor_login_options_update_editable(editor); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1140 | } |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1141 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1142 | static void |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1143 | pidgin_account_editor_finalize(GObject *obj) { |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1144 | PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1145 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1146 | g_clear_pointer(&editor->user_split_rows, g_list_free); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1147 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1148 | g_clear_pointer(&editor->advanced_entries, g_list_free); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1149 | g_clear_pointer(&editor->advanced_rows, g_list_free); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1150 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1151 | G_OBJECT_CLASS(pidgin_account_editor_parent_class)->finalize(obj); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1152 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1153 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1154 | static void |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1155 | pidgin_account_editor_class_init(PidginAccountEditorClass *klass) { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1156 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1157 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1158 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1159 | obj_class->get_property = pidgin_account_editor_get_property; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1160 | obj_class->set_property = pidgin_account_editor_set_property; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1161 | obj_class->constructed = pidgin_account_editor_constructed; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1162 | obj_class->dispose = pidgin_account_editor_dispose; |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1163 | obj_class->finalize = pidgin_account_editor_finalize; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1164 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1165 | /** |
|
42303
52c26807d91a
Fix a number of issues with the documentation for properties
Gary Kramlich <grim@reaperworld.com>
parents:
42261
diff
changeset
|
1166 | * PidginAccountEditor:account: |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1167 | * |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1168 | * The account that this editor is modifying. |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1169 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42575
diff
changeset
|
1170 | * Since: 3.0 |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1171 | */ |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1172 | properties[PROP_ACCOUNT] = g_param_spec_object( |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1173 | "account", "account", |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1174 | "The account to modify", |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1175 | PURPLE_TYPE_ACCOUNT, |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1176 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1177 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1178 | /** |
|
42303
52c26807d91a
Fix a number of issues with the documentation for properties
Gary Kramlich <grim@reaperworld.com>
parents:
42261
diff
changeset
|
1179 | * PidginAccountEditor:valid: |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1180 | * |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1181 | * Whether or not the account settings are valid and it is okay to save the |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1182 | * account. |
|
42303
52c26807d91a
Fix a number of issues with the documentation for properties
Gary Kramlich <grim@reaperworld.com>
parents:
42261
diff
changeset
|
1183 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42575
diff
changeset
|
1184 | * Since: 3.0 |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1185 | */ |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1186 | properties[PROP_VALID] = g_param_spec_boolean( |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1187 | "valid", "valid", |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1188 | "Whether or not the account settings are valid", |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1189 | FALSE, |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1190 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1191 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1192 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1193 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1194 | gtk_widget_class_set_template_from_resource(widget_class, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1195 | "/im/pidgin/Pidgin3/Accounts/editor.ui"); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1196 | |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1197 | /* Login Options */ |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1198 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1199 | login_options); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1200 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1201 | protocol); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1202 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1203 | username); |
|
41776
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
1204 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
1205 | user_splits); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
1206 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
1207 | require_password_row); |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
1208 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
3dc254c25eeb
Add the require password option to PidginAccountEditor
Gary Kramlich <grim@reaperworld.com>
parents:
41688
diff
changeset
|
1209 | require_password); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1210 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1211 | gtk_widget_class_bind_template_callback(widget_class, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1212 | pidgin_account_editor_protocol_changed_cb); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1213 | gtk_widget_class_bind_template_callback(widget_class, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1214 | pidgin_account_editor_username_changed_cb); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1215 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1216 | /* User Options */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1217 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1218 | alias); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1219 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1220 | avatar_row); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1221 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1222 | use_custom_avatar); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1223 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1224 | avatar); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1225 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1226 | gtk_widget_class_bind_template_callback(widget_class, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1227 | pidgin_account_editor_avatar_set_clicked_cb); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1228 | gtk_widget_class_bind_template_callback(widget_class, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1229 | pidgin_account_editor_avatar_remove_clicked_cb); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1230 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1231 | /* Advanced Options */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1232 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1233 | advanced_group); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1234 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1235 | advanced_toggle); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1236 | |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1237 | /* Proxy Options */ |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1238 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1239 | proxy_type); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1240 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1241 | proxy_options); |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1242 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1243 | proxy_host); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1244 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1245 | proxy_port); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1246 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1247 | proxy_username); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1248 | gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1249 | proxy_password); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1250 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1251 | gtk_widget_class_bind_template_callback(widget_class, |
|
41688
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1252 | pidgin_account_editor_proxy_type_expression_cb); |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1253 | gtk_widget_class_bind_template_callback(widget_class, |
|
6ccdb4116ca2
Modernize the AccountEditor.
Gary Kramlich <grim@reaperworld.com>
parents:
41560
diff
changeset
|
1254 | pidgin_account_editor_proxy_type_changed_cb); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1255 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1256 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1257 | /****************************************************************************** |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1258 | * API |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1259 | *****************************************************************************/ |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1260 | GtkWidget * |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1261 | pidgin_account_editor_new(PurpleAccount *account) { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1262 | return g_object_new(PIDGIN_TYPE_ACCOUNT_EDITOR, "account", account, NULL); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1263 | } |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1264 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1265 | PurpleAccount * |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1266 | pidgin_account_editor_get_account(PidginAccountEditor *editor) { |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1267 | g_return_val_if_fail(PIDGIN_IS_ACCOUNT_EDITOR(editor), NULL); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1268 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1269 | return editor->account; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1270 | } |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1271 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1272 | void |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1273 | pidgin_account_editor_set_account(PidginAccountEditor *editor, |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1274 | PurpleAccount *account) |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1275 | { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1276 | g_return_if_fail(PIDGIN_IS_ACCOUNT_EDITOR(editor)); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1277 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1278 | /* Disconnect the notify handler from the previous account. */ |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1279 | if(PURPLE_IS_ACCOUNT(editor->account)) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1280 | g_signal_handlers_disconnect_by_func(editor->account, |
|
42246
3230f1a1fb8f
Remove unnecessary casting from g_signal_handlers_disconnect
Gary Kramlich <grim@reaperworld.com>
parents:
42179
diff
changeset
|
1281 | pidgin_account_editor_connection_changed_cb, |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1282 | editor); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1283 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1284 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1285 | if(g_set_object(&editor->account, account)) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1286 | if(PURPLE_IS_ACCOUNT(account)) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1287 | pidgin_protocol_chooser_set_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol), |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1288 | purple_account_get_protocol(editor->account)); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1289 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1290 | g_signal_connect_object(account, "notify::connection", |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1291 | G_CALLBACK(pidgin_account_editor_connection_changed_cb), |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1292 | editor, 0); |
|
42261
d5651ee577d8
Fix creating new accounts
Gary Kramlich <grim@reaperworld.com>
parents:
42255
diff
changeset
|
1293 | } else { |
|
d5651ee577d8
Fix creating new accounts
Gary Kramlich <grim@reaperworld.com>
parents:
42255
diff
changeset
|
1294 | /* If we don't have an account reset the fields that are static. */ |
|
d5651ee577d8
Fix creating new accounts
Gary Kramlich <grim@reaperworld.com>
parents:
42255
diff
changeset
|
1295 | pidgin_protocol_chooser_set_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol), |
|
d5651ee577d8
Fix creating new accounts
Gary Kramlich <grim@reaperworld.com>
parents:
42255
diff
changeset
|
1296 | NULL); |
|
d5651ee577d8
Fix creating new accounts
Gary Kramlich <grim@reaperworld.com>
parents:
42255
diff
changeset
|
1297 | gtk_editable_set_text(GTK_EDITABLE(editor->username), ""); |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1298 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1299 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1300 | g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_ACCOUNT]); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1301 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1302 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1303 | pidgin_account_editor_update(editor); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1304 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1305 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1306 | gboolean |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1307 | pidgin_account_editor_get_is_valid(PidginAccountEditor *editor) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1308 | g_return_val_if_fail(PIDGIN_IS_ACCOUNT_EDITOR(editor), FALSE); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1309 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1310 | return editor->valid; |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1311 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1312 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1313 | void |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1314 | pidgin_account_editor_save(PidginAccountEditor *editor) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1315 | gboolean new_account = FALSE; |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1316 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1317 | g_return_if_fail(PIDGIN_IS_ACCOUNT_EDITOR(editor)); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1318 | g_return_if_fail(editor->valid == TRUE); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1319 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1320 | new_account = pidgin_account_editor_save_login_options(editor); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1321 | pidgin_account_editor_save_user_options(editor); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1322 | pidgin_account_editor_save_advanced_options(editor); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1323 | pidgin_account_editor_save_proxy(editor, new_account); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1324 | |
|
42700
3e480ee2d7ee
Move Pidgin to the presence API
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
1325 | /* If this is a new account, enable it, and add it to the account manager. |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1326 | */ |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1327 | if(new_account) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1328 | PurpleAccountManager *manager = NULL; |
|
42700
3e480ee2d7ee
Move Pidgin to the presence API
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
1329 | |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1330 | manager = purple_account_manager_get_default(); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1331 | purple_account_manager_add(manager, editor->account); |
|
42788
33f25c732a0b
Fix problem that the enabled-accounts menu is empty when creating a new account
Markus Fischer <ivanhoe@fiscari.de>
parents:
42724
diff
changeset
|
1332 | |
|
33f25c732a0b
Fix problem that the enabled-accounts menu is empty when creating a new account
Markus Fischer <ivanhoe@fiscari.de>
parents:
42724
diff
changeset
|
1333 | purple_account_set_enabled(editor->account, TRUE); |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1334 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
41971
diff
changeset
|
1335 | } |