From: <enl...@li...> - 2004-09-24 16:19:55
|
Enlightenment CVS committal Author : handyande Project : misc Module : enotes Dir : misc/enotes/src Modified Files: main.c storage.c storage.h Log Message: Only create the new note when there is no control center if there are no notes autoloading =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/main.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- main.c 24 Sep 2004 13:59:56 -0000 1.16 +++ main.c 24 Sep 2004 16:19:47 -0000 1.17 @@ -25,10 +25,14 @@ main(int argc, char *argv[]) { char *spec_conf; + int note_count; /* IPC Check */ ecore_ipc_init(); dml("IPC Initiated Successfully", 1); + /* autoload (if on) will increment this if there are notes + if not we may need to create a blank one */ + note_count = 0; /* Read the Usage and Configurations */ main_config = mainconfig_new(); @@ -68,18 +72,19 @@ dml("Efl Successfully Initiated", 1); + /* Autoloading */ + if (main_config->autosave == 1) { + note_count = autoload(); + } + /* Begin the Control Centre */ if (main_config->controlcentre == 1) { setup_cc(); dml("Control Centre Setup", 1); } else { dml("No Control Centre - Displaying Notice", 1); - new_note(); - } - - /* Autoloading */ - if (main_config->autosave == 1) { - autoload(); + if (note_count == 0) + new_note(); } if (main_config->welcome == 1) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/storage.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- storage.c 9 Sep 2004 11:57:30 -0000 1.9 +++ storage.c 24 Sep 2004 16:19:48 -0000 1.10 @@ -328,14 +328,16 @@ /** * @brief: Automatically loads all of the "autosave" notes. */ -void +int autoload(void) { XmlReadHandle *r; NoteStor *p; + int count; dml("Autoloading Saved Notes", 1); + count = 0; r = stor_cycle_begin_autosave(); if (r != NULL) { while (r->cur != NULL) { @@ -344,10 +346,11 @@ p->content); free_note_stor(p); stor_cycle_next(r); + count++; } stor_cycle_end(r); } - return; + return count; } /** =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/storage.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- storage.h 9 Sep 2004 10:38:15 -0000 1.4 +++ storage.h 24 Sep 2004 16:19:48 -0000 1.5 @@ -58,7 +58,7 @@ NoteStor *stor_cycle_get_notestor(XmlReadHandle * p); /* Autosave Functions */ -void autoload(void); +int autoload(void); void autosave(void); /* Internal Functions */ |