Exemple #1
0
/**
 * caja_get_desktop_directory:
 *
 * Get the path for the directory containing files on the desktop.
 *
 * Return value: the directory path.
 **/
char *
caja_get_desktop_directory (void)
{
    char *desktop_directory;

    desktop_directory = get_desktop_path ();

    /* Don't try to create a home directory */
    if (!g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR))
    {
        if (!g_file_test (desktop_directory, G_FILE_TEST_EXISTS))
        {
            g_mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
            /* FIXME bugzilla.gnome.org 41286:
             * How should we handle the case where this mkdir fails?
             * Note that caja_application_startup will refuse to launch if this
             * directory doesn't get created, so that case is OK. But the directory
             * could be deleted after Caja was launched, and perhaps
             * there is some bad side-effect of not handling that case.
             */
        }
    }

    return desktop_directory;
}
GFile *
nautilus_get_desktop_location (void)
{
    char *desktop_directory;
    GFile *res;

    desktop_directory = get_desktop_path ();

    res = g_file_new_for_path (desktop_directory);
    g_free (desktop_directory);
    return res;
}
char *
nautilus_get_desktop_directory_uri_no_create (void)
{
	char *desktop_path;
	char *desktop_uri;
	
	desktop_path = get_desktop_path ();
	desktop_uri = g_filename_to_uri (desktop_path, NULL, NULL);
	g_free (desktop_path);

	return desktop_uri;
}
static void
update_desktop_dir (void)
{
	const char *path;
	char *dirname;

	path = get_desktop_path ();
	desktop_dir = g_file_new_for_path (path);
	
	dirname = g_path_get_dirname (path);
	desktop_dir_dir = g_file_new_for_path (dirname);
	g_free (dirname);
	desktop_dir_filename = g_path_get_basename (path);
}
/**
 * nautilus_get_desktop_directory:
 * 
 * Get the path for the directory containing files on the desktop.
 *
 * Return value: the directory path.
 **/
char *
nautilus_get_desktop_directory (void)
{
	const char *desktop_directory;
	
	desktop_directory = get_desktop_path ();

	/* Don't try to create a home directory */
	if (!g_file_test (desktop_directory, G_FILE_TEST_EXISTS)) {
		g_mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
		/* FIXME bugzilla.gnome.org 41286: 
		 * How should we handle the case where this mkdir fails? 
		 * Note that nautilus_application_startup will refuse to launch if this 
		 * directory doesn't get created, so that case is OK. But the directory 
		 * could be deleted after Nautilus was launched, and perhaps
		 * there is some bad side-effect of not handling that case.
		 */
	}

	return g_strdup (desktop_directory);
}
GFile *
nautilus_get_desktop_location (void)
{
	return g_file_new_for_path (get_desktop_path ());
}