annotate src/gtkaccount.c @ 5694:2d0d96c5a7a7

[gaim-migrate @ 6115] Added a function to clear all protocol settings from an account. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 03 Jun 2003 07:44:42 +0000
parents 0b5318235562
children 0a20c8e1d2ca
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 */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "gtkaccount.h"
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "account.h"
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
25 #include "accountopt.h"
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
26 #include "event.h"
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "prefs.h"
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 #include "stock.h"
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
29 #include "gtkblist.h"
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
30 #include "gaim-disclosure.h"
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
31
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
32 #ifdef _WIN32
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
33 # include <gdk/gdkwin32.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
34 #else
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
35 # include <unistd.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
36 # include <gdk/gdkx.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
37 #endif
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
38
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
39 #include <string.h>
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
40
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
41 enum
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
42 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
43 COLUMN_ICON,
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
44 COLUMN_PROTOCOL,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
45 COLUMN_SCREENNAME,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
46 COLUMN_ONLINE,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
47 COLUMN_AUTOLOGIN,
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
48 COLUMN_FILLER,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
49 COLUMN_DATA,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
50 NUM_COLUMNS
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
51 };
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
53 typedef enum
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
54 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
55 ADD_ACCOUNT_DIALOG,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
56 MODIFY_ACCOUNT_DIALOG
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
57
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
58 } AccountPrefsDialogType;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
59
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 typedef struct
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 GtkWidget *window;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
63 GtkWidget *treeview;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
65 GtkListStore *model;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
66 GtkTreeIter drag_iter;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
67
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
68 GtkTreeViewColumn *screenname_col;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
69
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 } AccountsDialog;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
72 typedef struct
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
73 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
74 AccountPrefsDialogType type;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
75
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
76 GaimAccount *account;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
77 GaimProtocol protocol;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
78 GaimPlugin *plugin;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
79 GaimPluginProtocolInfo *prpl_info;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
80
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
81 GaimProxyType new_proxy_type;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
82
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
83 GtkSizeGroup *sg;
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
84 GtkWidget *window;
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
85
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
86 GtkWidget *top_vbox;
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
87 GtkWidget *bottom_vbox;
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
88
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
89 /* Login Options */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
90 GtkWidget *login_frame;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
91 GtkWidget *protocol_menu;
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
92 GtkWidget *password_box;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
93 GtkWidget *screenname_entry;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
94 GtkWidget *password_entry;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
95 GtkWidget *alias_entry;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
96 GtkWidget *remember_pass_check;
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
97 GtkWidget *auto_login_check;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
98
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
99 /* User Options */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
100 GtkWidget *user_frame;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
101 GtkWidget *new_mail_check;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
102 GtkWidget *buddy_icon_hbox;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
103 GtkWidget *buddy_icon_entry;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
104
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
105 /* Protocol Options */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
106 GtkWidget *protocol_frame;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
107 GtkWidget *register_check;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
108
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
109 /* Proxy Options */
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
110 GtkWidget *proxy_frame;
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
111 GtkWidget *proxy_vbox;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
112 GtkWidget *proxy_dropdown;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
113 GtkWidget *proxy_menu;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
114 GtkWidget *proxy_host_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
115 GtkWidget *proxy_port_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
116 GtkWidget *proxy_user_entry;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
117 GtkWidget *proxy_pass_entry;
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
118
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
119 } AccountPrefsDialog;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
120
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
121
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 static AccountsDialog *accounts_dialog = NULL;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
124
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
125 static char *
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
126 proto_name(int proto)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
127 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
128 GaimPlugin *p = gaim_find_prpl(proto);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
129
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
130 return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
131 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
132
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
133 /**************************************************************************
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
134 * Add/Modify Account dialog
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
135 **************************************************************************/
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
136 static void __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
137 static void __add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
138 static void __add_protocol_options(AccountPrefsDialog *dialog,
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
139 GtkWidget *parent);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
140 static void __add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
141
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
142 static GtkWidget *
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
143 __add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
144 const char *text, GtkWidget *widget)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
145 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
146 GtkWidget *hbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
147 GtkWidget *label;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
148
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
149 hbox = gtk_hbox_new(FALSE, 6);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
150 gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
151 gtk_widget_show(hbox);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
152
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
153 label = gtk_label_new_with_mnemonic(text);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
154 gtk_size_group_add_widget(dialog->sg, label);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
155 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
156 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
157 gtk_widget_show(label);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
158
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
159 gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
160 gtk_widget_show(widget);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
161
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
162 return hbox;
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
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
165 static void
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
166 __set_account_protocol_cb(GtkWidget *item, GaimProtocol protocol,
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
167 AccountPrefsDialog *dialog)
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
168 {
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
169 dialog->protocol = protocol;
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
170
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
171 if ((dialog->plugin = gaim_find_prpl(dialog->protocol)) != NULL)
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
172 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
173
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
174 __add_login_options(dialog, dialog->top_vbox);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
175 __add_user_options(dialog, dialog->top_vbox);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
176 __add_protocol_options(dialog, dialog->bottom_vbox);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
177 }
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
178
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
179 static void
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
180 __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
181 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
182 GtkWidget *frame;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
183 GtkWidget *vbox;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
184 GtkWidget *entry;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
185 GList *user_splits;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
186 GList *split_entries = NULL;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
187 GList *l, *l2;
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
188 char *username = NULL;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
189
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
190 if (dialog->login_frame != NULL)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
191 gtk_widget_destroy(dialog->login_frame);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
192
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
193 /* Build the login options frame. */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
194 frame = gaim_gtk_make_frame(parent, _("Login Options"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
195
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
196 /* cringe */
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
197 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
198
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
199 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
200 gtk_widget_show(dialog->login_frame);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
201
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
202 /* Main vbox */
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
203 vbox = gtk_vbox_new(FALSE, 6);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
204 gtk_container_add(GTK_CONTAINER(frame), vbox);
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
205 gtk_widget_show(vbox);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
206
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
207 /* Protocol */
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
208 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new(
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
209 dialog->protocol, G_CALLBACK(__set_account_protocol_cb), dialog);
5644
213e999fa5cc [gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents: 5641
diff changeset
210
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
211 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
212
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
213 /* Screen Name */
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
214 dialog->screenname_entry = gtk_entry_new();
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
215
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
216 __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry);
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
217
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
218 /* Do the user split thang */
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
219 if (dialog->plugin == NULL) /* Yeah right. */
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
220 user_splits = NULL;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
221 else
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
222 user_splits = dialog->prpl_info->user_splits;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
223
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
224 if (dialog->account != NULL)
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
225 username = g_strdup(gaim_account_get_username(dialog->account));
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
226
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
227 for (l = user_splits; l != NULL; l = l->next) {
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
228 GaimAccountUserSplit *split = l->data;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
229 char *buf;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
230
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
231 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
232
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
233 entry = gtk_entry_new();
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
234
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
235 __add_pref_box(dialog, vbox, buf, entry);
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
236
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
237 g_free(buf);
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
238
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
239 split_entries = g_list_append(split_entries, entry);
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
240 }
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
241
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
242 for (l = g_list_last(split_entries), l2 = g_list_last(user_splits);
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
243 l != NULL && l2 != NULL;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
244 l = l->prev, l2 = l2->prev) {
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
245
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
246 GaimAccountUserSplit *split = l2->data;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
247 GtkWidget *entry = l->data;
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
248 const char *value = NULL;
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
249 char *c;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
250
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
251 if (dialog->account != NULL) {
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
252 c = strrchr(username,
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
253 gaim_account_user_split_get_separator(split));
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
254
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
255 if (c != NULL) {
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
256 *c = '\0';
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
257 c++;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
258
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
259 value = c;
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
260 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
261 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
262
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
263 if (value == NULL)
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
264 value = gaim_account_user_split_get_default_value(split);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
265
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
266 if (value != NULL)
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
267 gtk_entry_set_text(GTK_ENTRY(entry), value);
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
268 }
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
269
5656
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
270 if (username != NULL)
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
271 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
272
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
273 g_free(username);
160dfd3b0679 [gaim-migrate @ 6070]
Christian Hammond <chipx86@chipx86.com>
parents: 5653
diff changeset
274
5653
2216abc2d421 [gaim-migrate @ 6067]
Christian Hammond <chipx86@chipx86.com>
parents: 5651
diff changeset
275 g_list_free(split_entries);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
276
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
277 /* Password */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
278 dialog->password_entry = gtk_entry_new();
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
279 gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE);
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
280 dialog->password_box = __add_pref_box(dialog, vbox, _("Password:"),
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
281 dialog->password_entry);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
282
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
283 /* Alias */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
284 dialog->alias_entry = gtk_entry_new();
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
285 __add_pref_box(dialog, vbox, _("Alias:"), dialog->alias_entry);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
286
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
287 /* Remember Password */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
288 dialog->remember_pass_check =
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
289 gtk_check_button_new_with_label(_("Remember password"));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
290 gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check,
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
291 FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
292 gtk_widget_show(dialog->remember_pass_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
293
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
294 /* Auto-Login */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
295 dialog->auto_login_check =
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
296 gtk_check_button_new_with_label(_("Auto-login"));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
297 gtk_box_pack_start(GTK_BOX(vbox), dialog->auto_login_check,
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
298 FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
299 gtk_widget_show(dialog->auto_login_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
300
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
301 /* Set the fields. */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
302 if (dialog->account != NULL) {
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
303 if (gaim_account_get_password(dialog->account))
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
304 gtk_entry_set_text(GTK_ENTRY(dialog->password_entry),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
305 gaim_account_get_password(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
306
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
307 if (gaim_account_get_alias(dialog->account))
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
308 gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
309 gaim_account_get_alias(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
310
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
311 gtk_toggle_button_set_active(
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
312 GTK_TOGGLE_BUTTON(dialog->remember_pass_check),
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
313 gaim_account_get_remember_password(dialog->account));
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
314
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
315 gtk_toggle_button_set_active(
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
316 GTK_TOGGLE_BUTTON(dialog->auto_login_check), FALSE);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
317 }
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
318
5662
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
319 if (dialog->prpl_info != NULL &&
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
320 (dialog->prpl_info->options & OPT_PROTO_NO_PASSWORD)) {
937d5554021e [gaim-migrate @ 6076]
Christian Hammond <chipx86@chipx86.com>
parents: 5661
diff changeset
321
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
322 gtk_widget_hide(dialog->password_box);
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
323 gtk_widget_hide(dialog->remember_pass_check);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
324 }
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
325 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
326
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
327 static void
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
328 __add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
329 {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
330 GtkWidget *frame;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
331 GtkWidget *vbox;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
332 GtkWidget *hbox;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
333 GtkWidget *button;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
334 GtkWidget *label;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
335
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
336 if (dialog->user_frame != NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
337 gtk_widget_destroy(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
338
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
339 /* Build the user options frame. */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
340 frame = gaim_gtk_make_frame(parent, _("User Options"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
341 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
342
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
343 gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
344 gtk_widget_show(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
345
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
346 /* Main vbox */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
347 vbox = gtk_vbox_new(FALSE, 6);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
348 gtk_container_add(GTK_CONTAINER(frame), vbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
349 gtk_widget_show(vbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
350
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
351 /* New mail notifications */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
352 dialog->new_mail_check =
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
353 gtk_check_button_new_with_label(_("New mail notifications"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
354 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
355 gtk_widget_show(dialog->new_mail_check);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
356
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
357 /* Buddy icon */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
358 dialog->buddy_icon_hbox = hbox = gtk_hbox_new(FALSE, 6);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
359 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
360 gtk_widget_show(hbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
361
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
362 label = gtk_label_new(_("Buddy icon file:"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
363 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
364 gtk_widget_show(label);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
365
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
366 dialog->buddy_icon_entry = gtk_entry_new();
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
367 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
368 gtk_widget_show(dialog->buddy_icon_entry);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
369
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
370 button = gtk_button_new_with_label(_("Browse"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
371 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
372 gtk_widget_show(button);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
373
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
374 button = gtk_button_new_with_label(_("Reset"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
375 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
376 gtk_widget_show(button);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
377
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
378 if (dialog->prpl_info != NULL) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
379 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK))
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
380 gtk_widget_hide(dialog->new_mail_check);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
381
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
382 if (!(dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON))
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
383 gtk_widget_hide(dialog->buddy_icon_hbox);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
384 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
385
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
386 if (dialog->account != NULL) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
387 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
388 gaim_account_get_check_mail(dialog->account));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
389
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
390 if (gaim_account_get_buddy_icon(dialog->account) != NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
391 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_icon_entry),
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
392 gaim_account_get_buddy_icon(dialog->account));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
393 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
394
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
395 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) &&
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
396 !(dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON)) {
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
397
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
398 /* Nothing to see :( aww. */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
399 gtk_widget_hide(dialog->user_frame);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
400 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
401 }
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
402
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
403 static void
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
404 __add_protocol_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
405 {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
406 GaimAccountOption *option;
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
407 GaimAccount *account;
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
408 GtkWidget *frame;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
409 GtkWidget *vbox;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
410 GtkWidget *check;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
411 GtkWidget *entry;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
412 GList *l;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
413 char buf[1024];
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
414 char *title;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
415 const char *str_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
416 gboolean bool_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
417 int int_value;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
418
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
419 if (dialog->protocol_frame != NULL) {
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
420 gtk_widget_destroy(dialog->protocol_frame);
5689
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
421 dialog->protocol_frame = NULL;
7a619706e048 [gaim-migrate @ 6110]
Christian Hammond <chipx86@chipx86.com>
parents: 5688
diff changeset
422 }
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
423
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
424 if (dialog->prpl_info == NULL ||
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
425 dialog->prpl_info->protocol_options == NULL) {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
426
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
427 return;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
428 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
429
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
430 account = dialog->account;
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
431
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
432 /* Build the protocol options frame. */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
433 g_snprintf(buf, sizeof(buf), _("%s Options"), dialog->plugin->info->name);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
434
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
435 frame = gaim_gtk_make_frame(parent, buf);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
436 dialog->protocol_frame =
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
437 gtk_widget_get_parent(gtk_widget_get_parent(frame));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
438
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
439 gtk_box_reorder_child(GTK_BOX(parent), dialog->protocol_frame, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
440 gtk_widget_show(dialog->protocol_frame);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
441
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
442 /* Main vbox */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
443 vbox = gtk_vbox_new(FALSE, 6);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
444 gtk_container_add(GTK_CONTAINER(frame), vbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
445 gtk_widget_show(vbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
446
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
447 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
448 option = (GaimAccountOption *)l->data;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
449
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
450 switch (gaim_account_option_get_type(option)) {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
451 case GAIM_PREF_BOOLEAN:
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
452 if (account == NULL ||
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
453 gaim_account_get_protocol(account) != dialog->protocol) {
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
454
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
455 bool_value = gaim_account_option_get_default_bool(option);
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
456 }
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
457 else
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
458 bool_value = gaim_account_get_bool(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
459 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
460 gaim_account_option_get_default_bool(option));
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
461
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
462 check = gtk_check_button_new_with_label(
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
463 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
464
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
465 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
466 bool_value);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
467
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
468 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
469 gtk_widget_show(check);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
470 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
471
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
472 case GAIM_PREF_INT:
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
473 if (account == NULL ||
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
474 gaim_account_get_protocol(account) != dialog->protocol) {
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
475
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
476 int_value = gaim_account_option_get_default_int(option);
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
477 }
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
478 else
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
479 int_value = gaim_account_get_int(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
480 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
481 gaim_account_option_get_default_int(option));
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
482
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
483 g_snprintf(buf, sizeof(buf), "%d", int_value);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
484
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
485 entry = gtk_entry_new();
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
486 gtk_entry_set_text(GTK_ENTRY(entry), buf);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
487
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
488 title = g_strdup_printf("%s:",
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
489 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
490
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
491 __add_pref_box(dialog, vbox, title, entry);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
492
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
493 g_free(title);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
494 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
495
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
496 case GAIM_PREF_STRING:
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
497 if (account == NULL ||
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
498 gaim_account_get_protocol(account) != dialog->protocol) {
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
499
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
500 str_value = gaim_account_option_get_default_string(option);
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
501 }
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
502 else
5690
08d20eb262c7 [gaim-migrate @ 6111]
Christian Hammond <chipx86@chipx86.com>
parents: 5689
diff changeset
503 str_value = gaim_account_get_string(account,
5664
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
504 gaim_account_option_get_setting(option),
7867ae4836ac [gaim-migrate @ 6079]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
505 gaim_account_option_get_default_string(option));
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
506
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
507 entry = gtk_entry_new();
5663
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
508
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
509 if (str_value != NULL)
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5662
diff changeset
510 gtk_entry_set_text(GTK_ENTRY(entry), str_value);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
511
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
512 title = g_strdup_printf("%s:",
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
513 gaim_account_option_get_text(option));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
514
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
515 __add_pref_box(dialog, vbox, title, entry);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
516
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
517 g_free(title);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
518 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
519
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
520 default:
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
521 break;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
522 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
523 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
524
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
525 /* Register user */
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
526 if (dialog->prpl_info->register_user != NULL) {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
527 dialog->register_check =
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
528 gtk_check_button_new_with_label(_("Register with your server"));
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
529
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
530 gtk_box_pack_start(GTK_BOX(vbox), dialog->register_check,
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
531 FALSE, FALSE, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
532 gtk_widget_show(dialog->register_check);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
533 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
534 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
535
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
536 static GtkWidget *
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
537 __make_proxy_dropdown(void)
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
538 {
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
539 GtkWidget *dropdown;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
540 GtkWidget *menu;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
541 GtkWidget *item;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
542
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
543 dropdown = gtk_option_menu_new();
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
544 menu = gtk_menu_new();
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
545
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
546 /* Use Global Proxy Settings */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
547 item = gtk_menu_item_new_with_label(_("Use Global Proxy Settings"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
548 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
549 GINT_TO_POINTER(GAIM_PROXY_USE_GLOBAL));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
550 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
551 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
552
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
553 /* No Proxy */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
554 item = gtk_menu_item_new_with_label(_("No Proxy"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
555 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
556 GINT_TO_POINTER(GAIM_PROXY_NONE));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
557 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
558 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
559
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
560 /* SOCKS 4 */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
561 item = gtk_menu_item_new_with_label(_("SOCKS 4"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
562 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
563 GINT_TO_POINTER(GAIM_PROXY_SOCKS4));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
564 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
565 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
566
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
567 /* SOCKS 5 */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
568 item = gtk_menu_item_new_with_label(_("SOCKS 5"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
569 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
570 GINT_TO_POINTER(GAIM_PROXY_SOCKS5));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
571 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
572 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
573
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
574 /* HTTP */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
575 item = gtk_menu_item_new_with_label(_("HTTP"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
576 g_object_set_data(G_OBJECT(item), "proxytype",
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
577 GINT_TO_POINTER(GAIM_PROXY_HTTP));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
578 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
579 gtk_widget_show(item);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
580
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
581 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
582
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
583 return dropdown;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
584 }
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
585
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
586 static void
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
587 __proxy_type_changed_cb(GtkWidget *optmenu, AccountPrefsDialog *dialog)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
588 {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
589 dialog->new_proxy_type =
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
590 gtk_option_menu_get_history(GTK_OPTION_MENU(optmenu)) - 1;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
591
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
592 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL ||
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
593 dialog->new_proxy_type == GAIM_PROXY_NONE) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
594
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
595 gtk_widget_hide_all(dialog->proxy_vbox);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
596 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
597 else
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
598 gtk_widget_show_all(dialog->proxy_vbox);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
599 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
600
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
601 static void
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
602 __add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent)
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
603 {
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
604 GaimProxyInfo *proxy_info;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
605 GtkWidget *frame;
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
606 GtkWidget *vbox;
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
607 GtkWidget *vbox2;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
608
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
609 if (dialog->proxy_frame != NULL)
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
610 gtk_widget_destroy(dialog->proxy_frame);
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
611
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
612 frame = gaim_gtk_make_frame(parent, _("Proxy Options"));
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
613 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
614
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
615 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
616 gtk_widget_show(dialog->proxy_frame);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
617
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
618 /* Main vbox */
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
619 vbox = gtk_vbox_new(FALSE, 6);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
620 gtk_container_add(GTK_CONTAINER(frame), vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
621 gtk_widget_show(vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
622
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
623 /* Proxy Type drop-down. */
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
624 dialog->proxy_dropdown = __make_proxy_dropdown();
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
625 dialog->proxy_menu =
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
626 gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->proxy_dropdown));
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
627
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
628 __add_pref_box(dialog, vbox, _("Proxy _type:"), dialog->proxy_dropdown);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
629
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
630 /* Setup the second vbox, which may be hidden at times. */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
631 dialog->proxy_vbox = vbox2 = gtk_vbox_new(FALSE, 6);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
632 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
633 gtk_widget_show(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
634
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
635 /* Host */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
636 dialog->proxy_host_entry = gtk_entry_new();
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
637 __add_pref_box(dialog, vbox2, _("_Host:"), dialog->proxy_host_entry);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
638
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
639 /* Port */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
640 dialog->proxy_port_entry = gtk_entry_new();
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
641 __add_pref_box(dialog, vbox2, _("_Port:"), dialog->proxy_port_entry);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
642
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
643 /* User */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
644 dialog->proxy_user_entry = gtk_entry_new();
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
645 __add_pref_box(dialog, vbox2, _("_Username:"), dialog->proxy_user_entry);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
646
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
647 /* Password */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
648 dialog->proxy_pass_entry = gtk_entry_new();
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
649 __add_pref_box(dialog, vbox2, _("Pa_ssword:"), dialog->proxy_pass_entry);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
650
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
651 if (dialog->account != NULL &&
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
652 (proxy_info = gaim_account_get_proxy_info(dialog->account)) != NULL) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
653
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
654 GaimProxyType type = gaim_proxy_info_get_type(proxy_info);
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
655
5687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
656 /* Hah! */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
657 gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->proxy_dropdown),
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
658 (int)type + 1);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
659
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
660 if (type == GAIM_PROXY_NONE || type == GAIM_PROXY_USE_GLOBAL) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
661 gtk_widget_hide_all(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
662 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
663 else {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
664 const char *value;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
665 int int_val;
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
666
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
667 if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
668 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
669
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
670 if ((int_val = gaim_proxy_info_get_port(proxy_info)) != 0) {
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
671 char buf[32];
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
672
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
673 g_snprintf(buf, sizeof(buf), "%d", int_val);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
674
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
675 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), buf);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
676 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
677
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
678 if ((value = gaim_proxy_info_get_username(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
679 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_user_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
680
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
681 if ((value = gaim_proxy_info_get_password(proxy_info)) != NULL)
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
682 gtk_entry_set_text(GTK_ENTRY(dialog->proxy_pass_entry), value);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
683 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
684 }
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
685 else
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
686 gtk_widget_hide_all(vbox2);
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
687
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
688 /* Connect signals. */
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
689 g_signal_connect(G_OBJECT(dialog->proxy_dropdown), "changed",
ae626f0b68ef [gaim-migrate @ 6108]
Christian Hammond <chipx86@chipx86.com>
parents: 5686
diff changeset
690 G_CALLBACK(__proxy_type_changed_cb), dialog);
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
691 }
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
692
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5664
diff changeset
693 static void
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
694 __close_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
695 {
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
696 gtk_widget_destroy(dialog->window);
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
697
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
698 g_free(dialog);
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
699 }
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
700
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
701 static void
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
702 __account_win_destroy_cb(GtkWidget *w, GdkEvent *event,
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
703 AccountPrefsDialog *dialog)
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
704 {
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
705 __close_account_prefs_cb(NULL, dialog);
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
706 }
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
707
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
708 static void
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
709 __show_account_prefs(AccountPrefsDialogType type, GaimAccount *account)
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
710 {
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
711 AccountPrefsDialog *dialog;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
712 GtkWidget *win;
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
713 GtkWidget *main_vbox;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
714 GtkWidget *vbox;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
715 GtkWidget *bbox;
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
716 GtkWidget *dbox;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
717 GtkWidget *disclosure;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
718 GtkWidget *sep;
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
719 GtkWidget *button;
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
720
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
721 dialog = g_new0(AccountPrefsDialog, 1);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
722
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
723 dialog->account = account;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
724 dialog->type = type;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
725 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
726
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
727 if (dialog->account == NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
728 dialog->protocol = GAIM_PROTO_OSCAR;
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
729 else
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
730 dialog->protocol = gaim_account_get_protocol(dialog->account);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
731
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
732 if ((dialog->plugin = gaim_find_prpl(dialog->protocol)) != NULL)
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
733 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
734
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
735
5661
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
736 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
737 gtk_window_set_role(GTK_WINDOW(win), "account");
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
738
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
739 if (type == ADD_ACCOUNT_DIALOG)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
740 gtk_window_set_title(GTK_WINDOW(win), _("Add Account"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
741 else
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
742 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account"));
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
743
5661
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
744 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
b596002ff81e [gaim-migrate @ 6075]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
745
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
746 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
747
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
748 g_signal_connect(G_OBJECT(win), "delete_event",
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
749 G_CALLBACK(__account_win_destroy_cb), dialog);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
750
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
751 /* Setup the vbox */
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
752 main_vbox = gtk_vbox_new(FALSE, 12);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
753 gtk_container_add(GTK_CONTAINER(win), main_vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
754 gtk_widget_show(main_vbox);
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
755
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
756 /* Setup the inner vbox */
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
757 dialog->top_vbox = vbox = gtk_vbox_new(FALSE, 18);
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
758 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
759 gtk_widget_show(vbox);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
760
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
761 /* Setup the top frames. */
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
762 __add_login_options(dialog, vbox);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
763 __add_user_options(dialog, vbox);
5658
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
764
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
765 /* Add the disclosure */
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
766 disclosure = gaim_disclosure_new(_("Show more options"),
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
767 _("Show fewer options"));
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
768 gtk_box_pack_start(GTK_BOX(vbox), disclosure, FALSE, FALSE, 0);
060fb5fd081d [gaim-migrate @ 6072]
Christian Hammond <chipx86@chipx86.com>
parents: 5657
diff changeset
769 gtk_widget_show(disclosure);
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
770
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
771 /* Setup the box that the disclosure will cover. */
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
772 dialog->bottom_vbox = dbox = gtk_vbox_new(FALSE, 18);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
773 gtk_box_pack_start(GTK_BOX(vbox), dbox, FALSE, FALSE, 0);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
774
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
775 gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), dbox);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
776
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
777 /** Setup the bottom frames. */
5688
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
778 __add_protocol_options(dialog, dbox);
e43e1b8dca8b [gaim-migrate @ 6109]
Christian Hammond <chipx86@chipx86.com>
parents: 5687
diff changeset
779 __add_proxy_options(dialog, dbox);
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5658
diff changeset
780
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
781 /* Separator... */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
782 sep = gtk_hseparator_new();
5686
861565bed110 [gaim-migrate @ 6107]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
783 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
784 gtk_widget_show(sep);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
785
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
786 /* Setup the button box */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
787 bbox = gtk_hbutton_box_new();
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
788 gtk_box_set_spacing(GTK_BOX(bbox), 6);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
789 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
790 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
791 gtk_widget_show(bbox);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
792
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
793 /* Cancel button */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
794 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
795 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
796 gtk_widget_show(button);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
797
5692
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
798 g_signal_connect(G_OBJECT(button), "clicked",
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
799 G_CALLBACK(__close_account_prefs_cb), dialog);
b1eb9fc30ff8 [gaim-migrate @ 6113]
Christian Hammond <chipx86@chipx86.com>
parents: 5690
diff changeset
800
5657
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
801 /* OK button */
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
802 button = gtk_button_new_from_stock(GTK_STOCK_OK);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
803 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
804 gtk_widget_show(button);
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
805
bbe66a970662 [gaim-migrate @ 6071]
Christian Hammond <chipx86@chipx86.com>
parents: 5656
diff changeset
806 /* Show the window. */
5641
5e9babc828c4 [gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
807 gtk_widget_show(win);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
808 }
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
809
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
810 /**************************************************************************
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
811 * Accounts Dialog
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
812 **************************************************************************/
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
813
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
814 static void
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
815 __signed_on_off_cb(GaimConnection *gc, AccountsDialog *dialog)
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
816 {
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
817 GaimAccount *account = gaim_connection_get_account(gc);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
818 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
819 GtkTreeIter iter;
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
820 size_t index = g_list_index(gaim_accounts_get_all(), account);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
821
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
822 if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) {
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
823 gtk_list_store_set(dialog->model, &iter,
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
824 COLUMN_ONLINE, gaim_account_is_connected(account),
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
825 -1);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
826 }
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
827 }
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
828
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
829 static void
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
830 __drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
831 GtkSelectionData *data, guint info, guint time,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
832 AccountsDialog *dialog)
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
833 {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
834 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
835 GtkTreeRowReference *ref;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
836 GtkTreePath *source_row;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
837 GtkTreeIter iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
838 GaimAccount *account = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
839 GValue val = {0};
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
840
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
841 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
842 source_row = gtk_tree_row_reference_get_path(ref);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
843
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
844 if (source_row == NULL)
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
845 return;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
846
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
847 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
848 source_row);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
849 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
850 COLUMN_DATA, &val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
851
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
852 dialog->drag_iter = iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
853
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
854 account = g_value_get_pointer(&val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
855
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
856 gtk_selection_data_set(data, gdk_atom_intern("GAIM_ACCOUNT", FALSE),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
857 8, (void *)&account, sizeof(account));
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
858
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
859 gtk_tree_path_free(source_row);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
860 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
861 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
862
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
863 static void
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
864 __drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
865 guint x, guint y, GtkSelectionData *sd,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
866 guint info, guint t, AccountsDialog *dialog)
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
867 {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
868 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
869 size_t dest_index;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
870 GaimAccount *a = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
871 GtkTreePath *path = NULL;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
872 GtkTreeViewDropPosition position;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
873
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
874 memcpy(&a, sd->data, sizeof(a));
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
875
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
876 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
877 &path, &position)) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
878
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
879 GtkTreeIter iter;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
880 GaimAccount *account;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
881 GValue val = {0};
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
882
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
883 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
884 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
885 COLUMN_DATA, &val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
886
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
887 account = g_value_get_pointer(&val);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
888
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
889 switch (position) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
890 case GTK_TREE_VIEW_DROP_AFTER:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
891 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
892 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount",
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
893 "after\n");
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
894 gtk_list_store_move_after(dialog->model,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
895 &dialog->drag_iter, &iter);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
896 dest_index = g_list_index(gaim_accounts_get_all(),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
897 account) + 1;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
898 break;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
899
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
900 case GTK_TREE_VIEW_DROP_BEFORE:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
901 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
902 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount",
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
903 "before\n");
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
904 dest_index = g_list_index(gaim_accounts_get_all(),
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
905 account);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
906
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
907 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount",
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
908 "iter = %p\n", &iter);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
909 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount",
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
910 "account = %s\n",
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
911 gaim_account_get_username(account));
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
912
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
913 /*
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
914 * Somebody figure out why inserting before the first
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
915 * account sometimes moves to the end, please :(
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
916 */
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
917 if (dest_index == 0) {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
918 gtk_list_store_move_after(dialog->model,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
919 &dialog->drag_iter, &iter);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
920 gtk_list_store_swap(dialog->model, &iter,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
921 &dialog->drag_iter);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
922 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
923 else {
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
924 gtk_list_store_move_before(dialog->model,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
925 &dialog->drag_iter, &iter);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
926 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
927
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
928 break;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
929
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
930 default:
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
931 return;
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
932 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
933
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
934 gaim_accounts_reorder(a, dest_index);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
935 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
936 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
937 }
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
938
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
939 static gint
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
940 __accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsDialog *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
941 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
942 g_free(accounts_dialog);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
943 accounts_dialog = NULL;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
944
5617
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
945 /* See if we're the main window here. */
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
946 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL &&
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
947 mainwindow == NULL && gaim_connections_get_all() == NULL) {
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
948
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
949 do_quit();
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
950 }
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
951
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
952 return FALSE;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
953 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
954
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
955 static gboolean
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
956 __configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog)
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
957 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
958 if (GTK_WIDGET_VISIBLE(w)) {
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
959 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
960 int col_width;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
961 int difference;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
962
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
963 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
964 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
965
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
966 col_width = gtk_tree_view_column_get_width(dialog->screenname_col);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
967
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
968 if (col_width == 0)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
969 return FALSE;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
970
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
971 difference = (MAX(old_width, event->width) -
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
972 MIN(old_width, event->width));
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
973
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
974 if (difference == 0)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
975 return FALSE;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
976
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
977 if (old_width < event->width)
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
978 gtk_tree_view_column_set_min_width(dialog->screenname_col,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
979 col_width + difference);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
980 else
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
981 gtk_tree_view_column_set_max_width(dialog->screenname_col,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
982 col_width - difference);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
983 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
984
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
985 return FALSE;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
986 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
987
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
988 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
989 __add_account_cb(GtkWidget *w, AccountsDialog *dialog)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
990 {
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
991 __show_account_prefs(ADD_ACCOUNT_DIALOG, NULL);
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
992 }
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
993
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
994 static void
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
995 __modify_account_sel(GtkTreeModel *model, GtkTreePath *path,
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
996 GtkTreeIter *iter, gpointer data)
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
997 {
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
998 GaimAccount *account;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
999
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1000 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1001
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1002 if (account != NULL)
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1003 __show_account_prefs(MODIFY_ACCOUNT_DIALOG, account);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1004 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1005
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1006 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1007 __modify_account_cb(GtkWidget *w, AccountsDialog *dialog)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1008 {
5651
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1009 GtkTreeSelection *selection;
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1010
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1011 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1012
20ce7928c0b9 [gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents: 5648
diff changeset
1013 gtk_tree_selection_selected_foreach(selection, __modify_account_sel, NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1014 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1015
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1016 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1017 __delete_account_cb(GtkWidget *w, AccountsDialog *dialog)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1018 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1019
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1020 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1021
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1022 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1023 __close_accounts_cb(GtkWidget *w, AccountsDialog *dialog)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1024 {
5617
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1025 gtk_widget_destroy(dialog->window);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1026
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1027 __accedit_win_destroy_cb(NULL, NULL, dialog);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1028 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1029
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1030 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1031 __online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1032 {
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1033 AccountsDialog *dialog = (AccountsDialog *)data;
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1034 GaimAccount *account;
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1035 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model);
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1036 GtkTreeIter iter;
5637
69c92ae58876 [gaim-migrate @ 6044]
Nathan Walp <nwalp@pidgin.im>
parents: 5620
diff changeset
1037 gboolean online;
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1038
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1039 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
5637
69c92ae58876 [gaim-migrate @ 6044]
Nathan Walp <nwalp@pidgin.im>
parents: 5620
diff changeset
1040 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account,
69c92ae58876 [gaim-migrate @ 6044]
Nathan Walp <nwalp@pidgin.im>
parents: 5620
diff changeset
1041 COLUMN_ONLINE, &online, -1);
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1042
5637
69c92ae58876 [gaim-migrate @ 6044]
Nathan Walp <nwalp@pidgin.im>
parents: 5620
diff changeset
1043 if (online)
5592
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1044 gaim_account_disconnect(account);
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1045 else
57165429ed73 [gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents: 5581
diff changeset
1046 gaim_account_connect(account);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1047 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1048
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1049 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1050 __autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1051 gpointer data)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1052 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1053
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1054 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1055
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1056 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1057 __add_columns(GtkWidget *treeview, AccountsDialog *dialog)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1058 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1059 GtkCellRenderer *renderer;
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1060 GtkTreeViewColumn *column;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1061
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1062 /* Protocol */
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1063 column = gtk_tree_view_column_new();
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1064 gtk_tree_view_column_set_title(column, _("Protocol"));
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1065 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1066
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1067 /* Icon text */
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1068 renderer = gtk_cell_renderer_pixbuf_new();
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1069 gtk_tree_view_column_pack_start(column, renderer, FALSE);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1070 gtk_tree_view_column_add_attribute(column, renderer,
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1071 "pixbuf", COLUMN_ICON);
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1072
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1073 /* Protocol name */
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1074 renderer = gtk_cell_renderer_text_new();
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1075 gtk_tree_view_column_pack_start(column, renderer, TRUE);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1076 gtk_tree_view_column_add_attribute(column, renderer,
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1077 "text", COLUMN_PROTOCOL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1078
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1079 /* Screennames */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1080 renderer = gtk_cell_renderer_text_new();
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1081 column = gtk_tree_view_column_new_with_attributes(_("Screenname"),
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1082 renderer, "text", COLUMN_SCREENNAME, NULL);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1083 dialog->screenname_col = column;
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1084
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1085 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1086 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1087
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1088 /* Online? */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1089 renderer = gtk_cell_renderer_toggle_new();
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1090
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1091 g_signal_connect(G_OBJECT(renderer), "toggled",
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1092 G_CALLBACK(__online_cb), dialog);
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1093
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1094 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
1095 -1, _("Online"),
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1096 renderer,
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1097 "active", COLUMN_ONLINE,
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1098 NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1099
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1100 /* Auto-login? */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1101 renderer = gtk_cell_renderer_toggle_new();
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1102
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1103 g_signal_connect(G_OBJECT(renderer), "toggled",
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1104 G_CALLBACK(__autologin_cb), dialog);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1105
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1106 column = gtk_tree_view_column_new_with_attributes(_("Auto-login"),
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1107 renderer, "active", COLUMN_AUTOLOGIN, NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1108
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1109 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1110 g_object_set(renderer, "xalign", 0.0, "xpad", 10, NULL);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1111
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1112
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1113 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1114
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1115 static void
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1116 __populate_accounts_list(AccountsDialog *dialog)
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1117 {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1118 GList *l;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1119 GaimAccount *account;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1120 GtkTreeIter iter;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1121 GdkPixbuf *pixbuf;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1122 GdkPixbuf *scale;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1123
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1124 gtk_list_store_clear(dialog->model);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1125
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1126 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1127 account = l->data;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1128
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1129 scale = NULL;
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1130
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1131 pixbuf = create_prpl_icon(account);
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1132
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1133 if (pixbuf != NULL)
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1134 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1135 GDK_INTERP_BILINEAR);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1136
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1137 gtk_list_store_append(dialog->model, &iter);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1138 gtk_list_store_set(dialog->model, &iter,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1139 COLUMN_ICON, scale,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1140 COLUMN_SCREENNAME, gaim_account_get_username(account),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1141 COLUMN_ONLINE, gaim_account_is_connected(account),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1142 COLUMN_AUTOLOGIN, FALSE,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1143 COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol(account)),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1144 COLUMN_DATA, account,
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1145 COLUMN_FILLER, FALSE,
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1146 -1);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1147
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1148 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf));
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1149 if (scale != NULL) g_object_unref(G_OBJECT(scale));
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1150 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1151 }
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1152
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1153 static GtkWidget *
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1154 __create_accounts_list(AccountsDialog *dialog)
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1155 {
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1156 GtkWidget *sw;
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1157 GtkWidget *treeview;
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1158 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}};
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1159
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1160 /* Create the scrolled window. */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1161 sw = gtk_scrolled_window_new(0, 0);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1162 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1163 GTK_POLICY_AUTOMATIC,
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1164 GTK_POLICY_ALWAYS);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1165 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1166 GTK_SHADOW_IN);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1167 gtk_widget_show(sw);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1168
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1169 /* Create the list model. */
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5569
diff changeset
1170 dialog->model = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF,
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1171 G_TYPE_STRING, G_TYPE_STRING,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1172 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1173 G_TYPE_BOOLEAN, G_TYPE_POINTER);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1174
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1175 /* And now the actual treeview */
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1176 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
1177 dialog->treeview = treeview;
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1178 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1179 gtk_tree_selection_set_mode(
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1180 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1181 GTK_SELECTION_MULTIPLE);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1182
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1183 gtk_container_add(GTK_CONTAINER(sw), treeview);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1184 gtk_widget_show(treeview);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1185
5581
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1186 __add_columns(treeview, dialog);
3a9b54f260e3 [gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
1187
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1188 __populate_accounts_list(dialog);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1189
5620
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1190 /* Setup DND. I wanna be an orc! */
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1191 gtk_tree_view_enable_model_drag_source(
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1192 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1193 2, GDK_ACTION_COPY);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1194 gtk_tree_view_enable_model_drag_dest(
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1195 GTK_TREE_VIEW(treeview), gte, 2,
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1196 GDK_ACTION_COPY | GDK_ACTION_MOVE);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1197
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1198 g_signal_connect(G_OBJECT(treeview), "drag-data-received",
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1199 G_CALLBACK(__drag_data_received_cb), dialog);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1200 g_signal_connect(G_OBJECT(treeview), "drag-data-get",
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1201 G_CALLBACK(__drag_data_get_cb), dialog);
c9724982ce45 [gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents: 5617
diff changeset
1202
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1203 return sw;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1204 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1205
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1206 void
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1207 gaim_gtk_account_dialog_show(void)
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1208 {
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1209 AccountsDialog *dialog;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1210 GtkWidget *win;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1211 GtkWidget *vbox;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1212 GtkWidget *bbox;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1213 GtkWidget *sw;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1214 GtkWidget *sep;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1215 GtkWidget *button;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1216 int width, height;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1217
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1218 if (accounts_dialog != NULL)
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1219 return;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1220
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1221 accounts_dialog = dialog = g_new0(AccountsDialog, 1);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1222
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1223 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width");
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1224 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height");
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1225
5617
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1226 GAIM_DIALOG(win);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1227
5617
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1228 dialog->window = win;
feb012e01741 [gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents: 5615
diff changeset
1229
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1230 gtk_window_set_default_size(GTK_WINDOW(win), width, height);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1231 gtk_window_set_role(GTK_WINDOW(win), "accounts");
5693
0b5318235562 [gaim-migrate @ 6114]
Sean Egan <seanegan@gmail.com>
parents: 5692
diff changeset
1232 gtk_window_set_title(GTK_WINDOW(win), _("Accounts"));
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1233 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1234
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1235 g_signal_connect(G_OBJECT(win), "delete_event",
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5637
diff changeset
1236 G_CALLBACK(__accedit_win_destroy_cb), accounts_dialog);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1237 g_signal_connect(G_OBJECT(win), "configure_event",
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1238 G_CALLBACK(__configure_cb), accounts_dialog);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1239
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1240 /* Setup the vbox */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1241 vbox = gtk_vbox_new(FALSE, 12);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1242 gtk_container_add(GTK_CONTAINER(win), vbox);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1243 gtk_widget_show(vbox);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1244
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1245 /* Setup the scrolled window that will contain the list of accounts. */
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1246 sw = __create_accounts_list(dialog);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1247 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1248 gtk_widget_show(sw);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1249
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1250 /* Separator... */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1251 sep = gtk_hseparator_new();
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1252 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1253 gtk_widget_show(sep);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1254
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1255 /* Button box. */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1256 bbox = gtk_hbutton_box_new();
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1257 gtk_box_set_spacing(GTK_BOX(bbox), 6);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1258 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1259 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
1260 gtk_widget_show(bbox);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1261
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1262 /* Add button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1263 button = gtk_button_new_from_stock(GTK_STOCK_ADD);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1264 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1265 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1266
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1267 g_signal_connect(G_OBJECT(button), "clicked",
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1268 G_CALLBACK(__add_account_cb), dialog);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1269
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1270 /* Modify button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1271 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1272 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1273 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1274
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1275 g_signal_connect(G_OBJECT(button), "clicked",
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1276 G_CALLBACK(__modify_account_cb), dialog);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1277
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1278 /* Delete button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1279 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1280 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1281 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1282
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1283 g_signal_connect(G_OBJECT(button), "clicked",
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1284 G_CALLBACK(__delete_account_cb), dialog);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1285
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1286 /* Close button */
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1287 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1288 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1289 gtk_widget_show(button);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1290
5569
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1291 g_signal_connect(G_OBJECT(button), "clicked",
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1292 G_CALLBACK(__close_accounts_cb), dialog);
5d2911d6d38e [gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1293
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1294 /* Setup some gaim signal handlers. */
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1295 gaim_signal_connect(dialog, event_signon, __signed_on_off_cb, dialog);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1296 gaim_signal_connect(dialog, event_signoff, __signed_on_off_cb, dialog);
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5592
diff changeset
1297
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1298 gtk_widget_show(win);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1299 }
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1300