Thu, 25 Aug 2022 20:28:29 -0500
Port the AccountChooser to GTK4
Testing Done:
Open the new im dialog and verified the account chooser worked as expected.
Reviewed at https://reviews.imfreedom.org/r/1645/
|
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" |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | struct _PidginAccountManager { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | GtkDialog parent; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | GtkListStore *model; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | GtkTreeSelection *selection; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | GtkWidget *modify_button; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | GtkWidget *remove_button; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | }; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | enum { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | RESPONSE_ADD, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | RESPONSE_MODIFY, |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
46 | RESPONSE_REMOVE, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
47 | RESPONSE_ADD_OLD, |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
48 | RESPONSE_MODIFY_OLD |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | }; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | enum { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | COLUMN_ENABLED, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | COLUMN_AVATAR, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | COLUMN_USERNAME, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | COLUMN_PROTOCOL_ICON, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | COLUMN_PROTOCOL_NAME, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | COLUMN_ACCOUNT |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | }; |
|
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 | 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
|
61 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | static void pidgin_account_manager_account_notify_cb(GObject *obj, GParamSpec *pspec, gpointer data); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | * Helpers |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | *****************************************************************************/ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | static gboolean |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | pidgin_account_manager_find_account(PidginAccountManager *manager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | PurpleAccount *account, GtkTreeIter *iter) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | GtkTreeModel *model = GTK_TREE_MODEL(manager->model); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | if(!gtk_tree_model_get_iter_first(model, iter)) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | return FALSE; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | do { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | PurpleAccount *current = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | gtk_tree_model_get(model, iter, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | COLUMN_ACCOUNT, ¤t, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | -1); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | if(current == account) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | g_clear_object(¤t); |
|
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 | return TRUE; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | g_clear_object(¤t); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | } while(gtk_tree_model_iter_next(model, iter)); |
|
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 | return FALSE; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | static PurpleAccount * |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | pidgin_account_manager_get_selected_account(PidginAccountManager *manager) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | PurpleAccount *account = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | GtkTreeIter iter; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | if(gtk_tree_selection_count_selected_rows(manager->selection) == 0) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | return NULL; |
|
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 | gtk_tree_selection_get_selected(manager->selection, NULL, &iter); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | gtk_tree_model_get(GTK_TREE_MODEL(manager->model), &iter, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | COLUMN_ACCOUNT, &account, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | -1); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | return account; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | pidgin_account_manager_refresh_account(PidginAccountManager *manager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | PurpleAccount *account, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | GtkTreeIter *iter) |
|
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 | PurpleImage *image = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | PurpleProtocol *protocol = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | GdkPixbuf *avatar = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | const gchar *protocol_icon = NULL, *protocol_name = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | /* Try to find the avatar for the account. */ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | image = purple_buddy_icons_find_account_icon(account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | if(image != NULL) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | GdkPixbuf *raw = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | |
|
41319
04d027ed3d63
Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents:
41310
diff
changeset
|
129 | raw = purple_gdk_pixbuf_from_image(image); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | g_object_unref(image); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | avatar = gdk_pixbuf_scale_simple(raw, 22, 22, GDK_INTERP_HYPER); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | g_clear_object(&raw); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | } |
|
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 | /* Get the protocol fields. */ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | protocol = purple_account_get_protocol(account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | if(PURPLE_IS_PROTOCOL(protocol)) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | protocol_name = purple_protocol_get_name(protocol); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | protocol_icon = purple_protocol_get_icon_name(protocol); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | } else { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | protocol_name = _("Unknown"); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | } |
|
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 | gtk_list_store_set(manager->model, iter, |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41319
diff
changeset
|
146 | COLUMN_ENABLED, purple_account_get_enabled(account), |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | COLUMN_AVATAR, avatar, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | COLUMN_USERNAME, purple_account_get_username(account), |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | COLUMN_PROTOCOL_ICON, protocol_icon, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | COLUMN_PROTOCOL_NAME, protocol_name, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | COLUMN_ACCOUNT, account, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | -1); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | g_clear_object(&avatar); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | pidgin_account_manager_update_account(PidginAccountManager *manager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | PurpleAccount *account) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | GtkTreeIter iter; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | if(pidgin_account_manager_find_account(manager, account, &iter)) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | pidgin_account_manager_refresh_account(manager, account, &iter); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | pidgin_account_manager_add_account(PidginAccountManager *manager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | PurpleAccount *account) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | GtkTreeIter iter; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | gtk_list_store_append(manager->model, &iter); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | pidgin_account_manager_refresh_account(manager, account, &iter); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | g_signal_connect_object(account, "notify", |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | G_CALLBACK(pidgin_account_manager_account_notify_cb), |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | manager, 0); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | pidgin_account_manager_populate_helper(PurpleAccount *account, gpointer data) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | pidgin_account_manager_add_account(PIDGIN_ACCOUNT_MANAGER(data), account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | pidgin_account_manager_populate(PidginAccountManager *manager) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | purple_account_manager_foreach(purple_account_manager_get_default(), |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | pidgin_account_manager_populate_helper, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | manager); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | * Callbacks |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | *****************************************************************************/ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | pidgin_account_manager_account_notify_cb(GObject *obj, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | G_GNUC_UNUSED GParamSpec *pspec, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | PidginAccountManager *manager = PIDGIN_ACCOUNT_MANAGER(data); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | PurpleAccount *account = PURPLE_ACCOUNT(obj); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | pidgin_account_manager_update_account(manager, account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | 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
|
211 | G_GNUC_UNUSED gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | 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
|
214 | PurpleAccount *account = NULL; |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
215 | GtkWidget *editor = NULL; |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | switch(response_id) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | case RESPONSE_ADD: |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
219 | editor = pidgin_account_editor_new(NULL); |
|
41560
2579a5138f0c
A bunch of random fixes for the the gtk4 branch
Gary Kramlich <grim@reaperworld.com>
parents:
41546
diff
changeset
|
220 | gtk_widget_show(editor); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
221 | break; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
222 | case RESPONSE_ADD_OLD: |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | pidgin_account_dialog_show(PIDGIN_ADD_ACCOUNT_DIALOG, NULL); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | break; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | case RESPONSE_MODIFY: |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | account = pidgin_account_manager_get_selected_account(manager); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
228 | editor = pidgin_account_editor_new(account); |
|
41560
2579a5138f0c
A bunch of random fixes for the the gtk4 branch
Gary Kramlich <grim@reaperworld.com>
parents:
41546
diff
changeset
|
229 | gtk_widget_show(editor); |
|
41483
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
230 | |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
231 | g_clear_object(&account); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
232 | break; |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
233 | case RESPONSE_MODIFY_OLD: |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
234 | account = pidgin_account_manager_get_selected_account(manager); |
|
e3bd18c1769d
The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41439
diff
changeset
|
235 | |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | g_clear_object(&account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | break; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | case RESPONSE_REMOVE: |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | account = pidgin_account_manager_get_selected_account(manager); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | purple_accounts_delete(account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | g_clear_object(&account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | break; |
|
41439
3745e6e9d836
handle GTK_RESPONSE_DELETE_EVENT when closing account manager via window manager
ivanhoe <ivanhoe@fiscari.de>
parents:
41392
diff
changeset
|
249 | case GTK_RESPONSE_DELETE_EVENT: |
|
3745e6e9d836
handle GTK_RESPONSE_DELETE_EVENT when closing account manager via window manager
ivanhoe <ivanhoe@fiscari.de>
parents:
41392
diff
changeset
|
250 | /* fallthrough */ |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | case GTK_RESPONSE_CLOSE: |
|
41546
f9c9174d3747
Update PidginAccountManager for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41483
diff
changeset
|
252 | 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
|
253 | break; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | default: |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | 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
|
256 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | pidgin_account_manager_selection_changed_cb(GtkTreeSelection *selection, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | PidginAccountManager *manager = data; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | gboolean sensitive = TRUE; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | if(gtk_tree_selection_count_selected_rows(selection) == 0) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | sensitive = FALSE; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | gtk_widget_set_sensitive(manager->modify_button, sensitive); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | gtk_widget_set_sensitive(manager->remove_button, sensitive); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | pidgin_account_manager_row_activated_cb(G_GNUC_UNUSED GtkTreeView *tree_view, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | GtkTreePath *path, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | G_GNUC_UNUSED GtkTreeViewColumn *column, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | PidginAccountManager *manager = data; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | GtkTreeIter iter; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | if(gtk_tree_model_get_iter(GTK_TREE_MODEL(manager->model), &iter, path)) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | PurpleAccount *account = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | gtk_tree_model_get(GTK_TREE_MODEL(manager->model), &iter, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | COLUMN_ACCOUNT, &account, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | -1); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | g_clear_object(&account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | pidgin_account_manager_enable_toggled_cb(G_GNUC_UNUSED GtkCellRendererToggle *renderer, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | gchar *path, gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | PidginAccountManager *manager = data; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | GtkTreeModel *model = GTK_TREE_MODEL(manager->model); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | GtkTreeIter iter; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | if(gtk_tree_model_get_iter_from_string(model, &iter, path)) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | PurpleAccount *account = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | gboolean enabled = FALSE; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | /* The value of enabled in the model is the old value, so if enabled |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | * is currently set to TRUE, we are disabling the account and vice |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | * versa. |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | */ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | gtk_tree_model_get(model, &iter, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | COLUMN_ENABLED, &enabled, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | COLUMN_ACCOUNT, &account, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | -1); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | /* The account was just enabled, so set its status. */ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | if(!enabled) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | PurpleSavedStatus *status = purple_savedstatus_get_current(); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | purple_savedstatus_activate_for_account(status, account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41319
diff
changeset
|
323 | purple_account_set_enabled(account, !enabled); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | /* We don't update the model here, as it's updated via the notify |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | * signal. |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | */ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | pidgin_account_manager_account_added_cb(G_GNUC_UNUSED PurpleAccountManager *purple_manager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | PurpleAccount *account, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | PidginAccountManager *manager = data; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | pidgin_account_manager_add_account(manager, account); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | pidgin_account_manager_account_removed_cb(G_GNUC_UNUSED PurpleAccountManager *purple_manager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | PurpleAccount *account, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | gpointer data) |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | PidginAccountManager *manager = data; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | GtkTreeIter iter; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | if(pidgin_account_manager_find_account(manager, account, &iter)) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | gtk_list_store_remove(manager->model, &iter); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | * GObject Implementation |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | *****************************************************************************/ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | pidgin_account_manager_init(PidginAccountManager *manager) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | PurpleAccountManager *purple_manager = NULL; |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | 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
|
362 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | pidgin_account_manager_populate(manager); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | purple_manager = purple_account_manager_get_default(); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
366 | g_signal_connect_object(purple_manager, "added", |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
367 | G_CALLBACK(pidgin_account_manager_account_added_cb), |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
368 | manager, 0); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
369 | g_signal_connect_object(purple_manager, "removed", |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | G_CALLBACK(pidgin_account_manager_account_removed_cb), |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
371 | manager, 0); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | static void |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | 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
|
376 | 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
|
377 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
378 | 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
|
379 | widget_class, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | "/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
|
381 | ); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | gtk_widget_class_bind_template_child(widget_class, PidginAccountManager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | model); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | gtk_widget_class_bind_template_child(widget_class, PidginAccountManager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | selection); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | gtk_widget_class_bind_template_child(widget_class, PidginAccountManager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | modify_button); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | gtk_widget_class_bind_template_child(widget_class, PidginAccountManager, |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
391 | remove_button); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | 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
|
394 | pidgin_account_manager_enable_toggled_cb); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | 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
|
396 | pidgin_account_manager_response_cb); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | 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
|
398 | 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
|
399 | 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
|
400 | pidgin_account_manager_selection_changed_cb); |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | } |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
403 | /****************************************************************************** |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
404 | * Public API |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | *****************************************************************************/ |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | GtkWidget * |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | pidgin_account_manager_new(void) { |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | 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
|
409 | } |