Mercurial > pidgin
annotate src/gtkaccount.c @ 10082:51e9c4f27a62
[gaim-migrate @ 11073]
an update was provided for this as well
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 06 Oct 2004 11:22:18 +0000 |
parents | 41ef089e3df8 |
children | 9f358a718f38 |
rev | line source |
---|---|
5563 | 1 /** |
7820 | 2 * @file gtkaccount.c GTK+ Account Editor UI |
5563 | 3 * @ingroup gtkui |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
10 * |
5563 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9308 | 25 |
9791 | 26 #include "internal.h" |
27 #include "gtkgaim.h" | |
5717 | 28 |
5563 | 29 #include "account.h" |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
30 #include "accountopt.h" |
6229 | 31 #include "core.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
32 #include "debug.h" |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
33 #include "notify.h" |
5852
daac2e9a1b0b
[gaim-migrate @ 6283]
Christian Hammond <chipx86@chipx86.com>
parents:
5851
diff
changeset
|
34 #include "plugin.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
35 #include "prefs.h" |
9308 | 36 #include "prpl.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
37 #include "request.h" |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
38 #include "signals.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
39 #include "util.h" |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
40 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
41 #include "gaim-disclosure.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
42 #include "gtkaccount.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
43 #include "gtkblist.h" |
9709 | 44 #include "gtkdialogs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
45 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
46 #include "stock.h" |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
47 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
48 enum |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
49 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
50 COLUMN_ICON, |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
51 COLUMN_SCREENNAME, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
52 COLUMN_ONLINE, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
53 COLUMN_AUTOLOGIN, |
5781
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
54 COLUMN_PROTOCOL, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
55 COLUMN_DATA, |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
56 COLUMN_PULSE_DATA, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
57 NUM_COLUMNS |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
58 }; |
5563 | 59 |
60 typedef struct | |
61 { | |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
62 GaimAccount *account; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
63 char *username; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
64 char *alias; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
65 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
66 } GaimGtkAccountAddUserData; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
67 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
68 typedef struct |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
69 { |
5563 | 70 GtkWidget *window; |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
71 GtkWidget *treeview; |
5563 | 72 |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
73 GtkWidget *modify_button; |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
74 GtkWidget *delete_button; |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
75 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
76 GtkListStore *model; |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
77 GtkTreeIter drag_iter; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
78 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
79 GtkTreeViewColumn *screenname_col; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
80 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
81 GHashTable *account_pref_wins; |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
82 |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
83 } AccountsWindow; |
5563 | 84 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
85 typedef struct |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
86 { |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
87 GaimGtkAccountDialogType type; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
88 |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
89 GaimAccount *account; |
5978
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
90 char *protocol_id; |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
91 GaimPlugin *plugin; |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
92 GaimPluginProtocolInfo *prpl_info; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
93 |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
94 GaimProxyType new_proxy_type; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
95 |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
96 GList *user_split_entries; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
97 GList *protocol_opt_entries; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
98 |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
99 GtkSizeGroup *sg; |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
100 GtkWidget *window; |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
101 |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
102 GtkWidget *top_vbox; |
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
103 GtkWidget *bottom_vbox; |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
104 GtkWidget *ok_button; |
6141 | 105 GtkWidget *register_button; |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
106 |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
107 /* Login Options */ |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
108 GtkWidget *login_frame; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
109 GtkWidget *protocol_menu; |
5689
7a619706e048
[gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents:
5688
diff
changeset
|
110 GtkWidget *password_box; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
111 GtkWidget *screenname_entry; |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
112 GtkWidget *password_entry; |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
113 GtkWidget *alias_entry; |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
114 GtkWidget *remember_pass_check; |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
115 GtkWidget *auto_login_check; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
116 |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
117 /* User Options */ |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
118 GtkWidget *user_frame; |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
119 GtkWidget *new_mail_check; |
9482 | 120 GtkWidget *icon_hbox; |
121 GtkWidget *icon_entry; | |
122 char *icon_path; | |
123 GtkWidget *icon_filesel; | |
124 GtkWidget *icon_preview; | |
125 GtkWidget *icon_text; | |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
126 |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
127 /* Protocol Options */ |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
128 GtkWidget *protocol_frame; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
129 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
130 /* Proxy Options */ |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
131 GtkWidget *proxy_frame; |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
132 GtkWidget *proxy_vbox; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
133 GtkWidget *proxy_dropdown; |
8555 | 134 #if !GTK_CHECK_VERSION(2,4,0) |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
135 GtkWidget *proxy_menu; |
8555 | 136 #endif |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
137 GtkWidget *proxy_host_entry; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
138 GtkWidget *proxy_port_entry; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
139 GtkWidget *proxy_user_entry; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
140 GtkWidget *proxy_pass_entry; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
141 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
142 } AccountPrefsDialog; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
143 |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
144 typedef struct |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
145 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
146 GdkPixbuf *online_pixbuf; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
147 gboolean pulse_to_grey; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
148 float pulse_value; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
149 int timeout; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
150 GaimAccount *account; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
151 GtkTreeModel *model; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
152 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
153 } GaimGtkPulseData; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
154 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
155 |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
156 static AccountsWindow *accounts_window = NULL; |
5563 | 157 |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
158 static void add_account(AccountsWindow *dialog, GaimAccount *account); |
5774 | 159 static void set_account(GtkListStore *store, GtkTreeIter *iter, |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
160 GaimAccount *account); |
9555 | 161 static char* |
9702 | 162 convert_buddy_icon(GaimPlugin *plugin, const char *path); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
163 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
164 /************************************************************************** |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
165 * Add/Modify Account dialog |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
166 **************************************************************************/ |
5774 | 167 static void add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent); |
168 static void add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent); | |
169 static void add_protocol_options(AccountPrefsDialog *dialog, | |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
170 GtkWidget *parent); |
5774 | 171 static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
172 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
173 static GtkWidget * |
5774 | 174 add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
175 const char *text, GtkWidget *widget) |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
176 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
177 GtkWidget *hbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
178 GtkWidget *label; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
179 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
180 hbox = gtk_hbox_new(FALSE, 6); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
181 gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
182 gtk_widget_show(hbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
183 |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
184 label = gtk_label_new_with_mnemonic(text); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
185 gtk_size_group_add_widget(dialog->sg, label); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
186 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
187 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
188 gtk_widget_show(label); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
189 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
190 gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
191 gtk_widget_show(widget); |
8137 | 192 gaim_set_accessible_label (widget, label); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
193 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
194 return hbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
195 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
196 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
197 static void |
7956 | 198 set_account_protocol_cb(GtkWidget *item, const char *id, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
199 AccountPrefsDialog *dialog) |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
200 { |
9304
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
201 GaimPlugin *new_plugin; |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
202 |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
203 new_plugin = gaim_find_prpl(id); |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
204 |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
205 if (new_plugin == dialog->plugin) |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
206 return; |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
207 |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
208 dialog->plugin = new_plugin; |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
209 |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
210 if (dialog->plugin != NULL) |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
211 { |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5900
diff
changeset
|
212 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); |
5978
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
213 |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
214 if (dialog->protocol_id != NULL) |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
215 g_free(dialog->protocol_id); |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
216 |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
217 dialog->protocol_id = g_strdup(dialog->plugin->info->id); |
5955
235a14ae42f1
[gaim-migrate @ 6399]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
218 } |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
219 |
9304
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
220 if (dialog->account != NULL) |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
221 gaim_account_clear_settings(dialog->account); |
96c481da57ea
[gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents:
8903
diff
changeset
|
222 |
5774 | 223 add_login_options(dialog, dialog->top_vbox); |
224 add_user_options(dialog, dialog->top_vbox); | |
225 add_protocol_options(dialog, dialog->bottom_vbox); | |
6141 | 226 |
7208 | 227 if (!dialog->prpl_info || !dialog->prpl_info->register_user) |
6141 | 228 gtk_widget_hide(dialog->register_button); |
229 else | |
230 gtk_widget_show(dialog->register_button); | |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
231 } |
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
232 |
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
233 static void |
5774 | 234 screenname_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
235 { |
6732 | 236 if (dialog->ok_button) |
237 gtk_widget_set_sensitive(dialog->ok_button, | |
238 *gtk_entry_get_text(entry) != '\0'); | |
239 if (dialog->register_button) | |
240 gtk_widget_set_sensitive(dialog->register_button, | |
241 *gtk_entry_get_text(entry) != '\0'); | |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
242 |
5826 | 243 } |
6732 | 244 |
9482 | 245 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
246 static void |
9482 | 247 icon_filesel_choose_cb(GtkWidget *widget, gint response, AccountPrefsDialog *dialog) |
5826 | 248 { |
9482 | 249 const char *filename; |
250 | |
251 if (response != GTK_RESPONSE_ACCEPT) { | |
252 if (response == GTK_RESPONSE_CANCEL) | |
253 gtk_widget_destroy(dialog->icon_filesel); | |
254 dialog->icon_filesel = NULL; | |
255 return; | |
256 } | |
257 | |
258 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
259 #else /* FILECHOOSER */ | |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
260 static void |
9482 | 261 icon_filesel_choose_cb(GtkWidget *w, AccountPrefsDialog *dialog) |
5826 | 262 { |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
263 const char *filename; |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
264 |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
265 filename = gtk_file_selection_get_filename( |
9482 | 266 GTK_FILE_SELECTION(dialog->icon_filesel)); |
5870 | 267 |
5959 | 268 /* If they typed in a directory, change there */ |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
269 if (gaim_gtk_check_if_dir(filename, |
9482 | 270 GTK_FILE_SELECTION(dialog->icon_filesel))) |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
271 { |
5959 | 272 return; |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
273 } |
9482 | 274 #endif /* FILECHOOSER */ |
275 | |
276 if (dialog->icon_path) | |
277 g_free(dialog->icon_path); | |
9702 | 278 dialog->icon_path = convert_buddy_icon(dialog->plugin, filename); |
9555 | 279 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), dialog->icon_path); |
9482 | 280 gtk_widget_show(dialog->icon_entry); |
281 | |
282 gtk_widget_destroy(dialog->icon_filesel); | |
283 dialog->icon_filesel = NULL; | |
9555 | 284 } |
5826 | 285 |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
286 static void |
9482 | 287 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
288 icon_preview_change_cb(GtkFileChooser *widget, AccountPrefsDialog *dialog) | |
289 #else /* FILECHOOSER */ | |
290 icon_preview_change_cb(GtkTreeSelection *sel, AccountPrefsDialog *dialog) | |
291 #endif /* FILECHOOSER */ | |
5826 | 292 { |
293 GdkPixbuf *pixbuf, *scale; | |
294 int height, width; | |
295 char *basename, *markup, *size; | |
296 struct stat st; | |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
297 const char *filename; |
5826 | 298 |
9482 | 299 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
300 filename = gtk_file_chooser_get_preview_filename( | |
301 GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
302 #else /* FILECHOOSER */ | |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
303 filename = gtk_file_selection_get_filename( |
9482 | 304 GTK_FILE_SELECTION(dialog->icon_filesel)); |
305 #endif /* FILECHOOSER */ | |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
306 |
5826 | 307 if (!filename || stat(filename, &st)) |
308 return; | |
309 | |
310 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
311 if (!pixbuf) { | |
9482 | 312 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), NULL); |
313 gtk_label_set_markup(GTK_LABEL(dialog->icon_text), ""); | |
314 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ | |
315 gtk_file_chooser_set_preview_widget_active( | |
316 GTK_FILE_CHOOSER(dialog->icon_filesel), FALSE); | |
317 #endif /* FILECHOOSER */ | |
5826 | 318 return; |
319 } | |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
320 |
5826 | 321 width = gdk_pixbuf_get_width(pixbuf); |
322 height = gdk_pixbuf_get_height(pixbuf); | |
323 basename = g_path_get_basename(filename); | |
7107
9220c7490cd1
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
324 size = gaim_str_size_to_units(st.st_size); |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
325 markup = g_strdup_printf(_("<b>File:</b> %s\n" |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
326 "<b>File size:</b> %s\n" |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
327 "<b>Image size:</b> %dx%d"), |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
328 basename, size, width, height); |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
329 |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
330 scale = gdk_pixbuf_scale_simple(pixbuf, width * 50 / height, |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
331 50, GDK_INTERP_BILINEAR); |
9482 | 332 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), scale); |
333 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ | |
334 gtk_file_chooser_set_preview_widget_active( | |
335 GTK_FILE_CHOOSER(dialog->icon_filesel), TRUE); | |
336 #endif /* FILECHOOSER */ | |
337 gtk_label_set_markup(GTK_LABEL(dialog->icon_text), markup); | |
5826 | 338 |
339 g_object_unref(G_OBJECT(pixbuf)); | |
340 g_object_unref(G_OBJECT(scale)); | |
341 g_free(basename); | |
342 g_free(size); | |
5870 | 343 g_free(markup); |
5826 | 344 } |
345 | |
9482 | 346 #if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
347 static void |
9482 | 348 icon_filesel_delete_cb(GtkWidget *w, AccountPrefsDialog *dialog) |
5826 | 349 { |
9482 | 350 if (dialog->icon_filesel != NULL) |
351 gtk_widget_destroy(dialog->icon_filesel); | |
352 | |
353 dialog->icon_filesel = NULL; | |
354 } | |
355 #endif /* FILECHOOSER */ | |
356 | |
357 static void | |
358 icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog) | |
359 { | |
360 #if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ | |
5826 | 361 GtkWidget *hbox; |
362 GtkWidget *tv; | |
363 GtkTreeSelection *sel; | |
9482 | 364 #endif /* FILECHOOSER */ |
365 | |
366 if (dialog->icon_filesel != NULL) { | |
367 gtk_window_present(GTK_WINDOW(dialog->icon_filesel)); | |
5826 | 368 return; |
369 } | |
5870 | 370 |
9482 | 371 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
372 dialog->icon_filesel = gtk_file_chooser_dialog_new(_("Buddy Icon"), | |
373 GTK_WINDOW(dialog->window), | |
374 GTK_FILE_CHOOSER_ACTION_OPEN, | |
375 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
376 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, | |
377 NULL); | |
378 gtk_dialog_set_default_response(GTK_DIALOG(dialog->icon_filesel), GTK_RESPONSE_ACCEPT); | |
9496 | 379 |
380 | |
381 /* I removed code to set the current path to the current icon in the old file selector so I figure | |
382 * it shouldn't be here either. The reason is because the icon will potentially converted and won't | |
383 * be anything near what the user selected last time (which is the advantage to doing it this way. | |
384 * The solution is to create a new pref to specify the last chosen buddy icon. This would also have the | |
385 * advantage (?) of not being account-specific. | |
9482 | 386 if (dialog->icon_path != NULL) |
387 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog->icon_filesel), | |
388 dialog->icon_path); | |
9496 | 389 */ |
390 | |
9482 | 391 dialog->icon_preview = gtk_image_new(); |
392 dialog->icon_text = gtk_label_new(NULL); | |
393 gtk_widget_set_size_request(GTK_WIDGET(dialog->icon_preview), -1, 50); | |
394 gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(dialog->icon_filesel), | |
395 GTK_WIDGET(dialog->icon_preview)); | |
396 g_signal_connect(G_OBJECT(dialog->icon_filesel), "update-preview", | |
397 G_CALLBACK(icon_preview_change_cb), dialog); | |
398 g_signal_connect(G_OBJECT(dialog->icon_filesel), "response", | |
399 G_CALLBACK(icon_filesel_choose_cb), dialog); | |
400 icon_preview_change_cb(NULL, dialog); | |
401 #else /* FILECHOOSER */ | |
402 dialog->icon_filesel = gtk_file_selection_new(_("Buddy Icon")); | |
403 dialog->icon_preview = gtk_image_new(); | |
404 dialog->icon_text = gtk_label_new(NULL); | |
405 | |
406 gtk_widget_set_size_request(GTK_WIDGET(dialog->icon_preview), -1, 50); | |
5826 | 407 hbox = gtk_hbox_new(FALSE, 6); |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
408 gtk_box_pack_start( |
9482 | 409 GTK_BOX(GTK_FILE_SELECTION(dialog->icon_filesel)->main_vbox), |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
410 hbox, FALSE, FALSE, 0); |
9482 | 411 gtk_box_pack_end(GTK_BOX(hbox), dialog->icon_preview, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
412 FALSE, FALSE, 0); |
9482 | 413 gtk_box_pack_end(GTK_BOX(hbox), dialog->icon_text, FALSE, FALSE, 0); |
414 | |
415 tv = GTK_FILE_SELECTION(dialog->icon_filesel)->file_list; | |
5826 | 416 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
417 |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
418 g_signal_connect(G_OBJECT(sel), "changed", |
9482 | 419 G_CALLBACK(icon_preview_change_cb), dialog); |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
420 g_signal_connect( |
9482 | 421 G_OBJECT(GTK_FILE_SELECTION(dialog->icon_filesel)->ok_button), |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
422 "clicked", |
9482 | 423 G_CALLBACK(icon_filesel_choose_cb), dialog); |
424 g_signal_connect( | |
425 G_OBJECT(GTK_FILE_SELECTION(dialog->icon_filesel)->cancel_button), | |
426 "clicked", | |
427 G_CALLBACK(icon_filesel_delete_cb), dialog); | |
428 g_signal_connect(G_OBJECT(dialog->icon_filesel), "destroy", | |
429 G_CALLBACK(icon_filesel_delete_cb), dialog); | |
430 #endif /* FILECHOOSER */ | |
431 | |
432 gtk_widget_show_all(GTK_WIDGET(dialog->icon_filesel)); | |
5826 | 433 } |
434 | |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
435 static void |
9482 | 436 icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog) |
5826 | 437 { |
9482 | 438 if (dialog->icon_path) |
439 g_free(dialog->icon_path); | |
440 dialog->icon_path = NULL; | |
441 | |
442 gtk_widget_hide(dialog->icon_entry); | |
9308 | 443 } |
444 | |
9314 | 445 |
446 static void | |
447 account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, | |
448 GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog) | |
449 { | |
450 gchar *name = sd->data; | |
451 | |
452 if ((sd->length >= 0) && (sd->format == 8)) { | |
453 /* Well, it looks like the drag event was cool. | |
454 * Let's do something with it */ | |
455 if (!g_ascii_strncasecmp(name, "file://", 7)) { | |
456 GError *converr = NULL; | |
457 gchar *tmp, *rtmp; | |
458 /* It looks like we're dealing with a local file. Let's | |
459 * just untar it in the right place */ | |
460 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { | |
461 gaim_debug(GAIM_DEBUG_ERROR, "buddyicon", "%s\n", | |
462 (converr ? converr->message : | |
463 "g_filename_from_uri error")); | |
464 return; | |
465 } | |
466 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) | |
467 *rtmp = '\0'; | |
9482 | 468 if (dialog->icon_path) |
469 g_free(dialog->icon_path); | |
9702 | 470 dialog->icon_path = convert_buddy_icon(dialog->plugin, tmp); |
9555 | 471 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), dialog->icon_path); |
9482 | 472 gtk_widget_show(dialog->icon_entry); |
9314 | 473 g_free(tmp); |
474 } | |
475 gtk_drag_finish(dc, TRUE, FALSE, t); | |
476 } | |
477 gtk_drag_finish(dc, FALSE, FALSE, t); | |
478 } | |
479 | |
480 | |
9334 | 481 #if GTK_CHECK_VERSION(2,2,0) |
482 static gboolean | |
483 str_array_match(char **a, char **b) | |
9308 | 484 { |
485 int i, j; | |
9334 | 486 |
487 if (!a || !b) | |
488 return FALSE; | |
9309 | 489 for (i = 0; a[i] != NULL; i++) |
490 for (j = 0; b[j] != NULL; j++) | |
9308 | 491 if (!g_ascii_strcasecmp(a[i], b[j])) |
492 return TRUE; | |
493 return FALSE; | |
494 } | |
9309 | 495 #endif |
9308 | 496 |
9555 | 497 static char* |
9702 | 498 convert_buddy_icon(GaimPlugin *plugin, const char *path) |
9308 | 499 { |
9334 | 500 #if GTK_CHECK_VERSION(2,2,0) |
9308 | 501 int width, height; |
9334 | 502 char **pixbuf_formats = NULL; |
9309 | 503 GdkPixbufFormat *format; |
9334 | 504 GdkPixbuf *pixbuf; |
9702 | 505 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
9312 | 506 char **prpl_formats = g_strsplit (prpl_info->icon_spec.format,",",0); |
9334 | 507 #if !GTK_CHECK_VERSION(2,4,0) |
508 GdkPixbufLoader *loader; | |
509 FILE *file; | |
510 struct stat st; | |
511 void *data = NULL; | |
512 #endif | |
513 | |
514 #if GTK_CHECK_VERSION(2,4,0) | |
9309 | 515 format = gdk_pixbuf_get_file_info (path, &width, &height); |
9334 | 516 #else |
517 loader = gdk_pixbuf_loader_new(); | |
518 if (!stat(path, &st) && (file = fopen(path, "rb")) != NULL) { | |
519 data = g_malloc(st.st_size); | |
520 fread(data, 1, st.st_size, file); | |
521 fclose(file); | |
522 gdk_pixbuf_loader_write(loader, data, st.st_size, NULL); | |
523 g_free(data); | |
524 } | |
525 pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); | |
526 width = gdk_pixbuf_get_width(pixbuf); | |
527 height = gdk_pixbuf_get_height(pixbuf); | |
528 format = gdk_pixbuf_loader_get_format(loader); | |
529 gdk_pixbuf_loader_close(loader, NULL); | |
9337 | 530 g_object_unref(G_OBJECT(loader)); |
9334 | 531 #endif |
9309 | 532 pixbuf_formats = gdk_pixbuf_format_get_extensions(format); |
9308 | 533 |
9312 | 534 if (str_array_match(pixbuf_formats, prpl_formats) && /* This is an acceptable format AND */ |
9318 | 535 (!(prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_SEND) || /* The prpl doesn't scale before it sends OR */ |
536 (prpl_info->icon_spec.min_width <= width && | |
537 prpl_info->icon_spec.max_width >= width && | |
538 prpl_info->icon_spec.min_height <= height && | |
539 prpl_info->icon_spec.max_height >= height))) { /* The icon is the correct size */ | |
9309 | 540 #endif |
9555 | 541 return g_strdup(path); |
9334 | 542 #if GTK_CHECK_VERSION(2,2,0) |
9308 | 543 } else { |
544 int i; | |
545 GError *error = NULL; | |
546 GdkPixbuf *scale; | |
547 char *random = g_strdup_printf("%x", g_random_int()); | |
548 const char *dirname = gaim_buddy_icons_get_cache_dir(); | |
549 char *filename = g_build_filename(dirname, random, NULL); | |
9334 | 550 pixbuf = gdk_pixbuf_new_from_file(path, &error); |
9318 | 551 if (!error && prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_SEND) { |
552 int new_width = gdk_pixbuf_get_width(pixbuf); | |
553 int new_height = gdk_pixbuf_get_height(pixbuf); | |
554 | |
555 if(new_width > prpl_info->icon_spec.max_width) | |
556 new_width = prpl_info->icon_spec.max_width; | |
557 else if(new_width < prpl_info->icon_spec.min_width) | |
558 new_width = prpl_info->icon_spec.min_width; | |
559 if(new_height > prpl_info->icon_spec.max_height) | |
560 new_height = prpl_info->icon_spec.max_height; | |
561 else if(new_height < prpl_info->icon_spec.min_height) | |
562 new_height = prpl_info->icon_spec.min_height; | |
563 | |
564 scale = gdk_pixbuf_scale_simple (pixbuf, new_width, new_height, | |
565 GDK_INTERP_HYPER); | |
9334 | 566 g_object_unref(G_OBJECT(pixbuf)); |
9308 | 567 pixbuf = scale; |
568 } | |
569 if (error) { | |
570 g_free(filename); | |
571 g_free(random); | |
572 gaim_debug_error("buddyicon", "Could not open icon for conversion: %s\n", error->message); | |
9334 | 573 g_error_free(error); |
9555 | 574 return NULL; |
9308 | 575 } |
9705 | 576 |
577 if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) { | |
578 gaim_debug_info("buddyicon", "Creating icon cache directory.\n"); | |
579 | |
580 if (mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) { | |
581 gaim_debug_error("buddyicon", | |
582 "Unable to create directory %s: %s\n", | |
583 dirname, strerror(errno)); | |
584 return NULL; | |
585 } | |
586 } | |
587 | |
9308 | 588 for (i = 0; prpl_formats[i]; i++) { |
589 gaim_debug_info("buddyicon", "Converting buddy icon to %s as %s\n", prpl_formats[i], filename); | |
9591 | 590 /* The gdk-pixbuf documentation is wrong. gdk_pixbuf_save returns TRUE if it was successful, |
591 * FALSE if an error was set. */ | |
9710 | 592 if (gdk_pixbuf_save (pixbuf, filename, prpl_formats[i], &error, NULL) == TRUE) |
593 break; | |
9308 | 594 } |
595 if (!error) { | |
9555 | 596 g_free(random); |
597 g_object_unref(G_OBJECT(pixbuf)); | |
598 return filename; | |
9308 | 599 } else { |
600 gaim_debug_error("buddyicon", "Could not convert icon to usable format: %s\n", error->message); | |
9334 | 601 g_error_free(error); |
9308 | 602 } |
603 g_free(filename); | |
604 g_free(random); | |
9334 | 605 g_object_unref(G_OBJECT(pixbuf)); |
9308 | 606 } |
9555 | 607 return NULL; |
9309 | 608 #endif |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
609 } |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
610 |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
611 static void |
5774 | 612 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
613 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
614 GtkWidget *frame; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
615 GtkWidget *vbox; |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
616 GtkWidget *entry; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
617 GList *user_splits; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
618 GList *l, *l2; |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
619 char *username = NULL; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
620 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
621 if (dialog->login_frame != NULL) |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
622 gtk_widget_destroy(dialog->login_frame); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
623 |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
624 /* Build the login options frame. */ |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
625 frame = gaim_gtk_make_frame(parent, _("Login Options")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
626 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
627 /* cringe */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
628 dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
629 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
630 gtk_box_reorder_child(GTK_BOX(parent), dialog->login_frame, 0); |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
631 gtk_widget_show(dialog->login_frame); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
632 |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
633 /* Main vbox */ |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
634 vbox = gtk_vbox_new(FALSE, 6); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
635 gtk_container_add(GTK_CONTAINER(frame), vbox); |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
636 gtk_widget_show(vbox); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
637 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
638 /* Protocol */ |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
639 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new( |
7956 | 640 dialog->protocol_id, G_CALLBACK(set_account_protocol_cb), dialog); |
5644
213e999fa5cc
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
641 |
5774 | 642 add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
643 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
644 /* Screen Name */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
645 dialog->screenname_entry = gtk_entry_new(); |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
646 |
8152 | 647 add_pref_box(dialog, vbox, _("Screen Name:"), dialog->screenname_entry); |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
648 |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
649 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", |
5826 | 650 G_CALLBACK(screenname_changed_cb), dialog); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
651 |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
652 /* Do the user split thang */ |
5662
937d5554021e
[gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents:
5661
diff
changeset
|
653 if (dialog->plugin == NULL) /* Yeah right. */ |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
654 user_splits = NULL; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
655 else |
5662
937d5554021e
[gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents:
5661
diff
changeset
|
656 user_splits = dialog->prpl_info->user_splits; |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
657 |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
658 if (dialog->account != NULL) |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
659 username = g_strdup(gaim_account_get_username(dialog->account)); |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
660 |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
661 if (dialog->user_split_entries != NULL) { |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
662 g_list_free(dialog->user_split_entries); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
663 dialog->user_split_entries = NULL; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
664 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
665 |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
666 for (l = user_splits; l != NULL; l = l->next) { |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
667 GaimAccountUserSplit *split = l->data; |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
668 char *buf; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
669 |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
670 buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(split)); |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
671 |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
672 entry = gtk_entry_new(); |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
673 |
5774 | 674 add_pref_box(dialog, vbox, buf, entry); |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
675 |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
676 g_free(buf); |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
677 |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
678 dialog->user_split_entries = |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
679 g_list_append(dialog->user_split_entries, entry); |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
680 } |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
681 |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
682 for (l = g_list_last(dialog->user_split_entries), |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
683 l2 = g_list_last(user_splits); |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
684 l != NULL && l2 != NULL; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
685 l = l->prev, l2 = l2->prev) { |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
686 |
5708
1d5c5acfc846
[gaim-migrate @ 6129]
Christian Hammond <chipx86@chipx86.com>
parents:
5705
diff
changeset
|
687 GtkWidget *entry = l->data; |
1d5c5acfc846
[gaim-migrate @ 6129]
Christian Hammond <chipx86@chipx86.com>
parents:
5705
diff
changeset
|
688 GaimAccountUserSplit *split = l2->data; |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
689 const char *value = NULL; |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
690 char *c; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
691 |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
692 if (dialog->account != NULL) { |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
693 c = strrchr(username, |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
694 gaim_account_user_split_get_separator(split)); |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
695 |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
696 if (c != NULL) { |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
697 *c = '\0'; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
698 c++; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
699 |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
700 value = c; |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
701 } |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
702 } |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
703 |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
704 if (value == NULL) |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
705 value = gaim_account_user_split_get_default_value(split); |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
706 |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
707 if (value != NULL) |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
708 gtk_entry_set_text(GTK_ENTRY(entry), value); |
5653
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
709 } |
2216abc2d421
[gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents:
5651
diff
changeset
|
710 |
5656
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
711 if (username != NULL) |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
712 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username); |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
713 |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
714 g_free(username); |
160dfd3b0679
[gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents:
5653
diff
changeset
|
715 |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
716 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
717 /* Password */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
718 dialog->password_entry = gtk_entry_new(); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
719 gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE); |
5774 | 720 dialog->password_box = add_pref_box(dialog, vbox, _("Password:"), |
5689
7a619706e048
[gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents:
5688
diff
changeset
|
721 dialog->password_entry); |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
722 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
723 /* Alias */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
724 dialog->alias_entry = gtk_entry_new(); |
5774 | 725 add_pref_box(dialog, vbox, _("Alias:"), dialog->alias_entry); |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
726 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
727 /* Remember Password */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
728 dialog->remember_pass_check = |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
729 gtk_check_button_new_with_label(_("Remember password")); |
5783
d4171d0bc80a
[gaim-migrate @ 6208]
Christian Hammond <chipx86@chipx86.com>
parents:
5782
diff
changeset
|
730 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check), |
7810 | 731 FALSE); |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
732 gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check, |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
733 FALSE, FALSE, 0); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
734 gtk_widget_show(dialog->remember_pass_check); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
735 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
736 /* Auto-Login */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
737 dialog->auto_login_check = |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
738 gtk_check_button_new_with_label(_("Auto-login")); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
739 gtk_box_pack_start(GTK_BOX(vbox), dialog->auto_login_check, |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
740 FALSE, FALSE, 0); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
741 gtk_widget_show(dialog->auto_login_check); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
742 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
743 /* Set the fields. */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
744 if (dialog->account != NULL) { |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
745 if (gaim_account_get_password(dialog->account)) |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
746 gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
747 gaim_account_get_password(dialog->account)); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
748 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
749 if (gaim_account_get_alias(dialog->account)) |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
750 gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry), |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
751 gaim_account_get_alias(dialog->account)); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
752 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
753 gtk_toggle_button_set_active( |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
754 GTK_TOGGLE_BUTTON(dialog->remember_pass_check), |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
755 gaim_account_get_remember_password(dialog->account)); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
756 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
757 gtk_toggle_button_set_active( |
5804 | 758 GTK_TOGGLE_BUTTON(dialog->auto_login_check), |
759 gaim_account_get_auto_login(dialog->account, GAIM_GTK_UI)); | |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
760 } |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
761 |
5662
937d5554021e
[gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents:
5661
diff
changeset
|
762 if (dialog->prpl_info != NULL && |
937d5554021e
[gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents:
5661
diff
changeset
|
763 (dialog->prpl_info->options & OPT_PROTO_NO_PASSWORD)) { |
937d5554021e
[gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents:
5661
diff
changeset
|
764 |
5689
7a619706e048
[gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents:
5688
diff
changeset
|
765 gtk_widget_hide(dialog->password_box); |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
766 gtk_widget_hide(dialog->remember_pass_check); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
767 } |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
768 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
769 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
770 static void |
5774 | 771 add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent) |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
772 { |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
773 GtkWidget *frame; |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
774 GtkWidget *vbox; |
9333
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
775 GtkWidget *vbox2; |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
776 GtkWidget *hbox; |
9333
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
777 GtkWidget *hbox2; |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
778 GtkWidget *button; |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
779 GtkWidget *label; |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
780 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
781 if (dialog->user_frame != NULL) |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
782 gtk_widget_destroy(dialog->user_frame); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
783 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
784 /* Build the user options frame. */ |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
785 frame = gaim_gtk_make_frame(parent, _("User Options")); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
786 dialog->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
787 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
788 gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
789 gtk_widget_show(dialog->user_frame); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
790 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
791 /* Main vbox */ |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
792 vbox = gtk_vbox_new(FALSE, 6); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
793 gtk_container_add(GTK_CONTAINER(frame), vbox); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
794 gtk_widget_show(vbox); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
795 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
796 /* New mail notifications */ |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
797 dialog->new_mail_check = |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
798 gtk_check_button_new_with_label(_("New mail notifications")); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
799 gtk_box_pack_start(GTK_BOX(vbox), dialog->new_mail_check, FALSE, FALSE, 0); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
800 gtk_widget_show(dialog->new_mail_check); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
801 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
802 /* Buddy icon */ |
9482 | 803 dialog->icon_hbox = hbox = gtk_hbox_new(FALSE, 6); |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
804 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
805 gtk_widget_show(hbox); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
806 |
9312 | 807 label = gtk_label_new(_("Buddy icon:")); |
9333
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
808 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
809 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
810 gtk_widget_show(label); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
811 |
9482 | 812 dialog->icon_entry = gtk_image_new(); |
813 gtk_box_pack_start(GTK_BOX(hbox), dialog->icon_entry, | |
9333
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
814 FALSE, FALSE, 0); |
9482 | 815 gtk_widget_show(dialog->icon_entry); |
816 gaim_set_accessible_label (dialog->icon_entry, label); | |
817 dialog->icon_path = NULL; | |
9333
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
818 |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
819 vbox2 = gtk_vbox_new(FALSE, 0); |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
820 gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0); |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
821 gtk_widget_show(vbox2); |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
822 |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
823 hbox2 = gtk_hbox_new(FALSE, 6); |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
824 gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, FALSE, 0); |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
825 gtk_widget_show(hbox2); |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
826 |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
827 button = gtk_button_new_from_stock(GTK_STOCK_OPEN); |
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
828 gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 0); |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
829 g_signal_connect(G_OBJECT(button), "clicked", |
9482 | 830 G_CALLBACK(icon_select_cb), dialog); |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
831 gtk_widget_show(button); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
832 |
9333
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
833 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); |
5826 | 834 g_signal_connect(G_OBJECT(button), "clicked", |
9482 | 835 G_CALLBACK(icon_reset_cb), dialog); |
9333
120e0607e1cd
[gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
836 gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 0); |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
837 gtk_widget_show(button); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
838 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
839 if (dialog->prpl_info != NULL) { |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
840 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK)) |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
841 gtk_widget_hide(dialog->new_mail_check); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
842 |
9308 | 843 if (!(dialog->prpl_info->icon_spec.format != NULL)) |
9482 | 844 gtk_widget_hide(dialog->icon_hbox); |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
845 } |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
846 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
847 if (dialog->account != NULL) { |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
848 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->new_mail_check), |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
849 gaim_account_get_check_mail(dialog->account)); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
850 |
9308 | 851 if (gaim_account_get_buddy_icon(dialog->account) != NULL) { |
9482 | 852 dialog->icon_path = g_strdup(gaim_account_get_buddy_icon(dialog->account)); |
853 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry),dialog->icon_path); | |
9308 | 854 } |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
855 } |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
856 |
7207 | 857 if (!dialog->prpl_info || |
858 (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) && | |
9308 | 859 (dialog->prpl_info->icon_spec.format == NULL))) { |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
860 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
861 /* Nothing to see :( aww. */ |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
862 gtk_widget_hide(dialog->user_frame); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
863 } |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
864 } |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
865 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
866 static void |
5774 | 867 add_protocol_options(AccountPrefsDialog *dialog, GtkWidget *parent) |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
868 { |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
869 GaimAccountOption *option; |
5690
08d20eb262c7
[gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents:
5689
diff
changeset
|
870 GaimAccount *account; |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
871 GtkWidget *frame; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
872 GtkWidget *vbox; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
873 GtkWidget *check; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
874 GtkWidget *entry; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
875 GList *l; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
876 char buf[1024]; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
877 char *title; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
878 const char *str_value; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
879 gboolean bool_value; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
880 int int_value; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
881 |
5689
7a619706e048
[gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents:
5688
diff
changeset
|
882 if (dialog->protocol_frame != NULL) { |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
883 gtk_widget_destroy(dialog->protocol_frame); |
5689
7a619706e048
[gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents:
5688
diff
changeset
|
884 dialog->protocol_frame = NULL; |
7a619706e048
[gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents:
5688
diff
changeset
|
885 } |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
886 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
887 if (dialog->prpl_info == NULL || |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
888 dialog->prpl_info->protocol_options == NULL) { |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
889 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
890 return; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
891 } |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
892 |
5690
08d20eb262c7
[gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents:
5689
diff
changeset
|
893 account = dialog->account; |
08d20eb262c7
[gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents:
5689
diff
changeset
|
894 |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
895 /* Build the protocol options frame. */ |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
896 g_snprintf(buf, sizeof(buf), _("%s Options"), dialog->plugin->info->name); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
897 |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
898 frame = gaim_gtk_make_frame(parent, buf); |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
899 dialog->protocol_frame = |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
900 gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
901 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
902 gtk_box_reorder_child(GTK_BOX(parent), dialog->protocol_frame, 0); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
903 gtk_widget_show(dialog->protocol_frame); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
904 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
905 /* Main vbox */ |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
906 vbox = gtk_vbox_new(FALSE, 6); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
907 gtk_container_add(GTK_CONTAINER(frame), vbox); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
908 gtk_widget_show(vbox); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
909 |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
910 if (dialog->protocol_opt_entries != NULL) { |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
911 g_list_free(dialog->protocol_opt_entries); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
912 dialog->protocol_opt_entries = NULL; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
913 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
914 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
915 for (l = dialog->prpl_info->protocol_options; l != NULL; l = l->next) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
916 { |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
917 option = (GaimAccountOption *)l->data; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
918 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
919 switch (gaim_account_option_get_type(option)) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
920 { |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
921 case GAIM_PREF_BOOLEAN: |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
922 if (account == NULL || |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
923 strcmp(gaim_account_get_protocol_id(account), |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
924 dialog->protocol_id)) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
925 { |
5664
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
926 bool_value = gaim_account_option_get_default_bool(option); |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
927 } |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
928 else |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
929 { |
5690
08d20eb262c7
[gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents:
5689
diff
changeset
|
930 bool_value = gaim_account_get_bool(account, |
5664
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
931 gaim_account_option_get_setting(option), |
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
932 gaim_account_option_get_default_bool(option)); |
7956 | 933 } |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
934 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
935 check = gtk_check_button_new_with_label( |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
936 gaim_account_option_get_text(option)); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
937 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
938 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
939 bool_value); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
940 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
941 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
942 gtk_widget_show(check); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
943 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
944 dialog->protocol_opt_entries = |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
945 g_list_append(dialog->protocol_opt_entries, check); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
946 |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
947 break; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
948 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
949 case GAIM_PREF_INT: |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
950 if (account == NULL || |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
951 strcmp(gaim_account_get_protocol_id(account), |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
952 dialog->protocol_id)) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
953 { |
5664
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
954 int_value = gaim_account_option_get_default_int(option); |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
955 } |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
956 else |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
957 { |
5690
08d20eb262c7
[gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents:
5689
diff
changeset
|
958 int_value = gaim_account_get_int(account, |
5664
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
959 gaim_account_option_get_setting(option), |
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
960 gaim_account_option_get_default_int(option)); |
7956 | 961 } |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
962 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
963 g_snprintf(buf, sizeof(buf), "%d", int_value); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
964 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
965 entry = gtk_entry_new(); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
966 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
967 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
968 title = g_strdup_printf("%s:", |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
969 gaim_account_option_get_text(option)); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
970 |
5774 | 971 add_pref_box(dialog, vbox, title, entry); |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
972 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
973 g_free(title); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
974 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
975 dialog->protocol_opt_entries = |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
976 g_list_append(dialog->protocol_opt_entries, entry); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
977 |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
978 break; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
979 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
980 case GAIM_PREF_STRING: |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
981 if (account == NULL || |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
982 strcmp(gaim_account_get_protocol_id(account), |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
983 dialog->protocol_id)) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
984 { |
5664
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
985 str_value = gaim_account_option_get_default_string(option); |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
986 } |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
987 else |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
988 { |
5690
08d20eb262c7
[gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents:
5689
diff
changeset
|
989 str_value = gaim_account_get_string(account, |
5664
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
990 gaim_account_option_get_setting(option), |
7867ae4836ac
[gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
991 gaim_account_option_get_default_string(option)); |
7956 | 992 } |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
993 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
994 entry = gtk_entry_new(); |
5663
e9551e7d6f01
[gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents:
5662
diff
changeset
|
995 |
e9551e7d6f01
[gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents:
5662
diff
changeset
|
996 if (str_value != NULL) |
e9551e7d6f01
[gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents:
5662
diff
changeset
|
997 gtk_entry_set_text(GTK_ENTRY(entry), str_value); |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
998 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
999 title = g_strdup_printf("%s:", |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1000 gaim_account_option_get_text(option)); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1001 |
5774 | 1002 add_pref_box(dialog, vbox, title, entry); |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1003 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1004 g_free(title); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1005 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1006 dialog->protocol_opt_entries = |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1007 g_list_append(dialog->protocol_opt_entries, entry); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1008 |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1009 break; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1010 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1011 default: |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1012 break; |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1013 } |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1014 } |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1015 } |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1016 |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1017 static GtkWidget * |
5774 | 1018 make_proxy_dropdown(void) |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1019 { |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1020 GtkWidget *dropdown; |
8555 | 1021 |
1022 #if GTK_CHECK_VERSION(2,4,0) | |
1023 GtkListStore *model; | |
1024 GtkTreeIter iter; | |
1025 GtkCellRenderer *renderer; | |
1026 | |
1027 model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); | |
1028 dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); | |
1029 | |
1030 gtk_list_store_append(model, &iter); | |
1031 gtk_list_store_set(model, &iter, | |
1032 0, _("Use Global Proxy Settings"), | |
8581
2714e30991db
[gaim-migrate @ 9331]
Christian Hammond <chipx86@chipx86.com>
parents:
8555
diff
changeset
|
1033 1, GAIM_PROXY_USE_GLOBAL, |
8555 | 1034 -1); |
1035 | |
1036 gtk_list_store_append(model, &iter); | |
1037 gtk_list_store_set(model, &iter, | |
1038 0, _("No Proxy"), | |
1039 1, GAIM_PROXY_NONE, | |
1040 -1); | |
1041 | |
1042 gtk_list_store_append(model, &iter); | |
1043 gtk_list_store_set(model, &iter, | |
1044 0, _("HTTP"), | |
1045 1, GAIM_PROXY_HTTP, | |
1046 -1); | |
1047 | |
1048 gtk_list_store_append(model, &iter); | |
1049 gtk_list_store_set(model, &iter, | |
1050 0, _("SOCKS 4"), | |
1051 1, GAIM_PROXY_SOCKS4, | |
1052 -1); | |
1053 | |
1054 gtk_list_store_append(model, &iter); | |
1055 gtk_list_store_set(model, &iter, | |
1056 0, _("SOCKS 5"), | |
1057 1, GAIM_PROXY_SOCKS5, | |
1058 -1); | |
1059 | |
1060 gtk_list_store_append(model, &iter); | |
1061 gtk_list_store_set(model, &iter, | |
1062 0, _("Use Environmental Settings"), | |
1063 1, GAIM_PROXY_USE_ENVVAR, | |
1064 -1); | |
1065 | |
1066 renderer = gtk_cell_renderer_text_new(); | |
1067 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE); | |
1068 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, | |
1069 "text", 0, NULL); | |
1070 | |
1071 #else | |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1072 GtkWidget *menu; |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1073 GtkWidget *item; |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1074 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1075 dropdown = gtk_option_menu_new(); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1076 menu = gtk_menu_new(); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1077 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1078 /* Use Global Proxy Settings */ |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1079 item = gtk_menu_item_new_with_label(_("Use Global Proxy Settings")); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1080 g_object_set_data(G_OBJECT(item), "proxytype", |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1081 GINT_TO_POINTER(GAIM_PROXY_USE_GLOBAL)); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1082 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1083 gtk_widget_show(item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1084 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1085 /* No Proxy */ |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1086 item = gtk_menu_item_new_with_label(_("No Proxy")); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1087 g_object_set_data(G_OBJECT(item), "proxytype", |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1088 GINT_TO_POINTER(GAIM_PROXY_NONE)); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1089 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1090 gtk_widget_show(item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1091 |
6122 | 1092 /* HTTP */ |
1093 item = gtk_menu_item_new_with_label(_("HTTP")); | |
1094 g_object_set_data(G_OBJECT(item), "proxytype", | |
1095 GINT_TO_POINTER(GAIM_PROXY_HTTP)); | |
1096 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
1097 gtk_widget_show(item); | |
1098 | |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1099 /* SOCKS 4 */ |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1100 item = gtk_menu_item_new_with_label(_("SOCKS 4")); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1101 g_object_set_data(G_OBJECT(item), "proxytype", |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1102 GINT_TO_POINTER(GAIM_PROXY_SOCKS4)); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1103 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1104 gtk_widget_show(item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1105 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1106 /* SOCKS 5 */ |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1107 item = gtk_menu_item_new_with_label(_("SOCKS 5")); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1108 g_object_set_data(G_OBJECT(item), "proxytype", |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1109 GINT_TO_POINTER(GAIM_PROXY_SOCKS5)); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1110 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1111 gtk_widget_show(item); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1112 |
6621 | 1113 /* Use Environmental Settings */ |
1114 item = gtk_menu_item_new_with_label(_("Use Environmental Settings")); | |
1115 g_object_set_data(G_OBJECT(item), "proxytype", | |
1116 GINT_TO_POINTER(GAIM_PROXY_USE_ENVVAR)); | |
1117 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
1118 gtk_widget_show(item); | |
1119 | |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1120 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); |
8555 | 1121 #endif |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1122 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1123 return dropdown; |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1124 } |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1125 |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1126 static void |
8555 | 1127 proxy_type_changed_cb(GtkWidget *menu, AccountPrefsDialog *dialog) |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1128 { |
8555 | 1129 #if GTK_CHECK_VERSION(2,4,0) |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1130 dialog->new_proxy_type = |
8555 | 1131 gtk_combo_box_get_active(GTK_COMBO_BOX(menu)) - 1; |
1132 #else | |
1133 dialog->new_proxy_type = | |
1134 gtk_option_menu_get_history(GTK_OPTION_MENU(menu)) - 1; | |
1135 #endif | |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1136 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1137 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL || |
6621 | 1138 dialog->new_proxy_type == GAIM_PROXY_NONE || |
1139 dialog->new_proxy_type == GAIM_PROXY_USE_ENVVAR) { | |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1140 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1141 gtk_widget_hide_all(dialog->proxy_vbox); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1142 } |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1143 else |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1144 gtk_widget_show_all(dialog->proxy_vbox); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1145 } |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1146 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1147 static void |
5774 | 1148 port_popup_cb(GtkWidget *w, GtkMenu *menu, gpointer data) |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1149 { |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1150 GtkWidget *item; |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1151 |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1152 item = gtk_menu_item_new_with_label( |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1153 _("you can see the butterflies mating")); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1154 gtk_widget_show(item); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1155 gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1156 |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1157 item = gtk_menu_item_new_with_label(_("If you look real closely")); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1158 gtk_widget_show(item); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1159 gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1160 } |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1161 |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1162 static void |
5774 | 1163 add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent) |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
1164 { |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1165 GaimProxyInfo *proxy_info; |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1166 GtkWidget *frame; |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1167 GtkWidget *vbox; |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1168 GtkWidget *vbox2; |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1169 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
1170 if (dialog->proxy_frame != NULL) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
1171 gtk_widget_destroy(dialog->proxy_frame); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
1172 |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1173 frame = gaim_gtk_make_frame(parent, _("Proxy Options")); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1174 dialog->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1175 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1176 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1177 gtk_widget_show(dialog->proxy_frame); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1178 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1179 /* Main vbox */ |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1180 vbox = gtk_vbox_new(FALSE, 6); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1181 gtk_container_add(GTK_CONTAINER(frame), vbox); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1182 gtk_widget_show(vbox); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1183 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1184 /* Proxy Type drop-down. */ |
5774 | 1185 dialog->proxy_dropdown = make_proxy_dropdown(); |
8555 | 1186 #if !GTK_CHECK_VERSION(2,4,0) |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1187 dialog->proxy_menu = |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1188 gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->proxy_dropdown)); |
8555 | 1189 #endif |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1190 |
5774 | 1191 add_pref_box(dialog, vbox, _("Proxy _type:"), dialog->proxy_dropdown); |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1192 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1193 /* Setup the second vbox, which may be hidden at times. */ |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1194 dialog->proxy_vbox = vbox2 = gtk_vbox_new(FALSE, 6); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1195 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1196 gtk_widget_show(vbox2); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1197 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1198 /* Host */ |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1199 dialog->proxy_host_entry = gtk_entry_new(); |
5774 | 1200 add_pref_box(dialog, vbox2, _("_Host:"), dialog->proxy_host_entry); |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1201 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1202 /* Port */ |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1203 dialog->proxy_port_entry = gtk_entry_new(); |
5774 | 1204 add_pref_box(dialog, vbox2, _("_Port:"), dialog->proxy_port_entry); |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1205 |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1206 g_signal_connect(G_OBJECT(dialog->proxy_port_entry), "populate-popup", |
5774 | 1207 G_CALLBACK(port_popup_cb), NULL); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1208 |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1209 /* User */ |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1210 dialog->proxy_user_entry = gtk_entry_new(); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1211 |
5774 | 1212 add_pref_box(dialog, vbox2, _("_Username:"), dialog->proxy_user_entry); |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1213 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1214 /* Password */ |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1215 dialog->proxy_pass_entry = gtk_entry_new(); |
5700
ad55a15c7b93
[gaim-migrate @ 6121]
Christian Hammond <chipx86@chipx86.com>
parents:
5699
diff
changeset
|
1216 gtk_entry_set_visibility(GTK_ENTRY(dialog->proxy_pass_entry), FALSE); |
5774 | 1217 add_pref_box(dialog, vbox2, _("Pa_ssword:"), dialog->proxy_pass_entry); |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1218 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1219 if (dialog->account != NULL && |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1220 (proxy_info = gaim_account_get_proxy_info(dialog->account)) != NULL) { |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1221 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1222 GaimProxyType type = gaim_proxy_info_get_type(proxy_info); |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1223 |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1224 /* Hah! */ |
6621 | 1225 /* I dunno what you're laughing about, fuzz ball. */ |
1226 dialog->new_proxy_type = type; | |
8555 | 1227 #if GTK_CHECK_VERSION(2,4,0) |
1228 gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->proxy_dropdown), | |
9662 | 1229 type + 1); |
8555 | 1230 #else |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1231 gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->proxy_dropdown), |
8555 | 1232 (int)type + 1); |
1233 #endif | |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1234 |
6621 | 1235 if (type == GAIM_PROXY_USE_GLOBAL || type == GAIM_PROXY_NONE || |
1236 type == GAIM_PROXY_USE_ENVVAR) { | |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1237 gtk_widget_hide_all(vbox2); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1238 } |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1239 else { |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1240 const char *value; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1241 int int_val; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1242 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1243 if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL) |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1244 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), value); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1245 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1246 if ((int_val = gaim_proxy_info_get_port(proxy_info)) != 0) { |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1247 char buf[32]; |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1248 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1249 g_snprintf(buf, sizeof(buf), "%d", int_val); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1250 |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
1251 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_port_entry), buf); |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1252 } |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1253 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1254 if ((value = gaim_proxy_info_get_username(proxy_info)) != NULL) |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1255 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_user_entry), value); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1256 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1257 if ((value = gaim_proxy_info_get_password(proxy_info)) != NULL) |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1258 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_pass_entry), value); |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1259 } |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1260 } |
6856 | 1261 else { |
1262 dialog->new_proxy_type = GAIM_PROXY_USE_GLOBAL; | |
8555 | 1263 #if GTK_CHECK_VERSION(2,4,0) |
1264 gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->proxy_dropdown), | |
1265 dialog->new_proxy_type + 1); | |
1266 #else | |
6856 | 1267 gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->proxy_dropdown), |
1268 dialog->new_proxy_type + 1); | |
8555 | 1269 #endif |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1270 gtk_widget_hide_all(vbox2); |
6856 | 1271 } |
5687
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1272 |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1273 /* Connect signals. */ |
ae626f0b68ef
[gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents:
5686
diff
changeset
|
1274 g_signal_connect(G_OBJECT(dialog->proxy_dropdown), "changed", |
5774 | 1275 G_CALLBACK(proxy_type_changed_cb), dialog); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
1276 } |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
1277 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5664
diff
changeset
|
1278 static void |
5774 | 1279 account_win_destroy_cb(GtkWidget *w, GdkEvent *event, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1280 AccountPrefsDialog *dialog) |
5692
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1281 { |
8454 | 1282 if (accounts_window != NULL) |
1283 g_hash_table_remove(accounts_window->account_pref_wins, dialog->account); | |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1284 |
7450 | 1285 gtk_widget_destroy(dialog->window); |
1286 | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1287 if (dialog->user_split_entries != NULL) |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1288 g_list_free(dialog->user_split_entries); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1289 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1290 if (dialog->protocol_opt_entries != NULL) |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1291 g_list_free(dialog->protocol_opt_entries); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1292 |
5978
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1293 if (dialog->protocol_id != NULL) |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1294 g_free(dialog->protocol_id); |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1295 |
9482 | 1296 if (dialog->icon_filesel) |
1297 gtk_widget_destroy(dialog->icon_filesel); | |
5826 | 1298 |
5692
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1299 g_free(dialog); |
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1300 } |
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1301 |
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1302 static void |
5774 | 1303 cancel_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) |
5692
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1304 { |
5774 | 1305 account_win_destroy_cb(NULL, NULL, dialog); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1306 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1307 |
7269 | 1308 static GaimAccount* |
5774 | 1309 ok_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1310 { |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1311 GaimProxyInfo *proxy_info = NULL; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1312 GList *l, *l2; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1313 const char *value; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1314 char *username; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1315 char *tmp; |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
1316 size_t index; |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
1317 GtkTreeIter iter; |
7269 | 1318 GaimAccount *ret; |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1319 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1320 if (dialog->account == NULL) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1321 { |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1322 const char *screenname; |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1323 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1324 screenname = gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry)); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1325 |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5900
diff
changeset
|
1326 dialog->account = gaim_account_new(screenname, dialog->protocol_id); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1327 } |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1328 else |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1329 { |
5699
3bac8b558577
[gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents:
5698
diff
changeset
|
1330 /* Protocol */ |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5900
diff
changeset
|
1331 gaim_account_set_protocol_id(dialog->account, dialog->protocol_id); |
5699
3bac8b558577
[gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents:
5698
diff
changeset
|
1332 } |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1333 |
5697
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1334 /* Alias */ |
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1335 value = gtk_entry_get_text(GTK_ENTRY(dialog->alias_entry)); |
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1336 |
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1337 if (*value != '\0') |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1338 gaim_account_set_alias(dialog->account, value); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1339 else |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1340 gaim_account_set_alias(dialog->account, NULL); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1341 |
5697
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1342 /* Buddy Icon */ |
9482 | 1343 value = dialog->icon_path; |
9555 | 1344 gaim_account_set_buddy_icon(dialog->account, value); |
9308 | 1345 |
5697
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1346 /* Remember Password */ |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1347 gaim_account_set_remember_password(dialog->account, |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1348 gtk_toggle_button_get_active( |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1349 GTK_TOGGLE_BUTTON(dialog->remember_pass_check))); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1350 |
5697
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1351 /* Check Mail */ |
7208 | 1352 if (dialog->prpl_info && dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1353 gaim_account_set_check_mail(dialog->account, |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1354 gtk_toggle_button_get_active( |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1355 GTK_TOGGLE_BUTTON(dialog->new_mail_check))); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1356 |
5804 | 1357 /* Auto Login */ |
1358 gaim_account_set_auto_login(dialog->account, GAIM_GTK_UI, | |
1359 gtk_toggle_button_get_active( | |
1360 GTK_TOGGLE_BUTTON(dialog->auto_login_check))); | |
1361 | |
5697
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1362 /* Password */ |
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1363 value = gtk_entry_get_text(GTK_ENTRY(dialog->password_entry)); |
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1364 |
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1365 if (gaim_account_get_remember_password(dialog->account) && *value != '\0') |
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1366 gaim_account_set_password(dialog->account, value); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1367 else |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1368 gaim_account_set_password(dialog->account, NULL); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1369 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1370 /* Build the username string. */ |
5711
e33778b9d395
[gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents:
5710
diff
changeset
|
1371 username = |
e33778b9d395
[gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents:
5710
diff
changeset
|
1372 g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry))); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1373 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1374 if (dialog->prpl_info != NULL) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1375 { |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1376 for (l = dialog->prpl_info->user_splits, |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1377 l2 = dialog->user_split_entries; |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1378 l != NULL && l2 != NULL; |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1379 l = l->next, l2 = l2->next) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1380 { |
7208 | 1381 GaimAccountUserSplit *split = l->data; |
1382 GtkEntry *entry = l2->data; | |
1383 char sep[2] = " "; | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1384 |
7208 | 1385 value = gtk_entry_get_text(entry); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1386 |
7208 | 1387 *sep = gaim_account_user_split_get_separator(split); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1388 |
7208 | 1389 tmp = g_strconcat(username, sep, |
1390 (*value ? value : | |
1391 gaim_account_user_split_get_default_value(split)), | |
1392 NULL); | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1393 |
7208 | 1394 g_free(username); |
1395 username = tmp; | |
1396 } | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1397 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1398 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1399 gaim_account_set_username(dialog->account, username); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1400 g_free(username); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1401 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1402 /* Add the protocol settings */ |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1403 |
7208 | 1404 if(dialog->prpl_info) { |
1405 for (l = dialog->prpl_info->protocol_options, | |
1406 l2 = dialog->protocol_opt_entries; | |
1407 l != NULL && l2 != NULL; | |
1408 l = l->next, l2 = l2->next) { | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1409 |
7208 | 1410 GaimPrefType type; |
1411 GaimAccountOption *option = l->data; | |
1412 GtkWidget *widget = l2->data; | |
1413 const char *setting; | |
1414 int int_value; | |
1415 gboolean bool_value; | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1416 |
7208 | 1417 type = gaim_account_option_get_type(option); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1418 |
7208 | 1419 setting = gaim_account_option_get_setting(option); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1420 |
7208 | 1421 switch (type) { |
1422 case GAIM_PREF_STRING: | |
1423 value = gtk_entry_get_text(GTK_ENTRY(widget)); | |
1424 gaim_account_set_string(dialog->account, setting, value); | |
1425 break; | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1426 |
7208 | 1427 case GAIM_PREF_INT: |
1428 int_value = atoi(gtk_entry_get_text(GTK_ENTRY(widget))); | |
1429 gaim_account_set_int(dialog->account, setting, int_value); | |
1430 break; | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1431 |
7208 | 1432 case GAIM_PREF_BOOLEAN: |
1433 bool_value = | |
1434 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
1435 gaim_account_set_bool(dialog->account, setting, bool_value); | |
1436 break; | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1437 |
7208 | 1438 default: |
1439 break; | |
1440 } | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1441 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1442 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1443 |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1444 /* Set the proxy stuff. */ |
6621 | 1445 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL) { |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1446 gaim_account_set_proxy_info(dialog->account, NULL); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1447 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1448 else { |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1449 proxy_info = gaim_account_get_proxy_info(dialog->account); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1450 |
6344
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1451 /* Create the proxy info if it doesn't exist. */ |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1452 if (proxy_info == NULL) { |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1453 proxy_info = gaim_proxy_info_new(); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1454 gaim_account_set_proxy_info(dialog->account, proxy_info); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1455 } |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1456 |
6344
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1457 /* Set the proxy info type. */ |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1458 gaim_proxy_info_set_type(proxy_info, dialog->new_proxy_type); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1459 |
6344
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1460 /* Host */ |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1461 value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_host_entry)); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1462 |
6344
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1463 if (*value != '\0') |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1464 gaim_proxy_info_set_host(proxy_info, value); |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1465 else |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1466 gaim_proxy_info_set_host(proxy_info, NULL); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1467 |
6344
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1468 /* Port */ |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1469 value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_port_entry)); |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1470 |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1471 if (*value != '\0') |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1472 gaim_proxy_info_set_port(proxy_info, atoi(value)); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1473 else |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1474 gaim_proxy_info_set_port(proxy_info, 0); |
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1475 |
6344
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1476 /* Username */ |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1477 value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_user_entry)); |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1478 |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1479 if (*value != '\0') |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1480 gaim_proxy_info_set_username(proxy_info, value); |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1481 else |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1482 gaim_proxy_info_set_username(proxy_info, NULL); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1483 |
6344
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1484 /* Password */ |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1485 value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_pass_entry)); |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1486 |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1487 if (*value != '\0') |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1488 gaim_proxy_info_set_password(proxy_info, value); |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1489 else |
f63da9023c99
[gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents:
6334
diff
changeset
|
1490 gaim_proxy_info_set_password(proxy_info, NULL); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1491 } |
5697
fc659d75fcf7
[gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents:
5696
diff
changeset
|
1492 |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
1493 /* Adds the account to the list, or modify the existing entry. */ |
7159 | 1494 if (accounts_window != NULL) { |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1495 index = g_list_index(gaim_accounts_get_all(), dialog->account); |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1496 |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1497 if (index != -1 && |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1498 (gtk_tree_model_iter_nth_child( |
7159 | 1499 GTK_TREE_MODEL(accounts_window->model), &iter, |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1500 NULL, index))) { |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
1501 |
7159 | 1502 set_account(accounts_window->model, &iter, |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1503 dialog->account); |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1504 } |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1505 else { |
7159 | 1506 add_account(accounts_window, dialog->account); |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1507 gaim_accounts_add(dialog->account); |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1508 } |
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5709
diff
changeset
|
1509 } |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
1510 |
7269 | 1511 ret = dialog->account; |
1512 | |
5774 | 1513 account_win_destroy_cb(NULL, NULL, dialog); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1514 |
9609 | 1515 gaim_signal_emit(gaim_gtk_account_get_handle(), "account-modified", ret); |
1516 | |
7269 | 1517 return ret; |
5692
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1518 } |
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1519 |
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1520 static void |
5851
023fd44672d8
[gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents:
5850
diff
changeset
|
1521 register_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) |
023fd44672d8
[gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents:
5850
diff
changeset
|
1522 { |
7269 | 1523 GaimAccount *account = ok_account_prefs_cb(NULL, dialog); |
5851
023fd44672d8
[gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents:
5850
diff
changeset
|
1524 |
7269 | 1525 gaim_account_register(account); |
5851
023fd44672d8
[gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents:
5850
diff
changeset
|
1526 } |
023fd44672d8
[gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents:
5850
diff
changeset
|
1527 |
9314 | 1528 |
1529 static const GtkTargetEntry dnd_targets[] = { | |
1530 {"text/plain", 0, 0}, | |
1531 {"text/uri-list", 0, 1}, | |
1532 {"STRING", 0, 2} | |
1533 }; | |
1534 | |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1535 void |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1536 gaim_gtk_account_dialog_show(GaimGtkAccountDialogType type, |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1537 GaimAccount *account) |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1538 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1539 AccountPrefsDialog *dialog; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1540 GtkWidget *win; |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1541 GtkWidget *main_vbox; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1542 GtkWidget *vbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1543 GtkWidget *bbox; |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1544 GtkWidget *dbox; |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1545 GtkWidget *disclosure; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1546 GtkWidget *sep; |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1547 GtkWidget *button; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1548 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1549 if (accounts_window != NULL && account != NULL && |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1550 (dialog = g_hash_table_lookup(accounts_window->account_pref_wins, |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1551 account)) != NULL) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1552 { |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1553 gtk_window_present(GTK_WINDOW(dialog->window)); |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1554 return; |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1555 } |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1556 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1557 dialog = g_new0(AccountPrefsDialog, 1); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1558 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1559 if (accounts_window != NULL && account != NULL) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1560 { |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1561 g_hash_table_insert(accounts_window->account_pref_wins, |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1562 account, dialog); |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1563 } |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1564 |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1565 dialog->account = account; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1566 dialog->type = type; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1567 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1568 |
9971 | 1569 if (dialog->account == NULL) { |
1570 /* Select the first prpl in the list*/ | |
1571 GList *prpl_list = gaim_plugins_get_protocols(); | |
1572 if (prpl_list != NULL) | |
10014 | 1573 dialog->protocol_id = g_strdup(((GaimPlugin *) prpl_list->data)->info->id); |
9971 | 1574 } |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1575 else |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1576 { |
5978
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1577 dialog->protocol_id = |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1578 g_strdup(gaim_account_get_protocol_id(dialog->account)); |
041b657227c4
[gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1579 } |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1580 |
7956 | 1581 if ((dialog->plugin = gaim_find_prpl(dialog->protocol_id)) != NULL) |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1582 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1583 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1584 |
5661
b596002ff81e
[gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
1585 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1586 gtk_window_set_role(GTK_WINDOW(win), "account"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1587 |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1588 if (type == GAIM_GTK_ADD_ACCOUNT_DIALOG) |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1589 gtk_window_set_title(GTK_WINDOW(win), _("Add Account")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1590 else |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1591 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1592 |
5661
b596002ff81e
[gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
1593 gtk_window_set_resizable(GTK_WINDOW(win), FALSE); |
b596002ff81e
[gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
1594 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1595 gtk_container_set_border_width(GTK_CONTAINER(win), 12); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1596 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1597 g_signal_connect(G_OBJECT(win), "delete_event", |
5774 | 1598 G_CALLBACK(account_win_destroy_cb), dialog); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1599 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1600 /* Setup the vbox */ |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1601 main_vbox = gtk_vbox_new(FALSE, 12); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1602 gtk_container_add(GTK_CONTAINER(win), main_vbox); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1603 gtk_widget_show(main_vbox); |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1604 |
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1605 /* Setup the inner vbox */ |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
1606 dialog->top_vbox = vbox = gtk_vbox_new(FALSE, 18); |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1607 gtk_box_pack_start(GTK_BOX(main_vbox), vbox, FALSE, FALSE, 0); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1608 gtk_widget_show(vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1609 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1610 /* Setup the top frames. */ |
5774 | 1611 add_login_options(dialog, vbox); |
1612 add_user_options(dialog, vbox); | |
5658
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1613 |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1614 /* Add the disclosure */ |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1615 disclosure = gaim_disclosure_new(_("Show more options"), |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1616 _("Show fewer options")); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1617 gtk_box_pack_start(GTK_BOX(vbox), disclosure, FALSE, FALSE, 0); |
060fb5fd081d
[gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents:
5657
diff
changeset
|
1618 gtk_widget_show(disclosure); |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
1619 |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1620 /* Setup the box that the disclosure will cover. */ |
5688
e43e1b8dca8b
[gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents:
5687
diff
changeset
|
1621 dialog->bottom_vbox = dbox = gtk_vbox_new(FALSE, 18); |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1622 gtk_box_pack_start(GTK_BOX(vbox), dbox, FALSE, FALSE, 0); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1623 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1624 gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), dbox); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1625 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1626 /** Setup the bottom frames. */ |
5774 | 1627 add_protocol_options(dialog, dbox); |
1628 add_proxy_options(dialog, dbox); | |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5658
diff
changeset
|
1629 |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1630 /* Separator... */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1631 sep = gtk_hseparator_new(); |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1632 gtk_box_pack_start(GTK_BOX(main_vbox), sep, FALSE, FALSE, 0); |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1633 gtk_widget_show(sep); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1634 |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1635 /* Setup the button box */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1636 bbox = gtk_hbutton_box_new(); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1637 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1638 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
5686
861565bed110
[gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1639 gtk_box_pack_end(GTK_BOX(main_vbox), bbox, FALSE, TRUE, 0); |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1640 gtk_widget_show(bbox); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1641 |
6141 | 1642 /* Register button */ |
1643 button = gtk_button_new_with_label(_("Register")); | |
1644 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
1645 gtk_widget_show(button); | |
5850
540bd1680b93
[gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
1646 |
6141 | 1647 g_signal_connect(G_OBJECT(button), "clicked", |
1648 G_CALLBACK(register_account_prefs_cb), dialog); | |
1649 | |
1650 dialog->register_button = button; | |
1651 | |
6732 | 1652 if (dialog->account == NULL) |
1653 gtk_widget_set_sensitive(button, FALSE); | |
1654 | |
7208 | 1655 if (!dialog->prpl_info || !dialog->prpl_info->register_user) |
6141 | 1656 gtk_widget_hide(button); |
5850
540bd1680b93
[gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
1657 |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1658 /* Cancel button */ |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1659 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1660 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1661 gtk_widget_show(button); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1662 |
5692
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1663 g_signal_connect(G_OBJECT(button), "clicked", |
5774 | 1664 G_CALLBACK(cancel_account_prefs_cb), dialog); |
5692
b1eb9fc30ff8
[gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents:
5690
diff
changeset
|
1665 |
5850
540bd1680b93
[gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
1666 /* Save button */ |
540bd1680b93
[gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
1667 button = gtk_button_new_from_stock(GTK_STOCK_SAVE); |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1668 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1669 |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1670 if (dialog->account == NULL) |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1671 gtk_widget_set_sensitive(button, FALSE); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1672 |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1673 gtk_widget_show(button); |
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1674 |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1675 dialog->ok_button = button; |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
1676 |
9314 | 1677 /* Set up DND */ |
1678 gtk_drag_dest_set(dialog->window, | |
1679 GTK_DEST_DEFAULT_MOTION | | |
1680 GTK_DEST_DEFAULT_DROP, | |
1681 dnd_targets, | |
1682 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
1683 GDK_ACTION_COPY); | |
1684 | |
1685 g_signal_connect(G_OBJECT(dialog->window), "drag_data_received", | |
1686 G_CALLBACK(account_dnd_recv), dialog); | |
1687 | |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1688 g_signal_connect(G_OBJECT(button), "clicked", |
5774 | 1689 G_CALLBACK(ok_account_prefs_cb), dialog); |
5696
0a20c8e1d2ca
[gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents:
5693
diff
changeset
|
1690 |
5657
bbe66a970662
[gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents:
5656
diff
changeset
|
1691 /* Show the window. */ |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
1692 gtk_widget_show(win); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1693 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1694 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1695 /************************************************************************** |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1696 * Accounts Dialog |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1697 **************************************************************************/ |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1698 static void |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1699 account_pulse_update(GaimGtkPulseData *pulse_data) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1700 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1701 GdkPixbuf *pixbuf; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1702 GtkTreeIter iter; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1703 size_t index = g_list_index(gaim_accounts_get_all(), pulse_data->account); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1704 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1705 if (gtk_tree_model_iter_nth_child(pulse_data->model, &iter, NULL, index)) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1706 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1707 pixbuf = gdk_pixbuf_copy(pulse_data->online_pixbuf); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1708 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1709 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1710 pulse_data->pulse_value, FALSE); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1711 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1712 if (pulse_data->pulse_to_grey) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1713 pulse_data->pulse_value += 0.20; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1714 else |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1715 pulse_data->pulse_value -= 0.20; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1716 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1717 if (pulse_data->pulse_value >= 1) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1718 pulse_data->pulse_to_grey = FALSE; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1719 else if (pulse_data->pulse_value <= 0) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1720 pulse_data->pulse_to_grey = TRUE; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1721 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1722 gtk_list_store_set(GTK_LIST_STORE(pulse_data->model), &iter, |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1723 COLUMN_ICON, pixbuf, -1); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1724 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1725 if (pixbuf != NULL) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1726 g_object_unref(G_OBJECT(pixbuf)); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1727 } |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1728 } |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
1729 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1730 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1731 signed_on_off_cb(GaimConnection *gc, AccountsWindow *dialog) |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1732 { |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1733 GaimAccount *account = gaim_connection_get_account(gc); |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1734 GaimGtkPulseData *pulse_data; |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1735 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1736 GtkTreeIter iter; |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1737 GdkPixbuf *pixbuf, *scale = NULL; |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1738 size_t index = g_list_index(gaim_accounts_get_all(), account); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1739 |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1740 if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1741 { |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1742 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1743 COLUMN_PULSE_DATA, &pulse_data, -1); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1744 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1745 if (pulse_data != NULL) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1746 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1747 if (pulse_data->timeout > 0) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1748 g_source_remove(pulse_data->timeout); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1749 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1750 g_object_unref(G_OBJECT(pulse_data->online_pixbuf)); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1751 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1752 g_free(pulse_data); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1753 } |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1754 |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1755 pixbuf = create_prpl_icon(account); |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1756 |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1757 if (pixbuf != NULL) |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1758 { |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1759 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1760 GDK_INTERP_BILINEAR); |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1761 |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1762 if (!gaim_account_is_connected(account)) |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1763 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1764 } |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1765 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1766 gtk_list_store_set(dialog->model, &iter, |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1767 COLUMN_ICON, scale, |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1768 COLUMN_ONLINE, gaim_account_is_connected(account), |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
1769 COLUMN_PULSE_DATA, NULL, |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1770 -1); |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1771 |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1772 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
1773 if (scale != NULL) g_object_unref(G_OBJECT(scale)); |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1774 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1775 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
1776 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1777 static void |
5774 | 1778 drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1779 GtkSelectionData *data, guint info, guint time, |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1780 AccountsWindow *dialog) |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1781 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1782 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1783 GtkTreeRowReference *ref; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1784 GtkTreePath *source_row; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1785 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1786 GaimAccount *account = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1787 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1788 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1789 ref = g_object_get_data(G_OBJECT(ctx), "gtk-tree-view-source-row"); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1790 source_row = gtk_tree_row_reference_get_path(ref); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1791 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1792 if (source_row == NULL) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1793 return; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1794 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1795 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1796 source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1797 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1798 COLUMN_DATA, &val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1799 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1800 dialog->drag_iter = iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1801 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1802 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1803 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1804 gtk_selection_data_set(data, gdk_atom_intern("GAIM_ACCOUNT", FALSE), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1805 8, (void *)&account, sizeof(account)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1806 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1807 gtk_tree_path_free(source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1808 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1809 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1810 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1811 static void |
5802
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1812 move_account_after(GtkListStore *store, GtkTreeIter *iter, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1813 GtkTreeIter *position) |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1814 { |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1815 GtkTreeIter new_iter; |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1816 GaimAccount *account; |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1817 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1818 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1819 COLUMN_DATA, &account, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1820 -1); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1821 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1822 gtk_list_store_insert_after(store, &new_iter, position); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1823 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1824 set_account(store, &new_iter, account); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1825 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1826 gtk_list_store_remove(store, iter); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1827 } |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1828 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1829 static void |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1830 move_account_before(GtkListStore *store, GtkTreeIter *iter, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1831 GtkTreeIter *position) |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1832 { |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1833 GtkTreeIter new_iter; |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1834 GaimAccount *account; |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1835 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1836 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1837 COLUMN_DATA, &account, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1838 -1); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1839 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1840 gtk_list_store_insert_before(store, &new_iter, position); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1841 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1842 set_account(store, &new_iter, account); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1843 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1844 gtk_list_store_remove(store, iter); |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1845 } |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1846 |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1847 static void |
5774 | 1848 drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1849 guint x, guint y, GtkSelectionData *sd, |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1850 guint info, guint t, AccountsWindow *dialog) |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1851 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1852 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1853 size_t dest_index; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1854 GaimAccount *a = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1855 GtkTreePath *path = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1856 GtkTreeViewDropPosition position; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1857 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1858 memcpy(&a, sd->data, sizeof(a)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1859 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1860 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1861 &path, &position)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1862 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1863 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1864 GaimAccount *account; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1865 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1866 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1867 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1868 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1869 COLUMN_DATA, &val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1870 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1871 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1872 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1873 switch (position) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1874 case GTK_TREE_VIEW_DROP_AFTER: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1875 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER: |
5802
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1876 move_account_after(dialog->model, &dialog->drag_iter, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1877 &iter); |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1878 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1879 account) + 1; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1880 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1881 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1882 case GTK_TREE_VIEW_DROP_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1883 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1884 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1885 account); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1886 |
5802
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1887 move_account_before(dialog->model, &dialog->drag_iter, |
d23c0d94be18
[gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents:
5783
diff
changeset
|
1888 &iter); |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1889 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1890 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1891 default: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1892 return; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1893 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1894 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1895 gaim_accounts_reorder(a, dest_index); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1896 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1897 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1898 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
1899 |
5563 | 1900 static gint |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1901 accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsWindow *dialog) |
5563 | 1902 { |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1903 gaim_gtk_accounts_window_hide(); |
7159 | 1904 |
6123 | 1905 return 0; |
5563 | 1906 } |
1907 | |
1908 static gboolean | |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1909 configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsWindow *dialog) |
5563 | 1910 { |
1911 if (GTK_WIDGET_VISIBLE(w)) { | |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1912 int old_width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1913 int col_width; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1914 int difference; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1915 |
5563 | 1916 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width); |
1917 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/height", event->height); | |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1918 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1919 col_width = gtk_tree_view_column_get_width(dialog->screenname_col); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1920 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1921 if (col_width == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1922 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1923 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1924 difference = (MAX(old_width, event->width) - |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1925 MIN(old_width, event->width)); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1926 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1927 if (difference == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1928 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1929 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1930 if (old_width < event->width) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1931 gtk_tree_view_column_set_min_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1932 col_width + difference); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1933 else |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1934 gtk_tree_view_column_set_max_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
1935 col_width - difference); |
5563 | 1936 } |
1937 | |
1938 return FALSE; | |
1939 } | |
1940 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1941 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1942 add_account_cb(GtkWidget *w, AccountsWindow *dialog) |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1943 { |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1944 gaim_gtk_account_dialog_show(GAIM_GTK_ADD_ACCOUNT_DIALOG, NULL); |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1945 } |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1946 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1947 static void |
5774 | 1948 modify_account_sel(GtkTreeModel *model, GtkTreePath *path, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1949 GtkTreeIter *iter, gpointer data) |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1950 { |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1951 GaimAccount *account; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1952 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1953 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1954 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1955 if (account != NULL) |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1956 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1957 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1958 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1959 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
1960 modify_account_cb(GtkWidget *w, AccountsWindow *dialog) |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1961 { |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1962 GtkTreeSelection *selection; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1963 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1964 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
1965 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1966 gtk_tree_selection_selected_foreach(selection, modify_account_sel, dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1967 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1968 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1969 static void |
5774 | 1970 delete_account_cb(GaimAccount *account) |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1971 { |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1972 size_t index; |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1973 GtkTreeIter iter; |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1974 |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1975 index = g_list_index(gaim_accounts_get_all(), account); |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1976 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1977 if (accounts_window != NULL) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1978 { |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1979 AccountPrefsDialog *dialog; |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1980 |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1981 if (gtk_tree_model_iter_nth_child( |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1982 GTK_TREE_MODEL(accounts_window->model), &iter, NULL, index)) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1983 { |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1984 gtk_list_store_remove(accounts_window->model, &iter); |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1985 } |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1986 |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1987 if ((dialog = g_hash_table_lookup(accounts_window->account_pref_wins, |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1988 account)) != NULL) |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1989 { |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1990 account_win_destroy_cb(NULL, NULL, dialog); |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1991 } |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1992 } |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1993 |
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6344
diff
changeset
|
1994 gaim_accounts_delete(account); |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1995 } |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1996 |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
1997 static void |
5774 | 1998 ask_delete_account_sel(GtkTreeModel *model, GtkTreePath *path, |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
1999 GtkTreeIter *iter, gpointer data) |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2000 { |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2001 GaimAccount *account; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2002 |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2003 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2004 |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2005 if (account != NULL) { |
7677 | 2006 char *buf; |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2007 |
7677 | 2008 buf = g_strdup_printf(_("Are you sure you want to delete %s?"), |
2009 gaim_account_get_username(account)); | |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2010 |
9814 | 2011 gaim_request_close_with_handle(account); |
2012 gaim_request_action(account, NULL, buf, NULL, 1, account, 2, | |
5774 | 2013 _("Delete"), delete_account_cb, |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2014 _("Cancel"), NULL); |
7677 | 2015 g_free(buf); |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2016 } |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2017 } |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2018 |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2019 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2020 ask_delete_account_cb(GtkWidget *w, AccountsWindow *dialog) |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2021 { |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2022 GtkTreeSelection *selection; |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2023 |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2024 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2025 |
5774 | 2026 gtk_tree_selection_selected_foreach(selection, ask_delete_account_sel, |
5701
730bfc7c5e2d
[gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents:
5700
diff
changeset
|
2027 dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2028 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2029 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2030 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2031 close_accounts_cb(GtkWidget *w, AccountsWindow *dialog) |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2032 { |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
2033 gtk_widget_destroy(dialog->window); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2034 |
7159 | 2035 gaim_gtk_accounts_window_hide(); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2036 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2037 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2038 static void |
5774 | 2039 online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2040 { |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2041 AccountsWindow *dialog = (AccountsWindow *)data; |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2042 GaimAccount *account; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2043 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2044 GtkTreeIter iter; |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2045 GaimGtkPulseData *pulse_data; |
5637 | 2046 gboolean online; |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2047 |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2048 gtk_tree_model_get_iter_from_string(model, &iter, path_str); |
5718
c19cc2a3d65e
[gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
2049 gtk_tree_model_get(model, &iter, |
c19cc2a3d65e
[gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
2050 COLUMN_DATA, &account, |
c19cc2a3d65e
[gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
2051 COLUMN_ONLINE, &online, |
c19cc2a3d65e
[gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
2052 -1); |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2053 |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2054 if (online) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2055 { |
5855 | 2056 account->gc->wants_to_die = TRUE; |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2057 gaim_account_disconnect(account); |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2058 } |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2059 else |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2060 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2061 GdkPixbuf *pixbuf; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2062 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2063 pulse_data = g_new0(GaimGtkPulseData, 1); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2064 pulse_data->pulse_to_grey = TRUE; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2065 pulse_data->pulse_value = 0; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2066 pulse_data->account = account; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2067 pulse_data->model = model; |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2068 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2069 pixbuf = create_prpl_icon(account); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2070 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2071 if (pixbuf != NULL) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2072 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2073 pulse_data->online_pixbuf = |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2074 gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2075 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2076 g_object_unref(G_OBJECT(pixbuf)); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2077 } |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2078 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2079 if (pulse_data->online_pixbuf == NULL) |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2080 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2081 g_free(pulse_data); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2082 } |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2083 else |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2084 { |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2085 pulse_data->timeout = g_timeout_add(100, |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2086 (GSourceFunc)account_pulse_update, pulse_data); |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2087 |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2088 gtk_list_store_set(GTK_LIST_STORE(model), &iter, |
7480
d70cfddd8164
[gaim-migrate @ 8093]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7450
diff
changeset
|
2089 COLUMN_PULSE_DATA, pulse_data, -1); |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2090 } |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2091 |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
2092 gaim_account_connect(account); |
5855 | 2093 } |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2094 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2095 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2096 static void |
5774 | 2097 autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2098 gpointer data) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2099 { |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2100 AccountsWindow *dialog = (AccountsWindow *)data; |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2101 GaimAccount *account; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2102 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2103 GtkTreeIter iter; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2104 gboolean autologin; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2105 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2106 gtk_tree_model_get_iter_from_string(model, &iter, path_str); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2107 gtk_tree_model_get(model, &iter, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2108 COLUMN_DATA, &account, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2109 COLUMN_AUTOLOGIN, &autologin, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2110 -1); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2111 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2112 gaim_account_set_auto_login(account, GAIM_GTK_UI, !autologin); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2113 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2114 gtk_list_store_set(dialog->model, &iter, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2115 COLUMN_AUTOLOGIN, !autologin, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2116 -1); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2117 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2118 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2119 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2120 add_columns(GtkWidget *treeview, AccountsWindow *dialog) |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2121 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2122 GtkCellRenderer *renderer; |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2123 GtkTreeViewColumn *column; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2124 |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2125 /* Screen name column */ |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2126 column = gtk_tree_view_column_new(); |
6623 | 2127 gtk_tree_view_column_set_title(column, _("Screen Name")); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2128 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
9519 | 2129 gtk_tree_view_column_set_resizable(column, TRUE); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2130 |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2131 /* Icon */ |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2132 renderer = gtk_cell_renderer_pixbuf_new(); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2133 gtk_tree_view_column_pack_start(column, renderer, FALSE); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2134 gtk_tree_view_column_add_attribute(column, renderer, |
5693 | 2135 "pixbuf", COLUMN_ICON); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2136 |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2137 /* Screen name */ |
5774 | 2138 renderer = gtk_cell_renderer_text_new(); |
2139 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
2140 gtk_tree_view_column_add_attribute(column, renderer, | |
2141 "text", COLUMN_SCREENNAME); | |
2142 dialog->screenname_col = column; | |
2143 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2144 /* Online? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2145 renderer = gtk_cell_renderer_toggle_new(); |
5782
087b4b5abe35
[gaim-migrate @ 6207]
Christian Hammond <chipx86@chipx86.com>
parents:
5781
diff
changeset
|
2146 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2147 g_signal_connect(G_OBJECT(renderer), "toggled", |
5774 | 2148 G_CALLBACK(online_cb), dialog); |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
2149 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2150 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
5693 | 2151 -1, _("Online"), |
2152 renderer, | |
2153 "active", COLUMN_ONLINE, | |
2154 NULL); | |
9519 | 2155 column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), 1); |
2156 gtk_tree_view_column_set_resizable(column, TRUE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2157 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2158 /* Auto-login? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2159 renderer = gtk_cell_renderer_toggle_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2160 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2161 g_signal_connect(G_OBJECT(renderer), "toggled", |
5774 | 2162 G_CALLBACK(autologin_cb), dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2163 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2164 column = gtk_tree_view_column_new_with_attributes(_("Auto-login"), |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2165 renderer, "active", COLUMN_AUTOLOGIN, NULL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2166 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2167 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
9519 | 2168 gtk_tree_view_column_set_resizable(column, TRUE); |
5781
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2169 |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2170 /* Protocol name */ |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2171 column = gtk_tree_view_column_new(); |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2172 gtk_tree_view_column_set_title(column, _("Protocol")); |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2173 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
9519 | 2174 gtk_tree_view_column_set_resizable(column, TRUE); |
5781
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2175 |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2176 renderer = gtk_cell_renderer_text_new(); |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2177 gtk_tree_view_column_pack_start(column, renderer, TRUE); |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2178 gtk_tree_view_column_add_attribute(column, renderer, |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2179 "text", COLUMN_PROTOCOL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2180 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2181 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2182 static void |
5774 | 2183 set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account) |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2184 { |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2185 GdkPixbuf *pixbuf; |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2186 GdkPixbuf *scale; |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2187 |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2188 scale = NULL; |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2189 |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2190 pixbuf = create_prpl_icon(account); |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2191 |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2192 if (pixbuf != NULL) |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
2193 { |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2194 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2195 |
6751
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
2196 if (!gaim_account_is_connected(account)) |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
2197 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
2198 } |
35b01b371785
[gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents:
6732
diff
changeset
|
2199 |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2200 gtk_list_store_set(store, iter, |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2201 COLUMN_ICON, scale, |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2202 COLUMN_SCREENNAME, gaim_account_get_username(account), |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2203 COLUMN_ONLINE, gaim_account_is_connected(account), |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2204 COLUMN_AUTOLOGIN, gaim_account_get_auto_login(account, GAIM_GTK_UI), |
9699 | 2205 COLUMN_PROTOCOL, gaim_account_get_protocol_name(account), |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2206 COLUMN_DATA, account, |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2207 -1); |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2208 |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2209 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2210 if (scale != NULL) g_object_unref(G_OBJECT(scale)); |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2211 } |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2212 |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2213 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2214 add_account(AccountsWindow *dialog, GaimAccount *account) |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2215 { |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2216 GtkTreeIter iter; |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2217 |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2218 gtk_list_store_append(dialog->model, &iter); |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2219 |
5774 | 2220 set_account(dialog->model, &iter, account); |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2221 } |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2222 |
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2223 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2224 populate_accounts_list(AccountsWindow *dialog) |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2225 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2226 GList *l; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2227 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2228 gtk_list_store_clear(dialog->model); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2229 |
5698
81d7b4239815
[gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents:
5697
diff
changeset
|
2230 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) |
5774 | 2231 add_account(dialog, (GaimAccount *)l->data); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2232 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2233 |
8406
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2234 #if !GTK_CHECK_VERSION(2,2,0) |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2235 static void |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2236 get_selected_helper(GtkTreeModel *model, GtkTreePath *path, |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2237 GtkTreeIter *iter, gpointer user_data) |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2238 { |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2239 *((gboolean *)user_data) = TRUE; |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2240 } |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2241 #endif |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2242 |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2243 static void |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2244 account_selected_cb(GtkTreeSelection *sel, AccountsWindow *dialog) |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2245 { |
8406
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2246 gboolean selected = FALSE; |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2247 |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2248 #if GTK_CHECK_VERSION(2,2,0) |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2249 selected = (gtk_tree_selection_count_selected_rows(sel) > 0); |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2250 #else |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2251 gtk_tree_selection_selected_foreach(sel, get_selected_helper, &selected); |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2252 #endif |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2253 |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2254 gtk_widget_set_sensitive(dialog->modify_button, selected); |
f8b8ee06f26c
[gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents:
8405
diff
changeset
|
2255 gtk_widget_set_sensitive(dialog->delete_button, selected); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2256 } |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2257 |
5563 | 2258 static GtkWidget * |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2259 create_accounts_list(AccountsWindow *dialog) |
5563 | 2260 { |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2261 GtkWidget *sw; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2262 GtkWidget *treeview; |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2263 GtkTreeSelection *sel; |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2264 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2265 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2266 /* Create the scrolled window. */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2267 sw = gtk_scrolled_window_new(0, 0); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2268 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2269 GTK_POLICY_AUTOMATIC, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2270 GTK_POLICY_ALWAYS); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2271 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2272 GTK_SHADOW_IN); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2273 gtk_widget_show(sw); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2274 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2275 /* Create the list model. */ |
5781
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2276 dialog->model = gtk_list_store_new(NUM_COLUMNS, |
c8837160add6
[gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents:
5779
diff
changeset
|
2277 GDK_TYPE_PIXBUF, G_TYPE_STRING, |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2278 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, |
7179
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2279 G_TYPE_STRING, G_TYPE_POINTER, |
819905ce7bc0
[gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents:
7159
diff
changeset
|
2280 G_TYPE_POINTER); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2281 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2282 /* And now the actual treeview */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2283 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
2284 dialog->treeview = treeview; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2285 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2286 gtk_tree_selection_set_mode( |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2287 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2288 GTK_SELECTION_MULTIPLE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2289 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2290 gtk_container_add(GTK_CONTAINER(sw), treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2291 gtk_widget_show(treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2292 |
5774 | 2293 add_columns(treeview, dialog); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
2294 |
5774 | 2295 populate_accounts_list(dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2296 |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2297 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2298 g_signal_connect(G_OBJECT(sel), "changed", |
5774 | 2299 G_CALLBACK(account_selected_cb), dialog); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2300 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2301 /* Setup DND. I wanna be an orc! */ |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2302 gtk_tree_view_enable_model_drag_source( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2303 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2304 1, GDK_ACTION_COPY); |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2305 gtk_tree_view_enable_model_drag_dest( |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5774
diff
changeset
|
2306 GTK_TREE_VIEW(treeview), gte, 1, |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2307 GDK_ACTION_COPY | GDK_ACTION_MOVE); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2308 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2309 g_signal_connect(G_OBJECT(treeview), "drag-data-received", |
5774 | 2310 G_CALLBACK(drag_data_received_cb), dialog); |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2311 g_signal_connect(G_OBJECT(treeview), "drag-data-get", |
5774 | 2312 G_CALLBACK(drag_data_get_cb), dialog); |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
2313 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2314 return sw; |
5563 | 2315 } |
2316 | |
2317 void | |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2318 gaim_gtk_accounts_window_show(void) |
5563 | 2319 { |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2320 AccountsWindow *dialog; |
5563 | 2321 GtkWidget *win; |
2322 GtkWidget *vbox; | |
2323 GtkWidget *bbox; | |
2324 GtkWidget *sw; | |
2325 GtkWidget *sep; | |
2326 GtkWidget *button; | |
2327 int width, height; | |
2328 | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2329 if (accounts_window != NULL) { |
9482 | 2330 gtk_window_present(GTK_WINDOW(accounts_window->window)); |
5563 | 2331 return; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2332 } |
5563 | 2333 |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2334 accounts_window = dialog = g_new0(AccountsWindow, 1); |
5563 | 2335 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
2336 accounts_window->account_pref_wins = |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
2337 g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
2338 |
5563 | 2339 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); |
2340 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height"); | |
2341 | |
5803
56042e59499a
[gaim-migrate @ 6233]
Christian Hammond <chipx86@chipx86.com>
parents:
5802
diff
changeset
|
2342 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
5563 | 2343 gtk_window_set_default_size(GTK_WINDOW(win), width, height); |
2344 gtk_window_set_role(GTK_WINDOW(win), "accounts"); | |
5693 | 2345 gtk_window_set_title(GTK_WINDOW(win), _("Accounts")); |
5563 | 2346 gtk_container_set_border_width(GTK_CONTAINER(win), 12); |
2347 | |
2348 g_signal_connect(G_OBJECT(win), "delete_event", | |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2349 G_CALLBACK(accedit_win_destroy_cb), accounts_window); |
5563 | 2350 g_signal_connect(G_OBJECT(win), "configure_event", |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2351 G_CALLBACK(configure_cb), accounts_window); |
5563 | 2352 |
2353 /* Setup the vbox */ | |
2354 vbox = gtk_vbox_new(FALSE, 12); | |
2355 gtk_container_add(GTK_CONTAINER(win), vbox); | |
2356 gtk_widget_show(vbox); | |
2357 | |
2358 /* Setup the scrolled window that will contain the list of accounts. */ | |
5774 | 2359 sw = create_accounts_list(dialog); |
5563 | 2360 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
2361 gtk_widget_show(sw); | |
2362 | |
2363 /* Separator... */ | |
2364 sep = gtk_hseparator_new(); | |
2365 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
2366 gtk_widget_show(sep); | |
2367 | |
2368 /* Button box. */ | |
2369 bbox = gtk_hbutton_box_new(); | |
2370 gtk_box_set_spacing(GTK_BOX(bbox), 6); | |
2371 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
2372 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2373 gtk_widget_show(bbox); |
5563 | 2374 |
2375 /* Add button */ | |
2376 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
2377 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
2378 gtk_widget_show(button); | |
2379 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2380 g_signal_connect(G_OBJECT(button), "clicked", |
5774 | 2381 G_CALLBACK(add_account_cb), dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2382 |
5563 | 2383 /* Modify button */ |
2384 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY); | |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2385 dialog->modify_button = button; |
5563 | 2386 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2387 gtk_widget_set_sensitive(button, FALSE); |
5563 | 2388 gtk_widget_show(button); |
2389 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2390 g_signal_connect(G_OBJECT(button), "clicked", |
5774 | 2391 G_CALLBACK(modify_account_cb), dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2392 |
5563 | 2393 /* Delete button */ |
2394 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); | |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2395 dialog->delete_button = button; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2396 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5703
cee14870644c
[gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents:
5702
diff
changeset
|
2397 gtk_widget_set_sensitive(button, FALSE); |
5563 | 2398 gtk_widget_show(button); |
2399 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2400 g_signal_connect(G_OBJECT(button), "clicked", |
5774 | 2401 G_CALLBACK(ask_delete_account_cb), dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2402 |
5563 | 2403 /* Close button */ |
2404 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2405 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5563 | 2406 gtk_widget_show(button); |
2407 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2408 g_signal_connect(G_OBJECT(button), "clicked", |
5774 | 2409 G_CALLBACK(close_accounts_cb), dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2410 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
2411 /* Setup some gaim signal handlers. */ |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
2412 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
2413 dialog, GAIM_CALLBACK(signed_on_off_cb), dialog); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
2414 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
2415 dialog, GAIM_CALLBACK(signed_on_off_cb), dialog); |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
2416 |
5563 | 2417 gtk_widget_show(win); |
2418 } | |
2419 | |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2420 void |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2421 gaim_gtk_accounts_window_hide(void) |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2422 { |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2423 if (accounts_window == NULL) |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2424 return; |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2425 |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2426 gaim_signals_disconnect_by_handle(accounts_window); |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2427 |
8405
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
2428 g_hash_table_destroy(accounts_window->account_pref_wins); |
1c4402a2ac71
[gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents:
8363
diff
changeset
|
2429 |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2430 g_free(accounts_window); |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2431 accounts_window = NULL; |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2432 |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2433 /* See if we're the main window here. */ |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2434 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL && |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2435 mainwindow == NULL && gaim_connections_get_all() == NULL) { |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2436 |
6179
16e384bb7fbf
[gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents:
6141
diff
changeset
|
2437 gaim_core_quit(); |
6119
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2438 } |
0d2bd49c611e
[gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents:
6092
diff
changeset
|
2439 } |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2440 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2441 static void |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2442 free_add_user_data(GaimGtkAccountAddUserData *data) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2443 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2444 g_free(data->username); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2445 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2446 if (data->alias != NULL) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2447 g_free(data->alias); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2448 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2449 g_free(data); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2450 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2451 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2452 static void |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2453 add_user_cb(GaimGtkAccountAddUserData *data) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2454 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2455 GaimConnection *gc = gaim_account_get_connection(data->account); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2456 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2457 if (g_list_find(gaim_connections_get_all(), gc)) |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
2458 { |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
2459 gaim_blist_request_add_buddy(data->account, data->username, |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
2460 NULL, data->alias); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
2461 } |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2462 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2463 free_add_user_data(data); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2464 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2465 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2466 static void |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2467 gaim_gtk_accounts_notify_added(GaimAccount *account, const char *remote_user, |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2468 const char *id, const char *alias, |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2469 const char *msg) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2470 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2471 char *buffer; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2472 GaimConnection *gc; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2473 GaimGtkAccountAddUserData *data; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2474 GaimBuddy *buddy; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2475 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2476 gc = gaim_account_get_connection(account); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2477 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2478 buddy = gaim_find_buddy(account, remote_user); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2479 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2480 data = g_new0(GaimGtkAccountAddUserData, 1); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2481 data->account = account; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2482 data->username = g_strdup(remote_user); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2483 data->alias = (alias != NULL ? g_strdup(alias) : NULL); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2484 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2485 buffer = g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s%s"), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2486 remote_user, |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2487 (alias != NULL ? " (" : ""), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2488 (alias != NULL ? alias : ""), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2489 (alias != NULL ? ")" : ""), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2490 (id != NULL |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2491 ? id |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2492 : (gaim_connection_get_display_name(gc) != NULL |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2493 ? gaim_connection_get_display_name(gc) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2494 : gaim_account_get_username(account))), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2495 (msg != NULL ? ": " : "."), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2496 (msg != NULL ? msg : ""), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2497 (buddy != NULL |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2498 ? "" |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2499 : _("\n\nDo you wish to add him or her to your buddy list?"))); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2500 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2501 if (buddy != NULL) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2502 { |
7859 | 2503 gaim_notify_info(NULL, NULL, _("Information"), buffer); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2504 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2505 else |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2506 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2507 gaim_request_action(NULL, NULL, _("Add buddy to your list?"), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2508 buffer, 0, data, 2, |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2509 _("Add"), G_CALLBACK(add_user_cb), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2510 _("Cancel"), G_CALLBACK(free_add_user_data)); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2511 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2512 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2513 g_free(buffer); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2514 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2515 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2516 static GaimAccountUiOps ui_ops = |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2517 { |
9944 | 2518 gaim_gtk_accounts_notify_added, |
2519 NULL | |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2520 }; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2521 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2522 GaimAccountUiOps * |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2523 gaim_gtk_accounts_get_ui_ops(void) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2524 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2525 return &ui_ops; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6856
diff
changeset
|
2526 } |
9609 | 2527 |
2528 void * | |
2529 gaim_gtk_account_get_handle() { | |
2530 static int handle; | |
2531 | |
2532 return &handle; | |
2533 } | |
2534 | |
2535 void | |
2536 gaim_gtk_account_init(void) { | |
2537 gaim_signal_register(gaim_gtk_account_get_handle(), "account-modified", | |
2538 gaim_marshal_VOID__POINTER, NULL, 1, | |
2539 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
2540 GAIM_SUBTYPE_ACCOUNT)); | |
2541 } | |
2542 | |
2543 void | |
2544 gaim_gtk_account_uninit(void) { | |
9617 | 2545 gaim_signals_unregister_by_instance(gaim_gtk_account_get_handle()); |
9609 | 2546 } |