Wed, 22 Jan 2025 20:47:54 -0600
Prepare for the 2.14.14 release
Testing Done:
Ran `make distcheck`
Reviewed at https://reviews.imfreedom.org/r/3779/
| 6371 | 1 | /** |
| 2 | * @file gtkprivacy.c GTK+ Privacy UI | |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
15931
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* pidgin |
| 6371 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
11 | * |
| 6371 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18327
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6371 | 25 | */ |
| 9791 | 26 | #include "internal.h" |
| 15577 | 27 | #include "pidgin.h" |
| 6371 | 28 | |
| 29 | #include "connection.h" | |
| 30 | #include "debug.h" | |
| 31 | #include "privacy.h" | |
| 32 | #include "request.h" | |
| 33 | #include "util.h" | |
| 34 | ||
|
11111
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11047
diff
changeset
|
35 | #include "gtkblist.h" |
| 6371 | 36 | #include "gtkprivacy.h" |
| 37 | #include "gtkutils.h" | |
| 38 | ||
| 39 | typedef struct | |
| 40 | { | |
| 41 | GtkWidget *win; | |
| 42 | ||
| 43 | GtkWidget *type_menu; | |
| 44 | ||
| 45 | GtkWidget *add_button; | |
| 46 | GtkWidget *remove_button; | |
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
47 | GtkWidget *removeall_button; |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
48 | GtkWidget *close_button; |
| 6371 | 49 | |
| 50 | GtkWidget *button_box; | |
| 51 | GtkWidget *allow_widget; | |
| 52 | GtkWidget *block_widget; | |
| 53 | ||
| 54 | GtkListStore *allow_store; | |
| 55 | GtkListStore *block_store; | |
| 56 | ||
| 57 | GtkWidget *allow_list; | |
| 58 | GtkWidget *block_list; | |
| 59 | ||
| 60 | gboolean in_allow_list; | |
| 61 | ||
| 15884 | 62 | PurpleAccount *account; |
| 6371 | 63 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
64 | } PidginPrivacyDialog; |
| 6371 | 65 | |
| 66 | typedef struct | |
| 67 | { | |
| 15884 | 68 | PurpleAccount *account; |
| 6371 | 69 | char *name; |
| 70 | gboolean block; | |
| 71 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
72 | } PidginPrivacyRequestData; |
| 6371 | 73 | |
| 74 | static struct | |
| 75 | { | |
| 76 | const char *text; | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
77 | PurplePrivacyType type; |
| 6371 | 78 | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20147
diff
changeset
|
79 | } const menu_entries[] = |
| 6371 | 80 | { |
| 15884 | 81 | { N_("Allow all users to contact me"), PURPLE_PRIVACY_ALLOW_ALL }, |
| 82 | { N_("Allow only the users on my buddy list"), PURPLE_PRIVACY_ALLOW_BUDDYLIST }, | |
| 83 | { N_("Allow only the users below"), PURPLE_PRIVACY_ALLOW_USERS }, | |
| 84 | { N_("Block all users"), PURPLE_PRIVACY_DENY_ALL }, | |
| 85 | { N_("Block only the users below"), PURPLE_PRIVACY_DENY_USERS } | |
| 6371 | 86 | }; |
| 87 | ||
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20147
diff
changeset
|
88 | static const size_t menu_entry_count = sizeof(menu_entries) / sizeof(*menu_entries); |
| 6371 | 89 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
90 | static PidginPrivacyDialog *privacy_dialog = NULL; |
| 6371 | 91 | |
|
41401
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
92 | static void type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog); |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
93 | |
| 6371 | 94 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
95 | rebuild_allow_list(PidginPrivacyDialog *dialog) |
| 6371 | 96 | { |
| 97 | GSList *l; | |
| 98 | GtkTreeIter iter; | |
| 99 | ||
| 100 | gtk_list_store_clear(dialog->allow_store); | |
| 101 | ||
| 102 | for (l = dialog->account->permit; l != NULL; l = l->next) { | |
| 103 | gtk_list_store_append(dialog->allow_store, &iter); | |
| 104 | gtk_list_store_set(dialog->allow_store, &iter, 0, l->data, -1); | |
| 105 | } | |
| 106 | } | |
| 107 | ||
| 108 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
109 | rebuild_block_list(PidginPrivacyDialog *dialog) |
| 6371 | 110 | { |
| 111 | GSList *l; | |
| 112 | GtkTreeIter iter; | |
| 113 | ||
| 114 | gtk_list_store_clear(dialog->block_store); | |
| 115 | ||
| 116 | for (l = dialog->account->deny; l != NULL; l = l->next) { | |
| 117 | gtk_list_store_append(dialog->block_store, &iter); | |
| 118 | gtk_list_store_set(dialog->block_store, &iter, 0, l->data, -1); | |
| 119 | } | |
| 120 | } | |
| 121 | ||
| 122 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
123 | user_selected_cb(GtkTreeSelection *sel, PidginPrivacyDialog *dialog) |
| 6371 | 124 | { |
| 125 | gtk_widget_set_sensitive(dialog->remove_button, TRUE); | |
| 126 | } | |
| 127 | ||
| 128 | static GtkWidget * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
129 | build_list(PidginPrivacyDialog *dialog, GtkListStore *model, |
| 6371 | 130 | GtkWidget **ret_treeview) |
| 131 | { | |
| 132 | GtkWidget *sw; | |
| 133 | GtkWidget *treeview; | |
| 134 | GtkCellRenderer *rend; | |
| 135 | GtkTreeViewColumn *column; | |
| 136 | GtkTreeSelection *sel; | |
| 137 | ||
| 138 | treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); | |
| 139 | *ret_treeview = treeview; | |
| 140 | ||
| 141 | rend = gtk_cell_renderer_text_new(); | |
| 142 | ||
| 143 | column = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
| 144 | "text", 0, | |
| 145 | NULL); | |
| 146 | gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
| 147 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
| 148 | gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); | |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
29742
diff
changeset
|
149 | sw = pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, 200); |
|
6374
0bbc59035c89
[gaim-migrate @ 6879]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
150 | |
| 6371 | 151 | gtk_widget_show(treeview); |
| 152 | ||
| 153 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); | |
| 154 | ||
| 155 | g_signal_connect(G_OBJECT(sel), "changed", | |
| 156 | G_CALLBACK(user_selected_cb), dialog); | |
| 157 | ||
| 158 | return sw; | |
| 159 | } | |
| 160 | ||
| 161 | static GtkWidget * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
162 | build_allow_list(PidginPrivacyDialog *dialog) |
| 6371 | 163 | { |
| 164 | GtkWidget *widget; | |
| 165 | GtkWidget *list; | |
| 166 | ||
| 167 | dialog->allow_store = gtk_list_store_new(1, G_TYPE_STRING); | |
| 168 | ||
|
11047
1b0452e2f2a9
[gaim-migrate @ 12972]
Richard Laager <rlaager@pidgin.im>
parents:
10704
diff
changeset
|
169 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->allow_store), 0, GTK_SORT_ASCENDING); |
|
1b0452e2f2a9
[gaim-migrate @ 12972]
Richard Laager <rlaager@pidgin.im>
parents:
10704
diff
changeset
|
170 | |
| 6371 | 171 | widget = build_list(dialog, dialog->allow_store, &list); |
| 172 | ||
| 173 | dialog->allow_list = list; | |
| 174 | ||
| 175 | rebuild_allow_list(dialog); | |
| 176 | ||
| 177 | return widget; | |
| 178 | } | |
| 179 | ||
| 180 | static GtkWidget * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
181 | build_block_list(PidginPrivacyDialog *dialog) |
| 6371 | 182 | { |
| 183 | GtkWidget *widget; | |
| 184 | GtkWidget *list; | |
| 185 | ||
| 186 | dialog->block_store = gtk_list_store_new(1, G_TYPE_STRING); | |
| 187 | ||
|
11047
1b0452e2f2a9
[gaim-migrate @ 12972]
Richard Laager <rlaager@pidgin.im>
parents:
10704
diff
changeset
|
188 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->block_store), 0, GTK_SORT_ASCENDING); |
|
1b0452e2f2a9
[gaim-migrate @ 12972]
Richard Laager <rlaager@pidgin.im>
parents:
10704
diff
changeset
|
189 | |
| 6371 | 190 | widget = build_list(dialog, dialog->block_store, &list); |
| 191 | ||
| 192 | dialog->block_list = list; | |
| 193 | ||
| 194 | rebuild_block_list(dialog); | |
| 195 | ||
| 196 | return widget; | |
| 197 | } | |
| 198 | ||
| 199 | static gint | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
200 | destroy_cb(GtkWidget *w, GdkEvent *event, PidginPrivacyDialog *dialog) |
| 6371 | 201 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
202 | pidgin_privacy_dialog_hide(); |
| 6371 | 203 | |
| 204 | return 0; | |
| 205 | } | |
| 206 | ||
| 207 | static void | |
| 15884 | 208 | select_account_cb(GtkWidget *dropdown, PurpleAccount *account, |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
209 | PidginPrivacyDialog *dialog) |
| 6371 | 210 | { |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
211 | gsize i; |
| 6371 | 212 | |
| 213 | dialog->account = account; | |
| 214 | ||
| 215 | for (i = 0; i < menu_entry_count; i++) { | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
216 | if (menu_entries[i].type == account->perm_deny) { |
|
29741
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
217 | gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i); |
| 6371 | 218 | break; |
| 219 | } | |
| 220 | } | |
| 221 | ||
| 222 | rebuild_allow_list(dialog); | |
| 223 | rebuild_block_list(dialog); | |
|
41401
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
224 | |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
225 | type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog); |
| 6371 | 226 | } |
| 227 | ||
|
10704
99a466f384d2
[gaim-migrate @ 12288]
Mark Doliner <markdoliner@pidgin.im>
parents:
10535
diff
changeset
|
228 | /* |
|
99a466f384d2
[gaim-migrate @ 12288]
Mark Doliner <markdoliner@pidgin.im>
parents:
10535
diff
changeset
|
229 | * TODO: Setting the permit/deny setting needs to go through privacy.c |
|
99a466f384d2
[gaim-migrate @ 12288]
Mark Doliner <markdoliner@pidgin.im>
parents:
10535
diff
changeset
|
230 | * Even better: the privacy API needs to not suck. |
|
99a466f384d2
[gaim-migrate @ 12288]
Mark Doliner <markdoliner@pidgin.im>
parents:
10535
diff
changeset
|
231 | */ |
|
29741
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
232 | static void |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
233 | type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
234 | { |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
235 | PurplePrivacyType new_type = |
|
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
236 | menu_entries[gtk_combo_box_get_active(combo)].type; |
| 6371 | 237 | |
|
8520
0a0fe6abc212
[gaim-migrate @ 9259]
Mark Doliner <markdoliner@pidgin.im>
parents:
8275
diff
changeset
|
238 | dialog->account->perm_deny = new_type; |
| 15884 | 239 | serv_set_permit_deny(purple_account_get_connection(dialog->account)); |
| 6371 | 240 | |
| 241 | gtk_widget_hide(dialog->allow_widget); | |
| 242 | gtk_widget_hide(dialog->block_widget); | |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
243 | gtk_widget_hide_all(dialog->button_box); |
| 6371 | 244 | |
| 15884 | 245 | if (new_type == PURPLE_PRIVACY_ALLOW_USERS) { |
| 6371 | 246 | gtk_widget_show(dialog->allow_widget); |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
247 | gtk_widget_show_all(dialog->button_box); |
| 6371 | 248 | dialog->in_allow_list = TRUE; |
| 249 | } | |
| 15884 | 250 | else if (new_type == PURPLE_PRIVACY_DENY_USERS) { |
| 6371 | 251 | gtk_widget_show(dialog->block_widget); |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
252 | gtk_widget_show_all(dialog->button_box); |
| 6371 | 253 | dialog->in_allow_list = FALSE; |
| 254 | } | |
|
10147
a4897a5bcf8d
[gaim-migrate @ 11224]
Peter Lawler <pidgin@bleeter.id.au>
parents:
9791
diff
changeset
|
255 | |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
256 | gtk_widget_show_all(dialog->close_button); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
257 | gtk_widget_show(dialog->button_box); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
258 | |
| 15884 | 259 | purple_blist_schedule_save(); |
| 260 | pidgin_blist_refresh(purple_get_blist()); | |
| 6371 | 261 | } |
| 262 | ||
| 263 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
264 | add_cb(GtkWidget *button, PidginPrivacyDialog *dialog) |
| 6371 | 265 | { |
| 266 | if (dialog->in_allow_list) | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
267 | pidgin_request_add_permit(dialog->account, NULL); |
| 6371 | 268 | else |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
269 | pidgin_request_add_block(dialog->account, NULL); |
| 6371 | 270 | } |
| 271 | ||
| 272 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
273 | remove_cb(GtkWidget *button, PidginPrivacyDialog *dialog) |
| 6371 | 274 | { |
| 275 | GtkTreeIter iter; | |
| 276 | GtkTreeModel *model; | |
| 277 | GtkTreeSelection *sel; | |
| 278 | char *name; | |
| 279 | ||
| 280 | if (dialog->in_allow_list && dialog->allow_store == NULL) | |
| 281 | return; | |
| 282 | ||
| 283 | if (!dialog->in_allow_list && dialog->block_store == NULL) | |
| 284 | return; | |
| 285 | ||
| 286 | if (dialog->in_allow_list) { | |
| 287 | model = GTK_TREE_MODEL(dialog->allow_store); | |
| 288 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->allow_list)); | |
| 289 | } | |
| 290 | else { | |
| 291 | model = GTK_TREE_MODEL(dialog->block_store); | |
| 292 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->block_list)); | |
| 293 | } | |
| 294 | ||
| 295 | if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
| 296 | gtk_tree_model_get(model, &iter, 0, &name, -1); | |
| 297 | else | |
| 298 | return; | |
| 299 | ||
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
300 | if (dialog->in_allow_list) |
|
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
301 | purple_privacy_permit_remove(dialog->account, name, FALSE); |
|
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
302 | else |
|
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
303 | purple_privacy_deny_remove(dialog->account, name, FALSE); |
|
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
304 | |
|
13149
895f0495b7db
[gaim-migrate @ 15511]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12852
diff
changeset
|
305 | g_free(name); |
|
41401
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
306 | |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
307 | purple_blist_schedule_save(); |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
308 | pidgin_blist_refresh(purple_get_blist()); |
| 6371 | 309 | } |
| 310 | ||
| 311 | static void | |
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
312 | removeall_cb(GtkWidget *button, PidginPrivacyDialog *dialog) |
| 6371 | 313 | { |
| 8556 | 314 | GSList *l; |
| 315 | if (dialog->in_allow_list) | |
| 316 | l = dialog->account->permit; | |
| 317 | else | |
| 318 | l = dialog->account->deny; | |
| 319 | while (l) { | |
| 320 | char *user; | |
| 321 | user = l->data; | |
| 322 | l = l->next; | |
| 323 | if (dialog->in_allow_list) | |
| 15884 | 324 | purple_privacy_permit_remove(dialog->account, user, FALSE); |
| 8556 | 325 | else |
| 15884 | 326 | purple_privacy_deny_remove(dialog->account, user, FALSE); |
| 8556 | 327 | } |
|
41401
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
328 | |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
329 | purple_blist_schedule_save(); |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
330 | pidgin_blist_refresh(purple_get_blist()); |
| 6371 | 331 | } |
| 332 | ||
| 333 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
334 | close_cb(GtkWidget *button, PidginPrivacyDialog *dialog) |
| 6371 | 335 | { |
|
7165
6547d94b0725
[gaim-migrate @ 7732]
Mark Doliner <markdoliner@pidgin.im>
parents:
6646
diff
changeset
|
336 | gtk_widget_destroy(dialog->win); |
|
6547d94b0725
[gaim-migrate @ 7732]
Mark Doliner <markdoliner@pidgin.im>
parents:
6646
diff
changeset
|
337 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
338 | pidgin_privacy_dialog_hide(); |
| 6371 | 339 | } |
| 340 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
341 | static PidginPrivacyDialog * |
| 6371 | 342 | privacy_dialog_new(void) |
| 343 | { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
344 | PidginPrivacyDialog *dialog; |
| 6371 | 345 | GtkWidget *vbox; |
| 346 | GtkWidget *button; | |
| 347 | GtkWidget *dropdown; | |
| 348 | GtkWidget *label; | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
349 | gssize selected = -1; |
|
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
350 | gsize i; |
| 6371 | 351 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
352 | dialog = g_new0(PidginPrivacyDialog, 1); |
| 6371 | 353 | |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
354 | dialog->win = pidgin_create_dialog(_("Privacy"), PIDGIN_HIG_BORDER, "privacy", TRUE); |
| 6371 | 355 | |
| 356 | g_signal_connect(G_OBJECT(dialog->win), "delete_event", | |
| 357 | G_CALLBACK(destroy_cb), dialog); | |
| 358 | ||
| 359 | /* Main vbox */ | |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
360 | vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(dialog->win), FALSE, PIDGIN_HIG_BORDER); |
| 6371 | 361 | |
| 362 | /* Description label */ | |
| 363 | label = gtk_label_new( | |
| 364 | _("Changes to privacy settings take effect immediately.")); | |
| 365 | ||
| 366 | gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
| 367 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 368 | gtk_widget_show(label); | |
| 369 | ||
| 370 | /* Accounts drop-down */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
371 | dropdown = pidgin_account_option_menu_new(NULL, FALSE, |
|
12852
dc6be215f15e
[gaim-migrate @ 15202]
Richard Laager <rlaager@pidgin.im>
parents:
12849
diff
changeset
|
372 | G_CALLBACK(select_account_cb), NULL, dialog); |
|
22131
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
373 | pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Set privacy for:"), NULL, dropdown, TRUE, NULL); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
374 | dialog->account = pidgin_account_option_menu_get_selected(dropdown); |
| 6371 | 375 | |
| 376 | /* Add the drop-down list with the allow/block types. */ | |
|
29741
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
377 | dialog->type_menu = gtk_combo_box_new_text(); |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
378 | gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0); |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
379 | gtk_widget_show(dialog->type_menu); |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
380 | |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
381 | for (i = 0; i < menu_entry_count; i++) { |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
382 | gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu), |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
383 | _(menu_entries[i].text)); |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
384 | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
385 | if (menu_entries[i].type == dialog->account->perm_deny) |
|
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
386 | selected = (gssize)i; |
|
29741
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
387 | } |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
388 | |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
389 | gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), selected); |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
390 | |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
391 | g_signal_connect(G_OBJECT(dialog->type_menu), "changed", |
|
3fbd100877f9
Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
392 | G_CALLBACK(type_changed_cb), dialog); |
| 6371 | 393 | |
| 394 | /* Build the treeview for the allow list. */ | |
| 395 | dialog->allow_widget = build_allow_list(dialog); | |
| 396 | gtk_box_pack_start(GTK_BOX(vbox), dialog->allow_widget, TRUE, TRUE, 0); | |
| 397 | ||
| 398 | /* Build the treeview for the block list. */ | |
| 399 | dialog->block_widget = build_block_list(dialog); | |
| 400 | gtk_box_pack_start(GTK_BOX(vbox), dialog->block_widget, TRUE, TRUE, 0); | |
| 401 | ||
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
402 | /* Add the button box for Add, Remove, Remove All */ |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
403 | dialog->button_box = pidgin_dialog_get_action_area(GTK_DIALOG(dialog->win)); |
| 6371 | 404 | |
| 405 | /* Add button */ | |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
406 | button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_ADD, G_CALLBACK(add_cb), dialog); |
| 6371 | 407 | dialog->add_button = button; |
| 408 | ||
| 409 | /* Remove button */ | |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
410 | button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_REMOVE, G_CALLBACK(remove_cb), dialog); |
| 6371 | 411 | dialog->remove_button = button; |
|
22389
21650aee2a19
Remove the privacy prpl callbacks in Zephyr since they're basically a
Mark Doliner <markdoliner@pidgin.im>
parents:
22372
diff
changeset
|
412 | /* TODO: This button should be sensitive/invisitive more cleverly */ |
| 6371 | 413 | gtk_widget_set_sensitive(button, FALSE); |
| 414 | ||
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
415 | /* Remove All button */ |
|
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
416 | button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), _("Remove Al_l"), G_CALLBACK(removeall_cb), dialog); |
|
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
417 | dialog->removeall_button = button; |
| 6371 | 418 | |
| 419 | /* Close button */ | |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
420 | button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLOSE, G_CALLBACK(close_cb), dialog); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
421 | dialog->close_button = button; |
| 6371 | 422 | |
|
41401
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
423 | select_account_cb(dropdown, dialog->account, dialog); |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
424 | #if 0 |
| 15884 | 425 | if (dialog->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { |
| 6371 | 426 | gtk_widget_show(dialog->allow_widget); |
| 427 | gtk_widget_show(dialog->button_box); | |
| 428 | dialog->in_allow_list = TRUE; | |
| 429 | } | |
| 15884 | 430 | else if (dialog->account->perm_deny == PURPLE_PRIVACY_DENY_USERS) { |
| 6371 | 431 | gtk_widget_show(dialog->block_widget); |
| 432 | gtk_widget_show(dialog->button_box); | |
| 433 | dialog->in_allow_list = FALSE; | |
| 434 | } | |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
435 | #endif |
| 6371 | 436 | return dialog; |
| 437 | } | |
| 438 | ||
| 439 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
440 | pidgin_privacy_dialog_show(void) |
| 6371 | 441 | { |
| 15884 | 442 | g_return_if_fail(purple_connections_get_all() != NULL); |
|
10352
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10148
diff
changeset
|
443 | |
| 6371 | 444 | if (privacy_dialog == NULL) |
| 445 | privacy_dialog = privacy_dialog_new(); | |
| 446 | ||
| 447 | gtk_widget_show(privacy_dialog->win); | |
| 448 | gdk_window_raise(privacy_dialog->win->window); | |
| 449 | } | |
| 450 | ||
| 451 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
452 | pidgin_privacy_dialog_hide(void) |
| 6371 | 453 | { |
| 454 | if (privacy_dialog == NULL) | |
| 455 | return; | |
| 456 | ||
|
22214
e8a9916cb99e
It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22131
diff
changeset
|
457 | g_object_unref(G_OBJECT(privacy_dialog->allow_store)); |
|
e8a9916cb99e
It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22131
diff
changeset
|
458 | g_object_unref(G_OBJECT(privacy_dialog->block_store)); |
|
7165
6547d94b0725
[gaim-migrate @ 7732]
Mark Doliner <markdoliner@pidgin.im>
parents:
6646
diff
changeset
|
459 | g_free(privacy_dialog); |
| 6371 | 460 | privacy_dialog = NULL; |
| 461 | } | |
| 462 | ||
| 463 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
464 | destroy_request_data(PidginPrivacyRequestData *data) |
| 6371 | 465 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
466 | g_free(data->name); |
| 6371 | 467 | g_free(data); |
| 468 | } | |
| 469 | ||
| 470 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
471 | confirm_permit_block_cb(PidginPrivacyRequestData *data, int option) |
| 6371 | 472 | { |
| 473 | if (data->block) | |
| 15884 | 474 | purple_privacy_deny(data->account, data->name, FALSE, FALSE); |
| 6371 | 475 | else |
| 15884 | 476 | purple_privacy_allow(data->account, data->name, FALSE, FALSE); |
| 6371 | 477 | |
| 478 | destroy_request_data(data); | |
|
41401
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
479 | |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
480 | purple_blist_schedule_save(); |
|
ccd35a6add9c
Fix GtkPrivacy to respect privacy settings
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
36256
diff
changeset
|
481 | pidgin_blist_refresh(purple_get_blist()); |
| 6371 | 482 | } |
| 483 | ||
| 484 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
485 | add_permit_block_cb(PidginPrivacyRequestData *data, const char *name) |
| 6371 | 486 | { |
| 487 | data->name = g_strdup(name); | |
| 488 | ||
| 489 | confirm_permit_block_cb(data, 0); | |
| 490 | } | |
| 491 | ||
| 492 | void | |
| 15884 | 493 | pidgin_request_add_permit(PurpleAccount *account, const char *name) |
| 6371 | 494 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
495 | PidginPrivacyRequestData *data; |
| 6371 | 496 | |
| 497 | g_return_if_fail(account != NULL); | |
| 498 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
499 | data = g_new0(PidginPrivacyRequestData, 1); |
| 6371 | 500 | data->account = account; |
| 501 | data->name = g_strdup(name); | |
| 502 | data->block = FALSE; | |
| 503 | ||
| 504 | if (name == NULL) { | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
505 | purple_request_input(account, _("Permit User"), |
| 6371 | 506 | _("Type a user you permit to contact you."), |
| 507 | _("Please enter the name of the user you wish to be " | |
| 508 | "able to contact you."), | |
| 8697 | 509 | NULL, FALSE, FALSE, NULL, |
| 12603 | 510 | _("_Permit"), G_CALLBACK(add_permit_block_cb), |
| 6371 | 511 | _("Cancel"), G_CALLBACK(destroy_request_data), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
512 | account, name, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
513 | data); |
| 6371 | 514 | } |
| 515 | else { | |
| 516 | char *primary = g_strdup_printf(_("Allow %s to contact you?"), name); | |
| 517 | char *secondary = | |
| 518 | g_strdup_printf(_("Are you sure you wish to allow " | |
| 519 | "%s to contact you?"), name); | |
| 520 | ||
| 521 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
522 | purple_request_action(account, _("Permit User"), primary, secondary, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
523 | 0, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
524 | account, name, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
525 | data, 2, |
| 12603 | 526 | _("_Permit"), G_CALLBACK(confirm_permit_block_cb), |
| 6371 | 527 | _("Cancel"), G_CALLBACK(destroy_request_data)); |
| 528 | ||
| 529 | g_free(primary); | |
| 530 | g_free(secondary); | |
| 531 | } | |
| 532 | } | |
| 533 | ||
| 534 | void | |
| 15884 | 535 | pidgin_request_add_block(PurpleAccount *account, const char *name) |
| 6371 | 536 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
537 | PidginPrivacyRequestData *data; |
| 6371 | 538 | |
| 539 | g_return_if_fail(account != NULL); | |
| 540 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
541 | data = g_new0(PidginPrivacyRequestData, 1); |
| 6371 | 542 | data->account = account; |
| 543 | data->name = g_strdup(name); | |
| 544 | data->block = TRUE; | |
| 545 | ||
| 546 | if (name == NULL) { | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
547 | purple_request_input(account, _("Block User"), |
| 6371 | 548 | _("Type a user to block."), |
| 549 | _("Please enter the name of the user you wish to block."), | |
| 8697 | 550 | NULL, FALSE, FALSE, NULL, |
| 12603 | 551 | _("_Block"), G_CALLBACK(add_permit_block_cb), |
| 6371 | 552 | _("Cancel"), G_CALLBACK(destroy_request_data), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
553 | account, name, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
554 | data); |
| 6371 | 555 | } |
| 556 | else { | |
| 557 | char *primary = g_strdup_printf(_("Block %s?"), name); | |
| 558 | char *secondary = | |
| 559 | g_strdup_printf(_("Are you sure you want to block %s?"), name); | |
| 560 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
561 | purple_request_action(account, _("Block User"), primary, secondary, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
562 | 0, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
563 | account, name, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
564 | data, 2, |
| 12603 | 565 | _("_Block"), G_CALLBACK(confirm_permit_block_cb), |
| 6371 | 566 | _("Cancel"), G_CALLBACK(destroy_request_data)); |
| 567 | ||
| 568 | g_free(primary); | |
| 569 | g_free(secondary); | |
| 570 | } | |
| 571 | } | |
| 572 | ||
| 573 | static void | |
| 15884 | 574 | pidgin_permit_added_removed(PurpleAccount *account, const char *name) |
| 6371 | 575 | { |
| 576 | if (privacy_dialog != NULL) | |
| 577 | rebuild_allow_list(privacy_dialog); | |
| 578 | } | |
| 579 | ||
| 580 | static void | |
| 15884 | 581 | pidgin_deny_added_removed(PurpleAccount *account, const char *name) |
| 6371 | 582 | { |
| 583 | if (privacy_dialog != NULL) | |
| 584 | rebuild_block_list(privacy_dialog); | |
| 585 | } | |
| 586 | ||
| 15884 | 587 | static PurplePrivacyUiOps privacy_ops = |
| 6371 | 588 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
589 | pidgin_permit_added_removed, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
590 | pidgin_permit_added_removed, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
591 | pidgin_deny_added_removed, |
|
16752
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
592 | pidgin_deny_added_removed, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
593 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
594 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
595 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
596 | NULL |
| 6371 | 597 | }; |
| 598 | ||
| 15884 | 599 | PurplePrivacyUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
600 | pidgin_privacy_get_ui_ops(void) |
| 6371 | 601 | { |
| 602 | return &privacy_ops; | |
| 603 | } | |
| 604 | ||
| 605 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
606 | pidgin_privacy_init(void) |
| 6371 | 607 | { |
| 608 | } |