annotate src/multi.c @ 5697:fc659d75fcf7

[gaim-migrate @ 6118] Several fixes. Checks for empty strings, and the buddy icon gets set now. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 03 Jun 2003 09:03:40 +0000
parents e2f2d8857f9f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * (at your option) any later version.
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * GNU General Public License for more details.
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
22 #include <stdlib.h>
2100
a93aeb6f813d [gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
23 #include <string.h>
3067
b695cbbeee2d [gaim-migrate @ 3081]
Sean Egan <seanegan@gmail.com>
parents: 3066
diff changeset
24 #include <ctype.h>
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 #include <gtk/gtk.h>
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
26 #include "prpl.h"
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 #include "multi.h"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
32 #include "gaim-disclosure.h"
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
40 enum
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
41 {
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
42 COLUMN_SCREENNAME,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
43 COLUMN_ONLINE,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
44 COLUMN_AUTOLOGIN,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
45 COLUMN_PROTOCOL,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
46 COLUMN_DATA,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
47 NUM_COLUMNS
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
48 };
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
49
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
50 struct meter_window {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
51 GtkWidget *window;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
52 GtkTable *table;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
53 gint rows;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
54 gint active_count;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
55 } *meter_win = NULL;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
66 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
67 GdkPixbuf *pb = create_prpl_icon(gc->account);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
68 GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
69 GtkWidget *image =
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
70 gtk_image_new_from_pixbuf(scale);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
71 g_object_unref(G_OBJECT(pb));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
72 g_object_unref(G_OBJECT(scale));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
73 return image;
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
74 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
87 void kill_meter(struct signon_meter *meter) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
88 gtk_widget_set_sensitive (meter->button, FALSE);
4275
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
89 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), 1);
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
90 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1);
4169
40d35a98f481 [gaim-migrate @ 4398]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
91 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, _("Done."));
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
92 meter_win->active_count--;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
93 if (meter_win->active_count == 0) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
94 gtk_widget_destroy(meter_win->window);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
95 g_free (meter_win);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
96 meter_win = NULL;
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3517
diff changeset
97 }
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
98 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
146 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
147 GaimAccount *account;
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
148 GtkWidget *graphic;
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
149 GtkWidget *label;
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
150 GtkWidget *nest_vbox;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
151 GString *name_to_print;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
152 struct signon_meter *meter;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
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
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
157
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
158 meter = g_new0(struct signon_meter, 1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
159
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
160 (*rows)++;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
161 gtk_table_resize (table, *rows, 4);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
162
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
163 graphic = create_meter_pixmap(gc);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
164
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
165 nest_vbox = gtk_vbox_new (FALSE, 0);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
166
4225
76ea459c8b5b [gaim-migrate @ 4469]
Luke Schierer <lschiere@pidgin.im>
parents: 4169
diff changeset
167 g_string_prepend(name_to_print, _("Signon: "));
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
168 label = gtk_label_new (name_to_print->str);
4225
76ea459c8b5b [gaim-migrate @ 4469]
Luke Schierer <lschiere@pidgin.im>
parents: 4169
diff changeset
169 g_string_free(name_to_print, TRUE);
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
170 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
171
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
172 meter->status = gtk_statusbar_new();
4639
2c9f1ac20b36 [gaim-migrate @ 4947]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
173 gtk_widget_set_size_request(meter->status, 250, -1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
174
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
175 meter->progress = gtk_progress_bar_new ();
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
176
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4998
diff changeset
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
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
180
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
181 gtk_table_attach (GTK_TABLE (table), graphic, 0, 1, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
182 gtk_table_attach (GTK_TABLE (table), nest_vbox, 1, 2, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
183 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (label), FALSE, FALSE, 0);
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
184 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (meter->status), FALSE, FALSE, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
185 gtk_table_attach (GTK_TABLE (table), meter->progress, 2, 3, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
186 gtk_table_attach (GTK_TABLE (table), meter->button, 3, 4, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
187
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
188 gtk_widget_show_all (GTK_WIDGET (meter_win->window));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
189
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
190 meter_win->active_count++;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
191
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
192 return meter;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
193 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
194
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
195 static void loop_cancel () {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
196 GSList *m = meters;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
197 struct signon_meter *meter = NULL;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
198
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
199 while (m) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
200 meter = (struct signon_meter *) (m->data);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
203 m = meters;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
204 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
205 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
214 if (!meter_win) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
215 GtkWidget *cancel_button;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
216 GtkWidget *vbox;
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
217
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
218 meter_win = g_new0(struct meter_window, 1);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
219 meter_win->rows=0;
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
220
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
221 meter_win->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
222 gtk_window_set_resizable(GTK_WINDOW(meter_win->window), FALSE);
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 4040
diff changeset
223 gtk_window_set_role(GTK_WINDOW(meter_win->window), "signon");
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
224 gtk_container_set_border_width(GTK_CONTAINER(meter_win->window), 5);
4703
e4dda06a3143 [gaim-migrate @ 5014]
Sean Egan <seanegan@gmail.com>
parents: 4695
diff changeset
225 gtk_window_set_title (GTK_WINDOW (meter_win->window), _("Signon"));
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
226 gtk_widget_realize(meter_win->window);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
227
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
228 vbox = gtk_vbox_new (FALSE, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
229 gtk_container_add (GTK_CONTAINER (meter_win->window), GTK_WIDGET (vbox));
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
230
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
231 meter_win->table = (GtkTable *) gtk_table_new (1 , 4, FALSE);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
232 gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (meter_win->table), FALSE, FALSE, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
233 gtk_container_set_border_width (GTK_CONTAINER (meter_win->table), 5);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
234 gtk_table_set_row_spacings (GTK_TABLE (meter_win->table), 5);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
235 gtk_table_set_col_spacings (GTK_TABLE (meter_win->table), 10);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
236
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4998
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
1f92610b0772 [gaim-migrate @ 5322]
Mark Doliner <mark@kingant.net>
parents: 4966
diff changeset
244 }
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
245
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
246 if (!meter) {
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
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
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
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
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
281 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
282 * Common code for hide_login_progress(), and hide_login_progress_info()
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
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
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
285 char *details,
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
286 char *title,
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
287 char *prologue)
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
288 {
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
289 gchar *buf;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
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
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
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
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
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
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
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
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
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
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
309 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
310 GaimAccount *account = gaim_connection_get_account(gc);
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
311 gchar *buf;
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
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
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
316 hide_login_progress_common(gc, why, _("Signon Error"), buf);
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
317 g_free(buf);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
318 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
319
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
320 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
321 * Like hide_login_progress(), but for informational, not error/warning,
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
322 * messages.
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
323 *
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
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
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
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
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
331 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
332
3074
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
333 /*
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
334 * Like hide_login_progress(), but for non-signon error messages.
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
335 *
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
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
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
338 {
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
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
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
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
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
345 hide_login_progress_common(gc, why, _("Connection Error"), buf);
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
346 }
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
347