annotate src/gtkaccount.c @ 14133:31d33e7bc0e6

[gaim-migrate @ 16775] A global buddy icon selector in the statusbox. This is done totally in the GTK+ UI; the core still sees a buddy icon as belonging to an account. Per-account icons can override the global one in Modify Account. There are some caching issues to work out, still. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 15 Aug 2006 23:25:29 +0000
parents 223570831b0b
children 5f656a0a82b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
7820
8e60ddc28a22 [gaim-migrate @ 8472]
Mark Doliner <mark@kingant.net>
parents: 7810
diff changeset
2 * @file gtkaccount.c GTK+ Account Editor UI
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup gtkui
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
9 * source distribution.
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
10 *
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
9308
b3bda982996b [gaim-migrate @ 10116]
Sean Egan <seanegan@gmail.com>
parents: 9304
diff changeset
25
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9710
diff changeset
26 #include "internal.h"
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9710
diff changeset
27 #include "gtkgaim.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5715
diff changeset
28
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "account.h"
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
30 #include "accountopt.h"
6229
254bb94a216e [gaim-migrate @ 6722]
Mark Doliner <mark@kingant.net>
parents: 6179
diff changeset
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
b3bda982996b [gaim-migrate @ 10116]
Sean Egan <seanegan@gmail.com>
parents: 9304
diff changeset
36 #include "prpl.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5870
diff changeset
37 #include "request.h"
11724
a8ec0a291d14 [gaim-migrate @ 14015]
Mark Doliner <mark@kingant.net>
parents: 11654
diff changeset
38 #include "savedstatuses.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
39 #include "signals.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5870
diff changeset
40 #include "util.h"
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
41
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
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 9705
diff changeset
44 #include "gtkdialogs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5870
diff changeset
45 #include "gtkutils.h"
10649
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10646
diff changeset
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
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
49 enum
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
50 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
51 COLUMN_ICON,
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
52 COLUMN_SCREENNAME,
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
53 COLUMN_ENABLED,
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
54 COLUMN_PROTOCOL,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
55 COLUMN_DATA,
7179
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
56 COLUMN_PULSE_DATA,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
57 NUM_COLUMNS
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
58 };
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 typedef struct
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 {
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
62 GaimAccount *account;
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
63 char *username;
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
64 char *alias;
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
65
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
66 } GaimGtkAccountAddUserData;
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
67
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
68 typedef struct
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
69 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 GtkWidget *window;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
71 GtkWidget *treeview;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
73 GtkWidget *modify_button;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
74 GtkWidget *delete_button;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
75
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
76 GtkListStore *model;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
77 GtkTreeIter drag_iter;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
78
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
79 GtkTreeViewColumn *screenname_col;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
80
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
81 } AccountsWindow;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
83 typedef struct
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
84 {
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
85 GaimGtkAccountDialogType type;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
86
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
87 GaimAccount *account;
5978
041b657227c4 [gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
88 char *protocol_id;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
89 GaimPlugin *plugin;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
90 GaimPluginProtocolInfo *prpl_info;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
91
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
92 GaimProxyType new_proxy_type;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
93
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
94 GList *user_split_entries;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
95 GList *protocol_opt_entries;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
96
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
97 GtkSizeGroup *sg;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
98 GtkWidget *window;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
99
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
100 GtkWidget *top_vbox;
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
101 GtkWidget *bottom_vbox;
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
102 GtkWidget *ok_button;
6141
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
103 GtkWidget *register_button;
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
104
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
105 /* Login Options */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
106 GtkWidget *login_frame;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
107 GtkWidget *protocol_menu;
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
108 GtkWidget *password_box;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
109 GtkWidget *screenname_entry;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
110 GtkWidget *password_entry;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
111 GtkWidget *alias_entry;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
112 GtkWidget *remember_pass_check;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
113
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
114 /* User Options */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
115 GtkWidget *user_frame;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
116 GtkWidget *new_mail_check;
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
117 GtkWidget *icon_hbox;
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
118 GtkWidget *icon_check;
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
119 GtkWidget *icon_entry;
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
120 char *icon_path;
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
121 GtkWidget *icon_filesel;
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
122 GtkWidget *icon_preview;
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
123 GtkWidget *icon_text;
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
124
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
125 /* Protocol Options */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
126 GtkWidget *protocol_frame;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
127
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
128 /* Proxy Options */
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
129 GtkWidget *proxy_frame;
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
130 GtkWidget *proxy_vbox;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
131 GtkWidget *proxy_dropdown;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
132 GtkWidget *proxy_host_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
133 GtkWidget *proxy_port_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
134 GtkWidget *proxy_user_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
135 GtkWidget *proxy_pass_entry;
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
136
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
137 } AccountPrefsDialog;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
138
7179
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
139 typedef struct
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
140 {
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
141 GdkPixbuf *online_pixbuf;
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
142 gboolean pulse_to_grey;
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
143 float pulse_value;
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
144 int timeout;
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
145 GaimAccount *account;
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
146 GtkTreeModel *model;
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
147
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
148 } GaimGtkPulseData;
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
149
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
150
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
151 static AccountsWindow *accounts_window = NULL;
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
152 static GHashTable *account_pref_wins;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
153
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
154 static void add_account_to_liststore(GaimAccount *account, gpointer user_data);
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
155 static void set_account(GtkListStore *store, GtkTreeIter *iter,
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
156 GaimAccount *account);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
157
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
158 /**************************************************************************
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
159 * Add/Modify Account dialog
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
160 **************************************************************************/
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
161 static void add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
162 static void add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
163 static void add_protocol_options(AccountPrefsDialog *dialog,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
164 GtkWidget *parent);
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
165 static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
166
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
167 static GtkWidget *
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
168 add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
169 const char *text, GtkWidget *widget)
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
170 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
171 GtkWidget *hbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
172 GtkWidget *label;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
173
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
174 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
175 gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
176 gtk_widget_show(hbox);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
177
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
178 label = gtk_label_new_with_mnemonic(text);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
179 gtk_size_group_add_widget(dialog->sg, label);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
180 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
181 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
182 gtk_widget_show(label);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
183
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
184 gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, GAIM_HIG_BORDER);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
185 gtk_widget_show(widget);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8085
diff changeset
186 gaim_set_accessible_label (widget, label);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
187
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
188 return hbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
189 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
190
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
191 static void
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
192 set_dialog_icon(AccountPrefsDialog *dialog)
11286
0c2d1b4b1351 [gaim-migrate @ 13483]
Richard Laager <rlaager@wiktel.com>
parents: 11256
diff changeset
193 {
11304
74e30ef571ce [gaim-migrate @ 13504]
Richard Laager <rlaager@wiktel.com>
parents: 11303
diff changeset
194 char *filename = gaim_buddy_icons_get_full_path(dialog->icon_path);
13221
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
195 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
196
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
197 if (pixbuf && dialog->prpl_info &&
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
198 (dialog->prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_DISPLAY))
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
199 {
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
200 int width, height;
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
201 GdkPixbuf *scale;
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
202
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
203 gaim_gtk_buddy_icon_get_scale_size(pixbuf,
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
204 &dialog->prpl_info->icon_spec, &width, &height);
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
205 scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR);
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
206
13221
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
207 g_object_unref(G_OBJECT(pixbuf));
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
208 pixbuf = scale;
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
209 }
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
210
cc85a78191cc [gaim-migrate @ 15585]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
211 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_entry), pixbuf);
14088
223570831b0b [gaim-migrate @ 16711]
Mark Doliner <mark@kingant.net>
parents: 14035
diff changeset
212 if (pixbuf != NULL)
223570831b0b [gaim-migrate @ 16711]
Mark Doliner <mark@kingant.net>
parents: 14035
diff changeset
213 g_object_unref(G_OBJECT(pixbuf));
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
214 g_free(filename);
11286
0c2d1b4b1351 [gaim-migrate @ 13483]
Richard Laager <rlaager@wiktel.com>
parents: 11256
diff changeset
215 }
0c2d1b4b1351 [gaim-migrate @ 13483]
Richard Laager <rlaager@wiktel.com>
parents: 11256
diff changeset
216
0c2d1b4b1351 [gaim-migrate @ 13483]
Richard Laager <rlaager@wiktel.com>
parents: 11256
diff changeset
217 static void
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7859
diff changeset
218 set_account_protocol_cb(GtkWidget *item, const char *id,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
219 AccountPrefsDialog *dialog)
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 GaimPlugin *new_plugin;
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
222
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
223 new_plugin = gaim_find_prpl(id);
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
224
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
225 if (new_plugin == dialog->plugin)
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
226 return;
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
227
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
228 dialog->plugin = new_plugin;
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
229
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
230 if (dialog->plugin != NULL)
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
231 {
5943
a4f2aba0848d [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5900
diff changeset
232 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
5978
041b657227c4 [gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
233
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
234 g_free(dialog->protocol_id);
5978
041b657227c4 [gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
235 dialog->protocol_id = g_strdup(dialog->plugin->info->id);
5955
235a14ae42f1 [gaim-migrate @ 6399]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
236 }
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
237
9304
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
238 if (dialog->account != NULL)
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
239 gaim_account_clear_settings(dialog->account);
96c481da57ea [gaim-migrate @ 10112]
Christian Hammond <chipx86@chipx86.com>
parents: 8903
diff changeset
240
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
241 add_login_options(dialog, dialog->top_vbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
242 add_user_options(dialog, dialog->top_vbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
243 add_protocol_options(dialog, dialog->bottom_vbox);
6141
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
244
11358
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
245 if (!dialog->prpl_info || !dialog->prpl_info->register_user) {
6141
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
246 gtk_widget_hide(dialog->register_button);
11358
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
247 } else {
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
248 if (dialog->prpl_info != NULL &&
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
249 (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)) {
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
250 gtk_widget_set_sensitive(dialog->register_button, TRUE);
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
251 } else {
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
252 gtk_widget_set_sensitive(dialog->register_button, FALSE);
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
253 }
6141
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
254 gtk_widget_show(dialog->register_button);
11358
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
255 }
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
256 }
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
257
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
258 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
259 screenname_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog)
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
260 {
6732
c49f232b6bd0 [gaim-migrate @ 7259]
Nathan Walp <nwalp@pidgin.im>
parents: 6623
diff changeset
261 if (dialog->ok_button)
c49f232b6bd0 [gaim-migrate @ 7259]
Nathan Walp <nwalp@pidgin.im>
parents: 6623
diff changeset
262 gtk_widget_set_sensitive(dialog->ok_button,
c49f232b6bd0 [gaim-migrate @ 7259]
Nathan Walp <nwalp@pidgin.im>
parents: 6623
diff changeset
263 *gtk_entry_get_text(entry) != '\0');
11358
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
264 if (dialog->register_button) {
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
265 if (dialog->prpl_info != NULL && (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME))
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
266 gtk_widget_set_sensitive(dialog->register_button, TRUE);
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
267 else
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
268 gtk_widget_set_sensitive(dialog->register_button,
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
269 *gtk_entry_get_text(entry) != '\0');
fb702c34794b [gaim-migrate @ 13580]
Bartoz Oler <bartosz@pidgin.im>
parents: 11304
diff changeset
270 }
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
271 }
6732
c49f232b6bd0 [gaim-migrate @ 7259]
Nathan Walp <nwalp@pidgin.im>
parents: 6623
diff changeset
272
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
273 static void
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
274 icon_filesel_choose_cb(const char *filename, AccountPrefsDialog *dialog)
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
275 {
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
276 if (filename) {
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
277 g_free(dialog->icon_path);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
278 dialog->icon_path = gaim_gtk_convert_buddy_icon(dialog->plugin, filename);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
279 set_dialog_icon(dialog);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
280 gtk_widget_show(dialog->icon_entry);
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
281 }
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
282
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
283 dialog->icon_filesel = NULL;
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
284 }
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
285
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
286 static void
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
287 icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog)
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
288 {
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
289 dialog->icon_filesel = gaim_gtk_buddy_icon_chooser_new(dialog->window, icon_filesel_choose_cb, dialog);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
290 gtk_widget_show_all(dialog->icon_filesel);
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
291 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
292
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
293 static void
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
294 icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog)
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
295 {
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
296 g_free(dialog->icon_path);
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
297 dialog->icon_path = NULL;
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
298
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
299 gtk_widget_hide(dialog->icon_entry);
9308
b3bda982996b [gaim-migrate @ 10116]
Sean Egan <seanegan@gmail.com>
parents: 9304
diff changeset
300 }
b3bda982996b [gaim-migrate @ 10116]
Sean Egan <seanegan@gmail.com>
parents: 9304
diff changeset
301
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
302
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
303 static void
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
304 account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
305 GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog)
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
306 {
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11113
diff changeset
307 gchar *name = (gchar *)sd->data;
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
308
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
309 if ((sd->length >= 0) && (sd->format == 8)) {
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
310 /* Well, it looks like the drag event was cool.
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
311 * Let's do something with it */
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
312 if (!g_ascii_strncasecmp(name, "file://", 7)) {
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
313 GError *converr = NULL;
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
314 gchar *tmp, *rtmp;
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
315 /* It looks like we're dealing with a local file. Let's
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
316 * just untar it in the right place */
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
317 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
318 gaim_debug(GAIM_DEBUG_ERROR, "buddyicon", "%s\n",
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
319 (converr ? converr->message :
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
320 "g_filename_from_uri error"));
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
321 return;
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
322 }
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
323 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
324 *rtmp = '\0';
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
325 g_free(dialog->icon_path);
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
326
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
327 dialog->icon_path = gaim_gtk_convert_buddy_icon(dialog->plugin, tmp);
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
328 set_dialog_icon(dialog);
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
329 gtk_widget_show(dialog->icon_entry);
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
330 g_free(tmp);
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
331 }
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
332 gtk_drag_finish(dc, TRUE, FALSE, t);
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
333 }
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
334 gtk_drag_finish(dc, FALSE, FALSE, t);
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
335 }
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
336
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
337 static void
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
338 update_editable(GaimConnection *gc, AccountPrefsDialog *dialog)
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
339 {
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
340 gboolean set;
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
341 GList *l;
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
342
12843
d9686e688342 [gaim-migrate @ 15191]
Richard Laager <rlaager@wiktel.com>
parents: 12671
diff changeset
343 if (dialog->account == NULL)
d9686e688342 [gaim-migrate @ 15191]
Richard Laager <rlaager@wiktel.com>
parents: 12671
diff changeset
344 return;
d9686e688342 [gaim-migrate @ 15191]
Richard Laager <rlaager@wiktel.com>
parents: 12671
diff changeset
345
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
346 if (gc != NULL && dialog->account != gaim_connection_get_account(gc))
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
347 return;
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
348
12555
8427ef2b4138 [gaim-migrate @ 14874]
Richard Laager <rlaager@wiktel.com>
parents: 12521
diff changeset
349 set = !(gaim_account_is_connected(dialog->account) || gaim_account_is_connecting(dialog->account));
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
350 gtk_widget_set_sensitive(dialog->protocol_menu, set);
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
351 gtk_widget_set_sensitive(dialog->screenname_entry, set);
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
352
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
353 for (l = dialog->user_split_entries ; l != NULL ; l = l->next)
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
354 gtk_widget_set_sensitive((GtkWidget *)l->data, set);
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
355 }
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
356
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
357 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
358 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
359 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
360 GtkWidget *frame;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
361 GtkWidget *vbox;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
362 GtkWidget *entry;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
363 GList *user_splits;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
364 GList *l, *l2;
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
365 char *username = NULL;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
366
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
367 if (dialog->login_frame != NULL)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
368 gtk_widget_destroy(dialog->login_frame);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
369
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
370 /* Build the login options frame. */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
371 frame = gaim_gtk_make_frame(parent, _("Login Options"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
372
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
373 /* cringe */
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
374 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
375
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
376 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
377 gtk_widget_show(dialog->login_frame);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
378
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
379 /* Main vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
380 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
381 gtk_container_add(GTK_CONTAINER(frame), vbox);
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
382 gtk_widget_show(vbox);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
383
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
384 /* Protocol */
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
385 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new(
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7859
diff changeset
386 dialog->protocol_id, G_CALLBACK(set_account_protocol_cb), dialog);
5644
213e999fa5cc [gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents: 5641
diff changeset
387
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
388 add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
389
12152
cda86ce5b026 [gaim-migrate @ 14453]
Richard Laager <rlaager@wiktel.com>
parents: 12125
diff changeset
390 /* Screen name */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
391 dialog->screenname_entry = gtk_entry_new();
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
392
12152
cda86ce5b026 [gaim-migrate @ 14453]
Richard Laager <rlaager@wiktel.com>
parents: 12125
diff changeset
393 add_pref_box(dialog, vbox, _("Screen name:"), dialog->screenname_entry);
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
394
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
395 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed",
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
396 G_CALLBACK(screenname_changed_cb), dialog);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
397
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
398 /* Do the user split thang */
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
399 if (dialog->plugin == NULL) /* Yeah right. */
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
400 user_splits = NULL;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
401 else
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
402 user_splits = dialog->prpl_info->user_splits;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
403
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
404 if (dialog->account != NULL)
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
405 username = g_strdup(gaim_account_get_username(dialog->account));
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
406
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
407 if (dialog->user_split_entries != NULL) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
408 g_list_free(dialog->user_split_entries);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
409 dialog->user_split_entries = NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
410 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
411
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
412 for (l = user_splits; l != NULL; l = l->next) {
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
413 GaimAccountUserSplit *split = l->data;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
414 char *buf;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
415
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
416 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
417
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
418 entry = gtk_entry_new();
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
419
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
420 add_pref_box(dialog, vbox, buf, entry);
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
421
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
422 g_free(buf);
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
423
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
424 dialog->user_split_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
425 g_list_append(dialog->user_split_entries, entry);
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
426 }
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
427
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
428 for (l = g_list_last(dialog->user_split_entries),
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
429 l2 = g_list_last(user_splits);
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
430 l != NULL && l2 != NULL;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
431 l = l->prev, l2 = l2->prev) {
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
432
5708
1d5c5acfc846 [gaim-migrate @ 6129]
Christian Hammond <chipx86@chipx86.com>
parents: 5705
diff changeset
433 GtkWidget *entry = l->data;
1d5c5acfc846 [gaim-migrate @ 6129]
Christian Hammond <chipx86@chipx86.com>
parents: 5705
diff changeset
434 GaimAccountUserSplit *split = l2->data;
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
435 const char *value = NULL;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
436 char *c;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
437
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
438 if (dialog->account != NULL) {
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
439 c = strrchr(username,
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
440 gaim_account_user_split_get_separator(split));
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
441
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
442 if (c != NULL) {
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
443 *c = '\0';
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
444 c++;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
445
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
446 value = c;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
447 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
448 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
449
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
450 if (value == NULL)
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
451 value = gaim_account_user_split_get_default_value(split);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
452
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
453 if (value != NULL)
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
454 gtk_entry_set_text(GTK_ENTRY(entry), value);
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
455 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
456
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
457 if (username != NULL)
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
458 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
459
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
460 g_free(username);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
461
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
462
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
463 /* Password */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
464 dialog->password_entry = gtk_entry_new();
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
465 gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE);
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
466 gtk_entry_set_invisible_char(GTK_ENTRY(dialog->password_entry), GAIM_INVISIBLE_CHAR);
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
467 dialog->password_box = add_pref_box(dialog, vbox, _("Password:"),
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
468 dialog->password_entry);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
469
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
470 /* Alias */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
471 dialog->alias_entry = gtk_entry_new();
14025
e1fd2a8bd40b [gaim-migrate @ 16624]
Mark Doliner <mark@kingant.net>
parents: 13982
diff changeset
472 add_pref_box(dialog, vbox, _("Local alias:"), dialog->alias_entry);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
473
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
474 /* Remember Password */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
475 dialog->remember_pass_check =
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
476 gtk_check_button_new_with_label(_("Remember password"));
5783
d4171d0bc80a [gaim-migrate @ 6208]
Christian Hammond <chipx86@chipx86.com>
parents: 5782
diff changeset
477 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check),
7810
10010e717354 [gaim-migrate @ 8457]
Mark Doliner <mark@kingant.net>
parents: 7762
diff changeset
478 FALSE);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
479 gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check,
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
480 FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
481 gtk_widget_show(dialog->remember_pass_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
482
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
483 /* Set the fields. */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
484 if (dialog->account != NULL) {
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
485 if (gaim_account_get_password(dialog->account))
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
486 gtk_entry_set_text(GTK_ENTRY(dialog->password_entry),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
487 gaim_account_get_password(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
488
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
489 if (gaim_account_get_alias(dialog->account))
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
490 gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
491 gaim_account_get_alias(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
492
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
493 gtk_toggle_button_set_active(
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
494 GTK_TOGGLE_BUTTON(dialog->remember_pass_check),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
495 gaim_account_get_remember_password(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
496 }
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
497
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
498 if (dialog->prpl_info != NULL &&
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
499 (dialog->prpl_info->options & OPT_PROTO_NO_PASSWORD)) {
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
500
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
501 gtk_widget_hide(dialog->password_box);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
502 gtk_widget_hide(dialog->remember_pass_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
503 }
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
504
12555
8427ef2b4138 [gaim-migrate @ 14874]
Richard Laager <rlaager@wiktel.com>
parents: 12521
diff changeset
505 /* Do not let the user change the protocol/screenname while connected. */
8427ef2b4138 [gaim-migrate @ 14874]
Richard Laager <rlaager@wiktel.com>
parents: 12521
diff changeset
506 update_editable(NULL, dialog);
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
507 gaim_signal_connect(gaim_connections_get_handle(), "signing-on", dialog,
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
508 G_CALLBACK(update_editable), dialog);
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
509 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", dialog,
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
510 G_CALLBACK(update_editable), dialog);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
511 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
512
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
513 static void
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
514 icon_check_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog)
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
515 {
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
516 gtk_widget_set_sensitive(dialog->icon_hbox, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)));
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
517 }
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
518
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
519 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
520 add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
521 {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
522 GtkWidget *frame;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
523 GtkWidget *vbox;
9333
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
524 GtkWidget *vbox2;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
525 GtkWidget *hbox;
9333
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
526 GtkWidget *hbox2;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
527 GtkWidget *button;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
528 GtkWidget *label;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
529
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
530 if (dialog->user_frame != NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
531 gtk_widget_destroy(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
532
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
533 /* Build the user options frame. */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
534 frame = gaim_gtk_make_frame(parent, _("User Options"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
535 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
536
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
537 gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
538 gtk_widget_show(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
539
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
540 /* Main vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
541 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
542 gtk_container_add(GTK_CONTAINER(frame), vbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
543 gtk_widget_show(vbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
544
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
545 /* New mail notifications */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
546 dialog->new_mail_check =
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
547 gtk_check_button_new_with_label(_("New mail notifications"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
548 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
549 gtk_widget_show(dialog->new_mail_check);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
550
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
551 /* Buddy icon */
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
552 dialog->icon_check = gtk_check_button_new_with_label(_("Use this buddy icon for this account:"));
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
553 g_signal_connect(G_OBJECT(dialog->icon_check), "toggled", G_CALLBACK(icon_check_cb), dialog);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
554 gtk_widget_show(dialog->icon_check);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
555 gtk_box_pack_start(GTK_BOX(vbox), dialog->icon_check, FALSE, FALSE, 0);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
556
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
557 dialog->icon_hbox = hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
558 gtk_widget_set_sensitive(hbox, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)));
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
559 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
560 gtk_widget_show(hbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
561
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
562 label = gtk_label_new(" ");
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
563 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
564 gtk_widget_show(label);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
565
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
566 dialog->icon_entry = gtk_image_new();
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
567 gtk_box_pack_start(GTK_BOX(hbox), dialog->icon_entry,
9333
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
568 FALSE, FALSE, 0);
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
569 gtk_widget_show(dialog->icon_entry);
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
570 gaim_set_accessible_label (dialog->icon_entry, label);
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
571 dialog->icon_path = NULL;
9333
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
572
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
573 vbox2 = gtk_vbox_new(FALSE, 0);
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
574 gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0);
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
575 gtk_widget_show(vbox2);
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
576
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
577 hbox2 = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
578 gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, FALSE, GAIM_HIG_BORDER);
9333
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
579 gtk_widget_show(hbox2);
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
580
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
581 button = gtk_button_new_from_stock(GTK_STOCK_OPEN);
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
582 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
583 g_signal_connect(G_OBJECT(button), "clicked",
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
584 G_CALLBACK(icon_select_cb), dialog);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
585 gtk_widget_show(button);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
586
9333
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
587 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
588 g_signal_connect(G_OBJECT(button), "clicked",
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
589 G_CALLBACK(icon_reset_cb), dialog);
9333
120e0607e1cd [gaim-migrate @ 10141]
Christian Hammond <chipx86@chipx86.com>
parents: 9318
diff changeset
590 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
591 gtk_widget_show(button);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
592
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
593 if (dialog->prpl_info != NULL) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
594 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK))
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
595 gtk_widget_hide(dialog->new_mail_check);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
596
9308
b3bda982996b [gaim-migrate @ 10116]
Sean Egan <seanegan@gmail.com>
parents: 9304
diff changeset
597 if (!(dialog->prpl_info->icon_spec.format != NULL))
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
598 gtk_widget_hide(dialog->icon_hbox);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
599 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
600
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
601 if (dialog->account != NULL) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
602 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->new_mail_check),
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
603 gaim_account_get_check_mail(dialog->account));
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
604
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
605 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->icon_check),
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
606 !gaim_account_get_ui_bool(dialog->account, GAIM_GTK_UI, "use-global-buddyicon",
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
607 TRUE));
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
608
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
609 dialog->icon_path = g_strdup(gaim_account_get_ui_string(dialog->account, GAIM_GTK_UI, "non-global-buddyicon", NULL));
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
610 set_dialog_icon(dialog);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
611 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
612
7207
439b83f4a833 [gaim-migrate @ 7776]
Nathan Walp <nwalp@pidgin.im>
parents: 7179
diff changeset
613 if (!dialog->prpl_info ||
439b83f4a833 [gaim-migrate @ 7776]
Nathan Walp <nwalp@pidgin.im>
parents: 7179
diff changeset
614 (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) &&
9308
b3bda982996b [gaim-migrate @ 10116]
Sean Egan <seanegan@gmail.com>
parents: 9304
diff changeset
615 (dialog->prpl_info->icon_spec.format == NULL))) {
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
616
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
617 /* Nothing to see :( aww. */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
618 gtk_widget_hide(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
619 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
620 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
621
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
622 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
623 add_protocol_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
624 {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
625 GaimAccountOption *option;
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
626 GaimAccount *account;
12185
c42e2720fe7b [gaim-migrate @ 14487]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12172
diff changeset
627 GtkWidget *frame, *vbox, *check, *entry, *combo;
c42e2720fe7b [gaim-migrate @ 14487]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12172
diff changeset
628 const GList *list, *node;
c42e2720fe7b [gaim-migrate @ 14487]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12172
diff changeset
629 gint i, idx, int_value;
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
630 GtkListStore *model;
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
631 GtkTreeIter iter;
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
632 GtkCellRenderer *renderer;
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
633 GaimKeyValuePair *kvp;
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
634 GList *l;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
635 char buf[1024];
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
636 char *title;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
637 const char *str_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
638 gboolean bool_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
639
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
640 if (dialog->protocol_frame != NULL) {
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
641 gtk_widget_destroy(dialog->protocol_frame);
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
642 dialog->protocol_frame = NULL;
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
643 }
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
644
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
645 if (dialog->prpl_info == NULL ||
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
646 dialog->prpl_info->protocol_options == NULL) {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
647
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
648 return;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
649 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
650
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
651 account = dialog->account;
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
652
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
653 /* Build the protocol options frame. */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
654 g_snprintf(buf, sizeof(buf), _("%s Options"), dialog->plugin->info->name);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
655
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
656 frame = gaim_gtk_make_frame(parent, buf);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
657 dialog->protocol_frame =
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
658 gtk_widget_get_parent(gtk_widget_get_parent(frame));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
659
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
660 gtk_box_reorder_child(GTK_BOX(parent), dialog->protocol_frame, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
661 gtk_widget_show(dialog->protocol_frame);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
662
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
663 /* Main vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
664 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
665 gtk_container_add(GTK_CONTAINER(frame), vbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
666 gtk_widget_show(vbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
667
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
668 if (dialog->protocol_opt_entries != NULL) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
669 g_list_free(dialog->protocol_opt_entries);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
670 dialog->protocol_opt_entries = NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
671 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
672
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
673 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
674 {
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
675 option = (GaimAccountOption *)l->data;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
676
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
677 switch (gaim_account_option_get_type(option))
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
678 {
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
679 case GAIM_PREF_BOOLEAN:
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
680 if (account == NULL ||
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
681 strcmp(gaim_account_get_protocol_id(account),
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
682 dialog->protocol_id))
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
683 {
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
684 bool_value = gaim_account_option_get_default_bool(option);
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
685 }
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
686 else
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
687 {
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
688 bool_value = gaim_account_get_bool(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
689 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
690 gaim_account_option_get_default_bool(option));
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7859
diff changeset
691 }
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
692
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
693 check = gtk_check_button_new_with_label(
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
694 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
695
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
696 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
697 bool_value);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
698
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
699 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
700 gtk_widget_show(check);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
701
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
702 dialog->protocol_opt_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
703 g_list_append(dialog->protocol_opt_entries, check);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
704
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
705 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
706
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
707 case GAIM_PREF_INT:
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
708 if (account == NULL ||
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
709 strcmp(gaim_account_get_protocol_id(account),
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
710 dialog->protocol_id))
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
711 {
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
712 int_value = gaim_account_option_get_default_int(option);
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
713 }
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
714 else
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
715 {
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
716 int_value = gaim_account_get_int(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
717 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
718 gaim_account_option_get_default_int(option));
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7859
diff changeset
719 }
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
720
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
721 g_snprintf(buf, sizeof(buf), "%d", int_value);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
722
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
723 entry = gtk_entry_new();
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
724 gtk_entry_set_text(GTK_ENTRY(entry), buf);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
725
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
726 title = g_strdup_printf("%s:",
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
727 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
728
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
729 add_pref_box(dialog, vbox, title, entry);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
730
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
731 g_free(title);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
732
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
733 dialog->protocol_opt_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
734 g_list_append(dialog->protocol_opt_entries, entry);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
735
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
736 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
737
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
738 case GAIM_PREF_STRING:
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
739 if (account == NULL ||
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
740 strcmp(gaim_account_get_protocol_id(account),
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
741 dialog->protocol_id))
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
742 {
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
743 str_value = gaim_account_option_get_default_string(option);
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
744 }
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
745 else
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
746 {
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
747 str_value = gaim_account_get_string(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
748 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
749 gaim_account_option_get_default_string(option));
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7859
diff changeset
750 }
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
751
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
752 entry = gtk_entry_new();
10658
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 10649
diff changeset
753 if (gaim_account_option_get_masked(option))
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
754 {
10658
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 10649
diff changeset
755 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
756 gtk_entry_set_invisible_char(GTK_ENTRY(entry), GAIM_INVISIBLE_CHAR);
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
757 }
5663
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
758
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
759 if (str_value != NULL)
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
760 gtk_entry_set_text(GTK_ENTRY(entry), str_value);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
761
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
762 title = g_strdup_printf("%s:",
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
763 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
764
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
765 add_pref_box(dialog, vbox, title, entry);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
766
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
767 g_free(title);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
768
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
769 dialog->protocol_opt_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
770 g_list_append(dialog->protocol_opt_entries, entry);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
771
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
772 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
773
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
774 case GAIM_PREF_STRING_LIST:
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
775 i = 0;
12172
d5937f126c60 [gaim-migrate @ 14474]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12152
diff changeset
776 idx = 0;
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
777
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
778 if (account == NULL ||
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
779 strcmp(gaim_account_get_protocol_id(account),
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
780 dialog->protocol_id))
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
781 {
12172
d5937f126c60 [gaim-migrate @ 14474]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12152
diff changeset
782 str_value = gaim_account_option_get_default_list_value(option);
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
783 }
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
784 else
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
785 {
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
786 str_value = gaim_account_get_string(account,
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
787 gaim_account_option_get_setting(option),
12172
d5937f126c60 [gaim-migrate @ 14474]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12152
diff changeset
788 gaim_account_option_get_default_list_value(option));
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
789 }
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
790
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
791 list = gaim_account_option_get_list(option);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
792 model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
793 combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
794
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
795 /* Loop through list of GaimKeyValuePair items */
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
796 for (node = list; node != NULL; node = node->next) {
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
797 if (node->data != NULL) {
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
798 kvp = (GaimKeyValuePair *) node->data;
12172
d5937f126c60 [gaim-migrate @ 14474]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12152
diff changeset
799 if ((kvp->value != NULL) && (str_value != NULL) &&
d5937f126c60 [gaim-migrate @ 14474]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12152
diff changeset
800 !g_utf8_collate(kvp->value, str_value))
d5937f126c60 [gaim-migrate @ 14474]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12152
diff changeset
801 idx = i;
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
802
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
803 gtk_list_store_append(model, &iter);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
804 gtk_list_store_set(model, &iter,
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
805 0, kvp->key,
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
806 1, kvp->value,
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
807 -1);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
808 }
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
809
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
810 i++;
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
811 }
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
812
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
813 /* Set default */
12172
d5937f126c60 [gaim-migrate @ 14474]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12152
diff changeset
814 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), idx);
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
815
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
816 /* Define renderer */
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
817 renderer = gtk_cell_renderer_text_new();
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
818 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer,
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
819 TRUE);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
820 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
821 renderer, "text", 0, NULL);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
822
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
823 title = g_strdup_printf("%s:",
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
824 gaim_account_option_get_text(option));
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
825
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
826 add_pref_box(dialog, vbox, title, combo);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
827
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
828 g_free(title);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
829
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
830 dialog->protocol_opt_entries =
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
831 g_list_append(dialog->protocol_opt_entries, combo);
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
832
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
833 break;
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
834
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
835
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
836 default:
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
837 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
838 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
839 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
840 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
841
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
842 static GtkWidget *
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
843 make_proxy_dropdown(void)
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
844 {
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
845 GtkWidget *dropdown;
8555
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
846 GtkListStore *model;
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
847 GtkTreeIter iter;
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
848 GtkCellRenderer *renderer;
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
849
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
850 model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
851 dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
852
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
853 gtk_list_store_append(model, &iter);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
854 gtk_list_store_set(model, &iter,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
855 0, _("Use Global Proxy Settings"),
8581
2714e30991db [gaim-migrate @ 9331]
Christian Hammond <chipx86@chipx86.com>
parents: 8555
diff changeset
856 1, GAIM_PROXY_USE_GLOBAL,
8555
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
857 -1);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
858
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
859 gtk_list_store_append(model, &iter);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
860 gtk_list_store_set(model, &iter,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
861 0, _("No Proxy"),
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
862 1, GAIM_PROXY_NONE,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
863 -1);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
864
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
865 gtk_list_store_append(model, &iter);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
866 gtk_list_store_set(model, &iter,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
867 0, _("HTTP"),
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
868 1, GAIM_PROXY_HTTP,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
869 -1);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
870
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
871 gtk_list_store_append(model, &iter);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
872 gtk_list_store_set(model, &iter,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
873 0, _("SOCKS 4"),
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
874 1, GAIM_PROXY_SOCKS4,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
875 -1);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
876
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
877 gtk_list_store_append(model, &iter);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
878 gtk_list_store_set(model, &iter,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
879 0, _("SOCKS 5"),
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
880 1, GAIM_PROXY_SOCKS5,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
881 -1);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
882
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
883 gtk_list_store_append(model, &iter);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
884 gtk_list_store_set(model, &iter,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
885 0, _("Use Environmental Settings"),
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
886 1, GAIM_PROXY_USE_ENVVAR,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
887 -1);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
888
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
889 renderer = gtk_cell_renderer_text_new();
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
890 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
891 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
892 "text", 0, NULL);
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
893
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
894 return dropdown;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
895 }
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
896
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
897 static void
8555
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
898 proxy_type_changed_cb(GtkWidget *menu, AccountPrefsDialog *dialog)
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
899 {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
900 dialog->new_proxy_type =
8555
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
901 gtk_combo_box_get_active(GTK_COMBO_BOX(menu)) - 1;
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
902
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
903 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL ||
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6581
diff changeset
904 dialog->new_proxy_type == GAIM_PROXY_NONE ||
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6581
diff changeset
905 dialog->new_proxy_type == GAIM_PROXY_USE_ENVVAR) {
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
906
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
907 gtk_widget_hide_all(dialog->proxy_vbox);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
908 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
909 else
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
910 gtk_widget_show_all(dialog->proxy_vbox);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
911 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
912
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
913 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
914 port_popup_cb(GtkWidget *w, GtkMenu *menu, gpointer data)
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
915 {
13700
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
916 GtkWidget *item1;
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
917 GtkWidget *item2;
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
918
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
919 /* This is an easter egg.
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
920 It means one of two things, both intended as humourus:
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
921 A) your network is really slow and you have nothing better to do than
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
922 look at butterflies.
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
923 B)You are looking really closely at something that shouldn't matter. */
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
924 item1 = gtk_menu_item_new_with_label(_("If you look real closely"));
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
925
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
926 /* This is an easter egg. See the comment on the previous line in the source. */
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
927 item2 = gtk_menu_item_new_with_label(_("you can see the butterflies mating"));
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
928
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
929 gtk_widget_show(item1);
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
930 gtk_widget_show(item2);
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
931
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
932 /* Prepend these in reverse order so they appear correctly. */
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
933 gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item2);
85267a333422 [gaim-migrate @ 16103]
Richard Laager <rlaager@wiktel.com>
parents: 13639
diff changeset
934 gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item1);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
935 }
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
936
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
937 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
938 add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
939 {
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
940 GaimProxyInfo *proxy_info;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
941 GtkWidget *frame;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
942 GtkWidget *vbox;
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
943 GtkWidget *vbox2;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
944
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
945 if (dialog->proxy_frame != NULL)
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
946 gtk_widget_destroy(dialog->proxy_frame);
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
947
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
948 frame = gaim_gtk_make_frame(parent, _("Proxy Options"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
949 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
950
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
951 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
952 gtk_widget_show(dialog->proxy_frame);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
953
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
954 /* Main vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
955 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
956 gtk_container_add(GTK_CONTAINER(frame), vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
957 gtk_widget_show(vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
958
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
959 /* Proxy Type drop-down. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
960 dialog->proxy_dropdown = make_proxy_dropdown();
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
961
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
962 add_pref_box(dialog, vbox, _("Proxy _type:"), dialog->proxy_dropdown);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
963
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
964 /* Setup the second vbox, which may be hidden at times. */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
965 dialog->proxy_vbox = vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
966 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, GAIM_HIG_BORDER);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
967 gtk_widget_show(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
968
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
969 /* Host */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
970 dialog->proxy_host_entry = gtk_entry_new();
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
971 add_pref_box(dialog, vbox2, _("_Host:"), dialog->proxy_host_entry);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
972
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
973 /* Port */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
974 dialog->proxy_port_entry = gtk_entry_new();
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
975 add_pref_box(dialog, vbox2, _("_Port:"), dialog->proxy_port_entry);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
976
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
977 g_signal_connect(G_OBJECT(dialog->proxy_port_entry), "populate-popup",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
978 G_CALLBACK(port_popup_cb), NULL);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
979
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
980 /* User */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
981 dialog->proxy_user_entry = gtk_entry_new();
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
982
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
983 add_pref_box(dialog, vbox2, _("_Username:"), dialog->proxy_user_entry);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
984
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
985 /* Password */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
986 dialog->proxy_pass_entry = gtk_entry_new();
5700
ad55a15c7b93 [gaim-migrate @ 6121]
Christian Hammond <chipx86@chipx86.com>
parents: 5699
diff changeset
987 gtk_entry_set_visibility(GTK_ENTRY(dialog->proxy_pass_entry), FALSE);
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
988 gtk_entry_set_invisible_char(GTK_ENTRY(dialog->proxy_pass_entry), GAIM_INVISIBLE_CHAR);
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
989 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
990
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
991 if (dialog->account != NULL &&
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
992 (proxy_info = gaim_account_get_proxy_info(dialog->account)) != NULL) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
993
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
994 GaimProxyType type = gaim_proxy_info_get_type(proxy_info);
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
995
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
996 /* Hah! */
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6581
diff changeset
997 /* I dunno what you're laughing about, fuzz ball. */
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6581
diff changeset
998 dialog->new_proxy_type = type;
8555
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
999 gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->proxy_dropdown),
9662
cedb8474b255 [gaim-migrate @ 10510]
Luke Schierer <lschiere@pidgin.im>
parents: 9617
diff changeset
1000 type + 1);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1001
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6581
diff changeset
1002 if (type == GAIM_PROXY_USE_GLOBAL || type == GAIM_PROXY_NONE ||
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6581
diff changeset
1003 type == GAIM_PROXY_USE_ENVVAR) {
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1004 gtk_widget_hide_all(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1005 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1006 else {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1007 const char *value;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1008 int int_val;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1009
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1010 if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1011 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1012
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1013 if ((int_val = gaim_proxy_info_get_port(proxy_info)) != 0) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1014 char buf[32];
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1015
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1016 g_snprintf(buf, sizeof(buf), "%d", int_val);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1017
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1018 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
1019 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1020
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1021 if ((value = gaim_proxy_info_get_username(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1022 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_user_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1023
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1024 if ((value = gaim_proxy_info_get_password(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1025 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_pass_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1026 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1027 }
6856
a14200b24371 [gaim-migrate @ 7401]
Mark Doliner <mark@kingant.net>
parents: 6751
diff changeset
1028 else {
a14200b24371 [gaim-migrate @ 7401]
Mark Doliner <mark@kingant.net>
parents: 6751
diff changeset
1029 dialog->new_proxy_type = GAIM_PROXY_USE_GLOBAL;
8555
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
1030 gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->proxy_dropdown),
e0535ba0d667 [gaim-migrate @ 9298]
Nathan Walp <nwalp@pidgin.im>
parents: 8454
diff changeset
1031 dialog->new_proxy_type + 1);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1032 gtk_widget_hide_all(vbox2);
6856
a14200b24371 [gaim-migrate @ 7401]
Mark Doliner <mark@kingant.net>
parents: 6751
diff changeset
1033 }
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1034
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1035 /* Connect signals. */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
1036 g_signal_connect(G_OBJECT(dialog->proxy_dropdown), "changed",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1037 G_CALLBACK(proxy_type_changed_cb), dialog);
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
1038 }
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
1039
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
1040 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1041 account_win_destroy_cb(GtkWidget *w, GdkEvent *event,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1042 AccountPrefsDialog *dialog)
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1043 {
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1044 g_hash_table_remove(account_pref_wins, dialog->account);
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1045
7450
685736e14aac [gaim-migrate @ 8061]
Luke Schierer <lschiere@pidgin.im>
parents: 7269
diff changeset
1046 gtk_widget_destroy(dialog->window);
685736e14aac [gaim-migrate @ 8061]
Luke Schierer <lschiere@pidgin.im>
parents: 7269
diff changeset
1047
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
1048 g_list_free(dialog->user_split_entries);
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
1049 g_list_free(dialog->protocol_opt_entries);
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
1050 g_free(dialog->protocol_id);
5978
041b657227c4 [gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
1051
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10432
diff changeset
1052 if (dialog->icon_path != NULL)
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1053 {
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1054 const char *icon = gaim_account_get_ui_string(dialog->account, GAIM_GTK_UI, "non-global-buddyicon", NULL);
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1055 if (dialog->icon_path != NULL && (icon == NULL || strcmp(dialog->icon_path, icon)))
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1056 {
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1057 /* The user set an icon, which would've been cached by convert_buddy_icon,
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1058 * but didn't save the changes. Delete the cache file. */
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1059 char *filename = g_build_filename(gaim_buddy_icons_get_cache_dir(), dialog->icon_path, NULL);
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1060 printf("Deleting\n");
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1061 g_unlink(filename);
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1062 g_free(filename);
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1063 }
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1064
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10432
diff changeset
1065 g_free(dialog->icon_path);
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11295
diff changeset
1066 }
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10432
diff changeset
1067
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
1068 if (dialog->icon_filesel)
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
1069 gtk_widget_destroy(dialog->icon_filesel);
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
1070
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
1071 gaim_signals_disconnect_by_handle(dialog);
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
1072
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1073 g_free(dialog);
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1074 }
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1075
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1076 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1077 cancel_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1078 {
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1079 account_win_destroy_cb(NULL, NULL, dialog);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1080 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1081
7269
4fc46299e5fb [gaim-migrate @ 7846]
Nathan Walp <nwalp@pidgin.im>
parents: 7208
diff changeset
1082 static GaimAccount*
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1083 ok_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1084 {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1085 GaimProxyInfo *proxy_info = NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1086 GList *l, *l2;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1087 const char *value;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1088 char *username;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1089 char *tmp;
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1090 gboolean new = FALSE, icon_change = FALSE;
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1091 GaimAccount *account;
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1092
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1093 if (dialog->account == NULL)
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1094 {
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1095 const char *screenname;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1096
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1097 screenname = gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry));
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1098 account = gaim_account_new(screenname, dialog->protocol_id);
10932
3ad0e7351826 [gaim-migrate @ 12711]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10931
diff changeset
1099 new = TRUE;
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1100 }
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1101 else
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1102 {
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1103 account = dialog->account;
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1104
5699
3bac8b558577 [gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents: 5698
diff changeset
1105 /* Protocol */
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1106 gaim_account_set_protocol_id(account, dialog->protocol_id);
5699
3bac8b558577 [gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents: 5698
diff changeset
1107 }
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1108
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1109 /* Alias */
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1110 value = gtk_entry_get_text(GTK_ENTRY(dialog->alias_entry));
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1111
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1112 if (*value != '\0')
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1113 gaim_account_set_alias(account, value);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1114 else
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1115 gaim_account_set_alias(account, NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1116
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1117 /* Buddy Icon */
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1118 if (gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", TRUE) ==
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1119 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) {
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1120 icon_change = TRUE;
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1121 }
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1122 gaim_account_set_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)));
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1123 gaim_account_set_ui_string(account, GAIM_GTK_UI, "non-global-buddyicon", dialog->icon_path);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1124 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) {
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1125 gaim_account_set_buddy_icon(account, dialog->icon_path);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1126 } else if (gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon") && icon_change) {
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1127 char *icon = gaim_gtk_convert_buddy_icon(dialog->plugin, gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon"));
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1128 gaim_account_set_buddy_icon(account, icon);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1129 g_free(icon);
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1130 }
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
1131
10432
dc4475bf718f [gaim-migrate @ 11684]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
1132
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1133 /* Remember Password */
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1134 gaim_account_set_remember_password(account,
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1135 gtk_toggle_button_get_active(
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1136 GTK_TOGGLE_BUTTON(dialog->remember_pass_check)));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1137
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1138 /* Check Mail */
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1139 if (dialog->prpl_info && dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK)
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1140 gaim_account_set_check_mail(account,
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1141 gtk_toggle_button_get_active(
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1142 GTK_TOGGLE_BUTTON(dialog->new_mail_check)));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1143
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1144 /* Password */
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1145 value = gtk_entry_get_text(GTK_ENTRY(dialog->password_entry));
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1146
11985
41d84ac57cb6 [gaim-migrate @ 14278]
Mark Doliner <mark@kingant.net>
parents: 11789
diff changeset
1147 /*
41d84ac57cb6 [gaim-migrate @ 14278]
Mark Doliner <mark@kingant.net>
parents: 11789
diff changeset
1148 * We set the password if this is a new account because new accounts
41d84ac57cb6 [gaim-migrate @ 14278]
Mark Doliner <mark@kingant.net>
parents: 11789
diff changeset
1149 * will be set to online, and if the user has entered a password into
41d84ac57cb6 [gaim-migrate @ 14278]
Mark Doliner <mark@kingant.net>
parents: 11789
diff changeset
1150 * the account editor (but has not checked the 'save' box), then we
41d84ac57cb6 [gaim-migrate @ 14278]
Mark Doliner <mark@kingant.net>
parents: 11789
diff changeset
1151 * don't want to prompt them.
41d84ac57cb6 [gaim-migrate @ 14278]
Mark Doliner <mark@kingant.net>
parents: 11789
diff changeset
1152 */
41d84ac57cb6 [gaim-migrate @ 14278]
Mark Doliner <mark@kingant.net>
parents: 11789
diff changeset
1153 if ((gaim_account_get_remember_password(account) || new) && (*value != '\0'))
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1154 gaim_account_set_password(account, value);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1155 else
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1156 gaim_account_set_password(account, NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1157
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1158 /* Build the username string. */
5711
e33778b9d395 [gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents: 5710
diff changeset
1159 username =
e33778b9d395 [gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents: 5710
diff changeset
1160 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
1161
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1162 if (dialog->prpl_info != NULL)
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1163 {
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1164 for (l = dialog->prpl_info->user_splits,
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1165 l2 = dialog->user_split_entries;
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1166 l != NULL && l2 != NULL;
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1167 l = l->next, l2 = l2->next)
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1168 {
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1169 GaimAccountUserSplit *split = l->data;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1170 GtkEntry *entry = l2->data;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1171 char sep[2] = " ";
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1172
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1173 value = gtk_entry_get_text(entry);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1174
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1175 *sep = gaim_account_user_split_get_separator(split);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1176
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1177 tmp = g_strconcat(username, sep,
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1178 (*value ? value :
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1179 gaim_account_user_split_get_default_value(split)),
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1180 NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1181
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1182 g_free(username);
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1183 username = tmp;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1184 }
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1185 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1186
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1187 gaim_account_set_username(account, username);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1188 g_free(username);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1189
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1190 /* Add the protocol settings */
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1191 if (dialog->prpl_info) {
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1192 for (l = dialog->prpl_info->protocol_options,
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1193 l2 = dialog->protocol_opt_entries;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1194 l != NULL && l2 != NULL;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1195 l = l->next, l2 = l2->next) {
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1196
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1197 GaimPrefType type;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1198 GaimAccountOption *option = l->data;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1199 GtkWidget *widget = l2->data;
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
1200 GtkTreeIter iter;
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1201 const char *setting;
13639
43c7e892d8bf [gaim-migrate @ 16037]
Stu Tomlinson <stu@nosnilmot.com>
parents: 13221
diff changeset
1202 char *value2;
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1203 int int_value;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1204 gboolean bool_value;
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1205
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1206 type = gaim_account_option_get_type(option);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1207
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1208 setting = gaim_account_option_get_setting(option);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1209
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1210 switch (type) {
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1211 case GAIM_PREF_STRING:
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1212 value = gtk_entry_get_text(GTK_ENTRY(widget));
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1213 gaim_account_set_string(account, setting, value);
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1214 break;
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1215
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1216 case GAIM_PREF_INT:
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1217 int_value = atoi(gtk_entry_get_text(GTK_ENTRY(widget)));
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1218 gaim_account_set_int(account, setting, int_value);
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1219 break;
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1220
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1221 case GAIM_PREF_BOOLEAN:
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1222 bool_value =
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1223 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1224 gaim_account_set_bool(account, setting, bool_value);
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1225 break;
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1226
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
1227 case GAIM_PREF_STRING_LIST:
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
1228 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter);
13639
43c7e892d8bf [gaim-migrate @ 16037]
Stu Tomlinson <stu@nosnilmot.com>
parents: 13221
diff changeset
1229 gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(widget)), &iter, 1, &value2, -1);
43c7e892d8bf [gaim-migrate @ 16037]
Stu Tomlinson <stu@nosnilmot.com>
parents: 13221
diff changeset
1230 gaim_account_set_string(account, setting, value2);
43c7e892d8bf [gaim-migrate @ 16037]
Stu Tomlinson <stu@nosnilmot.com>
parents: 13221
diff changeset
1231 g_free(value2);
12106
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
1232 break;
36a0c8719af3 [gaim-migrate @ 14403]
Sean Egan <seanegan@gmail.com>
parents: 12073
diff changeset
1233
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1234 default:
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1235 break;
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1236 }
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1237 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1238 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1239
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1240 /* Set the proxy stuff. */
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6581
diff changeset
1241 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL) {
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1242 gaim_account_set_proxy_info(account, NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1243 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1244 else {
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1245 proxy_info = gaim_account_get_proxy_info(account);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1246
6344
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1247 /* Create the proxy info if it doesn't exist. */
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1248 if (proxy_info == NULL) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1249 proxy_info = gaim_proxy_info_new();
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1250 gaim_account_set_proxy_info(account, proxy_info);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1251 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1252
6344
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1253 /* Set the proxy info type. */
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1254 gaim_proxy_info_set_type(proxy_info, dialog->new_proxy_type);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1255
6344
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1256 /* Host */
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1257 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
1258
6344
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1259 if (*value != '\0')
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1260 gaim_proxy_info_set_host(proxy_info, value);
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1261 else
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1262 gaim_proxy_info_set_host(proxy_info, NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1263
6344
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1264 /* Port */
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1265 value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_port_entry));
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1266
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1267 if (*value != '\0')
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1268 gaim_proxy_info_set_port(proxy_info, atoi(value));
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1269 else
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1270 gaim_proxy_info_set_port(proxy_info, 0);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1271
6344
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1272 /* Username */
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1273 value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_user_entry));
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1274
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1275 if (*value != '\0')
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1276 gaim_proxy_info_set_username(proxy_info, value);
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1277 else
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1278 gaim_proxy_info_set_username(proxy_info, NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1279
6344
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1280 /* Password */
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1281 value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_pass_entry));
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1282
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1283 if (*value != '\0')
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1284 gaim_proxy_info_set_password(proxy_info, value);
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1285 else
f63da9023c99 [gaim-migrate @ 6843]
Christian Hammond <chipx86@chipx86.com>
parents: 6334
diff changeset
1286 gaim_proxy_info_set_password(proxy_info, NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1287 }
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1288
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1289 /* We no longer need the data from the dialog window */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1290 account_win_destroy_cb(NULL, NULL, dialog);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1291
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1292 /* If this is a new account, add it to our list */
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1293 if (new)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1294 gaim_accounts_add(account);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1295 else
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1296 gaim_signal_emit(gaim_gtk_account_get_handle(), "account-modified", account);
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1297
11987
831e52ceddf3 [gaim-migrate @ 14280]
Mark Doliner <mark@kingant.net>
parents: 11986
diff changeset
1298 /* If this is a new account, then sign on! */
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11358
diff changeset
1299 if (new) {
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
1300 const GaimSavedStatus *saved_status;
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
1301
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
1302 saved_status = gaim_savedstatus_get_current();
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
1303 if (saved_status != NULL) {
12121
943307dd6ee9 [gaim-migrate @ 14421]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12106
diff changeset
1304 gaim_savedstatus_activate_for_account(saved_status, account);
943307dd6ee9 [gaim-migrate @ 14421]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12106
diff changeset
1305 gaim_account_set_enabled(account, GAIM_GTK_UI, TRUE);
943307dd6ee9 [gaim-migrate @ 14421]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12106
diff changeset
1306 }
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11358
diff changeset
1307 }
10932
3ad0e7351826 [gaim-migrate @ 12711]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10931
diff changeset
1308
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11733
diff changeset
1309 return account;
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1310 }
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1311
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1312 static void
5851
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1313 register_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1314 {
7269
4fc46299e5fb [gaim-migrate @ 7846]
Nathan Walp <nwalp@pidgin.im>
parents: 7208
diff changeset
1315 GaimAccount *account = ok_account_prefs_cb(NULL, dialog);
5851
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1316
7269
4fc46299e5fb [gaim-migrate @ 7846]
Nathan Walp <nwalp@pidgin.im>
parents: 7208
diff changeset
1317 gaim_account_register(account);
5851
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1318 }
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1319
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1320
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1321 static const GtkTargetEntry dnd_targets[] = {
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1322 {"text/plain", 0, 0},
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1323 {"text/uri-list", 0, 1},
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1324 {"STRING", 0, 2}
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1325 };
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1326
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1327 void
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1328 gaim_gtk_account_dialog_show(GaimGtkAccountDialogType type,
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1329 GaimAccount *account)
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1330 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1331 AccountPrefsDialog *dialog;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1332 GtkWidget *win;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1333 GtkWidget *main_vbox;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1334 GtkWidget *vbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1335 GtkWidget *bbox;
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1336 GtkWidget *dbox;
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
1337 GtkWidget *notebook;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1338 GtkWidget *button;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1339
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1340 if (accounts_window != NULL && account != NULL &&
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1341 (dialog = g_hash_table_lookup(account_pref_wins, account)) != NULL)
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1342 {
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1343 gtk_window_present(GTK_WINDOW(dialog->window));
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1344 return;
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1345 }
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1346
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1347 dialog = g_new0(AccountPrefsDialog, 1);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1348
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1349 if (accounts_window != NULL && account != NULL)
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1350 {
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1351 g_hash_table_insert(account_pref_wins, account, dialog);
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1352 }
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1353
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1354 dialog->account = account;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1355 dialog->type = type;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1356 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1357
9971
ab5db2c5da79 [gaim-migrate @ 10882]
Mark Doliner <mark@kingant.net>
parents: 9944
diff changeset
1358 if (dialog->account == NULL) {
ab5db2c5da79 [gaim-migrate @ 10882]
Mark Doliner <mark@kingant.net>
parents: 9944
diff changeset
1359 /* Select the first prpl in the list*/
ab5db2c5da79 [gaim-migrate @ 10882]
Mark Doliner <mark@kingant.net>
parents: 9944
diff changeset
1360 GList *prpl_list = gaim_plugins_get_protocols();
ab5db2c5da79 [gaim-migrate @ 10882]
Mark Doliner <mark@kingant.net>
parents: 9944
diff changeset
1361 if (prpl_list != NULL)
10014
41ef089e3df8 [gaim-migrate @ 10932]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
1362 dialog->protocol_id = g_strdup(((GaimPlugin *) prpl_list->data)->info->id);
9971
ab5db2c5da79 [gaim-migrate @ 10882]
Mark Doliner <mark@kingant.net>
parents: 9944
diff changeset
1363 }
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1364 else
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1365 {
5978
041b657227c4 [gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
1366 dialog->protocol_id =
041b657227c4 [gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
1367 g_strdup(gaim_account_get_protocol_id(dialog->account));
041b657227c4 [gaim-migrate @ 6425]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
1368 }
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1369
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7859
diff changeset
1370 if ((dialog->plugin = gaim_find_prpl(dialog->protocol_id)) != NULL)
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1371 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1372
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1373
5661
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
1374 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1375 gtk_window_set_role(GTK_WINDOW(win), "account");
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1376
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1377 if (type == GAIM_GTK_ADD_ACCOUNT_DIALOG)
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1378 gtk_window_set_title(GTK_WINDOW(win), _("Add Account"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1379 else
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1380 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1381
5661
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
1382 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
1383
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1384 gtk_container_set_border_width(GTK_CONTAINER(win), GAIM_HIG_BORDER);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1385
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1386 g_signal_connect(G_OBJECT(win), "delete_event",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1387 G_CALLBACK(account_win_destroy_cb), dialog);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1388
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1389 /* Setup the vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1390 main_vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER);
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1391 gtk_container_add(GTK_CONTAINER(win), main_vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1392 gtk_widget_show(main_vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1393
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
1394 notebook = gtk_notebook_new();
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
1395 gtk_box_pack_start(GTK_BOX(main_vbox), notebook, FALSE, FALSE, 0);
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11358
diff changeset
1396 gtk_widget_show(GTK_WIDGET(notebook));
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
1397
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1398 /* Setup the inner vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1399 dialog->top_vbox = vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER);
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1400 gtk_container_set_border_width(GTK_CONTAINER(vbox), GAIM_HIG_BORDER);
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
1401 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
12240
1c0fd404e07e [gaim-migrate @ 14542]
Mark Doliner <mark@kingant.net>
parents: 12185
diff changeset
1402 gtk_label_new_with_mnemonic(_("_Basic")));
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1403 gtk_widget_show(vbox);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1404
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1405 /* Setup the top frames. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1406 add_login_options(dialog, vbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1407 add_user_options(dialog, vbox);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1408
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
1409 /* Setup the page with 'Advanced'. */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1410 dialog->bottom_vbox = dbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER);
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1411 gtk_container_set_border_width(GTK_CONTAINER(dbox), GAIM_HIG_BORDER);
11008
845a0dd5ca45 [gaim-migrate @ 12868]
Mark Doliner <mark@kingant.net>
parents: 10967
diff changeset
1412 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dbox,
12240
1c0fd404e07e [gaim-migrate @ 14542]
Mark Doliner <mark@kingant.net>
parents: 12185
diff changeset
1413 gtk_label_new_with_mnemonic(_("_Advanced")));
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11358
diff changeset
1414 gtk_widget_show(dbox);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1415
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1416 /** Setup the bottom frames. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1417 add_protocol_options(dialog, dbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1418 add_proxy_options(dialog, dbox);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1419
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1420 /* Setup the button box */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1421 bbox = gtk_hbutton_box_new();
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1422 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1423 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
1424 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
1425 gtk_widget_show(bbox);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1426
6141
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1427 /* Register button */
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1428 button = gtk_button_new_with_label(_("Register"));
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1429 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1430 gtk_widget_show(button);
5850
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1431
6141
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1432 g_signal_connect(G_OBJECT(button), "clicked",
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1433 G_CALLBACK(register_account_prefs_cb), dialog);
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1434
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1435 dialog->register_button = button;
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1436
6732
c49f232b6bd0 [gaim-migrate @ 7259]
Nathan Walp <nwalp@pidgin.im>
parents: 6623
diff changeset
1437 if (dialog->account == NULL)
c49f232b6bd0 [gaim-migrate @ 7259]
Nathan Walp <nwalp@pidgin.im>
parents: 6623
diff changeset
1438 gtk_widget_set_sensitive(button, FALSE);
c49f232b6bd0 [gaim-migrate @ 7259]
Nathan Walp <nwalp@pidgin.im>
parents: 6623
diff changeset
1439
7208
e5a03ffc6c26 [gaim-migrate @ 7777]
Nathan Walp <nwalp@pidgin.im>
parents: 7207
diff changeset
1440 if (!dialog->prpl_info || !dialog->prpl_info->register_user)
6141
387221e0623f [gaim-migrate @ 6615]
Nathan Walp <nwalp@pidgin.im>
parents: 6123
diff changeset
1441 gtk_widget_hide(button);
5850
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1442
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1443 /* Cancel button */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1444 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1445 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1446 gtk_widget_show(button);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1447
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1448 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1449 G_CALLBACK(cancel_account_prefs_cb), dialog);
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1450
5850
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1451 /* Save button */
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1452 button = gtk_button_new_from_stock(GTK_STOCK_SAVE);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1453 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
1454
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1455 if (dialog->account == NULL)
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1456 gtk_widget_set_sensitive(button, FALSE);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1457
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1458 gtk_widget_show(button);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1459
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1460 dialog->ok_button = button;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1461
9314
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1462 /* Set up DND */
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1463 gtk_drag_dest_set(dialog->window,
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1464 GTK_DEST_DEFAULT_MOTION |
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1465 GTK_DEST_DEFAULT_DROP,
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1466 dnd_targets,
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1467 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1468 GDK_ACTION_COPY);
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1469
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1470 g_signal_connect(G_OBJECT(dialog->window), "drag_data_received",
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1471 G_CALLBACK(account_dnd_recv), dialog);
74728ac40475 [gaim-migrate @ 10122]
Sean Egan <seanegan@gmail.com>
parents: 9312
diff changeset
1472
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1473 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1474 G_CALLBACK(ok_account_prefs_cb), dialog);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1475
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1476 /* Show the window. */
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
1477 gtk_widget_show(win);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1478 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1479
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1480 /**************************************************************************
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1481 * Accounts Dialog
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1482 **************************************************************************/
7179
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1483 static void
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1484 signed_on_off_cb(GaimConnection *gc, gpointer user_data)
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1485 {
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1486 GaimAccount *account;
7179
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1487 GaimGtkPulseData *pulse_data;
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1488 GtkTreeModel *model;
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1489 GtkTreeIter iter;
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1490 GdkPixbuf *pixbuf;
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1491 size_t index;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1492
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1493 /* Don't need to do anything if the accounts window is not visible */
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1494 if (accounts_window == NULL)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1495 return;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1496
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1497 account = gaim_connection_get_account(gc);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1498 model = GTK_TREE_MODEL(accounts_window->model);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1499 index = g_list_index(gaim_accounts_get_all(), account);
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1500
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
1501 if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index))
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
1502 {
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1503 gtk_tree_model_get(GTK_TREE_MODEL(accounts_window->model), &iter,
7179
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1504 COLUMN_PULSE_DATA, &pulse_data, -1);
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1505
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1506 if (pulse_data != NULL)
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1507 {
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1508 if (pulse_data->timeout > 0)
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1509 g_source_remove(pulse_data->timeout);
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1510
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1511 g_object_unref(G_OBJECT(pulse_data->online_pixbuf));
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1512
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1513 g_free(pulse_data);
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1514 }
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
1515
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1516 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1517 if ((pixbuf != NULL) && gaim_account_is_disconnected(account))
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1518 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1519
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1520 gtk_list_store_set(accounts_window->model, &iter,
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1521 COLUMN_ICON, pixbuf,
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1522 COLUMN_PULSE_DATA, NULL,
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1523 -1);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1524
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
1525
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
1526 if (pixbuf != NULL)
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1527 g_object_unref(G_OBJECT(pixbuf));
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1528 }
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1529 }
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1530
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1531 /*
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1532 * Get the GtkTreeIter of the specified account in the
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1533 * GtkListStore
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1534 */
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1535 static gboolean
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1536 accounts_window_find_account_in_treemodel(GtkTreeIter *iter, GaimAccount *account)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1537 {
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1538 GtkTreeModel *model;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1539 GaimAccount *cur;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1540
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1541 g_return_val_if_fail(account != NULL, FALSE);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1542 g_return_val_if_fail(accounts_window != NULL, FALSE);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1543
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1544 model = GTK_TREE_MODEL(accounts_window->model);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1545
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1546 if (!gtk_tree_model_get_iter_first(model, iter))
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1547 return FALSE;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1548
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1549 gtk_tree_model_get(model, iter, COLUMN_DATA, &cur, -1);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1550 if (cur == account)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1551 return TRUE;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1552
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1553 while (gtk_tree_model_iter_next(model, iter))
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1554 {
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1555 gtk_tree_model_get(model, iter, COLUMN_DATA, &cur, -1);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1556 if (cur == account)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1557 return TRUE;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1558 }
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1559
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1560 return FALSE;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1561 }
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1562
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1563 static void
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1564 account_removed_cb(GaimAccount *account, gpointer user_data)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1565 {
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1566 AccountPrefsDialog *dialog;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1567 GtkTreeIter iter;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1568
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1569 /* If the account was being modified, close the edit window */
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1570 if ((dialog = g_hash_table_lookup(account_pref_wins, account)) != NULL)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1571 account_win_destroy_cb(NULL, NULL, dialog);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1572
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1573 if (accounts_window == NULL)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1574 return;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1575
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1576 /* Remove the account from the GtkListStore */
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1577 if (accounts_window_find_account_in_treemodel(&iter, account))
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1578 gtk_list_store_remove(accounts_window->model, &iter);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1579 }
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1580
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1581 static void
12070
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1582 account_abled_cb(GaimAccount *account, gpointer user_data)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1583 {
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1584 GtkTreeIter iter;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1585
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1586 if (accounts_window == NULL)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1587 return;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1588
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1589 /* update the account in the GtkListStore */
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1590 if (accounts_window_find_account_in_treemodel(&iter, account))
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1591 gtk_list_store_set(accounts_window->model, &iter,
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1592 COLUMN_ENABLED, GPOINTER_TO_INT(user_data),
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1593 -1);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1594 }
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1595
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
1596 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1597 drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1598 GtkSelectionData *data, guint info, guint time,
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1599 AccountsWindow *dialog)
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1600 {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1601 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1602 GtkTreeRowReference *ref;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1603 GtkTreePath *source_row;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1604 GtkTreeIter iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1605 GaimAccount *account = NULL;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12555
diff changeset
1606 GValue val;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1607
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1608 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
1609 source_row = gtk_tree_row_reference_get_path(ref);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1610
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1611 if (source_row == NULL)
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1612 return;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1613
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1614 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1615 source_row);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12555
diff changeset
1616 val.g_type = 0;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1617 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1618 COLUMN_DATA, &val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1619
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1620 dialog->drag_iter = iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1621
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1622 account = g_value_get_pointer(&val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1623
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1624 gtk_selection_data_set(data, gdk_atom_intern("GAIM_ACCOUNT", FALSE),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1625 8, (void *)&account, sizeof(account));
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1626
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1627 gtk_tree_path_free(source_row);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1628 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1629 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1630
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1631 static void
5802
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1632 move_account_after(GtkListStore *store, GtkTreeIter *iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1633 GtkTreeIter *position)
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1634 {
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1635 GtkTreeIter new_iter;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1636 GaimAccount *account;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1637
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1638 gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1639 COLUMN_DATA, &account,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1640 -1);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1641
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1642 gtk_list_store_insert_after(store, &new_iter, position);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1643
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1644 set_account(store, &new_iter, account);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1645
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1646 gtk_list_store_remove(store, iter);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1647 }
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1648
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1649 static void
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1650 move_account_before(GtkListStore *store, GtkTreeIter *iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1651 GtkTreeIter *position)
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1652 {
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1653 GtkTreeIter new_iter;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1654 GaimAccount *account;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1655
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1656 gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1657 COLUMN_DATA, &account,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1658 -1);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1659
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1660 gtk_list_store_insert_before(store, &new_iter, position);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1661
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1662 set_account(store, &new_iter, account);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1663
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1664 gtk_list_store_remove(store, iter);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1665 }
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1666
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1667 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1668 drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1669 guint x, guint y, GtkSelectionData *sd,
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1670 guint info, guint t, AccountsWindow *dialog)
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1671 {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1672 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) {
12420
b7d77321b685 [gaim-migrate @ 14727]
Richard Laager <rlaager@wiktel.com>
parents: 12376
diff changeset
1673 gint dest_index;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1674 GaimAccount *a = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1675 GtkTreePath *path = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1676 GtkTreeViewDropPosition position;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1677
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1678 memcpy(&a, sd->data, sizeof(a));
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1679
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1680 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
1681 &path, &position)) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1682
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1683 GtkTreeIter iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1684 GaimAccount *account;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12555
diff changeset
1685 GValue val;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1686
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1687 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12555
diff changeset
1688 val.g_type = 0;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1689 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1690 COLUMN_DATA, &val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1691
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1692 account = g_value_get_pointer(&val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1693
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1694 switch (position) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1695 case GTK_TREE_VIEW_DROP_AFTER:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1696 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
5802
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1697 move_account_after(dialog->model, &dialog->drag_iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1698 &iter);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1699 dest_index = g_list_index(gaim_accounts_get_all(),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1700 account) + 1;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1701 break;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1702
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1703 case GTK_TREE_VIEW_DROP_BEFORE:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1704 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1705 dest_index = g_list_index(gaim_accounts_get_all(),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1706 account);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1707
5802
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1708 move_account_before(dialog->model, &dialog->drag_iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1709 &iter);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1710 break;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1711
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1712 default:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1713 return;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1714 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1715
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1716 gaim_accounts_reorder(a, dest_index);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1717 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1718 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1719 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1720
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1721 static gint
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1722 accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsWindow *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1723 {
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1724 gaim_gtk_accounts_window_hide();
7159
669af8c0801a [gaim-migrate @ 7726]
Mark Doliner <mark@kingant.net>
parents: 7107
diff changeset
1725
6123
adabfcf8abe1 [gaim-migrate @ 6597]
Mark Doliner <mark@kingant.net>
parents: 6122
diff changeset
1726 return 0;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1727 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1728
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1729 static gboolean
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1730 configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsWindow *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1731 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1732 if (GTK_WIDGET_VISIBLE(w)) {
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1733 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
1734 int col_width;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1735 int difference;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1736
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1737 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1738 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
1739
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1740 col_width = gtk_tree_view_column_get_width(dialog->screenname_col);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1741
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1742 if (col_width == 0)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1743 return FALSE;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1744
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1745 difference = (MAX(old_width, event->width) -
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1746 MIN(old_width, event->width));
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1747
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1748 if (difference == 0)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1749 return FALSE;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1750
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1751 if (old_width < event->width)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1752 gtk_tree_view_column_set_min_width(dialog->screenname_col,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1753 col_width + difference);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1754 else
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1755 gtk_tree_view_column_set_max_width(dialog->screenname_col,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1756 col_width - difference);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1757 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1758
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1759 return FALSE;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1760 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1761
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1762 static void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1763 add_account_cb(GtkWidget *w, AccountsWindow *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1764 {
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1765 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
1766 }
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1767
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1768 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1769 modify_account_sel(GtkTreeModel *model, GtkTreePath *path,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1770 GtkTreeIter *iter, gpointer data)
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1771 {
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1772 GaimAccount *account;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1773
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1774 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1775
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1776 if (account != NULL)
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1777 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
1778 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1779
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1780 static void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1781 modify_account_cb(GtkWidget *w, AccountsWindow *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1782 {
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1783 GtkTreeSelection *selection;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1784
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1785 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1786
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1787 gtk_tree_selection_selected_foreach(selection, modify_account_sel, dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1788 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1789
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1790 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1791 delete_account_cb(GaimAccount *account)
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1792 {
6368
41e6d15f4687 [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6344
diff changeset
1793 gaim_accounts_delete(account);
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1794 }
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1795
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1796 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1797 ask_delete_account_sel(GtkTreeModel *model, GtkTreePath *path,
8405
1c4402a2ac71 [gaim-migrate @ 9135]
Christian Hammond <chipx86@chipx86.com>
parents: 8363
diff changeset
1798 GtkTreeIter *iter, gpointer data)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1799 {
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1800 GaimAccount *account;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1801
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1802 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1803
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1804 if (account != NULL) {
7677
1f035c12f6f5 [gaim-migrate @ 8321]
Mark Doliner <mark@kingant.net>
parents: 7480
diff changeset
1805 char *buf;
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1806
7677
1f035c12f6f5 [gaim-migrate @ 8321]
Mark Doliner <mark@kingant.net>
parents: 7480
diff changeset
1807 buf = g_strdup_printf(_("Are you sure you want to delete %s?"),
1f035c12f6f5 [gaim-migrate @ 8321]
Mark Doliner <mark@kingant.net>
parents: 7480
diff changeset
1808 gaim_account_get_username(account));
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1809
9814
aaef48dc13a9 [gaim-migrate @ 10685]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1810 gaim_request_close_with_handle(account);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10014
diff changeset
1811 gaim_request_action(account, NULL, buf, NULL, 0, account, 2,
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1812 _("Delete"), delete_account_cb,
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1813 _("Cancel"), NULL);
7677
1f035c12f6f5 [gaim-migrate @ 8321]
Mark Doliner <mark@kingant.net>
parents: 7480
diff changeset
1814 g_free(buf);
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1815 }
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1816 }
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1817
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1818 static void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1819 ask_delete_account_cb(GtkWidget *w, AccountsWindow *dialog)
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1820 {
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1821 GtkTreeSelection *selection;
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1822
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1823 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1824
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1825 gtk_tree_selection_selected_foreach(selection, ask_delete_account_sel,
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1826 dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1827 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1828
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1829 static void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1830 close_accounts_cb(GtkWidget *w, AccountsWindow *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1831 {
5617
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1832 gtk_widget_destroy(dialog->window);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1833
7159
669af8c0801a [gaim-migrate @ 7726]
Mark Doliner <mark@kingant.net>
parents: 7107
diff changeset
1834 gaim_gtk_accounts_window_hide();
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1835 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1836
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1837
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1838 static void
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1839 enabled_cb(GtkCellRendererToggle *renderer, gchar *path_str,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1840 gpointer data)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1841 {
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1842 AccountsWindow *dialog = (AccountsWindow *)data;
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1843 GaimAccount *account;
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1844 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model);
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1845 GtkTreeIter iter;
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1846 gboolean enabled;
11724
a8ec0a291d14 [gaim-migrate @ 14015]
Mark Doliner <mark@kingant.net>
parents: 11654
diff changeset
1847 const GaimSavedStatus *saved_status;
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1848
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1849 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1850 gtk_tree_model_get(model, &iter,
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1851 COLUMN_DATA, &account,
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1852 COLUMN_ENABLED, &enabled,
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1853 -1);
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1854
13982
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1855 /*
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1856 * If we just enabled the account, then set the statuses
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1857 * to the current status.
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1858 */
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1859 if (!enabled)
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1860 {
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1861 saved_status = gaim_savedstatus_get_current();
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1862 gaim_savedstatus_activate_for_account(saved_status, account);
052aee037835 [gaim-migrate @ 16550]
Mark Doliner <mark@kingant.net>
parents: 13773
diff changeset
1863 }
11724
a8ec0a291d14 [gaim-migrate @ 14015]
Mark Doliner <mark@kingant.net>
parents: 11654
diff changeset
1864
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1865 gaim_account_set_enabled(account, GAIM_GTK_UI, !enabled);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1866 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1867
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1868 static void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1869 add_columns(GtkWidget *treeview, AccountsWindow *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1870 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1871 GtkCellRenderer *renderer;
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1872 GtkTreeViewColumn *column;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1873
10159
952fb08c60b0 [gaim-migrate @ 11240]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
1874 /* Screen Name column */
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1875 column = gtk_tree_view_column_new();
6623
156e6643f9db [gaim-migrate @ 7147]
Luke Schierer <lschiere@pidgin.im>
parents: 6621
diff changeset
1876 gtk_tree_view_column_set_title(column, _("Screen Name"));
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1877 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
9519
8cd47267c5bd [gaim-migrate @ 10346]
Luke Schierer <lschiere@pidgin.im>
parents: 9496
diff changeset
1878 gtk_tree_view_column_set_resizable(column, TRUE);
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1879
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1880 /* Icon */
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1881 renderer = gtk_cell_renderer_pixbuf_new();
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1882 gtk_tree_view_column_pack_start(column, renderer, FALSE);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1883 gtk_tree_view_column_add_attribute(column, renderer,
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1884 "pixbuf", COLUMN_ICON);
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1885
10159
952fb08c60b0 [gaim-migrate @ 11240]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
1886 /* Screen Name */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1887 renderer = gtk_cell_renderer_text_new();
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1888 gtk_tree_view_column_pack_start(column, renderer, TRUE);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1889 gtk_tree_view_column_add_attribute(column, renderer,
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1890 "text", COLUMN_SCREENNAME);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1891 dialog->screenname_col = column;
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1892
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1893 /* Enabled */
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1894 renderer = gtk_cell_renderer_toggle_new();
5782
087b4b5abe35 [gaim-migrate @ 6207]
Christian Hammond <chipx86@chipx86.com>
parents: 5781
diff changeset
1895
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1896 g_signal_connect(G_OBJECT(renderer), "toggled",
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1897 G_CALLBACK(enabled_cb), dialog);
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1898
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1899 column = gtk_tree_view_column_new_with_attributes(_("Enabled"),
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1900 renderer, "active", COLUMN_ENABLED, NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1901
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1902 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
9519
8cd47267c5bd [gaim-migrate @ 10346]
Luke Schierer <lschiere@pidgin.im>
parents: 9496
diff changeset
1903 gtk_tree_view_column_set_resizable(column, TRUE);
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1904
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1905 /* Protocol name */
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1906 column = gtk_tree_view_column_new();
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1907 gtk_tree_view_column_set_title(column, _("Protocol"));
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1908 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
9519
8cd47267c5bd [gaim-migrate @ 10346]
Luke Schierer <lschiere@pidgin.im>
parents: 9496
diff changeset
1909 gtk_tree_view_column_set_resizable(column, TRUE);
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1910
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1911 renderer = gtk_cell_renderer_text_new();
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1912 gtk_tree_view_column_pack_start(column, renderer, TRUE);
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1913 gtk_tree_view_column_add_attribute(column, renderer,
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1914 "text", COLUMN_PROTOCOL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1915 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1916
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1917 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1918 set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account)
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1919 {
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1920 GdkPixbuf *pixbuf;
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1921
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1922 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1923 if ((pixbuf != NULL) && gaim_account_is_disconnected(account))
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1924 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
6751
35b01b371785 [gaim-migrate @ 7283]
Christian Hammond <chipx86@chipx86.com>
parents: 6732
diff changeset
1925
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1926 gtk_list_store_set(store, iter,
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1927 COLUMN_ICON, pixbuf,
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1928 COLUMN_SCREENNAME, gaim_account_get_username(account),
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
1929 COLUMN_ENABLED, gaim_account_get_enabled(account, GAIM_GTK_UI),
9699
267eab8f3fa4 [gaim-migrate @ 10558]
Mark Doliner <mark@kingant.net>
parents: 9662
diff changeset
1930 COLUMN_PROTOCOL, gaim_account_get_protocol_name(account),
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1931 COLUMN_DATA, account,
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1932 -1);
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1933
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1934 if (pixbuf != NULL)
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13014
diff changeset
1935 g_object_unref(G_OBJECT(pixbuf));
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1936 }
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1937
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1938 static void
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1939 add_account_to_liststore(GaimAccount *account, gpointer user_data)
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1940 {
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1941 GtkTreeIter iter;
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1942
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1943 if (accounts_window == NULL)
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1944 return;
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1945
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1946 gtk_list_store_append(accounts_window->model, &iter);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1947
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1948 set_account(accounts_window->model, &iter, account);
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1949 }
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1950
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1951 static void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1952 populate_accounts_list(AccountsWindow *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1953 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1954 GList *l;
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 gtk_list_store_clear(dialog->model);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1957
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1958 for (l = gaim_accounts_get_all(); l != NULL; l = l->next)
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
1959 add_account_to_liststore((GaimAccount *)l->data, NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1960 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1961
8406
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1962 #if !GTK_CHECK_VERSION(2,2,0)
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1963 static void
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1964 get_selected_helper(GtkTreeModel *model, GtkTreePath *path,
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1965 GtkTreeIter *iter, gpointer user_data)
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1966 {
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1967 *((gboolean *)user_data) = TRUE;
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1968 }
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1969 #endif
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1970
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1971 static void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
1972 account_selected_cb(GtkTreeSelection *sel, AccountsWindow *dialog)
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1973 {
8406
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1974 gboolean selected = FALSE;
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1975
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1976 #if GTK_CHECK_VERSION(2,2,0)
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1977 selected = (gtk_tree_selection_count_selected_rows(sel) > 0);
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1978 #else
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1979 gtk_tree_selection_selected_foreach(sel, get_selected_helper, &selected);
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1980 #endif
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1981
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1982 gtk_widget_set_sensitive(dialog->modify_button, selected);
f8b8ee06f26c [gaim-migrate @ 9136]
Christian Hammond <chipx86@chipx86.com>
parents: 8405
diff changeset
1983 gtk_widget_set_sensitive(dialog->delete_button, selected);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1984 }
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1985
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1986 static gboolean
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1987 account_treeview_double_click_cb(GtkTreeView *treeview, GdkEventButton *event, gpointer user_data)
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1988 {
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1989 AccountsWindow *dialog;
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1990 GtkTreePath *path;
11113
a5efa067eaca [gaim-migrate @ 13166]
Richard Laager <rlaager@wiktel.com>
parents: 11037
diff changeset
1991 GtkTreeViewColumn *column;
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1992 GtkTreeIter iter;
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1993 GaimAccount *account;
11113
a5efa067eaca [gaim-migrate @ 13166]
Richard Laager <rlaager@wiktel.com>
parents: 11037
diff changeset
1994 const gchar *title;
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1995
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1996 dialog = (AccountsWindow *)user_data;
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1997
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
1998 /* Figure out which node was clicked */
11113
a5efa067eaca [gaim-migrate @ 13166]
Richard Laager <rlaager@wiktel.com>
parents: 11037
diff changeset
1999 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(dialog->treeview), event->x, event->y, &path, &column, NULL, NULL))
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2000 return FALSE;
11113
a5efa067eaca [gaim-migrate @ 13166]
Richard Laager <rlaager@wiktel.com>
parents: 11037
diff changeset
2001 title = gtk_tree_view_column_get_title(column);
12671
c8afbc1bf98b [gaim-migrate @ 15014]
Richard Laager <rlaager@wiktel.com>
parents: 12601
diff changeset
2002 /* The -1 is required because the first two columns of the list
c8afbc1bf98b [gaim-migrate @ 15014]
Richard Laager <rlaager@wiktel.com>
parents: 12601
diff changeset
2003 * store are displayed as only one column in the tree view. */
c8afbc1bf98b [gaim-migrate @ 15014]
Richard Laager <rlaager@wiktel.com>
parents: 12601
diff changeset
2004 column = gtk_tree_view_get_column(treeview, COLUMN_ENABLED-1);
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2005 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path);
10641
5564a3066387 [gaim-migrate @ 12149]
Mark Doliner <mark@kingant.net>
parents: 10640
diff changeset
2006 gtk_tree_path_free(path);
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2007 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, COLUMN_DATA, &account, -1);
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2008
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2009 if ((account != NULL) && (event->button == 1) &&
12121
943307dd6ee9 [gaim-migrate @ 14421]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12106
diff changeset
2010 (event->type == GDK_2BUTTON_PRESS) &&
11113
a5efa067eaca [gaim-migrate @ 13166]
Richard Laager <rlaager@wiktel.com>
parents: 11037
diff changeset
2011 (strcmp(gtk_tree_view_column_get_title(column), title)))
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2012 {
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2013 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account);
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2014 return TRUE;
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2015 }
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2016
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2017 return FALSE;
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2018 }
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2019
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2020 static GtkWidget *
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2021 create_accounts_list(AccountsWindow *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2022 {
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2023 GtkWidget *sw;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2024 GtkWidget *treeview;
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
2025 GtkTreeSelection *sel;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2026 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}};
5569
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 /* Create the scrolled window. */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2029 sw = gtk_scrolled_window_new(0, 0);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2030 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
13773
3ac2d64a74a0 [gaim-migrate @ 16185]
Richard Laager <rlaager@wiktel.com>
parents: 13700
diff changeset
2031 GTK_POLICY_AUTOMATIC,
3ac2d64a74a0 [gaim-migrate @ 16185]
Richard Laager <rlaager@wiktel.com>
parents: 13700
diff changeset
2032 GTK_POLICY_AUTOMATIC);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2033 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
13773
3ac2d64a74a0 [gaim-migrate @ 16185]
Richard Laager <rlaager@wiktel.com>
parents: 13700
diff changeset
2034 GTK_SHADOW_IN);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2035 gtk_widget_show(sw);
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 /* Create the list model. */
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
2038 dialog->model = gtk_list_store_new(NUM_COLUMNS,
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
2039 GDK_TYPE_PIXBUF, G_TYPE_STRING,
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10315
diff changeset
2040 G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER,
7179
819905ce7bc0 [gaim-migrate @ 7747]
Christian Hammond <chipx86@chipx86.com>
parents: 7159
diff changeset
2041 G_TYPE_POINTER);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2042
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2043 /* And now the actual treeview */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2044 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
2045 dialog->treeview = treeview;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2046 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10413
diff changeset
2047
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10413
diff changeset
2048 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10413
diff changeset
2049 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10413
diff changeset
2050 g_signal_connect(G_OBJECT(sel), "changed",
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10413
diff changeset
2051 G_CALLBACK(account_selected_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2052
10640
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2053 /* Handle double-clicking */
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2054 g_signal_connect(G_OBJECT(treeview), "button_press_event",
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2055 G_CALLBACK(account_treeview_double_click_cb), dialog);
43ab987a0222 [gaim-migrate @ 12145]
Mark Doliner <mark@kingant.net>
parents: 10605
diff changeset
2056
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2057 gtk_container_add(GTK_CONTAINER(sw), treeview);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2058 gtk_widget_show(treeview);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2059
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2060 add_columns(treeview, dialog);
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
2061
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2062 populate_accounts_list(dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2063
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2064 /* Setup DND. I wanna be an orc! */
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2065 gtk_tree_view_enable_model_drag_source(
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2066 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte,
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
2067 1, GDK_ACTION_COPY);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2068 gtk_tree_view_enable_model_drag_dest(
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
2069 GTK_TREE_VIEW(treeview), gte, 1,
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2070 GDK_ACTION_COPY | GDK_ACTION_MOVE);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2071
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2072 g_signal_connect(G_OBJECT(treeview), "drag-data-received",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2073 G_CALLBACK(drag_data_received_cb), dialog);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2074 g_signal_connect(G_OBJECT(treeview), "drag-data-get",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2075 G_CALLBACK(drag_data_get_cb), dialog);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
2076
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2077 return sw;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2078 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2079
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2080 static void
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2081 account_modified_cb(GaimAccount *account, AccountsWindow *window)
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2082 {
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2083 GtkTreeIter iter;
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2084
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2085 if (!accounts_window_find_account_in_treemodel(&iter, account))
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2086 return;
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2087
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2088 set_account(window->model, &iter, account);
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2089 }
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2090
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2091 void
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2092 gaim_gtk_accounts_window_show(void)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2093 {
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2094 AccountsWindow *dialog;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2095 GtkWidget *win;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2096 GtkWidget *vbox;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2097 GtkWidget *bbox;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2098 GtkWidget *sw;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2099 GtkWidget *button;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2100 int width, height;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2101
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
2102 if (accounts_window != NULL) {
9482
b917acdc982f [gaim-migrate @ 10307]
Mark Doliner <mark@kingant.net>
parents: 9337
diff changeset
2103 gtk_window_present(GTK_WINDOW(accounts_window->window));
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2104 return;
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
2105 }
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2106
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2107 accounts_window = dialog = g_new0(AccountsWindow, 1);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2108
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2109 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width");
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2110 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height");
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2111
5803
56042e59499a [gaim-migrate @ 6233]
Christian Hammond <chipx86@chipx86.com>
parents: 5802
diff changeset
2112 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2113 gtk_window_set_default_size(GTK_WINDOW(win), width, height);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2114 gtk_window_set_role(GTK_WINDOW(win), "accounts");
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
2115 gtk_window_set_title(GTK_WINDOW(win), _("Accounts"));
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
2116 gtk_container_set_border_width(GTK_CONTAINER(win), GAIM_HIG_BORDER);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2117
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2118 g_signal_connect(G_OBJECT(win), "delete_event",
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2119 G_CALLBACK(accedit_win_destroy_cb), accounts_window);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2120 g_signal_connect(G_OBJECT(win), "configure_event",
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2121 G_CALLBACK(configure_cb), accounts_window);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2122
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2123 /* Setup the vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
2124 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2125 gtk_container_add(GTK_CONTAINER(win), vbox);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2126 gtk_widget_show(vbox);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2127
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2128 /* Setup the scrolled window that will contain the list of accounts. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2129 sw = create_accounts_list(dialog);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2130 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2131 gtk_widget_show(sw);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2132
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2133 /* Button box. */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2134 bbox = gtk_hbutton_box_new();
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
2135 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2136 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2137 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
2138 gtk_widget_show(bbox);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2139
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2140 /* Add button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2141 button = gtk_button_new_from_stock(GTK_STOCK_ADD);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2142 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2143 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2144
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2145 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2146 G_CALLBACK(add_account_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2147
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2148 /* Modify button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2149 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
2150 dialog->modify_button = button;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2151 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
2152 gtk_widget_set_sensitive(button, FALSE);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2153 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2154
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2155 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2156 G_CALLBACK(modify_account_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2157
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2158 /* Delete button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2159 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
2160 dialog->delete_button = button;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2161 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
2162 gtk_widget_set_sensitive(button, FALSE);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2163 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2164
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2165 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2166 G_CALLBACK(ask_delete_account_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2167
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2168 /* Close button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2169 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2170 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2171 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2172
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2173 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
2174 G_CALLBACK(close_accounts_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
2175
12521
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2176 gaim_signal_connect(gaim_gtk_account_get_handle(), "account-modified",
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2177 accounts_window,
e9c143acd765 [gaim-migrate @ 14833]
Richard Laager <rlaager@wiktel.com>
parents: 12493
diff changeset
2178 GAIM_CALLBACK(account_modified_cb), accounts_window);
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
2179
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2180 gtk_widget_show(win);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2181 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2182
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2183 void
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2184 gaim_gtk_accounts_window_hide(void)
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2185 {
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2186 if (accounts_window == NULL)
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2187 return;
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2188
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2189 gaim_signals_disconnect_by_handle(accounts_window);
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2190
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2191 g_free(accounts_window);
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2192 accounts_window = NULL;
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2193
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2194 /* See if we're the main window here. */
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2195 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL &&
10315
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
2196 gaim_connections_get_all() == NULL) {
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2197
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6141
diff changeset
2198 gaim_core_quit();
6119
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2199 }
0d2bd49c611e [gaim-migrate @ 6588]
Christian Hammond <chipx86@chipx86.com>
parents: 6092
diff changeset
2200 }
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2201
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2202 static void
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2203 free_add_user_data(GaimGtkAccountAddUserData *data)
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2204 {
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2205 g_free(data->username);
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
2206 g_free(data->alias);
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2207 g_free(data);
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2208 }
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2209
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2210 static void
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2211 add_user_cb(GaimGtkAccountAddUserData *data)
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2212 {
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2213 GaimConnection *gc = gaim_account_get_connection(data->account);
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2214
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2215 if (g_list_find(gaim_connections_get_all(), gc))
7060
9946001989a3 [gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
2216 {
9946001989a3 [gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
2217 gaim_blist_request_add_buddy(data->account, data->username,
9946001989a3 [gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
2218 NULL, data->alias);
9946001989a3 [gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
2219 }
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2220
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2221 free_add_user_data(data);
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2222 }
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2223
12285
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2224 static char *
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2225 make_info(GaimAccount *account, GaimConnection *gc, const char *remote_user,
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2226 const char *id, const char *alias, const char *msg)
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2227 {
12976
0a5b48576913 [gaim-migrate @ 15329]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12960
diff changeset
2228 if (msg != NULL && *msg == '\0')
12960
cefac38bcb9f [gaim-migrate @ 15313]
Richard Laager <rlaager@wiktel.com>
parents: 12843
diff changeset
2229 msg = NULL;
cefac38bcb9f [gaim-migrate @ 15313]
Richard Laager <rlaager@wiktel.com>
parents: 12843
diff changeset
2230
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12285
diff changeset
2231 return g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s"),
12285
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2232 remote_user,
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2233 (alias != NULL ? " (" : ""),
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2234 (alias != NULL ? alias : ""),
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2235 (alias != NULL ? ")" : ""),
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2236 (id != NULL
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2237 ? id
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2238 : (gaim_connection_get_display_name(gc) != NULL
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2239 ? gaim_connection_get_display_name(gc)
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2240 : gaim_account_get_username(account))),
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2241 (msg != NULL ? ": " : "."),
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2242 (msg != NULL ? msg : ""));
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2243 }
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2244
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2245 static void
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2246 gaim_gtk_accounts_notify_added(GaimAccount *account, const char *remote_user,
12285
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2247 const char *id, const char *alias,
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2248 const char *msg)
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2249 {
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2250 char *buffer;
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2251 GaimConnection *gc;
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2252
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2253 gc = gaim_account_get_connection(account);
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2254
12285
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2255 buffer = make_info(account, gc, remote_user, id, alias, msg);
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2256
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2257 gaim_notify_info(NULL, NULL, buffer, NULL);
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2258
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2259 g_free(buffer);
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2260 }
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2261
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2262 static void
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2263 gaim_gtk_accounts_request_add(GaimAccount *account, const char *remote_user,
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2264 const char *id, const char *alias,
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2265 const char *msg)
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2266 {
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2267 char *buffer;
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2268 GaimConnection *gc;
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2269 GaimGtkAccountAddUserData *data;
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2270
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2271 gc = gaim_account_get_connection(account);
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2272
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2273 data = g_new0(GaimGtkAccountAddUserData, 1);
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2274 data->account = account;
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2275 data->username = g_strdup(remote_user);
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 14025
diff changeset
2276 data->alias = g_strdup(alias);
12285
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2277
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2278 buffer = make_info(account, gc, remote_user, id, alias, msg);
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2279
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2280 gaim_request_action(NULL, NULL, _("Add buddy to your list?"),
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2281 buffer, GAIM_DEFAULT_ACTION_NONE, data, 2,
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2282 _("Add"), G_CALLBACK(add_user_cb),
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2283 _("Cancel"), G_CALLBACK(free_add_user_data));
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2284
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2285 g_free(buffer);
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2286 }
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2287
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2288 static GaimAccountUiOps ui_ops =
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2289 {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9814
diff changeset
2290 gaim_gtk_accounts_notify_added,
12285
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2291 NULL,
af257d8679fe [gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12240
diff changeset
2292 gaim_gtk_accounts_request_add
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2293 };
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2294
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2295 GaimAccountUiOps *
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2296 gaim_gtk_accounts_get_ui_ops(void)
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2297 {
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2298 return &ui_ops;
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6856
diff changeset
2299 }
9609
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2300
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2301 void *
13014
5efbb0162f86 [gaim-migrate @ 15367]
Mark Doliner <mark@kingant.net>
parents: 12976
diff changeset
2302 gaim_gtk_account_get_handle(void) {
9609
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2303 static int handle;
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2304
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2305 return &handle;
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2306 }
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2307
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2308 void
10163
34a8bbf5b1b9 [gaim-migrate @ 11249]
Mark Doliner <mark@kingant.net>
parents: 10159
diff changeset
2309 gaim_gtk_account_init(void)
34a8bbf5b1b9 [gaim-migrate @ 11249]
Mark Doliner <mark@kingant.net>
parents: 10159
diff changeset
2310 {
34a8bbf5b1b9 [gaim-migrate @ 11249]
Mark Doliner <mark@kingant.net>
parents: 10159
diff changeset
2311 gaim_prefs_add_none("/gaim/gtk/accounts");
34a8bbf5b1b9 [gaim-migrate @ 11249]
Mark Doliner <mark@kingant.net>
parents: 10159
diff changeset
2312 gaim_prefs_add_none("/gaim/gtk/accounts/dialog");
12336
0bde9a3cb93d [gaim-migrate @ 14640]
Mark Doliner <mark@kingant.net>
parents: 12286
diff changeset
2313 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/width", 520);
0bde9a3cb93d [gaim-migrate @ 14640]
Mark Doliner <mark@kingant.net>
parents: 12286
diff changeset
2314 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/height", 321);
14133
31d33e7bc0e6 [gaim-migrate @ 16775]
Sean Egan <seanegan@gmail.com>
parents: 14088
diff changeset
2315 gaim_prefs_add_string("/gaim/gtk/accounts/buddyicon", NULL);
10163
34a8bbf5b1b9 [gaim-migrate @ 11249]
Mark Doliner <mark@kingant.net>
parents: 10159
diff changeset
2316
9609
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2317 gaim_signal_register(gaim_gtk_account_get_handle(), "account-modified",
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2318 gaim_marshal_VOID__POINTER, NULL, 1,
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2319 gaim_value_new(GAIM_TYPE_SUBTYPE,
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2320 GAIM_SUBTYPE_ACCOUNT));
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2321
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2322 /* Setup some gaim signal handlers. */
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2323 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2324 gaim_gtk_account_get_handle(),
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2325 GAIM_CALLBACK(signed_on_off_cb), NULL);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2326 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2327 gaim_gtk_account_get_handle(),
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2328 GAIM_CALLBACK(signed_on_off_cb), NULL);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2329 gaim_signal_connect(gaim_accounts_get_handle(), "account-added",
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2330 gaim_gtk_account_get_handle(),
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2331 GAIM_CALLBACK(add_account_to_liststore), NULL);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2332 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed",
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2333 gaim_gtk_account_get_handle(),
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2334 GAIM_CALLBACK(account_removed_cb), NULL);
12070
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
2335 gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled",
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
2336 gaim_gtk_account_get_handle(),
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
2337 GAIM_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE));
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
2338 gaim_signal_connect(gaim_accounts_get_handle(), "account-enabled",
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
2339 gaim_gtk_account_get_handle(),
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11987
diff changeset
2340 GAIM_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE));
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2341
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2342 account_pref_wins =
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2343 g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
9609
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2344 }
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2345
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2346 void
10163
34a8bbf5b1b9 [gaim-migrate @ 11249]
Mark Doliner <mark@kingant.net>
parents: 10159
diff changeset
2347 gaim_gtk_account_uninit(void)
34a8bbf5b1b9 [gaim-migrate @ 11249]
Mark Doliner <mark@kingant.net>
parents: 10159
diff changeset
2348 {
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2349 /*
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2350 * TODO: Need to free all the dialogs in here. Could probably create
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2351 * a callback function to use for the free-some-data-function
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2352 * parameter of g_hash_table_new_full, above.
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2353 */
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2354 g_hash_table_destroy(account_pref_wins);
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2355
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2356 gaim_signals_disconnect_by_handle(gaim_gtk_account_get_handle());
9617
d5055337c9d9 [gaim-migrate @ 10461]
Luke Schierer <lschiere@pidgin.im>
parents: 9609
diff changeset
2357 gaim_signals_unregister_by_instance(gaim_gtk_account_get_handle());
9609
93211b7538d6 [gaim-migrate @ 10452]
Luke Schierer <lschiere@pidgin.im>
parents: 9591
diff changeset
2358 }
11789
1c53ff1e7a0d [gaim-migrate @ 14080]
Mark Doliner <mark@kingant.net>
parents: 11784
diff changeset
2359