JNIEXPORT jint JNICALL Java_org_helllabs_android_xmp_Xmp_init(JNIEnv *env, jobject obj) { xmp_drv_register(&drv_smix); ctx = xmp_create_context(); xmp_init(ctx, 0, NULL); opt = xmp_get_options(ctx); opt->verbosity = 0; xmp_register_event_callback(ctx, process_echoback, NULL); _playing = 0; opt->freq = 44100; opt->resol = 16; opt->outfmt &= ~XMP_FMT_MONO; opt->flags |= XMP_CTL_ITPT | XMP_CTL_FILTER; if (xmp_open_audio(ctx) < 0) { xmp_deinit(ctx); xmp_free_context(ctx); return -1; } return 0; }
int main (int argc, char *argv[]) { gint retval; CajaApplication *application; #if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD) /* Caja uses lots and lots of small and medium size allocations, * and then a few large ones for the desktop background. By default * glibc uses a dynamic treshold for how large allocations should * be mmaped. Unfortunately this triggers quickly for caja when * it does the desktop background allocations, raising the limit * such that a lot of temporary large allocations end up on the * heap and are thus not returned to the OS. To fix this we set * a hardcoded limit. I don't know what a good value is, but 128K * was the old glibc static limit, lets use that. */ mallopt (M_MMAP_THRESHOLD, 128 *1024); #endif if (g_getenv ("CAJA_DEBUG") != NULL) { eel_make_warnings_and_criticals_stop_in_debugger (); } /* Initialize gettext support */ bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); g_set_prgname ("caja"); gdk_set_allowed_backends ("x11"); if (g_file_test (DATADIR "/applications/caja.desktop", G_FILE_TEST_EXISTS)) { egg_set_desktop_file (DATADIR "/applications/caja.desktop"); } #ifdef HAVE_EXEMPI xmp_init(); #endif setup_debug_log (); /* Initialize the services that we use. */ LIBXML_TEST_VERSION /* Run the caja application. */ application = caja_application_new(); retval = g_application_run (G_APPLICATION (application), argc, argv); g_object_unref (application); eel_debug_shut_down (); return retval; }
int main(int argc, char **argv) { xmp_init(&argc, &argv); ixmp_sub(); xmp_finalize(); return 0; }
int main (int argc, char *argv[]) { gint retval; NautilusApplication *application; #if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD) /* Nautilus uses lots and lots of small and medium size allocations, * and then a few large ones for the desktop background. By default * glibc uses a dynamic treshold for how large allocations should * be mmaped. Unfortunately this triggers quickly for nautilus when * it does the desktop background allocations, raising the limit * such that a lot of temporary large allocations end up on the * heap and are thus not returned to the OS. To fix this we set * a hardcoded limit. I don't know what a good value is, but 128K * was the old glibc static limit, lets use that. */ mallopt (M_MMAP_THRESHOLD, 128 *1024); #endif /* This will be done by gtk+ later, but for now, force it to GNOME */ g_desktop_app_info_set_desktop_env ("GNOME"); if (g_getenv ("NAUTILUS_DEBUG") != NULL) { eel_make_warnings_and_criticals_stop_in_debugger (); } /* Initialize gettext support */ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); g_set_prgname ("nautilus"); #ifdef HAVE_EXEMPI xmp_init(); #endif /* Run the nautilus application. */ application = nautilus_application_new (); /* hold indefinitely if we're asked to persist */ if (g_getenv ("NAUTILUS_PERSIST") != NULL) { g_application_hold (G_APPLICATION (application)); } retval = g_application_run (G_APPLICATION (application), argc, argv); g_object_unref (application); eel_debug_shut_down (); return retval; }
//void test_tiff_leak() int test_main(int argc, char *argv[]) { prepare_test(argc, argv, "../../samples/testfiles/BlueSquare.jpg"); std::string orig_tiff_file = g_src_testdir + "../../samples/testfiles/BlueSquare.tif"; std::string command = "cp "; command += orig_tiff_file + " test.tif"; BOOST_CHECK(system(command.c_str()) >= 0); BOOST_CHECK(chmod("test.tif", S_IRUSR|S_IWUSR) == 0); BOOST_CHECK(xmp_init()); XmpFilePtr f = xmp_files_open_new("test.tif", XMP_OPEN_FORUPDATE); BOOST_CHECK(f != NULL); if (f == NULL) { return 1; } XmpPtr xmp; BOOST_CHECK(xmp = xmp_files_get_new_xmp(f)); BOOST_CHECK(xmp != NULL); xmp_set_localized_text(xmp, NS_DC, "description", "en", "en-US", "foo", 0); BOOST_CHECK(xmp_files_put_xmp(f, xmp)); BOOST_CHECK(xmp_files_close(f, XMP_CLOSE_NOOPTION)); BOOST_CHECK(xmp_free(xmp)); BOOST_CHECK(xmp_files_free(f)); xmp_terminate(); BOOST_CHECK(unlink("test.tif") == 0); BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); return 0; }
int main (int argc, char *argv[]) { gboolean kill_shell; gboolean no_default_window; gboolean browser_window; gboolean no_desktop; gboolean version; gboolean autostart_mode; const char *autostart_id; gchar *geometry; gchar **remaining; gboolean perform_self_check; CajaApplication *application; GOptionContext *context; GFile *file = NULL; GFileInfo *fileinfo = NULL; GAppInfo *appinfo = NULL; char *uri = NULL; char **uris = NULL; GPtrArray *uris_array; GError *error; int i; const GOptionEntry options[] = { #ifndef CAJA_OMIT_SELF_CHECK { "check", 'c', 0, G_OPTION_ARG_NONE, &perform_self_check, N_("Perform a quick set of self-check tests."), NULL }, #endif { "version", '\0', 0, G_OPTION_ARG_NONE, &version, N_("Show the version of the program."), NULL }, { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry, N_("Create the initial window with the given geometry."), N_("GEOMETRY") }, { "no-default-window", 'n', 0, G_OPTION_ARG_NONE, &no_default_window, N_("Only create windows for explicitly specified URIs."), NULL }, { "no-desktop", '\0', 0, G_OPTION_ARG_NONE, &no_desktop, N_("Do not manage the desktop (ignore the preference set in the preferences dialog)."), NULL }, { "browser", '\0', 0, G_OPTION_ARG_NONE, &browser_window, N_("open a browser window."), NULL }, { "quit", 'q', 0, G_OPTION_ARG_NONE, &kill_shell, N_("Quit Caja."), NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, N_("[URI...]") }, { NULL } }; #if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD) /* Caja uses lots and lots of small and medium size allocations, * and then a few large ones for the desktop background. By default * glibc uses a dynamic treshold for how large allocations should * be mmaped. Unfortunately this triggers quickly for caja when * it does the desktop background allocations, raising the limit * such that a lot of temporary large allocations end up on the * heap and are thus not returned to the OS. To fix this we set * a hardcoded limit. I don't know what a good value is, but 128K * was the old glibc static limit, lets use that. */ mallopt (M_MMAP_THRESHOLD, 128 *1024); #endif g_thread_init (NULL); /* This will be done by gtk+ later, but for now, force it to MATE */ g_desktop_app_info_set_desktop_env ("MATE"); if (g_getenv ("CAJA_DEBUG") != NULL) { eel_make_warnings_and_criticals_stop_in_debugger (); } /* Initialize gettext support */ bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); autostart_mode = FALSE; autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID"); if (autostart_id != NULL && *autostart_id != '\0') { autostart_mode = TRUE; } /* Get parameters. */ remaining = NULL; geometry = NULL; version = FALSE; kill_shell = FALSE; no_default_window = FALSE; no_desktop = FALSE; perform_self_check = FALSE; browser_window = FALSE; g_set_prgname ("caja"); if (g_file_test (DATADIR "/applications/caja.desktop", G_FILE_TEST_EXISTS)) { egg_set_desktop_file (DATADIR "/applications/caja.desktop"); } context = g_option_context_new (_("\n\nBrowse the file system with the file manager")); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_add_group (context, egg_sm_client_get_option_group ()); error = NULL; if (!g_option_context_parse (context, &argc, &argv, &error)) { g_printerr ("Could not parse arguments: %s\n", error->message); g_error_free (error); return 1; } g_option_context_free (context); if (version) { g_print ("MATE caja " PACKAGE_VERSION "\n"); return 0; } #ifdef HAVE_EXEMPI xmp_init(); #endif setup_debug_log (); /* If in autostart mode (aka started by mate-session), we need to ensure * caja starts with the correct options. */ if (autostart_mode) { no_default_window = TRUE; no_desktop = FALSE; } if (perform_self_check && remaining != NULL) { /* translators: %s is an option (e.g. --check) */ fprintf (stderr, _("caja: %s cannot be used with URIs.\n"), "--check"); return EXIT_FAILURE; } if (perform_self_check && kill_shell) { fprintf (stderr, _("caja: --check cannot be used with other options.\n")); return EXIT_FAILURE; } if (kill_shell && remaining != NULL) { fprintf (stderr, _("caja: %s cannot be used with URIs.\n"), "--quit"); return EXIT_FAILURE; } if (geometry != NULL && remaining != NULL && remaining[0] != NULL && remaining[1] != NULL) { fprintf (stderr, _("caja: --geometry cannot be used with more than one URI.\n")); return EXIT_FAILURE; } /* Initialize the services that we use. */ LIBXML_TEST_VERSION /* Initialize preferences. This is needed so that proper * defaults are available before any preference peeking * happens. */ caja_global_preferences_init (); /* exit_with_last_window being FALSE, caja can run without window. */ exit_with_last_window = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_EXIT_WITH_LAST_WINDOW); application = NULL; /* Do either the self-check or the real work. */ if (perform_self_check) { #ifndef CAJA_OMIT_SELF_CHECK /* Run the checks (each twice) for caja and libcaja-private. */ caja_run_self_checks (); caja_run_lib_self_checks (); eel_exit_if_self_checks_failed (); caja_run_self_checks (); caja_run_lib_self_checks (); eel_exit_if_self_checks_failed (); #endif } else { /* Convert args to URIs */ if (remaining != NULL) { uris_array = g_ptr_array_new (); for (i = 0; remaining[i] != NULL; i++) { file = g_file_new_for_commandline_arg (remaining[i]); if (file != NULL) { uri = g_file_get_uri (file); if (uri) { fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); if (fileinfo && g_file_info_get_file_type(fileinfo) == G_FILE_TYPE_DIRECTORY) { g_ptr_array_add (uris_array, uri); } else { if (fileinfo) g_object_unref (fileinfo); fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); if (fileinfo) { appinfo = g_app_info_get_default_for_type (g_file_info_get_content_type (fileinfo), TRUE); if (appinfo) { if (g_strcmp0 (g_app_info_get_executable (appinfo), "caja") != 0) { g_app_info_launch_default_for_uri (uri, NULL, NULL); } else { fprintf (stderr, _("caja: set erroneously as default application for '%s' content type.\n"), g_file_info_get_content_type (fileinfo)); } g_object_unref (appinfo); } g_free (uri); } else { g_ptr_array_add (uris_array, uri); } } if (fileinfo) g_object_unref (fileinfo); } if (file) g_object_unref (file); } } if (uris_array->len == 0) { /* Caja is being used only to open files (not directories), so closing */ g_strfreev (remaining); return EXIT_SUCCESS; } g_ptr_array_add (uris_array, NULL); uris = (char**) g_ptr_array_free (uris_array, FALSE); g_strfreev (remaining); } /* Run the caja application. */ application = caja_application_new (); if (egg_sm_client_is_resumed (application->smclient)) { no_default_window = TRUE; } caja_application_startup (application, kill_shell, no_default_window, no_desktop, browser_window, geometry, uris); g_strfreev (uris); if (unique_app_is_running (application->unique_app) || kill_shell) { exit_with_last_window = TRUE; } if (is_event_loop_needed ()) { gtk_main (); } } caja_icon_info_clear_caches (); if (application != NULL) { g_object_unref (application); } eel_debug_shut_down (); caja_application_save_accel_map (NULL); return EXIT_SUCCESS; }
int main(int argc, char **argv) { int ch; int action = ACTION_NONE; bool dont_reconcile = false; bool write_in_place = false; bool dump_xml = false; bool is_an_xmp = false; std::string output_file; std::string value_name; std::string prop_value; while((ch = getopt(argc, argv, "hRo:wxXg:s:v:")) != -1) { switch(ch) { case 'R': dont_reconcile = true; break; case 'o': output_file = optarg; break; case 'w': write_in_place = true; break; case 'x': dump_xml = true; break; case 'X': is_an_xmp = true; break; case 'g': if(!value_name.empty()) { usage(); } action = ACTION_GET; value_name = optarg; break; case 's': if(!value_name.empty()) { usage(); } action = ACTION_SET; value_name = optarg; break; case 'v': if(action != ACTION_SET || value_name.empty()) { fatal_error("-v needs to come after -s"); } prop_value = optarg; break; case 'h': case '?': usage(); break; } } argc -= optind; argv += optind; if(optind == 1 || argc == 0) { fatal_error("Missing input."); return 1; } if(write_in_place && (!output_file.empty() || action != ACTION_SET)) { fatal_error("Need to write in place and output file are mutually exclusive."); return 1; } if(action == ACTION_SET && (!write_in_place && argc > 1)) { fatal_error("Need to write in place for more than one file."); return 1; } xmp_init(); while(argc) { process_file(*argv, dont_reconcile, is_an_xmp, write_in_place, dump_xml, action, value_name, prop_value, output_file); argc--; argv++; } xmp_terminate(); return 0; }
/** * Is there any XMP metadata in the map file for us to worry about? */ int msXmpWrite( mapObj *map, const char *filename ) { #ifdef USE_EXEMPI /* Should hold our keys */ hashTableObj hash_metadata = map->web.metadata; /* Temporary place for custom name spaces */ hashTableObj hash_ns; /* We use regex to strip out the namespace and XMP key value from the metadata key */ regex_t xmp_regex; const char *xmp_ns_str = "^xmp_(.+)_namespace$"; const char *xmp_tag_str = "^xmp_(.+)_(.+)$"; const char *key = NULL; static int regflags = REG_ICASE | REG_EXTENDED; /* XMP object and file pointers */ XmpPtr xmp; XmpFilePtr f; /* Force the hash table to empty */ hash_ns.numitems = 0; /* Prepare XMP library */ xmp_init(); f = xmp_files_open_new(filename, XMP_OPEN_FORUPDATE); if ( ! f ) { msSetError( MS_MISCERR, "Unable to open temporary file '%s' to write XMP info", "msXmpWrite()", filename ); return MS_FAILURE; } /* Create a new XMP structure if the file doesn't already have one */ xmp = xmp_files_get_new_xmp(f); if ( xmp == NULL ) xmp = xmp_new_empty(); /* Check we can write to the file */ if ( ! xmp_files_can_put_xmp(f, xmp) ) { msSetError( MS_MISCERR, "Unable to write XMP information to '%s'", "msXmpWrite()", filename ); return MS_FAILURE; } /* Compile our "xmp_*_namespace" regex */ if ( regcomp(&xmp_regex, xmp_ns_str, regflags) ) { msSetError( MS_MISCERR, "Unable compile regex '%s'", "msXmpWrite()", xmp_ns_str ); return MS_FAILURE; } /* Check all the keys for "xmp_*_namespace" pattern */ initHashTable(&hash_ns); key = msFirstKeyFromHashTable(&hash_metadata); /* No first key? No license info. We shouldn't get here. */ if ( ! key ) return MS_SUCCESS; do { /* Our regex has one match slot */ regmatch_t matches[2]; /* Found a custom namespace entry! Store it for later. */ if ( 0 == regexec(&xmp_regex, key, 2, matches, 0) ) { size_t ns_size = 0; char *ns_name = NULL; const char *ns_uri; /* Copy in the namespace name */ ns_size = matches[1].rm_eo - matches[1].rm_so; ns_name = msSmallMalloc(ns_size + 1); memcpy(ns_name, key + matches[1].rm_so, ns_size); ns_name[ns_size] = 0; /* null terminate */ /* Copy in the namespace uri */ ns_uri = msLookupHashTable(&hash_metadata, key); msInsertHashTable(&hash_ns, ns_name, ns_uri); xmp_register_namespace(ns_uri, ns_name, NULL); msFree(ns_name); } } while( (key = msNextKeyFromHashTable(&hash_metadata, key)) ); /* Clean up regex */ regfree(&xmp_regex); /* Compile our "xmp_*_*" regex */ if ( regcomp(&xmp_regex, xmp_tag_str, regflags) ) { msFreeHashItems(&hash_ns); msSetError( MS_MISCERR, "Unable compile regex '%s'", "msXmpWrite()", xmp_tag_str ); return MS_FAILURE; } /* Check all the keys for "xmp_*_*" pattern */ key = msFirstKeyFromHashTable(&hash_metadata); do { /* Our regex has two match slots */ regmatch_t matches[3]; /* Found a namespace entry! Write it into XMP. */ if ( 0 == regexec(&xmp_regex, key, 3, matches, 0) ) { /* Get the namespace and tag name */ size_t ns_name_size = matches[1].rm_eo - matches[1].rm_so; size_t ns_tag_size = matches[2].rm_eo - matches[2].rm_so; char *ns_name = msSmallMalloc(ns_name_size + 1); char *ns_tag = msSmallMalloc(ns_tag_size + 1); const char *ns_uri = NULL; memcpy(ns_name, key + matches[1].rm_so, ns_name_size); memcpy(ns_tag, key + matches[2].rm_so, ns_tag_size); ns_name[ns_name_size] = 0; /* null terminate */ ns_tag[ns_tag_size] = 0; /* null terminate */ if ( strcmp(ns_tag,"namespace") == 0 ) { msFree(ns_name); msFree(ns_tag); continue; } /* If this is a default name space?... */ if ( (ns_uri = msXmpUri(ns_name)) ) { xmp_register_namespace(ns_uri, ns_name, NULL); xmp_set_property(xmp, ns_uri, ns_tag, msLookupHashTable(&hash_metadata, key), 0); } /* Or maybe it's a custom one?... */ else if ( (ns_uri = msLookupHashTable(&hash_ns, ns_name)) ) { xmp_set_property(xmp, ns_uri, ns_tag, msLookupHashTable(&hash_metadata, key), 0); } /* Or perhaps we're screwed. */ else { msSetError( MS_MISCERR, "Unable to identify XMP namespace '%s' in metadata key '%s'", "msXmpWrite()", ns_name, key ); msFreeHashItems(&hash_ns); msFree(ns_name); msFree(ns_tag); return MS_FAILURE; } msFree(ns_name); msFree(ns_tag); } } while( (key = msNextKeyFromHashTable(&hash_metadata, key)) ); /* Clean up regex */ regfree(&xmp_regex); /* Write out the XMP */ if ( !xmp_files_put_xmp(f, xmp) ) { msFreeHashItems(&hash_ns); msSetError( MS_MISCERR, "Unable to execute '%s' on pointer %p", "msXmpWrite()", "xmp_files_put_xmp", f ); return MS_FAILURE; } /* Write out the file and flush */ if ( !xmp_files_close(f, XMP_CLOSE_SAFEUPDATE) ) { msFreeHashItems(&hash_ns); msSetError( MS_MISCERR, "Unable to execute '%s' on pointer %p", "msXmpWrite()", "xmp_files_close", f ); return MS_FAILURE; } msFreeHashItems(&hash_ns); xmp_free(xmp); xmp_terminate(); return MS_SUCCESS; #else return MS_FAILURE; #endif }
int main (int argc, char *argv[]) { gboolean kill_shell; gboolean restart_shell; gboolean no_default_window; gboolean browser_window; gboolean no_desktop; const char *startup_id; char *startup_id_copy; char *session_to_load; gchar *geometry; const gchar **remaining; gboolean perform_self_check; GOptionContext *context; NautilusApplication *application; char **argv_copy; GnomeProgram *program; const GOptionEntry options[] = { #ifndef NAUTILUS_OMIT_SELF_CHECK { "check", 'c', 0, G_OPTION_ARG_NONE, &perform_self_check, N_("Perform a quick set of self-check tests."), NULL }, #endif { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry, N_("Create the initial window with the given geometry."), N_("GEOMETRY") }, { "no-default-window", 'n', 0, G_OPTION_ARG_NONE, &no_default_window, N_("Only create windows for explicitly specified URIs."), NULL }, { "no-desktop", '\0', 0, G_OPTION_ARG_NONE, &no_desktop, N_("Do not manage the desktop (ignore the preference set in the preferences dialog)."), NULL }, { "browser", '\0', 0, G_OPTION_ARG_NONE, &browser_window, N_("open a browser window."), NULL }, { "quit", 'q', 0, G_OPTION_ARG_NONE, &kill_shell, N_("Quit Nautilus."), NULL }, { "restart", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &restart_shell, N_("Restart Nautilus."), NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, N_("[URI...]") }, { "load-session", 'l', 0, G_OPTION_ARG_STRING, &session_to_load, /* Translators: --no-default-window is a nautilus command line parameter, don't modify it. */ N_("Load a saved session from the specified file. Implies \"--no-default-window\"."), N_("FILENAME") }, { NULL } }; g_thread_init (NULL); setlocale (LC_ALL, ""); /* This will be done by gtk+ later, but for now, force it to GNOME */ g_desktop_app_info_set_desktop_env ("GNOME"); if (g_getenv ("NAUTILUS_DEBUG") != NULL) { eel_make_warnings_and_criticals_stop_in_debugger (); } /* Initialize gettext support */ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); startup_id = g_getenv ("DESKTOP_STARTUP_ID"); startup_id_copy = NULL; if (startup_id != NULL && *startup_id != '\0') { /* Clear the DESKTOP_STARTUP_ID, but make sure to copy it first */ startup_id_copy = g_strdup (startup_id); g_unsetenv ("DESKTOP_STARTUP_ID"); } /* we'll do it ourselves due to complicated factory setup */ gtk_window_set_auto_startup_notification (FALSE); /* Get parameters. */ remaining = NULL; geometry = NULL; session_to_load = NULL; kill_shell = FALSE; no_default_window = FALSE; no_desktop = FALSE; perform_self_check = FALSE; restart_shell = FALSE; browser_window = FALSE; g_set_application_name (_("File Manager")); context = g_option_context_new (_("\n\nBrowse the file system with the file manager")); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); #ifdef HAVE_EXEMPI xmp_init(); #endif program = gnome_program_init ("nautilus", VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_GOPTION_CONTEXT, context, GNOME_PARAM_HUMAN_READABLE_NAME, _("Nautilus"), NULL); /* We do this after gnome_program_init(), since that function sets up * its own handler for SIGSEGV and others --- we want to chain to those * handlers. */ setup_debug_log (); if (session_to_load != NULL) { no_default_window = TRUE; } /* Do this here so that gdk_display is initialized */ if (startup_id_copy == NULL) { /* Create a fake one containing a timestamp that we can use */ Time timestamp; timestamp = slowly_and_stupidly_obtain_timestamp (gdk_display); startup_id_copy = g_strdup_printf ("_TIME%lu", timestamp); } /* Set default icon for all nautilus windows */ gtk_window_set_default_icon_name (NAUTILUS_ICON_FOLDER); /* Need to set this to the canonical DISPLAY value, since thats where we're registering per-display components */ bonobo_activation_set_activation_env_value ("DISPLAY", gdk_display_get_name (gdk_display_get_default())); if (perform_self_check && remaining != NULL) { /* translators: %s is an option (e.g. --check) */ fprintf (stderr, _("nautilus: %s cannot be used with URIs.\n"), "--check"); return EXIT_FAILURE; } if (perform_self_check && (kill_shell || restart_shell)) { fprintf (stderr, _("nautilus: --check cannot be used with other options.\n")); return EXIT_FAILURE; } if (kill_shell && remaining != NULL) { fprintf (stderr, _("nautilus: %s cannot be used with URIs.\n"), "--quit"); return EXIT_FAILURE; } if (restart_shell && remaining != NULL) { fprintf (stderr, _("nautilus: %s cannot be used with URIs.\n"), "--restart"); return EXIT_FAILURE; } if (geometry != NULL && remaining != NULL && remaining[0] != NULL && remaining[1] != NULL) { fprintf (stderr, _("nautilus: --geometry cannot be used with more than one URI.\n")); return EXIT_FAILURE; } /* Initialize the services that we use. */ LIBXML_TEST_VERSION /* Initialize preferences. This is needed so that proper * defaults are available before any preference peeking * happens. */ nautilus_global_preferences_init (); if (no_desktop) { eel_preferences_set_is_invisible (NAUTILUS_PREFERENCES_SHOW_DESKTOP, TRUE); eel_preferences_set_is_invisible (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR, TRUE); } bonobo_activate (); /* do now since we need it before main loop */ application = NULL; /* Do either the self-check or the real work. */ if (perform_self_check) { #ifndef NAUTILUS_OMIT_SELF_CHECK /* Run the checks (each twice) for nautilus and libnautilus-private. */ nautilus_run_self_checks (); nautilus_run_lib_self_checks (); eel_exit_if_self_checks_failed (); nautilus_run_self_checks (); nautilus_run_lib_self_checks (); eel_exit_if_self_checks_failed (); #endif } else { /* Run the nautilus application. */ application = nautilus_application_new (); nautilus_application_startup (application, kill_shell, restart_shell, no_default_window, no_desktop, !(kill_shell || restart_shell), browser_window, startup_id_copy, geometry, session_to_load, remaining); g_free (startup_id_copy); /* The application startup does things in an idle, so we need to check whether the main loop is needed in an idle */ g_idle_add (initial_event_loop_needed, NULL); gtk_main (); } nautilus_icon_info_clear_caches (); if (application != NULL) { bonobo_object_unref (application); } eel_debug_shut_down (); /* If told to restart, exec() myself again. This is used when * the program is told to restart with CORBA, for example when * an update takes place. */ if (g_getenv ("_NAUTILUS_RESTART") != NULL) { g_unsetenv ("_NAUTILUS_RESTART"); /* Might eventually want to copy all the parameters * from argv into the new exec. For now, though, that * would just interfere with the re-creation of * windows based on the window info stored in gconf, * including whether the desktop was started. */ argv_copy = g_new0 (char *, 2); argv_copy[0] = argv[0]; execvp (argv[0], argv_copy); }