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