summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
authorBastien Nocera <[email protected]>2017-07-11 11:07:59 +0200
committerraveit65 <[email protected]>2020-01-18 23:46:03 +0100
commit90e62f364e5bad38b741ba0df38a7555f6d2045c (patch)
tree9d38a4e4ba6082b836f9ff38882ec5882fcdd240 /libmate-desktop
parent25c870976c9090e9d93c85fb83d821ab81e99898 (diff)
downloadmate-desktop-90e62f364e5bad38b741ba0df38a7555f6d2045c.tar.bz2
mate-desktop-90e62f364e5bad38b741ba0df38a7555f6d2045c.tar.xz
thumbnail: Simplify init_thumbnailers_dirs()
origin commit: https://gitlab.gnome.org/GNOME/gnome-desktop/commit/a0702a2
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-desktop-thumbnail.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libmate-desktop/mate-desktop-thumbnail.c b/libmate-desktop/mate-desktop-thumbnail.c
index 3a14a68..e88c537 100644
--- a/libmate-desktop/mate-desktop-thumbnail.c
+++ b/libmate-desktop/mate-desktop-thumbnail.c
@@ -220,19 +220,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 *