Mercurial > pidgin.yaz
annotate src/aim.c @ 99:f810fc7d423f
[gaim-migrate @ 109]
Autorecon reconnects you on signoff (kick). Made other small changes.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sun, 09 Apr 2000 20:29:25 +0000 |
parents | 5b4b7aa8dd9a |
children | 55faf2e3a134 |
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 | |
22 #ifdef USE_THEMES | |
23 #include <gnome.h> | |
24 #else | |
25 #ifdef USE_APPLET | |
26 #include "gnome_applet_mgr.h" | |
27 #include <gnome.h> | |
28 #endif /* USE_APPLET */ | |
29 #endif /* USE_THEMES */ | |
30 #include <gtk/gtk.h> | |
31 #include <gdk/gdkx.h> | |
32 #include <unistd.h> | |
33 #include <netinet/in.h> | |
34 #include <arpa/inet.h> | |
35 #include <sys/wait.h> | |
36 #include <stdio.h> | |
37 #include <string.h> | |
38 #include <stdarg.h> | |
39 #include <stdlib.h> | |
40 #include "gaim.h" | |
41 #ifndef USE_APPLET | |
42 #include "pixmaps/logo.xpm" | |
43 #endif /* USE_APPLET */ | |
44 | |
45 static GtkWidget *name; | |
46 static GtkWidget *pass; | |
47 static GtkWidget *signon; | |
48 static GtkWidget *cancel; | |
49 static GtkWidget *progress; | |
50 static GtkWidget *notice; | |
51 | |
52 GList *permit = NULL; | |
53 GList *deny = NULL; | |
54 GList *log_conversations = NULL; | |
55 GList *buddy_pounces = NULL; | |
56 GList *away_messages = NULL; | |
57 GList *groups = NULL; | |
58 GList *buddy_chats = NULL; | |
59 GList *conversations = NULL; | |
60 GList *chat_rooms = NULL; | |
61 | |
62 GtkWidget *mainwindow = NULL; | |
63 | |
64 char toc_addy[16]; | |
26 | 65 char *quad_addr = NULL; |
1 | 66 |
67 | |
68 void cancel_logon(void) | |
69 { | |
70 #ifdef USE_APPLET | |
71 set_applet_draw_closed(); | |
72 AppletCancelLogon(); | |
73 gtk_widget_hide(mainwindow); | |
74 #else | |
75 exit(0); | |
76 #endif /* USE_APPLET */ | |
77 } | |
78 | |
79 void set_login_progress(int howfar, char *whattosay) | |
80 { | |
81 gtk_progress_bar_update(GTK_PROGRESS_BAR(progress), | |
82 ((float)howfar / (float)LOGIN_STEPS)); | |
83 gtk_statusbar_pop(GTK_STATUSBAR(notice), 1); | |
84 gtk_statusbar_push(GTK_STATUSBAR(notice), 1, whattosay); | |
85 | |
86 while (gtk_events_pending()) | |
87 gtk_main_iteration(); | |
88 | |
89 /* Why do I need these? */ | |
90 usleep(10); | |
91 while (gtk_events_pending()) | |
92 gtk_main_iteration(); | |
93 | |
94 } | |
95 | |
96 void hide_login_progress(char *why) | |
97 { | |
98 gtk_progress_bar_update(GTK_PROGRESS_BAR(progress), | |
99 0); | |
100 gtk_statusbar_pop(GTK_STATUSBAR(notice), 1); | |
101 gtk_statusbar_push(GTK_STATUSBAR(notice), 1, why); | |
102 | |
103 while (gtk_events_pending()) | |
104 gtk_main_iteration(); | |
105 | |
106 /* Why do I need these? */ | |
107 usleep(10); | |
108 while (gtk_events_pending()) | |
109 gtk_main_iteration(); | |
110 } | |
111 | |
112 void dologin(GtkWidget *widget, GtkWidget *w) | |
113 { | |
84 | 114 static gboolean running = FALSE; |
1 | 115 char *username = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(name)->entry)); |
116 char *password = gtk_entry_get_text(GTK_ENTRY(pass)); | |
117 | |
118 if (query_state() != STATE_OFFLINE) | |
119 return; | |
120 | |
121 if (!strlen(username)) { | |
122 hide_login_progress("Please enter your logon"); | |
123 return; | |
124 } | |
125 if (!strlen(password)) { | |
126 hide_login_progress("You must give your password"); | |
127 return; | |
128 } | |
129 | |
130 #ifdef USE_APPLET | |
131 set_applet_draw_closed(); | |
132 setUserState(signing_on); | |
133 #endif /* USE_APPLET */ | |
134 | |
84 | 135 if (running) return; |
136 running = TRUE; | |
1 | 137 |
84 | 138 if (serv_login(username, password) < 0) { |
139 running = FALSE; | |
1 | 140 return; |
84 | 141 } |
1 | 142 |
84 | 143 #ifdef USE_APPLET |
144 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon"); | |
145 applet_widget_register_callback(APPLET_WIDGET(applet), | |
146 "buddy", | |
147 _("Buddy List"), | |
148 (AppletCallbackFunc)make_buddy, | |
149 NULL); | |
150 applet_widget_register_callback(APPLET_WIDGET(applet), | |
151 "signoff", | |
152 _("Signoff"), | |
153 signoff, | |
154 NULL); | |
155 #endif | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
156 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
157 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
158 { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
159 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
160 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
161 void (*function)(void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
162 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
163 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
164 if (g->event == event_signon && g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
165 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
166 (*function)(g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
167 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
168 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
169 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
170 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
171 #endif |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
172 |
84 | 173 running = FALSE; |
174 return; | |
1 | 175 } |
176 | |
177 | |
178 | |
179 | |
180 void doenter(GtkWidget *widget, GtkWidget *w) | |
181 { | |
182 if (widget == name) { | |
183 gtk_entry_set_text(GTK_ENTRY(pass),""); | |
184 gtk_entry_select_region(GTK_ENTRY(GTK_COMBO(name)->entry), 0, 0); | |
185 gtk_window_set_focus(GTK_WINDOW(mainwindow), pass); | |
186 } else if (widget == pass) { | |
187 gtk_window_set_focus(GTK_WINDOW(mainwindow), signon); | |
188 } else { | |
189 g_print("what did you press enter on?\n"); | |
190 } | |
191 | |
192 } | |
193 | |
194 | |
195 static void combo_changed(GtkWidget *w, GtkWidget *combo) | |
196 { | |
197 char *txt = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(combo)->entry), 0, -1); | |
198 struct aim_user *u; | |
199 | |
25 | 200 if (!(general_options & OPT_GEN_REMEMBER_PASS)) { |
201 g_free(txt); | |
1 | 202 return; |
25 | 203 } |
204 | |
1 | 205 u = find_user(txt); |
206 | |
207 if (u != NULL) { | |
208 gtk_entry_set_text(GTK_ENTRY(pass), u->password); | |
209 } else { | |
210 gtk_entry_set_text(GTK_ENTRY(pass), ""); | |
211 } | |
25 | 212 |
213 g_free(txt); | |
1 | 214 return; |
215 } | |
216 | |
217 static GList *combo_user_names() | |
218 { | |
219 GList *usr = aim_users; | |
220 GList *tmp = NULL; | |
221 struct aim_user *u; | |
222 | |
223 | |
224 if (!usr) | |
225 return g_list_append(NULL, "<unknown>"); | |
226 | |
227 while(usr) { | |
228 u = (struct aim_user *)usr->data; | |
229 tmp = g_list_append(tmp, g_strdup(u->username)); | |
230 usr = usr->next; | |
231 | |
232 } | |
233 | |
234 return tmp; | |
235 } | |
236 | |
237 | |
238 | |
239 void show_login() | |
240 { | |
241 GtkWidget *options; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
242 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
243 GtkWidget *plugs; |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
244 #endif |
1 | 245 GtkWidget *reg; |
246 GtkWidget *bbox; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
247 GtkWidget *hbox; |
1 | 248 GtkWidget *sbox; |
249 GtkWidget *label; | |
250 GtkWidget *table; | |
251 GtkWidget *remember; | |
252 | |
253 #ifndef USE_APPLET | |
254 GtkWidget *pmw; | |
255 GdkPixmap *pm; | |
256 GtkStyle *style; | |
257 GdkBitmap *mask; | |
258 #endif /* USE_APPLET */ | |
259 | |
260 if (mainwindow) { | |
261 gtk_widget_show(mainwindow); | |
262 return; | |
263 } | |
264 | |
265 mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
266 signon = gtk_button_new_with_label("Signon"); | |
267 cancel = gtk_button_new_with_label("Cancel"); | |
268 reg = gtk_button_new_with_label("Register"); | |
269 options = gtk_button_new_with_label("Options"); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
270 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
271 plugs = gtk_button_new_with_label("Plugins"); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
272 #endif |
1 | 273 table = gtk_table_new(8, 2, FALSE); |
274 name = gtk_combo_new(); | |
275 pass = gtk_entry_new(); | |
276 notice = gtk_statusbar_new(); | |
277 progress = gtk_progress_bar_new(); | |
278 | |
279 gtk_combo_set_popdown_strings(GTK_COMBO(name), combo_user_names()); | |
280 | |
281 /* Make the buttons do stuff */ | |
282 /* Clicking the button initiates a login */ | |
283 gtk_signal_connect(GTK_OBJECT(signon), "clicked", | |
284 GTK_SIGNAL_FUNC(dologin), mainwindow); | |
285 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
286 GTK_SIGNAL_FUNC(cancel_logon), mainwindow); | |
287 /* Allow user to change prefs before logging in */ | |
288 gtk_signal_connect(GTK_OBJECT(options), "clicked", | |
289 GTK_SIGNAL_FUNC(show_prefs), NULL); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
290 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
291 /* Allow user to control plugins before logging in */ |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
292 gtk_signal_connect(GTK_OBJECT(plugs), "clicked", |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
293 GTK_SIGNAL_FUNC(show_plugins), NULL); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
294 #endif |
1 | 295 |
296 /* Register opens the right URL */ | |
297 gtk_signal_connect(GTK_OBJECT(reg), "clicked", | |
298 GTK_SIGNAL_FUNC(open_url), "http://www.aol.com/aim"); | |
299 /* Enter in the username clears the password and sets | |
300 the pointer in the password field */ | |
301 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "activate", | |
302 GTK_SIGNAL_FUNC(doenter), mainwindow); | |
303 | |
304 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed", | |
305 GTK_SIGNAL_FUNC(combo_changed), name); | |
306 | |
307 gtk_signal_connect(GTK_OBJECT(pass), "activate", | |
308 GTK_SIGNAL_FUNC(doenter), mainwindow); | |
309 gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", | |
310 GTK_SIGNAL_FUNC(cancel_logon), mainwindow); | |
311 /* Homogenous spacing, 10 padding */ | |
312 bbox = gtk_hbox_new(TRUE, 10); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
313 hbox = gtk_hbox_new(TRUE, 10); |
1 | 314 sbox = gtk_vbox_new(TRUE, 10); |
315 | |
316 gtk_box_pack_start(GTK_BOX(bbox), reg, TRUE, TRUE, 0); | |
317 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
318 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
|
319 |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
320 gtk_box_pack_start(GTK_BOX(hbox), options, TRUE, TRUE, 0); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
321 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
322 gtk_box_pack_start(GTK_BOX(hbox), plugs, TRUE, TRUE, 0); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
323 #endif |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
324 |
1 | 325 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
|
326 gtk_box_pack_start(GTK_BOX(sbox), hbox, TRUE, TRUE, 0); |
1 | 327 |
328 /* Labels for selectors and text boxes */ | |
329 #if 0 | |
330 label = gtk_label_new("TOC: "); | |
331 gtk_table_attach(GTK_TABLE(table), label, 0,1,1,2,0,0, 5, 5); | |
332 gtk_widget_show(label); | |
333 #endif | |
334 label = gtk_label_new("Screen Name: "); | |
335 gtk_table_attach(GTK_TABLE(table), label, 0,1,2,3,0,0, 5, 5); | |
336 gtk_widget_show(label); | |
337 label = gtk_label_new("Password: "); | |
338 gtk_table_attach(GTK_TABLE(table), label, 0,1,3,4,0,0, 5, 5); | |
339 gtk_widget_show(label); | |
340 remember = gtk_check_button_new_with_label("Remember Password"); | |
341 gtk_table_attach(GTK_TABLE(table), remember, 0,2,4,5,0,0, 5, 5); | |
342 gtk_widget_show(remember); | |
343 | |
344 gtk_widget_show(options); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
345 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
346 gtk_widget_show(plugs); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
347 #endif |
1 | 348 |
349 /* Adjust sizes of inputs */ | |
350 gtk_widget_set_usize(name,95,0); | |
351 gtk_widget_set_usize(pass,95,0); | |
352 | |
353 | |
354 /* Status and label */ | |
355 gtk_widget_show(notice); | |
356 | |
357 gtk_widget_set_usize(progress,150,0); | |
358 | |
359 gtk_widget_show(progress); | |
360 | |
361 gtk_table_attach(GTK_TABLE(table), progress, 0, 2, 6, 7, 0, 0, 5, 5); | |
362 gtk_widget_set_usize(GTK_STATUSBAR(notice)->label, 150, 0); | |
363 gtk_table_attach(GTK_TABLE(table), notice, 0, 2, 8, 9, 0, 0, 5, 5); | |
364 | |
365 /* Attach the buttons at the bottom */ | |
366 gtk_widget_show(signon); | |
367 gtk_widget_show(cancel); | |
368 gtk_widget_show(reg); | |
369 gtk_widget_show(bbox); | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
370 gtk_widget_show(hbox); |
1 | 371 gtk_widget_show(sbox); |
372 gtk_table_attach(GTK_TABLE(table), sbox, 0,2,7,8,0,0, 5, 5); | |
373 | |
374 /* Text fields */ | |
375 | |
376 gtk_table_attach(GTK_TABLE(table),name,1,2,2,3,0,0,5,5); | |
377 gtk_widget_show(name); | |
378 gtk_table_attach(GTK_TABLE(table),pass,1,2,3,4,0,0,5,5); | |
379 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
380 gtk_widget_show(pass); | |
381 | |
382 gtk_container_border_width(GTK_CONTAINER(sbox), 10); | |
383 | |
384 gtk_container_add(GTK_CONTAINER(mainwindow),table ); | |
385 | |
386 gtk_widget_show(table); | |
387 gtk_window_set_title(GTK_WINDOW(mainwindow),"Gaim - Login"); | |
388 | |
389 | |
390 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(remember), (general_options & OPT_GEN_REMEMBER_PASS)); | |
391 | |
392 if (current_user) { | |
85 | 393 GList *all = combo_user_names(); |
394 GList *srch = g_list_find(all, (void *)current_user->username); | |
395 int length = g_list_length(all) - g_list_length(srch); | |
396 g_list_free(srch); | |
397 g_list_free(all); | |
398 | |
399 gtk_combo_set_value_in_list(GTK_COMBO(name), length, 0); | |
1 | 400 if ((general_options & OPT_GEN_REMEMBER_PASS)) { |
401 gtk_entry_set_text(GTK_ENTRY(pass), current_user->password); | |
402 } | |
403 | |
404 | |
405 gtk_widget_grab_focus(signon); | |
406 } else | |
407 gtk_widget_grab_focus(name); | |
408 | |
409 | |
410 | |
411 gtk_signal_connect(GTK_OBJECT(remember), "clicked", GTK_SIGNAL_FUNC(set_general_option), (int *)OPT_GEN_REMEMBER_PASS); | |
412 | |
413 | |
414 gtk_widget_realize(mainwindow); | |
415 | |
416 #ifndef USE_APPLET | |
417 /* Logo at the top */ | |
418 style = gtk_widget_get_style(mainwindow); | |
419 pm = gdk_pixmap_create_from_xpm_d(mainwindow->window, &mask, | |
420 &style->bg[GTK_STATE_NORMAL], (gchar **)aol_logo); | |
421 pmw = gtk_pixmap_new( pm, mask); | |
422 gtk_table_attach(GTK_TABLE(table), pmw, 0,2,0,1,0,0,5,5); | |
423 gtk_widget_show(pmw); | |
424 #endif /* USE_APPLET */ | |
425 | |
426 | |
427 aol_icon(mainwindow->window); | |
428 #ifndef _WIN32 | |
429 gdk_window_set_group(mainwindow->window, mainwindow->window); | |
430 #endif | |
431 | |
432 | |
433 gtk_widget_show(mainwindow); | |
434 | |
435 if((general_options & OPT_GEN_AUTO_LOGIN) && | |
436 (general_options & OPT_GEN_REMEMBER_PASS)) { | |
437 dologin(signon, NULL); | |
438 } | |
439 } | |
440 | |
441 | |
442 int main(int argc, char *argv[]) | |
443 { | |
444 #ifdef USE_APPLET | |
445 InitAppletMgr( argc, argv ); | |
446 #elif defined USE_THEMES | |
447 gnome_init("GAIM",NULL,argc,argv); | |
448 #else | |
449 gtk_init(&argc, &argv); | |
450 #endif /* USE_THEMES */ | |
451 | |
452 | |
453 set_defaults(); | |
454 load_prefs(); | |
455 | |
456 #ifdef USE_APPLET | |
457 applet_widget_register_callback(APPLET_WIDGET(applet), | |
458 "prefs", | |
459 _("Preferences"), | |
460 show_prefs, | |
461 NULL); | |
462 applet_widget_register_callback(APPLET_WIDGET(applet), | |
463 "signon", | |
464 _("Signon"), | |
465 applet_show_login, | |
466 NULL); | |
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
467 #ifdef GAIM_PLUGINS |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
468 applet_widget_register_callback(APPLET_WIDGET(applet), |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
469 "plugins", |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
470 _("Plugins"), |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
471 GTK_SIGNAL_FUNC(show_plugins), |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
472 NULL); |
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
473 #endif /* GAIM_PLUGINS */ |
1 | 474 |
475 if((general_options & OPT_GEN_AUTO_LOGIN) && | |
476 (general_options & OPT_GEN_REMEMBER_PASS)) { | |
477 | |
478 applet_show_login(APPLET_WIDGET(applet), NULL); | |
479 } | |
82 | 480 |
481 update_pixmaps(); | |
1 | 482 |
483 applet_widget_gtk_main(); | |
484 #else | |
485 | |
486 | |
487 show_login(); | |
488 gtk_main(); | |
489 | |
490 #endif /* USE_APPLET */ | |
491 | |
492 return 0; | |
493 | |
494 } |