Mercurial > pidgin.yaz
annotate src/gtkaccount.c @ 5651:20ce7928c0b9
[gaim-migrate @ 6065]
The account dialog now pulls in some of the options from the account.
Lookie, ma, real work been done!
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 02 Jun 2003 05:33:06 +0000 |
parents | 0cc2d99b7c44 |
children | 2216abc2d421 |
rev | line source |
---|---|
5563 | 1 /** |
2 * @file gtkaccount.c Account Editor dialog | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #include "gtkaccount.h" | |
24 #include "account.h" | |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
25 #include "event.h" |
5563 | 26 #include "prefs.h" |
27 #include "stock.h" | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
28 #include "gtkblist.h" |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
29 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
30 #ifdef _WIN32 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
31 # include <gdk/gdkwin32.h> |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
32 #else |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
33 # include <unistd.h> |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
34 # include <gdk/gdkx.h> |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
35 #endif |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
36 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
37 #include <string.h> |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
38 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
39 enum |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
40 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
41 COLUMN_ICON, |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
42 COLUMN_PROTOCOL, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
43 COLUMN_SCREENNAME, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
44 COLUMN_ONLINE, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
45 COLUMN_AUTOLOGIN, |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
46 COLUMN_FILLER, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
47 COLUMN_DATA, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
48 NUM_COLUMNS |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
49 }; |
5563 | 50 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
51 typedef enum |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
52 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
53 ADD_ACCOUNT_DIALOG, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
54 MODIFY_ACCOUNT_DIALOG |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
55 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
56 } AccountPrefsDialogType; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
57 |
5563 | 58 typedef struct |
59 { | |
60 GtkWidget *window; | |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
61 GtkWidget *treeview; |
5563 | 62 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
63 GtkListStore *model; |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
64 GtkTreeIter drag_iter; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
65 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
66 GtkTreeViewColumn *screenname_col; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
67 |
5563 | 68 } AccountsDialog; |
69 | |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
70 typedef struct |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
71 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
72 AccountPrefsDialogType type; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
73 |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
74 GaimAccount *account; |
5638
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 GtkWidget *window; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
77 GtkWidget *login_frame; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
78 GtkWidget *protocol_menu; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
79 GtkWidget *screenname_entry; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
80 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
81 GtkSizeGroup *sg; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
82 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
83 } AccountPrefsDialog; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
84 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
85 |
5563 | 86 static AccountsDialog *accounts_dialog = NULL; |
87 | |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
88 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
89 static char * |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
90 proto_name(int proto) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
91 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
92 GaimPlugin *p = gaim_find_prpl(proto); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
93 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
94 return ((p && p->info->name) ? _(p->info->name) : _("Unknown")); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
95 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
96 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
97 /************************************************************************** |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
98 * Add/Modify Account dialog |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
99 **************************************************************************/ |
5644
213e999fa5cc
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
100 static void |
5648
0cc2d99b7c44
[gaim-migrate @ 6062]
Christian Hammond <chipx86@chipx86.com>
parents:
5644
diff
changeset
|
101 __set_account_protocol(GtkWidget *item, GaimProtocol protocol, |
0cc2d99b7c44
[gaim-migrate @ 6062]
Christian Hammond <chipx86@chipx86.com>
parents:
5644
diff
changeset
|
102 AccountPrefsDialog *dialog) |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
103 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
104 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
105 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
106 static GtkWidget * |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
107 __add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
108 const char *text, GtkWidget *widget) |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
109 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
110 GtkWidget *hbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
111 GtkWidget *label; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
112 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
113 hbox = gtk_hbox_new(FALSE, 6); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
114 gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
115 gtk_widget_show(hbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
116 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
117 label = gtk_label_new(text); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
118 gtk_size_group_add_widget(dialog->sg, label); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
119 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
120 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
|
121 gtk_widget_show(label); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
122 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
123 gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
124 gtk_widget_show(widget); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
125 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
126 return hbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
127 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
128 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
129 static void |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
130 __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
131 { |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
132 GtkWidget *frame; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
133 GtkWidget *vbox; |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
134 GaimProtocol protocol; |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
135 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
136 if (dialog->login_frame != NULL) |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
137 gtk_widget_destroy(dialog->login_frame); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
138 |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
139 if (dialog->account == NULL) |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
140 protocol = GAIM_PROTO_OSCAR; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
141 else |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
142 protocol = gaim_account_get_protocol(dialog->account); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
143 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
144 frame = gaim_gtk_make_frame(parent, _("Login Options")); |
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 /* cringe */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
147 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
|
148 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
149 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
|
150 gtk_widget_show(dialog->login_frame); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
151 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
152 vbox = gtk_vbox_new(FALSE, 6); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
153 gtk_container_add(GTK_CONTAINER(frame), vbox); |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
154 gtk_widget_show(vbox); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
155 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
156 /* Protocol */ |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
157 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new( |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
158 protocol, G_CALLBACK(__set_account_protocol), dialog); |
5644
213e999fa5cc
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
159 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
160 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); |
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 /* Screen Name */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
163 dialog->screenname_entry = gtk_entry_new(); |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
164 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
165 if (dialog->account != NULL) |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
166 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
167 gaim_account_get_username(dialog->account)); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
168 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
169 __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry); |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
170 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
171 #if 0 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
172 if (dialog->user_splits != NULL) { |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
173 g_list_free(dialog->user_splits); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
174 dialog->user_splits = NULL; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
175 } |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
176 #endif |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
177 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
178 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
179 static void |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
180 __show_account_prefs(AccountPrefsDialogType type, GaimAccount *account) |
5638
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 AccountPrefsDialog *dialog; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
183 GtkWidget *win; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
184 GtkWidget *vbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
185 GtkWidget *bbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
186 GtkWidget *sep; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
187 GtkWidget *disclosure; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
188 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
189 dialog = g_new0(AccountPrefsDialog, 1); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
190 |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
191 dialog->account = account; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
192 dialog->type = type; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
193 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
194 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
195 GAIM_DIALOG(win); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
196 dialog->window = win; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
197 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
198 gtk_window_set_role(GTK_WINDOW(win), "account"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
199 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
200 if (type == ADD_ACCOUNT_DIALOG) |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
201 gtk_window_set_title(GTK_WINDOW(win), _("Add Account")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
202 else |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
203 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
204 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
205 gtk_container_set_border_width(GTK_CONTAINER(win), 12); |
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 #if 0 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
208 g_signal_connect(G_OBJECT(win), "delete_event", |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
209 G_CALLBACK(__account_win_destroy_cb), dialog); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
210 #endif |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
211 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
212 /* Setup the vbox */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
213 vbox = gtk_vbox_new(FALSE, 12); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
214 gtk_container_add(GTK_CONTAINER(win), vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
215 gtk_widget_show(vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
216 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
217 /* Setup the top frames. */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
218 __add_login_options(dialog, vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
219 #if 0 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
220 __add_user_options(dialog, vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
221 #endif |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
222 |
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
223 gtk_widget_show(win); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
224 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
225 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
226 /************************************************************************** |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
227 * Accounts Dialog |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
228 **************************************************************************/ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
229 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
230 static void |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
231 __signed_on_off_cb(GaimConnection *gc, AccountsDialog *dialog) |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
232 { |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
233 GaimAccount *account = gaim_connection_get_account(gc); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
234 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
235 GtkTreeIter iter; |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
236 size_t index = g_list_index(gaim_accounts_get_all(), account); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
237 |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
238 if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) { |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
239 gtk_list_store_set(dialog->model, &iter, |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
240 COLUMN_ONLINE, gaim_account_is_connected(account), |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
241 -1); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
242 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
243 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
244 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
245 static void |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
246 __drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
247 GtkSelectionData *data, guint info, guint time, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
248 AccountsDialog *dialog) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
249 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
250 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
251 GtkTreeRowReference *ref; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
252 GtkTreePath *source_row; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
253 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
254 GaimAccount *account = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
255 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
256 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
257 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
|
258 source_row = gtk_tree_row_reference_get_path(ref); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
259 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
260 if (source_row == NULL) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
261 return; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
262 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
263 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
264 source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
265 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
266 COLUMN_DATA, &val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
267 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
268 dialog->drag_iter = iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
269 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
270 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
271 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
272 gtk_selection_data_set(data, gdk_atom_intern("GAIM_ACCOUNT", FALSE), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
273 8, (void *)&account, sizeof(account)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
274 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
275 gtk_tree_path_free(source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
276 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
277 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
278 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
279 static void |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
280 __drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
281 guint x, guint y, GtkSelectionData *sd, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
282 guint info, guint t, AccountsDialog *dialog) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
283 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
284 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
285 size_t dest_index; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
286 GaimAccount *a = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
287 GtkTreePath *path = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
288 GtkTreeViewDropPosition position; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
289 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
290 memcpy(&a, sd->data, sizeof(a)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
291 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
292 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
|
293 &path, &position)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
294 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
295 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
296 GaimAccount *account; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
297 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
298 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
299 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
|
300 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
301 COLUMN_DATA, &val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
302 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
303 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
304 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
305 switch (position) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
306 case GTK_TREE_VIEW_DROP_AFTER: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
307 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
308 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
309 "after\n"); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
310 gtk_list_store_move_after(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
311 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
312 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
313 account) + 1; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
314 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
315 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
316 case GTK_TREE_VIEW_DROP_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
317 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
318 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
319 "before\n"); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
320 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
321 account); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
322 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
323 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
324 "iter = %p\n", &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
325 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
326 "account = %s\n", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
327 gaim_account_get_username(account)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
328 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
329 /* |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
330 * Somebody figure out why inserting before the first |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
331 * account sometimes moves to the end, please :( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
332 */ |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
333 if (dest_index == 0) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
334 gtk_list_store_move_after(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
335 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
336 gtk_list_store_swap(dialog->model, &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
337 &dialog->drag_iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
338 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
339 else { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
340 gtk_list_store_move_before(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
341 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
342 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
343 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
344 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
345 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
346 default: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
347 return; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
348 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
349 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
350 gaim_accounts_reorder(a, dest_index); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
351 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
352 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
353 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
354 |
5563 | 355 static gint |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
356 __accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsDialog *dialog) |
5563 | 357 { |
358 g_free(accounts_dialog); | |
359 accounts_dialog = NULL; | |
360 | |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
361 /* See if we're the main window here. */ |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
362 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL && |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
363 mainwindow == NULL && gaim_connections_get_all() == NULL) { |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
364 |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
365 do_quit(); |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
366 } |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
367 |
5563 | 368 return FALSE; |
369 } | |
370 | |
371 static gboolean | |
372 __configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog) | |
373 { | |
374 if (GTK_WIDGET_VISIBLE(w)) { | |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
375 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
|
376 int col_width; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
377 int difference; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
378 |
5563 | 379 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width); |
380 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
|
381 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
382 col_width = gtk_tree_view_column_get_width(dialog->screenname_col); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
383 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
384 if (col_width == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
385 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
386 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
387 difference = (MAX(old_width, event->width) - |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
388 MIN(old_width, event->width)); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
389 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
390 if (difference == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
391 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
392 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
393 if (old_width < event->width) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
394 gtk_tree_view_column_set_min_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
395 col_width + difference); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
396 else |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
397 gtk_tree_view_column_set_max_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
398 col_width - difference); |
5563 | 399 } |
400 | |
401 return FALSE; | |
402 } | |
403 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
404 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
405 __add_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
406 { |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
407 __show_account_prefs(ADD_ACCOUNT_DIALOG, NULL); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
408 } |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
409 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
410 static void |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
411 __modify_account_sel(GtkTreeModel *model, GtkTreePath *path, |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
412 GtkTreeIter *iter, gpointer data) |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
413 { |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
414 GaimAccount *account; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
415 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
416 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
417 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
418 if (account != NULL) |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
419 __show_account_prefs(MODIFY_ACCOUNT_DIALOG, account); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
420 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
421 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
422 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
423 __modify_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
424 { |
5651
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
425 GtkTreeSelection *selection; |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
426 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
427 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
428 |
20ce7928c0b9
[gaim-migrate @ 6065]
Christian Hammond <chipx86@chipx86.com>
parents:
5648
diff
changeset
|
429 gtk_tree_selection_selected_foreach(selection, __modify_account_sel, NULL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
430 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
431 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
432 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
433 __delete_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
434 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
435 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
436 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
437 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
438 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
439 __close_accounts_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
440 { |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
441 gtk_widget_destroy(dialog->window); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
442 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
443 __accedit_win_destroy_cb(NULL, NULL, dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
444 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
445 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
446 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
447 __online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
448 { |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
449 AccountsDialog *dialog = (AccountsDialog *)data; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
450 GaimAccount *account; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
451 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
452 GtkTreeIter iter; |
5637 | 453 gboolean online; |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
454 |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
455 gtk_tree_model_get_iter_from_string(model, &iter, path_str); |
5637 | 456 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, |
457 COLUMN_ONLINE, &online, -1); | |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
458 |
5637 | 459 if (online) |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
460 gaim_account_disconnect(account); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
461 else |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
462 gaim_account_connect(account); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
463 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
464 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
465 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
466 __autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
467 gpointer data) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
468 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
469 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
470 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
471 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
472 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
473 __add_columns(GtkWidget *treeview, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
474 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
475 GtkCellRenderer *renderer; |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
476 GtkTreeViewColumn *column; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
477 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
478 /* Protocol */ |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
479 column = gtk_tree_view_column_new(); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
480 gtk_tree_view_column_set_title(column, _("Protocol")); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
481 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
482 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
483 /* Icon text */ |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
484 renderer = gtk_cell_renderer_pixbuf_new(); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
485 gtk_tree_view_column_pack_start(column, renderer, FALSE); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
486 gtk_tree_view_column_add_attribute(column, renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
487 "pixbuf", COLUMN_ICON); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
488 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
489 /* Protocol name */ |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
490 renderer = gtk_cell_renderer_text_new(); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
491 gtk_tree_view_column_pack_start(column, renderer, TRUE); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
492 gtk_tree_view_column_add_attribute(column, renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
493 "text", COLUMN_PROTOCOL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
494 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
495 /* Screennames */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
496 renderer = gtk_cell_renderer_text_new(); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
497 column = gtk_tree_view_column_new_with_attributes(_("Screenname"), |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
498 renderer, "text", COLUMN_SCREENNAME, NULL); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
499 dialog->screenname_col = column; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
500 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
501 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
|
502 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
|
503 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
504 /* Online? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
505 renderer = gtk_cell_renderer_toggle_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
506 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
507 g_signal_connect(G_OBJECT(renderer), "toggled", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
508 G_CALLBACK(__online_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
509 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
510 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
511 -1, _("Online"), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
512 renderer, |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
513 "active", COLUMN_ONLINE, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
514 NULL); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
515 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
516 /* Auto-login? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
517 renderer = gtk_cell_renderer_toggle_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
518 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
519 g_signal_connect(G_OBJECT(renderer), "toggled", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
520 G_CALLBACK(__autologin_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
521 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
522 column = gtk_tree_view_column_new_with_attributes(_("Auto-login"), |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
523 renderer, "active", COLUMN_AUTOLOGIN, NULL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
524 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
525 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
|
526 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
527 /* Filler */ |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
528 renderer = gtk_cell_renderer_text_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
529 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
530 -1, "", renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
531 "visible", COLUMN_FILLER, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
532 NULL); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
533 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
534 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
535 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
536 __populate_accounts_list(AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
537 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
538 GList *l; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
539 GaimAccount *account; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
540 GtkTreeIter iter; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
541 GdkPixbuf *pixbuf; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
542 GdkPixbuf *scale; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
543 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
544 gtk_list_store_clear(dialog->model); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
545 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
546 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
547 account = l->data; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
548 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
549 scale = NULL; |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
550 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
551 pixbuf = create_prpl_icon(account); |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
552 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
553 if (pixbuf != NULL) |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
554 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
555 GDK_INTERP_BILINEAR); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
556 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
557 gtk_list_store_append(dialog->model, &iter); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
558 gtk_list_store_set(dialog->model, &iter, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
559 COLUMN_ICON, scale, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
560 COLUMN_SCREENNAME, gaim_account_get_username(account), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
561 COLUMN_ONLINE, gaim_account_is_connected(account), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
562 COLUMN_AUTOLOGIN, FALSE, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
563 COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol(account)), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
564 COLUMN_DATA, account, |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
565 COLUMN_FILLER, FALSE, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
566 -1); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
567 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
568 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
569 if (scale != NULL) g_object_unref(G_OBJECT(scale)); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
570 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
571 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
572 |
5563 | 573 static GtkWidget * |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
574 __create_accounts_list(AccountsDialog *dialog) |
5563 | 575 { |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
576 GtkWidget *sw; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
577 GtkWidget *treeview; |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
578 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
579 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
580 /* Create the scrolled window. */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
581 sw = gtk_scrolled_window_new(0, 0); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
582 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
583 GTK_POLICY_AUTOMATIC, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
584 GTK_POLICY_ALWAYS); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
585 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
586 GTK_SHADOW_IN); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
587 gtk_widget_show(sw); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
588 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
589 /* Create the list model. */ |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
590 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
|
591 G_TYPE_STRING, G_TYPE_STRING, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
592 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
593 G_TYPE_BOOLEAN, G_TYPE_POINTER); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
594 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
595 /* And now the actual treeview */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
596 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
|
597 dialog->treeview = treeview; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
598 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
599 gtk_tree_selection_set_mode( |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
600 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
601 GTK_SELECTION_MULTIPLE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
602 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
603 gtk_container_add(GTK_CONTAINER(sw), treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
604 gtk_widget_show(treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
605 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
606 __add_columns(treeview, dialog); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
607 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
608 __populate_accounts_list(dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
609 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
610 /* Setup DND. I wanna be an orc! */ |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
611 gtk_tree_view_enable_model_drag_source( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
612 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
613 2, GDK_ACTION_COPY); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
614 gtk_tree_view_enable_model_drag_dest( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
615 GTK_TREE_VIEW(treeview), gte, 2, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
616 GDK_ACTION_COPY | GDK_ACTION_MOVE); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
617 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
618 g_signal_connect(G_OBJECT(treeview), "drag-data-received", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
619 G_CALLBACK(__drag_data_received_cb), dialog); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
620 g_signal_connect(G_OBJECT(treeview), "drag-data-get", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
621 G_CALLBACK(__drag_data_get_cb), dialog); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
622 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
623 return sw; |
5563 | 624 } |
625 | |
626 void | |
627 gaim_gtk_account_dialog_show(void) | |
628 { | |
629 AccountsDialog *dialog; | |
630 GtkWidget *win; | |
631 GtkWidget *vbox; | |
632 GtkWidget *bbox; | |
633 GtkWidget *sw; | |
634 GtkWidget *sep; | |
635 GtkWidget *button; | |
636 int width, height; | |
637 | |
638 if (accounts_dialog != NULL) | |
639 return; | |
640 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
641 accounts_dialog = dialog = g_new0(AccountsDialog, 1); |
5563 | 642 |
643 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); | |
644 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height"); | |
645 | |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
646 GAIM_DIALOG(win); |
5563 | 647 |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
648 dialog->window = win; |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
649 |
5563 | 650 gtk_window_set_default_size(GTK_WINDOW(win), width, height); |
651 gtk_window_set_role(GTK_WINDOW(win), "accounts"); | |
652 gtk_window_set_title(GTK_WINDOW(win), "Accounts"); | |
653 gtk_container_set_border_width(GTK_CONTAINER(win), 12); | |
654 | |
655 g_signal_connect(G_OBJECT(win), "delete_event", | |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
656 G_CALLBACK(__accedit_win_destroy_cb), accounts_dialog); |
5563 | 657 g_signal_connect(G_OBJECT(win), "configure_event", |
658 G_CALLBACK(__configure_cb), accounts_dialog); | |
659 | |
660 /* Setup the vbox */ | |
661 vbox = gtk_vbox_new(FALSE, 12); | |
662 gtk_container_add(GTK_CONTAINER(win), vbox); | |
663 gtk_widget_show(vbox); | |
664 | |
665 /* 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
|
666 sw = __create_accounts_list(dialog); |
5563 | 667 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
668 gtk_widget_show(sw); | |
669 | |
670 /* Separator... */ | |
671 sep = gtk_hseparator_new(); | |
672 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
673 gtk_widget_show(sep); | |
674 | |
675 /* Button box. */ | |
676 bbox = gtk_hbutton_box_new(); | |
677 gtk_box_set_spacing(GTK_BOX(bbox), 6); | |
678 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
679 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
|
680 gtk_widget_show(bbox); |
5563 | 681 |
682 /* Add button */ | |
683 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
684 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
685 gtk_widget_show(button); | |
686 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
687 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
688 G_CALLBACK(__add_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
689 |
5563 | 690 /* Modify button */ |
691 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY); | |
692 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
693 gtk_widget_show(button); | |
694 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
695 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
696 G_CALLBACK(__modify_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
697 |
5563 | 698 /* Delete button */ |
699 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
700 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5563 | 701 gtk_widget_show(button); |
702 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
703 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
704 G_CALLBACK(__delete_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
705 |
5563 | 706 /* Close button */ |
707 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
708 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5563 | 709 gtk_widget_show(button); |
710 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
711 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
712 G_CALLBACK(__close_accounts_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
713 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
714 /* Setup some gaim signal handlers. */ |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
715 gaim_signal_connect(dialog, event_signon, __signed_on_off_cb, dialog); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
716 gaim_signal_connect(dialog, event_signoff, __signed_on_off_cb, dialog); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
717 |
5563 | 718 gtk_widget_show(win); |
719 } | |
720 |