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