annotate src/gtkaccount.c @ 10456:d23802800eeb

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