Enlightenment CVS committal

Author  : titan
Project : e17
Module  : proto

Dir     : e17/proto/ephoto/src


Modified Files:
        ephoto.c ephoto_callbacks.c 


Log Message:
More databasing work.

===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- ephoto.c    20 Jul 2006 06:23:02 -0000      1.60
+++ ephoto.c    20 Jul 2006 06:55:51 -0000      1.61
@@ -37,22 +37,14 @@
  if (!ecore_file_exists(database))
  {
   sqlite3_open(database, &db);
-  sqlite3_exec(db, "create table albums(id int AUTOINCREMENT primary key,"
-                                       "name varchar(255));", NULL, 0, 0);
-  sqlite3_exec(db, "create table a_images(id int AUTOINCREMENT primary key,"
-                                       "name varchar(255));", NULL, 0, 0);
-  sqlite3_exec(db, "create table albums_full(id int AUTOINCREMENT primary 
key," 
-                               "alubm_id int, image_id int);", NULL, 0, 0);
-  sqlite3_exec(db, "create table slideshows(id int AUTOINCREMENT primary key," 
-                                       "name varchar(255));", NULL, 0, 0);
-  sqlite3_exec(db, "create table s_images(id int AUTOINCREMENT primary key,"
-                                       "name varchar(255));", NULL, 0, 0);
-  sqlite3_exec(db, "create_table slideshows_images_full(id int AUTOINCREMENT 
primary key," 
-                                       "slideshows_id int, images_id int);", 
NULL, 0, 0);
-  sqlite3_exec(db, "create table s_settings(id int AUTOINCREMENT primary key,"
-                                       "name varchar(255));", NULL, 0, 0);
-  sqlite3_exec(db, "create table slideshows_settings_full(id int AUTOINCREMENT 
primary key," 
-                                       "slideshows_id int, settings_id int);", 
NULL, 0, 0);
+  sqlite3_exec(db, "create table albums (id INTEGER AUTOINCREMENT PRIMARY KEY, 
name varchar(255));", NULL, 0, 0);
+  sqlite3_exec(db, "create table a_images (id INTEGER AUTOINCREMENT PRIMARY 
KEY, name varchar(255));", NULL, 0, 0);
+  sqlite3_exec(db, "create table albums_full (id INTEGER AUTOINCREMENT PRIMARY 
KEY, alubm_id int, image_id int);", NULL, 0, 0);
+  sqlite3_exec(db, "create table slideshows (id INTEGER AUTOINCREMENT PRIMARY 
KEY, name varchar(255));", NULL, 0, 0);
+  sqlite3_exec(db, "create table s_images (id INTEGER AUTOINCREMENT PRIMARY 
KEY, name varchar(255));", NULL, 0, 0);
+  sqlite3_exec(db, "create_table slideshows_images_full (id INTEGER 
AUTOINCREMENT PRIMARY KEY, slideshows_id int, images_id int);", NULL, 0, 0);
+  sqlite3_exec(db, "create table s_settings (id INTEGER AUTOINCREMENT PRIMARY 
KEY, name varchar(255));", NULL, 0, 0);
+  sqlite3_exec(db, "create table slideshows_settings_full (id INTEGER 
AUTOINCREMENT PRIMARY KEY, slideshows_id int, settings_id int);", NULL, 0, 0);
   sqlite3_close(db);
  }
 
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto_callbacks.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ephoto_callbacks.c  20 Jul 2006 06:23:02 -0000      1.2
+++ ephoto_callbacks.c  20 Jul 2006 06:55:51 -0000      1.3
@@ -18,7 +18,7 @@
 {
  char *home;
  char *entry_text;
- char album_path[PATH_MAX];
+ char database[PATH_MAX];
  Ewl_Widget *win;
  Ewl_Widget *vbox;
  Ewl_Widget *icon;
@@ -29,12 +29,16 @@
  home = getenv("HOME");
  entry_text = ewl_text_text_get(EWL_TEXT(data));
 
- snprintf(album_path, PATH_MAX, "%s/.ephoto/database", home);
+ snprintf(database, PATH_MAX, "%s/.ephoto/ephoto_database", home);
  
  if (strcmp(entry_text, " ") != 0)
  {
-  if (!ecore_file_exists(album_path))
+  if (entry_text)
   {
+   sqlite3_open(database, &db);
+   sqlite3_exec(db, "insert into albums (name) values ('hello');", NULL, 0, 0);
+   sqlite3_close(db);
+
    m->icon = ewl_icon_new();
    ewl_icon_label_set(EWL_ICON(m->icon), entry_text);
    ewl_object_alignment_set(EWL_OBJECT(m->icon), EWL_FLAG_ALIGN_CENTER);
@@ -105,7 +109,7 @@
 {
  char *home;
  char *entry_text;
- char slideshow_path[PATH_MAX];
+ char database[PATH_MAX];
  Ewl_Widget *win;
  Ewl_Widget *vbox;
  Ewl_Widget *icon;
@@ -116,12 +120,17 @@
  home = getenv("HOME");
  entry_text = ewl_text_text_get(EWL_TEXT(data));
 
- snprintf(slideshow_path, PATH_MAX, "%s/.ephoto/database", home);
+ snprintf(database, PATH_MAX, "%s/.ephoto/ephoto_database", home);
 
  if (strcmp(entry_text, " ") != 0)
  {
-  if (!ecore_file_exists(slideshow_path))
+    
+  if (entry_text)
   {
+   sqlite3_open(database, &db);
+   sqlite3_exec(db, "insert into albums (name) values ('hello');", NULL, 0, 0);
+   sqlite3_close(db);
+ 
    m->icon = ewl_icon_new();
    ewl_icon_label_set(EWL_ICON(m->icon), entry_text);
    ewl_object_alignment_set(EWL_OBJECT(m->icon), EWL_FLAG_ALIGN_CENTER);



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