Exemplo n.º 1
0
GList *editor_get_desktop_files(void)
{
	gchar *path;
	gchar *xdg_data_dirs;
	gchar *all_dirs;
	gchar **split_dirs;
	gint i;
	GList *list = NULL;

	xdg_data_dirs = getenv("XDG_DATA_DIRS");
	if (xdg_data_dirs && xdg_data_dirs[0])
		xdg_data_dirs = path_to_utf8(xdg_data_dirs);
	else
		xdg_data_dirs = g_strdup("/usr/share");

	all_dirs = g_strconcat(get_rc_dir(), ":", GQ_APP_DIR, ":", xdg_data_home_get(), ":", xdg_data_dirs, NULL);

	g_free(xdg_data_dirs);

	split_dirs = g_strsplit(all_dirs, ":", 0);

	g_free(all_dirs);

	for (i = 0; split_dirs[i]; i++);
	for (--i; i >= 0; i--)
		{
		path = g_build_filename(split_dirs[i], "applications", NULL);
		list = editor_add_desktop_dir(list, path);
		g_free(path);
		}

	g_strfreev(split_dirs);
	return list;
}
Exemplo n.º 2
0
const gchar *get_metadata_cache_dir(void)
{
	static gchar *metadata_cache_dir = NULL;

	if (metadata_cache_dir) return metadata_cache_dir;

	if (USE_XDG)
		{
		/* Metadata go to $XDG_DATA_HOME.
		 * "Keywords and comments, among other things, are irreplaceable and cannot be auto-generated,
		 * so I don't think they'd be appropriate for the cache directory." -- Omari Stephens on geeqie-devel ml
		 */
		metadata_cache_dir = g_build_filename(xdg_data_home_get(), GQ_APPNAME_LC, GQ_CACHE_METADATA, NULL);
		}
	else
		{
		metadata_cache_dir = g_build_filename(get_rc_dir(), GQ_CACHE_METADATA, NULL);
		}

	return metadata_cache_dir;
}