hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=1cc52fee5727d37398e3ed9d12e28f92f58fb0a2

commit 1cc52fee5727d37398e3ed9d12e28f92f58fb0a2
Author: ChunEon Park <her...@hermet.pe.kr>
Date:   Fri Jul 3 19:58:20 2015 +0900

    fix to avoid popup of "file modified"
    
    if the file is modified continously,
    it couldn't catch that the file is modified by self or not.
    we do avoid this by delaying the notifying event for 3 secs.
---
 src/lib/enventor_smart.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c
index 486a8f8..aeab6b1 100644
--- a/src/lib/enventor_smart.c
+++ b/src/lib/enventor_smart.c
@@ -25,6 +25,7 @@ typedef struct _Enventor_Object_Data
    edit_data *ed;
    Eio_Monitor *edc_monitor;
    Eina_Stringshare *group_name;
+   Ecore_Timer *file_modified_timer;
 
    Eina_Bool dummy_swallow : 1;
 
@@ -50,6 +51,18 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
 /*****************************************************************************/
 /* Internal method implementation                                            */
 /*****************************************************************************/
+
+static Eina_Bool
+file_modified_timer(void *data)
+{
+   Enventor_EDC_Modified modified;
+   Enventor_Object_Data *pd = data;
+   modified.self_changed = EINA_FALSE;
+   evas_object_smart_callback_call(pd->obj, SIG_EDC_MODIFIED, &modified);
+   pd->file_modified_timer = NULL;
+   return ECORE_CALLBACK_CANCEL;
+}
+
 static Eina_Bool
 file_modified_cb(void *data, int type EINA_UNUSED, void *event)
 {
@@ -60,8 +73,10 @@ file_modified_cb(void *data, int type EINA_UNUSED, void 
*event)
    if (ev->monitor != pd->edc_monitor) return ECORE_CALLBACK_PASS_ON;
    if (!edit_saved_get(pd->ed))
      {
-        modified.self_changed = EINA_FALSE;
-        evas_object_smart_callback_call(pd->obj, SIG_EDC_MODIFIED, &modified);
+        /* Don't notify info right soon,
+           if the source changing can be happened continously. */
+        if (pd->file_modified_timer) ecore_timer_del(pd->file_modified_timer);
+        pd->file_modified_timer = ecore_timer_add(3, file_modified_timer, pd);
         return ECORE_CALLBACK_DONE;
      }
    if (!edit_changed_get(pd->ed)) return ECORE_CALLBACK_DONE;
@@ -167,6 +182,7 @@ _enventor_object_evas_object_smart_del(Evas_Object *obj 
EINA_UNUSED,
 {
    EINA_REFCOUNT_UNREF(pd)
      {
+        ecore_timer_del(pd->file_modified_timer);
         eio_monitor_del(pd->edc_monitor);
         eina_stringshare_del(pd->group_name);
         edit_term(pd->ed);

-- 


Reply via email to