Enlightenment CVS committal

Author  : titan
Project : e17
Module  : proto

Dir     : e17/proto/ephoto/src/bin


Modified Files:
        ephoto_database.c ephoto_gui.c 


Log Message:
More database work.. Fixup the gui a little bit.

===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto_database.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ephoto_database.c   26 Jan 2007 08:26:57 -0000      1.1
+++ ephoto_database.c   26 Jan 2007 09:22:50 -0000      1.2
@@ -13,6 +13,7 @@
 /*Ephoto databasing ecore global variables*/
 static Ecore_List *albums, *images, *image_ids;
 
+/*Open the sqlite3 database. Create the database if it does not already 
exits.*/
 sqlite3 *ephoto_db_init(void)
 {
        char path[PATH_MAX];
@@ -43,6 +44,7 @@
        return db;
 }
 
+/*Get the id of an image in the images table*/
 static int get_image_id(void *notused, int argc, char **argv, char **col)
 {
        int i;
@@ -55,6 +57,7 @@
        return 0;
 }
 
+/*Get the id of an album in the albums table*/
 static int get_album_id(void *notused, int argc, char **argv, char **col)
 {
        int i;
@@ -67,7 +70,7 @@
        return 0;
 }
 
-
+/*Add a new album to the album table*/
 void ephoto_db_add_album(sqlite3 *db, char *name, char *description)
 {
        char command[PATH_MAX];
@@ -79,6 +82,7 @@
        return;
 }
 
+/*Add a new image to a particular album*/
 void ephoto_db_add_image(sqlite3 *db, char *album, char *name, char *path)
 {
        char command[PATH_MAX];
@@ -92,10 +96,19 @@
        sqlite3_exec(db, command, get_album_id, 0, 0);
        snprintf(command, PATH_MAX, "INSERT or IGNORE into 
album_images(image_id, album_id) "
                                    "VALUES('%d', '%d');", image_id, album_id);
+       sqlite3_exec(db, command, 0, 0, 0);
+
+       /*This is to make sure the complete library has all images*/
+       snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = 
'Complete Library';");
+       sqlite3_exec(db, command, get_album_id, 0, 0);
+       snprintf(command, PATH_MAX, "INSERT into album_images(image_id, 
album_id) "
+                                   "VALUES('%d', '%d');", image_id, album_id);
+       sqlite3_exec(db, command, 0, 0, 0);
+
        return;
 }
 
-
+/*Populate a list the albums in the albums table*/
 static int list_albums(void *notused, int argc, char **argv, char **col)
 {
        int i;
@@ -110,6 +123,7 @@
        return 0;
 }
 
+/*Return a list of albums in the albums table*/ 
 Ecore_List *ephoto_db_list_albums(sqlite3 *db)
 {
        if(albums)
@@ -122,6 +136,7 @@
        return albums;
 }
 
+/*Populate a list of images belonging to a certain album*/
 static int list_images(void *notused, int argc, char **argv, char **col)
 {
        int i;
@@ -136,6 +151,7 @@
        return 0;
 }
 
+/*Populate a list of the id's of images belonging to a certain album*/
 static int list_image_ids(void *notused, int argc, char **argv, char **col)
 {
        char command[PATH_MAX];
@@ -151,6 +167,7 @@
        return 0;
 }
 
+/*Return a list of images belonging to a certain album*/
 Ecore_List *ephoto_db_list_images(sqlite3 *db, char *album)
 {
        char command[PATH_MAX];
@@ -183,6 +200,7 @@
        return images;
 }
 
+/*Close the sqlite3 database*/
 void ephoto_db_close(sqlite3 *db)
 {
        sqlite3_close(db);
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto_gui.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ephoto_gui.c        26 Jan 2007 08:26:57 -0000      1.26
+++ ephoto_gui.c        26 Jan 2007 09:22:50 -0000      1.27
@@ -3,7 +3,6 @@
 /*Ewl Callbacks*/
 static void destroy(Ewl_Widget *w, void *event, void *data);
 static void populate(Ewl_Widget *w, void *event, void *data);
-static void view_catalog(Ewl_Widget *w, void *event, void *data);
 static void view_image(Ewl_Widget *w, void *event, void *data);
 
 /*Ephoto Widget Creation Callbacks*/
@@ -27,8 +26,7 @@
 static void rotate_image_right(Ewl_Widget *w, void *event, void *data);
 
 /*Ephoto Widget Global Variables*/
-static Ewl_Widget *atree, *fbox, *vnb;
-static Ewl_Widget *cvbox, *ivbox, *vimage;
+static Ewl_Widget *atree, *fbox, *vimage;
 
 /*Ephoto Ecore Global Variables*/
 static Ecore_Timer *timer;
@@ -231,12 +229,6 @@
        return val;
 }
 
-/*Switch to the Image List*/
-static void view_catalog(Ewl_Widget *w, void *event, void *data)
-{
-       ewl_notebook_visible_page_set(EWL_NOTEBOOK(vnb), cvbox);
-}
-
 /*Switch to the Image Viewer*/
 static void view_image(Ewl_Widget *w, void *event, void *data)
 {
@@ -244,7 +236,7 @@
 
        file = data;
        ewl_image_file_set(EWL_IMAGE(vimage), file, NULL);
-       ewl_notebook_visible_page_set(EWL_NOTEBOOK(vnb), ivbox);
+       ewl_widget_reparent(vimage);
 }
 
 /*Update the Directory List and Image List*/
