annotate src/gtkconn.c @ 7640:99ae80bdffa1

[gaim-migrate @ 8282] Did we say gboolean? Oh, we meant void. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 26 Nov 2003 16:24:33 +0000
parents 6afe28251c85
children 834570cb8d86
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 *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 * 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
8 * the Free Software Foundation; either version 2 of the License, or
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * (at your option) any later version.
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6216
diff changeset
20 #include "gtkinternal.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 #include "account.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
23 #include "debug.h"
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
24 #include "notify.h"
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
25 #include "prefs.h"
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
26 #include "stock.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
27 #include "util.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
29 #include "gtkblist.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
30 #include "gtkutils.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
31
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5746
diff changeset
32 #include "ui.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 struct signon_meter {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 GaimAccount *account;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36 GtkWidget *button;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 GtkWidget *progress;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 GtkWidget *status;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 };
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 struct meter_window {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 GtkWidget *window;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43 GtkWidget *table;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44 gint rows;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 gint active_count;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 GSList *meters;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 } *meter_win = NULL;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
49 static void kill_meter(struct signon_meter *meter, const char *text);
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
50
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 static void cancel_signon(GtkWidget *button, struct signon_meter *meter)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52 {
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
53 if (meter->account->gc != NULL) {
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
54 meter->account->gc->wants_to_die = TRUE;
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
55 gaim_connection_destroy(meter->account->gc);
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
56 }
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
57 else {
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
58 kill_meter(meter, _("Done."));
5987
6e19ad2ef712 [gaim-migrate @ 6435]
Christian Hammond <chipx86@chipx86.com>
parents: 5936
diff changeset
59
5991
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
60 if (gaim_connections_get_all() == NULL) {
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
61 destroy_all_dialogs();
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
62
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
63 gaim_blist_destroy();
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
64
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
65 show_login();
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
66 }
5d5bad909bc4 [gaim-migrate @ 6439]
Christian Hammond <chipx86@chipx86.com>
parents: 5989
diff changeset
67 }
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70 static void cancel_all () {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
71 GSList *m = meter_win ? meter_win->meters : NULL;
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
72 struct signon_meter *meter;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
74 while (m) {
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
75 meter = m->data;
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
76 cancel_signon(NULL, meter);
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
77 m = m->next;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
78 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
79 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
80
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
81 static gint meter_destroy(GtkWidget *window, GdkEvent *evt, struct signon_meter *meter)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
82 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
83 return TRUE;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
84 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
85
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
86 static struct signon_meter *find_signon_meter(GaimConnection *gc)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
87 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 GSList *m = meter_win ? meter_win->meters : NULL;
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
89 struct signon_meter *meter;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91 while (m) {
6114
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
92 meter = m->data;
3c70f8be8558 [gaim-migrate @ 6576]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
93 if (meter->account == gaim_connection_get_account(gc))
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
94 return m->data;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
95 m = m->next;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
96 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
97
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
98 return NULL;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
99 }
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 static GtkWidget* create_meter_pixmap (GaimConnection *gc)
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 GdkPixbuf *pb = create_prpl_icon(gc->account);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
104 GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
105 GtkWidget *image =
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
106 gtk_image_new_from_pixbuf(scale);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
107 g_object_unref(G_OBJECT(pb));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108 g_object_unref(G_OBJECT(scale));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109 return image;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
111
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
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
114 static struct signon_meter *
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
115 new_meter(GaimConnection *gc, GtkWidget *widget,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
116 GtkWidget *table, gint *rows)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
117 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
118 GtkWidget *graphic;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
119 GtkWidget *label;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120 GtkWidget *nest_vbox;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121 GString *name_to_print;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
122 struct signon_meter *meter;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
123
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 meter = g_new0(struct signon_meter, 1);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
126
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
127 meter->account = gaim_connection_get_account(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
128 name_to_print = g_string_new(gaim_account_get_username(meter->account));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
129
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
130 (*rows)++;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
131 gtk_table_resize (GTK_TABLE(table), *rows, 4);
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 graphic = create_meter_pixmap(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
134
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 nest_vbox = gtk_vbox_new (FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
136
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 g_string_prepend(name_to_print, _("Signon: "));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
138 label = gtk_label_new (name_to_print->str);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
139 g_string_free(name_to_print, TRUE);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
140 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
141
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
142 meter->status = gtk_label_new("");
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
143 gtk_misc_set_alignment(GTK_MISC(meter->status), 0, 0.5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
144 gtk_widget_set_size_request(meter->status, 250, -1);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
145
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
146 meter->progress = gtk_progress_bar_new ();
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
147
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
148 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
149 g_signal_connect(G_OBJECT (meter->button), "clicked",
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
150 G_CALLBACK (cancel_signon), meter);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
151
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152 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
153 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
154 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
155 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
156 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
157 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
158
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
159 gtk_widget_show_all (GTK_WIDGET (meter_win->window));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
160
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
161 meter_win->active_count++;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
162
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
163 return meter;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
164 }
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 static void kill_meter(struct signon_meter *meter, const char *text) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
167 gtk_widget_set_sensitive (meter->button, FALSE);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
168 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), 1);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
169 gtk_label_set_text(GTK_LABEL(meter->status), text);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
170 meter_win->active_count--;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
171 if (meter_win->active_count == 0) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
172 gtk_widget_destroy(meter_win->window);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
173 g_free (meter_win);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
174 meter_win = NULL;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
175 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
176 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
177
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
178 static void gaim_gtk_connection_connect_progress(GaimConnection *gc,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
179 const char *text, size_t step, size_t step_count)
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 struct signon_meter *meter;
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 if(!meter_win) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
184 GtkWidget *vbox;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
185 GtkWidget *cancel_button;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
186
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
187 if(mainwindow)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
188 gtk_widget_hide(mainwindow);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
189
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
190 meter_win = g_new0(struct meter_window, 1);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
191 meter_win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
192 gtk_window_set_resizable(GTK_WINDOW(meter_win->window), FALSE);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
193 gtk_window_set_role(GTK_WINDOW(meter_win->window), "signon");
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
194 gtk_container_set_border_width(GTK_CONTAINER(meter_win->window), 5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
195 gtk_window_set_title(GTK_WINDOW(meter_win->window), _("Signon"));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
196 gtk_widget_realize(meter_win->window);
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 vbox = gtk_vbox_new (FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
199 gtk_container_add(GTK_CONTAINER(meter_win->window), vbox);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
200
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
201 meter_win->table = gtk_table_new(1, 4, FALSE);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
202 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(meter_win->table),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 FALSE, FALSE, 0);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 gtk_container_set_border_width(GTK_CONTAINER(meter_win->table), 5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205 gtk_table_set_row_spacings(GTK_TABLE(meter_win->table), 5);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206 gtk_table_set_col_spacings(GTK_TABLE(meter_win->table), 10);
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 cancel_button = gaim_pixbuf_button_from_stock(_("Cancel All"),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209 GTK_STOCK_QUIT, GAIM_BUTTON_HORIZONTAL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
210 g_signal_connect_swapped(G_OBJECT(cancel_button), "clicked",
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
211 G_CALLBACK(cancel_all), NULL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(cancel_button),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213 FALSE, FALSE, 0);
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 g_signal_connect(G_OBJECT(meter_win->window), "delete_event",
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 G_CALLBACK(meter_destroy), NULL);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 meter = find_signon_meter(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220 if(!meter) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221 meter = new_meter(gc, meter_win->window, meter_win->table,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 &meter_win->rows);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224 meter_win->meters = g_slist_append(meter_win->meters, meter);
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
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress),
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 (float)step / (float)step_count);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229 gtk_label_set_text(GTK_LABEL(meter->status), text);
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
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
232 static void gaim_gtk_connection_connected(GaimConnection *gc)
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 struct signon_meter *meter = find_signon_meter(gc);
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
235
5885
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
236 gaim_setup(gc);
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
237
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
238 do_away_menu();
5936
1b56a833d665 [gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents: 5885
diff changeset
239 gaim_gtk_blist_update_protocol_actions();
5885
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
240
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241 if(meter)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
242 kill_meter(meter, _("Done."));
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
243 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
245 static void gaim_gtk_connection_disconnected(GaimConnection *gc)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
246 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
247 struct signon_meter *meter = find_signon_meter(gc);
5883
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
248
5885
02569519d0cc [gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents: 5883
diff changeset
249 do_away_menu();
5936
1b56a833d665 [gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents: 5885
diff changeset
250 gaim_gtk_blist_update_protocol_actions();
5883
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
251
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
252 if(meter)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
253 kill_meter(meter, _("Done."));
5883
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
254
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
255 if (gaim_connections_get_all() != NULL)
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
256 return;
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
257
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
258 destroy_all_dialogs();
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
259
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
260 gaim_blist_destroy();
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
261
f5b0c6073264 [gaim-migrate @ 6315]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
262 show_login();
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265 static void gaim_gtk_connection_notice(GaimConnection *gc,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266 const char *text)
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
267 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
268 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
269
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
270 struct disconnect_window {
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
271 GtkWidget *window;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
272 GtkWidget *treeview;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
273 GtkWidget *sw;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
274 GtkWidget *label;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
275 };
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
276 struct disconnect_window *disconnect_window = NULL;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
277
7493
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
278 static void disconnect_window_hide()
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
279 {
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
280 gtk_widget_destroy(disconnect_window->window);
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
281 g_free(disconnect_window);
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
282 disconnect_window = NULL;
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
283 }
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
284
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
285 static void disconnect_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget)
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
286 {
7483
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
287 GtkTreeIter iter;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
288 GValue val = { 0, };
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
289 GtkTreeSelection *sel = NULL;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
290 GtkTreeModel *model = NULL;
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7409
diff changeset
291 GaimAccount *account = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7409
diff changeset
292
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
293 switch(id) {
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
294 case GTK_RESPONSE_DELETE_EVENT:
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
295 case GTK_RESPONSE_CLOSE:
7493
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
296 disconnect_window_hide();
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
297 break;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
298 case GTK_RESPONSE_ACCEPT:
7483
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
299 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
300 /*
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
301 * If we have more than one account disconnection displayed, then
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
302 * the scroll window is visible and we should use the selected
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
303 * account to reconnect.
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
304 */
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
305 if (GTK_WIDGET_VISIBLE(disconnect_window->sw)) {
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
306 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
307 if (!gtk_tree_selection_get_selected(sel, &model, &iter))
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
308 return;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
309 } else {
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
310 /* There is only one account disconnection, so reconnect to it. */
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
311 if (!gtk_tree_model_get_iter_first(model, &iter))
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
312 return;
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
313 }
7493
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
314 gtk_tree_model_get_value(model, &iter, 4, &val);
7483
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
315 account = g_value_get_pointer(&val);
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
316 g_value_unset(&val);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
317 gaim_account_connect(account);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
318 /* remove all disconnections of the account reconnected */
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
319 if (gtk_tree_model_get_iter_first(model, &iter)) {
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
320 GaimAccount *account2 = NULL;
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
321 gboolean alreadyIterated = FALSE;
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
322 do {
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
323 alreadyIterated = FALSE;
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
324 gtk_tree_model_get_value(model, &iter, 4, &val);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
325 account2 = g_value_get_pointer(&val);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
326 g_value_unset(&val);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
327 if (account2 == account) {
7640
99ae80bdffa1 [gaim-migrate @ 8282]
Ethan Blanton <elb@pidgin.im>
parents: 7637
diff changeset
328 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
329 alreadyIterated = TRUE;
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
330 }
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
331 g_value_unset(&val);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
332 } while (alreadyIterated || gtk_tree_model_iter_next(model, &iter));
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
333 }
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
334
7552
83453431d722 [gaim-migrate @ 8166]
Mark Doliner <mark@kingant.net>
parents: 7506
diff changeset
335 if (!gtk_tree_model_get_iter_first(model, &iter))
83453431d722 [gaim-migrate @ 8166]
Mark Doliner <mark@kingant.net>
parents: 7506
diff changeset
336 disconnect_window_hide();
83453431d722 [gaim-migrate @ 8166]
Mark Doliner <mark@kingant.net>
parents: 7506
diff changeset
337 else {
83453431d722 [gaim-migrate @ 8166]
Mark Doliner <mark@kingant.net>
parents: 7506
diff changeset
338 gtk_tree_selection_select_iter(sel, &iter);
83453431d722 [gaim-migrate @ 8166]
Mark Doliner <mark@kingant.net>
parents: 7506
diff changeset
339 if (!gtk_tree_model_iter_next(model, &iter))
83453431d722 [gaim-migrate @ 8166]
Mark Doliner <mark@kingant.net>
parents: 7506
diff changeset
340 gtk_widget_hide_all(disconnect_window->sw);
7493
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
341 }
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
342 break;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
343 }
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
344 }
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
345
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
346 static void disconnect_tree_cb(GtkTreeSelection *sel, GtkTreeModel *model)
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
347 {
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
348 GtkTreeIter iter;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
349 GValue val = { 0, };
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
350 const char *label_text;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
351
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
352 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) {
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
353 gtk_dialog_set_response_sensitive(GTK_DIALOG(disconnect_window->window), GTK_RESPONSE_ACCEPT, FALSE);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
354 return;
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
355 } else
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
356 gtk_dialog_set_response_sensitive(GTK_DIALOG(disconnect_window->window), GTK_RESPONSE_ACCEPT, TRUE);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
357 gtk_tree_model_get_value (model, &iter, 3, &val);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
358 label_text = g_value_get_string(&val);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
359 gtk_label_set_markup(GTK_LABEL(disconnect_window->label), label_text);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
360 g_value_unset(&val);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
361 }
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
362
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
363 static void disconnect_signed_on_cb(GaimConnection *gc, void *data)
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
364 {
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
365 if (disconnect_window) {
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
366 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
367 GaimAccount *account = gaim_connection_get_account(gc);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
368 GdkPixbuf *icon = create_prpl_icon(account);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
369 GdkPixbuf *scale = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR);
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
370 GtkTreeIter iter;
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
371 if (gtk_tree_model_get_iter_first(model, &iter)) {
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
372 GaimAccount *account2 = NULL;
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
373 do {
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
374 GValue val = { 0, };
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
375 gtk_tree_model_get_value(model, &iter, 4, &val);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
376 account2 = g_value_get_pointer(&val);
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
377 g_value_unset(&val);
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
378 if (account2 == account) {
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
379 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, scale, -1);
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
380 }
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
381 } while (gtk_tree_model_iter_next(model, &iter));
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
382 }
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
383 if (icon != NULL) g_object_unref(G_OBJECT(icon));
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
384 if (scale != NULL) g_object_unref(G_OBJECT(scale));
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
385 }
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
386 }
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
387
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
388 static void
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
389 gaim_gtk_connection_report_disconnect(GaimConnection *gc, const char *text)
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
390 {
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
391 char *label_text = NULL;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
392 GdkPixbuf *scale, *icon;
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
393 GtkTreeIter new_row_iter, iter;
7483
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
394 GValue val = { 0, };
4a416ff9cb4f [gaim-migrate @ 8096]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
395 GaimAccount *account = NULL;
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
396 GtkListStore *list_store;
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
397 GtkTreeViewColumn *col;
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
398 GtkTreeSelection *sel = NULL;
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
399
7409
2ea9bf5686ad [gaim-migrate @ 8009]
Christian Hammond <chipx86@chipx86.com>
parents: 7407
diff changeset
400 label_text = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s has been disconnected.</span>\n\n%s\n%s",
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
401 gaim_account_get_username(gaim_connection_get_account(gc)), gaim_date_full(),
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
402 text ? text : _("Reason Unknown."));
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
403
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
404 /* Build the window if it isn't there yet */
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
405 if (!disconnect_window) {
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
406 GtkWidget *hbox, *vbox, *img;
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
407 GtkCellRenderer *rend, *rend2;
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
408
7407
0c0bde5a3959 [gaim-migrate @ 8007]
Nathan Walp <nwalp@pidgin.im>
parents: 7399
diff changeset
409 disconnect_window = g_new0(struct disconnect_window, 1);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
410 disconnect_window->window = gtk_dialog_new_with_buttons("", NULL, GTK_DIALOG_NO_SEPARATOR,
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
411 _("Reconnect"), GTK_RESPONSE_ACCEPT,
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
412 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
413 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
414
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
415 gtk_container_set_border_width(GTK_CONTAINER(disconnect_window->window), 6);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
416 gtk_window_set_resizable(GTK_WINDOW(disconnect_window->window), FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
417 gtk_dialog_set_has_separator(GTK_DIALOG(disconnect_window->window), FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
418 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
419 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
420
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
421 hbox = gtk_hbox_new(FALSE, 12);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
422 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
423 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
424 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
425 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
426
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
427 vbox = gtk_vbox_new(FALSE, 12);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
428 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
429
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
430 disconnect_window->label = gtk_label_new(label_text);
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
431
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
432 gtk_label_set_line_wrap(GTK_LABEL(disconnect_window->label), TRUE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
433 gtk_misc_set_alignment(GTK_MISC(disconnect_window->label), 0, 0);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
434 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
435
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
436 gtk_widget_show_all(disconnect_window->window);
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
437
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
438 /* Tree View */
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
439 disconnect_window->sw = gtk_scrolled_window_new(NULL,NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
440 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(disconnect_window->sw), GTK_SHADOW_IN);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
441 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(disconnect_window->sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
442 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
443
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
444 list_store = gtk_list_store_new (5, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
445 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
446
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
447 rend = gtk_cell_renderer_pixbuf_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
448 rend2 = gtk_cell_renderer_text_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
449 col = gtk_tree_view_column_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
450 gtk_tree_view_column_set_title(col, _("Account"));
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
451 gtk_tree_view_column_pack_start(col, rend, FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
452 gtk_tree_view_column_pack_start(col, rend2, FALSE);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
453 gtk_tree_view_column_set_attributes(col, rend, "pixbuf", 0, NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
454 gtk_tree_view_column_set_attributes(col, rend2, "text", 1, NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
455 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
456
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
457 rend = gtk_cell_renderer_text_new();
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
458 col = gtk_tree_view_column_new_with_attributes (_("Time"),
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
459 rend, "text", 2, NULL);
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
460 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
461
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
462 g_object_unref(G_OBJECT(list_store));
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
463 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
464
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
465 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
466 gtk_widget_set_size_request(disconnect_window->treeview, -1, 96);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
467 g_signal_connect (G_OBJECT (sel), "changed",
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
468 G_CALLBACK (disconnect_tree_cb), list_store);
7625
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
469
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
470 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
471 disconnect_window, GAIM_CALLBACK(disconnect_signed_on_cb), NULL);
1ffe44bb2573 [gaim-migrate @ 8249]
Luke Schierer <lschiere@pidgin.im>
parents: 7552
diff changeset
472
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
473 } else
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
474 list_store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview)));
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
475 /* mark all disconnections w/ the account type disconnected /w grey icon */
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
476 icon = create_prpl_icon(gaim_connection_get_account(gc));
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
477 scale = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR);
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
478 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
479 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list_store), &iter)) {
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
480 do {
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
481 gtk_tree_model_get_value(GTK_TREE_MODEL(list_store), &iter, 4, &val);
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
482 account = g_value_get_pointer(&val);
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
483 g_value_unset(&val);
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
484 if (account == gaim_connection_get_account(gc)) {
7637
6afe28251c85 [gaim-migrate @ 8279]
Sean Egan <seanegan@gmail.com>
parents: 7625
diff changeset
485 gtk_list_store_set(list_store, &iter, 0, scale, -1);
7506
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
486 }
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
487 } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(list_store), &iter));
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
488 }
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
489
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
490 /* Add this account to our list of disconnected accounts */
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
491 gtk_list_store_append(list_store, &new_row_iter);
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
492 gtk_list_store_set(list_store, &new_row_iter,
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
493 0, scale,
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
494 1, gaim_account_get_username(gaim_connection_get_account(gc)),
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
495 2, gaim_date_full(),
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
496 3, label_text,
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
497 4, gaim_connection_get_account(gc), -1);
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
498 g_object_unref(G_OBJECT(icon));
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
499 g_object_unref(G_OBJECT(scale));
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
500
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
501 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list_store), &iter))
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
502 {
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
503 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(disconnect_window->treeview));
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
504 gtk_tree_selection_select_iter(sel, &new_row_iter);
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
505 /* if we have more than one disconnected acct, display the treeview */
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
506 if (gtk_tree_model_iter_next(GTK_TREE_MODEL(list_store), &iter))
240aca6344b6 [gaim-migrate @ 8119]
Mark Doliner <mark@kingant.net>
parents: 7496
diff changeset
507 gtk_widget_show_all(disconnect_window->sw);
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
508 }
7496
39185ff57842 [gaim-migrate @ 8109]
Mark Doliner <mark@kingant.net>
parents: 7493
diff changeset
509
7399
9ab1987e5d8b [gaim-migrate @ 7995]
Sean Egan <seanegan@gmail.com>
parents: 7108
diff changeset
510 g_free(label_text);
7493
6b9f452e84e1 [gaim-migrate @ 8106]
Mark Doliner <mark@kingant.net>
parents: 7483
diff changeset
511 gtk_window_present(GTK_WINDOW(disconnect_window->window));
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
512 }
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
513
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
514 static GaimConnectionUiOps conn_ui_ops =
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
515 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
516 gaim_gtk_connection_connect_progress,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
517 gaim_gtk_connection_connected,
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
518 gaim_gtk_connection_disconnected,
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
519 gaim_gtk_connection_notice,
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
520 gaim_gtk_connection_report_disconnect
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
521 };
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
522
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6460
diff changeset
523 GaimConnectionUiOps *
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6460
diff changeset
524 gaim_gtk_connections_get_ui_ops(void)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
525 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
526 return &conn_ui_ops;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
527 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
528
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
529 void away_on_login(const char *mesg)
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
530 {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
531 GSList *awy = away_messages;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
532 struct away_message *a, *message = NULL;
7098
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
533 GaimGtkBuddyList *gtkblist;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
534
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
535 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
536
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
537 if (!gtkblist->window) {
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
538 return;
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
539 }
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
540
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
541 if (mesg == NULL)
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
542 mesg = gaim_prefs_get_string("/core/away/default_message");
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
543 while (awy) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
544 a = (struct away_message *)awy->data;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
545 if (strcmp(a->name, mesg) == 0) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
546 message = a;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
547 break;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
548 }
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
549 awy = awy->next;
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
550 }
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
551 if (message == NULL) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
552 if(!away_messages)
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
553 return;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
554 message = away_messages->data;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
555 }
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 6114
diff changeset
556 do_away_message(NULL, message);
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
557 }