Mercurial > pidgin.yaz
annotate console/gntaccount.c @ 15544:cb6bb41291c8
merge of '600cfd77bdb8554e712ba04da84518976cd80b86'
and '79f63e67c9df036c4f97bc50b13b4bbf90c7b0bc'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 04 Feb 2007 09:51:11 +0000 |
parents | 81650a27f253 |
children | 2eacd3be75a0 |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
2 * @file gntaccount.c GNT Account API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14422
diff
changeset
|
24 */ |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include <gnt.h> |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include <gntbox.h> |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 #include <gntbutton.h> |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
28 #include <gntcheckbox.h> |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
29 #include <gntcombobox.h> |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
30 #include <gntentry.h> |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include <gntlabel.h> |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
32 #include <gntline.h> |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 #include <gnttree.h> |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
35 #include <account.h> |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
36 #include <accountopt.h> |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 #include <connection.h> |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 #include <notify.h> |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
39 #include <plugin.h> |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 #include <request.h> |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 #include "gntaccount.h" |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 #include "gntgaim.h" |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
45 #include <string.h> |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
46 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 typedef struct |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 GntWidget *window; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 GntWidget *tree; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 } GGAccountList; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 static GGAccountList accounts; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
55 typedef struct |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
56 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
57 GaimAccount *account; /* NULL for a new account */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
58 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
59 GntWidget *window; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
60 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
61 GntWidget *protocol; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
62 GntWidget *screenname; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
63 GntWidget *password; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
64 GntWidget *alias; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
65 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
66 GntWidget *splits; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
67 GList *split_entries; |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
68 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
69 GList *prpl_entries; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
70 GntWidget *prpls; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
71 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
72 GntWidget *newmail; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
73 GntWidget *remember; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
74 } AccountEditDialog; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
75 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
76 /* This is necessary to close an edit-dialog when an account is deleted */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
77 static GList *accountdialogs; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
78 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
79 static void |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
80 account_add(GaimAccount *account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
81 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
82 gnt_tree_add_choice(GNT_TREE(accounts.tree), account, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
83 gnt_tree_create_row(GNT_TREE(accounts.tree), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
84 gaim_account_get_username(account), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
85 gaim_account_get_protocol_name(account)), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
86 NULL, NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
87 gnt_tree_set_choice(GNT_TREE(accounts.tree), account, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
88 gaim_account_get_enabled(account, GAIM_GNT_UI)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
89 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
90 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
91 static void |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
92 edit_dialog_destroy(AccountEditDialog *dialog) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
93 { |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
94 accountdialogs = g_list_remove(accountdialogs, dialog); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
95 g_list_free(dialog->prpl_entries); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
96 g_list_free(dialog->split_entries); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
97 g_free(dialog); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
98 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
99 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
100 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
101 save_account_cb(AccountEditDialog *dialog) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
102 { |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
103 GaimAccount *account; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
104 GaimPlugin *plugin; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
105 GaimPluginProtocolInfo *prplinfo; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
106 const char *value; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
107 GString *username; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
108 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
109 /* XXX: Do some error checking first. */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
110 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
111 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
112 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
113 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
114 /* Screenname && user-splits */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
115 value = gnt_entry_get_text(GNT_ENTRY(dialog->screenname)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
116 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
117 if (value == NULL || *value == '\0') |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
118 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
119 gaim_notify_error(NULL, _("Error"), _("Account was not added"), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
120 _("Screenname of an account must be non-empty.")); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
121 return; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
122 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
123 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
124 username = g_string_new(value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
125 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
126 if (prplinfo != NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
127 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
128 GList *iter, *entries; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
129 for (iter = prplinfo->user_splits, entries = dialog->split_entries; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
130 iter && entries; iter = iter->next, entries = entries->next) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
131 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
132 GaimAccountUserSplit *split = iter->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
133 GntWidget *entry = entries->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
134 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
135 value = gnt_entry_get_text(GNT_ENTRY(entry)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
136 if (value == NULL || *value == '\0') |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
137 value = gaim_account_user_split_get_default_value(split); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
138 g_string_append_printf(username, "%c%s", |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
139 gaim_account_user_split_get_separator(split), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
140 value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
141 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
142 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
143 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
144 if (dialog->account == NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
145 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
146 account = gaim_account_new(username->str, gaim_plugin_get_id(plugin)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
147 gaim_accounts_add(account); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
148 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
149 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
150 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
151 account = dialog->account; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
152 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
153 /* Protocol */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
154 gaim_account_set_protocol_id(account, gaim_plugin_get_id(plugin)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
155 gaim_account_set_username(account, username->str); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
156 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
157 g_string_free(username, TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
158 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
159 /* Alias */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
160 value = gnt_entry_get_text(GNT_ENTRY(dialog->alias)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
161 if (value && *value) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
162 gaim_account_set_alias(account, value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
163 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
164 /* Remember password and password */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
165 gaim_account_set_remember_password(account, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
166 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
167 value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
168 if (value && *value && gaim_account_get_remember_password(account)) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
169 gaim_account_set_password(account, value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
170 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
171 gaim_account_set_password(account, NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
172 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
173 /* Mail notification */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
174 gaim_account_set_check_mail(account, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
175 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
176 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
177 /* Protocol options */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
178 if (prplinfo) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
179 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
180 GList *iter, *entries; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
181 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
182 for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
183 iter && entries; iter = iter->next, entries = entries->next) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
184 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
185 GaimAccountOption *option = iter->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
186 GntWidget *entry = entries->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
187 GaimPrefType type = gaim_account_option_get_type(option); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
188 const char *setting = gaim_account_option_get_setting(option); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
189 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
190 if (type == GAIM_PREF_STRING) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
191 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
192 const char *value = gnt_entry_get_text(GNT_ENTRY(entry)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
193 gaim_account_set_string(account, setting, value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
194 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
195 else if (type == GAIM_PREF_INT) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
196 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
197 const char *str = gnt_entry_get_text(GNT_ENTRY(entry)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
198 int value = 0; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
199 if (str) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
200 value = atoi(str); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
201 gaim_account_set_int(account, setting, value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
202 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
203 else if (type == GAIM_PREF_BOOLEAN) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
204 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
205 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
206 gaim_account_set_bool(account, setting, value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
207 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
208 else if (type == GAIM_PREF_STRING_LIST) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
209 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
210 /* TODO: */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
211 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
212 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
213 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
214 g_assert_not_reached(); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
215 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
216 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
217 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
218 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
219 /* XXX: Proxy options */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
220 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
221 gnt_widget_destroy(dialog->window); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
222 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
223 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
224 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
225 update_user_splits(AccountEditDialog *dialog) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
226 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
227 GntWidget *hbox; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
228 GaimPlugin *plugin; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
229 GaimPluginProtocolInfo *prplinfo; |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
230 GList *iter, *entries; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
231 char *username = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
232 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
233 if (dialog->splits) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
234 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
235 gnt_box_remove_all(GNT_BOX(dialog->splits)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
236 g_list_free(dialog->split_entries); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
237 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
238 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
239 { |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
240 dialog->splits = gnt_vbox_new(FALSE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
241 gnt_box_set_pad(GNT_BOX(dialog->splits), 0); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
242 gnt_box_set_fill(GNT_BOX(dialog->splits), TRUE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
243 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
244 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
245 dialog->split_entries = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
246 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
247 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
248 if (!plugin) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
249 return; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
250 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
251 |
14326
f74c19f2da30
[gaim-migrate @ 17021]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
252 username = dialog->account ? g_strdup(gaim_account_get_username(dialog->account)) : NULL; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
253 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
254 for (iter = prplinfo->user_splits; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
255 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
256 GaimAccountUserSplit *split = iter->data; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
257 GntWidget *entry; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
258 char *buf; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
259 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
260 hbox = gnt_hbox_new(TRUE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
261 gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
262 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
263 buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(split)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
264 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(buf)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
265 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
266 entry = gnt_entry_new(NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
267 gnt_box_add_widget(GNT_BOX(hbox), entry); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
268 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
269 dialog->split_entries = g_list_append(dialog->split_entries, entry); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
270 g_free(buf); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
271 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
272 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
273 for (iter = g_list_last(prplinfo->user_splits), entries = g_list_last(dialog->split_entries); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
274 iter && entries; iter = iter->prev, entries = entries->prev) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
275 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
276 GntWidget *entry = entries->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
277 GaimAccountUserSplit *split = iter->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
278 const char *value = NULL; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
279 char *s; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
280 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
281 if (dialog->account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
282 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
283 s = strrchr(username, gaim_account_user_split_get_separator(split)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
284 if (s != NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
285 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
286 *s = '\0'; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
287 s++; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
288 value = s; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
289 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
290 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
291 if (value == NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
292 value = gaim_account_user_split_get_default_value(split); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
293 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
294 if (value != NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
295 gnt_entry_set_text(GNT_ENTRY(entry), value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
296 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
297 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
298 if (username != NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
299 gnt_entry_set_text(GNT_ENTRY(dialog->screenname), username); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
300 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
301 g_free(username); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
302 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
303 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
304 static void |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
305 add_protocol_options(AccountEditDialog *dialog) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
306 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
307 GaimPlugin *plugin; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
308 GaimPluginProtocolInfo *prplinfo; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
309 GList *iter; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
310 GntWidget *vbox, *box; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
311 GaimAccount *account; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
312 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
313 if (dialog->prpls) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
314 gnt_box_remove_all(GNT_BOX(dialog->prpls)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
315 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
316 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
317 dialog->prpls = vbox = gnt_vbox_new(FALSE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
318 gnt_box_set_pad(GNT_BOX(vbox), 0); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
319 gnt_box_set_alignment(GNT_BOX(vbox), GNT_ALIGN_LEFT); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
320 gnt_box_set_fill(GNT_BOX(vbox), TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
321 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
322 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
323 if (dialog->prpl_entries) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
324 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
325 g_list_free(dialog->prpl_entries); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
326 dialog->prpl_entries = NULL; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
327 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
328 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
329 vbox = dialog->prpls; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
330 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
331 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
332 if (!plugin) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
333 return; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
334 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
335 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
336 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
337 account = dialog->account; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
338 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
339 for (iter = prplinfo->protocol_options; iter; iter = iter->next) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
340 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
341 GaimAccountOption *option = iter->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
342 GaimPrefType type = gaim_account_option_get_type(option); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
343 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
344 box = gnt_hbox_new(TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
345 gnt_box_set_pad(GNT_BOX(box), 0); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
346 gnt_box_add_widget(GNT_BOX(vbox), box); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
347 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
348 if (type == GAIM_PREF_BOOLEAN) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
349 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
350 GntWidget *widget = gnt_check_box_new(gaim_account_option_get_text(option)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
351 gnt_box_add_widget(GNT_BOX(box), widget); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
352 dialog->prpl_entries = g_list_append(dialog->prpl_entries, widget); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
353 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
354 if (account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
355 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
356 gaim_account_get_bool(account, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
357 gaim_account_option_get_setting(option), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
358 gaim_account_option_get_default_bool(option))); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
359 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
360 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
361 gaim_account_option_get_default_bool(option)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
362 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
363 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
364 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
365 gnt_box_add_widget(GNT_BOX(box), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
366 gnt_label_new(gaim_account_option_get_text(option))); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
367 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
368 if (type == GAIM_PREF_STRING_LIST) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
369 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
370 /* TODO: Use a combobox */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
371 /* Don't forget to append the widget to prpl_entries */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
372 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
373 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
374 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
375 GntWidget *entry = gnt_entry_new(NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
376 gnt_box_add_widget(GNT_BOX(box), entry); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
377 dialog->prpl_entries = g_list_append(dialog->prpl_entries, entry); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
378 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
379 if (type == GAIM_PREF_STRING) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
380 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
381 const char *dv = gaim_account_option_get_default_string(option); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
382 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
383 if (account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
384 gnt_entry_set_text(GNT_ENTRY(entry), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
385 gaim_account_get_string(account, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
386 gaim_account_option_get_setting(option), dv)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
387 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
388 gnt_entry_set_text(GNT_ENTRY(entry), dv); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
389 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
390 else if (type == GAIM_PREF_INT) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
391 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
392 char str[32]; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
393 int value = gaim_account_option_get_default_int(option); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
394 if (account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
395 value = gaim_account_get_int(account, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
396 gaim_account_option_get_setting(option), value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
397 snprintf(str, sizeof(str), "%d", value); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
398 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
399 gnt_entry_set_text(GNT_ENTRY(entry), str); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
400 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
401 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
402 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
403 g_assert_not_reached(); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
404 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
405 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
406 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
407 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
408 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
409 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
410 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
411 update_user_options(AccountEditDialog *dialog) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
412 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
413 GaimPlugin *plugin; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
414 GaimPluginProtocolInfo *prplinfo; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
415 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
416 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
417 if (!plugin) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
418 return; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
419 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
420 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
421 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
422 if (dialog->newmail == NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
423 dialog->newmail = gnt_check_box_new(_("New mail notifications")); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
424 if (dialog->account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
425 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
426 gaim_account_get_check_mail(dialog->account)); |
13980
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
427 if (!prplinfo || !(prplinfo->options & OPT_PROTO_MAIL_CHECK)) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
428 gnt_widget_set_visible(dialog->newmail, FALSE); |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
429 else |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
430 gnt_widget_set_visible(dialog->newmail, TRUE); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
431 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
432 if (dialog->remember == NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
433 dialog->remember = gnt_check_box_new(_("Remember password")); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
434 if (dialog->account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
435 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
436 gaim_account_get_remember_password(dialog->account)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
437 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
438 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
439 static void |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
440 prpl_changed_cb(GntWidget *combo, GaimPlugin *old, GaimPlugin *new, AccountEditDialog *dialog) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
441 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
442 update_user_splits(dialog); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
443 add_protocol_options(dialog); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
444 update_user_options(dialog); /* This may not be necessary here */ |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
445 gnt_box_readjust(GNT_BOX(dialog->window)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
446 gnt_widget_draw(dialog->window); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
447 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
448 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
449 static void |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
450 edit_account(GaimAccount *account) |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
451 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
452 GntWidget *window, *hbox; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
453 GntWidget *combo, *button, *entry; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
454 GList *list, *iter; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
455 AccountEditDialog *dialog; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
456 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
457 if (account) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
458 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
459 GList *iter; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
460 for (iter = accountdialogs; iter; iter = iter->next) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
461 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
462 AccountEditDialog *dlg = iter->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
463 if (dlg->account == account) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
464 return; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
465 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
466 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
467 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
468 dialog = g_new0(AccountEditDialog, 1); |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
469 accountdialogs = g_list_prepend(accountdialogs, dialog); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
470 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
471 dialog->window = window = gnt_vbox_new(FALSE); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
472 dialog->account = account; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
473 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
474 gnt_box_set_title(GNT_BOX(window), account ? _("Modify Account") : _("New Account")); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
475 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
476 gnt_box_set_pad(GNT_BOX(window), 0); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
477 gnt_widget_set_name(window, "edit-account"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
478 gnt_box_set_fill(GNT_BOX(window), TRUE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
479 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
480 hbox = gnt_hbox_new(TRUE); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
481 gnt_box_set_pad(GNT_BOX(hbox), 0); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
482 gnt_box_add_widget(GNT_BOX(window), hbox); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
483 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
484 dialog->protocol = combo = gnt_combo_box_new(); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
485 list = gaim_plugins_get_protocols(); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
486 for (iter = list; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
487 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
488 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
489 ((GaimPlugin*)iter->data)->info->name); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
490 } |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
491 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
492 if (account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
493 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
494 gaim_plugins_find_with_id(gaim_account_get_protocol_id(account))); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
495 else |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
496 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
497 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
498 g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
499 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
500 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Protocol:"))); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
501 gnt_box_add_widget(GNT_BOX(hbox), combo); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
502 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
503 hbox = gnt_hbox_new(TRUE); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
504 gnt_box_set_pad(GNT_BOX(hbox), 0); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
505 gnt_box_add_widget(GNT_BOX(window), hbox); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
506 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
507 dialog->screenname = entry = gnt_entry_new(NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
508 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Screen name:"))); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
509 gnt_box_add_widget(GNT_BOX(hbox), entry); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
510 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
511 /* User splits */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
512 update_user_splits(dialog); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
513 gnt_box_add_widget(GNT_BOX(window), dialog->splits); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
514 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
515 hbox = gnt_hbox_new(TRUE); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
516 gnt_box_set_pad(GNT_BOX(hbox), 0); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
517 gnt_box_add_widget(GNT_BOX(window), hbox); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
518 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
519 dialog->password = entry = gnt_entry_new(NULL); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
520 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
521 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
522 gnt_box_add_widget(GNT_BOX(hbox), entry); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
523 if (account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
524 gnt_entry_set_text(GNT_ENTRY(entry), gaim_account_get_password(account)); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
525 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
526 hbox = gnt_hbox_new(TRUE); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
527 gnt_box_set_pad(GNT_BOX(hbox), 0); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
528 gnt_box_add_widget(GNT_BOX(window), hbox); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
529 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
530 dialog->alias = entry = gnt_entry_new(NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
531 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
532 gnt_box_add_widget(GNT_BOX(hbox), entry); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
533 if (account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
534 gnt_entry_set_text(GNT_ENTRY(entry), gaim_account_get_alias(account)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
535 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
536 /* User options */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
537 update_user_options(dialog); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
538 gnt_box_add_widget(GNT_BOX(window), dialog->remember); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
539 gnt_box_add_widget(GNT_BOX(window), dialog->newmail); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
540 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
541 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
542 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
543 /* The advanced box */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
544 add_protocol_options(dialog); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
545 gnt_box_add_widget(GNT_BOX(window), dialog->prpls); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
546 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
547 /* TODO: Add proxy options */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
548 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
549 /* The button box */ |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
550 hbox = gnt_hbox_new(FALSE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
551 gnt_box_add_widget(GNT_BOX(window), hbox); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
552 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
553 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
554 button = gnt_button_new(_("Cancel")); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
555 gnt_box_add_widget(GNT_BOX(hbox), button); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
556 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
557 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
558 button = gnt_button_new(_("Save")); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
559 gnt_box_add_widget(GNT_BOX(hbox), button); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
560 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(save_account_cb), dialog); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
561 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
562 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(edit_dialog_destroy), dialog); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
563 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
564 gnt_widget_show(window); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
565 gnt_box_readjust(GNT_BOX(window)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
566 gnt_widget_draw(window); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
567 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
568 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
569 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
570 add_account_cb(GntWidget *widget, gpointer null) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
571 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
572 edit_account(NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
573 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
574 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
575 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
576 modify_account_cb(GntWidget *widget, GntTree *tree) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
577 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
578 GaimAccount *account = gnt_tree_get_selection_data(tree); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
579 if (!account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
580 return; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
581 edit_account(account); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
582 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
583 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
584 static void |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
585 really_delete_account(GaimAccount *account) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
586 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
587 GList *iter; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
588 for (iter = accountdialogs; iter; iter = iter->next) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
589 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
590 AccountEditDialog *dlg = iter->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
591 if (dlg->account == account) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
592 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
593 gnt_widget_destroy(dlg->window); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
594 break; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
595 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
596 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
597 gaim_accounts_delete(account); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
598 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
599 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
600 static void |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
601 delete_account_cb(GntWidget *widget, GntTree *tree) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
602 { |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
603 GaimAccount *account; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
604 char *prompt; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
605 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
606 account = gnt_tree_get_selection_data(tree); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
607 if (!account) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
608 return; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
609 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
610 prompt = g_strdup_printf(_("Are you sure you want to delete %s?"), |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
611 gaim_account_get_username(account)); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
612 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
613 gaim_request_close_with_handle(account); /* Close any other opened delete window */ |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
614 gaim_request_action(account, _("Delete Account"), prompt, NULL, 0, account, 2, |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
615 _("Delete"), really_delete_account, _("Cancel"), NULL); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
616 g_free(prompt); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
617 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
618 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
619 static void |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
620 account_toggled(GntWidget *widget, void *key, gpointer null) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
621 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
622 GaimAccount *account = key; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
623 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
624 gaim_account_set_enabled(account, GAIM_GNT_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
625 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
626 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
627 static void |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
628 reset_accounts_win(GntWidget *widget, gpointer null) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
629 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
630 accounts.window = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
631 accounts.tree = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
632 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
633 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
634 void gg_accounts_show_all() |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
636 GList *iter; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
637 GntWidget *box, *button; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 |
14326
f74c19f2da30
[gaim-migrate @ 17021]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
639 if (accounts.window) |
f74c19f2da30
[gaim-migrate @ 17021]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
640 return; |
f74c19f2da30
[gaim-migrate @ 17021]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
641 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
642 accounts.window = gnt_vbox_new(FALSE); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
643 gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts")); |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
645 gnt_box_set_pad(GNT_BOX(accounts.window), 0); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
646 gnt_box_set_alignment(GNT_BOX(accounts.window), GNT_ALIGN_MID); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 gnt_widget_set_name(accounts.window, "accounts"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 gnt_box_add_widget(GNT_BOX(accounts.window), |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
650 gnt_label_new(_("You can enable/disable accounts from the following list."))); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
651 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
652 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
653 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
654 accounts.tree = gnt_tree_new_with_columns(2); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
655 GNT_WIDGET_SET_FLAGS(accounts.tree, GNT_WIDGET_NO_BORDER); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
656 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
657 for (iter = gaim_accounts_get_all(); iter; iter = iter->next) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
658 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
659 GaimAccount *account = iter->data; |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
660 account_add(account); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
661 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
662 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
663 g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
664 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
665 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 0, 40); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
666 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 1, 10); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
667 gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
668 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
669 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
670 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
671 box = gnt_hbox_new(FALSE); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
672 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
673 button = gnt_button_new(_("Add")); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
674 gnt_box_add_widget(GNT_BOX(box), button); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
675 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(add_account_cb), NULL); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
676 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
677 button = gnt_button_new(_("Modify")); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
678 gnt_box_add_widget(GNT_BOX(box), button); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
679 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(modify_account_cb), accounts.tree); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
680 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
681 button = gnt_button_new(_("Delete")); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
682 gnt_box_add_widget(GNT_BOX(box), button); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
683 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(delete_account_cb), accounts.tree); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
684 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
685 gnt_box_add_widget(GNT_BOX(accounts.window), box); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
686 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
687 g_signal_connect(G_OBJECT(accounts.window), "destroy", G_CALLBACK(reset_accounts_win), NULL); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
688 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
689 gnt_widget_show(accounts.window); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
690 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
691 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
692 static gpointer |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
693 gg_accounts_get_handle() |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
694 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
695 static int handle; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
696 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
697 return &handle; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
698 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
699 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
700 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
701 account_added_callback(GaimAccount *account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
702 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
703 if (accounts.window == NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
704 return; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
705 account_add(account); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
706 gnt_widget_draw(accounts.tree); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
707 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
708 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
709 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
710 account_removed_callback(GaimAccount *account) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
711 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
712 if (accounts.window == NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
713 return; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
714 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
715 gnt_tree_remove(GNT_TREE(accounts.tree), account); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
716 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
717 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
718 void gg_accounts_init() |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
719 { |
14422
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
720 GList *iter; |
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
721 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
722 gaim_signal_connect(gaim_accounts_get_handle(), "account-added", |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
723 gg_accounts_get_handle(), GAIM_CALLBACK(account_added_callback), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
724 NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
725 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed", |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
726 gg_accounts_get_handle(), GAIM_CALLBACK(account_removed_callback), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
727 NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
728 |
14422
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
729 for (iter = gaim_accounts_get_all(); iter; iter = iter->next) { |
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
730 if (gaim_account_get_enabled(iter->data, GAIM_GNT_UI)) |
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
731 break; |
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
732 } |
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
733 if (!iter) |
84a480acb6ad
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14326
diff
changeset
|
734 gg_accounts_show_all(); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
735 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
736 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
737 void gg_accounts_uninit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
738 { |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
739 if (accounts.window) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
740 gnt_widget_destroy(accounts.window); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
741 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
742 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
743 /* The following uiops stuff are copied from gtkaccount.c */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
744 typedef struct |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
745 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
746 GaimAccount *account; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
747 char *username; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
748 char *alias; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
749 } AddUserData; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
750 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
751 static char * |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
752 make_info(GaimAccount *account, GaimConnection *gc, const char *remote_user, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
753 const char *id, const char *alias, const char *msg) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
754 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
755 if (msg != NULL && *msg == '\0') |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
756 msg = NULL; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
757 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
758 return g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s"), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
759 remote_user, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
760 (alias != NULL ? " (" : ""), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
761 (alias != NULL ? alias : ""), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
762 (alias != NULL ? ")" : ""), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
763 (id != NULL |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
764 ? id |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
765 : (gaim_connection_get_display_name(gc) != NULL |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
766 ? gaim_connection_get_display_name(gc) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
767 : gaim_account_get_username(account))), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
768 (msg != NULL ? ": " : "."), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
769 (msg != NULL ? msg : "")); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
770 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
771 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
772 static void |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
773 notify_added(GaimAccount *account, const char *remote_user, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
774 const char *id, const char *alias, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
775 const char *msg) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
776 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
777 char *buffer; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
778 GaimConnection *gc; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
779 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
780 gc = gaim_account_get_connection(account); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
781 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
782 buffer = make_info(account, gc, remote_user, id, alias, msg); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
783 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
784 gaim_notify_info(NULL, NULL, buffer, NULL); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
785 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
786 g_free(buffer); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
787 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
788 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
789 static void |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
790 free_add_user_data(AddUserData *data) |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
791 { |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
792 g_free(data->username); |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
793 |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
794 if (data->alias != NULL) |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
795 g_free(data->alias); |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
796 |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
797 g_free(data); |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
798 } |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
799 |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
800 static void |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
801 add_user_cb(AddUserData *data) |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
802 { |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
803 GaimConnection *gc = gaim_account_get_connection(data->account); |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
804 |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
805 if (g_list_find(gaim_connections_get_all(), gc)) |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
806 { |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
807 gaim_blist_request_add_buddy(data->account, data->username, |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
808 NULL, data->alias); |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
809 } |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
810 |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
811 free_add_user_data(data); |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
812 } |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
813 |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
814 static void |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
815 request_add(GaimAccount *account, const char *remote_user, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
816 const char *id, const char *alias, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
817 const char *msg) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
818 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
819 char *buffer; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
820 GaimConnection *gc; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
821 AddUserData *data; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
822 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
823 gc = gaim_account_get_connection(account); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
824 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
825 data = g_new0(AddUserData, 1); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
826 data->account = account; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
827 data->username = g_strdup(remote_user); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
828 data->alias = (alias != NULL ? g_strdup(alias) : NULL); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
829 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
830 buffer = make_info(account, gc, remote_user, id, alias, msg); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
831 gaim_request_action(NULL, NULL, _("Add buddy to your list?"), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
832 buffer, GAIM_DEFAULT_ACTION_NONE, data, 2, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
833 _("Add"), G_CALLBACK(add_user_cb), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
834 _("Cancel"), G_CALLBACK(free_add_user_data)); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
835 g_free(buffer); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
836 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
837 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
838 static GaimAccountUiOps ui_ops = |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
839 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
840 .notify_added = notify_added, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
841 .status_changed = NULL, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
842 .request_add = request_add |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
843 }; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
844 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
845 GaimAccountUiOps *gg_accounts_get_ui_ops() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
846 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
847 return &ui_ops; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
848 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
849 |