[libadwaita/wip/exalm/screenshots-2: 2/15] screenshot: Sort images
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/screenshots-2: 2/15] screenshot: Sort images
- Date: Mon, 20 Dec 2021 15:37:46 +0000 (UTC)
commit 8695e6e30c4fe06d602a55498d21f3fec6acce3d
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Dec 18 04:28:51 2021 +0500
screenshot: Sort images
doc/tools/screenshot.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/doc/tools/screenshot.c b/doc/tools/screenshot.c
index 2271c3d1..4babe508 100644
--- a/doc/tools/screenshot.c
+++ b/doc/tools/screenshot.c
@@ -236,6 +236,16 @@ init_libadwaita (void)
NULL);
}
+static int
+compare_images (gconstpointer a,
+ gconstpointer b)
+{
+ char **ap = (char **) a;
+ char **bp = (char **) b;
+
+ return g_ascii_strcasecmp (*ap, *bp);
+}
+
static char **
list_images (void)
{
@@ -244,10 +254,14 @@ list_images (void)
g_resources_enumerate_children (RESOURCE_PATH "data",
G_RESOURCE_LOOKUP_FLAGS_NONE,
&error);
+ guint length;
if (error)
g_critical ("Couldn't enumerate children: %s", error->message);
+ length = g_strv_length (children);
+ qsort (children, length, sizeof (char *), compare_images);
+
return children;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]