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