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