Thu, 23 Feb 2023 06:00:48 -0600
IRCv3: Port to our new SASL library named Hasl
Testing Done:
Connected to a local ergo and verfied that `PLAIN` worked with the right password and that it fell back to `EXTERNAL` with the wrong password, before giving up.
Reviewed at https://reviews.imfreedom.org/r/2236/
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n.h> |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <purple.h> |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include "pidginaccountmanager.h" |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | #include "gtkaccount.h" |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | #include "pidgincore.h" |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
31 | #include "pidginaccounteditor.h" |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
32 | #include "pidginaccountrow.h" |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | struct _PidginAccountManager { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | GtkDialog parent; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
37 | GtkListBox *list_box; |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
38 | GtkWidget *add; |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | }; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | enum { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | RESPONSE_ADD, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | }; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | G_DEFINE_TYPE(PidginAccountManager, pidgin_account_manager, GTK_TYPE_DIALOG) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | * Helpers |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | *****************************************************************************/ |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
50 | static GtkWidget * |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
51 | pidgin_account_manager_create_widget(gpointer item, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
52 | G_GNUC_UNUSED gpointer data) |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | { |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
54 | if(!PURPLE_IS_ACCOUNT(item)) { |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | return NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
58 | return pidgin_account_row_new(PURPLE_ACCOUNT(item)); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
41818
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
61 | static void |
|
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
62 | pidgin_account_manager_create_account(PidginAccountManager *manager) { |
|
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
63 | GtkWidget *editor = pidgin_account_editor_new(NULL); |
|
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
64 | gtk_window_set_transient_for(GTK_WINDOW(editor), |
|
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
65 | GTK_WINDOW(manager)); |
|
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
66 | gtk_window_present_with_time(GTK_WINDOW(editor), GDK_CURRENT_TIME); |
|
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
67 | } |
|
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
68 | |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | * Callbacks |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | *****************************************************************************/ |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
72 | |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | static void |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
74 | pidgin_account_manager_refresh_add_cb(GListModel *list, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
75 | G_GNUC_UNUSED guint position, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
76 | G_GNUC_UNUSED guint removed, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
77 | G_GNUC_UNUSED guint added, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
78 | gpointer data) |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | { |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
80 | PidginAccountManager *manager = data; |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
82 | /* If there are no accounts, the placeholder is shown, which includes an |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
83 | * Add button. So hide the one in the button box if that's the case. */ |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
84 | gtk_widget_set_visible(manager->add, g_list_model_get_n_items(list) != 0); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | pidgin_account_manager_response_cb(GtkDialog *dialog, gint response_id, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | G_GNUC_UNUSED gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | PidginAccountManager *manager = PIDGIN_ACCOUNT_MANAGER(dialog); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | switch(response_id) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | case RESPONSE_ADD: |
|
41818
60b85f276728
Clean up pidgin_account_manager_response_cb to make it a bit more readable
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
95 | pidgin_account_manager_create_account(manager); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
96 | break; |
|
41596
2f0fec76cfbc
Handle delete event in more dialogs (probably all, but can't be too sure.)
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41560
diff
changeset
|
97 | case GTK_RESPONSE_CLOSE: |
|
41439
3745e6e9d836
handle GTK_RESPONSE_DELETE_EVENT when closing account manager via window manager
ivanhoe <ivanhoe@fiscari.de>
parents:
41392
diff
changeset
|
98 | case GTK_RESPONSE_DELETE_EVENT: |
|
41546
f9c9174d3747
Update PidginAccountManager for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41483
diff
changeset
|
99 | gtk_window_destroy(GTK_WINDOW(dialog)); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | break; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | default: |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | g_warning("not sure how you got here..."); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | static void |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
107 | pidgin_account_manager_row_activated_cb(G_GNUC_UNUSED GtkListBox *box, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
108 | GtkListBoxRow *row, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
109 | G_GNUC_UNUSED gpointer data) |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | { |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
111 | GtkWidget *editor = NULL; |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
112 | PurpleAccount *account = NULL; |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
114 | account = pidgin_account_row_get_account(PIDGIN_ACCOUNT_ROW(row)); |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
115 | editor = pidgin_account_editor_new(account); |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
116 | gtk_widget_show(editor); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | * GObject Implementation |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | *****************************************************************************/ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | pidgin_account_manager_init(PidginAccountManager *manager) { |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
124 | GListModel *purple_manager = NULL; |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | gtk_widget_init_template(GTK_WIDGET(manager)); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
128 | purple_manager = purple_account_manager_get_default_as_model(); |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
129 | gtk_list_box_bind_model(manager->list_box, purple_manager, |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
130 | pidgin_account_manager_create_widget, NULL, NULL); |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
131 | g_signal_connect_object(purple_manager, "items-changed", |
|
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
132 | G_CALLBACK(pidgin_account_manager_refresh_add_cb), |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | manager, 0); |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
134 | pidgin_account_manager_refresh_add_cb(purple_manager, 0, 0, 0, manager); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | pidgin_account_manager_class_init(PidginAccountManagerClass *klass) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | gtk_widget_class_set_template_from_resource( |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | widget_class, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | "/im/pidgin/Pidgin3/Accounts/manager.ui" |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | ); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | gtk_widget_class_bind_template_child(widget_class, PidginAccountManager, |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
147 | list_box); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | gtk_widget_class_bind_template_child(widget_class, PidginAccountManager, |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
149 | add); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | gtk_widget_class_bind_template_callback(widget_class, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | pidgin_account_manager_response_cb); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | gtk_widget_class_bind_template_callback(widget_class, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | pidgin_account_manager_row_activated_cb); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | gtk_widget_class_bind_template_callback(widget_class, |
|
42028
f3090252de57
Re-design account manager as a GtkListBox
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
156 | pidgin_account_manager_create_account); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | * Public API |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | *****************************************************************************/ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | GtkWidget * |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | pidgin_account_manager_new(void) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | return g_object_new(PIDGIN_TYPE_ACCOUNT_MANAGER, NULL); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | } |