pidgin/pidginaccounteditor.c

changeset 41688
6ccdb4116ca2
parent 41560
2579a5138f0c
child 41776
3dc254c25eeb
equal deleted inserted replaced
41687:ba1699ed5d56 41688:6ccdb4116ca2
20 * along with this program; if not, see <https://www.gnu.org/licenses/>. 20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
21 */ 21 */
22 22
23 #include <glib/gi18n-lib.h> 23 #include <glib/gi18n-lib.h>
24 24
25 #include <adwaita.h>
26
25 #include "pidginaccounteditor.h" 27 #include "pidginaccounteditor.h"
26 28
27 #include "pidginproxyoptions.h" 29 #include "pidginprotocolchooser.h"
28 30
29 struct _PidginAccountEditor { 31 struct _PidginAccountEditor {
30 GtkDialog parent; 32 GtkDialog parent;
31 33
32 PurpleAccount *account; 34 PurpleAccount *account;
33 35
34 GtkWidget *notebook; 36 /* Login Options */
37 GtkWidget *login_options;
38 GtkWidget *protocol;
39 GtkWidget *username;
40
41 GList *user_split_entries;
42 GList *user_split_rows;
43
44 /* User Options */
45 GtkWidget *alias;
46
47 GtkFileChooserNative *avatar_dialog;
48 GdkPixbuf *avatar_pixbuf;
49 GtkWidget *avatar_row;
50 GtkWidget *use_custom_avatar;
51 GtkWidget *avatar;
52
53 /* Advanced Options */
54 GtkWidget *advanced_group;
55 GtkWidget *advanced_toggle;
56
57 GList *advanced_entries;
58 GList *advanced_rows;
59
60 /* Proxy Options */
61 GtkWidget *proxy_type;
35 GtkWidget *proxy_options; 62 GtkWidget *proxy_options;
63 GtkWidget *proxy_host;
64 GtkWidget *proxy_port;
65 GtkWidget *proxy_username;
66 GtkWidget *proxy_password;
36 }; 67 };
37 68
38 enum { 69 enum {
39 PROP_0, 70 PROP_0,
40 PROP_ACCOUNT, 71 PROP_ACCOUNT,
41 N_PROPERTIES, 72 N_PROPERTIES,
42 }; 73 };
43 static GParamSpec *properties[N_PROPERTIES] = {NULL, }; 74 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
44 75
76
77 /******************************************************************************
78 * Prototypes
79 *****************************************************************************/
80 static void pidgin_account_editor_connection_changed_cb(GObject *obj,
81 GParamSpec *pspec,
82 gpointer data);
83
45 /****************************************************************************** 84 /******************************************************************************
46 * Helpers 85 * Helpers
47 *****************************************************************************/ 86 *****************************************************************************/
48 static void 87 static void
88 pidgin_account_editor_add_user_split(gpointer data, gpointer user_data) {
89 PurpleAccountUserSplit *split = data;
90 PidginAccountEditor *editor = user_data;
91 GtkWidget *entry = NULL;
92
93 if(!purple_account_user_split_is_constant(split)) {
94 GtkWidget *row = NULL;
95
96 row = adw_action_row_new();
97 editor->user_split_rows = g_list_append(editor->user_split_rows, row);
98 adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->login_options),
99 row);
100
101 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row),
102 purple_account_user_split_get_text(split));
103
104 entry = gtk_entry_new();
105 gtk_widget_set_hexpand(entry, TRUE);
106 gtk_widget_set_valign(entry, GTK_ALIGN_CENTER);
107 adw_action_row_add_suffix(ADW_ACTION_ROW(row), entry);
108 adw_action_row_set_activatable_widget(ADW_ACTION_ROW(row), entry);
109 }
110
111 editor->user_split_entries = g_list_append(editor->user_split_entries,
112 entry);
113 }
114
115 static gboolean
116 pidgin_account_editor_update_login_options(PidginAccountEditor *editor,
117 PurpleProtocol *protocol)
118 {
119 GList *user_splits = NULL;
120 GList *split_item = NULL;
121 GList *entry_item = NULL;
122 gchar *username = NULL;
123
124 /* Clear out the old user splits from our list. */
125 g_clear_pointer(&editor->user_split_entries, g_list_free);
126
127 /* Now remove the rows we added to the preference group for each non
128 * constant user split.
129 */
130 while(editor->user_split_rows != NULL) {
131 adw_preferences_group_remove(ADW_PREFERENCES_GROUP(editor->login_options),
132 editor->user_split_rows->data);
133
134 editor->user_split_rows = g_list_delete_link(editor->user_split_rows,
135 editor->user_split_rows);
136 }
137
138 /* Add the user splits for the protocol. */
139 user_splits = purple_protocol_get_user_splits(protocol);
140 g_list_foreach(user_splits, pidgin_account_editor_add_user_split, editor);
141
142 /* If we have an account, populate its values. */
143 if(PURPLE_IS_ACCOUNT(editor->account)) {
144 /* The username will be split apart below and eventually set as the text
145 * in the username entry.
146 */
147 username = g_strdup(purple_account_get_username(editor->account));
148 }
149
150 /* Filling out the user splits is a pain. If we have an account, we created
151 * a copy of the username above. We then iterate the user splits backwards
152 * so we can insert a null terminator at the start of each split we find in
153 * the username.
154 */
155 split_item = g_list_last(user_splits);
156 entry_item = g_list_last(editor->user_split_entries);
157 while(split_item != NULL && entry_item != NULL) {
158 GtkWidget *entry = entry_item->data;
159 PurpleAccountUserSplit *split = split_item->data;
160 gchar *ptr = NULL;
161 const gchar *value = NULL;
162
163 if(username != NULL) {
164 gchar sep = purple_account_user_split_get_separator(split);
165
166 if(purple_account_user_split_get_reverse(split)) {
167 ptr = strrchr(username, sep);
168 } else {
169 ptr = strchr(username, sep);
170 }
171
172 if(ptr != NULL) {
173 /* Insert a null terminator in place of the separator. */
174 *ptr = '\0';
175
176 /* Set the value to the first byte after the separator. */
177 value = ptr + 1;
178 }
179 }
180
181 if(value == NULL) {
182 value = purple_account_user_split_get_default_value(split);
183 }
184
185 if(value != NULL && GTK_IS_ENTRY(entry)) {
186 gtk_editable_set_text(GTK_EDITABLE(entry), value);
187 }
188
189 split_item = split_item->prev;
190 entry_item = entry_item->prev;
191 }
192
193 /* Free the user splits. */
194 g_list_free_full(user_splits,
195 (GDestroyNotify)purple_account_user_split_destroy);
196
197 /* Set the username entry to the remaining text in username and free our
198 * copy of said username.
199 */
200 if(username != NULL) {
201 gtk_editable_set_text(GTK_EDITABLE(editor->username), username);
202 g_free(username);
203 return TRUE;
204 }
205
206 return FALSE;
207 }
208
209 static void
210 pidgin_account_editor_update_user_options(PidginAccountEditor *editor,
211 PurpleProtocol *protocol)
212 {
213 PurpleBuddyIconSpec *icon_spec = NULL;
214 PurpleImage *image = NULL;
215 gboolean show_avatar_opts = TRUE;
216 const gchar *svalue = "";
217 gboolean use_global = TRUE;
218
219 /* Check if the protocol supports avatars. */
220 icon_spec = purple_protocol_get_icon_spec(protocol);
221 show_avatar_opts = (icon_spec != NULL && icon_spec->format != NULL);
222 purple_buddy_icon_spec_free(icon_spec);
223
224 gtk_widget_set_visible(editor->avatar_row, show_avatar_opts);
225
226 /* Determine our values. */
227 if(editor->account != NULL) {
228 svalue = purple_account_get_private_alias(editor->account);
229 image = purple_buddy_icons_find_account_icon(editor->account);
230 use_global = purple_account_get_bool(editor->account,
231 "use-global-buddyicon", TRUE);
232 }
233
234 if(svalue == NULL) {
235 svalue = "";
236 }
237
238 gtk_editable_set_text(GTK_EDITABLE(editor->alias), svalue);
239 gtk_switch_set_active(GTK_SWITCH(editor->use_custom_avatar), !use_global);
240
241 g_clear_object(&editor->avatar_pixbuf);
242 if(PURPLE_IS_IMAGE(image)) {
243 editor->avatar_pixbuf = purple_gdk_pixbuf_from_image(image);
244 gtk_image_set_from_pixbuf(GTK_IMAGE(editor->avatar),
245 editor->avatar_pixbuf);
246 } else {
247 gtk_image_set_from_icon_name(GTK_IMAGE(editor->avatar),
248 "select-avatar");
249 }
250 }
251
252 static gboolean
253 pidgin_account_editor_advanced_option_use_default(PidginAccountEditor *editor) {
254 PurpleProtocol *protocol = NULL;
255
256 /* If this is the new dialog, use the default value. */
257 if(!PURPLE_IS_ACCOUNT(editor->account)) {
258 return TRUE;
259 }
260
261 /* If we have an existing account, check if the protocol has changed. */
262 protocol = pidgin_protocol_chooser_get_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol));
263 if(protocol != purple_account_get_protocol(editor->account)) {
264 return TRUE;
265 }
266
267 return FALSE;
268 }
269
270 static GtkWidget *
271 pidgin_account_editor_add_advanced_boolean(PidginAccountEditor *editor,
272 PurpleAccountOption *option)
273 {
274 GtkWidget *row = NULL;
275 GtkWidget *toggle = NULL;
276 gboolean value = FALSE;
277 gchar *title = NULL;
278
279 if(pidgin_account_editor_advanced_option_use_default(editor)) {
280 value = purple_account_option_get_default_bool(option);
281 } else {
282 const gchar *setting = purple_account_option_get_setting(option);
283 gboolean def_value = purple_account_option_get_default_bool(option);
284
285 value = purple_account_get_bool(editor->account, setting, def_value);
286 }
287
288 /* Create the row and set its title with a mnemonic. */
289 row = adw_action_row_new();
290 g_object_bind_property(editor->advanced_toggle, "active", row, "visible",
291 G_BINDING_SYNC_CREATE);
292 adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE);
293 title = g_strdup_printf("_%s", purple_account_option_get_text(option));
294 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title);
295 g_free(title);
296
297 adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group),
298 row);
299
300 /* Add the row to the editor's list of advanced rows. */
301 editor->advanced_rows = g_list_append(editor->advanced_rows, row);
302
303 /* Create the input widget. */
304 toggle = gtk_switch_new();
305 gtk_switch_set_active(GTK_SWITCH(toggle), value);
306 gtk_widget_set_valign(toggle, GTK_ALIGN_CENTER);
307 adw_action_row_add_suffix(ADW_ACTION_ROW(row), toggle);
308 adw_action_row_set_activatable_widget(ADW_ACTION_ROW(row), toggle);
309
310 return toggle;
311 }
312
313 static GtkWidget *
314 pidgin_account_editor_add_advanced_int(PidginAccountEditor *editor,
315 PurpleAccountOption *option)
316 {
317 GtkWidget *row = NULL;
318 GtkWidget *entry = NULL;
319 gint value = 0;
320 gchar *title = NULL;
321 gchar *svalue = NULL;
322
323 if(pidgin_account_editor_advanced_option_use_default(editor)) {
324 value = purple_account_option_get_default_int(option);
325 } else {
326 const gchar *setting = purple_account_option_get_setting(option);
327 gint def_value = purple_account_option_get_default_int(option);
328
329 value = purple_account_get_int(editor->account, setting, def_value);
330 }
331
332 /* Create the row and set its title with a mnemonic. */
333 row = adw_action_row_new();
334 g_object_bind_property(editor->advanced_toggle, "active", row, "visible",
335 G_BINDING_SYNC_CREATE);
336 adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE);
337 title = g_strdup_printf("_%s", purple_account_option_get_text(option));
338 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title);
339 g_free(title);
340
341 adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group),
342 row);
343
344 /* Add the row to the editor's list of advanced rows. */
345 editor->advanced_rows = g_list_append(editor->advanced_rows, row);
346
347 /* Create the input widget. */
348 entry = gtk_entry_new();
349 gtk_entry_set_input_purpose(GTK_ENTRY(entry), GTK_INPUT_PURPOSE_DIGITS);
350 svalue = g_strdup_printf("%d", value);
351 gtk_editable_set_text(GTK_EDITABLE(entry), svalue);
352 g_free(svalue);
353
354 gtk_widget_set_hexpand(entry, TRUE);
355 gtk_widget_set_valign(entry, GTK_ALIGN_CENTER);
356 adw_action_row_add_suffix(ADW_ACTION_ROW(row), entry);
357 adw_action_row_set_activatable_widget(ADW_ACTION_ROW(row), entry);
358
359 return entry;
360 }
361
362 static GtkWidget *
363 pidgin_account_editor_add_advanced_string(PidginAccountEditor *editor,
364 PurpleAccountOption *option)
365 {
366 GtkWidget *row = NULL;
367 GtkWidget *entry = NULL;
368 gchar *title = NULL;
369 const gchar *value = NULL;
370
371 if(pidgin_account_editor_advanced_option_use_default(editor)) {
372 value = purple_account_option_get_default_string(option);
373 } else {
374 const gchar *setting = purple_account_option_get_setting(option);
375 const gchar *def_value = NULL;
376
377 def_value = purple_account_option_get_default_string(option);
378
379 value = purple_account_get_string(editor->account, setting, def_value);
380 }
381
382 /* Create the row and set its title with a mnemonic. */
383 row = adw_action_row_new();
384 g_object_bind_property(editor->advanced_toggle, "active", row, "visible",
385 G_BINDING_SYNC_CREATE);
386 adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE);
387 title = g_strdup_printf("_%s", purple_account_option_get_text(option));
388 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title);
389 g_free(title);
390
391 adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group),
392 row);
393
394 /* Add the row to the editor's list of advanced rows. */
395 editor->advanced_rows = g_list_append(editor->advanced_rows, row);
396
397 /* Create the input widget. */
398 if(purple_account_option_string_get_masked(option)) {
399 entry = gtk_password_entry_new();
400 } else {
401 entry = gtk_entry_new();
402 }
403
404 if(value != NULL) {
405 gtk_editable_set_text(GTK_EDITABLE(entry), value);
406 }
407 gtk_widget_set_hexpand(entry, TRUE);
408 gtk_widget_set_valign(entry, GTK_ALIGN_CENTER);
409 adw_action_row_add_suffix(ADW_ACTION_ROW(row), entry);
410 adw_action_row_set_activatable_widget(ADW_ACTION_ROW(row), entry);
411
412 return entry;
413 }
414
415 static GtkWidget *
416 pidgin_account_editor_add_advanced_list(PidginAccountEditor *editor,
417 PurpleAccountOption *option)
418 {
419 GtkWidget *row = NULL;
420 GtkStringList *model = NULL;
421 GList *data = NULL;
422 GList *items = NULL;
423 gchar *title = NULL;
424 const gchar *value = FALSE;
425 guint index = 0;
426 guint position = 0;
427
428 if(pidgin_account_editor_advanced_option_use_default(editor)) {
429 value = purple_account_option_get_default_list_value(option);
430 } else {
431 const gchar *setting = purple_account_option_get_setting(option);
432 const gchar *def_value = NULL;
433
434 def_value = purple_account_option_get_default_list_value(option);
435
436 value = purple_account_get_string(editor->account, setting, def_value);
437 }
438
439 /* Create the row and set its title with a mnemonic. */
440 row = adw_combo_row_new();
441 g_object_bind_property(editor->advanced_toggle, "active", row, "visible",
442 G_BINDING_SYNC_CREATE);
443 adw_preferences_row_set_use_underline(ADW_PREFERENCES_ROW(row), TRUE);
444 adw_combo_row_set_use_subtitle(ADW_COMBO_ROW(row), TRUE);
445 title = g_strdup_printf("_%s", purple_account_option_get_text(option));
446 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), title);
447 g_free(title);
448
449 adw_preferences_group_add(ADW_PREFERENCES_GROUP(editor->advanced_group),
450 row);
451
452 /* Add the row to the editor's list of advanced rows. */
453 editor->advanced_rows = g_list_append(editor->advanced_rows, row);
454
455 /* Create the model and data for the expression. */
456 items = purple_account_option_get_list(option);
457 model = gtk_string_list_new(NULL);
458
459 for(GList *l = items; l != NULL; l = l->next) {
460 PurpleKeyValuePair *kvp = l->data;
461
462 if(kvp != NULL) {
463 if(purple_strequal(kvp->value, value)) {
464 position = index;
465 }
466
467 data = g_list_append(data, kvp->value);
468 gtk_string_list_append(model, kvp->key);
469 }
470
471 index++;
472 }
473
474 adw_combo_row_set_model(ADW_COMBO_ROW(row), G_LIST_MODEL(model));
475 adw_combo_row_set_selected(ADW_COMBO_ROW(row), position);
476 g_object_set_data_full(G_OBJECT(row), "keys", data,
477 (GDestroyNotify)g_list_free);
478
479 return row;
480 }
481
482 static void
483 pidgin_account_editor_add_advanced_option(PidginAccountEditor *editor,
484 PurpleAccountOption *option)
485 {
486 PurplePrefType type;
487 GtkWidget *widget = NULL;
488
489 type = purple_account_option_get_pref_type(option);
490 switch(type) {
491 case PURPLE_PREF_BOOLEAN:
492 widget = pidgin_account_editor_add_advanced_boolean(editor, option);
493 break;
494 case PURPLE_PREF_INT:
495 widget = pidgin_account_editor_add_advanced_int(editor, option);
496 break;
497 case PURPLE_PREF_STRING:
498 widget = pidgin_account_editor_add_advanced_string(editor, option);
499 break;
500 case PURPLE_PREF_STRING_LIST:
501 widget = pidgin_account_editor_add_advanced_list(editor, option);
502 break;
503 default:
504 purple_debug_error("PidginAccountEditor",
505 "Invalid Account Option pref type (%d)", type);
506 break;
507 }
508
509 if(GTK_IS_WIDGET(widget)) {
510 g_object_set_data_full(G_OBJECT(widget), "option", option,
511 (GDestroyNotify)purple_account_option_destroy);
512
513 editor->advanced_entries = g_list_append(editor->advanced_entries,
514 widget);
515 } else {
516 purple_account_option_destroy(option);
517 }
518 }
519
520 static void
521 pidgin_account_editor_update_advanced_options(PidginAccountEditor *editor,
522 PurpleProtocol *protocol)
523 {
524 GList *options = NULL;
525
526 g_clear_pointer(&editor->advanced_entries, g_list_free);
527 while(editor->advanced_rows != NULL) {
528 adw_preferences_group_remove(ADW_PREFERENCES_GROUP(editor->advanced_group),
529 GTK_WIDGET(editor->advanced_rows->data));
530
531 editor->advanced_rows = g_list_delete_link(editor->advanced_rows,
532 editor->advanced_rows);
533 }
534
535 if(!PURPLE_IS_PROTOCOL(protocol)) {
536 gtk_widget_set_visible(editor->advanced_group, FALSE);
537
538 return;
539 }
540
541 options = purple_protocol_get_account_options(protocol);
542 if(options == NULL) {
543 gtk_widget_set_visible(editor->advanced_group, FALSE);
544
545 return;
546 }
547
548 /* Iterate the options and call our helper which will take ownership of the
549 * option itself, but we'll delete the list item as we go.
550 */
551 while(options != NULL) {
552 pidgin_account_editor_add_advanced_option(editor, options->data);
553
554 options = g_list_delete_link(options, options);
555 }
556
557 gtk_widget_set_visible(editor->advanced_group, TRUE);
558 }
559
560 static void
561 pidgin_account_editor_update_proxy_options(PidginAccountEditor *editor) {
562 PurpleProxyInfo *info = NULL;
563 GListModel *model = NULL;
564 const gchar *svalue = NULL;
565 gint ivalue = 0;
566 guint position = 0;
567
568 if(!PURPLE_IS_ACCOUNT(editor->account)) {
569 return;
570 }
571
572 info = purple_account_get_proxy_info(editor->account);
573
574 switch(purple_proxy_info_get_proxy_type(info)) {
575 case PURPLE_PROXY_TYPE_USE_GLOBAL:
576 svalue = "global";
577 break;
578 case PURPLE_PROXY_TYPE_NONE:
579 svalue = "none";
580 break;
581 case PURPLE_PROXY_TYPE_SOCKS4:
582 svalue = "socks4";
583 break;
584 case PURPLE_PROXY_TYPE_SOCKS5:
585 svalue = "socks5";
586 break;
587 case PURPLE_PROXY_TYPE_TOR:
588 svalue = "tor";
589 break;
590 case PURPLE_PROXY_TYPE_HTTP:
591 svalue = "http";
592 break;
593 case PURPLE_PROXY_TYPE_USE_ENVVAR:
594 svalue = "envvar";
595 break;
596 }
597
598 model = adw_combo_row_get_model(ADW_COMBO_ROW(editor->proxy_type));
599 for(guint i = 0; i < g_list_model_get_n_items(model); i++) {
600 GtkStringObject *obj = g_list_model_get_item(model, i);
601 if(purple_strequal(svalue, gtk_string_object_get_string(obj))) {
602 position = i;
603 break;
604 }
605 }
606 adw_combo_row_set_selected(ADW_COMBO_ROW(editor->proxy_type), position);
607
608 svalue = purple_proxy_info_get_hostname(info);
609 if(svalue == NULL) {
610 svalue = "";
611 }
612 gtk_editable_set_text(GTK_EDITABLE(editor->proxy_host), svalue);
613
614 ivalue = purple_proxy_info_get_port(info);
615 gtk_spin_button_set_value(GTK_SPIN_BUTTON(editor->proxy_port),
616 (gdouble)ivalue);
617
618 svalue = purple_proxy_info_get_username(info);
619 if(svalue == NULL) {
620 svalue = "";
621 }
622 gtk_editable_set_text(GTK_EDITABLE(editor->proxy_username), svalue);
623
624 svalue = purple_proxy_info_get_password(info);
625 if(svalue == NULL) {
626 svalue = "";
627 }
628 gtk_editable_set_text(GTK_EDITABLE(editor->proxy_password), svalue);
629 }
630
631 static void
632 pidgin_account_editor_update(PidginAccountEditor *editor) {
633 PurpleProtocol *protocol = NULL;
634 gboolean sensitive = FALSE;
635
636 if(PURPLE_IS_ACCOUNT(editor->account)) {
637 PurpleConnection *connection = NULL;
638
639 connection = purple_account_get_connection(editor->account);
640 if(PURPLE_IS_CONNECTION(connection)) {
641 gtk_widget_set_sensitive(editor->protocol, FALSE);
642 }
643 }
644
645 protocol = pidgin_protocol_chooser_get_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol));
646
647 sensitive = pidgin_account_editor_update_login_options(editor, protocol);
648 pidgin_account_editor_update_user_options(editor, protocol);
649 pidgin_account_editor_update_advanced_options(editor, protocol);
650 pidgin_account_editor_update_proxy_options(editor);
651
652 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor), GTK_RESPONSE_APPLY,
653 sensitive);
654 }
655
656 static void
657 pidgin_account_editor_login_options_update_editable(PidginAccountEditor *editor)
658 {
659 PurpleConnection *connection = NULL;
660 gboolean editable = TRUE;
661
662 if(PURPLE_IS_ACCOUNT(editor->account)) {
663
664 connection = purple_account_get_connection(editor->account);
665
666 /* If we have an active connection, we need to disable everything
667 * related to the protocol and username.
668 */
669 if(PURPLE_IS_CONNECTION(connection)) {
670 PidginProtocolChooser *chooser = NULL;
671 PurpleProtocol *connected_protocol = NULL;
672 PurpleProtocol *selected_protocol = NULL;
673 editable = FALSE;
674
675 /* Check if the user changed the protocol. If they did, switch it
676 * back and update the editor to reflect what settings are active.
677 */
678 connected_protocol = purple_connection_get_protocol(connection);
679
680 chooser = PIDGIN_PROTOCOL_CHOOSER(editor->protocol);
681 selected_protocol = pidgin_protocol_chooser_get_protocol(chooser);
682 if(connected_protocol != selected_protocol) {
683 pidgin_protocol_chooser_set_protocol(chooser, connected_protocol);
684 pidgin_account_editor_update(editor);
685 }
686 }
687
688 }
689
690 gtk_widget_set_sensitive(editor->protocol, editable);
691 gtk_editable_set_editable(GTK_EDITABLE(editor->username), editable);
692 for(GList *l = editor->user_split_entries; l != NULL; l = l->next) {
693 GtkWidget *widget = l->data;
694
695 gtk_editable_set_editable(GTK_EDITABLE(widget), editable);
696 }
697 }
698
699 static void
49 pidgin_account_editor_set_account(PidginAccountEditor *editor, 700 pidgin_account_editor_set_account(PidginAccountEditor *editor,
50 PurpleAccount *account) 701 PurpleAccount *account)
51 { 702 {
52 if(g_set_object(&editor->account, account)) { 703 if(g_set_object(&editor->account, account)) {
53 PurpleProxyInfo *proxy_info = NULL;
54
55 if(PURPLE_IS_ACCOUNT(account)) { 704 if(PURPLE_IS_ACCOUNT(account)) {
56 proxy_info = purple_account_get_proxy_info(account); 705 g_signal_connect(account, "notify::connection",
57 } 706 G_CALLBACK(pidgin_account_editor_connection_changed_cb),
58 707 editor);
59 pidgin_proxy_options_set_info(PIDGIN_PROXY_OPTIONS(editor->proxy_options), 708 }
60 proxy_info);
61 709
62 g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_ACCOUNT]); 710 g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_ACCOUNT]);
63 } 711 }
712
713 pidgin_account_editor_update(editor);
714 }
715
716 static gboolean
717 pidgin_account_editor_save_login_options(PidginAccountEditor *editor) {
718 PurpleProtocol *protocol = NULL;
719 GList *split_item = NULL, *entry_item = NULL;
720 GString *username = NULL;
721 const gchar *protocol_id = NULL;
722 gboolean new_account = FALSE;
723
724 protocol = pidgin_protocol_chooser_get_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol));
725 protocol_id = purple_protocol_get_id(protocol);
726
727 username = g_string_new(gtk_editable_get_text(GTK_EDITABLE(editor->username)));
728
729 split_item = purple_protocol_get_user_splits(protocol);
730 entry_item = editor->user_split_entries;
731 while(split_item != NULL && entry_item != NULL) {
732 PurpleAccountUserSplit *split = split_item->data;
733 GtkEntry *entry = entry_item->data;
734 const gchar *value = "";
735 gchar sep = '\0';
736
737 sep = purple_account_user_split_get_separator(split);
738 g_string_append_c(username, sep);
739
740 if(GTK_IS_ENTRY(entry)) {
741 value = gtk_editable_get_text(GTK_EDITABLE(entry));
742 }
743
744 if(value == NULL || *value == '\0') {
745 value = purple_account_user_split_get_default_value(split);
746 }
747
748 g_string_append(username, value);
749
750 split_item = split_item->next;
751 entry_item = entry_item->next;
752 }
753
754 if(!PURPLE_IS_ACCOUNT(editor->account)) {
755 editor->account = purple_account_new(username->str, protocol_id);
756 new_account = TRUE;
757 } else {
758 purple_account_set_username(editor->account, username->str);
759 purple_account_set_protocol_id(editor->account, protocol_id);
760 }
761
762 g_string_free(username, TRUE);
763
764 return new_account;
765 }
766
767 static void
768 pidgin_account_editor_save_user_options(PidginAccountEditor *editor) {
769 const gchar *svalue = NULL;
770 gboolean bvalue = FALSE;
771
772 /* Set the alias. */
773 svalue = gtk_editable_get_text(GTK_EDITABLE(editor->alias));
774 if(*svalue == '\0') {
775 svalue = NULL;
776 }
777 purple_account_set_private_alias(editor->account, svalue);
778
779 /* Set whether or not to use the global avatar. */
780 bvalue = gtk_switch_get_active(GTK_SWITCH(editor->use_custom_avatar));
781 purple_account_set_bool(editor->account, "use-global-buddyicon", !bvalue);
782
783 if(bvalue) {
784 if(GDK_IS_PIXBUF(editor->avatar_pixbuf)) {
785 # warning implement this when buddy icons do not suck so bad.
786 } else {
787 purple_buddy_icons_set_account_icon(editor->account, NULL, 0);
788 }
789 } else {
790 # warning set the global buddy icon when buddy icons do not suck so bad.
791 }
792 }
793
794 static void
795 pidgin_account_editor_save_advanced_options(PidginAccountEditor *editor) {
796 for(GList *l = editor->advanced_entries; l != NULL; l = l->next) {
797 GtkWidget *widget = l->data;
798 PurpleAccountOption *option = NULL;
799 GList *keys = NULL;
800 const gchar *setting = NULL;
801 const gchar *svalue = NULL;
802 gboolean bvalue = FALSE;
803 gint ivalue = 0;
804 guint selected = 0;
805
806 option = g_object_get_data(G_OBJECT(widget), "option");
807 setting = purple_account_option_get_setting(option);
808
809 switch(purple_account_option_get_pref_type(option)) {
810 case PURPLE_PREF_STRING:
811 svalue = gtk_editable_get_text(GTK_EDITABLE(widget));
812 purple_account_set_string(editor->account, setting, svalue);
813 break;
814 case PURPLE_PREF_INT:
815 svalue = gtk_editable_get_text(GTK_EDITABLE(widget));
816 ivalue = atoi(svalue);
817 purple_account_set_int(editor->account, setting, ivalue);
818 break;
819 case PURPLE_PREF_BOOLEAN:
820 bvalue = gtk_switch_get_active(GTK_SWITCH(widget));
821 purple_account_set_bool(editor->account, setting, bvalue);
822 break;
823 case PURPLE_PREF_STRING_LIST:
824 keys = g_object_get_data(G_OBJECT(widget), "keys");
825 selected = adw_combo_row_get_selected(ADW_COMBO_ROW(widget));
826 svalue = g_list_nth_data(keys, selected);
827 purple_account_set_string(editor->account, setting, svalue);
828 break;
829 default:
830 break;
831 }
832 }
833 }
834
835 static void
836 pidgin_account_editor_save_proxy(PidginAccountEditor *editor,
837 gboolean new_account)
838 {
839 PurpleProxyInfo *info = NULL;
840 PurpleProxyType type = PURPLE_PROXY_TYPE_NONE;
841 GObject *item = NULL;
842 const gchar *svalue = NULL;
843 gint ivalue = 0;
844
845 /* Build the ProxyInfo object */
846 if(new_account) {
847 info = purple_proxy_info_new();
848 purple_account_set_proxy_info(editor->account, info);
849 } else {
850 info = purple_account_get_proxy_info(editor->account);
851 }
852
853 item = adw_combo_row_get_selected_item(ADW_COMBO_ROW(editor->proxy_type));
854 svalue = gtk_string_object_get_string(GTK_STRING_OBJECT(item));
855 if(purple_strequal(svalue, "global")) {
856 type = PURPLE_PROXY_TYPE_USE_GLOBAL;
857 } else if(purple_strequal(svalue, "none")) {
858 type = PURPLE_PROXY_TYPE_NONE;
859 } else if(purple_strequal(svalue, "socks4")) {
860 type = PURPLE_PROXY_TYPE_SOCKS4;
861 } else if(purple_strequal(svalue, "socks5")) {
862 type = PURPLE_PROXY_TYPE_SOCKS5;
863 } else if(purple_strequal(svalue, "tor")) {
864 type = PURPLE_PROXY_TYPE_TOR;
865 } else if(purple_strequal(svalue, "http")) {
866 type = PURPLE_PROXY_TYPE_HTTP;
867 } else if(purple_strequal(svalue, "envvar")) {
868 type = PURPLE_PROXY_TYPE_USE_ENVVAR;
869 }
870 purple_proxy_info_set_proxy_type(info, type);
871
872 svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_host));
873 purple_proxy_info_set_hostname(info, svalue);
874
875 ivalue = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(editor->proxy_port));
876 purple_proxy_info_set_port(info, ivalue);
877
878 svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_username));
879 purple_proxy_info_set_username(info, svalue);
880
881 svalue = gtk_editable_get_text(GTK_EDITABLE(editor->proxy_password));
882 purple_proxy_info_set_password(info, svalue);
64 } 883 }
65 884
66 static void 885 static void
67 pidgin_account_editor_save_account(PidginAccountEditor *editor) { 886 pidgin_account_editor_save_account(PidginAccountEditor *editor) {
68 PurpleAccountManager *manager = NULL;
69 PurpleProxyInfo *info = NULL;
70 gboolean new_account = FALSE; 887 gboolean new_account = FALSE;
71 888
72 manager = purple_account_manager_get_default(); 889 new_account = pidgin_account_editor_save_login_options(editor);
73 890 pidgin_account_editor_save_user_options(editor);
74 if(!PURPLE_IS_ACCOUNT(editor->account)) { 891 pidgin_account_editor_save_advanced_options(editor);
75 editor->account = purple_account_new("undefined", "undefined"); 892 pidgin_account_editor_save_proxy(editor, new_account);
76 new_account = TRUE;
77 }
78
79 info = pidgin_proxy_options_get_info(PIDGIN_PROXY_OPTIONS(editor->proxy_options));
80 purple_account_set_proxy_info(editor->account, info);
81 893
82 /* If this is a new account, add it to the account manager and bring it 894 /* If this is a new account, add it to the account manager and bring it
83 * online. 895 * online.
84 */ 896 */
85 if(new_account) { 897 if(new_account) {
898 PurpleAccountManager *manager = NULL;
86 const PurpleSavedStatus *saved_status; 899 const PurpleSavedStatus *saved_status;
900
901 manager = purple_account_manager_get_default();
87 902
88 purple_account_manager_add(manager, editor->account); 903 purple_account_manager_add(manager, editor->account);
89 904
90 saved_status = purple_savedstatus_get_current(); 905 saved_status = purple_savedstatus_get_current();
91 if (saved_status != NULL) { 906 if (saved_status != NULL) {
98 913
99 /****************************************************************************** 914 /******************************************************************************
100 * Callbacks 915 * Callbacks
101 *****************************************************************************/ 916 *****************************************************************************/
102 static void 917 static void
918 pidgin_account_editor_connection_changed_cb(G_GNUC_UNUSED GObject *obj,
919 G_GNUC_UNUSED GParamSpec *pspec,
920 gpointer data)
921 {
922 PidginAccountEditor *editor = data;
923
924 pidgin_account_editor_login_options_update_editable(editor);
925 }
926
927 static void
103 pidgin_account_editor_response_cb(GtkDialog *dialog, gint response_id, 928 pidgin_account_editor_response_cb(GtkDialog *dialog, gint response_id,
104 G_GNUC_UNUSED gpointer data) 929 G_GNUC_UNUSED gpointer data)
105 { 930 {
106 if(response_id == GTK_RESPONSE_APPLY) { 931 if(response_id == GTK_RESPONSE_APPLY) {
107 pidgin_account_editor_save_account(PIDGIN_ACCOUNT_EDITOR(dialog)); 932 pidgin_account_editor_save_account(PIDGIN_ACCOUNT_EDITOR(dialog));
108 } 933 }
109 934
110 gtk_window_destroy(GTK_WINDOW(dialog)); 935 gtk_window_destroy(GTK_WINDOW(dialog));
936 }
937
938 static void
939 pidgin_account_editor_protocol_changed_cb(G_GNUC_UNUSED GObject *obj,
940 G_GNUC_UNUSED GParamSpec *pspec,
941 gpointer data)
942 {
943 pidgin_account_editor_update(data);
944 }
945
946 static void
947 pidgin_account_editor_username_changed_cb(GtkEditable *self, gpointer data) {
948 PidginAccountEditor *editor = data;
949 const gchar *text = gtk_editable_get_text(self);
950 gboolean sensitive = FALSE;
951
952 if(text != NULL && *text != '\0') {
953 sensitive = TRUE;
954 }
955
956 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor), GTK_RESPONSE_APPLY,
957 sensitive);
958 }
959
960 static void
961 pidgin_account_editor_avatar_response_cb(GtkNativeDialog *self,
962 gint response_id, gpointer data)
963 {
964 PidginAccountEditor *editor = data;
965
966 if(response_id == GTK_RESPONSE_ACCEPT) {
967 GError *error = NULL;
968 GFile *file = NULL;
969 gchar *filename = NULL;
970
971 file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(self));
972 filename = g_file_get_path(file);
973
974 g_clear_object(&editor->avatar_pixbuf);
975 editor->avatar_pixbuf = gdk_pixbuf_new_from_file(filename, &error);
976 if(error != NULL) {
977 g_warning("Failed to create pixbuf from file %s: %s", filename,
978 error->message);
979 g_clear_error(&error);
980 } else {
981 gtk_image_set_from_pixbuf(GTK_IMAGE(editor->avatar),
982 editor->avatar_pixbuf);
983 }
984
985 g_free(filename);
986 g_object_unref(file);
987 }
988
989 g_clear_object(&editor->avatar_dialog);
990 }
991
992 static void
993 pidgin_account_editor_avatar_set_clicked_cb(G_GNUC_UNUSED GtkButton *self,
994 gpointer data)
995 {
996 PidginAccountEditor *editor = data;
997
998 editor->avatar_dialog = gtk_file_chooser_native_new(_("Buddy Icon"),
999 GTK_WINDOW(editor),
1000 GTK_FILE_CHOOSER_ACTION_OPEN,
1001 _("_Open"),
1002 _("_Cancel"));
1003 gtk_native_dialog_set_transient_for(GTK_NATIVE_DIALOG(editor->avatar_dialog),
1004 GTK_WINDOW(editor));
1005
1006 g_signal_connect(G_OBJECT(editor->avatar_dialog), "response",
1007 G_CALLBACK(pidgin_account_editor_avatar_response_cb),
1008 editor);
1009
1010 gtk_native_dialog_show(GTK_NATIVE_DIALOG(editor->avatar_dialog));
1011 }
1012
1013 static void
1014 pidgin_account_editor_avatar_remove_clicked_cb(G_GNUC_UNUSED GtkButton *self,
1015 gpointer data)
1016 {
1017 PidginAccountEditor *editor = data;
1018
1019 gtk_image_set_from_icon_name(GTK_IMAGE(editor->avatar), "select-avatar");
1020
1021 g_clear_object(&editor->avatar_pixbuf);
1022 }
1023
1024 static gchar *
1025 pidgin_account_editor_proxy_type_expression_cb(GObject *self,
1026 G_GNUC_UNUSED gpointer data)
1027 {
1028 const gchar *text = "";
1029 const gchar *value = NULL;
1030
1031 value = gtk_string_object_get_string(GTK_STRING_OBJECT(self));
1032 if(purple_strequal(value, "global")) {
1033 text = _("Use Global Proxy Settings");
1034 } else if(purple_strequal(value, "none")) {
1035 text = _("No proxy");
1036 } else if(purple_strequal(value, "socks4")) {
1037 text = _("SOCKS 4");
1038 } else if(purple_strequal(value, "socks5")) {
1039 text = _("SOCKS 5");
1040 } else if(purple_strequal(value, "tor")) {
1041 text = _("Tor/Privacy (SOCKS 5)");
1042 } else if(purple_strequal(value, "http")) {
1043 text = _("HTTP");
1044 } else if(purple_strequal(value, "envvar")) {
1045 text = _("Use Environmental Settings");
1046 }
1047
1048 return g_strdup(text);
1049 }
1050
1051 static void
1052 pidgin_account_editor_proxy_type_changed_cb(G_GNUC_UNUSED GObject *obj,
1053 G_GNUC_UNUSED GParamSpec *pspec,
1054 gpointer data)
1055 {
1056 PidginAccountEditor *editor = data;
1057 GObject *selected = NULL;
1058 gboolean show_options = TRUE;
1059 const gchar *value = NULL;
1060
1061 selected = adw_combo_row_get_selected_item(ADW_COMBO_ROW(editor->proxy_type));
1062 value = gtk_string_object_get_string(GTK_STRING_OBJECT(selected));
1063
1064 if(purple_strequal(value, "global") || purple_strequal(value, "none") ||
1065 purple_strequal(value, "envvar"))
1066 {
1067 show_options = FALSE;
1068 }
1069
1070 gtk_widget_set_visible(editor->proxy_options, show_options);
111 } 1071 }
112 1072
113 /****************************************************************************** 1073 /******************************************************************************
114 * GObject Implementation 1074 * GObject Implementation
115 *****************************************************************************/ 1075 *****************************************************************************/
152 static void 1112 static void
153 pidgin_account_editor_dispose(GObject *obj) { 1113 pidgin_account_editor_dispose(GObject *obj) {
154 PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj); 1114 PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj);
155 1115
156 g_clear_object(&editor->account); 1116 g_clear_object(&editor->account);
1117 g_clear_object(&editor->avatar_dialog);
1118 g_clear_object(&editor->avatar_pixbuf);
157 1119
158 G_OBJECT_CLASS(pidgin_account_editor_parent_class)->dispose(obj); 1120 G_OBJECT_CLASS(pidgin_account_editor_parent_class)->dispose(obj);
159 } 1121 }
160 1122
161 static void 1123 static void
162 pidgin_account_editor_init(PidginAccountEditor *account_editor) { 1124 pidgin_account_editor_init(PidginAccountEditor *editor) {
163 GtkWidget *widget = GTK_WIDGET(account_editor); 1125 GtkCssProvider *css_provider = NULL;
1126 GtkStyleContext *context = NULL;
1127 GtkWidget *widget = GTK_WIDGET(editor);
164 1128
165 gtk_widget_init_template(widget); 1129 gtk_widget_init_template(widget);
1130
1131 css_provider = gtk_css_provider_new();
1132 gtk_css_provider_load_from_resource(css_provider,
1133 "/im/pidgin/Pidgin3/Accounts/entry.css");
1134
1135 context = gtk_widget_get_style_context(GTK_WIDGET(editor));
1136 gtk_style_context_add_provider(context,
1137 GTK_STYLE_PROVIDER(css_provider),
1138 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
1139
1140 g_clear_object(&css_provider);
1141
1142 pidgin_account_editor_proxy_type_changed_cb(NULL, NULL, editor);
1143 }
1144
1145 static void
1146 pidgin_account_editor_constructed(GObject *obj) {
1147 PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj);
1148
1149 G_OBJECT_CLASS(pidgin_account_editor_parent_class)->constructed(obj);
1150
1151 if(PURPLE_IS_ACCOUNT(editor->account)) {
1152 pidgin_protocol_chooser_set_protocol(PIDGIN_PROTOCOL_CHOOSER(editor->protocol),
1153 purple_account_get_protocol(editor->account));
1154 }
1155
1156 pidgin_account_editor_update(editor);
1157 pidgin_account_editor_login_options_update_editable(editor);
1158 }
1159
1160 static void
1161 pidgin_account_editor_finalize(GObject *obj) {
1162 PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj);
1163
1164 g_clear_pointer(&editor->user_split_entries, g_list_free);
1165 g_clear_pointer(&editor->user_split_rows, g_list_free);
1166
1167 g_clear_pointer(&editor->advanced_entries, g_list_free);
1168 g_clear_pointer(&editor->advanced_rows, g_list_free);
1169
1170 G_OBJECT_CLASS(pidgin_account_editor_parent_class)->finalize(obj);
166 } 1171 }
167 1172
168 static void 1173 static void
169 pidgin_account_editor_class_init(PidginAccountEditorClass *klass) { 1174 pidgin_account_editor_class_init(PidginAccountEditorClass *klass) {
170 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); 1175 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
171 GObjectClass *obj_class = G_OBJECT_CLASS(klass); 1176 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
172 1177
173 obj_class->get_property = pidgin_account_editor_get_property; 1178 obj_class->get_property = pidgin_account_editor_get_property;
174 obj_class->set_property = pidgin_account_editor_set_property; 1179 obj_class->set_property = pidgin_account_editor_set_property;
1180 obj_class->constructed = pidgin_account_editor_constructed;
175 obj_class->dispose = pidgin_account_editor_dispose; 1181 obj_class->dispose = pidgin_account_editor_dispose;
1182 obj_class->finalize = pidgin_account_editor_finalize;
176 1183
177 /** 1184 /**
178 * PidginAccountEditor::account: 1185 * PidginAccountEditor::account:
179 * 1186 *
180 * The account that this editor is modifying. 1187 * The account that this editor is modifying.
190 g_object_class_install_properties(obj_class, N_PROPERTIES, properties); 1197 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
191 1198
192 gtk_widget_class_set_template_from_resource(widget_class, 1199 gtk_widget_class_set_template_from_resource(widget_class,
193 "/im/pidgin/Pidgin3/Accounts/editor.ui"); 1200 "/im/pidgin/Pidgin3/Accounts/editor.ui");
194 1201
195 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor, 1202 /* Dialog */
196 notebook);
197 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
198 proxy_options);
199
200 gtk_widget_class_bind_template_callback(widget_class, 1203 gtk_widget_class_bind_template_callback(widget_class,
201 pidgin_account_editor_response_cb); 1204 pidgin_account_editor_response_cb);
1205
1206 /* Login Options */
1207 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1208 login_options);
1209 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1210 protocol);
1211 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1212 username);
1213
1214 gtk_widget_class_bind_template_callback(widget_class,
1215 pidgin_account_editor_protocol_changed_cb);
1216 gtk_widget_class_bind_template_callback(widget_class,
1217 pidgin_account_editor_username_changed_cb);
1218
1219 /* User Options */
1220 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1221 alias);
1222 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1223 avatar_row);
1224 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1225 use_custom_avatar);
1226 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1227 avatar);
1228
1229 gtk_widget_class_bind_template_callback(widget_class,
1230 pidgin_account_editor_avatar_set_clicked_cb);
1231 gtk_widget_class_bind_template_callback(widget_class,
1232 pidgin_account_editor_avatar_remove_clicked_cb);
1233
1234 /* Advanced Options */
1235 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1236 advanced_group);
1237 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1238 advanced_toggle);
1239
1240 /* Proxy Options */
1241 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1242 proxy_type);
1243 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1244 proxy_options);
1245 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1246 proxy_host);
1247 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1248 proxy_port);
1249 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1250 proxy_username);
1251 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
1252 proxy_password);
1253
1254 gtk_widget_class_bind_template_callback(widget_class,
1255 pidgin_account_editor_proxy_type_expression_cb);
1256 gtk_widget_class_bind_template_callback(widget_class,
1257 pidgin_account_editor_proxy_type_changed_cb);
202 } 1258 }
203 1259
204 /****************************************************************************** 1260 /******************************************************************************
205 * API 1261 * API
206 *****************************************************************************/ 1262 *****************************************************************************/

mercurial