Enlightenment CVS committal
Author : fletch3k
Project : misc
Module : enotes
Dir : misc/enotes/src
Modified Files:
debug.c note.c note.h saveload.c saveload.h
Log Message:
Efficient Sync of Saveload and Notes.
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/debug.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- debug.c 17 Feb 2004 12:07:28 -0000 1.3
+++ debug.c 19 Feb 2004 18:12:56 -0000 1.4
@@ -63,6 +63,7 @@
{"note_edje_minimise", 2},
{"get_date_string", 1},
{"note_edje_close_timer", 2},
+ {"timer_val_compare", 2},
{"get_note_by_title", 1},
{"get_note_by_content", 1},
{"get_title_by_note", 1},
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/note.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- note.c 17 Feb 2004 12:07:28 -0000 1.10
+++ note.c 19 Feb 2004 18:12:57 -0000 1.11
@@ -48,20 +48,41 @@
{
Note *note = malloc(sizeof(Note));
+ /* Set NULL's */
+ note->txt_title = NULL;
+
gbl_notes = evas_list_append(gbl_notes, note);
return (evas_list_find_list(gbl_notes, note));
}
void
remove_note(Evas_List * note)
-{ /* Sometimes here it might segv from the loop for no
particular reason. */
+{
Note *p = evas_list_data(note);
+ char *note_title;
dml("Closing a Note", 2);
+ ecore_timer_del(p->timcomp);
ecore_evas_free(p->win);
free(p);
gbl_notes = evas_list_remove_list(gbl_notes, note);
+
+ /**
+ * FIXME: When you can get the row and its child text, compare
+ * it to the ewl_entry_get_text(p->title) value and remove the row
+ * from the tree at this point. Reporting that you've done so with
+ * dml ("Removed note from save/load list", 2); or something. When ewl
+ * will let you do these things.
+ */
+
+ if (saveload != NULL) {
+// ewl_widget_destroy (p->saveload_row);
+ dml("Removing note entry from saveload list", 2);
+ ewl_tree_destroy_row((Ewl_Tree *) saveload->tree,
+ p->saveload_row);
+ }
+
return;
}
@@ -188,6 +209,14 @@
if (fcontent != NULL)
free(fcontent);
+ /* Values Comparison Timer */
+ p->timcomp = ecore_timer_add(COMPARE_INTERVAL, &timer_val_compare, p);
+
+ if (saveload != NULL) {
+ setup_saveload_opt(saveload->tree, (char *)
+ get_title_by_note(*note), *note);
+ dml("Added new note to saveload list", 2);
+ }
return;
}
@@ -247,6 +276,7 @@
p = evas_list_data(note);
ecore_evas_iconified_set(p->win, 1);
+
return;
}
@@ -272,6 +302,28 @@
return (0);
}
+int
+timer_val_compare(void *data)
+{
+ Note *p = (Note *) data;
+
+ if (p->txt_title != NULL) {
+ if (strcmp
+ (p->txt_title,
+ ewl_entry_get_text((Ewl_Entry *) p->title))) {
+ if (saveload != NULL)
+ ewl_saveload_revert(NULL, NULL, saveload->tree);
+
+ free(p->txt_title);
+ p->txt_title =
+ ewl_entry_get_text((Ewl_Entry *) p->title);
+ }
+ } else {
+ p->txt_title = ewl_entry_get_text((Ewl_Entry *) p->title);
+ }
+ return (1);
+}
+
/* External Interaction */
Evas_List *
get_note_by_title(char *title)
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/note.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- note.h 17 Feb 2004 12:07:28 -0000 1.4
+++ note.h 19 Feb 2004 18:12:57 -0000 1.5
@@ -21,6 +21,7 @@
#include "debug.h"
#include "config.h"
+#include "saveload.h"
#include "ipc.h"
#include "../config.h"
@@ -32,11 +33,14 @@
#define EDJE_SIGNAL_NOTE_MINIMISE "ENOTES_MINIMIZE"
#define EDJE_EWL_CONTAINER "EnotesContainer"
+#define COMPARE_INTERVAL 0.01
+
#define DEF_TITLE "New Note"
#define DEF_CONTENT "Edit me. :-)\nYou know you want to!"
typedef struct _note Note;
typedef struct _note {
+ /* Widgets */
Ecore_Evas *win;
Evas *evas;
Evas_Object *edje;
@@ -47,6 +51,12 @@
Ewl_Widget *vbox;
Ewl_Widget *title;
Ewl_Widget *content;
+
+ Ewl_Row *saveload_row;
+
+ /* Comparison Strings and Timer */
+ Ecore_Timer *timcomp;
+ char *txt_title;
} _note;
Evas_List *gbl_notes;
@@ -77,6 +87,7 @@
/* Misc */
char *get_date_string(void);
int note_edje_close_timer(void *p);
+int timer_val_compare(void *data);
/* External Interaction */
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/saveload.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- saveload.c 17 Feb 2004 12:07:28 -0000 1.6
+++ saveload.c 19 Feb 2004 18:12:57 -0000 1.7
@@ -148,11 +148,11 @@
p = (Evas_List *) get_cycle_begin();
if (p != NULL) {
setup_saveload_opt(saveload->tree,
- (char *) get_title_by_note(p));
+ (char *) get_title_by_note(p), p);
while ((p = (Evas_List *) get_cycle_next_note(p)) != NULL) {
if (strcmp(get_title_by_note(p), "")) {
setup_saveload_opt(saveload->tree, (char *)
- get_title_by_note(p));
+ get_title_by_note(p), p);
}
}
}
@@ -160,15 +160,17 @@
}
void
-setup_saveload_opt(Ewl_Widget * tree, char *caption)
+setup_saveload_opt(Ewl_Widget * tree, char *caption, Evas_List * p)
{
Ewl_Widget *capt;
+ Note *d = evas_list_data(p);
- capt = ewl_text_new(caption);
+ capt = (Ewl_Widget *) ewl_text_new(caption);
ewl_callback_append(capt, EWL_CALLBACK_CLICKED,
(void *) ewl_saveload_listitem_click, NULL);
ewl_widget_show(capt);
- ewl_tree_add_row((Ewl_Tree *) tree, 0, &capt);
+ d->saveload_row =
+ (Ewl_Row *) ewl_tree_add_row((Ewl_Tree *) tree, 0, &capt);
return;
}
@@ -202,8 +204,6 @@
{
dml("Refreshing the Saveload List", 2);
- /* FIXME: Find a more efficient way of doing this. */
-
ewl_container_reset((Ewl_Container *) p);
fill_saveload_tree();
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/saveload.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- saveload.h 6 Feb 2004 22:12:46 -0000 1.5
+++ saveload.h 19 Feb 2004 18:12:57 -0000 1.6
@@ -71,6 +71,8 @@
} Load;
extern MainConfig *main_config;
+extern SaveLoad *saveload;
+extern Load *load;
/** SAVE/LOAD **/
@@ -79,7 +81,8 @@
void saveload_setup_button(Ewl_Widget * c, Ewl_Widget ** b,
char *label);
void fill_saveload_tree(void);
-void setup_saveload_opt(Ewl_Widget * tree, char *caption);
+void setup_saveload_opt(Ewl_Widget * tree, char *caption,
+ Evas_List * p);
void ecore_saveload_resize(Ecore_Evas * ee);
void ecore_saveload_close(Ecore_Evas * ee);
void ewl_saveload_revert(Ewl_Widget * widget, void *ev_data,
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs