From 2f82ed57b751145449506164888281b57819abcc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 19 Jan 2010 17:01:57 -0600 Subject: Adding some API to our LRU file --- src/application-service-lru-file.c | 33 +++++++++++++++++++++++++++++++++ src/application-service-lru-file.h | 4 ++++ 2 files changed, 37 insertions(+) diff --git a/src/application-service-lru-file.c b/src/application-service-lru-file.c index 3cbb1dc..47cfab9 100644 --- a/src/application-service-lru-file.c +++ b/src/application-service-lru-file.c @@ -54,3 +54,36 @@ app_lru_file_finalize (GObject *object) G_OBJECT_CLASS (app_lru_file_parent_class)->finalize (object); return; } + +/* API */ + +/* Simple helper to create a new object */ +AppLruFile * +app_lru_file_new (void) +{ + return APP_LRU_FILE(g_object_new(APP_LRU_FILE_TYPE, NULL)); +} + +/* This updates the timestamp for a particular + entry in the database. It also queues up a + write out of the database. But that'll happen + later. */ +void +app_lru_file_touch (AppLruFile * lrufile, const gchar * id, const gchar * category) +{ + g_return_if_fail(IS_APP_LRU_FILE(lrufile)); + g_return_if_fail(id != NULL && id[0] != '\0'); + g_return_if_fail(category != NULL && category[0] != '\0'); + + return; +} + +/* Used to sort or compare different applications. */ +gint +app_lru_file_sort (AppLruFile * lrufile, const gchar * id_a, const gchar * id_b) +{ + g_return_val_if_fail(IS_APP_LRU_FILE(lrufile), -1); + + + return 0; +} diff --git a/src/application-service-lru-file.h b/src/application-service-lru-file.h index 6577278..45d3082 100644 --- a/src/application-service-lru-file.h +++ b/src/application-service-lru-file.h @@ -28,6 +28,10 @@ struct _AppLruFile { GType app_lru_file_get_type (void); +AppLruFile * app_lru_file_new (void); +void app_lru_file_touch (AppLruFile * lrufile, const gchar * id, const gchar * category); +gint app_lru_file_sort (AppLruFile * lrufile, const gchar * id_a, const gchar * id_b); + G_END_DECLS #endif -- cgit v1.2.3