annotate src/gtkconn.c @ 10026:341d89fa78e5

[gaim-migrate @ 10962] I don't remember who helped get everything working again initially. Tell somebody if I left you off. And kick me in The Shins are good. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 15 Sep 2004 03:25:37 +0000
parents bdec08a8fc5b
children 006410d0ae0c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /*
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * gaim
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8014
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8014
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8014
diff changeset
6 * source distribution.
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 */
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9730
diff changeset
22 #include "internal.h"
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9730
diff changeset
23 #include "gtkgaim.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 #include "account.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
26 #include "debug.h"
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
27 #include "notify.h"
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
28 #include "prefs.h"
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
29 #include "stock.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
30 #include "util.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
32 #include "gtkblist.h"
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
33 #include "gtkdialogs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
34 #include "gtkutils.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
35
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
36 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
37 * The next couple of functions deal with the connection dialog
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
38 */
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 struct signon_meter {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 GaimAccount *account;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 GtkWidget *button;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 GtkWidget *progress;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43 GtkWidget *status;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44 };
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 struct meter_window {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 GtkWidget *window;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 GtkWidget *table;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49 gint rows;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
50 gint active_count;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 GSList *meters;
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
52 };
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
53 struct meter_window *meter_win = NULL;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
55 static void kill_meter(struct signon_meter *meter, const char *text)
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
56 {
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8190
diff changeset
57 if(gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(meter->progress)) == 1)
8014
c052eccc10ee [gaim-migrate @ 8694]
Nathan Walp <nwalp@pidgin.im>
parents: 7912
diff changeset
58 return;
c052eccc10ee [gaim-migrate @ 8694]
Nathan Walp <nwalp@pidgin.im>
parents: 7912
diff changeset
59
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
60 gtk_widget_set_sensitive(meter->button, FALSE);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
61 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), 1);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
62 gtk_label_set_text(GTK_LABEL(meter->status), text);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
63 meter_win->active_count--;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
64
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
65 if (meter_win->active_count == 0) {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
66 gtk_widget_destroy(meter_win->window);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
67 g_free(meter_win);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
68 meter_win = NULL;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
69 }
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
70 }
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
71
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72 static void cancel_signon(GtkWidget *button, struct signon_meter *meter)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73 {
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
74 if (meter->account->gc != NULL) {
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
75 meter->account->gc->wants_to_die = TRUE;
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
76 gaim_connection_destroy(meter->account->gc);
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
77 } else {
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
78 kill_meter(meter, _("Done."));
5987
6e19ad2ef712 [gaim-migrate @ 6435]
Christian Hammond <chipx86@chipx86.com>
parents: 5936
diff changeset
79
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
80 if (gaim_connections_get_all() == NULL) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
81 gaim_gtkdialogs_destroy_all();
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
82
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
83 gaim_blist_destroy();
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
84
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
85 show_login();
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
86 }
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
87 }
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
90 static void cancel_all ()
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
91 {
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
92 GSList *m = meter_win ? meter_win->meters : NULL;
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
93 struct signon_meter *meter;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
94
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
95 while (m) {
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
96 meter = m->data;
7890
438b4667db0d [gaim-migrate @ 8550]
Luke Schierer <lschiere@pidgin.im>
parents: 7874
diff changeset
97 if (gaim_connection_get_state(meter->account->gc) != GAIM_CONNECTED)
438b4667db0d [gaim-migrate @ 8550]
Luke Schierer <lschiere@pidgin.im>
parents: 7874
diff changeset
98 cancel_signon(NULL, meter);
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
99 m = m->next;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
100 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
101 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
102
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
103 static gint meter_destroy(GtkWidget *window, GdkEvent *evt, struct signon_meter *meter)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
104 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
105 return TRUE;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
106 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
107
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108 static struct signon_meter *find_signon_meter(GaimConnection *gc)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110 GSList *m = meter_win ? meter_win->meters : NULL;
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
111 struct signon_meter *meter;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
112
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
113 while (m) {
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
114 meter = m->data;
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
115 if (meter->account == gaim_connection_get_account(gc))
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
116 return m->data;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
117 m = m->next;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
118 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
119
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120 return NULL;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
122
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
123 static GtkWidget* create_meter_pixmap (GaimConnection *gc)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
124 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
125 GdkPixbuf *pb = create_prpl_icon(gc->account);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
126 GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
127 GtkWidget *image =
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
128 gtk_image_new_from_pixbuf(scale);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
129 g_object_unref(G_OBJECT(pb));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
130 g_object_unref(G_OBJECT(scale));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
131 return image;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
132 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
133
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
134 static struct signon_meter *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 new_meter(GaimConnection *gc, GtkWidget *widget,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
136 GtkWidget *table, gint *rows)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
138 GtkWidget *graphic;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
139 GtkWidget *label;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
140 GtkWidget *nest_vbox;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
141 GString *name_to_print;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
142 struct signon_meter *meter;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
143
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
144
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
145 meter = g_new0(struct signon_meter, 1);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
146
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
147 meter->account = gaim_connection_get_account(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
148 name_to_print = g_string_new(gaim_account_get_username(meter->account));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
149
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
150 (*rows)++;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
151 gtk_table_resize (GTK_TABLE(table), *rows, 4);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153 graphic = create_meter_pixmap(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
155 nest_vbox = gtk_vbox_new (FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
156
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
157 g_string_prepend(name_to_print, _("Signon: "));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
158 label = gtk_label_new (name_to_print->str);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
159 g_string_free(name_to_print, TRUE);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
160 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
161
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
162 meter->status = gtk_label_new("");
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
163 gtk_misc_set_alignment(GTK_MISC(meter->status), 0, 0.5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
164 gtk_widget_set_size_request(meter->status, 250, -1);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
165
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
166 meter->progress = gtk_progress_bar_new ();
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
167
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
168 meter->button = gaim_pixbuf_button_from_stock (_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
169 g_signal_connect(G_OBJECT (meter->button), "clicked",
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
170 G_CALLBACK (cancel_signon), meter);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
171
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
172 gtk_table_attach (GTK_TABLE (table), graphic, 0, 1, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
173 gtk_table_attach (GTK_TABLE (table), nest_vbox, 1, 2, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
174 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (label), FALSE, FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
175 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (meter->status), FALSE, FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
176 gtk_table_attach (GTK_TABLE (table), meter->progress, 2, 3, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
177 gtk_table_attach (GTK_TABLE (table), meter->button, 3, 4, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
178
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
179 gtk_widget_show_all (GTK_WIDGET (meter_win->window));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
180
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
181 meter_win->active_count++;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
182
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
183 return meter;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
184 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
185
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
186 static void gaim_gtk_connection_connect_progress(GaimConnection *gc,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
187 const char *text, size_t step, size_t step_count)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
188 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
189 struct signon_meter *meter;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
190
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
191 if(!meter_win) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
192 GtkWidget *vbox;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
193 GtkWidget *cancel_button;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
194
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
195 if(mainwindow)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
196 gtk_widget_hide(mainwindow);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
197
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
198 meter_win = g_new0(struct meter_window, 1);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
199 meter_win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
200 gtk_window_set_resizable(GTK_WINDOW(meter_win->window), FALSE);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
201 gtk_window_set_role(GTK_WINDOW(meter_win->window), "signon");
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
202 gtk_container_set_border_width(GTK_CONTAINER(meter_win->window), 5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 gtk_window_set_title(GTK_WINDOW(meter_win->window), _("Signon"));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205 vbox = gtk_vbox_new (FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206 gtk_container_add(GTK_CONTAINER(meter_win->window), vbox);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
207
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
208 meter_win->table = gtk_table_new(1, 4, FALSE);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(meter_win->table),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
210 FALSE, FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
211 gtk_container_set_border_width(GTK_CONTAINER(meter_win->table), 5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212 gtk_table_set_row_spacings(GTK_TABLE(meter_win->table), 5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213 gtk_table_set_col_spacings(GTK_TABLE(meter_win->table), 10);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
214
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
215 cancel_button = gaim_pixbuf_button_from_stock(_("Cancel All"),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 GTK_STOCK_QUIT, GAIM_BUTTON_HORIZONTAL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 g_signal_connect_swapped(G_OBJECT(cancel_button), "clicked",
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218 G_CALLBACK(cancel_all), NULL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(cancel_button),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220 FALSE, FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 g_signal_connect(G_OBJECT(meter_win->window), "delete_event",
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223 G_CALLBACK(meter_destroy), NULL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226 meter = find_signon_meter(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227 if(!meter) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 meter = new_meter(gc, meter_win->window, meter_win->table,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229 &meter_win->rows);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
230
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
231 meter_win->meters = g_slist_append(meter_win->meters, meter);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
232 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
233
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
234 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
235 (float)step / (float)step_count);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
236 gtk_label_set_text(GTK_LABEL(meter->status), text);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
237 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
238
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
239 static void gaim_gtk_connection_connected(GaimConnection *gc)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
240 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241 struct signon_meter *meter = find_signon_meter(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
242
5885
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
243 gaim_setup(gc);
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
244
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
245 #if 0 /* XXX CORE/UI */
5885
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
246 do_away_menu();
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
247 #endif
5936
1b56a833d665 [gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents: 5885
diff changeset
248 gaim_gtk_blist_update_protocol_actions();
5885
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
249
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
250 if (meter)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
251 kill_meter(meter, _("Done."));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
252 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
253
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
254 static void gaim_gtk_connection_disconnected(GaimConnection *gc)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
255 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
256 struct signon_meter *meter = find_signon_meter(gc);
5883
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
257
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
258 #if 0 /* XXX CORE/UI */
5885
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
259 do_away_menu();
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
260 #endif
5936
1b56a833d665 [gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents: 5885
diff changeset
261 gaim_gtk_blist_update_protocol_actions();
5883
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
262
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
263 if (meter)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264 kill_meter(meter, _("Done."));
5883
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
265
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
266 if (gaim_connections_get_all() != NULL)
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
267 return;
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
268
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
269 gaim_gtkdialogs_destroy_all();
5883
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
270
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
271 gaim_blist_destroy();
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
272
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
273 show_login();
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
274 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
275
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
276 static void gaim_gtk_connection_notice(GaimConnection *gc,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
277 const char *text)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
278 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
280
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
281 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
282 * The next couple of functions deal with the disconnected dialog
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
283 */
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
284 struct disconnect_window {
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
285 GtkWidget *window;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
286 GtkWidget *treeview;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
287 GtkWidget *sw;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
288 GtkWidget *label;
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
289 GtkWidget *reconnect_btn;
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
290 GtkWidget *reconnectall_btn;
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
291 };
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
292 struct disconnect_window *disconnect_window = NULL;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
293
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
294 static void disconnect_connection_change_cb(GaimConnection *gc, void *data);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
295
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
296 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
297 * Destroy the dialog and remove the signals associated with it.
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
298 */
7493
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
299 static void disconnect_window_hide()
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
300 {
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
301 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
302 disconnect_window, GAIM_CALLBACK(disconnect_connection_change_cb));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
303
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
304 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
305 disconnect_window, GAIM_CALLBACK(disconnect_connection_change_cb));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
306
7493
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
307 gtk_widget_destroy(disconnect_window->window);
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
308 g_free(disconnect_window);
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
309 disconnect_window = NULL;
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
310 }
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
311
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
312 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
313 * Make sure the Reconnect and Reconnect All buttons are correctly
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
314 * shown or hidden. Also make sure the label on the Reconnect
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
315 * button is correctly set to either Reconnect or Remove. If there
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
316 * is more than one account then make sure the GtkTreeView is shown.
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8326
diff changeset
317 * If there are no accounts disconnected then hide the dialog.
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
318 */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
319 static void disconnect_window_update_buttons(GtkTreeModel *model)
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
320 {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
321 GtkTreeIter iter;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
322 GtkTreeSelection *sel;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
323 const char *label_text;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
324 GaimAccount *account = NULL;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
325
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
326 if ((disconnect_window == NULL) || (model == NULL))
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
327 return;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
328
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
329 if (!gtk_tree_model_get_iter_first(model, &iter)) {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
330 /* No more accounts being shown. Caloo calay! */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
331 disconnect_window_hide();
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
332 return;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
333 }
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
334
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
335 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
336 * If we have more than one disconnected account then show the
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
337 * GtkTreeView and the "Reconnect All" button
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
338 */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
339 if (gtk_tree_model_iter_next(model, &iter)) {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
340 gtk_widget_show_all(disconnect_window->sw);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
341 gtk_widget_show(disconnect_window->reconnectall_btn);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
342 } else {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
343 gtk_widget_hide_all(disconnect_window->sw);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
344 gtk_widget_hide(disconnect_window->reconnectall_btn);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
345 }
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
346
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
347 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
348 * Make sure one of the accounts is selected.
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
349 */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
350 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(disconnect_window->treeview));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
351 if (!gtk_tree_selection_get_selected(sel, &model, &iter)) {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
352 gtk_tree_model_get_iter_first(model, &iter);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
353 gtk_tree_selection_select_iter(sel, &iter);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
354 }
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
355
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
356 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
357 * Update the Reconnect/Remove button appropriately and set the
8174
4c34db6996d1 [gaim-migrate @ 8888]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
358 * label in the dialog to what it should be. If there is only
4c34db6996d1 [gaim-migrate @ 8888]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
359 * one account in the tree model, and that account is connected,
4c34db6996d1 [gaim-migrate @ 8888]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
360 * then we don't show the remove button.
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
361 */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
362 gtk_tree_model_get(model, &iter, 3, &label_text, 4, &account, -1);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
363 gtk_button_set_label(GTK_BUTTON(disconnect_window->reconnect_btn),
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
364 gaim_account_is_connected(account) ? _("_Remove") : _("_Reconnect"));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
365 gtk_label_set_markup(GTK_LABEL(disconnect_window->label), label_text);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
366 gtk_dialog_set_response_sensitive(GTK_DIALOG(disconnect_window->window), GTK_RESPONSE_ACCEPT, TRUE);
8190
0a0501566843 [gaim-migrate @ 8911]
Mark Doliner <mark@kingant.net>
parents: 8174
diff changeset
367 gtk_tree_model_get_iter_first(model, &iter);
8174
4c34db6996d1 [gaim-migrate @ 8888]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
368 if (gaim_account_is_connected(account) && !(gtk_tree_model_iter_next(model, &iter)))
4c34db6996d1 [gaim-migrate @ 8888]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
369 gtk_widget_hide(disconnect_window->reconnect_btn);
4c34db6996d1 [gaim-migrate @ 8888]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
370 else
4c34db6996d1 [gaim-migrate @ 8888]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
371 gtk_widget_show(disconnect_window->reconnect_btn);
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
372 }
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
373
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
374 static void disconnect_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget)
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
375 {
7483
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
376 GtkTreeIter iter;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
377 GtkTreeSelection *sel = NULL;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
378 GtkTreeModel *model = NULL;
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7409
diff changeset
379 GaimAccount *account = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7409
diff changeset
380
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
381 switch (id) {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
382 case GTK_RESPONSE_APPLY: /* Reconnect All */
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
383 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
384 if (gtk_tree_model_get_iter_first(model, &iter)) {
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
385 /* tree rows to be deleted */
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
386 GList *l_del = NULL, *l_del_iter = NULL;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
387 /* accounts to be connected */
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
388 GList *l_accts = NULL, *l_accts_iter = NULL;
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
389 do {
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
390 GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
391 GtkTreeRowReference* del_row = gtk_tree_row_reference_new(model, path);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
392 l_del = g_list_append(l_del, del_row);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
393 gtk_tree_path_free(path);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
394
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
395 gtk_tree_model_get(model, &iter, 4, &account, -1);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
396 if (!gaim_account_is_connected(account) && g_list_find(l_accts, account) == NULL)
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
397 l_accts = g_list_append(l_accts, account);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
398 } while (gtk_tree_model_iter_next(model, &iter));
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
399
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
400 /* remove all rows */
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
401 /* We could just do the following, but we only want to remove accounts
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
402 * that are going to be reconnected, not accounts that have already
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
403 * been reconnected.
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
404 */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
405 /* gtk_list_store_clear(GTK_LIST_STORE(model)); */
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
406 l_del_iter = l_del;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
407 while (l_del_iter != NULL) {
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
408 GtkTreeRowReference* del_row = l_del_iter->data;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
409 GtkTreePath *path = gtk_tree_row_reference_get_path(del_row);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
410 if (gtk_tree_model_get_iter(model, &iter, path))
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
411 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
412 gtk_tree_path_free(path);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
413 gtk_tree_row_reference_free(del_row);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
414 l_del_iter = l_del_iter->next;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
415 }
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
416 g_list_free(l_del);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
417
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
418 /* reconnect disconnected accounts */
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
419 l_accts_iter = l_accts;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
420 while (l_accts_iter != NULL) {
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
421 account = l_accts_iter->data;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
422 gaim_account_connect(account);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
423 l_accts_iter = l_accts_iter->next;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
424 }
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
425 g_list_free(l_accts);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
426
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
427 }
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
428
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
429 disconnect_window_update_buttons(model);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
430
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
431 break;
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
432
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
433 case GTK_RESPONSE_ACCEPT: /* Reconnect Selected */
7483
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
434 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
435
7483
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
436 /*
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
437 * If we have more than one account disconnection displayed, then
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
438 * the scroll window is visible and we should use the selected
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
439 * account to reconnect.
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
440 */
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
441 if (GTK_WIDGET_VISIBLE(disconnect_window->sw)) {
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
442 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(disconnect_window->treeview));
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
443 if (!gtk_tree_selection_get_selected(sel, &model, &iter))
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
444 return;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
445 } else {
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
446 /* There is only one account disconnection, so reconnect to it. */
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
447 if (!gtk_tree_model_get_iter_first(model, &iter))
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
448 return;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
449 }
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
450
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
451 /* remove all disconnections of the account to be reconnected */
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
452 gtk_tree_model_get(model, &iter, 4, &account, -1);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
453 if (gtk_tree_model_get_iter_first(model, &iter)) {
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
454 GList *l_del = NULL, *l_del_iter = NULL;
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
455 GaimAccount *account2 = NULL;
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
456 do {
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
457 gtk_tree_model_get(model, &iter, 4, &account2, -1);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
458 if (account2 == account) {
7643
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
459 GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
460 GtkTreeRowReference* del_row = gtk_tree_row_reference_new(model, path);
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
461 l_del = g_list_append(l_del, del_row);
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
462 gtk_tree_path_free(path);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
463 }
7643
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
464 } while (gtk_tree_model_iter_next(model, &iter));
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
465
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
466 l_del_iter = l_del;
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
467 while (l_del_iter != NULL) {
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
468 GtkTreeRowReference* del_row = l_del_iter->data;
7643
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
469 GtkTreePath *path = gtk_tree_row_reference_get_path(del_row);
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
470 if (gtk_tree_model_get_iter(model, &iter, path))
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
471 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
472 gtk_tree_path_free(path);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
473 gtk_tree_row_reference_free(del_row);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
474 l_del_iter = l_del_iter->next;
7643
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
475 }
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
476 g_list_free(l_del);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
477 }
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
478
7643
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
479 gaim_account_connect(account);
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
480 disconnect_window_update_buttons(model);
7643
834570cb8d86 [gaim-migrate @ 8286]
Ethan Blanton <elb@pidgin.im>
parents: 7640
diff changeset
481
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
482 break;
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
483
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
484 case GTK_RESPONSE_DELETE_EVENT:
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
485 case GTK_RESPONSE_CLOSE:
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
486 disconnect_window_hide();
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
487 break;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
488
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
489 }
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
490 }
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
491
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
492 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
493 * Called whenever a different account is selected in the GtkListWhatever.
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
494 */
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
495 static void disconnect_tree_cb(GtkTreeSelection *sel, GtkTreeModel *model)
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
496 {
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
497 disconnect_window_update_buttons(model);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
498 }
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
499
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
500 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
501 * Update the icon next to the account in the disconnect dialog, and
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
502 * gray the Reconnect All button if there is only 1 disconnected account.
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
503 */
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
504 static void disconnect_connection_change_cb(GaimConnection *gc, void *data) {
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
505 GaimAccount *account = gaim_connection_get_account(gc);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
506 GtkTreeIter iter;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
507 GtkTreeModel *model;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
508 GdkPixbuf *icon;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
509 GdkPixbuf *scale;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
510 GList *l_disc_accts = NULL;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
511
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
512 if (disconnect_window == NULL)
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
513 return;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
514
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
515 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
516 icon = create_prpl_icon(account);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
517 scale = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
518
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
519 /* Mark all disconnections w/ the account type disconnected /w grey icon */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
520 if (!gaim_account_is_connected(account))
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
521 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
522
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
523 gtk_tree_model_get_iter_first(model, &iter);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
524 do {
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
525 GaimAccount *account2 = NULL;
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
526 /* Gray out the icon if this row is for this account */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
527 gtk_tree_model_get(model, &iter, 4, &account2, -1);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
528 if (account2 == account)
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
529 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, scale, -1);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
530
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
531 /* Add */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
532 if (!gaim_account_is_connected(account2)
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
533 && g_list_find(l_disc_accts, account2) == NULL)
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
534 l_disc_accts = g_list_append(l_disc_accts, account2);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
535 } while (gtk_tree_model_iter_next(model, &iter));
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
536
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
537 gtk_dialog_set_response_sensitive(
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
538 GTK_DIALOG(disconnect_window->window),
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
539 GTK_RESPONSE_APPLY,
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
540 g_list_length(l_disc_accts) > 1);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
541 g_list_free(l_disc_accts);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
542
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
543 if (icon != NULL)
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
544 g_object_unref(G_OBJECT(icon));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
545 if (scale != NULL)
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
546 g_object_unref(G_OBJECT(scale));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
547
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
548 disconnect_window_update_buttons(model);
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
549 }
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
550
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
551 static void
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
552 gaim_gtk_connection_report_disconnect(GaimConnection *gc, const char *text)
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
553 {
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
554 char *label_text = NULL;
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
555 GtkTreeIter new_iter;
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
556 GtkListStore *list_store;
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
557 GtkTreeViewColumn *col;
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
558 GtkTreeSelection *sel = NULL;
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
559
7648
ab7497c96b1a [gaim-migrate @ 8291]
Luke Schierer <lschiere@pidgin.im>
parents: 7643
diff changeset
560 label_text = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">%s has been disconnected.</span>\n\n%s\n%s"),
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
561 gaim_account_get_username(gaim_connection_get_account(gc)), gaim_date_full(),
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
562 text ? text : _("Reason Unknown."));
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
563
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
564 /* Build the window if it isn't there yet */
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
565 if (!disconnect_window) {
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
566 GtkWidget *hbox, *vbox, *img;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
567 GtkCellRenderer *rend, *rend2;
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
568
7407
0c0bde5a3959 [gaim-migrate @ 8007]
Nathan Walp <nwalp@pidgin.im>
parents: 7399
diff changeset
569 disconnect_window = g_new0(struct disconnect_window, 1);
7874
40b37b1e0905 [gaim-migrate @ 8528]
Mark Doliner <mark@kingant.net>
parents: 7808
diff changeset
570 disconnect_window->window = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, NULL, GTK_DIALOG_NO_SEPARATOR, NULL);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
571 g_signal_connect(G_OBJECT(disconnect_window->window), "response", G_CALLBACK(disconnect_response_cb), disconnect_window);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
572
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
573 gtk_container_set_border_width(GTK_CONTAINER(disconnect_window->window), 6);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
574 gtk_window_set_resizable(GTK_WINDOW(disconnect_window->window), FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
575 gtk_dialog_set_has_separator(GTK_DIALOG(disconnect_window->window), FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
576 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(disconnect_window->window)->vbox), 12);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
577 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(disconnect_window->window)->vbox), 6);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
578
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
579 hbox = gtk_hbox_new(FALSE, 12);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
580 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(disconnect_window->window)->vbox), hbox);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
581 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
582 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
583 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
584
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
585 vbox = gtk_vbox_new(FALSE, 12);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
586 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
587
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
588 disconnect_window->label = gtk_label_new(label_text);
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
589
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
590 gtk_label_set_line_wrap(GTK_LABEL(disconnect_window->label), TRUE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
591 gtk_misc_set_alignment(GTK_MISC(disconnect_window->label), 0, 0);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
592 gtk_box_pack_start(GTK_BOX(vbox), disconnect_window->label, FALSE, FALSE, 0);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
593
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
594 disconnect_window->reconnect_btn = gtk_dialog_add_button(
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
595 GTK_DIALOG(disconnect_window->window),
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
596 _("_Reconnect"),
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
597 GTK_RESPONSE_ACCEPT);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
598
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
599 disconnect_window->reconnectall_btn = gtk_dialog_add_button(
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
600 GTK_DIALOG(disconnect_window->window),
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
601 _("Reconnect _All"),
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
602 GTK_RESPONSE_APPLY);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
603
7874
40b37b1e0905 [gaim-migrate @ 8528]
Mark Doliner <mark@kingant.net>
parents: 7808
diff changeset
604 gtk_dialog_add_button(
40b37b1e0905 [gaim-migrate @ 8528]
Mark Doliner <mark@kingant.net>
parents: 7808
diff changeset
605 GTK_DIALOG(disconnect_window->window),
40b37b1e0905 [gaim-migrate @ 8528]
Mark Doliner <mark@kingant.net>
parents: 7808
diff changeset
606 GTK_STOCK_CLOSE,
40b37b1e0905 [gaim-migrate @ 8528]
Mark Doliner <mark@kingant.net>
parents: 7808
diff changeset
607 GTK_RESPONSE_CLOSE);
40b37b1e0905 [gaim-migrate @ 8528]
Mark Doliner <mark@kingant.net>
parents: 7808
diff changeset
608
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
609 gtk_widget_show_all(disconnect_window->window);
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
610
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
611 /* Tree View */
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
612 disconnect_window->sw = gtk_scrolled_window_new(NULL,NULL);
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
613 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(disconnect_window->sw), GTK_SHADOW_IN);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
614 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(disconnect_window->sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
615 gtk_box_pack_start(GTK_BOX(vbox), disconnect_window->sw, TRUE, TRUE, 0);
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
616
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
617 list_store = gtk_list_store_new(5, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
618 disconnect_window->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store));
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
619
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
620 rend = gtk_cell_renderer_pixbuf_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
621 rend2 = gtk_cell_renderer_text_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
622 col = gtk_tree_view_column_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
623 gtk_tree_view_column_set_title(col, _("Account"));
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
624 gtk_tree_view_column_pack_start(col, rend, FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
625 gtk_tree_view_column_pack_start(col, rend2, FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
626 gtk_tree_view_column_set_attributes(col, rend, "pixbuf", 0, NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
627 gtk_tree_view_column_set_attributes(col, rend2, "text", 1, NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
628 gtk_tree_view_append_column (GTK_TREE_VIEW(disconnect_window->treeview), col);
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
629
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
630 rend = gtk_cell_renderer_text_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
631 col = gtk_tree_view_column_new_with_attributes (_("Time"),
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
632 rend, "text", 2, NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
633 gtk_tree_view_append_column (GTK_TREE_VIEW(disconnect_window->treeview), col);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
634
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
635 g_object_unref(G_OBJECT(list_store));
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
636 gtk_container_add(GTK_CONTAINER(disconnect_window->sw), disconnect_window->treeview);
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
637
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
638 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (disconnect_window->treeview));
7409
2ea9bf5686ad [gaim-migrate @ 8009]
Christian Hammond <chipx86@chipx86.com>
parents: 7407
diff changeset
639 gtk_widget_set_size_request(disconnect_window->treeview, -1, 96);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
640 g_signal_connect (G_OBJECT (sel), "changed",
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
641 G_CALLBACK (disconnect_tree_cb), list_store);
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
642
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
643 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
644 disconnect_window, GAIM_CALLBACK(disconnect_connection_change_cb), NULL);
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
645
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
646 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
647 disconnect_window, GAIM_CALLBACK(disconnect_connection_change_cb), NULL);
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
648 } else
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
649 list_store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview)));
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
650
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
651 /* Add this account to our list of disconnected accounts */
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
652 gtk_list_store_append(list_store, &new_iter);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
653 gtk_list_store_set(list_store, &new_iter,
7808
4707d8436806 [gaim-migrate @ 8455]
Sean Egan <seanegan@gmail.com>
parents: 7678
diff changeset
654 0, NULL,
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
655 1, gaim_account_get_username(gaim_connection_get_account(gc)),
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
656 2, gaim_date_full(),
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
657 3, label_text,
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
658 4, gaim_connection_get_account(gc), -1);
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
659
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
660 /* Make sure the newly disconnected account is selected */
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
661 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(disconnect_window->treeview));
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
662 gtk_tree_selection_select_iter(sel, &new_iter);
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
663
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
664 disconnect_window_update_buttons(GTK_TREE_MODEL(list_store));
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
665
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
666 g_free(label_text);
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
667 }
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
668 /*
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
669 * End of disconnected dialog
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
670 */
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
671
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
672 static GaimConnectionUiOps conn_ui_ops =
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
673 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
674 gaim_gtk_connection_connect_progress,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
675 gaim_gtk_connection_connected,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
676 gaim_gtk_connection_disconnected,
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
677 gaim_gtk_connection_notice,
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
678 gaim_gtk_connection_report_disconnect
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
679 };
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
680
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6460
diff changeset
681 GaimConnectionUiOps *
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6460
diff changeset
682 gaim_gtk_connections_get_ui_ops(void)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
683 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
684 return &conn_ui_ops;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
685 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
686
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
687 /*
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
688 * This function needs to be moved out of here once away messages are
7912
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
689 * core/UI split.
4d4438f6ddce [gaim-migrate @ 8573]
Mark Doliner <mark@kingant.net>
parents: 7890
diff changeset
690 */
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
691 void away_on_login(const char *mesg)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
692 {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
693 #if 0 /* XXX CORE/UI */
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
694 GSList *awy = away_messages;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
695 struct away_message *a, *message = NULL;
7098
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
696 GaimGtkBuddyList *gtkblist;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
697
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
698 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
699
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
700 if (!gtkblist->window) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
701 return;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
702 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
703
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
704 if (mesg == NULL)
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
705 mesg = gaim_prefs_get_string("/core/away/default_message");
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
706 while (awy) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
707 a = (struct away_message *)awy->data;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
708 if (strcmp(a->name, mesg) == 0) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
709 message = a;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
710 break;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
711 }
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
712 awy = awy->next;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
713 }
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
714 if (message == NULL) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
715 if(!away_messages)
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
716 return;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
717 message = away_messages->data;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
718 }
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
719 do_away_message(NULL, message);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
720 #endif
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
721 }