Skip to content

Commit

Permalink
recent: sort items by MRU.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhdunn committed Apr 23, 2012
1 parent b5f3f32 commit d4eb944
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/library.cpp
Expand Up @@ -34,6 +34,12 @@ enum LibColumns

namespace rql = cainteoir::rdf::query;

static gint sort_recent_items_mru(GtkRecentInfo *a, GtkRecentInfo *b, gpointer unused)
{
g_assert(a != NULL && b != NULL);
return gtk_recent_info_get_modified(b) - gtk_recent_info_get_modified(a);
}

static GtkWidget *create_nav_item(const char *name, bool is_button)
{
GtkWidget *item;
Expand Down Expand Up @@ -110,7 +116,7 @@ DocumentLibrary::DocumentLibrary(cainteoir::languages &aLanguages, GtkRecentMana

void DocumentLibrary::update_recent(GtkRecentManager *aRecent, rdf::graph &aMetadata, int max_items_to_show)
{
GList *items = gtk_recent_manager_get_items(aRecent);
GList *items = g_list_sort(gtk_recent_manager_get_items(aRecent), (GCompareFunc)sort_recent_items_mru);

rql::results mimetypes = rql::select(aMetadata, rql::matches(rql::predicate, rdf::tts("mimetype")));

Expand Down

0 comments on commit d4eb944

Please sign in to comment.