Mercurial > pidgin.yaz
annotate src/gtkaccount.c @ 5648:0cc2d99b7c44
[gaim-migrate @ 6062]
Of course, we should use the correct callback in the account editor...
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 02 Jun 2003 04:53:37 +0000 |
parents | 213e999fa5cc |
children | 20ce7928c0b9 |
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; | |
61 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
62 GtkListStore *model; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
63 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
64 GtkTreeViewColumn *screenname_col; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
65 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
66 GtkTreeIter drag_iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
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 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
74 GtkWidget *window; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
75 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
76 GtkWidget *login_frame; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
77 |
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; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
134 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
135 if (dialog->login_frame != NULL) |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
136 gtk_widget_destroy(dialog->login_frame); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
137 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
138 frame = gaim_gtk_make_frame(parent, _("Login Options")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
139 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
140 /* cringe */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
141 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
|
142 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
143 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
|
144 gtk_widget_show(dialog->login_frame); |
5638
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 vbox = gtk_vbox_new(FALSE, 6); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
147 gtk_container_add(GTK_CONTAINER(frame), vbox); |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
148 gtk_widget_show(vbox); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
149 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
150 /* Protocol */ |
5644
213e999fa5cc
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
151 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new(-1, |
213e999fa5cc
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
152 G_CALLBACK(__set_account_protocol), dialog); |
213e999fa5cc
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
153 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
154 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); |
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 /* Screen Name */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
157 dialog->screenname_entry = gtk_entry_new(); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
158 __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
159 } |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
160 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
161 static void |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
162 __show_account_prefs(AccountPrefsDialogType type) |
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 AccountPrefsDialog *dialog; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
165 GtkWidget *win; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
166 GtkWidget *vbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
167 GtkWidget *bbox; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
168 GtkWidget *sep; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
169 GtkWidget *disclosure; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
170 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
171 dialog = g_new0(AccountPrefsDialog, 1); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
172 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
173 dialog->type = type; |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
174 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
175 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
176 GAIM_DIALOG(win); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
177 dialog->window = win; |
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 gtk_window_set_role(GTK_WINDOW(win), "account"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
180 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
181 if (type == ADD_ACCOUNT_DIALOG) |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
182 gtk_window_set_title(GTK_WINDOW(win), _("Add Account")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
183 else |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
184 gtk_window_set_title(GTK_WINDOW(win), _("Modify Account")); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
185 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
186 gtk_container_set_border_width(GTK_CONTAINER(win), 12); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
187 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
188 #if 0 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
189 g_signal_connect(G_OBJECT(win), "delete_event", |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
190 G_CALLBACK(__account_win_destroy_cb), dialog); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
191 #endif |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
192 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
193 /* Setup the vbox */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
194 vbox = gtk_vbox_new(FALSE, 12); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
195 gtk_container_add(GTK_CONTAINER(win), vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
196 gtk_widget_show(vbox); |
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 /* Setup the top frames. */ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
199 __add_login_options(dialog, vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
200 #if 0 |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
201 __add_user_options(dialog, vbox); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
202 #endif |
5641
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
203 |
5e9babc828c4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
204 gtk_widget_show(win); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
205 } |
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 /************************************************************************** |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
208 * Accounts Dialog |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
209 **************************************************************************/ |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
210 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
211 static void |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
212 __signed_on_off_cb(GaimConnection *gc, AccountsDialog *dialog) |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
213 { |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
214 GaimAccount *account = gaim_connection_get_account(gc); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
215 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
216 GtkTreeIter iter; |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
217 size_t index = g_list_index(gaim_accounts_get_all(), account); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
218 |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
219 if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) { |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
220 gtk_list_store_set(dialog->model, &iter, |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
221 COLUMN_ONLINE, gaim_account_is_connected(account), |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
222 -1); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
223 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
224 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
225 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
226 static void |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
227 __drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
228 GtkSelectionData *data, guint info, guint time, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
229 AccountsDialog *dialog) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
230 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
231 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
232 GtkTreeRowReference *ref; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
233 GtkTreePath *source_row; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
234 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
235 GaimAccount *account = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
236 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
237 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
238 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
|
239 source_row = gtk_tree_row_reference_get_path(ref); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
240 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
241 if (source_row == NULL) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
242 return; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
243 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
244 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
245 source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
246 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
247 COLUMN_DATA, &val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
248 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
249 dialog->drag_iter = iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
250 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
251 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
252 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
253 gtk_selection_data_set(data, gdk_atom_intern("GAIM_ACCOUNT", FALSE), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
254 8, (void *)&account, sizeof(account)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
255 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
256 gtk_tree_path_free(source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
257 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
258 } |
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 static void |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
261 __drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
262 guint x, guint y, GtkSelectionData *sd, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
263 guint info, guint t, AccountsDialog *dialog) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
264 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
265 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
266 size_t dest_index; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
267 GaimAccount *a = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
268 GtkTreePath *path = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
269 GtkTreeViewDropPosition position; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
270 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
271 memcpy(&a, sd->data, sizeof(a)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
272 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
273 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
|
274 &path, &position)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
275 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
276 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
277 GaimAccount *account; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
278 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
279 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
280 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
|
281 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
282 COLUMN_DATA, &val); |
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 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
285 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
286 switch (position) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
287 case GTK_TREE_VIEW_DROP_AFTER: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
288 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
289 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
290 "after\n"); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
291 gtk_list_store_move_after(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
292 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
293 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
294 account) + 1; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
295 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
296 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
297 case GTK_TREE_VIEW_DROP_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
298 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
299 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
300 "before\n"); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
301 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
302 account); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
303 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
304 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
305 "iter = %p\n", &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
306 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
307 "account = %s\n", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
308 gaim_account_get_username(account)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
309 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
310 /* |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
311 * Somebody figure out why inserting before the first |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
312 * account sometimes moves to the end, please :( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
313 */ |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
314 if (dest_index == 0) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
315 gtk_list_store_move_after(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
316 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
317 gtk_list_store_swap(dialog->model, &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
318 &dialog->drag_iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
319 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
320 else { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
321 gtk_list_store_move_before(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
322 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
323 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
324 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
325 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
326 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
327 default: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
328 return; |
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 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
331 gaim_accounts_reorder(a, dest_index); |
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 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
334 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
335 |
5563 | 336 static gint |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
337 __accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsDialog *dialog) |
5563 | 338 { |
339 g_free(accounts_dialog); | |
340 accounts_dialog = NULL; | |
341 | |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
342 /* See if we're the main window here. */ |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
343 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL && |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
344 mainwindow == NULL && gaim_connections_get_all() == NULL) { |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
345 |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
346 do_quit(); |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
347 } |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
348 |
5563 | 349 return FALSE; |
350 } | |
351 | |
352 static gboolean | |
353 __configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog) | |
354 { | |
355 if (GTK_WIDGET_VISIBLE(w)) { | |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
356 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
|
357 int col_width; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
358 int difference; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
359 |
5563 | 360 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width); |
361 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
|
362 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
363 col_width = gtk_tree_view_column_get_width(dialog->screenname_col); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
364 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
365 if (col_width == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
366 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
367 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
368 difference = (MAX(old_width, event->width) - |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
369 MIN(old_width, event->width)); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
370 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
371 if (difference == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
372 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
373 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
374 if (old_width < event->width) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
375 gtk_tree_view_column_set_min_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
376 col_width + difference); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
377 else |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
378 gtk_tree_view_column_set_max_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
379 col_width - difference); |
5563 | 380 } |
381 | |
382 return FALSE; | |
383 } | |
384 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
385 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
386 __add_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
387 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
388 __show_account_prefs(ADD_ACCOUNT_DIALOG); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
389 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
390 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
391 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
392 __modify_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
393 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
394 __show_account_prefs(MODIFY_ACCOUNT_DIALOG); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
395 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
396 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
397 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
398 __delete_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
399 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
400 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
401 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
402 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
403 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
404 __close_accounts_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
405 { |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
406 gtk_widget_destroy(dialog->window); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
407 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
408 __accedit_win_destroy_cb(NULL, NULL, dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
409 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
410 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
411 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
412 __online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
413 { |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
414 AccountsDialog *dialog = (AccountsDialog *)data; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
415 GaimAccount *account; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
416 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
417 GtkTreeIter iter; |
5637 | 418 gboolean online; |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
419 |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
420 gtk_tree_model_get_iter_from_string(model, &iter, path_str); |
5637 | 421 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, |
422 COLUMN_ONLINE, &online, -1); | |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
423 |
5637 | 424 if (online) |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
425 gaim_account_disconnect(account); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
426 else |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
427 gaim_account_connect(account); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
428 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
429 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
430 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
431 __autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
432 gpointer data) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
433 { |
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 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
438 __add_columns(GtkWidget *treeview, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
439 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
440 GtkCellRenderer *renderer; |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
441 GtkTreeViewColumn *column; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
442 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
443 /* Protocol */ |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
444 column = gtk_tree_view_column_new(); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
445 gtk_tree_view_column_set_title(column, _("Protocol")); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
446 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
447 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
448 /* Icon text */ |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
449 renderer = gtk_cell_renderer_pixbuf_new(); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
450 gtk_tree_view_column_pack_start(column, renderer, FALSE); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
451 gtk_tree_view_column_add_attribute(column, renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
452 "pixbuf", COLUMN_ICON); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
453 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
454 /* Protocol name */ |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
455 renderer = gtk_cell_renderer_text_new(); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
456 gtk_tree_view_column_pack_start(column, renderer, TRUE); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
457 gtk_tree_view_column_add_attribute(column, renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
458 "text", COLUMN_PROTOCOL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
459 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
460 /* Screennames */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
461 renderer = gtk_cell_renderer_text_new(); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
462 column = gtk_tree_view_column_new_with_attributes(_("Screenname"), |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
463 renderer, "text", COLUMN_SCREENNAME, NULL); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
464 dialog->screenname_col = column; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
465 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
466 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
|
467 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
|
468 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
469 /* Online? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
470 renderer = gtk_cell_renderer_toggle_new(); |
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 g_signal_connect(G_OBJECT(renderer), "toggled", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
473 G_CALLBACK(__online_cb), 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 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
476 -1, _("Online"), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
477 renderer, |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
478 "active", COLUMN_ONLINE, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
479 NULL); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
480 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
481 /* Auto-login? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
482 renderer = gtk_cell_renderer_toggle_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
483 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
484 g_signal_connect(G_OBJECT(renderer), "toggled", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
485 G_CALLBACK(__autologin_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
486 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
487 column = gtk_tree_view_column_new_with_attributes(_("Auto-login"), |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
488 renderer, "active", COLUMN_AUTOLOGIN, NULL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
489 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
490 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
|
491 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
492 /* Filler */ |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
493 renderer = gtk_cell_renderer_text_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
494 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
|
495 -1, "", renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
496 "visible", COLUMN_FILLER, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
497 NULL); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
498 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
499 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
500 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
501 __populate_accounts_list(AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
502 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
503 GList *l; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
504 GaimAccount *account; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
505 GtkTreeIter iter; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
506 GdkPixbuf *pixbuf; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
507 GdkPixbuf *scale; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
508 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
509 gtk_list_store_clear(dialog->model); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
510 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
511 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
512 account = l->data; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
513 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
514 scale = NULL; |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
515 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
516 pixbuf = create_prpl_icon(account); |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
517 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
518 if (pixbuf != NULL) |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
519 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
520 GDK_INTERP_BILINEAR); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
521 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
522 gtk_list_store_append(dialog->model, &iter); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
523 gtk_list_store_set(dialog->model, &iter, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
524 COLUMN_ICON, scale, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
525 COLUMN_SCREENNAME, gaim_account_get_username(account), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
526 COLUMN_ONLINE, gaim_account_is_connected(account), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
527 COLUMN_AUTOLOGIN, FALSE, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
528 COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol(account)), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
529 COLUMN_DATA, account, |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
530 COLUMN_FILLER, FALSE, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
531 -1); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
532 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
533 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
534 if (scale != NULL) g_object_unref(G_OBJECT(scale)); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
535 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
536 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
537 |
5563 | 538 static GtkWidget * |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
539 __create_accounts_list(AccountsDialog *dialog) |
5563 | 540 { |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
541 GtkWidget *sw; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
542 GtkWidget *treeview; |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
543 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
544 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
545 /* Create the scrolled window. */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
546 sw = gtk_scrolled_window_new(0, 0); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
547 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
548 GTK_POLICY_AUTOMATIC, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
549 GTK_POLICY_ALWAYS); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
550 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
551 GTK_SHADOW_IN); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
552 gtk_widget_show(sw); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
553 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
554 /* Create the list model. */ |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
555 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
|
556 G_TYPE_STRING, G_TYPE_STRING, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
557 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
558 G_TYPE_BOOLEAN, G_TYPE_POINTER); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
559 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
560 /* And now the actual treeview */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
561 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
562 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
563 gtk_tree_selection_set_mode( |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
564 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
565 GTK_SELECTION_MULTIPLE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
566 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
567 gtk_container_add(GTK_CONTAINER(sw), treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
568 gtk_widget_show(treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
569 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
570 __add_columns(treeview, dialog); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
571 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
572 __populate_accounts_list(dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
573 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
574 /* Setup DND. I wanna be an orc! */ |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
575 gtk_tree_view_enable_model_drag_source( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
576 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
577 2, GDK_ACTION_COPY); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
578 gtk_tree_view_enable_model_drag_dest( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
579 GTK_TREE_VIEW(treeview), gte, 2, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
580 GDK_ACTION_COPY | GDK_ACTION_MOVE); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
581 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
582 g_signal_connect(G_OBJECT(treeview), "drag-data-received", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
583 G_CALLBACK(__drag_data_received_cb), dialog); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
584 g_signal_connect(G_OBJECT(treeview), "drag-data-get", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
585 G_CALLBACK(__drag_data_get_cb), dialog); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
586 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
587 return sw; |
5563 | 588 } |
589 | |
590 void | |
591 gaim_gtk_account_dialog_show(void) | |
592 { | |
593 AccountsDialog *dialog; | |
594 GtkWidget *win; | |
595 GtkWidget *vbox; | |
596 GtkWidget *bbox; | |
597 GtkWidget *sw; | |
598 GtkWidget *sep; | |
599 GtkWidget *button; | |
600 int width, height; | |
601 | |
602 if (accounts_dialog != NULL) | |
603 return; | |
604 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
605 accounts_dialog = dialog = g_new0(AccountsDialog, 1); |
5563 | 606 |
607 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); | |
608 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height"); | |
609 | |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
610 GAIM_DIALOG(win); |
5563 | 611 |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
612 dialog->window = win; |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
613 |
5563 | 614 gtk_window_set_default_size(GTK_WINDOW(win), width, height); |
615 gtk_window_set_role(GTK_WINDOW(win), "accounts"); | |
616 gtk_window_set_title(GTK_WINDOW(win), "Accounts"); | |
617 gtk_container_set_border_width(GTK_CONTAINER(win), 12); | |
618 | |
619 g_signal_connect(G_OBJECT(win), "delete_event", | |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5637
diff
changeset
|
620 G_CALLBACK(__accedit_win_destroy_cb), accounts_dialog); |
5563 | 621 g_signal_connect(G_OBJECT(win), "configure_event", |
622 G_CALLBACK(__configure_cb), accounts_dialog); | |
623 | |
624 /* Setup the vbox */ | |
625 vbox = gtk_vbox_new(FALSE, 12); | |
626 gtk_container_add(GTK_CONTAINER(win), vbox); | |
627 gtk_widget_show(vbox); | |
628 | |
629 /* 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
|
630 sw = __create_accounts_list(dialog); |
5563 | 631 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
632 gtk_widget_show(sw); | |
633 | |
634 /* Separator... */ | |
635 sep = gtk_hseparator_new(); | |
636 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
637 gtk_widget_show(sep); | |
638 | |
639 /* Button box. */ | |
640 bbox = gtk_hbutton_box_new(); | |
641 gtk_box_set_spacing(GTK_BOX(bbox), 6); | |
642 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
643 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
|
644 gtk_widget_show(bbox); |
5563 | 645 |
646 /* Add button */ | |
647 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
648 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
649 gtk_widget_show(button); | |
650 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
651 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
652 G_CALLBACK(__add_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
653 |
5563 | 654 /* Modify button */ |
655 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY); | |
656 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
657 gtk_widget_show(button); | |
658 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
659 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
660 G_CALLBACK(__modify_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
661 |
5563 | 662 /* Delete button */ |
663 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
664 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5563 | 665 gtk_widget_show(button); |
666 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
667 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
668 G_CALLBACK(__delete_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
669 |
5563 | 670 /* Close button */ |
671 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
672 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5563 | 673 gtk_widget_show(button); |
674 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
675 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
676 G_CALLBACK(__close_accounts_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
677 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
678 /* Setup some gaim signal handlers. */ |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
679 gaim_signal_connect(dialog, event_signon, __signed_on_off_cb, dialog); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
680 gaim_signal_connect(dialog, event_signoff, __signed_on_off_cb, dialog); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
681 |
5563 | 682 gtk_widget_show(win); |
683 } | |
684 |