[gnome-desktop] thumbnail: Simplify init_thumbnailers_dirs()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] thumbnail: Simplify init_thumbnailers_dirs()
- Date: Thu, 20 Jul 2017 23:20:59 +0000 (UTC)
commit a0702a2137c66b04953b91cfd49ce5c7e8414e8a
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jul 11 11:07:59 2017 +0200
thumbnail: Simplify init_thumbnailers_dirs()
libgnome-desktop/gnome-desktop-thumbnail.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c
index 381b8d6..6c4cd27 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail.c
@@ -326,19 +326,18 @@ static gpointer
init_thumbnailers_dirs (gpointer data)
{
const gchar * const *data_dirs;
- gchar **thumbs_dirs;
- guint i, length;
+ GPtrArray *thumbs_dirs;
+ guint i;
data_dirs = g_get_system_data_dirs ();
- length = g_strv_length ((char **) data_dirs);
+ thumbs_dirs = g_ptr_array_new ();
- thumbs_dirs = g_new (gchar *, length + 2);
- thumbs_dirs[0] = g_build_filename (g_get_user_data_dir (), "thumbnailers", NULL);
- for (i = 0; i < length; i++)
- thumbs_dirs[i + 1] = g_build_filename (data_dirs[i], "thumbnailers", NULL);
- thumbs_dirs[length + 1] = NULL;
+ g_ptr_array_add (thumbs_dirs, g_build_filename (g_get_user_data_dir (), "thumbnailers", NULL));
+ for (i = 0; data_dirs[i] != NULL; i++)
+ g_ptr_array_add (thumbs_dirs, g_build_filename (data_dirs[i], "thumbnailers", NULL));
+ g_ptr_array_add (thumbs_dirs, NULL);
- return thumbs_dirs;
+ return g_ptr_array_free (thumbs_dirs, FALSE);
}
static const gchar * const *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]