Mercurial > pidgin
comparison src/gtkmain.c @ 10323:bb2514e075db
[gaim-migrate @ 11530]
Completely remove the gaim -away option or gaim -w or whatever because
it didn't work. Use getopt for everything instead of looking at
argc/argv ourselves. If we don't have any accounts, then open the
account editor. Alphabetize a few things? Maybe change --loginwin to
-nologin?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 06 Dec 2004 00:34:42 +0000 |
parents | 2a132b73a6e6 |
children | 8d42237564f6 |
comparison
equal
deleted
inserted
replaced
10322:2a132b73a6e6 | 10323:bb2514e075db |
---|---|
73 #ifdef HAVE_STARTUP_NOTIFICATION | 73 #ifdef HAVE_STARTUP_NOTIFICATION |
74 static SnLauncheeContext *sn_context = NULL; | 74 static SnLauncheeContext *sn_context = NULL; |
75 static SnDisplay *sn_display = NULL; | 75 static SnDisplay *sn_display = NULL; |
76 #endif | 76 #endif |
77 | 77 |
78 int opt_away = 0; | |
79 int docklet_count = 0; | 78 int docklet_count = 0; |
80 char *opt_away_arg = NULL; | |
81 | 79 |
82 #if HAVE_SIGNAL_H | 80 #if HAVE_SIGNAL_H |
83 /* | 81 /* |
84 * Lists of signals we wish to catch and those we wish to ignore. | 82 * Lists of signals we wish to catch and those we wish to ignore. |
85 * Each list terminated with -1 | 83 * Each list terminated with -1 |
98 SIGPIPE, | 96 SIGPIPE, |
99 -1 | 97 -1 |
100 }; | 98 }; |
101 #endif | 99 #endif |
102 | 100 |
103 static int dologin_named(char *name) | 101 static int |
102 dologin_named(const char *name) | |
104 { | 103 { |
105 GaimAccount *account; | 104 GaimAccount *account; |
106 char **names, **n; | 105 char **names; |
107 int retval = -1; | 106 int i; |
108 | 107 int ret = -1; |
109 if (name !=NULL) { /* list of names given */ | 108 |
110 names = g_strsplit(name, ",", 32); | 109 if (name != NULL) { /* list of names given */ |
111 for (n = names; *n != NULL; n++) { | 110 names = g_strsplit(name, ",", 64); |
112 account = gaim_accounts_find(*n, NULL); | 111 for (i = 0; names[i] != NULL; i++) { |
113 if (account) { /* found a user */ | 112 account = gaim_accounts_find(names[i], NULL); |
114 retval = 0; | 113 if (account != NULL) { /* found a user */ |
114 ret = 0; | |
115 gaim_account_connect(account); | 115 gaim_account_connect(account); |
116 } | 116 } |
117 } | 117 } |
118 g_strfreev(names); | 118 g_strfreev(names); |
119 } else { /* no name given, use default */ | 119 } else { /* no name given, use the first account */ |
120 account = (GaimAccount *)gaim_accounts_get_all()->data; | 120 account = (GaimAccount *)gaim_accounts_get_all()->data; |
121 retval = 0; | 121 ret = 0; |
122 gaim_account_connect(account); | 122 gaim_account_connect(account); |
123 } | 123 } |
124 | 124 |
125 return retval; | 125 return ret; |
126 } | 126 } |
127 | 127 |
128 static void | 128 static void |
129 clean_pid(void) | 129 clean_pid(void) |
130 { | 130 { |
142 } | 142 } |
143 #endif | 143 #endif |
144 } | 144 } |
145 | 145 |
146 #if HAVE_SIGNAL_H | 146 #if HAVE_SIGNAL_H |
147 void sighandler(int sig) | 147 void |
148 sighandler(int sig) | |
148 { | 149 { |
149 switch (sig) { | 150 switch (sig) { |
150 case SIGHUP: | 151 case SIGHUP: |
151 gaim_debug(GAIM_DEBUG_WARNING, "sighandler", | 152 gaim_debug_warning("sighandler", "Caught signal %d\n", sig); |
152 "Caught signal %d\n", sig); | |
153 gaim_connections_disconnect_all(); | 153 gaim_connections_disconnect_all(); |
154 break; | 154 break; |
155 case SIGSEGV: | 155 case SIGSEGV: |
156 #ifndef DEBUG | 156 #ifndef DEBUG |
157 fprintf(stderr, "Gaim has segfaulted and attempted to dump a core file.\n" | 157 fprintf(stderr, "Gaim has segfaulted and attempted to dump a core file.\n" |
158 "This is a bug in the software and has happened through\n" | 158 "This is a bug in the software and has happened through\n" |
159 "no fault of your own.\n\n" | 159 "no fault of your own.\n\n" |
160 "It is possible that this bug is already fixed in CVS.\n" | 160 "It is possible that this bug is already fixed in CVS.\n" |
161 "If you can reproduce the crash, please notify the gaim\n" | 161 "If you can reproduce the crash, please notify the gaim\n" |
162 "maintainers by reporting a bug at\n" | 162 "maintainers by reporting a bug at\n" |
163 GAIM_WEBSITE "bug.php\n\n" | 163 GAIM_WEBSITE "bug.php\n\n" |
164 "Please make sure to specify what you were doing at the time,\n" | 164 "Please make sure to specify what you were doing at the time,\n" |
165 "and post the backtrace from the core file. If you do not know\n" | 165 "and post the backtrace from the core file. If you do not know\n" |
166 "how to get the backtrace, please get instructions at\n" | 166 "how to get the backtrace, please get instructions at\n" |
183 #if HAVE_SIGNAL_H | 183 #if HAVE_SIGNAL_H |
184 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */ | 184 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */ |
185 #endif | 185 #endif |
186 break; | 186 break; |
187 default: | 187 default: |
188 gaim_debug(GAIM_DEBUG_WARNING, "sighandler", | 188 gaim_debug_warning("sighandler", "Caught signal %d\n", sig); |
189 "Caught signal %d\n", sig); | |
190 gaim_connections_disconnect_all(); | 189 gaim_connections_disconnect_all(); |
191 | 190 |
192 gaim_plugins_unload_all(); | 191 gaim_plugins_unload_all(); |
193 | 192 |
194 if (gtk_main_level()) | 193 if (gtk_main_level()) |
196 exit(0); | 195 exit(0); |
197 } | 196 } |
198 } | 197 } |
199 #endif | 198 #endif |
200 | 199 |
201 static int ui_main() | 200 static int |
201 ui_main() | |
202 { | 202 { |
203 #ifndef _WIN32 | 203 #ifndef _WIN32 |
204 GList *icons = NULL; | 204 GList *icons = NULL; |
205 GdkPixbuf *icon = NULL; | 205 GdkPixbuf *icon = NULL; |
206 char *icon_path; | 206 char *icon_path; |
207 #endif | 207 #endif |
208 | 208 |
209 if (current_smiley_theme == NULL) { | 209 if (current_smiley_theme == NULL) { |
210 smiley_theme_probe(); | 210 smiley_theme_probe(); |
211 if (smiley_themes) { | 211 if (smiley_themes != NULL) { |
212 struct smiley_theme *smile = smiley_themes->data; | 212 struct smiley_theme *smile = smiley_themes->data; |
213 load_smiley_theme(smile->path, TRUE); | 213 load_smiley_theme(smile->path, TRUE); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
225 icons = g_list_append(icons,icon); | 225 icons = g_list_append(icons,icon); |
226 gtk_window_set_default_icon_list(icons); | 226 gtk_window_set_default_icon_list(icons); |
227 g_object_unref(G_OBJECT(icon)); | 227 g_object_unref(G_OBJECT(icon)); |
228 g_list_free(icons); | 228 g_list_free(icons); |
229 } else { | 229 } else { |
230 gaim_debug(GAIM_DEBUG_ERROR, "ui_main", | 230 gaim_debug_error("ui_main", |
231 "Failed to load the default window icon!\n"); | 231 "Failed to load the default window icon!\n"); |
232 } | 232 } |
233 #endif | 233 #endif |
234 | 234 |
235 return 0; | 235 return 0; |
236 } | |
237 | |
238 static void set_first_user(const char *name) | |
239 { | |
240 GaimAccount *account; | |
241 | |
242 account = gaim_accounts_find(name, NULL); | |
243 | |
244 /* Place it as the first user. */ | |
245 if (account != NULL) | |
246 gaim_accounts_reorder(account, 0); | |
247 } | 236 } |
248 | 237 |
249 static void | 238 static void |
250 debug_init(void) | 239 debug_init(void) |
251 { | 240 { |
327 "Usage: %s [OPTION]...\n\n" | 316 "Usage: %s [OPTION]...\n\n" |
328 " -a, --acct display account editor window\n" | 317 " -a, --acct display account editor window\n" |
329 " -c, --config=DIR use DIR for config files\n" | 318 " -c, --config=DIR use DIR for config files\n" |
330 " -d, --debug print debugging messages to stdout\n" | 319 " -d, --debug print debugging messages to stdout\n" |
331 " -h, --help display this help and exit\n" | 320 " -h, --help display this help and exit\n" |
332 " -n, --loginwin don't automatically login; show login window\n" | 321 " -n, --nologin don't automatically login\n" |
333 " -l, --login[=NAME] automatically login (optional argument NAME specifies\n" | 322 " -l, --login[=NAME] automatically login (optional argument NAME specifies\n" |
334 " account(s) to use, seperated by commas)\n" | 323 " account(s) to use, seperated by commas)\n" |
335 " -u, --user=NAME use account NAME\n" | 324 " -v, --version display the current version and exit\n"), VERSION, name); |
336 " -v, --version display the current version and exit\n" | |
337 " -w, --away[=MESG] make away on signon (optional argument MESG specifies\n" | |
338 " name of away message to use)\n"), VERSION, name); | |
339 } | 325 } |
340 | 326 |
341 /* tries to convert 'text' to users locale */ | 327 /* tries to convert 'text' to users locale */ |
342 text_conv = g_locale_from_utf8(text, -1, NULL, NULL, &error); | 328 text_conv = g_locale_from_utf8(text, -1, NULL, NULL, &error); |
343 if (text_conv != NULL) { | 329 if (text_conv != NULL) { |
444 int gaim_main(HINSTANCE hint, int argc, char *argv[]) | 430 int gaim_main(HINSTANCE hint, int argc, char *argv[]) |
445 #else | 431 #else |
446 int main(int argc, char *argv[]) | 432 int main(int argc, char *argv[]) |
447 #endif | 433 #endif |
448 { | 434 { |
449 int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1; | 435 gboolean opt_acct = FALSE; |
450 char *opt_user_arg = NULL, *opt_login_arg = NULL; | 436 gboolean opt_help = FALSE; |
451 char *opt_session_arg = NULL, *opt_config_dir_arg = NULL; | 437 gboolean opt_login = FALSE; |
438 gboolean opt_nologin = FALSE; | |
439 gboolean opt_version = FALSE; | |
440 char *opt_config_dir_arg = NULL; | |
441 char *opt_login_arg = NULL; | |
442 char *opt_session_arg = NULL; | |
443 int dologin_ret = -1; | |
452 char *plugin_search_paths[3]; | 444 char *plugin_search_paths[3]; |
453 #if HAVE_SIGNAL_H | 445 #if HAVE_SIGNAL_H |
454 int sig_indx; /* for setting up signal catching */ | 446 int sig_indx; /* for setting up signal catching */ |
455 sigset_t sigset; | 447 sigset_t sigset; |
456 void (*prev_sig_disp)(); | 448 void (*prev_sig_disp)(); |
457 #endif | 449 #endif |
458 int opt, opt_user = 0; | 450 int opt; |
459 int i; | |
460 gboolean gui_check; | 451 gboolean gui_check; |
461 gboolean debug_enabled; | 452 gboolean debug_enabled; |
462 gchar *gaimrc, *accountsxml; | 453 gchar *gaimrc, *accountsxml; |
454 char errmsg[BUFSIZ]; | |
463 | 455 |
464 struct option long_options[] = { | 456 struct option long_options[] = { |
465 {"acct", no_argument, NULL, 'a'}, | 457 {"acct", no_argument, NULL, 'a'}, |
466 /*{"away", optional_argument, NULL, 'w'}, */ | 458 {"config", required_argument, NULL, 'c'}, |
467 {"help", no_argument, NULL, 'h'}, | 459 {"debug", no_argument, NULL, 'd'}, |
468 /*{"login", optional_argument, NULL, 'l'}, */ | 460 {"help", no_argument, NULL, 'h'}, |
469 {"loginwin", no_argument, NULL, 'n'}, | 461 {"login", optional_argument, NULL, 'l'}, |
470 {"user", required_argument, NULL, 'u'}, | 462 {"nologin", no_argument, NULL, 'n'}, |
471 {"config", required_argument, NULL, 'c'}, | 463 {"session", required_argument, NULL, 's'}, |
472 {"debug", no_argument, NULL, 'd'}, | 464 {"version", no_argument, NULL, 'v'}, |
473 {"version", no_argument, NULL, 'v'}, | |
474 {"session", required_argument, NULL, 's'}, | |
475 {0, 0, 0, 0} | 465 {0, 0, 0, 0} |
476 }; | 466 }; |
477 | 467 |
478 #ifdef DEBUG | 468 #ifdef DEBUG |
479 debug_enabled = TRUE; | 469 debug_enabled = TRUE; |
495 /* jseymour: whatever the fsck that means */ | 485 /* jseymour: whatever the fsck that means */ |
496 /* Robot101: for some reason things like gdm like to block * | 486 /* Robot101: for some reason things like gdm like to block * |
497 * useful signals like SIGCHLD, so we unblock all the ones we * | 487 * useful signals like SIGCHLD, so we unblock all the ones we * |
498 * declare a handler for. thanks JSeymour and Vann. */ | 488 * declare a handler for. thanks JSeymour and Vann. */ |
499 if (sigemptyset(&sigset)) { | 489 if (sigemptyset(&sigset)) { |
500 char errmsg[BUFSIZ]; | |
501 snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set"); | 490 snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set"); |
502 perror(errmsg); | 491 perror(errmsg); |
503 } | 492 } |
504 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { | 493 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { |
505 if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { | 494 if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { |
506 char errmsg[BUFSIZ]; | |
507 snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching", | 495 snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching", |
508 catch_sig_list[sig_indx]); | 496 catch_sig_list[sig_indx]); |
509 perror(errmsg); | 497 perror(errmsg); |
510 } | 498 } |
511 if(sigaddset(&sigset, catch_sig_list[sig_indx])) { | 499 if(sigaddset(&sigset, catch_sig_list[sig_indx])) { |
512 char errmsg[BUFSIZ]; | |
513 snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking", | 500 snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking", |
514 catch_sig_list[sig_indx]); | 501 catch_sig_list[sig_indx]); |
515 perror(errmsg); | 502 perror(errmsg); |
516 } | 503 } |
517 } | 504 } |
518 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { | 505 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { |
519 if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { | 506 if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { |
520 char errmsg[BUFSIZ]; | |
521 snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore", | 507 snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore", |
522 ignore_sig_list[sig_indx]); | 508 ignore_sig_list[sig_indx]); |
523 perror(errmsg); | 509 perror(errmsg); |
524 } | 510 } |
525 } | 511 } |
526 | 512 |
527 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { | 513 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { |
528 char errmsg[BUFSIZ]; | |
529 snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals"); | 514 snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals"); |
530 perror(errmsg); | 515 perror(errmsg); |
531 } | 516 } |
532 #endif | 517 #endif |
533 | |
534 for (i = 0; i < argc; i++) { | |
535 /* --login option */ | |
536 if (strstr(argv[i], "--l") == argv[i]) { | |
537 char *equals; | |
538 opt_login = 1; | |
539 if ((equals = strchr(argv[i], '=')) != NULL) { | |
540 /* --login=NAME */ | |
541 opt_login_arg = g_strdup(equals + 1); | |
542 if (strlen(opt_login_arg) == 0) { | |
543 g_free(opt_login_arg); | |
544 opt_login_arg = NULL; | |
545 } | |
546 } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
547 /* --login NAME */ | |
548 opt_login_arg = g_strdup(argv[i + 1]); | |
549 strcpy(argv[i + 1], " "); | |
550 } | |
551 strcpy(argv[i], " "); | |
552 } | |
553 /* -l option */ | |
554 else if (strstr(argv[i], "-l") == argv[i]) { | |
555 opt_login = 1; | |
556 if (strlen(argv[i]) > 2) { | |
557 /* -lNAME */ | |
558 opt_login_arg = g_strdup(argv[i] + 2); | |
559 } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
560 /* -l NAME */ | |
561 opt_login_arg = g_strdup(argv[i + 1]); | |
562 strcpy(argv[i + 1], " "); | |
563 } | |
564 strcpy(argv[i], " "); | |
565 } | |
566 /* --away option */ | |
567 else if (strstr(argv[i], "--aw") == argv[i]) { | |
568 char *equals; | |
569 opt_away = 1; | |
570 if ((equals = strchr(argv[i], '=')) != NULL) { | |
571 /* --away=MESG */ | |
572 opt_away_arg = g_strdup(equals + 1); | |
573 if (strlen(opt_away_arg) == 0) { | |
574 g_free(opt_away_arg); | |
575 opt_away_arg = NULL; | |
576 } | |
577 } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
578 /* --away MESG */ | |
579 opt_away_arg = g_strdup(argv[i + 1]); | |
580 strcpy(argv[i + 1], " "); | |
581 } | |
582 strcpy(argv[i], " "); | |
583 } | |
584 /* -w option */ | |
585 else if (strstr(argv[i], "-w") == argv[i]) { | |
586 opt_away = 1; | |
587 if (strlen(argv[i]) > 2) { | |
588 /* -wMESG */ | |
589 opt_away_arg = g_strdup(argv[i] + 2); | |
590 } else if (i + 1 < argc && argv[i + 1][0] != '-') { | |
591 /* -w MESG */ | |
592 opt_away_arg = g_strdup(argv[i + 1]); | |
593 strcpy(argv[i + 1], " "); | |
594 } | |
595 strcpy(argv[i], " "); | |
596 } | |
597 } | |
598 /* | |
599 if (opt_login) { | |
600 printf ("--login given with arg %s\n", | |
601 opt_login_arg ? opt_login_arg : "NULL"); | |
602 exit(0); | |
603 } | |
604 */ | |
605 | 518 |
606 /* scan command-line options */ | 519 /* scan command-line options */ |
607 opterr = 1; | 520 opterr = 1; |
608 while ((opt = getopt_long(argc, argv, | 521 while ((opt = getopt_long(argc, argv, |
609 #ifndef _WIN32 | 522 #ifndef _WIN32 |
610 "adhu:c:vns:", | 523 "ac:dhnl::s:v", |
611 #else | 524 #else |
612 "adhu:c:vn", | 525 "ac:dhnl::v", |
613 #endif | 526 #endif |
614 long_options, NULL)) != -1) { | 527 long_options, NULL)) != -1) { |
615 switch (opt) { | 528 switch (opt) { |
616 case 'a': /* account editor */ | 529 case 'a': /* account editor */ |
617 opt_acct = 1; | 530 opt_acct = TRUE; |
531 break; | |
532 case 'c': /* config dir */ | |
533 g_free(opt_config_dir_arg); | |
534 opt_config_dir_arg = g_strdup(optarg); | |
618 break; | 535 break; |
619 case 'd': /* debug */ | 536 case 'd': /* debug */ |
620 debug_enabled = TRUE; | 537 debug_enabled = TRUE; |
621 break; | 538 break; |
622 case 'c': /* use specified config dir */ | |
623 set_gaim_user_dir(optarg); | |
624 opt_config_dir_arg = g_strdup(optarg); | |
625 break; | |
626 case 'h': /* help */ | 539 case 'h': /* help */ |
627 opt_help = 1; | 540 opt_help = TRUE; |
628 break; | 541 break; |
629 case 'n': /* don't autologin */ | 542 case 'n': /* no autologin */ |
630 opt_nologin = 1; | 543 opt_nologin = TRUE; |
544 break; | |
545 case 'l': /* login, option username */ | |
546 opt_login = TRUE; | |
547 g_free(opt_login_arg); | |
548 if (optarg != NULL) | |
549 opt_login_arg = g_strdup(optarg); | |
631 break; | 550 break; |
632 case 's': /* use existing session ID */ | 551 case 's': /* use existing session ID */ |
552 g_free(opt_session_arg); | |
633 opt_session_arg = g_strdup(optarg); | 553 opt_session_arg = g_strdup(optarg); |
634 break; | 554 break; |
635 case 'u': /* set user */ | |
636 opt_user = 1; | |
637 opt_user_arg = g_strdup(optarg); | |
638 break; | |
639 case 'v': /* version */ | 555 case 'v': /* version */ |
640 opt_version = 1; | 556 opt_version = TRUE; |
641 break; | 557 break; |
642 case '?': | 558 case '?': /* show terse help */ |
643 default: | 559 default: |
644 show_usage(argv[0], TRUE); | 560 show_usage(argv[0], TRUE); |
645 return 0; | 561 return 0; |
646 break; | 562 break; |
647 } | 563 } |
652 show_usage(argv[0], FALSE); | 568 show_usage(argv[0], FALSE); |
653 return 0; | 569 return 0; |
654 } | 570 } |
655 /* show version message */ | 571 /* show version message */ |
656 if (opt_version) { | 572 if (opt_version) { |
657 printf("Gaim %s\n",VERSION); | 573 printf("Gaim %s\n", VERSION); |
658 return 0; | 574 return 0; |
575 } | |
576 | |
577 /* set a user-specified config directory */ | |
578 if (opt_config_dir_arg != NULL) { | |
579 set_gaim_user_dir(opt_config_dir_arg); | |
659 } | 580 } |
660 | 581 |
661 gui_check = gtk_init_check(&argc, &argv); | 582 gui_check = gtk_init_check(&argc, &argv); |
662 if (!gui_check) { | 583 if (!gui_check) { |
663 char *display = gdk_get_display(); | 584 char *display = gdk_get_display(); |
667 | 588 |
668 return 1; | 589 return 1; |
669 } | 590 } |
670 | 591 |
671 #ifdef _WIN32 | 592 #ifdef _WIN32 |
672 wgaim_init(hint); | 593 wgaim_init(hint); |
673 #endif | 594 #endif |
674 gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops()); | 595 gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops()); |
675 gaim_eventloop_set_ui_ops(gaim_gtk_eventloop_get_ui_ops()); | 596 gaim_eventloop_set_ui_ops(gaim_gtk_eventloop_get_ui_ops()); |
676 | 597 |
677 if (!gaim_core_init(GAIM_GTK_UI)) { | 598 if (!gaim_core_init(GAIM_GTK_UI)) { |
733 if (opt_config_dir_arg != NULL) { | 654 if (opt_config_dir_arg != NULL) { |
734 g_free(opt_config_dir_arg); | 655 g_free(opt_config_dir_arg); |
735 opt_config_dir_arg = NULL; | 656 opt_config_dir_arg = NULL; |
736 } | 657 } |
737 | 658 |
738 /* set the default username */ | |
739 if (opt_user_arg != NULL) { | |
740 set_first_user(opt_user_arg); | |
741 g_free(opt_user_arg); | |
742 opt_user_arg = NULL; | |
743 } | |
744 | |
745 if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled")) | 659 if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled")) |
746 gaim_gtk_debug_window_show(); | 660 gaim_gtk_debug_window_show(); |
747 | 661 |
748 /* deal with --login */ | 662 gaim_blist_show(); |
663 | |
749 if (opt_login) { | 664 if (opt_login) { |
750 dologin_ret = dologin_named(opt_login_arg); | 665 dologin_ret = dologin_named(opt_login_arg); |
751 if (opt_login_arg != NULL) { | 666 if (opt_login_arg != NULL) { |
752 g_free(opt_login_arg); | 667 g_free(opt_login_arg); |
753 opt_login_arg = NULL; | 668 opt_login_arg = NULL; |
755 } | 670 } |
756 | 671 |
757 if (!opt_acct && !opt_nologin) | 672 if (!opt_acct && !opt_nologin) |
758 gaim_accounts_auto_login(GAIM_GTK_UI); | 673 gaim_accounts_auto_login(GAIM_GTK_UI); |
759 | 674 |
760 gaim_blist_show(); | 675 if (opt_acct || (gaim_accounts_get_all() == NULL)) { |
761 | |
762 if (opt_acct) { | |
763 gaim_gtk_accounts_window_show(); | 676 gaim_gtk_accounts_window_show(); |
764 } | 677 } |
765 | 678 |
766 #ifdef HAVE_STARTUP_NOTIFICATION | 679 #ifdef HAVE_STARTUP_NOTIFICATION |
767 startup_notification_complete(); | 680 startup_notification_complete(); |
772 #ifdef _WIN32 | 685 #ifdef _WIN32 |
773 wgaim_cleanup(); | 686 wgaim_cleanup(); |
774 #endif | 687 #endif |
775 | 688 |
776 return 0; | 689 return 0; |
777 | 690 } |
778 } |