From ba0a27c3ea6a73bdef387bd73739b07423abe41e Mon Sep 17 00:00:00 2001 From: titan Date: Sun, 11 Mar 2007 09:19:53 +0000 Subject: [PATCH] Change my mind on how I wanted to initialize the lists. SVN revision: 28655 --- src/bin/ephoto_database.c | 8 ++++++-- src/bin/ephoto_main.c | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bin/ephoto_database.c b/src/bin/ephoto_database.c index ca94b61..67cf8d1 100644 --- a/src/bin/ephoto_database.c +++ b/src/bin/ephoto_database.c @@ -11,7 +11,7 @@ static int list_image_ids(void *notused, int argc, char **argv, char **col); static int image_id, album_id; /*Ephoto databasing ecore global variables*/ -static Ecore_List *albums = NULL, *images_list = NULL, *image_ids = NULL; +static Ecore_List *albums, *images_list, *image_ids; /*Open the sqlite3 database. Create the database if it does not already exits.*/ sqlite3 *ephoto_db_init(void) @@ -20,6 +20,10 @@ sqlite3 *ephoto_db_init(void) char path2[PATH_MAX]; sqlite3 *db; + albums = ecore_list_new(); + images_list = ecore_dlist_new(); + image_ids = ecore_list_new(); + snprintf(path, PATH_MAX, "%s/.ephoto/.ephoto_database", getenv("HOME")); snprintf(path2, PATH_MAX, "%s/.ephoto", getenv("HOME")); @@ -218,7 +222,7 @@ Ecore_List *ephoto_db_list_images(sqlite3 *db, const char *album) } images_list = ecore_dlist_new(); image_ids = ecore_list_new(); - + snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = '%s';", album); sqlite3_exec(db, command, get_album_id, 0, 0); snprintf(command, PATH_MAX, "SELECT image_id FROM album_images WHERE album_id = '%d';", album_id); diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index 8b067e1..2bd1e6b 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -55,8 +55,8 @@ void create_main_gui(void) em = NULL; em = calloc(1, sizeof(Ephoto_Main)); - em->albums = NULL; - em->images = NULL; + em->albums = ecore_list_new(); + em->images = ecore_dlist_new(); em->win = ewl_window_new(); ewl_window_title_set(EWL_WINDOW(em->win), "Ephoto!"); @@ -189,7 +189,7 @@ static void populate(Ewl_Widget *w, void *event, void *data) album = data; } - if (em->images) + if (!ecore_list_is_empty(em->images)) { ecore_dlist_destroy(em->images); }