pidgin/gtkmain.c

changeset 26378
e85d894af8a5
parent 25881
42756cc75edb
child 26046
e7b5b744d052
child 26337
ec2fc1bc9024
child 26381
328de1f9ca0d
equal deleted inserted replaced
26377:9124a345ed3a 26378:e85d894af8a5
308 pidgin_xfers_init(); 308 pidgin_xfers_init();
309 pidgin_roomlist_init(); 309 pidgin_roomlist_init();
310 pidgin_log_init(); 310 pidgin_log_init();
311 pidgin_docklet_init(); 311 pidgin_docklet_init();
312 pidgin_smileys_init(); 312 pidgin_smileys_init();
313 pidgin_utils_init();
313 } 314 }
314 315
315 static GHashTable *ui_info = NULL; 316 static GHashTable *ui_info = NULL;
316 317
317 static void 318 static void
321 /* unplug */ 322 /* unplug */
322 pidgin_session_end(); 323 pidgin_session_end();
323 #endif 324 #endif
324 325
325 /* Uninit */ 326 /* Uninit */
327 pidgin_utils_uninit();
326 pidgin_smileys_uninit(); 328 pidgin_smileys_uninit();
327 pidgin_conversations_uninit(); 329 pidgin_conversations_uninit();
328 pidgin_status_uninit(); 330 pidgin_status_uninit();
329 pidgin_docklet_uninit(); 331 pidgin_docklet_uninit();
330 pidgin_blist_uninit(); 332 pidgin_blist_uninit();
383 #ifndef WIN32 385 #ifndef WIN32
384 text = g_strdup_printf(_("%s %s\n" 386 text = g_strdup_printf(_("%s %s\n"
385 "Usage: %s [OPTION]...\n\n" 387 "Usage: %s [OPTION]...\n\n"
386 " -c, --config=DIR use DIR for config files\n" 388 " -c, --config=DIR use DIR for config files\n"
387 " -d, --debug print debugging messages to stdout\n" 389 " -d, --debug print debugging messages to stdout\n"
390 " -f, --force-online force online, regardless of network status\n"
388 " -h, --help display this help and exit\n" 391 " -h, --help display this help and exit\n"
389 " -m, --multiple do not ensure single instance\n" 392 " -m, --multiple do not ensure single instance\n"
390 " -n, --nologin don't automatically login\n" 393 " -n, --nologin don't automatically login\n"
391 " -l, --login[=NAME] enable specified account(s) (optional argument NAME\n" 394 " -l, --login[=NAME] enable specified account(s) (optional argument NAME\n"
392 " specifies account(s) to use, separated by commas.\n" 395 " specifies account(s) to use, separated by commas.\n"
396 #else 399 #else
397 text = g_strdup_printf(_("%s %s\n" 400 text = g_strdup_printf(_("%s %s\n"
398 "Usage: %s [OPTION]...\n\n" 401 "Usage: %s [OPTION]...\n\n"
399 " -c, --config=DIR use DIR for config files\n" 402 " -c, --config=DIR use DIR for config files\n"
400 " -d, --debug print debugging messages to stdout\n" 403 " -d, --debug print debugging messages to stdout\n"
404 " -f, --force-online force online, regardless of network status\n"
401 " -h, --help display this help and exit\n" 405 " -h, --help display this help and exit\n"
402 " -m, --multiple do not ensure single instance\n" 406 " -m, --multiple do not ensure single instance\n"
403 " -n, --nologin don't automatically login\n" 407 " -n, --nologin don't automatically login\n"
404 " -l, --login[=NAME] enable specified account(s) (optional argument NAME\n" 408 " -l, --login[=NAME] enable specified account(s) (optional argument NAME\n"
405 " specifies account(s) to use, separated by commas.\n" 409 " specifies account(s) to use, separated by commas.\n"
455 int pidgin_main(HINSTANCE hint, int argc, char *argv[]) 459 int pidgin_main(HINSTANCE hint, int argc, char *argv[])
456 #else 460 #else
457 int main(int argc, char *argv[]) 461 int main(int argc, char *argv[])
458 #endif 462 #endif
459 { 463 {
464 gboolean opt_force_online = FALSE;
460 gboolean opt_help = FALSE; 465 gboolean opt_help = FALSE;
461 gboolean opt_login = FALSE; 466 gboolean opt_login = FALSE;
462 gboolean opt_nologin = FALSE; 467 gboolean opt_nologin = FALSE;
463 gboolean opt_nocrash = FALSE;
464 gboolean opt_version = FALSE; 468 gboolean opt_version = FALSE;
465 gboolean opt_si = TRUE; /* Check for single instance? */ 469 gboolean opt_si = TRUE; /* Check for single instance? */
466 char *opt_config_dir_arg = NULL; 470 char *opt_config_dir_arg = NULL;
467 char *opt_login_arg = NULL; 471 char *opt_login_arg = NULL;
468 char *opt_session_arg = NULL; 472 char *opt_session_arg = NULL;
483 gboolean debug_enabled; 487 gboolean debug_enabled;
484 gboolean migration_failed = FALSE; 488 gboolean migration_failed = FALSE;
485 GList *active_accounts; 489 GList *active_accounts;
486 490
487 struct option long_options[] = { 491 struct option long_options[] = {
488 {"config", required_argument, NULL, 'c'}, 492 {"config", required_argument, NULL, 'c'},
489 {"debug", no_argument, NULL, 'd'}, 493 {"debug", no_argument, NULL, 'd'},
490 {"help", no_argument, NULL, 'h'}, 494 {"force-online", no_argument, NULL, 'd'},
491 {"login", optional_argument, NULL, 'l'}, 495 {"help", no_argument, NULL, 'h'},
492 {"multiple", no_argument, NULL, 'm'}, 496 {"login", optional_argument, NULL, 'l'},
493 {"nologin", no_argument, NULL, 'n'}, 497 {"multiple", no_argument, NULL, 'm'},
494 {"nocrash", no_argument, NULL, 'x'}, 498 {"nologin", no_argument, NULL, 'n'},
495 {"session", required_argument, NULL, 's'}, 499 {"session", required_argument, NULL, 's'},
496 {"version", no_argument, NULL, 'v'}, 500 {"version", no_argument, NULL, 'v'},
497 {"display", required_argument, NULL, 'D'}, 501 {"display", required_argument, NULL, 'D'},
498 {"sync", no_argument, NULL, 'S'}, 502 {"sync", no_argument, NULL, 'S'},
499 {0, 0, 0, 0} 503 {0, 0, 0, 0}
500 }; 504 };
501 505
502 #ifdef DEBUG 506 #ifdef DEBUG
503 debug_enabled = TRUE; 507 debug_enabled = TRUE;
600 604
601 /* scan command-line options */ 605 /* scan command-line options */
602 opterr = 1; 606 opterr = 1;
603 while ((opt = getopt_long(argc, argv, 607 while ((opt = getopt_long(argc, argv,
604 #ifndef _WIN32 608 #ifndef _WIN32
605 "c:dhmnl::s:v", 609 "c:dfhmnl::s:v",
606 #else 610 #else
607 "c:dhmnl::v", 611 "c:dfhmnl::v",
608 #endif 612 #endif
609 long_options, NULL)) != -1) { 613 long_options, NULL)) != -1) {
610 switch (opt) { 614 switch (opt) {
611 case 'c': /* config dir */ 615 case 'c': /* config dir */
612 g_free(opt_config_dir_arg); 616 g_free(opt_config_dir_arg);
613 opt_config_dir_arg = g_strdup(optarg); 617 opt_config_dir_arg = g_strdup(optarg);
614 break; 618 break;
615 case 'd': /* debug */ 619 case 'd': /* debug */
616 debug_enabled = TRUE; 620 debug_enabled = TRUE;
617 break; 621 break;
622 case 'f': /* force-online */
623 opt_force_online = TRUE;
624 break;
618 case 'h': /* help */ 625 case 'h': /* help */
619 opt_help = TRUE; 626 opt_help = TRUE;
620 break; 627 break;
621 case 'n': /* no autologin */ 628 case 'n': /* no autologin */
622 opt_nologin = TRUE; 629 opt_nologin = TRUE;
634 case 'v': /* version */ 641 case 'v': /* version */
635 opt_version = TRUE; 642 opt_version = TRUE;
636 break; 643 break;
637 case 'm': /* do not ensure single instance. */ 644 case 'm': /* do not ensure single instance. */
638 opt_si = FALSE; 645 opt_si = FALSE;
639 break;
640 case 'x': /* --nocrash */
641 opt_nocrash = TRUE;
642 break; 646 break;
643 case 'D': /* --display */ 647 case 'D': /* --display */
644 case 'S': /* --sync */ 648 case 'S': /* --sync */
645 /* handled by gtk_init_check below */ 649 /* handled by gtk_init_check below */
646 break; 650 break;
814 if (opt_config_dir_arg != NULL) { 818 if (opt_config_dir_arg != NULL) {
815 g_free(opt_config_dir_arg); 819 g_free(opt_config_dir_arg);
816 opt_config_dir_arg = NULL; 820 opt_config_dir_arg = NULL;
817 } 821 }
818 822
823 /* This needs to be before purple_blist_show() so the
824 * statusbox gets the forced online status. */
825 if (opt_force_online)
826 purple_network_force_online();
827
819 /* 828 /*
820 * We want to show the blist early in the init process so the 829 * We want to show the blist early in the init process so the
821 * user feels warm and fuzzy (not cold and prickley). 830 * user feels warm and fuzzy (not cold and prickley).
822 */ 831 */
823 purple_blist_show(); 832 purple_blist_show();

mercurial