[libadwaita/wip/exalm/screenshots-2: 8/23] screenshot: Sort images
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/screenshots-2: 8/23] screenshot: Sort images
- Date: Tue, 21 Dec 2021 07:05:47 +0000 (UTC)
commit cba301f0e3adbdf23f5a505c9af16da0b8fbf7a4
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]