Mercurial > pidgin
annotate src/gtkaccount.c @ 5626:6275ac113622
[gaim-migrate @ 6033]
The first prpl-specific prefs. No, there's no prefs page :)
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 01 Jun 2003 03:43:19 +0000 |
parents | c9724982ce45 |
children | 69c92ae58876 |
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 |
51 typedef struct | |
52 { | |
53 GtkWidget *window; | |
54 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
55 GtkListStore *model; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
56 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
57 GtkTreeViewColumn *screenname_col; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
58 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
59 GtkTreeIter drag_iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
60 |
5563 | 61 } AccountsDialog; |
62 | |
63 static AccountsDialog *accounts_dialog = NULL; | |
64 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
65 static char * |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
66 proto_name(int proto) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
67 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
68 GaimPlugin *p = gaim_find_prpl(proto); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
69 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
70 return ((p && p->info->name) ? _(p->info->name) : _("Unknown")); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
71 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
72 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
73 static void |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
74 __signed_on_off_cb(GaimConnection *gc, AccountsDialog *dialog) |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
75 { |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
76 GaimAccount *account = gaim_connection_get_account(gc); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
77 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
78 GtkTreeIter iter; |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
79 size_t index = g_list_index(gaim_accounts_get_all(), account); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
80 |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
81 if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) { |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
82 gtk_list_store_set(dialog->model, &iter, |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
83 COLUMN_ONLINE, gaim_account_is_connected(account), |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
84 -1); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
85 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
86 } |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
87 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
88 static void |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
89 __drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
90 GtkSelectionData *data, guint info, guint time, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
91 AccountsDialog *dialog) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
92 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
93 if (data->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
94 GtkTreeRowReference *ref; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
95 GtkTreePath *source_row; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
96 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
97 GaimAccount *account = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
98 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
99 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
100 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
|
101 source_row = gtk_tree_row_reference_get_path(ref); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
102 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
103 if (source_row == NULL) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
104 return; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
105 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
106 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
107 source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
108 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
109 COLUMN_DATA, &val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
110 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
111 dialog->drag_iter = iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
112 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
113 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
114 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
115 gtk_selection_data_set(data, gdk_atom_intern("GAIM_ACCOUNT", FALSE), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
116 8, (void *)&account, sizeof(account)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
117 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
118 gtk_tree_path_free(source_row); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
119 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
120 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
121 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
122 static void |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
123 __drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
124 guint x, guint y, GtkSelectionData *sd, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
125 guint info, guint t, AccountsDialog *dialog) |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
126 { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
127 if (sd->target == gdk_atom_intern("GAIM_ACCOUNT", FALSE) && sd->data) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
128 size_t dest_index; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
129 GaimAccount *a = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
130 GtkTreePath *path = NULL; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
131 GtkTreeViewDropPosition position; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
132 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
133 memcpy(&a, sd->data, sizeof(a)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
134 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
135 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
|
136 &path, &position)) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
137 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
138 GtkTreeIter iter; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
139 GaimAccount *account; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
140 GValue val = {0}; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
141 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
142 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
|
143 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
144 COLUMN_DATA, &val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
145 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
146 account = g_value_get_pointer(&val); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
147 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
148 switch (position) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
149 case GTK_TREE_VIEW_DROP_AFTER: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
150 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
151 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
152 "after\n"); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
153 gtk_list_store_move_after(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
154 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
155 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
156 account) + 1; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
157 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
158 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
159 case GTK_TREE_VIEW_DROP_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
160 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
161 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
162 "before\n"); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
163 dest_index = g_list_index(gaim_accounts_get_all(), |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
164 account); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
165 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
166 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
167 "iter = %p\n", &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
168 gaim_debug(GAIM_DEBUG_MISC, "gtkaccount", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
169 "account = %s\n", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
170 gaim_account_get_username(account)); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
171 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
172 /* |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
173 * Somebody figure out why inserting before the first |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
174 * account sometimes moves to the end, please :( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
175 */ |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
176 if (dest_index == 0) { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
177 gtk_list_store_move_after(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
178 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
179 gtk_list_store_swap(dialog->model, &iter, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
180 &dialog->drag_iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
181 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
182 else { |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
183 gtk_list_store_move_before(dialog->model, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
184 &dialog->drag_iter, &iter); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
185 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
186 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
187 break; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
188 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
189 default: |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
190 return; |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
191 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
192 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
193 gaim_accounts_reorder(a, dest_index); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
194 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
195 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
196 } |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
197 |
5563 | 198 static gint |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
199 __window_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsDialog *dialog) |
5563 | 200 { |
201 g_free(accounts_dialog); | |
202 accounts_dialog = NULL; | |
203 | |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
204 /* See if we're the main window here. */ |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
205 if (GAIM_GTK_BLIST(gaim_get_blist())->window == NULL && |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
206 mainwindow == NULL && gaim_connections_get_all() == NULL) { |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
207 |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
208 do_quit(); |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
209 } |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
210 |
5563 | 211 return FALSE; |
212 } | |
213 | |
214 static gboolean | |
215 __configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog) | |
216 { | |
217 if (GTK_WIDGET_VISIBLE(w)) { | |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
218 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
|
219 int col_width; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
220 int difference; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
221 |
5563 | 222 gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width", event->width); |
223 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
|
224 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
225 col_width = gtk_tree_view_column_get_width(dialog->screenname_col); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
226 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
227 if (col_width == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
228 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
229 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
230 difference = (MAX(old_width, event->width) - |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
231 MIN(old_width, event->width)); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
232 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
233 if (difference == 0) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
234 return FALSE; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
235 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
236 if (old_width < event->width) |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
237 gtk_tree_view_column_set_min_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
238 col_width + difference); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
239 else |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
240 gtk_tree_view_column_set_max_width(dialog->screenname_col, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
241 col_width - difference); |
5563 | 242 } |
243 | |
244 return FALSE; | |
245 } | |
246 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
247 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
248 __add_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
249 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
250 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
251 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
252 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
253 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
254 __modify_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
255 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
256 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
257 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
258 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
259 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
260 __delete_account_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
261 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
262 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
263 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
264 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
265 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
266 __close_accounts_cb(GtkWidget *w, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
267 { |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
268 gtk_widget_destroy(dialog->window); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
269 |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
270 __window_destroy_cb(NULL, NULL, dialog); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
271 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
272 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
273 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
274 __online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
275 { |
5592
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
276 AccountsDialog *dialog = (AccountsDialog *)data; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
277 GaimAccount *account; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
278 GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
279 GtkTreeIter iter; |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
280 |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
281 gtk_tree_model_get_iter_from_string(model, &iter, path_str); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
282 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
283 |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
284 if (gaim_account_is_connected(account)) |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
285 gaim_account_disconnect(account); |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
286 else |
57165429ed73
[gaim-migrate @ 5996]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
287 gaim_account_connect(account); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
288 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
289 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
290 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
291 __autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
292 gpointer data) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
293 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
294 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
295 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
296 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
297 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
298 __add_columns(GtkWidget *treeview, AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
299 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
300 GtkCellRenderer *renderer; |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
301 GtkTreeViewColumn *column; |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
302 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
303 /* Protocol */ |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
304 column = gtk_tree_view_column_new(); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
305 gtk_tree_view_column_set_title(column, _("Protocol")); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
306 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
307 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
308 /* Icon text */ |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
309 renderer = gtk_cell_renderer_pixbuf_new(); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
310 gtk_tree_view_column_pack_start(column, renderer, FALSE); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
311 gtk_tree_view_column_add_attribute(column, renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
312 "pixbuf", COLUMN_ICON); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
313 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
314 /* Protocol name */ |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
315 renderer = gtk_cell_renderer_text_new(); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
316 gtk_tree_view_column_pack_start(column, renderer, TRUE); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
317 gtk_tree_view_column_add_attribute(column, renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
318 "text", COLUMN_PROTOCOL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
319 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
320 /* Screennames */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
321 renderer = gtk_cell_renderer_text_new(); |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
322 column = gtk_tree_view_column_new_with_attributes(_("Screenname"), |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
323 renderer, "text", COLUMN_SCREENNAME, NULL); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
324 dialog->screenname_col = column; |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
325 |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
326 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
|
327 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
|
328 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
329 /* Online? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
330 renderer = gtk_cell_renderer_toggle_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
331 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
332 g_signal_connect(G_OBJECT(renderer), "toggled", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
333 G_CALLBACK(__online_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
334 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
335 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
336 -1, _("Online"), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
337 renderer, |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
338 "active", COLUMN_ONLINE, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
339 NULL); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
340 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
341 /* Auto-login? */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
342 renderer = gtk_cell_renderer_toggle_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
343 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
344 g_signal_connect(G_OBJECT(renderer), "toggled", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
345 G_CALLBACK(__autologin_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
346 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
347 column = gtk_tree_view_column_new_with_attributes(_("Auto-login"), |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
348 renderer, "active", COLUMN_AUTOLOGIN, NULL); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
349 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
350 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
|
351 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
352 /* Filler */ |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
353 renderer = gtk_cell_renderer_text_new(); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
354 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
|
355 -1, "", renderer, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
356 "visible", COLUMN_FILLER, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
357 NULL); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
358 } |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
359 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
360 static void |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
361 __populate_accounts_list(AccountsDialog *dialog) |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
362 { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
363 GList *l; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
364 GaimAccount *account; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
365 GtkTreeIter iter; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
366 GdkPixbuf *pixbuf; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
367 GdkPixbuf *scale; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
368 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
369 gtk_list_store_clear(dialog->model); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
370 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
371 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
372 account = l->data; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
373 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
374 scale = NULL; |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
375 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
376 pixbuf = create_prpl_icon(account); |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
377 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
378 if (pixbuf != NULL) |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
379 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
380 GDK_INTERP_BILINEAR); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
381 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
382 gtk_list_store_append(dialog->model, &iter); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
383 gtk_list_store_set(dialog->model, &iter, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
384 COLUMN_ICON, scale, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
385 COLUMN_SCREENNAME, gaim_account_get_username(account), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
386 COLUMN_ONLINE, gaim_account_is_connected(account), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
387 COLUMN_AUTOLOGIN, FALSE, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
388 COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol(account)), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
389 COLUMN_DATA, account, |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
390 COLUMN_FILLER, FALSE, |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
391 -1); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
392 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
393 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
394 if (scale != NULL) g_object_unref(G_OBJECT(scale)); |
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 |
5563 | 398 static GtkWidget * |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
399 __create_accounts_list(AccountsDialog *dialog) |
5563 | 400 { |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
401 GtkWidget *sw; |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
402 GtkWidget *treeview; |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
403 GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; |
5569
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 /* Create the scrolled window. */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
406 sw = gtk_scrolled_window_new(0, 0); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
407 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
408 GTK_POLICY_AUTOMATIC, |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
409 GTK_POLICY_ALWAYS); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
410 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
411 GTK_SHADOW_IN); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
412 gtk_widget_show(sw); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
413 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
414 /* Create the list model. */ |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5569
diff
changeset
|
415 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
|
416 G_TYPE_STRING, G_TYPE_STRING, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
417 G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
418 G_TYPE_BOOLEAN, G_TYPE_POINTER); |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
419 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
420 /* And now the actual treeview */ |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
421 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
|
422 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
423 gtk_tree_selection_set_mode( |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
424 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
425 GTK_SELECTION_MULTIPLE); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
426 |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
427 gtk_container_add(GTK_CONTAINER(sw), treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
428 gtk_widget_show(treeview); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
429 |
5581
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
430 __add_columns(treeview, dialog); |
3a9b54f260e3
[gaim-migrate @ 5985]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
431 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
432 __populate_accounts_list(dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
433 |
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
434 /* Setup DND. I wanna be an orc! */ |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
435 gtk_tree_view_enable_model_drag_source( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
436 GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
437 2, GDK_ACTION_COPY); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
438 gtk_tree_view_enable_model_drag_dest( |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
439 GTK_TREE_VIEW(treeview), gte, 2, |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
440 GDK_ACTION_COPY | GDK_ACTION_MOVE); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
441 |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
442 g_signal_connect(G_OBJECT(treeview), "drag-data-received", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
443 G_CALLBACK(__drag_data_received_cb), dialog); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
444 g_signal_connect(G_OBJECT(treeview), "drag-data-get", |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
445 G_CALLBACK(__drag_data_get_cb), dialog); |
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5617
diff
changeset
|
446 |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
447 return sw; |
5563 | 448 } |
449 | |
450 void | |
451 gaim_gtk_account_dialog_show(void) | |
452 { | |
453 AccountsDialog *dialog; | |
454 GtkWidget *win; | |
455 GtkWidget *vbox; | |
456 GtkWidget *bbox; | |
457 GtkWidget *sw; | |
458 GtkWidget *sep; | |
459 GtkWidget *button; | |
460 int width, height; | |
461 | |
462 if (accounts_dialog != NULL) | |
463 return; | |
464 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
465 accounts_dialog = dialog = g_new0(AccountsDialog, 1); |
5563 | 466 |
467 width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width"); | |
468 height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height"); | |
469 | |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
470 GAIM_DIALOG(win); |
5563 | 471 |
5617
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
472 dialog->window = win; |
feb012e01741
[gaim-migrate @ 6024]
Christian Hammond <chipx86@chipx86.com>
parents:
5615
diff
changeset
|
473 |
5563 | 474 gtk_window_set_default_size(GTK_WINDOW(win), width, height); |
475 gtk_window_set_role(GTK_WINDOW(win), "accounts"); | |
476 gtk_window_set_title(GTK_WINDOW(win), "Accounts"); | |
477 gtk_container_set_border_width(GTK_CONTAINER(win), 12); | |
478 | |
479 g_signal_connect(G_OBJECT(win), "delete_event", | |
480 G_CALLBACK(__window_destroy_cb), accounts_dialog); | |
481 g_signal_connect(G_OBJECT(win), "configure_event", | |
482 G_CALLBACK(__configure_cb), accounts_dialog); | |
483 | |
484 /* Setup the vbox */ | |
485 vbox = gtk_vbox_new(FALSE, 12); | |
486 gtk_container_add(GTK_CONTAINER(win), vbox); | |
487 gtk_widget_show(vbox); | |
488 | |
489 /* 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
|
490 sw = __create_accounts_list(dialog); |
5563 | 491 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
492 gtk_widget_show(sw); | |
493 | |
494 /* Separator... */ | |
495 sep = gtk_hseparator_new(); | |
496 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
497 gtk_widget_show(sep); | |
498 | |
499 /* Button box. */ | |
500 bbox = gtk_hbutton_box_new(); | |
501 gtk_box_set_spacing(GTK_BOX(bbox), 6); | |
502 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
503 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
|
504 gtk_widget_show(bbox); |
5563 | 505 |
506 /* Add button */ | |
507 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
508 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
509 gtk_widget_show(button); | |
510 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
511 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
512 G_CALLBACK(__add_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
513 |
5563 | 514 /* Modify button */ |
515 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY); | |
516 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
517 gtk_widget_show(button); | |
518 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
519 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
520 G_CALLBACK(__modify_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
521 |
5563 | 522 /* Delete button */ |
523 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
524 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5563 | 525 gtk_widget_show(button); |
526 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
527 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
528 G_CALLBACK(__delete_account_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
529 |
5563 | 530 /* Close button */ |
531 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
532 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5563 | 533 gtk_widget_show(button); |
534 | |
5569
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
535 g_signal_connect(G_OBJECT(button), "clicked", |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
536 G_CALLBACK(__close_accounts_cb), dialog); |
5d2911d6d38e
[gaim-migrate @ 5971]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
537 |
5615
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
538 /* Setup some gaim signal handlers. */ |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
539 gaim_signal_connect(dialog, event_signon, __signed_on_off_cb, dialog); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
540 gaim_signal_connect(dialog, event_signoff, __signed_on_off_cb, dialog); |
6500a6c8d679
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5592
diff
changeset
|
541 |
5563 | 542 gtk_widget_show(win); |
543 } | |
544 |