Thu, 23 Jul 2020 20:13:47 -0500
phase2 of pidgin.h: move existing file to pidgincore.h
Rename pidgin.h to pidgincore.h and update everything accordingly.
Testing Done:
Compile test only.
Reviewed at https://reviews.imfreedom.org/r/43/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 6371 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
6 | * |
| 6371 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * 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
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6371 | 20 | */ |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
21 | |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
22 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
23 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40252
diff
changeset
|
24 | #include <purple.h> |
| 6371 | 25 | |
|
35040
f80a806325a4
Made pidgin_{permit|deny}_{added|removed} static
Ankit Vani <a@nevitus.org>
parents:
34940
diff
changeset
|
26 | #include "gtkaccount.h" |
|
11111
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11047
diff
changeset
|
27 | #include "gtkblist.h" |
| 6371 | 28 | #include "gtkprivacy.h" |
| 29 | #include "gtkutils.h" | |
|
39785
aa7e3b71802d
Split pidgin_account_option_menu into its own files.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
30 | #include "pidginaccountchooser.h" |
| 6371 | 31 | |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
32 | #define PIDGIN_TYPE_PRIVACY_DIALOG (pidgin_privacy_dialog_get_type()) |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
33 | G_DECLARE_FINAL_TYPE(PidginPrivacyDialog, pidgin_privacy_dialog, PIDGIN, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
34 | PRIVACY_DIALOG, GtkDialog) |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
35 | |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
36 | struct _PidginPrivacyDialog { |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
37 | GtkDialog parent; |
| 6371 | 38 | |
| 39 | GtkWidget *type_menu; | |
| 40 | ||
| 41 | GtkWidget *add_button; | |
| 42 | GtkWidget *remove_button; | |
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
43 | 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
|
44 | GtkWidget *close_button; |
| 6371 | 45 | |
| 46 | GtkWidget *allow_widget; | |
| 47 | GtkWidget *block_widget; | |
| 48 | ||
| 49 | GtkListStore *allow_store; | |
| 50 | GtkListStore *block_store; | |
| 51 | ||
| 52 | GtkWidget *allow_list; | |
| 53 | GtkWidget *block_list; | |
| 54 | ||
| 55 | gboolean in_allow_list; | |
| 56 | ||
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
57 | GtkWidget *account_chooser; |
| 15884 | 58 | PurpleAccount *account; |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
59 | }; |
| 6371 | 60 | |
| 61 | typedef struct | |
| 62 | { | |
| 15884 | 63 | PurpleAccount *account; |
| 6371 | 64 | char *name; |
| 65 | gboolean block; | |
| 66 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
67 | } PidginPrivacyRequestData; |
| 6371 | 68 | |
| 69 | static struct | |
| 70 | { | |
| 71 | const char *text; | |
| 34892 | 72 | PurpleAccountPrivacyType type; |
| 6371 | 73 | |
|
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
|
74 | } const menu_entries[] = |
| 6371 | 75 | { |
|
34586
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
76 | { N_("Allow all users to contact me"), PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL }, |
|
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
77 | { N_("Allow only the users on my buddy list"), PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST }, |
|
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
78 | { N_("Allow only the users below"), PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS }, |
|
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
79 | { N_("Block all users"), PURPLE_ACCOUNT_PRIVACY_DENY_ALL }, |
|
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
80 | { N_("Block only the users below"), PURPLE_ACCOUNT_PRIVACY_DENY_USERS } |
| 6371 | 81 | }; |
| 82 | ||
|
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
|
83 | static const size_t menu_entry_count = sizeof(menu_entries) / sizeof(*menu_entries); |
| 6371 | 84 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
85 | static PidginPrivacyDialog *privacy_dialog = NULL; |
| 6371 | 86 | |
| 87 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
88 | rebuild_allow_list(PidginPrivacyDialog *dialog) |
| 6371 | 89 | { |
| 90 | GSList *l; | |
| 91 | GtkTreeIter iter; | |
| 92 | ||
| 93 | gtk_list_store_clear(dialog->allow_store); | |
| 94 | ||
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34586
diff
changeset
|
95 | for (l = purple_account_privacy_get_permitted(dialog->account); l != NULL; l = l->next) { |
| 6371 | 96 | gtk_list_store_append(dialog->allow_store, &iter); |
| 97 | gtk_list_store_set(dialog->allow_store, &iter, 0, l->data, -1); | |
| 98 | } | |
| 99 | } | |
| 100 | ||
| 101 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
102 | rebuild_block_list(PidginPrivacyDialog *dialog) |
| 6371 | 103 | { |
| 104 | GSList *l; | |
| 105 | GtkTreeIter iter; | |
| 106 | ||
| 107 | gtk_list_store_clear(dialog->block_store); | |
| 108 | ||
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34586
diff
changeset
|
109 | for (l = purple_account_privacy_get_denied(dialog->account); l != NULL; l = l->next) { |
| 6371 | 110 | gtk_list_store_append(dialog->block_store, &iter); |
| 111 | gtk_list_store_set(dialog->block_store, &iter, 0, l->data, -1); | |
| 112 | } | |
| 113 | } | |
| 114 | ||
| 115 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
116 | user_selected_cb(GtkTreeSelection *sel, PidginPrivacyDialog *dialog) |
| 6371 | 117 | { |
| 118 | gtk_widget_set_sensitive(dialog->remove_button, TRUE); | |
| 119 | } | |
| 120 | ||
| 121 | static void | |
|
39787
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
122 | select_account_cb(GtkWidget *chooser, PidginPrivacyDialog *dialog) |
| 6371 | 123 | { |
|
39787
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
124 | PurpleAccount *account = pidgin_account_chooser_get_selected(chooser); |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
125 | gsize i; |
| 6371 | 126 | |
| 127 | dialog->account = account; | |
| 128 | ||
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
129 | if (account) { |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
130 | gtk_widget_set_sensitive(dialog->type_menu, TRUE); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
131 | gtk_widget_set_sensitive(dialog->add_button, TRUE); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
132 | /* dialog->remove_button is enabled when a user is selected. */ |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
133 | gtk_widget_set_sensitive(dialog->removeall_button, TRUE); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
134 | } else { |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
135 | gtk_widget_set_sensitive(dialog->type_menu, FALSE); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
136 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
137 | gtk_widget_set_sensitive(dialog->remove_button, FALSE); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
138 | gtk_widget_set_sensitive(dialog->removeall_button, FALSE); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
139 | gtk_list_store_clear(dialog->allow_store); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
140 | gtk_list_store_clear(dialog->block_store); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
141 | return; |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
142 | } |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
143 | |
| 6371 | 144 | for (i = 0; i < menu_entry_count; i++) { |
|
34308
cdb187c27360
Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
145 | if (menu_entries[i].type == purple_account_get_privacy_type(account)) { |
|
26931
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
146 | gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i); |
| 6371 | 147 | break; |
| 148 | } | |
| 149 | } | |
| 150 | ||
| 151 | rebuild_allow_list(dialog); | |
| 152 | rebuild_block_list(dialog); | |
| 153 | } | |
| 154 | ||
|
10704
99a466f384d2
[gaim-migrate @ 12288]
Mark Doliner <markdoliner@pidgin.im>
parents:
10535
diff
changeset
|
155 | /* |
|
99a466f384d2
[gaim-migrate @ 12288]
Mark Doliner <markdoliner@pidgin.im>
parents:
10535
diff
changeset
|
156 | * 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
|
157 | * Even better: the privacy API needs to not suck. |
|
99a466f384d2
[gaim-migrate @ 12288]
Mark Doliner <markdoliner@pidgin.im>
parents:
10535
diff
changeset
|
158 | */ |
|
26931
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
159 | static void |
|
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
160 | type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) |
|
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
161 | { |
| 34892 | 162 | PurpleAccountPrivacyType new_type = |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
163 | menu_entries[gtk_combo_box_get_active(combo)].type; |
|
40252
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
164 | gboolean buttons_sensitive; |
| 6371 | 165 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
31321
diff
changeset
|
166 | purple_account_set_privacy_type(dialog->account, new_type); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
167 | purple_serv_set_permit_deny(purple_account_get_connection(dialog->account)); |
| 6371 | 168 | |
| 169 | gtk_widget_hide(dialog->allow_widget); | |
| 170 | gtk_widget_hide(dialog->block_widget); | |
|
40252
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
171 | buttons_sensitive = FALSE; |
| 6371 | 172 | |
|
34586
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
173 | if (new_type == PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS) { |
| 6371 | 174 | gtk_widget_show(dialog->allow_widget); |
|
40252
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
175 | buttons_sensitive = TRUE; |
| 6371 | 176 | dialog->in_allow_list = TRUE; |
| 177 | } | |
|
34586
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
178 | else if (new_type == PURPLE_ACCOUNT_PRIVACY_DENY_USERS) { |
| 6371 | 179 | gtk_widget_show(dialog->block_widget); |
|
40252
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
180 | buttons_sensitive = TRUE; |
| 6371 | 181 | dialog->in_allow_list = FALSE; |
| 182 | } | |
|
10147
a4897a5bcf8d
[gaim-migrate @ 11224]
Peter Lawler <pidgin@bleeter.id.au>
parents:
9791
diff
changeset
|
183 | |
|
40252
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
184 | gtk_widget_set_sensitive(dialog->add_button, buttons_sensitive); |
|
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
185 | /* dialog->remove_button is enabled when a user is selected. */ |
|
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
186 | gtk_widget_set_sensitive(dialog->remove_button, FALSE); |
|
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
187 | gtk_widget_set_sensitive(dialog->removeall_button, buttons_sensitive); |
|
18fd5c5c4625
Don't hide button box in privacy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40251
diff
changeset
|
188 | |
|
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
|
189 | 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
|
190 | |
| 15884 | 191 | purple_blist_schedule_save(); |
|
39665
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
192 | pidgin_blist_refresh(purple_blist_get_default()); |
| 6371 | 193 | } |
| 194 | ||
| 195 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
196 | add_cb(GtkWidget *button, PidginPrivacyDialog *dialog) |
| 6371 | 197 | { |
| 198 | if (dialog->in_allow_list) | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
199 | pidgin_request_add_permit(dialog->account, NULL); |
| 6371 | 200 | else |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
201 | pidgin_request_add_block(dialog->account, NULL); |
| 6371 | 202 | } |
| 203 | ||
| 204 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
205 | remove_cb(GtkWidget *button, PidginPrivacyDialog *dialog) |
| 6371 | 206 | { |
| 207 | GtkTreeIter iter; | |
| 208 | GtkTreeModel *model; | |
| 209 | GtkTreeSelection *sel; | |
| 210 | char *name; | |
| 211 | ||
| 212 | if (dialog->in_allow_list && dialog->allow_store == NULL) | |
| 213 | return; | |
| 214 | ||
| 215 | if (!dialog->in_allow_list && dialog->block_store == NULL) | |
| 216 | return; | |
| 217 | ||
| 218 | if (dialog->in_allow_list) { | |
| 219 | model = GTK_TREE_MODEL(dialog->allow_store); | |
| 220 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->allow_list)); | |
| 221 | } | |
| 222 | else { | |
| 223 | model = GTK_TREE_MODEL(dialog->block_store); | |
| 224 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->block_list)); | |
| 225 | } | |
| 226 | ||
| 227 | if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
| 228 | gtk_tree_model_get(model, &iter, 0, &name, -1); | |
| 229 | else | |
| 230 | return; | |
| 231 | ||
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
232 | if (dialog->in_allow_list) |
|
34586
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
233 | purple_account_privacy_permit_remove(dialog->account, name, FALSE); |
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
234 | else |
|
34586
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
235 | purple_account_privacy_deny_remove(dialog->account, name, FALSE); |
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
236 | |
|
13149
895f0495b7db
[gaim-migrate @ 15511]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12852
diff
changeset
|
237 | g_free(name); |
| 6371 | 238 | } |
| 239 | ||
| 240 | static void | |
|
22372
2b2d10362583
In Pidgin's privacy dialog:
Mark Doliner <markdoliner@pidgin.im>
parents:
22214
diff
changeset
|
241 | removeall_cb(GtkWidget *button, PidginPrivacyDialog *dialog) |
| 6371 | 242 | { |
| 8556 | 243 | GSList *l; |
| 244 | if (dialog->in_allow_list) | |
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34586
diff
changeset
|
245 | l = purple_account_privacy_get_permitted(dialog->account); |
| 8556 | 246 | else |
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34586
diff
changeset
|
247 | l = purple_account_privacy_get_denied(dialog->account); |
| 8556 | 248 | while (l) { |
| 249 | char *user; | |
| 250 | user = l->data; | |
| 251 | l = l->next; | |
| 252 | if (dialog->in_allow_list) | |
|
34586
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
253 | purple_account_privacy_permit_remove(dialog->account, user, FALSE); |
| 8556 | 254 | else |
|
34586
9ed4700451cc
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
Ankit Vani <a@nevitus.org>
parents:
33170
diff
changeset
|
255 | purple_account_privacy_deny_remove(dialog->account, user, FALSE); |
| 8556 | 256 | } |
| 6371 | 257 | } |
| 258 | ||
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
259 | G_DEFINE_TYPE(PidginPrivacyDialog, pidgin_privacy_dialog, GTK_TYPE_DIALOG) |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
260 | |
| 6371 | 261 | static void |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
262 | pidgin_privacy_dialog_class_init(PidginPrivacyDialogClass *klass) |
| 6371 | 263 | { |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
264 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
265 | |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
266 | gtk_widget_class_set_template_from_resource( |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
267 | widget_class, "/im/pidgin/Pidgin/Privacy/dialog.ui"); |
|
7165
6547d94b0725
[gaim-migrate @ 7732]
Mark Doliner <markdoliner@pidgin.im>
parents:
6646
diff
changeset
|
268 | |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
269 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
270 | account_chooser); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
271 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
272 | add_button); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
273 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
274 | allow_list); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
275 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
276 | allow_store); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
277 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
278 | allow_widget); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
279 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
280 | block_list); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
281 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
282 | block_store); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
283 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
284 | block_widget); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
285 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
286 | close_button); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
287 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
288 | remove_button); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
289 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
290 | removeall_button); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
291 | gtk_widget_class_bind_template_child(widget_class, PidginPrivacyDialog, |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
292 | type_menu); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
293 | |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
294 | gtk_widget_class_bind_template_callback(widget_class, add_cb); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
295 | gtk_widget_class_bind_template_callback(widget_class, remove_cb); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
296 | gtk_widget_class_bind_template_callback(widget_class, removeall_cb); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
297 | gtk_widget_class_bind_template_callback(widget_class, select_account_cb); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
298 | gtk_widget_class_bind_template_callback(widget_class, type_changed_cb); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
299 | gtk_widget_class_bind_template_callback(widget_class, user_selected_cb); |
| 6371 | 300 | } |
| 301 | ||
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
302 | static void |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
303 | pidgin_privacy_dialog_init(PidginPrivacyDialog *dialog) |
| 6371 | 304 | { |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
305 | gssize selected = -1; |
|
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
306 | gsize i; |
| 6371 | 307 | |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
308 | gtk_widget_init_template(GTK_WIDGET(dialog)); |
| 6371 | 309 | |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
310 | dialog->account = |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
311 | pidgin_account_chooser_get_selected(dialog->account_chooser); |
| 6371 | 312 | |
| 313 | /* Add the drop-down list with the allow/block types. */ | |
|
26931
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
314 | for (i = 0; i < menu_entry_count; i++) { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
29742
diff
changeset
|
315 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(dialog->type_menu), |
|
26931
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
316 | _(menu_entries[i].text)); |
|
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
317 | |
|
34308
cdb187c27360
Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
318 | if (menu_entries[i].type == purple_account_get_privacy_type(dialog->account)) |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31321
diff
changeset
|
319 | selected = (gssize)i; |
|
26931
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
320 | } |
|
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
321 | gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), selected); |
|
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
322 | |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
323 | /* Rebuild the allow and block lists views. */ |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
324 | rebuild_allow_list(dialog); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
325 | rebuild_block_list(dialog); |
| 6371 | 326 | |
|
26931
57f05d09b5b7
Replace the GtkOptionMenu with a GtkComboBox for the privacy options list
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22389
diff
changeset
|
327 | type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog); |
| 6371 | 328 | } |
| 329 | ||
| 330 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
331 | pidgin_privacy_dialog_show(void) |
| 6371 | 332 | { |
| 15884 | 333 | g_return_if_fail(purple_connections_get_all() != NULL); |
|
10352
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10148
diff
changeset
|
334 | |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
335 | if (privacy_dialog == NULL) { |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
336 | privacy_dialog = g_object_new(PIDGIN_TYPE_PRIVACY_DIALOG, NULL); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
337 | g_signal_connect(privacy_dialog, "destroy", |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
338 | G_CALLBACK(gtk_widget_destroyed), &privacy_dialog); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
339 | } |
| 6371 | 340 | |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
341 | gtk_widget_show(GTK_WIDGET(privacy_dialog)); |
|
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
342 | gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(privacy_dialog))); |
| 6371 | 343 | } |
| 344 | ||
| 345 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
346 | pidgin_privacy_dialog_hide(void) |
| 6371 | 347 | { |
|
40251
41e9424fc96f
Convert Privacy dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
348 | gtk_widget_destroy(GTK_WIDGET(privacy_dialog)); |
| 6371 | 349 | } |
| 350 | ||
| 351 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
352 | destroy_request_data(PidginPrivacyRequestData *data) |
| 6371 | 353 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
354 | g_free(data->name); |
| 6371 | 355 | g_free(data); |
| 356 | } | |
| 357 | ||
| 358 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
359 | confirm_permit_block_cb(PidginPrivacyRequestData *data, int option) |
| 6371 | 360 | { |
| 361 | if (data->block) | |
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34586
diff
changeset
|
362 | purple_account_privacy_deny(data->account, data->name); |
| 6371 | 363 | else |
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34586
diff
changeset
|
364 | purple_account_privacy_allow(data->account, data->name); |
| 6371 | 365 | |
| 366 | destroy_request_data(data); | |
| 367 | } | |
| 368 | ||
| 369 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
370 | add_permit_block_cb(PidginPrivacyRequestData *data, const char *name) |
| 6371 | 371 | { |
| 372 | data->name = g_strdup(name); | |
| 373 | ||
| 374 | confirm_permit_block_cb(data, 0); | |
| 375 | } | |
| 376 | ||
| 377 | void | |
| 15884 | 378 | pidgin_request_add_permit(PurpleAccount *account, const char *name) |
| 6371 | 379 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
380 | PidginPrivacyRequestData *data; |
| 6371 | 381 | |
| 382 | g_return_if_fail(account != NULL); | |
| 383 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
384 | data = g_new0(PidginPrivacyRequestData, 1); |
| 6371 | 385 | data->account = account; |
| 386 | data->name = g_strdup(name); | |
| 387 | data->block = FALSE; | |
| 388 | ||
| 389 | if (name == NULL) { | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
390 | purple_request_input(account, _("Permit User"), |
| 6371 | 391 | _("Type a user you permit to contact you."), |
| 392 | _("Please enter the name of the user you wish to be " | |
| 393 | "able to contact you."), | |
| 8697 | 394 | NULL, FALSE, FALSE, NULL, |
| 12603 | 395 | _("_Permit"), G_CALLBACK(add_permit_block_cb), |
| 6371 | 396 | _("Cancel"), G_CALLBACK(destroy_request_data), |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
397 | purple_request_cpar_from_account(account), |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
398 | data); |
| 6371 | 399 | } |
| 400 | else { | |
| 401 | char *primary = g_strdup_printf(_("Allow %s to contact you?"), name); | |
| 402 | char *secondary = | |
| 403 | g_strdup_printf(_("Are you sure you wish to allow " | |
| 404 | "%s to contact you?"), name); | |
| 405 | ||
| 406 | ||
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
407 | purple_request_action(account, _("Permit User"), primary, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
408 | secondary, 0, purple_request_cpar_from_account(account), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
409 | data, 2, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
410 | _("_Permit"), G_CALLBACK(confirm_permit_block_cb), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
411 | _("Cancel"), G_CALLBACK(destroy_request_data)); |
| 6371 | 412 | |
| 413 | g_free(primary); | |
| 414 | g_free(secondary); | |
| 415 | } | |
| 416 | } | |
| 417 | ||
| 418 | void | |
| 15884 | 419 | pidgin_request_add_block(PurpleAccount *account, const char *name) |
| 6371 | 420 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
421 | PidginPrivacyRequestData *data; |
| 6371 | 422 | |
| 423 | g_return_if_fail(account != NULL); | |
| 424 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
425 | data = g_new0(PidginPrivacyRequestData, 1); |
| 6371 | 426 | data->account = account; |
| 427 | data->name = g_strdup(name); | |
| 428 | data->block = TRUE; | |
| 429 | ||
| 430 | if (name == NULL) { | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
431 | purple_request_input(account, _("Block User"), |
| 6371 | 432 | _("Type a user to block."), |
| 433 | _("Please enter the name of the user you wish to block."), | |
| 8697 | 434 | NULL, FALSE, FALSE, NULL, |
| 12603 | 435 | _("_Block"), G_CALLBACK(add_permit_block_cb), |
| 6371 | 436 | _("Cancel"), G_CALLBACK(destroy_request_data), |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
437 | purple_request_cpar_from_account(account), |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
438 | data); |
| 6371 | 439 | } |
| 440 | else { | |
| 441 | char *primary = g_strdup_printf(_("Block %s?"), name); | |
| 442 | char *secondary = | |
| 443 | g_strdup_printf(_("Are you sure you want to block %s?"), name); | |
| 444 | ||
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
445 | purple_request_action(account, _("Block User"), primary, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
446 | secondary, 0, purple_request_cpar_from_account(account), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
447 | data, 2, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
448 | _("_Block"), G_CALLBACK(confirm_permit_block_cb), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
449 | _("Cancel"), G_CALLBACK(destroy_request_data)); |
| 6371 | 450 | |
| 451 | g_free(primary); | |
| 452 | g_free(secondary); | |
| 453 | } | |
| 454 | } | |
| 455 | ||
| 456 | static void | |
| 15884 | 457 | pidgin_permit_added_removed(PurpleAccount *account, const char *name) |
| 6371 | 458 | { |
| 459 | if (privacy_dialog != NULL) | |
| 460 | rebuild_allow_list(privacy_dialog); | |
| 461 | } | |
| 462 | ||
| 463 | static void | |
| 15884 | 464 | pidgin_deny_added_removed(PurpleAccount *account, const char *name) |
| 6371 | 465 | { |
| 466 | if (privacy_dialog != NULL) | |
| 467 | rebuild_block_list(privacy_dialog); | |
| 468 | } | |
| 469 | ||
| 470 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15486
diff
changeset
|
471 | pidgin_privacy_init(void) |
| 6371 | 472 | { |
|
35040
f80a806325a4
Made pidgin_{permit|deny}_{added|removed} static
Ankit Vani <a@nevitus.org>
parents:
34940
diff
changeset
|
473 | PurpleAccountUiOps *ops = pidgin_accounts_get_ui_ops(); |
|
f80a806325a4
Made pidgin_{permit|deny}_{added|removed} static
Ankit Vani <a@nevitus.org>
parents:
34940
diff
changeset
|
474 | |
|
f80a806325a4
Made pidgin_{permit|deny}_{added|removed} static
Ankit Vani <a@nevitus.org>
parents:
34940
diff
changeset
|
475 | ops->permit_added = ops->permit_removed = pidgin_permit_added_removed; |
|
f80a806325a4
Made pidgin_{permit|deny}_{added|removed} static
Ankit Vani <a@nevitus.org>
parents:
34940
diff
changeset
|
476 | ops->deny_added = ops->deny_removed = pidgin_deny_added_removed; |
| 6371 | 477 | } |