@@ -278,7 +270,7 @@
                thumb = ewl_image_thumbnail_new();
                ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(thumb), imagef);
                ewl_image_proportional_set(EWL_IMAGE(thumb), TRUE);
-               ewl_image_constrain_set(EWL_IMAGE(thumb), 100);
+               ewl_image_size_set(EWL_IMAGE(thumb), 45, 45);
                ewl_container_child_append(EWL_CONTAINER(fbox), thumb);
                 ewl_callback_append(thumb, EWL_CALLBACK_CLICKED, view_image, 
imagef);
                ewl_widget_show(thumb);
@@ -343,7 +335,7 @@
 void create_main_gui(void)
 {
        Ewl_Widget *win, *vbox, *menubar, *menu, *image, *paned;
-       Ewl_Widget *ihbox, *sp;
+       Ewl_Widget *ivbox, *ihbox, *sp;
 
        win = ewl_window_new();
         ewl_window_title_set(EWL_WINDOW(win), "Ephoto!");
@@ -364,7 +356,12 @@
 
        menu = add_menu(menubar, "File");
        add_menu_item(menu, "Close", PACKAGE_DATA_DIR "/images/exit.png", 
destroy);
+       menu = add_menu(menubar, "Albums");
+       add_menu_item(menu, "Add Album", PACKAGE_DATA_DIR "/images/add.png", 
NULL);
+       add_menu_item(menu, "Remove Album", PACKAGE_DATA_DIR 
"/images/remove.png", NULL);
        menu = add_menu(menubar, "Help");
+       add_menu_item(menu, "About", NULL, NULL);
+       add_menu_item(menu, "Ephoto Tutorial", NULL, NULL);
 
        paned = ewl_hpaned_new();
        ewl_object_fill_policy_set(EWL_OBJECT(paned), EWL_FLAG_FILL_ALL);
@@ -373,44 +370,33 @@
 
        atree = add_tree(paned);
 
-       vnb = ewl_notebook_new();
-       ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(vnb), 0);
-       ewl_object_fill_policy_set(EWL_OBJECT(vnb), EWL_FLAG_FILL_ALL);
-       ewl_container_child_append(EWL_CONTAINER(paned), vnb);
-       ewl_widget_show(vnb);
-
-       cvbox = ewl_vbox_new();
-       ewl_object_fill_policy_set(EWL_OBJECT(cvbox), EWL_FLAG_FILL_ALL);
-       ewl_container_child_append(EWL_CONTAINER(vnb), cvbox);
-       ewl_widget_show(cvbox);
-       ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(vnb), cvbox, "Catalog");
+       ivbox = ewl_vbox_new();
+       ewl_object_fill_policy_set(EWL_OBJECT(ivbox), EWL_FLAG_FILL_ALL);
+       ewl_container_child_append(EWL_CONTAINER(paned), ivbox);
+       ewl_widget_show(ivbox);
 
        sp = ewl_scrollpane_new();
        ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_ALL);
-       ewl_container_child_append(EWL_CONTAINER(cvbox), sp);
+       ewl_container_child_append(EWL_CONTAINER(ivbox), sp);
        ewl_widget_show(sp);
 
-       fbox = ewl_hfreebox_new();
-       ewl_object_fill_policy_set(EWL_OBJECT(fbox), EWL_FLAG_FILL_ALL);
-       ewl_container_child_append(EWL_CONTAINER(sp), fbox);
-       ewl_widget_show(fbox);
-
-       ivbox = ewl_vbox_new();
-        ewl_object_fill_policy_set(EWL_OBJECT(ivbox), EWL_FLAG_FILL_ALL);
-        ewl_container_child_append(EWL_CONTAINER(vnb), ivbox);
-        ewl_widget_show(ivbox);
-
-        sp = ewl_scrollpane_new();
-        ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_ALL);
-        ewl_container_child_append(EWL_CONTAINER(ivbox), sp);
-        ewl_widget_show(sp);
-
        vimage = ewl_image_new();
        ewl_image_proportional_set(EWL_IMAGE(vimage), TRUE);
        ewl_object_alignment_set(EWL_OBJECT(vimage), EWL_FLAG_ALIGN_CENTER);
        ewl_object_fill_policy_set(EWL_OBJECT(vimage), EWL_FLAG_FILL_SHRINK);
        ewl_container_child_append(EWL_CONTAINER(sp), vimage);
        ewl_widget_show(vimage);
+
+       sp = ewl_scrollpane_new();
+       ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_HFILL);
+       ewl_container_child_append(EWL_CONTAINER(ivbox), sp);
+       ewl_widget_show(sp);
+
+       fbox = ewl_hfreebox_new();
+       ewl_object_fill_policy_set(EWL_OBJECT(fbox), EWL_FLAG_FILL_ALL);
+       ewl_container_child_append(EWL_CONTAINER(sp), fbox);
+       ewl_object_maximum_size_set(EWL_OBJECT(fbox), 99999, 35);
+       ewl_widget_show(fbox);
 
        albums = ecore_list_new();
        db = ephoto_db_init();



-------------------------------------------------------------------------
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