Enlightenment CVS committal

Author  : devilhorns
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_entry_dialog.c 


Log Message:
Entry dialog now supports "Return" key which will call the "Ok" function.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_entry_dialog.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- e_entry_dialog.c    7 Oct 2007 21:22:40 -0000       1.10
+++ e_entry_dialog.c    25 Dec 2007 18:15:26 -0000      1.11
@@ -5,6 +5,7 @@
 static void _e_entry_dialog_ok(void *data, E_Dialog *dia);
 static void _e_entry_dialog_cancel(void *data, E_Dialog *dia);
 static void _e_entry_dialog_delete(E_Win *win);
+static void _e_entry_cb_key_down(void *data, Evas_Object *obj, void 
*event_info);
 
 /* Externally accesible functions */
 EAPI E_Entry_Dialog *
@@ -49,6 +50,7 @@
      }
    
    ed->entry = e_widget_entry_add(dia->win->evas, &(ed->text), NULL, NULL, 
NULL);
+   evas_object_smart_callback_add(ed->entry, "key_down", _e_entry_cb_key_down, 
ed);
    e_widget_list_object_append(o, ed->entry, 1, 1, 0.5);
    e_widget_min_size_get(o, &w, &h);
    e_dialog_content_set(dia, o, w, h);
@@ -66,6 +68,7 @@
 _e_entry_dialog_free(E_Entry_Dialog *ed)
 {
    e_object_del(E_OBJECT(ed->dia));
+   evas_object_smart_callback_del(ed->entry, "key_down", _e_entry_cb_key_down);
    E_FREE(ed->text);
    free(ed);
 }
@@ -103,4 +106,19 @@
    dia = win->data;
    ed = dia->data;
    e_object_del(E_OBJECT(ed));
+}
+
+static void 
+_e_entry_cb_key_down(void *data, Evas_Object *obj, void *event_info) 
+{
+   Evas_Event_Key_Down *ev;
+   E_Entry_Dialog *ed;
+   
+   ev = event_info;
+   if (strcmp(ev->keyname, "Return")) return;
+   if (!(ed = data)) return;
+   e_object_ref(E_OBJECT(ed));
+   if (ed->ok.func) ed->ok.func(ed->text, ed->ok.data);
+   e_object_del(E_OBJECT(ed));
+   e_object_unref(E_OBJECT(ed));
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to