int main (int argc, char **argv) { #ifdef G_OS_WIN32 extern void link_shutdown (void); #endif GConfClient *client; #if DEVELOPMENT gboolean skip_warning_dialog; #endif GnomeProgram *program; GnomeClient *master_client; GOptionContext *context; char *filename; /* Make ElectricFence work. */ free (malloc (10)); bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); context = g_option_context_new (_("- The Evolution PIM and Email Client")); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); g_option_context_set_translation_domain(context, GETTEXT_PACKAGE); #ifdef G_OS_WIN32 set_paths (); #endif program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_GOPTION_CONTEXT, context, GNOME_PARAM_HUMAN_READABLE_NAME, _("Evolution"), NULL); #ifdef G_OS_WIN32 if (strcmp (_(""), "") == 0) { /* No message catalog installed for the current locale language, * so don't bother with the localisations provided by other things then * either. Reset thread locale to "en-US" and C library locale to "C". */ SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); setlocale (LC_ALL, "C"); } #endif if (start_online && start_offline) { fprintf (stderr, _("%s: --online and --offline cannot be used together.\n Use %s --help for more information.\n"), argv[0], argv[0]); exit (1); } if (killev) { filename = g_build_filename (EVOLUTION_TOOLSDIR, "killev", NULL); execl (filename, "killev", NULL); /* Not reached */ exit (0); } client = gconf_client_get_default (); #if DEVELOPMENT if (force_migrate) { destroy_config (client); } #endif if (disable_preview) { gconf_client_set_bool (client, "/apps/evolution/mail/display/show_preview", FALSE, NULL); gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL); gconf_client_set_bool (client, "/apps/evolution/addressbook/display/show_preview", FALSE, NULL); gconf_client_set_bool (client, "/apps/evolution/calendar/display/show_task_preview", FALSE, NULL); } setup_segv_redirect (); if (evolution_debug_log) { int fd; fd = g_open (evolution_debug_log, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd != -1) { dup2 (fd, STDOUT_FILENO); dup2 (fd, STDERR_FILENO); close (fd); } else g_warning ("Could not set up debugging output file."); } master_client = gnome_master_client (); g_signal_connect (G_OBJECT (master_client), "save_yourself", G_CALLBACK (gnome_master_client_save_yourself_cb), NULL); g_signal_connect (G_OBJECT (master_client), "die", G_CALLBACK (gnome_master_client_die_cb), NULL); glade_init (); e_cursors_init (); e_icon_factory_init (); e_passwords_init(); gtk_window_set_default_icon_name ("evolution"); if (setup_only) exit (0); gnome_sound_init ("localhost"); if (!disable_eplugin) { e_plugin_register_type(e_plugin_lib_get_type()); e_plugin_hook_register_type(es_menu_hook_get_type()); e_plugin_hook_register_type(es_event_hook_get_type()); #ifdef ENABLE_PROFILING e_plugin_hook_register_type(e_profile_event_hook_get_type()); #endif e_plugin_hook_register_type(e_plugin_type_hook_get_type()); e_plugin_hook_register_type(e_import_hook_get_type()); e_plugin_hook_register_type(E_TYPE_PLUGIN_UI_HOOK); e_plugin_load_plugins(); } #if DEVELOPMENT skip_warning_dialog = gconf_client_get_bool ( client, SKIP_WARNING_DIALOG_KEY, NULL); if (!skip_warning_dialog && !getenv ("EVOLVE_ME_HARDER")) gconf_client_set_bool ( client, SKIP_WARNING_DIALOG_KEY, show_development_warning (), NULL); else g_idle_add ((GSourceFunc) idle_cb, remaining_args); #else g_idle_add ((GSourceFunc) idle_cb, remaining_args); #endif g_object_unref (client); bonobo_main (); e_icon_factory_shutdown (); g_object_unref (program); gnome_sound_shutdown (); e_cursors_shutdown (); #ifdef G_OS_WIN32 link_shutdown (); #endif return 0; }
int main (int argc, char **argv) { GOptionContext *option_context; GnomeProgram *gnomegadu_app; gchar **remaining_args = NULL; GOptionEntry option_entries[] = { {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &remaining_args, "Special option that collects any remaining arguments for us"}, {NULL} }; gg_debug_level = 255; option_context = g_option_context_new ("gnomegadu-app"); g_option_context_add_main_entries (option_context, option_entries, NULL); gnomegadu_app = gnome_program_init (PACKAGE_NAME, PACKAGE_VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_GOPTION_CONTEXT, option_context, GNOME_PARAM_HUMAN_READABLE_NAME, PACKAGE_READABLE_NAME, GNOME_PARAM_NONE); if (remaining_args != NULL) { gint i, num_args; num_args = g_strv_length (remaining_args); for (i = 0; i < num_args; ++i) { /* * process remaining_args[i] here */ } g_strfreev (remaining_args); remaining_args = NULL; } gnomegadu_conf_init (gnomegadu_app); if (gconf_client_get_bool (gconf, g_strconcat(gnomegadu_gconf_relative_path, "/sound",NULL), NULL)) gnome_sound_init (NULL); gnomegadu_ui_init (); if (!notify_is_initted()) notify_init(PACKAGE); gnomegadu_protocol_is_connected = FALSE; //gnomegadu_galago_init(); gtk_main (); g_object_unref (gnomegadu_app); return 0; }