Accepting request 503613 from home:olh:branches:GNOME:Factory
- Sort directory entries when creating built-in icon cache gtk2.updateiconcache.sort.patch OBS-URL: https://build.opensuse.org/request/show/503613 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk2?expand=0&rev=246
This commit is contained in:
parent
10d4d21f3e
commit
d5779996cd
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jun 14 08:01:41 UTC 2017 - olaf@aepfle.de
|
||||||
|
|
||||||
|
- Sort directory entries when creating built-in icon cache
|
||||||
|
gtk2.updateiconcache.sort.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Sep 13 03:13:00 UTC 2016 - mgorse@suse.com
|
Tue Sep 13 03:13:00 UTC 2016 - mgorse@suse.com
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ Source4: baselibs.conf
|
|||||||
Source5: macros.gtk2
|
Source5: macros.gtk2
|
||||||
# PATCH-FIX-UPSTREAM gtk2-window-dragging.patch bgo#611313 -- Taken from Fedora, to support window dragging from menubars/toolbars
|
# PATCH-FIX-UPSTREAM gtk2-window-dragging.patch bgo#611313 -- Taken from Fedora, to support window dragging from menubars/toolbars
|
||||||
Patch0: gtk2-window-dragging.patch
|
Patch0: gtk2-window-dragging.patch
|
||||||
|
Patch1: gtk2.updateiconcache.sort.patch
|
||||||
# PATCH-FIX-OPENSUSE gtk2-GTK_PATH64.patch sbrabec@novell.com - 64-bit dual install. Use GTK_PATH64 environment variable instead of GTK_PATH
|
# PATCH-FIX-OPENSUSE gtk2-GTK_PATH64.patch sbrabec@novell.com - 64-bit dual install. Use GTK_PATH64 environment variable instead of GTK_PATH
|
||||||
Patch8: gtk2-GTK_PATH64.patch
|
Patch8: gtk2-GTK_PATH64.patch
|
||||||
# PATCH-FEATURE-UPSTREAM bugzilla-129753-gtk+-2.8.9-localize-font-style-name.diff bnc129753 bgo319484 mfabian@novell.com - Translate the font styles in the GUI
|
# PATCH-FEATURE-UPSTREAM bugzilla-129753-gtk+-2.8.9-localize-font-style-name.diff bnc129753 bgo319484 mfabian@novell.com - Translate the font styles in the GUI
|
||||||
@ -324,6 +325,7 @@ for LNG in po/*.po ; do
|
|||||||
done
|
done
|
||||||
gnome-patch-translation-prepare
|
gnome-patch-translation-prepare
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
%if "%{_lib}" == "lib64"
|
%if "%{_lib}" == "lib64"
|
||||||
cp -a %{SOURCE2} .
|
cp -a %{SOURCE2} .
|
||||||
# WARNING: This patch does not patch not installed demos and tests.
|
# WARNING: This patch does not patch not installed demos and tests.
|
||||||
|
97
gtk2.updateiconcache.sort.patch
Normal file
97
gtk2.updateiconcache.sort.patch
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
--- a/gtk/updateiconcache.c
|
||||||
|
+++ b/gtk/updateiconcache.c
|
||||||
|
@@ -37,6 +37,7 @@
|
||||||
|
#include <utime.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#include <dirent.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
#undef GDK_PIXBUF_DISABLE_DEPRECATED
|
||||||
|
@@ -594,6 +595,50 @@ replace_backslashes_with_slashes (gchar
|
||||||
|
path[i] = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
+struct sortdir {
|
||||||
|
+ struct dirent **nl;
|
||||||
|
+ int cur;
|
||||||
|
+ int max;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const gchar *sort_item(struct sortdir *sd)
|
||||||
|
+{
|
||||||
|
+ while (sd->cur >= 0) {
|
||||||
|
+ if (strcmp (sd->nl[sd->cur]->d_name, "..") == 0)
|
||||||
|
+ {
|
||||||
|
+ sd->cur--;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if (strcmp (sd->nl[sd->cur]->d_name, ".") == 0)
|
||||||
|
+ {
|
||||||
|
+ sd->cur--;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ return sd->nl[sd->cur--]->d_name;
|
||||||
|
+ }
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static gboolean sort_open(char *path, struct sortdir *sd)
|
||||||
|
+{
|
||||||
|
+ int n;
|
||||||
|
+
|
||||||
|
+ n = scandir(path, &sd->nl, NULL, alphasort);
|
||||||
|
+ if (n <= 0)
|
||||||
|
+ return FALSE;
|
||||||
|
+ sd->max = sd->cur = n - 1;
|
||||||
|
+ return TRUE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void sort_close(struct sortdir *sd)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ for (i = sd->max; i >= 0; i--)
|
||||||
|
+ free(sd->nl[i]);
|
||||||
|
+ free(sd->nl);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static GList *
|
||||||
|
scan_directory (const gchar *base_path,
|
||||||
|
const gchar *subdir,
|
||||||
|
@@ -602,7 +647,7 @@ scan_directory (const gchar *base_path,
|
||||||
|
gint depth)
|
||||||
|
{
|
||||||
|
GHashTable *dir_hash;
|
||||||
|
- GDir *dir;
|
||||||
|
+ struct sortdir sortdir;
|
||||||
|
const gchar *name;
|
||||||
|
gchar *dir_path;
|
||||||
|
gboolean dir_added = FALSE;
|
||||||
|
@@ -610,15 +655,12 @@ scan_directory (const gchar *base_path,
|
||||||
|
|
||||||
|
dir_path = g_build_path ("/", base_path, subdir, NULL);
|
||||||
|
|
||||||
|
- /* FIXME: Use the gerror */
|
||||||
|
- dir = g_dir_open (dir_path, 0, NULL);
|
||||||
|
-
|
||||||
|
- if (!dir)
|
||||||
|
+ if (sort_open(dir_path, &sortdir) == FALSE)
|
||||||
|
return directories;
|
||||||
|
|
||||||
|
dir_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
|
||||||
|
- while ((name = g_dir_read_name (dir)))
|
||||||
|
+ while ((name = sort_item(&sortdir)))
|
||||||
|
{
|
||||||
|
gchar *path;
|
||||||
|
gboolean retval;
|
||||||
|
@@ -698,7 +740,7 @@ scan_directory (const gchar *base_path,
|
||||||
|
g_free (path);
|
||||||
|
}
|
||||||
|
|
||||||
|
- g_dir_close (dir);
|
||||||
|
+ sort_close(&sortdir);
|
||||||
|
|
||||||
|
/* Move dir into the big file hash */
|
||||||
|
g_hash_table_foreach_remove (dir_hash, foreach_remove_func, files);
|
Loading…
x
Reference in New Issue
Block a user