[gtksourceview] utils: remove deprecated compat dir from get_default_dirs()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] utils: remove deprecated compat dir from get_default_dirs()
- Date: Sun, 24 Sep 2017 07:55:48 +0000 (UTC)
commit b6d61f2cbc55b3590a061a19b496234accca7979
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Sep 24 09:42:34 2017 +0200
utils: remove deprecated compat dir from get_default_dirs()
And improve a bit the coding style.
gtksourceview/gtksourcelanguagemanager.c | 4 +-
gtksourceview/gtksourcestyleschememanager.c | 8 +++---
gtksourceview/gtksourceview-utils.c | 34 +++++++-------------------
gtksourceview/gtksourceview-utils.h | 3 +-
4 files changed, 16 insertions(+), 33 deletions(-)
---
diff --git a/gtksourceview/gtksourcelanguagemanager.c b/gtksourceview/gtksourcelanguagemanager.c
index 39c0ae4..4d8ae35 100644
--- a/gtksourceview/gtksourcelanguagemanager.c
+++ b/gtksourceview/gtksourcelanguagemanager.c
@@ -260,7 +260,7 @@ gtk_source_language_manager_set_search_path (GtkSourceLanguageManager *lm,
tmp = lm->priv->lang_dirs;
if (dirs == NULL)
- lm->priv->lang_dirs = _gtk_source_utils_get_default_dirs (LANGUAGE_DIR, TRUE);
+ lm->priv->lang_dirs = _gtk_source_utils_get_default_dirs (LANGUAGE_DIR);
else
lm->priv->lang_dirs = g_strdupv (dirs);
@@ -285,7 +285,7 @@ gtk_source_language_manager_get_search_path (GtkSourceLanguageManager *lm)
g_return_val_if_fail (GTK_SOURCE_IS_LANGUAGE_MANAGER (lm), NULL);
if (lm->priv->lang_dirs == NULL)
- lm->priv->lang_dirs = _gtk_source_utils_get_default_dirs (LANGUAGE_DIR, TRUE);
+ lm->priv->lang_dirs = _gtk_source_utils_get_default_dirs (LANGUAGE_DIR);
return (const gchar * const *)lm->priv->lang_dirs;
}
diff --git a/gtksourceview/gtksourcestyleschememanager.c b/gtksourceview/gtksourcestyleschememanager.c
index bfc2c67..5a1911d 100644
--- a/gtksourceview/gtksourcestyleschememanager.c
+++ b/gtksourceview/gtksourcestyleschememanager.c
@@ -423,7 +423,7 @@ gtk_source_style_scheme_manager_set_search_path (GtkSourceStyleSchemeManager *m
tmp = manager->priv->search_path;
if (path == NULL)
- manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR, FALSE);
+ manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR);
else
manager->priv->search_path = g_strdupv (path);
@@ -451,7 +451,7 @@ gtk_source_style_scheme_manager_append_search_path (GtkSourceStyleSchemeManager
g_return_if_fail (path != NULL);
if (manager->priv->search_path == NULL)
- manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR, FALSE);
+ manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR);
g_return_if_fail (manager->priv->search_path != NULL);
@@ -487,7 +487,7 @@ gtk_source_style_scheme_manager_prepend_search_path (GtkSourceStyleSchemeManager
g_return_if_fail (path != NULL);
if (manager->priv->search_path == NULL)
- manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR, FALSE);
+ manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR);
g_return_if_fail (manager->priv->search_path != NULL);
@@ -520,7 +520,7 @@ gtk_source_style_scheme_manager_get_search_path (GtkSourceStyleSchemeManager *ma
g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), NULL);
if (manager->priv->search_path == NULL)
- manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR, FALSE);
+ manager->priv->search_path = _gtk_source_utils_get_default_dirs (STYLES_DIR);
return (const gchar * const *)manager->priv->search_path;
}
diff --git a/gtksourceview/gtksourceview-utils.c b/gtksourceview/gtksourceview-utils.c
index 500516a..de4fe4d 100644
--- a/gtksourceview/gtksourceview-utils.c
+++ b/gtksourceview/gtksourceview-utils.c
@@ -30,41 +30,25 @@
#define SOURCEVIEW_DIR "gtksourceview-3.0"
gchar **
-_gtk_source_utils_get_default_dirs (const char *basename,
- gboolean compat)
+_gtk_source_utils_get_default_dirs (const gchar *basename)
{
- const gchar * const *xdg_dirs;
+ const gchar * const *system_dirs;
GPtrArray *dirs;
dirs = g_ptr_array_new ();
- /* user dir */
+ /* User dir */
g_ptr_array_add (dirs, g_build_filename (g_get_user_data_dir (),
SOURCEVIEW_DIR,
basename,
NULL));
-#ifdef G_OS_UNIX
- /* Legacy gtsourceview 1 user dir, for backward compatibility */
- if (compat)
+ /* System dirs */
+ for (system_dirs = g_get_system_data_dirs ();
+ system_dirs != NULL && *system_dirs != NULL;
+ system_dirs++)
{
- const gchar *home;
-
- home = g_get_home_dir ();
- if (home != NULL)
- {
- g_ptr_array_add (dirs,
- g_strdup_printf ("%s/%s",
- home,
- ".gnome2/gtksourceview-1.0/language-specs"));
- }
- }
-#endif
-
- /* system dir */
- for (xdg_dirs = g_get_system_data_dirs (); xdg_dirs && *xdg_dirs; ++xdg_dirs)
- {
- g_ptr_array_add (dirs, g_build_filename (*xdg_dirs,
+ g_ptr_array_add (dirs, g_build_filename (*system_dirs,
SOURCEVIEW_DIR,
basename,
NULL));
@@ -72,7 +56,7 @@ _gtk_source_utils_get_default_dirs (const char *basename,
g_ptr_array_add (dirs, NULL);
- return (gchar**) g_ptr_array_free (dirs, FALSE);
+ return (gchar **) g_ptr_array_free (dirs, FALSE);
}
static GSList *
diff --git a/gtksourceview/gtksourceview-utils.h b/gtksourceview/gtksourceview-utils.h
index 5a38c6d..2debe62 100644
--- a/gtksourceview/gtksourceview-utils.h
+++ b/gtksourceview/gtksourceview-utils.h
@@ -27,8 +27,7 @@
G_BEGIN_DECLS
G_GNUC_INTERNAL
-gchar ** _gtk_source_utils_get_default_dirs (const gchar *basename,
- gboolean compat);
+gchar ** _gtk_source_utils_get_default_dirs (const gchar *basename);
G_GNUC_INTERNAL
GSList * _gtk_source_view_get_file_list (gchar **path,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]