Mercurial > pidgin.yaz
annotate src/aim.c @ 733:8f3bcde94e2c
[gaim-migrate @ 743]
I like stuff.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Mon, 21 Aug 2000 20:32:50 +0000 |
parents | e46cc3c6ff26 |
children | 5a908dd5cfc4 |
rev | line source |
---|---|
1 | 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 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
24 #endif |
1 | 25 #ifdef USE_APPLET |
26 #include "gnome_applet_mgr.h" | |
27 #include <gnome.h> | |
730
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
28 #else |
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
29 #ifdef USE_GNOME |
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
30 #include <gnome.h> |
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
31 #endif /* USE_GNOME */ |
1 | 32 #endif /* USE_APPLET */ |
395
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
33 #ifdef GAIM_PLUGINS |
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
34 #include <dlfcn.h> |
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
35 #endif /* GAIM_PLUGINS */ |
1 | 36 #include <gtk/gtk.h> |
37 #include <gdk/gdkx.h> | |
216
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
38 #include <gdk/gdk.h> |
1 | 39 #include <unistd.h> |
40 #include <netinet/in.h> | |
41 #include <arpa/inet.h> | |
42 #include <sys/wait.h> | |
43 #include <stdio.h> | |
44 #include <string.h> | |
45 #include <stdarg.h> | |
46 #include <stdlib.h> | |
228 | 47 #include <ctype.h> |
1 | 48 #include "gaim.h" |
49 #ifndef USE_APPLET | |
50 #include "pixmaps/logo.xpm" | |
51 #endif /* USE_APPLET */ | |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
52 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
53 #include <signal.h> |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
54 #endif |
462 | 55 #include "locale.h" |
430 | 56 #include "gtkticker.h" |
57 | |
1 | 58 static GtkWidget *name; |
59 static GtkWidget *pass; | |
60 static GtkWidget *signon; | |
61 static GtkWidget *cancel; | |
62 static GtkWidget *progress; | |
63 static GtkWidget *notice; | |
64 | |
65 GList *permit = NULL; | |
66 GList *deny = NULL; | |
67 GList *log_conversations = NULL; | |
68 GList *buddy_pounces = NULL; | |
69 GList *away_messages = NULL; | |
70 GList *groups = NULL; | |
71 GList *buddy_chats = NULL; | |
72 GList *conversations = NULL; | |
73 GList *chat_rooms = NULL; | |
74 | |
75 GtkWidget *mainwindow = NULL; | |
705
dcf672c5a1ff
[gaim-migrate @ 715]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
644
diff
changeset
|
76 GtkWidget *remember = NULL; |
1 | 77 |
430 | 78 void BuddyTickerCreateWindow( void ); |
79 | |
1 | 80 char toc_addy[16]; |
26 | 81 char *quad_addr = NULL; |
1 | 82 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
83 gboolean running = FALSE; /* whether or not we're currently trying to sign on */ |
1 | 84 |
85 void cancel_logon(void) | |
86 { | |
87 #ifdef USE_APPLET | |
88 set_applet_draw_closed(); | |
89 AppletCancelLogon(); | |
90 gtk_widget_hide(mainwindow); | |
91 #else | |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
92 #ifdef GAIM_PLUGINS |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
93 GList *c; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
94 struct gaim_callback *g; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
95 struct gaim_plugin *p; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
96 void (*function)(void *); |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
97 void (*gaim_plugin_remove)(); |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
98 char *error; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
99 |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
100 /* first we tell those who have requested it we're quitting */ |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
101 c = callbacks; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
102 while (c) { |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
103 g = (struct gaim_callback *)c->data; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
104 if (g->event == event_quit && g->function != NULL) { |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
105 function = g->function; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
106 (*function)(g->data); |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
107 } |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
108 c = c->next; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
109 } |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
110 |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
111 /* then we remove everyone in a mass suicide */ |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
112 c = plugins; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
113 while (c) { |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
114 p = (struct gaim_plugin *)c->data; |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
115 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
116 if ((error = (char *)dlerror()) == NULL) |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
117 (*gaim_plugin_remove)(); |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
118 /* we don't need to worry about removing callbacks since |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
119 * there won't be any more chance to call them back :) */ |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
120 dlclose(p->handle); |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
121 g_free(p->filename); /* why do i bother? */ |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
122 g_free(p); |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
395
diff
changeset
|
123 c = c->next; |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
124 } |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
125 #endif /* GAIM_PLUGINS */ |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
126 |
1 | 127 exit(0); |
128 #endif /* USE_APPLET */ | |
129 } | |
130 | |
131 void set_login_progress(int howfar, char *whattosay) | |
132 { | |
133 gtk_progress_bar_update(GTK_PROGRESS_BAR(progress), | |
134 ((float)howfar / (float)LOGIN_STEPS)); | |
135 gtk_statusbar_pop(GTK_STATUSBAR(notice), 1); | |
136 gtk_statusbar_push(GTK_STATUSBAR(notice), 1, whattosay); | |
137 | |
138 while (gtk_events_pending()) | |
139 gtk_main_iteration(); | |
140 | |
141 /* Why do I need these? */ | |
142 usleep(10); | |
143 while (gtk_events_pending()) | |
144 gtk_main_iteration(); | |
145 | |
146 } | |
147 | |
148 void hide_login_progress(char *why) | |
149 { | |
150 gtk_progress_bar_update(GTK_PROGRESS_BAR(progress), | |
151 0); | |
152 gtk_statusbar_pop(GTK_STATUSBAR(notice), 1); | |
153 gtk_statusbar_push(GTK_STATUSBAR(notice), 1, why); | |
154 | |
155 while (gtk_events_pending()) | |
156 gtk_main_iteration(); | |
157 | |
158 /* Why do I need these? */ | |
159 usleep(10); | |
160 while (gtk_events_pending()) | |
161 gtk_main_iteration(); | |
162 } | |
163 | |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
164 static int snd_tmout; |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
165 int logins_not_muted = 1; |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
166 static void sound_timeout() { |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
167 logins_not_muted = 1; |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
168 gtk_timeout_remove(snd_tmout); |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
169 } |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
170 |
228 | 171 char g_screenname[ 64 ]; /* gotta be enough */ |
172 | |
1 | 173 void dologin(GtkWidget *widget, GtkWidget *w) |
174 { | |
175 char *username = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(name)->entry)); | |
176 char *password = gtk_entry_get_text(GTK_ENTRY(pass)); | |
228 | 177 int i; |
1 | 178 |
179 if (query_state() != STATE_OFFLINE) | |
180 return; | |
181 | |
182 if (!strlen(username)) { | |
355 | 183 hide_login_progress(_("Please enter your logon")); |
1 | 184 return; |
185 } | |
186 if (!strlen(password)) { | |
355 | 187 hide_login_progress(_("You must give your password")); |
1 | 188 return; |
189 } | |
190 | |
228 | 191 /* save screenname away for cache file use */ |
192 | |
193 strcpy( g_screenname, username ); | |
194 | |
195 /* fold cache screen name file to upper case to avoid problems | |
196 finding file later if user uses different case at login time */ | |
197 | |
198 for ( i = 0; i < strlen( g_screenname ); i++ ) | |
199 g_screenname[i] = toupper( g_screenname[i] ); | |
200 | |
1 | 201 #ifdef USE_APPLET |
202 set_applet_draw_closed(); | |
203 setUserState(signing_on); | |
204 #endif /* USE_APPLET */ | |
205 | |
84 | 206 if (running) return; |
207 running = TRUE; | |
1 | 208 |
84 | 209 if (serv_login(username, password) < 0) { |
210 running = FALSE; | |
1 | 211 return; |
84 | 212 } |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
410
diff
changeset
|
213 |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
410
diff
changeset
|
214 if (!USE_OSCAR) /* serv_login will set up USE_OSCAR */ |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
410
diff
changeset
|
215 gaim_setup(); |
265
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
216 } |
1 | 217 |
270
cfa39d39dec6
[gaim-migrate @ 280]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
265
diff
changeset
|
218 void auth_failed() { |
cfa39d39dec6
[gaim-migrate @ 280]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
265
diff
changeset
|
219 running = FALSE; |
cfa39d39dec6
[gaim-migrate @ 280]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
265
diff
changeset
|
220 } |
cfa39d39dec6
[gaim-migrate @ 280]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
265
diff
changeset
|
221 |
265
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
222 /* we need to do this for Oscar because serv_login only starts the login |
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
223 * process, it doesn't end there. gaim_setup will be called later from |
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
224 * oscar.c, after the buddy list is made and serv_finish_login is called */ |
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
225 void gaim_setup() { |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
226 if (sound_options & OPT_SOUND_LOGIN && |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
227 sound_options & OPT_SOUND_SILENT_SIGNON) { |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
228 logins_not_muted = 0; |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
229 snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
230 NULL); |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
231 } |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
232 |
84 | 233 #ifdef USE_APPLET |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
234 setUserState(online); |
84 | 235 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon"); |
236 applet_widget_register_callback(APPLET_WIDGET(applet), | |
237 "signoff", | |
238 _("Signoff"), | |
239 signoff, | |
240 NULL); | |
265
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
241 #endif /* USE_APPLET */ |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
242 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
243 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
244 { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
245 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
246 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
247 void (*function)(void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
248 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
249 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
250 if (g->event == event_signon && g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
251 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
252 (*function)(g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
253 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
254 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
255 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
256 } |
265
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
257 #endif /* GAIM_PLUGINS */ |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
258 |
84 | 259 running = FALSE; |
260 return; | |
1 | 261 } |
262 | |
263 | |
264 | |
265 | |
266 void doenter(GtkWidget *widget, GtkWidget *w) | |
267 { | |
268 if (widget == name) { | |
269 gtk_entry_set_text(GTK_ENTRY(pass),""); | |
270 gtk_entry_select_region(GTK_ENTRY(GTK_COMBO(name)->entry), 0, 0); | |
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
271 gtk_widget_grab_focus(pass); |
1 | 272 } else if (widget == pass) { |
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
273 gtk_widget_grab_focus(signon); |
1 | 274 } |
275 | |
276 } | |
277 | |
278 | |
279 static void combo_changed(GtkWidget *w, GtkWidget *combo) | |
280 { | |
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
281 char *txt = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)); |
1 | 282 struct aim_user *u; |
283 | |
25 | 284 if (!(general_options & OPT_GEN_REMEMBER_PASS)) { |
1 | 285 return; |
25 | 286 } |
287 | |
1 | 288 u = find_user(txt); |
289 | |
290 if (u != NULL) { | |
291 gtk_entry_set_text(GTK_ENTRY(pass), u->password); | |
292 } else { | |
293 gtk_entry_set_text(GTK_ENTRY(pass), ""); | |
294 } | |
25 | 295 |
1 | 296 return; |
297 } | |
298 | |
299 static GList *combo_user_names() | |
300 { | |
301 GList *usr = aim_users; | |
302 GList *tmp = NULL; | |
303 struct aim_user *u; | |
304 | |
305 | |
306 if (!usr) | |
307 return g_list_append(NULL, "<unknown>"); | |
308 | |
309 while(usr) { | |
310 u = (struct aim_user *)usr->data; | |
311 tmp = g_list_append(tmp, g_strdup(u->username)); | |
312 usr = usr->next; | |
313 | |
314 } | |
315 | |
316 return tmp; | |
317 } | |
318 | |
319 | |
320 | |
321 void show_login() | |
322 { | |
323 GtkWidget *options; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
324 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
325 GtkWidget *plugs; |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
326 #endif |
1 | 327 GtkWidget *reg; |
328 GtkWidget *bbox; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
329 GtkWidget *hbox; |
1 | 330 GtkWidget *sbox; |
331 GtkWidget *label; | |
332 GtkWidget *table; | |
333 | |
334 #ifndef USE_APPLET | |
335 GtkWidget *pmw; | |
336 GdkPixmap *pm; | |
337 GtkStyle *style; | |
338 GdkBitmap *mask; | |
339 #endif /* USE_APPLET */ | |
340 | |
341 if (mainwindow) { | |
342 gtk_widget_show(mainwindow); | |
705
dcf672c5a1ff
[gaim-migrate @ 715]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
644
diff
changeset
|
343 if (!(general_options & OPT_GEN_REMEMBER_PASS)) |
dcf672c5a1ff
[gaim-migrate @ 715]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
644
diff
changeset
|
344 gtk_entry_set_text(GTK_ENTRY(pass), ""); |
1 | 345 return; |
346 } | |
430 | 347 |
1 | 348 mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
621 | 349 gtk_widget_realize(mainwindow); |
622 | 350 signon = gtk_button_new_with_label(_("Signon")); |
351 cancel = gtk_button_new_with_label(_("Cancel")); | |
352 reg = gtk_button_new_with_label(_("Register")); | |
353 options = gtk_button_new_with_label(_("Options")); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
354 #ifdef GAIM_PLUGINS |
622 | 355 plugs = gtk_button_new_with_label(_("Plugins")); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
356 #endif |
1 | 357 table = gtk_table_new(8, 2, FALSE); |
358 name = gtk_combo_new(); | |
359 pass = gtk_entry_new(); | |
360 notice = gtk_statusbar_new(); | |
621 | 361 progress = gtk_progress_bar_new(); |
1 | 362 |
621 | 363 gtk_combo_set_popdown_strings(GTK_COMBO(name), combo_user_names()); |
1 | 364 |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
365 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
366 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
367 gtk_button_set_relief(GTK_BUTTON(signon), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
368 gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
369 gtk_button_set_relief(GTK_BUTTON(reg), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
370 gtk_button_set_relief(GTK_BUTTON(options), GTK_RELIEF_NONE); |
600
01777a942034
[gaim-migrate @ 610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
583
diff
changeset
|
371 #ifdef GAIM_PLUGINS |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
372 gtk_button_set_relief(GTK_BUTTON(plugs), GTK_RELIEF_NONE); |
600
01777a942034
[gaim-migrate @ 610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
583
diff
changeset
|
373 #endif |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
374 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
375 |
1 | 376 /* Make the buttons do stuff */ |
377 /* Clicking the button initiates a login */ | |
378 gtk_signal_connect(GTK_OBJECT(signon), "clicked", | |
379 GTK_SIGNAL_FUNC(dologin), mainwindow); | |
380 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
381 GTK_SIGNAL_FUNC(cancel_logon), mainwindow); | |
382 /* Allow user to change prefs before logging in */ | |
383 gtk_signal_connect(GTK_OBJECT(options), "clicked", | |
384 GTK_SIGNAL_FUNC(show_prefs), NULL); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
385 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
386 /* Allow user to control plugins before logging in */ |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
387 gtk_signal_connect(GTK_OBJECT(plugs), "clicked", |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
388 GTK_SIGNAL_FUNC(show_plugins), NULL); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
389 #endif |
1 | 390 |
391 /* Register opens the right URL */ | |
392 gtk_signal_connect(GTK_OBJECT(reg), "clicked", | |
286 | 393 GTK_SIGNAL_FUNC(open_url), "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"); |
1 | 394 /* Enter in the username clears the password and sets |
395 the pointer in the password field */ | |
396 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "activate", | |
397 GTK_SIGNAL_FUNC(doenter), mainwindow); | |
398 | |
399 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed", | |
400 GTK_SIGNAL_FUNC(combo_changed), name); | |
401 | |
402 gtk_signal_connect(GTK_OBJECT(pass), "activate", | |
403 GTK_SIGNAL_FUNC(doenter), mainwindow); | |
404 gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", | |
405 GTK_SIGNAL_FUNC(cancel_logon), mainwindow); | |
406 /* Homogenous spacing, 10 padding */ | |
407 bbox = gtk_hbox_new(TRUE, 10); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
408 hbox = gtk_hbox_new(TRUE, 10); |
621 | 409 sbox = gtk_vbox_new(TRUE, 5); |
1 | 410 |
622 | 411 gtk_box_pack_start(GTK_BOX(bbox), reg, TRUE, TRUE, 0); |
1 | 412 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); |
413 gtk_box_pack_start(GTK_BOX(bbox), signon, TRUE, TRUE, 0); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
414 |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
415 gtk_box_pack_start(GTK_BOX(hbox), options, TRUE, TRUE, 0); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
416 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
417 gtk_box_pack_start(GTK_BOX(hbox), plugs, TRUE, TRUE, 0); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
418 #endif |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
419 |
1 | 420 gtk_box_pack_start(GTK_BOX(sbox), bbox, TRUE, TRUE, 0); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
421 gtk_box_pack_start(GTK_BOX(sbox), hbox, TRUE, TRUE, 0); |
1 | 422 |
423 /* Labels for selectors and text boxes */ | |
424 #if 0 | |
425 label = gtk_label_new("TOC: "); | |
426 gtk_table_attach(GTK_TABLE(table), label, 0,1,1,2,0,0, 5, 5); | |
427 gtk_widget_show(label); | |
428 #endif | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
429 label = gtk_label_new(_("Screen Name: ")); |
1 | 430 gtk_table_attach(GTK_TABLE(table), label, 0,1,2,3,0,0, 5, 5); |
431 gtk_widget_show(label); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
432 label = gtk_label_new(_("Password: ")); |
1 | 433 gtk_table_attach(GTK_TABLE(table), label, 0,1,3,4,0,0, 5, 5); |
434 gtk_widget_show(label); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
435 remember = gtk_check_button_new_with_label(_("Remember Password")); |
1 | 436 gtk_table_attach(GTK_TABLE(table), remember, 0,2,4,5,0,0, 5, 5); |
437 gtk_widget_show(remember); | |
438 | |
439 gtk_widget_show(options); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
440 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
441 gtk_widget_show(plugs); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
442 #endif |
1 | 443 |
444 /* Adjust sizes of inputs */ | |
621 | 445 gtk_widget_set_usize(name,100,0); |
446 gtk_widget_set_usize(pass,100,0); | |
1 | 447 |
448 | |
449 /* Status and label */ | |
450 gtk_widget_show(notice); | |
451 | |
452 gtk_widget_set_usize(progress,150,0); | |
453 | |
454 gtk_widget_show(progress); | |
455 | |
456 gtk_table_attach(GTK_TABLE(table), progress, 0, 2, 6, 7, 0, 0, 5, 5); | |
457 gtk_widget_set_usize(GTK_STATUSBAR(notice)->label, 150, 0); | |
458 gtk_table_attach(GTK_TABLE(table), notice, 0, 2, 8, 9, 0, 0, 5, 5); | |
459 | |
460 /* Attach the buttons at the bottom */ | |
461 gtk_widget_show(signon); | |
462 gtk_widget_show(cancel); | |
463 gtk_widget_show(reg); | |
464 gtk_widget_show(bbox); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
465 gtk_widget_show(hbox); |
1 | 466 gtk_widget_show(sbox); |
467 gtk_table_attach(GTK_TABLE(table), sbox, 0,2,7,8,0,0, 5, 5); | |
468 | |
469 /* Text fields */ | |
470 | |
471 gtk_table_attach(GTK_TABLE(table),name,1,2,2,3,0,0,5,5); | |
472 gtk_widget_show(name); | |
473 gtk_table_attach(GTK_TABLE(table),pass,1,2,3,4,0,0,5,5); | |
474 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
475 gtk_widget_show(pass); | |
476 | |
477 gtk_container_border_width(GTK_CONTAINER(sbox), 10); | |
478 | |
479 gtk_container_add(GTK_CONTAINER(mainwindow),table ); | |
480 | |
481 gtk_widget_show(table); | |
355 | 482 gtk_window_set_title(GTK_WINDOW(mainwindow),_("Gaim - Login")); |
1 | 483 |
484 | |
485 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(remember), (general_options & OPT_GEN_REMEMBER_PASS)); | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
410
diff
changeset
|
486 |
1 | 487 if (current_user) { |
508
1181582366f5
[gaim-migrate @ 518]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
462
diff
changeset
|
488 sprintf(debug_buff, "Current user is %s\n", current_user->username); |
1181582366f5
[gaim-migrate @ 518]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
462
diff
changeset
|
489 debug_print(debug_buff); |
1181582366f5
[gaim-migrate @ 518]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
462
diff
changeset
|
490 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(name)->entry), current_user->username); |
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
491 if ((general_options & OPT_GEN_REMEMBER_PASS)) { |
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
492 combo_changed(NULL, name); |
157
aad89d9bce85
[gaim-migrate @ 167]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
155
diff
changeset
|
493 gtk_widget_grab_focus(signon); |
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
494 } else { |
157
aad89d9bce85
[gaim-migrate @ 167]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
155
diff
changeset
|
495 gtk_widget_grab_focus(pass); |
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
496 } |
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
497 } else { |
157
aad89d9bce85
[gaim-migrate @ 167]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
155
diff
changeset
|
498 gtk_widget_grab_focus(name); |
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
499 } |
1 | 500 |
501 | |
502 gtk_signal_connect(GTK_OBJECT(remember), "clicked", GTK_SIGNAL_FUNC(set_general_option), (int *)OPT_GEN_REMEMBER_PASS); | |
503 | |
504 | |
505 gtk_widget_realize(mainwindow); | |
506 | |
507 #ifndef USE_APPLET | |
508 /* Logo at the top */ | |
509 style = gtk_widget_get_style(mainwindow); | |
510 pm = gdk_pixmap_create_from_xpm_d(mainwindow->window, &mask, | |
511 &style->bg[GTK_STATE_NORMAL], (gchar **)aol_logo); | |
512 pmw = gtk_pixmap_new( pm, mask); | |
513 gtk_table_attach(GTK_TABLE(table), pmw, 0,2,0,1,0,0,5,5); | |
514 gtk_widget_show(pmw); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
515 gdk_pixmap_unref(pm); |
1 | 516 #endif /* USE_APPLET */ |
517 | |
518 | |
519 aol_icon(mainwindow->window); | |
520 #ifndef _WIN32 | |
521 gdk_window_set_group(mainwindow->window, mainwindow->window); | |
522 #endif | |
523 | |
524 | |
525 gtk_widget_show(mainwindow); | |
436 | 526 |
527 SetTickerPrefs(); | |
1 | 528 |
529 if((general_options & OPT_GEN_AUTO_LOGIN) && | |
530 (general_options & OPT_GEN_REMEMBER_PASS)) { | |
531 dologin(signon, NULL); | |
532 } | |
533 } | |
534 | |
200
bc117fbcf527
[gaim-migrate @ 210]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
184
diff
changeset
|
535 extern void show_debug(GtkObject *); |
180 | 536 |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
537 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
538 void sighandler(int sig) |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
539 { |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
540 fprintf(stderr, "God damn, I tripped.\n"); |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
541 exit(11); /* signal 11 */ |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
542 } |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
543 #endif |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
544 |
1 | 545 int main(int argc, char *argv[]) |
546 { | |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
547 #ifdef ENABLE_NLS |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
548 bindtextdomain(PACKAGE, LOCALEDIR); |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
549 textdomain(PACKAGE); |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
550 #endif |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
551 |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
552 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
553 /* Let's not violate any PLA's!!!! */ |
636
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
554 /* signal(SIGSEGV, sighandler); */ |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
555 #endif |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
556 |
546
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
557 if (argc > 1 && !strcmp(argv[1], "--version")) { |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
558 gtk_init(&argc, &argv); |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
559 set_defaults(); /* needed for open_url_nw */ |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
560 load_prefs(); |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
561 show_about(0, (void *)1); |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
562 gtk_main(); |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
563 return 0; |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
564 } |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
565 |
1 | 566 #ifdef USE_APPLET |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
567 init_applet_mgr(argc, argv); |
724
e7d812852a7f
[gaim-migrate @ 734]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
705
diff
changeset
|
568 #elif defined USE_GNOME |
e7d812852a7f
[gaim-migrate @ 734]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
705
diff
changeset
|
569 gnome_init(PACKAGE,VERSION,argc,argv); |
1 | 570 #else |
571 gtk_init(&argc, &argv); | |
724
e7d812852a7f
[gaim-migrate @ 734]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
705
diff
changeset
|
572 #endif /* USE_GNOME */ |
1 | 573 |
574 set_defaults(); | |
575 load_prefs(); | |
180 | 576 |
176
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
158
diff
changeset
|
577 if (general_options & OPT_GEN_DEBUG) |
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
158
diff
changeset
|
578 show_debug(NULL); |
1 | 579 |
216
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
580 gdk_threads_enter(); |
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
581 |
1 | 582 #ifdef USE_APPLET |
583 applet_widget_register_callback(APPLET_WIDGET(applet), | |
584 "prefs", | |
585 _("Preferences"), | |
586 show_prefs, | |
587 NULL); | |
588 applet_widget_register_callback(APPLET_WIDGET(applet), | |
589 "signon", | |
590 _("Signon"), | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
591 applet_do_signon, |
1 | 592 NULL); |
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
593 #ifdef GAIM_PLUGINS |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
594 applet_widget_register_callback(APPLET_WIDGET(applet), |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
595 "plugins", |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
596 _("Plugins"), |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
597 GTK_SIGNAL_FUNC(show_plugins), |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
598 NULL); |
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
599 #endif /* GAIM_PLUGINS */ |
1 | 600 |
601 if((general_options & OPT_GEN_AUTO_LOGIN) && | |
602 (general_options & OPT_GEN_REMEMBER_PASS)) { | |
603 | |
604 applet_show_login(APPLET_WIDGET(applet), NULL); | |
605 } | |
82 | 606 |
607 update_pixmaps(); | |
1 | 608 |
609 applet_widget_gtk_main(); | |
610 #else | |
611 | |
612 | |
613 show_login(); | |
614 gtk_main(); | |
615 | |
616 #endif /* USE_APPLET */ | |
216
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
617 gdk_threads_leave(); |
1 | 618 |
619 return 0; | |
620 | |
621 } |