Fri, 03 Dec 2004 02:46:34 +0000
[gaim-migrate @ 11497]
And another one gone, and another one gone, another one bites the dust.
Hopefully I'm committing everything this time.
| 10302 | 1 | /* |
| 2 | * gaim | |
| 3 | * | |
| 4 | * Gaim is the legal property of its developers, whose names are too numerous | |
| 5 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | * | |
| 22 | */ | |
| 23 | ||
| 24 | #include "internal.h" | |
| 25 | #include "gtkgaim.h" | |
| 26 | ||
| 27 | #include "account.h" | |
| 28 | #include "conversation.h" | |
| 29 | #include "core.h" | |
| 30 | #include "debug.h" | |
| 31 | #include "eventloop.h" | |
| 32 | #include "ft.h" | |
| 33 | #include "log.h" | |
| 34 | #include "notify.h" | |
| 35 | #include "prefs.h" | |
| 36 | #include "prpl.h" | |
| 37 | #include "pounce.h" | |
| 38 | #include "sound.h" | |
| 39 | #include "status.h" | |
| 40 | #include "util.h" | |
| 41 | ||
| 42 | #include "gtkaccount.h" | |
| 43 | #include "gtkblist.h" | |
| 44 | #include "gtkconn.h" | |
| 45 | #include "gtkconv.h" | |
| 46 | #include "gtkdebug.h" | |
| 47 | #include "gtkdialogs.h" | |
| 48 | #include "gtkeventloop.h" | |
| 49 | #include "gtkft.h" | |
| 50 | #include "gtknotify.h" | |
| 51 | #include "gtkplugin.h" | |
| 52 | #include "gtkpounce.h" | |
| 53 | #include "gtkprefs.h" | |
| 54 | #include "gtkprivacy.h" | |
| 55 | #include "gtkrequest.h" | |
| 56 | #include "gtkroomlist.h" | |
| 57 | #include "gtksound.h" | |
| 58 | #include "gtkutils.h" | |
| 59 | #include "gtkstock.h" | |
| 60 | ||
| 61 | #if HAVE_SIGNAL_H | |
| 62 | # include <signal.h> | |
| 63 | #endif | |
| 64 | ||
| 65 | #include <getopt.h> | |
| 66 | ||
| 67 | #ifdef HAVE_STARTUP_NOTIFICATION | |
| 68 | # define SN_API_NOT_YET_FROZEN | |
| 69 | # include <libsn/sn-launchee.h> | |
| 70 | # include <gdk/gdkx.h> | |
| 71 | #endif | |
| 72 | ||
| 73 | static GtkWidget *name; | |
| 74 | static GtkWidget *pass; | |
| 75 | ||
| 76 | #ifdef HAVE_STARTUP_NOTIFICATION | |
| 77 | static SnLauncheeContext *sn_context = NULL; | |
| 78 | static SnDisplay *sn_display = NULL; | |
| 79 | #endif | |
| 80 | ||
| 81 | GtkWidget *mainwindow = NULL; | |
| 82 | ||
| 83 | int opt_away = 0; | |
| 84 | int docklet_count = 0; | |
| 85 | char *opt_away_arg = NULL; | |
| 86 | ||
| 87 | #if HAVE_SIGNAL_H | |
| 88 | /* | |
| 89 | * Lists of signals we wish to catch and those we wish to ignore. | |
| 90 | * Each list terminated with -1 | |
| 91 | */ | |
| 92 | static int catch_sig_list[] = { | |
| 93 | SIGSEGV, | |
| 94 | SIGHUP, | |
| 95 | SIGINT, | |
| 96 | SIGTERM, | |
| 97 | SIGQUIT, | |
| 98 | SIGCHLD, | |
| 99 | -1 | |
| 100 | }; | |
| 101 | ||
| 102 | static int ignore_sig_list[] = { | |
| 103 | SIGPIPE, | |
| 104 | -1 | |
| 105 | }; | |
| 106 | #endif | |
| 107 | ||
| 108 | static guint snd_tmout = 0; | |
| 109 | static gboolean sound_timeout(gpointer data) | |
| 110 | { | |
| 111 | gaim_gtk_sound_set_login_mute(FALSE); | |
| 112 | snd_tmout = 0; | |
| 113 | return FALSE; | |
| 114 | } | |
| 115 | ||
| 116 | /* we need to do this for Oscar because serv_login only starts the login | |
| 117 | * process, it doesn't end there. gaim_setup will be called later from | |
| 118 | * oscar.c, after the buddy list is made and serv_finish_login is called */ | |
| 119 | void gaim_setup(GaimConnection *gc) | |
| 120 | { | |
| 121 | if (gaim_prefs_get_bool("/gaim/gtk/sound/enabled/login")) { | |
| 122 | if (snd_tmout) | |
| 123 | g_source_remove(snd_tmout); | |
| 124 | gaim_gtk_sound_set_login_mute(TRUE); | |
| 125 | snd_tmout = gaim_timeout_add(10000, sound_timeout, NULL); | |
| 126 | } | |
| 127 | } | |
| 128 | ||
| 129 | static gboolean domiddleclick(GtkWidget *w, GdkEventButton *event, gpointer null) | |
| 130 | { | |
| 131 | if (event->button != 2) | |
| 132 | return FALSE; | |
| 133 | ||
| 134 | gaim_accounts_auto_login(GAIM_GTK_UI); | |
| 135 | ||
| 136 | return TRUE; | |
| 137 | } | |
| 138 | ||
| 139 | static void dologin(GtkWidget *widget, GtkWidget *w) | |
| 140 | { | |
| 141 | GaimAccount *account; | |
| 142 | GtkWidget *item; | |
| 143 | const char *password = gtk_entry_get_text(GTK_ENTRY(pass)); | |
| 144 | ||
| 145 | item = gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(name)))); | |
| 146 | account = g_object_get_data(G_OBJECT(item), "account"); | |
| 147 | ||
| 148 | if (!account) { | |
| 149 | gaim_notify_error(NULL, NULL, _("Please create an account."), NULL); | |
| 150 | return; | |
| 151 | } | |
| 152 | ||
| 153 | gaim_account_set_password(account, (*password != '\0') ? password : NULL); | |
| 154 | ||
| 155 | gaim_account_connect(account); | |
| 156 | } | |
| 157 | ||
| 158 | /* <name> is a comma-separated list of names, or NULL | |
| 159 | if NULL and there is at least one user defined in .gaimrc, try to login. | |
| 160 | if not NULL, parse <name> into separate strings, look up each one in | |
| 161 | .gaimrc and, if it's there, try to login. | |
| 162 | returns: 0 if successful | |
| 163 | -1 if no user was found that had a saved password | |
| 164 | */ | |
| 165 | static int dologin_named(char *name) | |
| 166 | { | |
| 167 | GaimAccount *account; | |
| 168 | char **names, **n; | |
| 169 | int retval = -1; | |
| 170 | ||
| 171 | if (name !=NULL) { /* list of names given */ | |
| 172 | names = g_strsplit(name, ",", 32); | |
| 173 | for (n = names; *n != NULL; n++) { | |
| 174 | account = gaim_accounts_find(*n, NULL); | |
| 175 | if (account) { /* found a user */ | |
| 176 | retval = 0; | |
| 177 | gaim_account_connect(account); | |
| 178 | } | |
| 179 | } | |
| 180 | g_strfreev(names); | |
| 181 | } else { /* no name given, use default */ | |
| 182 | account = (GaimAccount *)gaim_accounts_get_all()->data; | |
| 183 | retval = 0; | |
| 184 | gaim_account_connect(account); | |
| 185 | } | |
| 186 | ||
| 187 | return retval; | |
| 188 | } | |
| 189 | ||
| 190 | ||
| 191 | static void combo_changed(GtkWidget *menu, GaimAccount *account, gpointer data) | |
| 192 | { | |
| 193 | if (account && gaim_account_get_remember_password(account)) { | |
| 194 | gtk_entry_set_text(GTK_ENTRY(pass), account->password); | |
| 195 | } else { | |
| 196 | gtk_entry_set_text(GTK_ENTRY(pass), ""); | |
| 197 | } | |
| 198 | } | |
| 199 | ||
| 200 | ||
| 201 | static void login_window_closed(GtkWidget *w, GdkEvent *ev, gpointer d) | |
| 202 | { | |
| 203 | if(docklet_count) { | |
| 204 | #ifdef _WIN32 | |
| 205 | wgaim_systray_minimize(mainwindow); | |
| 206 | #endif | |
| 207 | gtk_widget_hide(mainwindow); | |
| 208 | } else | |
| 209 | gaim_core_quit(); | |
| 210 | } | |
| 211 | ||
| 212 | void show_login() | |
| 213 | { | |
| 214 | GtkWidget *image; | |
| 215 | GtkWidget *vbox; | |
| 216 | GtkWidget *button; | |
| 217 | GtkWidget *hbox; | |
| 218 | GtkWidget *label; | |
| 219 | GtkWidget *vbox2; | |
| 220 | ||
| 221 | /* Do we already have a main window opened? If so, bring it back, baby... ribs... yeah */ | |
| 222 | if (mainwindow) { | |
| 223 | gtk_window_present(GTK_WINDOW(mainwindow)); | |
| 224 | return; | |
| 225 | } | |
| 226 | ||
| 227 | mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 228 | ||
| 229 | gtk_window_set_role(GTK_WINDOW(mainwindow), "login"); | |
| 230 | gtk_window_set_resizable(GTK_WINDOW(mainwindow), FALSE); | |
| 231 | gtk_window_set_title(GTK_WINDOW(mainwindow), _("Login")); | |
| 232 | gtk_container_set_border_width(GTK_CONTAINER(mainwindow), 5); | |
| 233 | g_signal_connect(G_OBJECT(mainwindow), "delete_event", | |
| 234 | G_CALLBACK(login_window_closed), mainwindow); | |
| 235 | ||
| 236 | vbox = gtk_vbox_new(FALSE, 0); | |
| 237 | gtk_container_add(GTK_CONTAINER(mainwindow), vbox); | |
| 238 | ||
| 239 | image = gtk_image_new_from_stock(GAIM_STOCK_LOGO, gtk_icon_size_from_name(GAIM_ICON_SIZE_LOGO)); | |
| 240 | gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0); | |
| 241 | ||
| 242 | vbox2 = gtk_vbox_new(FALSE, 0); | |
| 243 | gtk_container_set_border_width(GTK_CONTAINER(vbox2), 5); | |
| 244 | ||
| 245 | /* why isn't there a gtk_label_new_with_markup? */ | |
| 246 | label = gtk_label_new(NULL); | |
| 247 | gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("<b>_Account:</b>")); | |
| 248 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 249 | gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0); | |
| 250 | ||
| 251 | name = gaim_gtk_account_option_menu_new(NULL, TRUE, G_CALLBACK(combo_changed), NULL, NULL); | |
| 252 | gtk_label_set_mnemonic_widget(GTK_LABEL(label), name); | |
| 253 | ||
| 254 | gtk_box_pack_start(GTK_BOX(vbox2), name, FALSE, TRUE, 0); | |
| 255 | gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, TRUE, 0); | |
| 256 | ||
| 257 | vbox2 = gtk_vbox_new(FALSE, 0); | |
| 258 | gtk_container_set_border_width(GTK_CONTAINER(vbox2), 5); | |
| 259 | ||
| 260 | label = gtk_label_new(NULL); | |
| 261 | gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("<b>_Password:</b>")); | |
| 262 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 263 | gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0); | |
| 264 | ||
| 265 | pass = gtk_entry_new(); | |
| 266 | gtk_label_set_mnemonic_widget(GTK_LABEL(label), pass); | |
| 267 | gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
| 268 | g_signal_connect(G_OBJECT(pass), "activate", | |
| 269 | G_CALLBACK(dologin), mainwindow); | |
| 270 | gtk_box_pack_start(GTK_BOX(vbox2), pass, FALSE, TRUE, 0); | |
| 271 | gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, TRUE, 0); | |
| 272 | ||
| 273 | /* Now for the button box */ | |
| 274 | hbox = gtk_hbox_new(TRUE, 0); | |
| 275 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 5); | |
| 276 | ||
| 277 | /* And now for the buttons */ | |
| 278 | button = gaim_pixbuf_button_from_stock(_("A_ccounts"), GAIM_STOCK_ACCOUNTS, GAIM_BUTTON_VERTICAL); | |
| 279 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
| 280 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 281 | G_CALLBACK(gaim_gtk_accounts_window_show), mainwindow); | |
| 282 | gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 283 | ||
| 284 | button = gaim_pixbuf_button_from_stock(_("P_references"), GTK_STOCK_PREFERENCES, GAIM_BUTTON_VERTICAL); | |
| 285 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
| 286 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 287 | G_CALLBACK(gaim_gtk_prefs_show), mainwindow); | |
| 288 | gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 289 | ||
| 290 | button = gaim_pixbuf_button_from_stock(_("_Log in"), GAIM_STOCK_SIGN_ON, GAIM_BUTTON_VERTICAL); | |
| 291 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
| 292 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 293 | G_CALLBACK(dologin), mainwindow); | |
| 294 | g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(domiddleclick), NULL); | |
| 295 | gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 296 | ||
| 297 | /* Now grab the focus that we need */ | |
| 298 | if (gaim_accounts_get_all()) { | |
| 299 | GaimAccount *account = gaim_accounts_get_all()->data; | |
| 300 | ||
| 301 | if (gaim_account_get_remember_password(account)) { | |
| 302 | combo_changed(NULL, account, NULL); | |
| 303 | gtk_widget_grab_focus(button); | |
| 304 | } else { | |
| 305 | gtk_widget_grab_focus(pass); | |
| 306 | } | |
| 307 | } else { | |
| 308 | gaim_gtk_accounts_window_show(); | |
| 309 | gtk_widget_grab_focus(button); | |
| 310 | } | |
| 311 | ||
| 312 | /* And raise the curtain! */ | |
| 313 | gtk_widget_show_all(mainwindow); | |
| 314 | ||
| 315 | } | |
| 316 | ||
| 317 | static void | |
| 318 | clean_pid(void) | |
| 319 | { | |
| 320 | #ifndef _WIN32 | |
| 321 | int status; | |
| 322 | pid_t pid; | |
| 323 | ||
| 324 | do { | |
| 325 | pid = waitpid(-1, &status, WNOHANG); | |
| 326 | } while (pid != 0 && pid != (pid_t)-1); | |
| 327 | if(pid == (pid_t)-1 && errno != ECHILD) { | |
| 328 | char errmsg[BUFSIZ]; | |
| 329 | snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid); | |
| 330 | perror(errmsg); | |
| 331 | } | |
| 332 | #endif | |
| 333 | } | |
| 334 | ||
| 335 | #if HAVE_SIGNAL_H | |
| 336 | void sighandler(int sig) | |
| 337 | { | |
| 338 | switch (sig) { | |
| 339 | case SIGHUP: | |
| 340 | gaim_debug(GAIM_DEBUG_WARNING, "sighandler", | |
| 341 | "Caught signal %d\n", sig); | |
| 342 | gaim_connections_disconnect_all(); | |
| 343 | break; | |
| 344 | case SIGSEGV: | |
| 345 | #ifndef DEBUG | |
| 346 | fprintf(stderr, "Gaim has segfaulted and attempted to dump a core file.\n" | |
| 347 | "This is a bug in the software and has happened through\n" | |
| 348 | "no fault of your own.\n\n" | |
| 349 | "It is possible that this bug is already fixed in CVS.\n" | |
| 350 | "If you can reproduce the crash, please notify the gaim\n" | |
| 351 | "maintainers by reporting a bug at\n" | |
| 352 | GAIM_WEBSITE "bug.php\n\n" | |
| 353 | "Please make sure to specify what you were doing at the time,\n" | |
| 354 | "and post the backtrace from the core file. If you do not know\n" | |
| 355 | "how to get the backtrace, please get instructions at\n" | |
| 356 | GAIM_WEBSITE "gdb.php. If you need further\n" | |
| 357 | "assistance, please IM either RobFlynn or SeanEgn and\n" | |
| 358 | "they can help you.\n"); | |
| 359 | #else | |
| 360 | fprintf(stderr, "Hi, user. We need to talk.\n" | |
| 361 | "I think something's gone wrong here. It's probably my fault.\n" | |
| 362 | "No, really, it's not you... it's me... no no no, I think we get along well\n" | |
| 363 | "it's just that.... well, I want to see other people. I... what?!? NO! I haven't\n" | |
| 364 | "been cheating on you!! How many times do you want me to tell you?! And for the\n" | |
| 365 | "last time, it's just a rash!\n"); | |
| 366 | /*g_on_error_query (g_get_prgname());*/ | |
| 367 | #endif | |
| 368 | abort(); | |
| 369 | break; | |
| 370 | case SIGCHLD: | |
| 371 | clean_pid(); | |
| 372 | #if HAVE_SIGNAL_H | |
| 373 | signal(SIGCHLD, sighandler); /* restore signal catching on this one! */ | |
| 374 | #endif | |
| 375 | break; | |
| 376 | default: | |
| 377 | gaim_debug(GAIM_DEBUG_WARNING, "sighandler", | |
| 378 | "Caught signal %d\n", sig); | |
| 379 | gaim_connections_disconnect_all(); | |
| 380 | ||
| 381 | gaim_plugins_unload_all(); | |
| 382 | ||
| 383 | if (gtk_main_level()) | |
| 384 | gtk_main_quit(); | |
| 385 | exit(0); | |
| 386 | } | |
| 387 | } | |
| 388 | #endif | |
| 389 | ||
| 390 | static int ui_main() | |
| 391 | { | |
| 392 | #ifndef _WIN32 | |
| 393 | GList *icons = NULL; | |
| 394 | GdkPixbuf *icon = NULL; | |
| 395 | char *icon_path; | |
| 396 | #endif | |
| 397 | ||
| 398 | if (current_smiley_theme == NULL) { | |
| 399 | smiley_theme_probe(); | |
| 400 | if (smiley_themes) { | |
| 401 | struct smiley_theme *smile = smiley_themes->data; | |
| 402 | load_smiley_theme(smile->path, TRUE); | |
| 403 | } | |
| 404 | } | |
| 405 | ||
| 406 | gaim_gtk_blist_setup_sort_methods(); | |
| 407 | ||
| 408 | #ifndef _WIN32 | |
| 409 | /* use the nice PNG icon for all the windows */ | |
| 410 | icon_path = g_build_filename(DATADIR, "pixmaps", "gaim", "icons", "online.png", NULL); | |
| 411 | icon = gdk_pixbuf_new_from_file(icon_path, NULL); | |
| 412 | g_free(icon_path); | |
| 413 | if (icon) { | |
| 414 | icons = g_list_append(icons,icon); | |
| 415 | gtk_window_set_default_icon_list(icons); | |
| 416 | g_object_unref(G_OBJECT(icon)); | |
| 417 | g_list_free(icons); | |
| 418 | } else { | |
| 419 | gaim_debug(GAIM_DEBUG_ERROR, "ui_main", | |
| 420 | "Failed to load the default window icon!\n"); | |
| 421 | } | |
| 422 | #endif | |
| 423 | ||
| 424 | return 0; | |
| 425 | } | |
| 426 | ||
| 427 | static void set_first_user(const char *name) | |
| 428 | { | |
| 429 | GaimAccount *account; | |
| 430 | ||
| 431 | account = gaim_accounts_find(name, NULL); | |
| 432 | ||
| 433 | /* Place it as the first user. */ | |
| 434 | if (account != NULL) | |
| 435 | gaim_accounts_reorder(account, 0); | |
| 436 | } | |
| 437 | ||
| 438 | static void | |
| 439 | debug_init(void) | |
| 440 | { | |
| 441 | gaim_debug_set_ui_ops(gaim_gtk_debug_get_ui_ops()); | |
| 442 | gaim_gtk_debug_init(); | |
| 443 | } | |
| 444 | ||
| 445 | static void | |
| 446 | gaim_gtk_ui_init(void) | |
| 447 | { | |
| 448 | /* Set the UI operation structures. */ | |
| 449 | gaim_accounts_set_ui_ops(gaim_gtk_accounts_get_ui_ops()); | |
| 450 | gaim_conversations_set_win_ui_ops(gaim_gtk_conversations_get_win_ui_ops()); | |
| 451 | gaim_xfers_set_ui_ops(gaim_gtk_xfers_get_ui_ops()); | |
| 452 | gaim_blist_set_ui_ops(gaim_gtk_blist_get_ui_ops()); | |
| 453 | gaim_notify_set_ui_ops(gaim_gtk_notify_get_ui_ops()); | |
| 454 | gaim_privacy_set_ui_ops(gaim_gtk_privacy_get_ui_ops()); | |
| 455 | gaim_request_set_ui_ops(gaim_gtk_request_get_ui_ops()); | |
| 456 | gaim_sound_set_ui_ops(gaim_gtk_sound_get_ui_ops()); | |
| 457 | gaim_connections_set_ui_ops(gaim_gtk_connections_get_ui_ops()); | |
| 458 | ||
| 459 | gaim_gtk_stock_init(); | |
| 460 | gaim_gtk_prefs_init(); | |
| 461 | gaim_gtk_account_init(); | |
| 462 | gaim_gtk_blist_init(); | |
| 463 | gaim_gtk_conversations_init(); | |
| 464 | gaim_gtk_pounces_init(); | |
| 465 | gaim_gtk_privacy_init(); | |
| 466 | gaim_gtk_xfers_init(); | |
| 467 | gaim_gtk_roomlist_init(); | |
| 468 | } | |
| 469 | ||
| 470 | static void | |
| 471 | gaim_gtk_quit(void) | |
| 472 | { | |
| 473 | /* XXX? */ | |
| 474 | /* YYY is there an XXX here? */ | |
| 475 | ||
| 476 | /* captain's log, stardate... */ | |
| 477 | /* LOG system_log(log_quit, NULL, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); */ | |
| 478 | ||
| 479 | #ifdef USE_SM | |
| 480 | /* unplug */ | |
| 481 | session_end(); | |
| 482 | #endif | |
| 483 | ||
| 484 | /* Save the plugins we have loaded for next time. */ | |
| 485 | gaim_gtk_plugins_save(); | |
| 486 | ||
| 487 | /* and end it all... */ | |
| 488 | gtk_main_quit(); | |
| 489 | } | |
| 490 | ||
| 491 | static GaimCoreUiOps core_ops = | |
| 492 | { | |
| 493 | gaim_gtk_prefs_init, | |
| 494 | debug_init, | |
| 495 | gaim_gtk_ui_init, | |
| 496 | gaim_gtk_quit | |
| 497 | }; | |
| 498 | ||
| 499 | static GaimCoreUiOps * | |
| 500 | gaim_gtk_core_get_ui_ops(void) | |
| 501 | { | |
| 502 | return &core_ops; | |
| 503 | } | |
| 504 | ||
| 505 | static void | |
| 506 | show_usage(int mode, const char *name) | |
| 507 | { | |
| 508 | char *text=NULL; | |
| 509 | ||
| 510 | switch (mode) { | |
| 511 | case 0: /* full help text */ | |
| 512 | text=g_strdup_printf(_("Gaim %s\n" | |
| 513 | "Usage: %s [OPTION]...\n\n" | |
| 514 | " -a, --acct display account editor window\n" | |
| 515 | " -w, --away[=MESG] make away on signon (optional argument MESG specifies\n" | |
| 516 | " name of away message to use)\n" | |
| 517 | " -l, --login[=NAME] automatically login (optional argument NAME specifies\n" | |
| 518 | " account(s) to use, seperated by commas)\n" | |
| 519 | " -n, --loginwin don't automatically login; show login window\n" | |
| 520 | " -u, --user=NAME use account NAME\n" | |
| 521 | " -c, --config=DIR use DIR for config files\n" | |
| 522 | " -d, --debug print debugging messages to stdout\n" | |
| 523 | " -v, --version display the current version and exit\n" | |
| 524 | " -h, --help display this help and exit\n"), VERSION, name); | |
| 525 | break; | |
| 526 | case 1: /* short message */ | |
| 527 | text=g_strdup_printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); | |
| 528 | break; | |
| 529 | } | |
| 530 | ||
| 531 | if(text) { | |
| 532 | char *text_conv; | |
| 533 | GError *error=NULL; | |
| 534 | ||
| 535 | /* tries to convert 'text' to users locale */ | |
| 536 | text_conv=g_locale_from_utf8(text,-1,NULL,NULL,&error); | |
| 537 | if(text_conv) { | |
| 538 | puts(text_conv); | |
| 539 | g_free(text_conv); | |
| 540 | } | |
| 541 | /* use 'text' as a fallback */ | |
| 542 | else { | |
| 543 | g_warning("%s\n", error->message); | |
| 544 | g_error_free(error); | |
| 545 | puts(text); | |
| 546 | } | |
| 547 | g_free(text); | |
| 548 | } | |
| 549 | } | |
| 550 | ||
| 551 | #ifdef HAVE_STARTUP_NOTIFICATION | |
| 552 | static void | |
| 553 | sn_error_trap_push(SnDisplay *display, Display *xdisplay) | |
| 554 | { | |
| 555 | gdk_error_trap_push(); | |
| 556 | } | |
| 557 | ||
| 558 | static void | |
| 559 | sn_error_trap_pop(SnDisplay *display, Display *xdisplay) | |
| 560 | { | |
| 561 | gdk_error_trap_pop(); | |
| 562 | } | |
| 563 | ||
| 564 | static void | |
| 565 | startup_notification_complete(void) | |
| 566 | { | |
| 567 | Display *xdisplay; | |
| 568 | ||
| 569 | xdisplay = GDK_DISPLAY(); | |
| 570 | sn_display = sn_display_new(xdisplay, | |
| 571 | sn_error_trap_push, | |
| 572 | sn_error_trap_pop); | |
| 573 | sn_context = | |
| 574 | sn_launchee_context_new_from_environment(sn_display, | |
| 575 | DefaultScreen(xdisplay)); | |
| 576 | ||
| 577 | if (sn_context != NULL) | |
| 578 | { | |
| 579 | sn_launchee_context_complete(sn_context); | |
| 580 | sn_launchee_context_unref(sn_context); | |
| 581 | ||
| 582 | sn_display_unref(sn_display); | |
| 583 | } | |
| 584 | } | |
| 585 | #endif /* HAVE_STARTUP_NOTIFICATION */ | |
| 586 | ||
| 587 | #ifndef _WIN32 | |
| 588 | static char *gaim_find_binary_location(void *symbol, void *data) | |
| 589 | { | |
| 590 | static char *fullname = NULL; | |
| 591 | static gboolean first = TRUE; | |
| 592 | ||
| 593 | char *argv0 = data; | |
| 594 | struct stat st; | |
| 595 | char *basebuf, *linkbuf, *fullbuf; | |
| 596 | ||
| 597 | if (!first) | |
| 598 | /* We've already been through this. */ | |
| 599 | return strdup(fullname); | |
| 600 | ||
| 601 | first = FALSE; | |
| 602 | ||
| 603 | if (!argv0) | |
| 604 | return NULL; | |
| 605 | ||
| 606 | ||
| 607 | basebuf = g_find_program_in_path(argv0); | |
| 608 | ||
| 609 | /* But we still need to deal with symbolic links */ | |
| 610 | lstat(basebuf, &st); | |
| 611 | while ((st.st_mode & S_IFLNK) == S_IFLNK) { | |
| 612 | linkbuf = g_malloc(1024); | |
| 613 | readlink(basebuf, linkbuf, 1024); | |
| 614 | if (linkbuf[0] == G_DIR_SEPARATOR) { | |
| 615 | /* an absolute path */ | |
| 616 | fullbuf = g_strdup(linkbuf); | |
| 617 | } else { | |
| 618 | char *dirbuf = g_path_get_dirname(basebuf); | |
| 619 | /* a relative path */ | |
| 620 | fullbuf = g_strdup_printf("%s%s%s", | |
| 621 | dirbuf, G_DIR_SEPARATOR_S, | |
| 622 | linkbuf); | |
| 623 | g_free(dirbuf); | |
| 624 | } | |
| 625 | /* There's no memory leak here. Really! */ | |
| 626 | g_free(linkbuf); | |
| 627 | g_free(basebuf); | |
| 628 | basebuf = fullbuf; | |
| 629 | lstat(basebuf, &st); | |
| 630 | } | |
| 631 | ||
| 632 | fullname = basebuf; | |
| 633 | return strdup(fullname); | |
| 634 | } | |
| 635 | #endif /* #ifndef _WIN32 */ | |
| 636 | ||
| 637 | /* FUCKING GET ME A TOWEL! */ | |
| 638 | #ifdef _WIN32 | |
| 639 | int gaim_main(HINSTANCE hint, int argc, char *argv[]) | |
| 640 | #else | |
| 641 | int main(int argc, char *argv[]) | |
| 642 | #endif | |
| 643 | { | |
| 644 | int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1; | |
| 645 | char *opt_user_arg = NULL, *opt_login_arg = NULL; | |
| 646 | char *opt_session_arg = NULL, *opt_config_dir_arg = NULL; | |
| 647 | char *plugin_search_paths[3]; | |
| 648 | #if HAVE_SIGNAL_H | |
| 649 | int sig_indx; /* for setting up signal catching */ | |
| 650 | sigset_t sigset; | |
| 651 | void (*prev_sig_disp)(); | |
| 652 | #endif | |
| 653 | int opt, opt_user = 0; | |
| 654 | int i; | |
| 655 | gboolean gui_check; | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
656 | gboolean debug_enabled; |
| 10302 | 657 | gchar *gaimrc, *accountsxml; |
| 658 | ||
| 659 | struct option long_options[] = { | |
| 660 | {"acct", no_argument, NULL, 'a'}, | |
| 661 | /*{"away", optional_argument, NULL, 'w'}, */ | |
| 662 | {"help", no_argument, NULL, 'h'}, | |
| 663 | /*{"login", optional_argument, NULL, 'l'}, */ | |
| 664 | {"loginwin", no_argument, NULL, 'n'}, | |
| 665 | {"user", required_argument, NULL, 'u'}, | |
| 666 | {"config", required_argument, NULL, 'c'}, | |
| 667 | {"debug", no_argument, NULL, 'd'}, | |
| 668 | {"version", no_argument, NULL, 'v'}, | |
| 669 | {"session", required_argument, NULL, 's'}, | |
| 670 | {0, 0, 0, 0} | |
| 671 | }; | |
| 672 | ||
| 673 | #ifdef DEBUG | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
674 | debug_enabled = TRUE; |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
675 | #else |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
676 | debug_enabled = FALSE; |
| 10302 | 677 | #endif |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
678 | |
| 10302 | 679 | #ifndef _WIN32 |
| 680 | br_set_locate_fallback_func(gaim_find_binary_location, argv[0]); | |
| 681 | #endif | |
| 682 | #ifdef ENABLE_NLS | |
| 683 | bindtextdomain(PACKAGE, LOCALEDIR); | |
| 684 | bind_textdomain_codeset(PACKAGE, "UTF-8"); | |
| 685 | textdomain(PACKAGE); | |
| 686 | #endif | |
| 687 | ||
| 688 | #if HAVE_SIGNAL_H | |
| 689 | /* Let's not violate any PLA's!!!! */ | |
| 690 | /* jseymour: whatever the fsck that means */ | |
| 691 | /* Robot101: for some reason things like gdm like to block * | |
| 692 | * useful signals like SIGCHLD, so we unblock all the ones we * | |
| 693 | * declare a handler for. thanks JSeymour and Vann. */ | |
| 694 | if (sigemptyset(&sigset)) { | |
| 695 | char errmsg[BUFSIZ]; | |
| 696 | snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set"); | |
| 697 | perror(errmsg); | |
| 698 | } | |
| 699 | for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { | |
| 700 | if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { | |
| 701 | char errmsg[BUFSIZ]; | |
| 702 | snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching", | |
| 703 | catch_sig_list[sig_indx]); | |
| 704 | perror(errmsg); | |
| 705 | } | |
| 706 | if(sigaddset(&sigset, catch_sig_list[sig_indx])) { | |
| 707 | char errmsg[BUFSIZ]; | |
| 708 | snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking", | |
| 709 | catch_sig_list[sig_indx]); | |
| 710 | perror(errmsg); | |
| 711 | } | |
| 712 | } | |
| 713 | for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { | |
| 714 | if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { | |
| 715 | char errmsg[BUFSIZ]; | |
| 716 | snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore", | |
| 717 | ignore_sig_list[sig_indx]); | |
| 718 | perror(errmsg); | |
| 719 | } | |
| 720 | } | |
| 721 | ||
| 722 | if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { | |
| 723 | char errmsg[BUFSIZ]; | |
| 724 | snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals"); | |
| 725 | perror(errmsg); | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
726 | } |
| 10302 | 727 | #endif |
| 728 | ||
| 729 | for (i = 0; i < argc; i++) { | |
| 730 | /* --login option */ | |
| 731 | if (strstr(argv[i], "--l") == argv[i]) { | |
| 732 | char *equals; | |
| 733 | opt_login = 1; | |
| 734 | if ((equals = strchr(argv[i], '=')) != NULL) { | |
| 735 | /* --login=NAME */ | |
| 736 | opt_login_arg = g_strdup(equals + 1); | |
| 737 | if (strlen(opt_login_arg) == 0) { | |
| 738 | g_free(opt_login_arg); | |
| 739 | opt_login_arg = NULL; | |
| 740 | } | |
| 741 | } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
| 742 | /* --login NAME */ | |
| 743 | opt_login_arg = g_strdup(argv[i + 1]); | |
| 744 | strcpy(argv[i + 1], " "); | |
| 745 | } | |
| 746 | strcpy(argv[i], " "); | |
| 747 | } | |
| 748 | /* -l option */ | |
| 749 | else if (strstr(argv[i], "-l") == argv[i]) { | |
| 750 | opt_login = 1; | |
| 751 | if (strlen(argv[i]) > 2) { | |
| 752 | /* -lNAME */ | |
| 753 | opt_login_arg = g_strdup(argv[i] + 2); | |
| 754 | } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
| 755 | /* -l NAME */ | |
| 756 | opt_login_arg = g_strdup(argv[i + 1]); | |
| 757 | strcpy(argv[i + 1], " "); | |
| 758 | } | |
| 759 | strcpy(argv[i], " "); | |
| 760 | } | |
| 761 | /* --away option */ | |
| 762 | else if (strstr(argv[i], "--aw") == argv[i]) { | |
| 763 | char *equals; | |
| 764 | opt_away = 1; | |
| 765 | if ((equals = strchr(argv[i], '=')) != NULL) { | |
| 766 | /* --away=MESG */ | |
| 767 | opt_away_arg = g_strdup(equals + 1); | |
| 768 | if (strlen(opt_away_arg) == 0) { | |
| 769 | g_free(opt_away_arg); | |
| 770 | opt_away_arg = NULL; | |
| 771 | } | |
| 772 | } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
| 773 | /* --away MESG */ | |
| 774 | opt_away_arg = g_strdup(argv[i + 1]); | |
| 775 | strcpy(argv[i + 1], " "); | |
| 776 | } | |
| 777 | strcpy(argv[i], " "); | |
| 778 | } | |
| 779 | /* -w option */ | |
| 780 | else if (strstr(argv[i], "-w") == argv[i]) { | |
| 781 | opt_away = 1; | |
| 782 | if (strlen(argv[i]) > 2) { | |
| 783 | /* -wMESG */ | |
| 784 | opt_away_arg = g_strdup(argv[i] + 2); | |
| 785 | } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
| 786 | /* -w MESG */ | |
| 787 | opt_away_arg = g_strdup(argv[i + 1]); | |
| 788 | strcpy(argv[i + 1], " "); | |
| 789 | } | |
| 790 | strcpy(argv[i], " "); | |
| 791 | } | |
| 792 | } | |
| 793 | /* | |
| 794 | if (opt_login) { | |
| 795 | printf ("--login given with arg %s\n", | |
| 796 | opt_login_arg ? opt_login_arg : "NULL"); | |
| 797 | exit(0); | |
| 798 | } | |
| 799 | */ | |
| 800 | ||
| 801 | gui_check = gtk_init_check(&argc, &argv); | |
| 802 | ||
| 803 | /* scan command-line options */ | |
| 804 | opterr = 1; | |
| 805 | while ((opt = getopt_long(argc, argv, | |
| 806 | #ifndef _WIN32 | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
807 | "adhu:c:vns:", |
| 10302 | 808 | #else |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
809 | "adhu:c:vn", |
| 10302 | 810 | #endif |
| 811 | long_options, NULL)) != -1) { | |
| 812 | switch (opt) { | |
| 813 | case 'u': /* set user */ | |
| 814 | opt_user = 1; | |
| 815 | opt_user_arg = g_strdup(optarg); | |
| 816 | break; | |
| 817 | case 'a': /* account editor */ | |
| 818 | opt_acct = 1; | |
| 819 | break; | |
| 820 | case 'd': /* debug */ | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
821 | debug_enabled = TRUE; |
| 10302 | 822 | break; |
| 823 | case 'c': /* use specified config dir */ | |
| 824 | set_gaim_user_dir(optarg); | |
| 825 | opt_config_dir_arg = g_strdup(optarg); | |
| 826 | break; | |
| 827 | case 's': /* use existing session ID */ | |
| 828 | opt_session_arg = g_strdup(optarg); | |
| 829 | break; | |
| 830 | case 'v': /* version */ | |
| 831 | opt_version = 1; | |
| 832 | break; | |
| 833 | case 'h': /* help */ | |
| 834 | opt_help = 1; | |
| 835 | break; | |
| 836 | case 'n': /* don't autologin */ | |
| 837 | opt_nologin = 1; | |
| 838 | break; | |
| 839 | case '?': | |
| 840 | default: | |
| 841 | show_usage(1, argv[0]); | |
| 842 | return 0; | |
| 843 | break; | |
| 844 | } | |
| 845 | } | |
| 846 | ||
| 847 | /* show help message */ | |
| 848 | if (opt_help) { | |
| 849 | show_usage(0, argv[0]); | |
| 850 | return 0; | |
| 851 | } | |
| 852 | /* show version message */ | |
| 853 | if (opt_version) { | |
| 854 | printf("Gaim %s\n",VERSION); | |
| 855 | return 0; | |
| 856 | } | |
| 857 | ||
| 858 | if (!gui_check) { | |
| 859 | char *display = gdk_get_display(); | |
| 860 | ||
| 861 | g_warning("cannot open display: %s", display ? display : "unset"); | |
| 862 | g_free(display); | |
| 863 | ||
| 864 | return 1; | |
| 865 | } | |
| 866 | ||
| 867 | #ifdef _WIN32 | |
| 868 | wgaim_init(hint); | |
| 869 | #endif | |
| 870 | gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops()); | |
| 871 | gaim_eventloop_set_ui_ops(gaim_gtk_eventloop_get_ui_ops()); | |
| 872 | ||
| 873 | if (!gaim_core_init(GAIM_GTK_UI)) { | |
| 874 | fprintf(stderr, | |
| 875 | "Initialization of the Gaim core failed. Dumping core.\n" | |
| 876 | "Please report this!\n"); | |
| 877 | abort(); | |
| 878 | } | |
| 879 | ||
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
880 | gaim_debug_set_enabled(debug_enabled); |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
881 | |
| 10302 | 882 | plugin_search_paths[0] = g_strdup(LIBDIR); |
| 883 | plugin_search_paths[1] = gaim_user_dir(); | |
| 884 | plugin_search_paths[2] = g_build_filename(gaim_user_dir(), "plugins", NULL); | |
| 885 | ||
| 886 | gaim_plugins_set_search_paths(sizeof(plugin_search_paths) / | |
| 887 | sizeof(*plugin_search_paths), | |
| 888 | plugin_search_paths); | |
| 889 | ||
| 890 | g_free(plugin_search_paths[0]); | |
| 891 | g_free(plugin_search_paths[2]); | |
| 892 | ||
| 893 | gaim_plugins_probe(NULL); | |
| 894 | ||
| 895 | /* XXX - Remove this check. Maybe in 2005. --KingAnt, 25 Jul 2004 */ | |
| 896 | gaimrc = g_build_filename(gaim_home_dir(), ".gaimrc", NULL); | |
| 897 | accountsxml = g_build_filename(gaim_user_dir(), "accounts.xml", NULL); | |
| 898 | if (g_file_test(gaimrc, G_FILE_TEST_EXISTS) && | |
| 899 | !g_file_test(accountsxml, G_FILE_TEST_EXISTS)) { | |
| 900 | gaim_notify_error(NULL, NULL, _("Unable to load preferences"), _("Gaim was not able to load your preferences because they are stored in an old format that is no longer used. Please reconfigure your settings using the Preferences window.")); | |
| 901 | } | |
| 902 | g_free(gaimrc); | |
| 903 | g_free(accountsxml); | |
| 904 | ||
| 905 | gaim_accounts_load(); | |
| 906 | ||
| 907 | gaim_set_blist(gaim_blist_new()); | |
| 908 | gaim_blist_load(); | |
| 909 | ||
| 910 | gaim_prefs_load(); | |
| 911 | gaim_prefs_update_old(); | |
| 912 | gaim_gtk_prefs_update_old(); | |
| 913 | ||
| 914 | /* load plugins we had when we quit */ | |
| 915 | gaim_plugins_load_saved("/gaim/gtk/plugins/loaded"); | |
| 916 | ||
| 917 | gaim_pounces_load(); | |
| 918 | gaim_statuses_load(); | |
| 919 | ||
| 920 | ui_main(); | |
| 921 | ||
| 922 | #ifdef USE_SM | |
| 923 | session_init(argv[0], opt_session_arg, opt_config_dir_arg); | |
| 924 | #endif | |
| 925 | if (opt_session_arg != NULL) { | |
| 926 | g_free(opt_session_arg); | |
| 927 | opt_session_arg = NULL; | |
| 928 | } | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
929 | |
| 10302 | 930 | if (opt_config_dir_arg != NULL) { |
| 931 | g_free(opt_config_dir_arg); | |
| 932 | opt_config_dir_arg = NULL; | |
| 933 | } | |
| 934 | ||
| 935 | /* set the default username */ | |
| 936 | if (opt_user_arg != NULL) { | |
| 937 | set_first_user(opt_user_arg); | |
| 938 | g_free(opt_user_arg); | |
| 939 | opt_user_arg = NULL; | |
| 940 | } | |
| 941 | ||
| 942 | if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled")) | |
| 943 | gaim_gtk_debug_window_show(); | |
| 944 | ||
| 945 | /* deal with --login */ | |
| 946 | if (opt_login) { | |
| 947 | dologin_ret = dologin_named(opt_login_arg); | |
| 948 | if (opt_login_arg != NULL) { | |
| 949 | g_free(opt_login_arg); | |
| 950 | opt_login_arg = NULL; | |
| 951 | } | |
| 952 | } | |
| 953 | ||
| 954 | if (!opt_acct && !opt_nologin) | |
| 955 | gaim_accounts_auto_login(GAIM_GTK_UI); | |
| 956 | ||
| 957 | if (opt_acct) { | |
| 958 | gaim_gtk_accounts_window_show(); | |
| 959 | } else if ((dologin_ret == -1) && !gaim_connections_get_all()) | |
| 960 | show_login(); | |
| 961 | ||
| 962 | #ifdef HAVE_STARTUP_NOTIFICATION | |
| 963 | startup_notification_complete(); | |
| 964 | #endif | |
| 965 | gtk_main(); | |
| 966 | gaim_sound_shutdown(); | |
| 967 | #ifdef _WIN32 | |
| 968 | wgaim_cleanup(); | |
| 969 | #endif | |
| 970 | ||
| 971 | ||
| 972 | return 0; | |
| 973 | ||
| 974 | } |