Mercurial > pidgin.yaz
annotate src/multi.c @ 6030:54c37db13279
[gaim-migrate @ 6480]
How did I not commit the Send As menu fix?
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 05 Jul 2003 08:00:53 +0000 |
parents | e2f2d8857f9f |
children |
rev | line source |
---|---|
960 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
4634 | 22 #include <stdlib.h> |
2100
a93aeb6f813d
[gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
23 #include <string.h> |
3067 | 24 #include <ctype.h> |
960 | 25 #include <gtk/gtk.h> |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
26 #include "prpl.h" |
960 | 27 #include "multi.h" |
28 #include "gaim.h" | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
29 #include "conversation.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5413
diff
changeset
|
30 #include "notify.h" |
5228
1a53330dfd34
[gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
31 #include "gtkblist.h" |
4962 | 32 #include "gaim-disclosure.h" |
960 | 33 |
4493
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
34 #ifdef _WIN32 |
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
35 #include "win32dep.h" |
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
36 #endif |
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
37 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
38 #define LOGIN_STEPS 5 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
39 |
3754 | 40 enum |
41 { | |
42 COLUMN_SCREENNAME, | |
43 COLUMN_ONLINE, | |
44 COLUMN_AUTOLOGIN, | |
45 COLUMN_PROTOCOL, | |
46 COLUMN_DATA, | |
47 NUM_COLUMNS | |
48 }; | |
49 | |
3060 | 50 struct meter_window { |
51 GtkWidget *window; | |
52 GtkTable *table; | |
53 gint rows; | |
54 gint active_count; | |
55 } *meter_win = NULL; | |
56 | |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
57 struct signon_meter { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
58 GaimConnection *gc; |
3060 | 59 GtkWidget *button; |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
60 GtkWidget *progress; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
61 GtkWidget *status; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
62 }; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
63 static GSList *meters = NULL; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
64 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
65 GtkWidget* create_meter_pixmap (GaimConnection *gc) |
3060 | 66 { |
4687 | 67 GdkPixbuf *pb = create_prpl_icon(gc->account); |
68 GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR); | |
69 GtkWidget *image = | |
70 gtk_image_new_from_pixbuf(scale); | |
71 g_object_unref(G_OBJECT(pb)); | |
72 g_object_unref(G_OBJECT(scale)); | |
73 return image; | |
3060 | 74 } |
75 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
76 static struct signon_meter *find_signon_meter(GaimConnection *gc) |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
77 { |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
78 GSList *m = meters; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
79 while (m) { |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
80 if (((struct signon_meter *)m->data)->gc == gc) |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
81 return m->data; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
82 m = m->next; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
83 } |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
84 return NULL; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
85 } |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
86 |
3060 | 87 void kill_meter(struct signon_meter *meter) { |
88 gtk_widget_set_sensitive (meter->button, FALSE); | |
4275 | 89 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), 1); |
3060 | 90 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1); |
4169 | 91 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, _("Done.")); |
3060 | 92 meter_win->active_count--; |
93 if (meter_win->active_count == 0) { | |
94 gtk_widget_destroy(meter_win->window); | |
95 g_free (meter_win); | |
96 meter_win = NULL; | |
3554 | 97 } |
3060 | 98 } |
99 | |
4890
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
100 void away_on_login(char *mesg) |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
101 { |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
102 GSList *awy = away_messages; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
103 struct away_message *a, *message = NULL; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
104 struct gaim_gtk_buddy_list *gtkblist; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
105 |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
106 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
107 |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
108 if (!gtkblist->window) { |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
109 return; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
110 } |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
111 |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
112 if (mesg == NULL) { |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
113 /* Use default message */ |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
114 do_away_message(NULL, default_away); |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
115 } else { |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
116 /* Use argument */ |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
117 while (awy) { |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
118 a = (struct away_message *)awy->data; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
119 if (strcmp(a->name, mesg) == 0) { |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
120 message = a; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
121 break; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
122 } |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
123 awy = awy->next; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
124 } |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
125 if (message == NULL) |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
126 message = default_away; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
127 do_away_message(NULL, message); |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
128 } |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
129 return; |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
130 } |
89cb14edf8cf
[gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
4856
diff
changeset
|
131 |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
132 static void cancel_signon(GtkWidget *button, struct signon_meter *meter) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
133 { |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
134 meter->gc->wants_to_die = TRUE; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
135 gaim_connection_destroy(meter->gc); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
136 } |
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
137 |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
138 static gint meter_destroy(GtkWidget *window, GdkEvent *evt, struct signon_meter *meter) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
139 { |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
140 return TRUE; |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
141 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
142 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
143 static struct signon_meter * |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
144 register_meter(GaimConnection *gc, GtkWidget *widget, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
145 GtkTable *table, gint *rows) |
3060 | 146 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
147 GaimAccount *account; |
3060 | 148 GtkWidget *graphic; |
3378 | 149 GtkWidget *label; |
3060 | 150 GtkWidget *nest_vbox; |
151 GString *name_to_print; | |
152 struct signon_meter *meter; | |
4491 | 153 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
154 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
155 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
156 name_to_print = g_string_new(gaim_account_get_username(account)); |
4491 | 157 |
3060 | 158 meter = g_new0(struct signon_meter, 1); |
4491 | 159 |
3060 | 160 (*rows)++; |
161 gtk_table_resize (table, *rows, 4); | |
4491 | 162 |
4687 | 163 graphic = create_meter_pixmap(gc); |
4491 | 164 |
3060 | 165 nest_vbox = gtk_vbox_new (FALSE, 0); |
4491 | 166 |
4225 | 167 g_string_prepend(name_to_print, _("Signon: ")); |
3378 | 168 label = gtk_label_new (name_to_print->str); |
4225 | 169 g_string_free(name_to_print, TRUE); |
3378 | 170 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); |
4491 | 171 |
3060 | 172 meter->status = gtk_statusbar_new(); |
4639 | 173 gtk_widget_set_size_request(meter->status, 250, -1); |
4491 | 174 |
3060 | 175 meter->progress = gtk_progress_bar_new (); |
4491 | 176 |
5024 | 177 meter->button = gaim_pixbuf_button_from_stock (_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
178 g_signal_connect(G_OBJECT (meter->button), "clicked", |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
179 G_CALLBACK (cancel_signon), meter); |
4491 | 180 |
3060 | 181 gtk_table_attach (GTK_TABLE (table), graphic, 0, 1, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); |
182 gtk_table_attach (GTK_TABLE (table), nest_vbox, 1, 2, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); | |
3378 | 183 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (label), FALSE, FALSE, 0); |
3060 | 184 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (meter->status), FALSE, FALSE, 0); |
185 gtk_table_attach (GTK_TABLE (table), meter->progress, 2, 3, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); | |
186 gtk_table_attach (GTK_TABLE (table), meter->button, 3, 4, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); | |
187 | |
188 gtk_widget_show_all (GTK_WIDGET (meter_win->window)); | |
4491 | 189 |
3060 | 190 meter_win->active_count++; |
4491 | 191 |
3060 | 192 return meter; |
193 } | |
194 | |
195 static void loop_cancel () { | |
196 GSList *m = meters; | |
197 struct signon_meter *meter = NULL; | |
198 | |
199 while (m) { | |
200 meter = (struct signon_meter *) (m->data); | |
201 meter->gc->wants_to_die = TRUE; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
202 gaim_connection_destroy((GaimConnection *) meter->gc); |
3060 | 203 m = meters; |
204 } | |
205 } | |
206 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
207 void set_login_progress(GaimConnection *gc, float howfar, char *message) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
208 { |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
209 struct signon_meter *meter = find_signon_meter(gc); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
210 |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
211 if (mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
212 gtk_widget_hide(mainwindow); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
213 |
3060 | 214 if (!meter_win) { |
215 GtkWidget *cancel_button; | |
216 GtkWidget *vbox; | |
4635 | 217 |
3060 | 218 meter_win = g_new0(struct meter_window, 1); |
219 meter_win->rows=0; | |
4635 | 220 |
3060 | 221 meter_win->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
4635 | 222 gtk_window_set_resizable(GTK_WINDOW(meter_win->window), FALSE); |
4074 | 223 gtk_window_set_role(GTK_WINDOW(meter_win->window), "signon"); |
3060 | 224 gtk_container_set_border_width(GTK_CONTAINER(meter_win->window), 5); |
4703 | 225 gtk_window_set_title (GTK_WINDOW (meter_win->window), _("Signon")); |
3060 | 226 gtk_widget_realize(meter_win->window); |
4635 | 227 |
3060 | 228 vbox = gtk_vbox_new (FALSE, 0); |
229 gtk_container_add (GTK_CONTAINER (meter_win->window), GTK_WIDGET (vbox)); | |
230 | |
231 meter_win->table = (GtkTable *) gtk_table_new (1 , 4, FALSE); | |
232 gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (meter_win->table), FALSE, FALSE, 0); | |
233 gtk_container_set_border_width (GTK_CONTAINER (meter_win->table), 5); | |
234 gtk_table_set_row_spacings (GTK_TABLE (meter_win->table), 5); | |
235 gtk_table_set_col_spacings (GTK_TABLE (meter_win->table), 10); | |
236 | |
5024 | 237 cancel_button = gaim_pixbuf_button_from_stock (_("Cancel All"), GTK_STOCK_QUIT, GAIM_BUTTON_HORIZONTAL); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
238 g_signal_connect_swapped(G_OBJECT(cancel_button), "clicked", |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
239 G_CALLBACK (loop_cancel), NULL); |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
240 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(cancel_button), FALSE, FALSE, 0); |
3060 | 241 |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
242 g_signal_connect(G_OBJECT(meter_win->window), "delete_event", |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
243 G_CALLBACK(meter_destroy), NULL); |
4987 | 244 } |
3060 | 245 |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
246 if (!meter) { |
3060 | 247 meter = register_meter(gc, GTK_WIDGET (meter_win->window), GTK_TABLE (meter_win->table), (gint *) &meter_win->rows); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
248 meter->gc = gc; |
2403
8555e48c02df
[gaim-migrate @ 2416]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2402
diff
changeset
|
249 meters = g_slist_append(meters, meter); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
250 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
251 |
4275 | 252 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), howfar / LOGIN_STEPS); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
253 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
254 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, message); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
255 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
256 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
257 struct kick_dlg { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
258 GaimAccount *account; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
259 GtkWidget *dlg; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
260 }; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
261 static GSList *kicks = NULL; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
262 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
263 static struct kick_dlg *find_kick_dlg(GaimAccount *account) |
1817
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
264 { |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
265 GSList *k = kicks; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
266 while (k) { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
267 struct kick_dlg *d = k->data; |
4491 | 268 if (d->account == account) |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
269 return d; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
270 k = k->next; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
271 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
272 return NULL; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
273 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
274 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5413
diff
changeset
|
275 static void set_kick_null(struct kick_dlg *k) |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
276 { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
277 kicks = g_slist_remove(kicks, k); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
278 g_free(k); |
1817
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
279 } |
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
280 |
2956 | 281 /* |
282 * Common code for hide_login_progress(), and hide_login_progress_info() | |
283 */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
284 static void hide_login_progress_common(GaimConnection *gc, |
2956 | 285 char *details, |
286 char *title, | |
287 char *prologue) | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
288 { |
4617 | 289 gchar *buf; |
4491 | 290 struct kick_dlg *k = find_kick_dlg(gc->account); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
291 struct signon_meter *meter = find_signon_meter(gc); |
4617 | 292 buf = g_strdup_printf(_("%s\n%s: %s"), full_date(), prologue, details); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
293 if (k) |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
294 gtk_widget_destroy(k->dlg); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
295 k = g_new0(struct kick_dlg, 1); |
4491 | 296 k->account = gc->account; |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5413
diff
changeset
|
297 k->dlg = gaim_notify_message(NULL, GAIM_NOTIFY_MSG_ERROR, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5413
diff
changeset
|
298 title, buf, G_CALLBACK(set_kick_null), k); |
2709
df0832a9ccec
[gaim-migrate @ 2722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2707
diff
changeset
|
299 kicks = g_slist_append(kicks, k); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
300 if (meter) { |
3060 | 301 kill_meter(meter); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
302 meters = g_slist_remove(meters, meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
303 g_free(meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
304 } |
4617 | 305 g_free(buf); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
306 } |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
307 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
308 void hide_login_progress(GaimConnection *gc, char *why) |
2956 | 309 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
310 GaimAccount *account = gaim_connection_get_account(gc); |
4617 | 311 gchar *buf; |
2956 | 312 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5068
diff
changeset
|
313 gaim_event_broadcast(event_error, gc, why); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
314 buf = g_strdup_printf(_("%s was unable to sign on"), |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
315 gaim_account_get_username(account)); |
2956 | 316 hide_login_progress_common(gc, why, _("Signon Error"), buf); |
4617 | 317 g_free(buf); |
2956 | 318 } |
319 | |
320 /* | |
321 * Like hide_login_progress(), but for informational, not error/warning, | |
322 * messages. | |
323 * | |
324 */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
325 void hide_login_progress_notice(GaimConnection *gc, char *why) |
2956 | 326 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
327 GaimAccount *account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
328 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
329 hide_login_progress_common(gc, why, _("Notice"), |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
330 (char *)gaim_account_get_username(account)); |
2956 | 331 } |
332 | |
3074 | 333 /* |
334 * Like hide_login_progress(), but for non-signon error messages. | |
335 * | |
336 */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
337 void hide_login_progress_error(GaimConnection *gc, char *why) |
3074 | 338 { |
339 char buf[2048]; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
340 GaimAccount *account = gaim_connection_get_account(gc); |
4617 | 341 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5068
diff
changeset
|
342 gaim_event_broadcast(event_error, gc, why); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
343 g_snprintf(buf, sizeof(buf), _("%s has been signed off"), |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
344 gaim_account_get_username(account)); |
3074 | 345 hide_login_progress_common(gc, why, _("Connection Error"), buf); |
346 } | |
347 |