summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 62bdfdd)
raw | patch | inline | side by side (parent: 62bdfdd)
author | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 17:18:04 +0000 (19:18 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 17:18:04 +0000 (19:18 +0200) |
src/filelist.c | patch | blob | history | |
src/filelist.h | patch | blob | history | |
src/mpdclient.c | patch | blob | history |
diff --git a/src/filelist.c b/src/filelist.c
index 2ce928cd4f73d7388bfb675a42d90b2896d41d3c..a8b8b3ca364b5445719873ac9c98c30078aa39ef 100644 (file)
--- a/src/filelist.c
+++ b/src/filelist.c
return compare_func(a, b);
}
+gint
+compare_filelist_entry_path(gconstpointer filelist_entry1,
+ gconstpointer filelist_entry2)
+{
+ const struct mpd_entity *e1, *e2;
+ int n = 0;
+
+ e1 = ((const struct filelist_entry *)filelist_entry1)->entity;
+ e2 = ((const struct filelist_entry *)filelist_entry2)->entity;
+
+ if (e1 != NULL && e2 != NULL &&
+ mpd_entity_get_type(e1) == mpd_entity_get_type(e2)) {
+ switch (mpd_entity_get_type(e1)) {
+ case MPD_ENTITY_TYPE_UNKNOWN:
+ break;
+ case MPD_ENTITY_TYPE_DIRECTORY:
+ n = g_utf8_collate(mpd_directory_get_path(mpd_entity_get_directory(e1)),
+ mpd_directory_get_path(mpd_entity_get_directory(e2)));
+ break;
+ case MPD_ENTITY_TYPE_SONG:
+ break;
+ case MPD_ENTITY_TYPE_PLAYLIST:
+ n = g_utf8_collate(mpd_playlist_get_path(mpd_entity_get_playlist(e1)),
+ mpd_playlist_get_path(mpd_entity_get_playlist(e2)));
+ }
+ }
+ return n;
+}
+
/* Sorts the whole filelist, at the moment used by filelist_search */
void
filelist_sort_all(struct filelist *filelist, GCompareFunc compare_func)
diff --git a/src/filelist.h b/src/filelist.h
index ee6e60610fa7fc01803a52b3252f5f1b792b6793..a0805d16bbf25921538f03bcb2fa95e3fb581187 100644 (file)
--- a/src/filelist.h
+++ b/src/filelist.h
void
filelist_move(struct filelist *filelist, struct filelist *from);
+gint
+compare_filelist_entry_path(gconstpointer filelist_entry1,
+ gconstpointer filelist_entry2);
+
/* Sorts the whole filelist, at the moment used by filelist_search */
void
filelist_sort_all(struct filelist *filelist, GCompareFunc compare_func);
diff --git a/src/mpdclient.c b/src/mpdclient.c
index c7b016845ae1746bb3018e8128565d0ae9c5d02c..d8557159ffb7e9fa667285e4a1a964ffd7cf58d2 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
mpd_connection_get_error(client->connection) != MPD_ERROR_SUCCESS;
}
-/* filelist sorting functions */
-static gint
-compare_filelistentry(gconstpointer filelist_entry1,
- gconstpointer filelist_entry2)
-{
- const struct mpd_entity *e1, *e2;
- int n = 0;
-
- e1 = ((const struct filelist_entry *)filelist_entry1)->entity;
- e2 = ((const struct filelist_entry *)filelist_entry2)->entity;
-
- if (e1 != NULL && e2 != NULL &&
- mpd_entity_get_type(e1) == mpd_entity_get_type(e2)) {
- switch (mpd_entity_get_type(e1)) {
- case MPD_ENTITY_TYPE_UNKNOWN:
- break;
- case MPD_ENTITY_TYPE_DIRECTORY:
- n = g_utf8_collate(mpd_directory_get_path(mpd_entity_get_directory(e1)),
- mpd_directory_get_path(mpd_entity_get_directory(e2)));
- break;
- case MPD_ENTITY_TYPE_SONG:
- break;
- case MPD_ENTITY_TYPE_PLAYLIST:
- n = g_utf8_collate(mpd_playlist_get_path(mpd_entity_get_playlist(e1)),
- mpd_playlist_get_path(mpd_entity_get_playlist(e2)));
- }
- }
- return n;
-}
-
/* sort by list-format */
gint
compare_filelistentry_format(gconstpointer filelist_entry1,
if (filelist == NULL)
return NULL;
- filelist_sort_dir_play(filelist, compare_filelistentry);
+ filelist_sort_dir_play(filelist, compare_filelist_entry_path);
return filelist;
}