comparison src/main.c @ 7150:e09020153d85

[gaim-migrate @ 7717] I fixed this! It doesn't hate me. How could it? committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 04 Oct 2003 23:45:00 +0000
parents d17a587efeb3
children 282887c9e3dc
comparison
equal deleted inserted replaced
7149:3aa374a7bc2e 7150:e09020153d85
472 472
473 /* Place it as the first user. */ 473 /* Place it as the first user. */
474 gaim_accounts_reorder(account, 0); 474 gaim_accounts_reorder(account, 0);
475 } 475 }
476 476
477 #ifdef _WIN32
478 /* WIN32 print and log handlers */
479
480 static void gaim_dummy_print( const gchar* string ) {
481 return;
482 }
483
484 static void gaim_dummy_log_handler (const gchar *domain,
485 GLogLevelFlags flags,
486 const gchar *msg,
487 gpointer user_data) {
488 return;
489 }
490
491 static void gaim_log_handler (const gchar *domain,
492 GLogLevelFlags flags,
493 const gchar *msg,
494 gpointer user_data) {
495 gaim_debug(GAIM_DEBUG_MISC, "log", "%s - %s\n", domain, msg);
496 g_log_default_handler(domain, flags, msg, user_data);
497 }
498 #endif /* _WIN32 */
499
500 static void 477 static void
501 debug_init(void) 478 debug_init(void)
502 { 479 {
503 gaim_debug_set_ui_ops(gaim_gtk_debug_get_ui_ops()); 480 gaim_debug_set_ui_ops(gaim_gtk_debug_get_ui_ops());
504 gaim_gtk_debug_init(); 481 gaim_gtk_debug_init();
786 return 0; 763 return 0;
787 break; 764 break;
788 } 765 }
789 } 766 }
790 767
791 #ifdef _WIN32
792 /* We don't want a console window.. */
793 /*
794 * Any calls to the glib logging functions, result in a call to AllocConsole().
795 * ME and 98 will in such cases produce a console window (2000 not), despite
796 * being built as a windows app rather than a console app. So we should either
797 * ignore messages by setting dummy log handlers, or redirect messages.
798 * This requires setting handlers for all domains (any lib which uses g_logging).
799 */
800
801 g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
802 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
803 NULL);
804 g_log_set_handler ("Gdk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
805 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
806 NULL);
807 g_log_set_handler ("Gtk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
808 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
809 NULL);
810 g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
811 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
812 NULL);
813 g_log_set_handler ("GModule", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
814 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
815 NULL);
816 g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
817 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
818 NULL);
819 g_log_set_handler ("GThread", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
820 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
821 NULL);
822
823 /* g_print also makes a call to AllocConsole(), therefore a handler needs to be
824 set here aswell */
825 if(!opt_debug)
826 g_set_print_handler( gaim_dummy_print );
827
828 #endif
829
830 /* show help message */ 768 /* show help message */
831 if (opt_help) { 769 if (opt_help) {
832 show_usage(0, argv[0]); 770 show_usage(0, argv[0]);
833 return 0; 771 return 0;
834 } 772 }