Enlightenment CVS committal

Author  : titan
Project : e17
Module  : proto

Dir     : e17/proto/ephoto/src/bin


Modified Files:
        Makefile.am ephoto.h ephoto_gui.c 
Added Files:
        ephoto_database.c 


Log Message:
Add a databaser to ephoto_test in preparation to move ephoto_test to an album 
style image viewer.

===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Makefile.am 11 Jan 2007 23:14:28 -0000      1.3
+++ Makefile.am 26 Jan 2007 08:26:57 -0000      1.4
@@ -4,13 +4,14 @@
 
 ephoto_test_SOURCES = ephoto.c \
                      ephoto_browsing.c \
+                     ephoto_database.c \
                      ephoto_gui.c \
                      ephoto_imaging.c \
                      ephoto_nls.c 
                     
 ephoto_test_CFLAGS = @ewl_cflags@
 
-ephoto_test_LDADD =  @ewl_libs@
+ephoto_test_LDADD =  @ewl_libs@ -lsqlite3
 
 EXTRA_DIST = \
             ephoto.h
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ephoto.h    19 Jan 2007 03:20:11 -0000      1.8
+++ ephoto.h    26 Jan 2007 08:26:57 -0000      1.9
@@ -8,6 +8,7 @@
 #include <fnmatch.h>
 #include <libgen.h>
 #include <limits.h>
+#include <sqlite3.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -19,6 +20,14 @@
 /* Ephoto Browsing */
 Ecore_List *get_directories(char *directory);
 Ecore_List *get_images(char *directory);
+
+/* Ephoto Databasing */
+sqlite3 *ephoto_db_init(void);
+void ephoto_db_add_album(sqlite3 *db, char *name, char *description);
+Ecore_List *ephoto_db_list_albums(sqlite3 *db);
+void ephoto_db_add_image(sqlite3 *db, char *album, char *name, char *path);
+Ecore_List *ephoto_db_list_images(sqlite3 *db, char *album);
+void ephoto_db_close(sqlite3 *db);
 
 /* Ephoto Imaging */
 unsigned int *flip_horizontal(Ewl_Widget *image);
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto_gui.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ephoto_gui.c        26 Jan 2007 05:16:54 -0000      1.25
+++ ephoto_gui.c        26 Jan 2007 08:26:57 -0000      1.26
@@ -34,12 +34,13 @@
 static Ecore_Timer *timer;
 static Ecore_List *albums, *images;
 
-/*Ephoto Current Directory*/
-static char *current_directory;
+/*Ephoto Databasing Global Variables*/
+sqlite3 *db;
 
 /*Destroy the Main Window*/
 static void destroy(Ewl_Widget *w, void *event, void *data)
 {
+       ephoto_db_close(db);
         ewl_widget_destroy(w);
         ewl_main_quit();
 }
@@ -187,7 +188,7 @@
 
        album = data;
        ewl_icon_image_set(EWL_ICON(w), PACKAGE_DATA_DIR "/images/image.png", 
NULL);
-       ewl_icon_label_set(EWL_ICON(w), basename(album));
+       ewl_icon_label_set(EWL_ICON(w), album);
        ewl_icon_constrain_set(EWL_ICON(w), 25);
        ewl_widget_name_set(w, album);
        ewl_callback_append(w, EWL_CALLBACK_CLICKED, populate, NULL);
@@ -256,19 +257,18 @@
        {
                album = (char *)ewl_widget_name_get(w);
        }
-
-       if (!ecore_list_is_empty(albums))
+       else
        {
-               ecore_list_destroy(albums);
-               albums = ecore_list_new();
+               album = data;
        }
-       if (!ecore_list_is_empty(images))
+
+       if (images)
        {
                ecore_list_destroy(images);
-               images = ecore_list_new();
        }
 
-       ewl_mvc_data_set(EWL_MVC(atree), albums);
+       images = ecore_list_new();
+       images = ephoto_db_list_images(db, album);
 
        ewl_container_reset(EWL_CONTAINER(fbox));
        while (!ecore_list_is_empty(images))
@@ -413,8 +413,11 @@
        ewl_widget_show(vimage);
 
        albums = ecore_list_new();
-       images = ecore_list_new();
-       populate(NULL, NULL, NULL);
+       db = ephoto_db_init();
+       albums = ephoto_db_list_albums(db);
+       ewl_mvc_data_set(EWL_MVC(atree), albums);
+       
+       populate(NULL, NULL, "Complete Library");
 
        ewl_main();
        return;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to