annotate src/gtkaccount.c @ 5852:daac2e9a1b0b

[gaim-migrate @ 6283] Compile before commit, compile before commit, compile before commit... committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 13 Jun 2003 09:42:07 +0000
parents 023fd44672d8
children 082982a4acbd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file gtkaccount.c Account Editor dialog
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup gtkui
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5715
diff changeset
23
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
24 #include <sys/types.h>
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
25 #include <sys/stat.h>
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
26 #include <unistd.h>
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
27
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5715
diff changeset
28 #include <gtk/gtk.h>
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5715
diff changeset
29
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 #include "gtkaccount.h"
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 #include "account.h"
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
32 #include "accountopt.h"
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
33 #include "event.h"
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 #include "prefs.h"
5852
daac2e9a1b0b [gaim-migrate @ 6283]
Christian Hammond <chipx86@chipx86.com>
parents: 5851
diff changeset
35 #include "plugin.h"
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 #include "stock.h"
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
37 #include "gtkblist.h"
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
38 #include "gaim-disclosure.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5715
diff changeset
39 #include "gaim.h"
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
40
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5715
diff changeset
41 #ifdef _WIN32
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
42 # include <gdk/gdkwin32.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
43 #else
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
44 # include <unistd.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
45 # include <gdk/gdkx.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
46 #endif
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
47
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
48 #include <string.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
49
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
50 enum
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
51 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
52 COLUMN_ICON,
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
53 COLUMN_SCREENNAME,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
54 COLUMN_ONLINE,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
55 COLUMN_AUTOLOGIN,
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
56 COLUMN_PROTOCOL,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
57 COLUMN_DATA,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
58 NUM_COLUMNS
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
59 };
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
61 typedef enum
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
62 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
63 ADD_ACCOUNT_DIALOG,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
64 MODIFY_ACCOUNT_DIALOG
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
65
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
66 } AccountPrefsDialogType;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
67
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 typedef struct
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 GtkWidget *window;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
71 GtkWidget *treeview;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
73 GtkWidget *modify_button;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
74 GtkWidget *delete_button;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
75
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
76 GtkListStore *model;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
77 GtkTreeIter drag_iter;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
78
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
79 GtkTreeViewColumn *screenname_col;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
80
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 } AccountsDialog;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
83 typedef struct
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
84 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
85 AccountPrefsDialogType type;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
86
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
87 AccountsDialog *accounts_dialog;
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
88
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
89 GaimAccount *account;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
90 GaimProtocol protocol;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
91 GaimPlugin *plugin;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
92 GaimPluginProtocolInfo *prpl_info;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
93
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
94 GaimProxyType new_proxy_type;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
95
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
96 GList *user_split_entries;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
97 GList *protocol_opt_entries;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
98
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
99 GtkSizeGroup *sg;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
100 GtkWidget *window;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
101
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
102 GtkWidget *top_vbox;
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
103 GtkWidget *bottom_vbox;
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
104 GtkWidget *ok_button;
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
105
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
106 /* Login Options */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
107 GtkWidget *login_frame;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
108 GtkWidget *protocol_menu;
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
109 GtkWidget *password_box;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
110 GtkWidget *screenname_entry;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
111 GtkWidget *password_entry;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
112 GtkWidget *alias_entry;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
113 GtkWidget *remember_pass_check;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
114 GtkWidget *auto_login_check;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
115
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
116 /* User Options */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
117 GtkWidget *user_frame;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
118 GtkWidget *new_mail_check;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
119 GtkWidget *buddy_icon_hbox;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
120 GtkWidget *buddy_icon_entry;
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
121 GtkWidget *buddy_icon_filesel;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
122 GtkWidget *buddy_icon_preview;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
123 GtkWidget *buddy_icon_text;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
124
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
125 /* Protocol Options */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
126 GtkWidget *protocol_frame;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
127
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
128 /* Proxy Options */
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
129 GtkWidget *proxy_frame;
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
130 GtkWidget *proxy_vbox;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
131 GtkWidget *proxy_dropdown;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
132 GtkWidget *proxy_menu;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
133 GtkWidget *proxy_host_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
134 GtkWidget *proxy_port_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
135 GtkWidget *proxy_user_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
136 GtkWidget *proxy_pass_entry;
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
137
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
138 } AccountPrefsDialog;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
139
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
140
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 static AccountsDialog *accounts_dialog = NULL;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
143 static void add_account(AccountsDialog *dialog, GaimAccount *account);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
144 static void set_account(GtkListStore *store, GtkTreeIter *iter,
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
145 GaimAccount *account);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
146
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
147 static char *
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
148 proto_name(int proto)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
149 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
150 GaimPlugin *p = gaim_find_prpl(proto);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
151
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
152 return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
153 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
154
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
155 /**************************************************************************
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
156 * Add/Modify Account dialog
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
157 **************************************************************************/
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
158 static void add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
159 static void add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
160 static void add_protocol_options(AccountPrefsDialog *dialog,
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
161 GtkWidget *parent);
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
162 static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
163
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
164 static GtkWidget *
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
165 add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent,
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
166 const char *text, GtkWidget *widget)
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 GtkWidget *hbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
169 GtkWidget *label;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
170
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
171 hbox = gtk_hbox_new(FALSE, 6);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
172 gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
173 gtk_widget_show(hbox);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
174
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
175 label = gtk_label_new_with_mnemonic(text);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
176 gtk_size_group_add_widget(dialog->sg, label);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
177 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
178 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
179 gtk_widget_show(label);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
180
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
181 gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
182 gtk_widget_show(widget);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
183
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
184 return hbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
185 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
186
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
187 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
188 set_account_protocol_cb(GtkWidget *item, GaimProtocol protocol,
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
189 AccountPrefsDialog *dialog)
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
190 {
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
191 dialog->protocol = protocol;
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
192
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
193 if ((dialog->plugin = gaim_find_prpl(dialog->protocol)) != NULL)
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
194 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
195
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
196 add_login_options(dialog, dialog->top_vbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
197 add_user_options(dialog, dialog->top_vbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
198 add_protocol_options(dialog, dialog->bottom_vbox);
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
199 }
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
200
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
201 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
202 screenname_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog)
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
203 {
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
204 if (dialog->ok_button == NULL)
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
205 return;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
206
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
207 gtk_widget_set_sensitive(dialog->ok_button,
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
208 *gtk_entry_get_text(entry) != '\0');
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
209 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
210
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
211 static void buddy_icon_filesel_delete_cb (GtkWidget *w, AccountPrefsDialog *dialog)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
212 {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
213 dialog->buddy_icon_filesel = NULL;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
214 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
215
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
216 static void buddy_icon_filesel_choose (GtkWidget *w, AccountPrefsDialog *dialog)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
217 {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
218 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->buddy_icon_filesel));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
219 if (dialog->account)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
220 gaim_account_set_buddy_icon(dialog->account, filename);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
221 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_icon_entry), filename);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
222 gtk_widget_destroy(dialog->buddy_icon_filesel);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
223 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
224
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
225 static void buddy_icon_preview_change_cb(GtkTreeSelection *sel, AccountPrefsDialog *dialog)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
226 {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
227 GdkPixbuf *pixbuf, *scale;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
228 int height, width;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
229 char *basename, *markup, *size;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
230 struct stat st;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
231
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
232 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->buddy_icon_filesel));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
233 if (!filename || stat(filename, &st))
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
234 return;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
235
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
236 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
237 if (!pixbuf) {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
238 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->buddy_icon_preview), NULL);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
239 gtk_label_set_markup(GTK_LABEL(dialog->buddy_icon_text), "");
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
240 return;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
241 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
242
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
243 width = gdk_pixbuf_get_width(pixbuf);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
244 height = gdk_pixbuf_get_height(pixbuf);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
245 basename = g_path_get_basename(filename);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
246 size = gaim_get_size_string(st.st_size);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
247 markup = g_strdup_printf(_("<b>File:</b> %s\n<b>File size:</b> %s\n<b>Image size:</b> %dx%d"),
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
248 basename, size, width, height);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
249 scale = gdk_pixbuf_scale_simple(pixbuf, width * 50 / height, 50, GDK_INTERP_BILINEAR);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
250 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->buddy_icon_preview), scale);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
251 gtk_label_set_markup(GTK_LABEL(dialog->buddy_icon_text), markup);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
252
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
253 g_object_unref(G_OBJECT(pixbuf));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
254 g_object_unref(G_OBJECT(scale));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
255 g_free(basename);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
256 g_free(size);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
257 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
258
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
259 static void buddy_icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
260 {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
261 GtkWidget *hbox;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
262 GtkWidget *tv;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
263 GtkTreeSelection *sel;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
264
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
265 if (dialog->buddy_icon_filesel) {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
266 gdk_window_show(GDK_WINDOW(dialog->buddy_icon_filesel));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
267 return;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
268 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
269
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
270 dialog->buddy_icon_filesel = gtk_file_selection_new(_("Buddy Icon"));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
271 dialog->buddy_icon_preview = gtk_image_new();
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
272 dialog->buddy_icon_text = gtk_label_new(NULL);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
273 gtk_widget_set_size_request(GTK_WIDGET(dialog->buddy_icon_preview), -1, 50);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
274 hbox = gtk_hbox_new(FALSE, 6);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
275 gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(dialog->buddy_icon_filesel)->main_vbox), hbox,
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
276 FALSE, FALSE, 0);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
277 gtk_box_pack_end(GTK_BOX(hbox), dialog->buddy_icon_preview, FALSE, FALSE, 0);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
278 gtk_box_pack_end(GTK_BOX(hbox), dialog->buddy_icon_text, FALSE, FALSE, 0);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
279
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
280 tv = GTK_FILE_SELECTION(dialog->buddy_icon_filesel)->file_list;
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
281 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
282 g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(buddy_icon_preview_change_cb), dialog);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
283
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
284 g_signal_connect(G_OBJECT(dialog->buddy_icon_filesel), "delete-event", G_CALLBACK(buddy_icon_filesel_delete_cb), dialog);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
285 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog->buddy_icon_filesel)->cancel_button), "clicked",
5842
dbed8c87f750 [gaim-migrate @ 6273]
Sean Egan <seanegan@gmail.com>
parents: 5840
diff changeset
286 G_CALLBACK(gtk_widget_destroy), NULL);
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
287 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog->buddy_icon_filesel)->ok_button), "clicked", G_CALLBACK(buddy_icon_filesel_choose),
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
288 dialog);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
289
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
290 gtk_widget_show_all(dialog->buddy_icon_filesel);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
291 if (dialog->account) {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
292 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog->buddy_icon_filesel),
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
293 gaim_account_get_buddy_icon(dialog->account));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
294 buddy_icon_preview_change_cb(NULL, dialog);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
295 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
296
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
297 }
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
298
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
299 static void buddy_icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
300 {
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
301 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_icon_entry), "");
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
302 if (dialog->account)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
303 gaim_account_set_buddy_icon(dialog->account, NULL);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
304 }
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
305
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
306 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
307 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
308 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
309 GtkWidget *frame;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
310 GtkWidget *vbox;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
311 GtkWidget *entry;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
312 GList *user_splits;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
313 GList *l, *l2;
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
314 char *username = NULL;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
315
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
316 if (dialog->login_frame != NULL)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
317 gtk_widget_destroy(dialog->login_frame);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
318
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
319 /* Build the login options frame. */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
320 frame = gaim_gtk_make_frame(parent, _("Login Options"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
321
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
322 /* cringe */
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
323 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
324
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
325 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
326 gtk_widget_show(dialog->login_frame);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
327
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
328 /* Main vbox */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
329 vbox = gtk_vbox_new(FALSE, 6);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
330 gtk_container_add(GTK_CONTAINER(frame), vbox);
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
331 gtk_widget_show(vbox);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
332
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
333 /* Protocol */
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
334 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new(
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
335 dialog->protocol, G_CALLBACK(set_account_protocol_cb), dialog);
5644
213e999fa5cc [gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents: 5641
diff changeset
336
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
337 add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
338
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
339 /* Screen Name */
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
340 dialog->screenname_entry = gtk_entry_new();
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
341
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
342 add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry);
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
343
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
344 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed",
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
345 G_CALLBACK(screenname_changed_cb), dialog);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
346
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
347 /* Do the user split thang */
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
348 if (dialog->plugin == NULL) /* Yeah right. */
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
349 user_splits = NULL;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
350 else
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
351 user_splits = dialog->prpl_info->user_splits;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
352
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
353 if (dialog->account != NULL)
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
354 username = g_strdup(gaim_account_get_username(dialog->account));
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
355
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
356 if (dialog->user_split_entries != NULL) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
357 g_list_free(dialog->user_split_entries);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
358 dialog->user_split_entries = NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
359 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
360
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
361 for (l = user_splits; l != NULL; l = l->next) {
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
362 GaimAccountUserSplit *split = l->data;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
363 char *buf;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
364
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
365 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
366
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
367 entry = gtk_entry_new();
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
368
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
369 add_pref_box(dialog, vbox, buf, entry);
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
370
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
371 g_free(buf);
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
372
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
373 dialog->user_split_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
374 g_list_append(dialog->user_split_entries, entry);
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
375 }
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
376
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
377 for (l = g_list_last(dialog->user_split_entries),
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
378 l2 = g_list_last(user_splits);
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
379 l != NULL && l2 != NULL;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
380 l = l->prev, l2 = l2->prev) {
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
381
5708
1d5c5acfc846 [gaim-migrate @ 6129]
Christian Hammond <chipx86@chipx86.com>
parents: 5705
diff changeset
382 GtkWidget *entry = l->data;
1d5c5acfc846 [gaim-migrate @ 6129]
Christian Hammond <chipx86@chipx86.com>
parents: 5705
diff changeset
383 GaimAccountUserSplit *split = l2->data;
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
384 const char *value = NULL;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
385 char *c;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
386
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
387 if (dialog->account != NULL) {
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
388 c = strrchr(username,
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
389 gaim_account_user_split_get_separator(split));
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
390
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
391 if (c != NULL) {
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
392 *c = '\0';
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
393 c++;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
394
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
395 value = c;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
396 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
397 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
398
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
399 if (value == NULL)
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
400 value = gaim_account_user_split_get_default_value(split);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
401
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
402 if (value != NULL)
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
403 gtk_entry_set_text(GTK_ENTRY(entry), value);
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
404 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
405
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
406 if (username != NULL)
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
407 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
408
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
409 g_free(username);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
410
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
411
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
412 /* Password */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
413 dialog->password_entry = gtk_entry_new();
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
414 gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE);
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
415 dialog->password_box = add_pref_box(dialog, vbox, _("Password:"),
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
416 dialog->password_entry);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
417
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
418 /* Alias */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
419 dialog->alias_entry = gtk_entry_new();
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
420 add_pref_box(dialog, vbox, _("Alias:"), dialog->alias_entry);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
421
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
422 /* Remember Password */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
423 dialog->remember_pass_check =
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
424 gtk_check_button_new_with_label(_("Remember password"));
5783
d4171d0bc80a [gaim-migrate @ 6208]
Christian Hammond <chipx86@chipx86.com>
parents: 5782
diff changeset
425 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check),
d4171d0bc80a [gaim-migrate @ 6208]
Christian Hammond <chipx86@chipx86.com>
parents: 5782
diff changeset
426 TRUE);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
427 gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check,
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
428 FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
429 gtk_widget_show(dialog->remember_pass_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
430
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
431 /* Auto-Login */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
432 dialog->auto_login_check =
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
433 gtk_check_button_new_with_label(_("Auto-login"));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
434 gtk_box_pack_start(GTK_BOX(vbox), dialog->auto_login_check,
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
435 FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
436 gtk_widget_show(dialog->auto_login_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
437
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
438 /* Set the fields. */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
439 if (dialog->account != NULL) {
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
440 if (gaim_account_get_password(dialog->account))
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
441 gtk_entry_set_text(GTK_ENTRY(dialog->password_entry),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
442 gaim_account_get_password(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
443
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
444 if (gaim_account_get_alias(dialog->account))
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
445 gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
446 gaim_account_get_alias(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
447
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
448 gtk_toggle_button_set_active(
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
449 GTK_TOGGLE_BUTTON(dialog->remember_pass_check),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
450 gaim_account_get_remember_password(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
451
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
452 gtk_toggle_button_set_active(
5804
1ba7dbd50d85 [gaim-migrate @ 6234]
Nathan Walp <nwalp@pidgin.im>
parents: 5803
diff changeset
453 GTK_TOGGLE_BUTTON(dialog->auto_login_check),
1ba7dbd50d85 [gaim-migrate @ 6234]
Nathan Walp <nwalp@pidgin.im>
parents: 5803
diff changeset
454 gaim_account_get_auto_login(dialog->account, GAIM_GTK_UI));
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
455 }
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
456
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
457 if (dialog->prpl_info != NULL &&
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
458 (dialog->prpl_info->options & OPT_PROTO_NO_PASSWORD)) {
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
459
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
460 gtk_widget_hide(dialog->password_box);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
461 gtk_widget_hide(dialog->remember_pass_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
462 }
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
463 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
464
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
465 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
466 add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
467 {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
468 GtkWidget *frame;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
469 GtkWidget *vbox;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
470 GtkWidget *hbox;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
471 GtkWidget *button;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
472 GtkWidget *label;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
473
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
474 if (dialog->user_frame != NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
475 gtk_widget_destroy(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
476
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
477 /* Build the user options frame. */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
478 frame = gaim_gtk_make_frame(parent, _("User Options"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
479 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
480
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
481 gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
482 gtk_widget_show(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
483
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
484 /* Main vbox */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
485 vbox = gtk_vbox_new(FALSE, 6);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
486 gtk_container_add(GTK_CONTAINER(frame), vbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
487 gtk_widget_show(vbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
488
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
489 /* New mail notifications */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
490 dialog->new_mail_check =
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
491 gtk_check_button_new_with_label(_("New mail notifications"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
492 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
493 gtk_widget_show(dialog->new_mail_check);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
494
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
495 /* Buddy icon */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
496 dialog->buddy_icon_hbox = hbox = gtk_hbox_new(FALSE, 6);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
497 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
498 gtk_widget_show(hbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
499
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
500 label = gtk_label_new(_("Buddy icon file:"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
501 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
502 gtk_widget_show(label);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
503
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
504 dialog->buddy_icon_entry = gtk_entry_new();
5840
8f5ccf9e590a [gaim-migrate @ 6271]
Nathan Walp <nwalp@pidgin.im>
parents: 5826
diff changeset
505 gtk_editable_set_editable(GTK_EDITABLE(dialog->buddy_icon_entry), FALSE);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
506 gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_icon_entry, TRUE, TRUE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
507 gtk_widget_show(dialog->buddy_icon_entry);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
508
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
509 button = gtk_button_new_with_mnemonic(_("_Browse"));
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
510 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
511 g_signal_connect(G_OBJECT(button), "clicked",
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
512 G_CALLBACK(buddy_icon_select_cb), dialog);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
513 gtk_widget_show(button);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
514
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
515 button = gtk_button_new_with_mnemonic(_("_Reset"));
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
516 g_signal_connect(G_OBJECT(button), "clicked",
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
517 G_CALLBACK(buddy_icon_reset_cb), dialog);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
518 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
519 gtk_widget_show(button);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
520
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
521 if (dialog->prpl_info != NULL) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
522 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK))
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
523 gtk_widget_hide(dialog->new_mail_check);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
524
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
525 if (!(dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON))
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
526 gtk_widget_hide(dialog->buddy_icon_hbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
527 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
528
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
529 if (dialog->account != NULL) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
530 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
531 gaim_account_get_check_mail(dialog->account));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
532
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
533 if (gaim_account_get_buddy_icon(dialog->account) != NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
534 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_icon_entry),
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
535 gaim_account_get_buddy_icon(dialog->account));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
536 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
537
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
538 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) &&
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
539 !(dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON)) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
540
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
541 /* Nothing to see :( aww. */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
542 gtk_widget_hide(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
543 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
544 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
545
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
546 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
547 add_protocol_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
548 {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
549 GaimAccountOption *option;
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
550 GaimAccount *account;
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
551 GtkWidget *frame;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
552 GtkWidget *vbox;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
553 GtkWidget *check;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
554 GtkWidget *entry;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
555 GList *l;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
556 char buf[1024];
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
557 char *title;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
558 const char *str_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
559 gboolean bool_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
560 int int_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
561
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
562 if (dialog->protocol_frame != NULL) {
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
563 gtk_widget_destroy(dialog->protocol_frame);
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
564 dialog->protocol_frame = NULL;
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
565 }
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
566
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
567 if (dialog->prpl_info == NULL ||
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
568 dialog->prpl_info->protocol_options == NULL) {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
569
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
570 return;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
571 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
572
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
573 account = dialog->account;
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
574
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
575 /* Build the protocol options frame. */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
576 g_snprintf(buf, sizeof(buf), _("%s Options"), dialog->plugin->info->name);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
577
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
578 frame = gaim_gtk_make_frame(parent, buf);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
579 dialog->protocol_frame =
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
580 gtk_widget_get_parent(gtk_widget_get_parent(frame));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
581
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
582 gtk_box_reorder_child(GTK_BOX(parent), dialog->protocol_frame, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
583 gtk_widget_show(dialog->protocol_frame);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
584
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
585 /* Main vbox */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
586 vbox = gtk_vbox_new(FALSE, 6);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
587 gtk_container_add(GTK_CONTAINER(frame), vbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
588 gtk_widget_show(vbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
589
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
590 if (dialog->protocol_opt_entries != NULL) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
591 g_list_free(dialog->protocol_opt_entries);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
592 dialog->protocol_opt_entries = NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
593 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
594
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
595 for (l = dialog->prpl_info->protocol_options; l != NULL; l = l->next) {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
596 option = (GaimAccountOption *)l->data;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
597
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
598 switch (gaim_account_option_get_type(option)) {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
599 case GAIM_PREF_BOOLEAN:
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
600 if (account == NULL ||
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
601 gaim_account_get_protocol(account) != dialog->protocol) {
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
602
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
603 bool_value = gaim_account_option_get_default_bool(option);
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
604 }
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
605 else
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
606 bool_value = gaim_account_get_bool(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
607 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
608 gaim_account_option_get_default_bool(option));
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
609
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
610 check = gtk_check_button_new_with_label(
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
611 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
612
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
613 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
614 bool_value);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
615
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
616 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
617 gtk_widget_show(check);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
618
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
619 dialog->protocol_opt_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
620 g_list_append(dialog->protocol_opt_entries, check);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
621
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
622 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
623
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
624 case GAIM_PREF_INT:
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
625 if (account == NULL ||
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
626 gaim_account_get_protocol(account) != dialog->protocol) {
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
627
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
628 int_value = gaim_account_option_get_default_int(option);
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
629 }
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
630 else
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
631 int_value = gaim_account_get_int(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
632 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
633 gaim_account_option_get_default_int(option));
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
634
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
635 g_snprintf(buf, sizeof(buf), "%d", int_value);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
636
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
637 entry = gtk_entry_new();
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
638 gtk_entry_set_text(GTK_ENTRY(entry), buf);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
639
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
640 title = g_strdup_printf("%s:",
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
641 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
642
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
643 add_pref_box(dialog, vbox, title, entry);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
644
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
645 g_free(title);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
646
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
647 dialog->protocol_opt_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
648 g_list_append(dialog->protocol_opt_entries, entry);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
649
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
650 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
651
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
652 case GAIM_PREF_STRING:
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
653 if (account == NULL ||
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
654 gaim_account_get_protocol(account) != dialog->protocol) {
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
655
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
656 str_value = gaim_account_option_get_default_string(option);
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
657 }
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
658 else
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
659 str_value = gaim_account_get_string(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
660 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
661 gaim_account_option_get_default_string(option));
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
662
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
663 entry = gtk_entry_new();
5663
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
664
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
665 if (str_value != NULL)
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
666 gtk_entry_set_text(GTK_ENTRY(entry), str_value);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
667
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
668 title = g_strdup_printf("%s:",
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
669 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
670
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
671 add_pref_box(dialog, vbox, title, entry);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
672
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
673 g_free(title);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
674
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
675 dialog->protocol_opt_entries =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
676 g_list_append(dialog->protocol_opt_entries, entry);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
677
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
678 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
679
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
680 default:
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
681 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
682 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
683 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
684 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
685
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
686 static GtkWidget *
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
687 make_proxy_dropdown(void)
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
688 {
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
689 GtkWidget *dropdown;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
690 GtkWidget *menu;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
691 GtkWidget *item;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
692
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
693 dropdown = gtk_option_menu_new();
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
694 menu = gtk_menu_new();
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
695
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
696 /* Use Global Proxy Settings */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
697 item = gtk_menu_item_new_with_label(_("Use Global Proxy Settings"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
698 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
699 GINT_TO_POINTER(GAIM_PROXY_USE_GLOBAL));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
700 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
701 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
702
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
703 /* No Proxy */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
704 item = gtk_menu_item_new_with_label(_("No Proxy"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
705 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
706 GINT_TO_POINTER(GAIM_PROXY_NONE));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
707 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
708 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
709
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
710 /* SOCKS 4 */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
711 item = gtk_menu_item_new_with_label(_("SOCKS 4"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
712 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
713 GINT_TO_POINTER(GAIM_PROXY_SOCKS4));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
714 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
715 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
716
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
717 /* SOCKS 5 */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
718 item = gtk_menu_item_new_with_label(_("SOCKS 5"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
719 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
720 GINT_TO_POINTER(GAIM_PROXY_SOCKS5));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
721 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
722 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
723
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
724 /* HTTP */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
725 item = gtk_menu_item_new_with_label(_("HTTP"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
726 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
727 GINT_TO_POINTER(GAIM_PROXY_HTTP));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
728 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
729 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
730
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
731 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
732
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
733 return dropdown;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
734 }
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
735
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
736 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
737 proxy_type_changed_cb(GtkWidget *optmenu, AccountPrefsDialog *dialog)
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
738 {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
739 dialog->new_proxy_type =
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
740 gtk_option_menu_get_history(GTK_OPTION_MENU(optmenu)) - 1;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
741
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
742 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL ||
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
743 dialog->new_proxy_type == GAIM_PROXY_NONE) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
744
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
745 gtk_widget_hide_all(dialog->proxy_vbox);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
746 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
747 else
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
748 gtk_widget_show_all(dialog->proxy_vbox);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
749 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
750
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
751 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
752 port_popup_cb(GtkWidget *w, GtkMenu *menu, gpointer data)
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
753 {
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
754 GtkWidget *item;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
755
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
756 item = gtk_menu_item_new_with_label(
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
757 _("you can see the butterflies mating"));
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
758 gtk_widget_show(item);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
759 gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
760
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
761 item = gtk_menu_item_new_with_label(_("If you look real closely"));
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
762 gtk_widget_show(item);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
763 gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
764 }
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
765
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
766 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
767 add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
768 {
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
769 GaimProxyInfo *proxy_info;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
770 GtkWidget *frame;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
771 GtkWidget *vbox;
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
772 GtkWidget *vbox2;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
773
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
774 if (dialog->proxy_frame != NULL)
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
775 gtk_widget_destroy(dialog->proxy_frame);
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
776
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
777 frame = gaim_gtk_make_frame(parent, _("Proxy Options"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
778 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
779
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
780 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
781 gtk_widget_show(dialog->proxy_frame);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
782
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
783 /* Main vbox */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
784 vbox = gtk_vbox_new(FALSE, 6);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
785 gtk_container_add(GTK_CONTAINER(frame), vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
786 gtk_widget_show(vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
787
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
788 /* Proxy Type drop-down. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
789 dialog->proxy_dropdown = make_proxy_dropdown();
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
790 dialog->proxy_menu =
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
791 gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->proxy_dropdown));
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
792
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
793 add_pref_box(dialog, vbox, _("Proxy _type:"), dialog->proxy_dropdown);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
794
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
795 /* Setup the second vbox, which may be hidden at times. */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
796 dialog->proxy_vbox = vbox2 = gtk_vbox_new(FALSE, 6);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
797 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
798 gtk_widget_show(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
799
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
800 /* Host */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
801 dialog->proxy_host_entry = gtk_entry_new();
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
802 add_pref_box(dialog, vbox2, _("_Host:"), dialog->proxy_host_entry);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
803
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
804 /* Port */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
805 dialog->proxy_port_entry = gtk_entry_new();
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
806 add_pref_box(dialog, vbox2, _("_Port:"), dialog->proxy_port_entry);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
807
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
808 g_signal_connect(G_OBJECT(dialog->proxy_port_entry), "populate-popup",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
809 G_CALLBACK(port_popup_cb), NULL);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
810
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
811 /* User */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
812 dialog->proxy_user_entry = gtk_entry_new();
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
813
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
814 add_pref_box(dialog, vbox2, _("_Username:"), dialog->proxy_user_entry);
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
815
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
816 /* Password */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
817 dialog->proxy_pass_entry = gtk_entry_new();
5700
ad55a15c7b93 [gaim-migrate @ 6121]
Christian Hammond <chipx86@chipx86.com>
parents: 5699
diff changeset
818 gtk_entry_set_visibility(GTK_ENTRY(dialog->proxy_pass_entry), FALSE);
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
819 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
820
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
821 if (dialog->account != NULL &&
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
822 (proxy_info = gaim_account_get_proxy_info(dialog->account)) != NULL) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
823
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
824 GaimProxyType type = gaim_proxy_info_get_type(proxy_info);
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
825
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
826 /* Hah! */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
827 gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->proxy_dropdown),
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
828 (int)type + 1);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
829
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
830 if (type == GAIM_PROXY_NONE || type == GAIM_PROXY_USE_GLOBAL) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
831 gtk_widget_hide_all(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
832 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
833 else {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
834 const char *value;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
835 int int_val;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
836
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
837 if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
838 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
839
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
840 if ((int_val = gaim_proxy_info_get_port(proxy_info)) != 0) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
841 char buf[32];
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
842
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
843 g_snprintf(buf, sizeof(buf), "%d", int_val);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
844
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
845 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
846 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
847
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
848 if ((value = gaim_proxy_info_get_username(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
849 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_user_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
850
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
851 if ((value = gaim_proxy_info_get_password(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
852 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_pass_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
853 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
854 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
855 else
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
856 gtk_widget_hide_all(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
857
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
858 /* Connect signals. */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
859 g_signal_connect(G_OBJECT(dialog->proxy_dropdown), "changed",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
860 G_CALLBACK(proxy_type_changed_cb), dialog);
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
861 }
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
862
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
863 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
864 account_win_destroy_cb(GtkWidget *w, GdkEvent *event,
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
865 AccountPrefsDialog *dialog)
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
866 {
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
867 if (dialog->user_split_entries != NULL)
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
868 g_list_free(dialog->user_split_entries);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
869
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
870 if (dialog->protocol_opt_entries != NULL)
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
871 g_list_free(dialog->protocol_opt_entries);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
872
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
873 if (dialog->buddy_icon_filesel)
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
874 gtk_widget_destroy(dialog->buddy_icon_filesel);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5804
diff changeset
875
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
876 g_free(dialog);
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
877 }
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
878
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
879 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
880 cancel_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
881 {
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
882 gtk_widget_destroy(dialog->window);
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
883
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
884 account_win_destroy_cb(NULL, NULL, dialog);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
885 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
886
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
887 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
888 ok_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
889 {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
890 GaimProxyInfo *proxy_info = NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
891 GList *l, *l2;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
892 const char *value;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
893 char *username;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
894 char *tmp;
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
895 size_t index;
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
896 GtkTreeIter iter;
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
897
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
898 if (dialog->account == NULL) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
899 const char *screenname;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
900
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
901 screenname = gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
902
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
903 dialog->account = gaim_account_new(screenname, dialog->protocol);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
904 }
5699
3bac8b558577 [gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents: 5698
diff changeset
905 else {
3bac8b558577 [gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents: 5698
diff changeset
906 /* Protocol */
3bac8b558577 [gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents: 5698
diff changeset
907 gaim_account_set_protocol(dialog->account, dialog->protocol);
3bac8b558577 [gaim-migrate @ 6120]
Christian Hammond <chipx86@chipx86.com>
parents: 5698
diff changeset
908 }
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
909
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
910 /* Alias */
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
911 value = gtk_entry_get_text(GTK_ENTRY(dialog->alias_entry));
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
912
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
913 if (*value != '\0')
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
914 gaim_account_set_alias(dialog->account, value);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
915 else
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
916 gaim_account_set_alias(dialog->account, NULL);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
917
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
918 /* Buddy Icon */
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
919 value = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_icon_entry));
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
920
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
921 if ((dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON) && *value != '\0')
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
922 gaim_account_set_buddy_icon(dialog->account, value);
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
923 else
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
924 gaim_account_set_buddy_icon(dialog->account, NULL);
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
925
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
926 /* Remember Password */
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
927 gaim_account_set_remember_password(dialog->account,
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
928 gtk_toggle_button_get_active(
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
929 GTK_TOGGLE_BUTTON(dialog->remember_pass_check)));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
930
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
931 /* Check Mail */
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
932 if (dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK)
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
933 gaim_account_set_check_mail(dialog->account,
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
934 gtk_toggle_button_get_active(
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
935 GTK_TOGGLE_BUTTON(dialog->new_mail_check)));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
936
5804
1ba7dbd50d85 [gaim-migrate @ 6234]
Nathan Walp <nwalp@pidgin.im>
parents: 5803
diff changeset
937 /* Auto Login */
1ba7dbd50d85 [gaim-migrate @ 6234]
Nathan Walp <nwalp@pidgin.im>
parents: 5803
diff changeset
938 gaim_account_set_auto_login(dialog->account, GAIM_GTK_UI,
1ba7dbd50d85 [gaim-migrate @ 6234]
Nathan Walp <nwalp@pidgin.im>
parents: 5803
diff changeset
939 gtk_toggle_button_get_active(
1ba7dbd50d85 [gaim-migrate @ 6234]
Nathan Walp <nwalp@pidgin.im>
parents: 5803
diff changeset
940 GTK_TOGGLE_BUTTON(dialog->auto_login_check)));
1ba7dbd50d85 [gaim-migrate @ 6234]
Nathan Walp <nwalp@pidgin.im>
parents: 5803
diff changeset
941
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
942 /* TODO: Do something about auto-login. */
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
943
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
944 /* Password */
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
945 value = gtk_entry_get_text(GTK_ENTRY(dialog->password_entry));
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
946
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
947 if (gaim_account_get_remember_password(dialog->account) && *value != '\0')
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
948 gaim_account_set_password(dialog->account, value);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
949 else
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
950 gaim_account_set_password(dialog->account, NULL);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
951
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
952 /* Build the username string. */
5711
e33778b9d395 [gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents: 5710
diff changeset
953 username =
e33778b9d395 [gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents: 5710
diff changeset
954 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
955
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
956 for (l = dialog->prpl_info->user_splits, l2 = dialog->user_split_entries;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
957 l != NULL && l2 != NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
958 l = l->next, l2 = l2->next) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
959
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
960 GaimAccountUserSplit *split = l->data;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
961 GtkEntry *entry = l2->data;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
962 char sep[2] = " ";
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
963
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
964 value = gtk_entry_get_text(entry);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
965
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
966 *sep = gaim_account_user_split_get_separator(split);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
967
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
968 tmp = g_strconcat(username, sep,
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
969 (*value ? value :
5710
dbac958d8937 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5709
diff changeset
970 gaim_account_user_split_get_default_value(split)),
dbac958d8937 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5709
diff changeset
971 NULL);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
972
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
973 g_free(username);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
974 username = tmp;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
975 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
976
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
977 gaim_account_set_username(dialog->account, username);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
978 g_free(username);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
979
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
980 /* Add the protocol settings */
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
981 gaim_account_clear_settings(dialog->account);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
982
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
983 for (l = dialog->prpl_info->protocol_options,
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
984 l2 = dialog->protocol_opt_entries;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
985 l != NULL && l2 != NULL;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
986 l = l->next, l2 = l2->next) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
987
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
988 GaimPrefType type;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
989 GaimAccountOption *option = l->data;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
990 GtkWidget *widget = l2->data;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
991 const char *setting;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
992 int int_value;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
993 gboolean bool_value;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
994
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
995 type = gaim_account_option_get_type(option);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
996
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
997 setting = gaim_account_option_get_setting(option);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
998
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
999 switch (type) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1000 case GAIM_PREF_STRING:
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1001 value = gtk_entry_get_text(GTK_ENTRY(widget));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1002 gaim_account_set_string(dialog->account, setting, value);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1003 break;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1004
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1005 case GAIM_PREF_INT:
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1006 int_value = atoi(gtk_entry_get_text(GTK_ENTRY(widget)));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1007 gaim_account_set_int(dialog->account, setting, int_value);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1008 break;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1009
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1010 case GAIM_PREF_BOOLEAN:
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1011 bool_value =
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1012 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1013 gaim_account_set_bool(dialog->account, setting, bool_value);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1014 break;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1015
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1016 default:
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1017 break;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1018 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1019 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1020
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1021 /* Set the proxy stuff. */
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1022 if (dialog->new_proxy_type == GAIM_PROXY_NONE) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1023 gaim_account_set_proxy_info(dialog->account, NULL);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1024 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1025 else {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1026 const char *port_str;
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1027
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1028 proxy_info = gaim_account_get_proxy_info(dialog->account);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1029
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1030 if (proxy_info == NULL) {
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1031 proxy_info = gaim_proxy_info_new();
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1032 gaim_account_set_proxy_info(dialog->account, proxy_info);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1033 }
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1034
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1035 gaim_proxy_info_set_type(proxy_info, dialog->new_proxy_type);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1036
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1037 gaim_proxy_info_set_host(proxy_info,
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1038 gtk_entry_get_text(GTK_ENTRY(dialog->proxy_host_entry)));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1039
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1040 port_str = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_port_entry));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1041
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1042 if (port_str != NULL)
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1043 gaim_proxy_info_set_port(proxy_info, atoi(port_str));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1044 else
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1045 gaim_proxy_info_set_port(proxy_info, 0);
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1046
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1047 gaim_proxy_info_set_username(proxy_info,
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1048 gtk_entry_get_text(GTK_ENTRY(dialog->proxy_user_entry)));
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 gaim_proxy_info_set_password(proxy_info,
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1051 gtk_entry_get_text(GTK_ENTRY(dialog->proxy_pass_entry)));
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1052 }
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1053
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1054 /* Adds the account to the list, or modify the existing entry. */
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1055 index = g_list_index(gaim_accounts_get_all(), dialog->account);
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1056
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1057 if (index != -1 &&
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1058 (gtk_tree_model_iter_nth_child(
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1059 GTK_TREE_MODEL(dialog->accounts_dialog->model), &iter,
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1060 NULL, index))) {
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1061
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1062 set_account(dialog->accounts_dialog->model, &iter, dialog->account);
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1063 }
5710
dbac958d8937 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5709
diff changeset
1064 else {
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1065 add_account(dialog->accounts_dialog, dialog->account);
5710
dbac958d8937 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5709
diff changeset
1066 gaim_accounts_add(dialog->account);
dbac958d8937 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5709
diff changeset
1067 }
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1068
5697
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1069 gtk_widget_destroy(dialog->window);
fc659d75fcf7 [gaim-migrate @ 6118]
Christian Hammond <chipx86@chipx86.com>
parents: 5696
diff changeset
1070
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1071 account_win_destroy_cb(NULL, NULL, dialog);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1072
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1073 gaim_accounts_sync();
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1074 }
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1075
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1076 static void
5851
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1077 register_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1078 {
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1079 GaimAccount *account = dialog->account;
5852
daac2e9a1b0b [gaim-migrate @ 6283]
Christian Hammond <chipx86@chipx86.com>
parents: 5851
diff changeset
1080 GaimPluginProtocolInfo *prpl_info = dialog->prpl_info;
5851
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1081
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1082 ok_account_prefs_cb(NULL, dialog);
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1083
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1084 prpl_info->register_user(account);
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1085 }
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1086
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1087 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1088 show_account_prefs(AccountPrefsDialogType type,
5851
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1089 AccountsDialog *accounts_dialog,
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1090 GaimAccount *account)
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1091 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1092 AccountPrefsDialog *dialog;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1093 GtkWidget *win;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1094 GtkWidget *main_vbox;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1095 GtkWidget *vbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1096 GtkWidget *bbox;
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1097 GtkWidget *dbox;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1098 GtkWidget *disclosure;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1099 GtkWidget *sep;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1100 GtkWidget *button;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1101
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1102 dialog = g_new0(AccountPrefsDialog, 1);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1103
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1104 dialog->accounts_dialog = accounts_dialog;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1105 dialog->account = account;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1106 dialog->type = type;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1107 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1108
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1109 if (dialog->account == NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1110 dialog->protocol = GAIM_PROTO_OSCAR;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1111 else
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1112 dialog->protocol = gaim_account_get_protocol(dialog->account);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1113
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1114 if ((dialog->plugin = gaim_find_prpl(dialog->protocol)) != NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1115 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1116
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1117
5661
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
1118 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1119 gtk_window_set_role(GTK_WINDOW(win), "account");
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1120
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1121 if (type == ADD_ACCOUNT_DIALOG)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1122 gtk_window_set_title(GTK_WINDOW(win), _("Add Account"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1123 else
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1124 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1125
5661
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
1126 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
1127
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1128 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1129
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1130 g_signal_connect(G_OBJECT(win), "delete_event",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1131 G_CALLBACK(account_win_destroy_cb), dialog);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1132
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1133 /* Setup the vbox */
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1134 main_vbox = gtk_vbox_new(FALSE, 12);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1135 gtk_container_add(GTK_CONTAINER(win), main_vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1136 gtk_widget_show(main_vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1137
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1138 /* Setup the inner vbox */
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
1139 dialog->top_vbox = vbox = gtk_vbox_new(FALSE, 18);
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1140 gtk_box_pack_start(GTK_BOX(main_vbox), vbox, FALSE, FALSE, 0);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1141 gtk_widget_show(vbox);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1142
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1143 /* Setup the top frames. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1144 add_login_options(dialog, vbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1145 add_user_options(dialog, vbox);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1146
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1147 /* Add the disclosure */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1148 disclosure = gaim_disclosure_new(_("Show more options"),
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1149 _("Show fewer options"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1150 gtk_box_pack_start(GTK_BOX(vbox), disclosure, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
1151 gtk_widget_show(disclosure);
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
1152
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1153 /* Setup the box that the disclosure will cover. */
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
1154 dialog->bottom_vbox = dbox = gtk_vbox_new(FALSE, 18);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1155 gtk_box_pack_start(GTK_BOX(vbox), dbox, FALSE, FALSE, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1156
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1157 gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), dbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1158
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1159 /** Setup the bottom frames. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1160 add_protocol_options(dialog, dbox);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1161 add_proxy_options(dialog, dbox);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
1162
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1163 /* Separator... */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1164 sep = gtk_hseparator_new();
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
1165 gtk_box_pack_start(GTK_BOX(main_vbox), sep, FALSE, FALSE, 0);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1166 gtk_widget_show(sep);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1167
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1168 /* Setup the button box */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1169 bbox = gtk_hbutton_box_new();
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1170 gtk_box_set_spacing(GTK_BOX(bbox), 6);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1171 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
1172 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
1173 gtk_widget_show(bbox);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1174
5850
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1175 if (dialog->prpl_info->register_user != NULL) {
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1176 /* Register button */
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1177 button = gtk_button_new_with_label("Register");
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1178 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1179 gtk_widget_show(button);
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1180
5851
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1181 g_signal_connect(G_OBJECT(button), "clicked",
023fd44672d8 [gaim-migrate @ 6282]
Christian Hammond <chipx86@chipx86.com>
parents: 5850
diff changeset
1182 G_CALLBACK(register_account_prefs_cb), dialog);
5850
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1183 }
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1184
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1185 /* Cancel button */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1186 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1187 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1188 gtk_widget_show(button);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1189
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1190 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1191 G_CALLBACK(cancel_account_prefs_cb), dialog);
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
1192
5850
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1193 /* Save button */
540bd1680b93 [gaim-migrate @ 6281]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1194 button = gtk_button_new_from_stock(GTK_STOCK_SAVE);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1195 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
1196
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1197 if (dialog->account == NULL)
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1198 gtk_widget_set_sensitive(button, FALSE);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1199
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1200 gtk_widget_show(button);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1201
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1202 dialog->ok_button = button;
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1203
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1204 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1205 G_CALLBACK(ok_account_prefs_cb), dialog);
5696
0a20c8e1d2ca [gaim-migrate @ 6117]
Christian Hammond <chipx86@chipx86.com>
parents: 5693
diff changeset
1206
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
1207 /* Show the window. */
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
1208 gtk_widget_show(win);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1209 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1210
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1211 /**************************************************************************
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1212 * Accounts Dialog
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1213 **************************************************************************/
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1214
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1215 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1216 signed_on_off_cb(GaimConnection *gc, AccountsDialog *dialog)
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1217 {
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1218 GaimAccount *account = gaim_connection_get_account(gc);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1219 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1220 GtkTreeIter iter;
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1221 size_t index = g_list_index(gaim_accounts_get_all(), account);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1222
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1223 if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) {
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1224 gtk_list_store_set(dialog->model, &iter,
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1225 COLUMN_ONLINE, gaim_account_is_connected(account),
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1226 -1);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1227 }
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1228 }
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1229
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1230 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1231 drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx,
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1232 GtkSelectionData *data, guint info, guint time,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1233 AccountsDialog *dialog)
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1234 {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1235 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1236 GtkTreeRowReference *ref;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1237 GtkTreePath *source_row;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1238 GtkTreeIter iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1239 GaimAccount *account = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1240 GValue val = {0};
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1241
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1242 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
1243 source_row = gtk_tree_row_reference_get_path(ref);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1244
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1245 if (source_row == NULL)
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1246 return;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1247
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1248 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1249 source_row);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1250 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1251 COLUMN_DATA, &val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1252
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1253 dialog->drag_iter = iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1254
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1255 account = g_value_get_pointer(&val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1256
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1257 gtk_selection_data_set(data, gdk_atom_intern("GAIM_ACCOUNT", FALSE),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1258 8, (void *)&account, sizeof(account));
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1259
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1260 gtk_tree_path_free(source_row);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1261 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1262 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1263
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1264 static void
5802
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1265 move_account_after(GtkListStore *store, GtkTreeIter *iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1266 GtkTreeIter *position)
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1267 {
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1268 GtkTreeIter new_iter;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1269 GaimAccount *account;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1270
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1271 gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1272 COLUMN_DATA, &account,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1273 -1);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1274
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1275 gtk_list_store_insert_after(store, &new_iter, position);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1276
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1277 set_account(store, &new_iter, account);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1278
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1279 gtk_list_store_remove(store, iter);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1280 }
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1281
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1282 static void
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1283 move_account_before(GtkListStore *store, GtkTreeIter *iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1284 GtkTreeIter *position)
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1285 {
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1286 GtkTreeIter new_iter;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1287 GaimAccount *account;
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1288
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1289 gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1290 COLUMN_DATA, &account,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1291 -1);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1292
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1293 gtk_list_store_insert_before(store, &new_iter, position);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1294
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1295 set_account(store, &new_iter, account);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1296
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1297 gtk_list_store_remove(store, iter);
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1298 }
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1299
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1300 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1301 drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx,
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1302 guint x, guint y, GtkSelectionData *sd,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1303 guint info, guint t, AccountsDialog *dialog)
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1304 {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1305 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1306 size_t dest_index;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1307 GaimAccount *a = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1308 GtkTreePath *path = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1309 GtkTreeViewDropPosition position;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1310
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1311 memcpy(&a, sd->data, sizeof(a));
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1312
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1313 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
1314 &path, &position)) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1315
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1316 GtkTreeIter iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1317 GaimAccount *account;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1318 GValue val = {0};
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1319
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1320 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1321 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1322 COLUMN_DATA, &val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1323
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1324 account = g_value_get_pointer(&val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1325
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1326 switch (position) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1327 case GTK_TREE_VIEW_DROP_AFTER:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1328 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
5802
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1329 move_account_after(dialog->model, &dialog->drag_iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1330 &iter);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1331 dest_index = g_list_index(gaim_accounts_get_all(),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1332 account) + 1;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1333 break;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1334
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1335 case GTK_TREE_VIEW_DROP_BEFORE:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1336 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1337 dest_index = g_list_index(gaim_accounts_get_all(),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1338 account);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1339
5802
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1340 move_account_before(dialog->model, &dialog->drag_iter,
d23c0d94be18 [gaim-migrate @ 6232]
Christian Hammond <chipx86@chipx86.com>
parents: 5783
diff changeset
1341 &iter);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1342 break;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1343
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1344 default:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1345 return;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1346 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1347
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1348 gaim_accounts_reorder(a, dest_index);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1349 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1350 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1351 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1352
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1353 static gint
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1354 accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsDialog *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1355 {
5725
d1aecc84319c [gaim-migrate @ 6147]
Nathan Walp <nwalp@pidgin.im>
parents: 5718
diff changeset
1356 gaim_signals_disconnect_by_handle(dialog);
d1aecc84319c [gaim-migrate @ 6147]
Nathan Walp <nwalp@pidgin.im>
parents: 5718
diff changeset
1357
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1358 g_free(accounts_dialog);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1359 accounts_dialog = NULL;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1360
5709
2c4e7df0a688 [gaim-migrate @ 6130]
Christian Hammond <chipx86@chipx86.com>
parents: 5708
diff changeset
1361
5617
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1362 /* See if we're the main window here. */
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1363 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL &&
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1364 mainwindow == NULL && gaim_connections_get_all() == NULL) {
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1365
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1366 do_quit();
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1367 }
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1368
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1369 return FALSE;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1370 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1371
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1372 static gboolean
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1373 configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1374 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1375 if (GTK_WIDGET_VISIBLE(w)) {
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1376 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
1377 int col_width;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1378 int difference;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1379
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1380 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1381 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
1382
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1383 col_width = gtk_tree_view_column_get_width(dialog->screenname_col);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1384
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1385 if (col_width == 0)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1386 return FALSE;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1387
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1388 difference = (MAX(old_width, event->width) -
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1389 MIN(old_width, event->width));
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1390
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1391 if (difference == 0)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1392 return FALSE;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1393
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1394 if (old_width < event->width)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1395 gtk_tree_view_column_set_min_width(dialog->screenname_col,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1396 col_width + difference);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1397 else
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1398 gtk_tree_view_column_set_max_width(dialog->screenname_col,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1399 col_width - difference);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1400 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1401
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1402 return FALSE;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1403 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1404
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1405 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1406 add_account_cb(GtkWidget *w, AccountsDialog *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1407 {
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1408 show_account_prefs(ADD_ACCOUNT_DIALOG, dialog, NULL);
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1409 }
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1410
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1411 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1412 modify_account_sel(GtkTreeModel *model, GtkTreePath *path,
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1413 GtkTreeIter *iter, gpointer data)
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1414 {
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1415 GaimAccount *account;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1416
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1417 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1418
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1419 if (account != NULL)
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1420 show_account_prefs(MODIFY_ACCOUNT_DIALOG, data, account);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1421 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1422
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1423 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1424 modify_account_cb(GtkWidget *w, AccountsDialog *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1425 {
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1426 GtkTreeSelection *selection;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1427
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1428 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1429
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1430 gtk_tree_selection_selected_foreach(selection, modify_account_sel,
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1431 dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1432 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1433
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1434 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1435 delete_account_cb(GaimAccount *account)
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1436 {
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1437 size_t index;
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1438 GtkTreeIter iter;
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1439
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1440 index = g_list_index(gaim_accounts_get_all(), account);
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1441
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1442 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(accounts_dialog->model),
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1443 &iter, NULL, index)) {
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1444
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1445 gtk_list_store_remove(accounts_dialog->model, &iter);
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1446 }
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1447
5710
dbac958d8937 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5709
diff changeset
1448 gaim_accounts_remove(account);
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1449 gaim_account_destroy(account);
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1450 }
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1451
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1452 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1453 ask_delete_account_sel(GtkTreeModel *model, GtkTreePath *path,
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1454 GtkTreeIter *iter, gpointer data)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1455 {
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1456 GaimAccount *account;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1457
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1458 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1459
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1460 if (account != NULL) {
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1461 char buf[8192];
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1462
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1463 g_snprintf(buf, sizeof(buf),
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1464 _("Are you sure you want to delete %s?"),
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1465 gaim_account_get_username(account));
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1466
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1467 gaim_request_action(NULL, NULL, buf, NULL, 1, account, 2,
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1468 _("Delete"), delete_account_cb,
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1469 _("Cancel"), NULL);
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1470 }
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1471 }
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1472
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1473 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1474 ask_delete_account_cb(GtkWidget *w, AccountsDialog *dialog)
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1475 {
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1476 GtkTreeSelection *selection;
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1477
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1478 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1479
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1480 gtk_tree_selection_selected_foreach(selection, ask_delete_account_sel,
5701
730bfc7c5e2d [gaim-migrate @ 6122]
Christian Hammond <chipx86@chipx86.com>
parents: 5700
diff changeset
1481 dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1482 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1483
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1484 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1485 close_accounts_cb(GtkWidget *w, AccountsDialog *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1486 {
5617
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1487 gtk_widget_destroy(dialog->window);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1488
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1489 accedit_win_destroy_cb(NULL, NULL, dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1490 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1491
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1492 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1493 online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1494 {
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1495 AccountsDialog *dialog = (AccountsDialog *)data;
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1496 GaimAccount *account;
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1497 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model);
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1498 GtkTreeIter iter;
5637
69c92ae58876 [gaim-migrate @ 6044]
Nathan Walp <nwalp@pidgin.im>
parents: 5620
diff changeset
1499 gboolean online;
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1500
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1501 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
5718
c19cc2a3d65e [gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
1502 gtk_tree_model_get(model, &iter,
c19cc2a3d65e [gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
1503 COLUMN_DATA, &account,
c19cc2a3d65e [gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
1504 COLUMN_ONLINE, &online,
c19cc2a3d65e [gaim-migrate @ 6140]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
1505 -1);
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1506
5637
69c92ae58876 [gaim-migrate @ 6044]
Nathan Walp <nwalp@pidgin.im>
parents: 5620
diff changeset
1507 if (online)
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1508 gaim_account_disconnect(account);
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1509 else
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1510 gaim_account_connect(account);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1511 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1512
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1513 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1514 autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1515 gpointer data)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1516 {
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1517 AccountsDialog *dialog = (AccountsDialog *)data;
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1518 GaimAccount *account;
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1519 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model);
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1520 GtkTreeIter iter;
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1521 gboolean autologin;
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1522
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1523 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1524 gtk_tree_model_get(model, &iter,
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1525 COLUMN_DATA, &account,
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1526 COLUMN_AUTOLOGIN, &autologin,
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1527 -1);
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1528
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1529 gaim_account_set_auto_login(account, GAIM_GTK_UI, !autologin);
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1530
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1531 gtk_list_store_set(dialog->model, &iter,
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1532 COLUMN_AUTOLOGIN, !autologin,
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1533 -1);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1534 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1535
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1536 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1537 add_columns(GtkWidget *treeview, AccountsDialog *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1538 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1539 GtkCellRenderer *renderer;
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1540 GtkTreeViewColumn *column;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1541
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1542 /* Screen name column */
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1543 column = gtk_tree_view_column_new();
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1544 gtk_tree_view_column_set_title(column, _("Screenname"));
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1545 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1546
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1547 /* Icon */
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1548 renderer = gtk_cell_renderer_pixbuf_new();
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1549 gtk_tree_view_column_pack_start(column, renderer, FALSE);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1550 gtk_tree_view_column_add_attribute(column, renderer,
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1551 "pixbuf", COLUMN_ICON);
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1552
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1553 /* Screen name */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1554 renderer = gtk_cell_renderer_text_new();
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1555 gtk_tree_view_column_pack_start(column, renderer, TRUE);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1556 gtk_tree_view_column_add_attribute(column, renderer,
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1557 "text", COLUMN_SCREENNAME);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1558 dialog->screenname_col = column;
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1559
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1560 /* Online? */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1561 renderer = gtk_cell_renderer_toggle_new();
5782
087b4b5abe35 [gaim-migrate @ 6207]
Christian Hammond <chipx86@chipx86.com>
parents: 5781
diff changeset
1562
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1563 g_signal_connect(G_OBJECT(renderer), "toggled",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1564 G_CALLBACK(online_cb), dialog);
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1565
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1566 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1567 -1, _("Online"),
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1568 renderer,
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1569 "active", COLUMN_ONLINE,
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1570 NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1571
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1572 /* Auto-login? */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1573 renderer = gtk_cell_renderer_toggle_new();
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1574
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1575 g_signal_connect(G_OBJECT(renderer), "toggled",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1576 G_CALLBACK(autologin_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1577
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1578 column = gtk_tree_view_column_new_with_attributes(_("Auto-login"),
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1579 renderer, "active", COLUMN_AUTOLOGIN, NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1580
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1581 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1582
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1583 /* Protocol name */
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1584 column = gtk_tree_view_column_new();
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1585 gtk_tree_view_column_set_title(column, _("Protocol"));
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1586 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1587
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1588 renderer = gtk_cell_renderer_text_new();
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1589 gtk_tree_view_column_pack_start(column, renderer, TRUE);
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1590 gtk_tree_view_column_add_attribute(column, renderer,
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1591 "text", COLUMN_PROTOCOL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1592 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1593
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1594 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1595 set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account)
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1596 {
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1597 GdkPixbuf *pixbuf;
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1598 GdkPixbuf *scale;
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1599
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1600 scale = NULL;
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1601
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1602 pixbuf = create_prpl_icon(account);
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1603
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1604 if (pixbuf != NULL)
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1605 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1606
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1607 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", "auto-login for %s: %d\n",
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1608 gaim_account_get_username(account),
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1609 gaim_account_get_auto_login(account, GAIM_GTK_UI));
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1610
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1611 gtk_list_store_set(store, iter,
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1612 COLUMN_ICON, scale,
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1613 COLUMN_SCREENNAME, gaim_account_get_username(account),
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1614 COLUMN_ONLINE, gaim_account_is_connected(account),
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1615 COLUMN_AUTOLOGIN, gaim_account_get_auto_login(account, GAIM_GTK_UI),
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1616 COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol(account)),
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1617 COLUMN_DATA, account,
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1618 -1);
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1619
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1620 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf));
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1621 if (scale != NULL) g_object_unref(G_OBJECT(scale));
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1622 }
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1623
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1624 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1625 add_account(AccountsDialog *dialog, GaimAccount *account)
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1626 {
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1627 GtkTreeIter iter;
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1628
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1629 gtk_list_store_append(dialog->model, &iter);
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1630
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1631 set_account(dialog->model, &iter, account);
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1632 }
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1633
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1634 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1635 populate_accounts_list(AccountsDialog *dialog)
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1636 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1637 GList *l;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1638
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1639 gtk_list_store_clear(dialog->model);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1640
5698
81d7b4239815 [gaim-migrate @ 6119]
Christian Hammond <chipx86@chipx86.com>
parents: 5697
diff changeset
1641 for (l = gaim_accounts_get_all(); l != NULL; l = l->next)
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1642 add_account(dialog, (GaimAccount *)l->data);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1643 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1644
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1645 static void
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1646 account_selected_cb(GtkTreeSelection *sel, AccountsDialog *dialog)
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1647 {
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1648 gtk_widget_set_sensitive(dialog->modify_button, TRUE);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1649 gtk_widget_set_sensitive(dialog->delete_button, TRUE);
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1650 }
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1651
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1652 static GtkWidget *
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1653 create_accounts_list(AccountsDialog *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1654 {
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1655 GtkWidget *sw;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1656 GtkWidget *treeview;
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1657 GtkTreeSelection *sel;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1658 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}};
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1659
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1660 /* Create the scrolled window. */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1661 sw = gtk_scrolled_window_new(0, 0);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1662 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1663 GTK_POLICY_AUTOMATIC,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1664 GTK_POLICY_ALWAYS);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1665 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1666 GTK_SHADOW_IN);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1667 gtk_widget_show(sw);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1668
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1669 /* Create the list model. */
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1670 dialog->model = gtk_list_store_new(NUM_COLUMNS,
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1671 GDK_TYPE_PIXBUF, G_TYPE_STRING,
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1672 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
5781
c8837160add6 [gaim-migrate @ 6206]
Christian Hammond <chipx86@chipx86.com>
parents: 5779
diff changeset
1673 G_TYPE_STRING, G_TYPE_POINTER);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1674
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1675 /* And now the actual treeview */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1676 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
1677 dialog->treeview = treeview;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1678 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1679 gtk_tree_selection_set_mode(
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1680 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1681 GTK_SELECTION_MULTIPLE);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1682
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1683 gtk_container_add(GTK_CONTAINER(sw), treeview);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1684 gtk_widget_show(treeview);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1685
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1686 add_columns(treeview, dialog);
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1687
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1688 populate_accounts_list(dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1689
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1690 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1691 g_signal_connect(G_OBJECT(sel), "changed",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1692 G_CALLBACK(account_selected_cb), dialog);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1693
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1694 /* Setup DND. I wanna be an orc! */
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1695 gtk_tree_view_enable_model_drag_source(
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1696 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte,
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1697 1, GDK_ACTION_COPY);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1698 gtk_tree_view_enable_model_drag_dest(
5779
758fa27534b3 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5774
diff changeset
1699 GTK_TREE_VIEW(treeview), gte, 1,
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1700 GDK_ACTION_COPY | GDK_ACTION_MOVE);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1701
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1702 g_signal_connect(G_OBJECT(treeview), "drag-data-received",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1703 G_CALLBACK(drag_data_received_cb), dialog);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1704 g_signal_connect(G_OBJECT(treeview), "drag-data-get",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1705 G_CALLBACK(drag_data_get_cb), dialog);
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1706
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1707 return sw;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1708 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1709
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1710 void
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1711 gaim_gtk_account_dialog_show(void)
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1712 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1713 AccountsDialog *dialog;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1714 GtkWidget *win;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1715 GtkWidget *vbox;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1716 GtkWidget *bbox;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1717 GtkWidget *sw;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1718 GtkWidget *sep;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1719 GtkWidget *button;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1720 int width, height;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1721
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1722 if (accounts_dialog != NULL)
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1723 return;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1724
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1725 accounts_dialog = dialog = g_new0(AccountsDialog, 1);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1726
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1727 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width");
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1728 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height");
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1729
5803
56042e59499a [gaim-migrate @ 6233]
Christian Hammond <chipx86@chipx86.com>
parents: 5802
diff changeset
1730 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1731 gtk_window_set_default_size(GTK_WINDOW(win), width, height);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1732 gtk_window_set_role(GTK_WINDOW(win), "accounts");
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1733 gtk_window_set_title(GTK_WINDOW(win), _("Accounts"));
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1734 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1735
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1736 g_signal_connect(G_OBJECT(win), "delete_event",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1737 G_CALLBACK(accedit_win_destroy_cb), accounts_dialog);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1738 g_signal_connect(G_OBJECT(win), "configure_event",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1739 G_CALLBACK(configure_cb), accounts_dialog);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1740
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1741 /* Setup the vbox */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1742 vbox = gtk_vbox_new(FALSE, 12);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1743 gtk_container_add(GTK_CONTAINER(win), vbox);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1744 gtk_widget_show(vbox);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1745
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1746 /* Setup the scrolled window that will contain the list of accounts. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1747 sw = create_accounts_list(dialog);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1748 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1749 gtk_widget_show(sw);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1750
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1751 /* Separator... */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1752 sep = gtk_hseparator_new();
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1753 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1754 gtk_widget_show(sep);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1755
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1756 /* Button box. */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1757 bbox = gtk_hbutton_box_new();
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1758 gtk_box_set_spacing(GTK_BOX(bbox), 6);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1759 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1760 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
1761 gtk_widget_show(bbox);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1762
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1763 /* Add button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1764 button = gtk_button_new_from_stock(GTK_STOCK_ADD);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1765 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1766 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1767
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1768 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1769 G_CALLBACK(add_account_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1770
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1771 /* Modify button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1772 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1773 dialog->modify_button = button;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1774 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
1775 gtk_widget_set_sensitive(button, FALSE);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1776 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1777
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1778 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1779 G_CALLBACK(modify_account_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1780
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1781 /* Delete button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1782 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
5703
cee14870644c [gaim-migrate @ 6124]
Christian Hammond <chipx86@chipx86.com>
parents: 5702
diff changeset
1783 dialog->delete_button = button;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1784 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
1785 gtk_widget_set_sensitive(button, FALSE);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1786 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1787
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1788 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1789 G_CALLBACK(ask_delete_account_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1790
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1791 /* Close button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1792 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1793 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1794 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1795
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1796 g_signal_connect(G_OBJECT(button), "clicked",
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1797 G_CALLBACK(close_accounts_cb), dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1798
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1799 /* Setup some gaim signal handlers. */
5774
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1800 gaim_signal_connect(dialog, event_signon, signed_on_off_cb, dialog);
e8f6209c4f59 [gaim-migrate @ 6199]
Sean Egan <seanegan@gmail.com>
parents: 5725
diff changeset
1801 gaim_signal_connect(dialog, event_signoff, signed_on_off_cb, dialog);
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1802
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1803 gtk_widget_show(win);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1804 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1805