Review comments are implemented. [Searchbar] "delay-changed" signal added.
authorPrince Kr Dubey <prince.dubey@samsung.com>
Mon, 28 Mar 2011 06:31:04 +0000 (12:01 +0530)
committerPrince Kr Dubey <prince.dubey@samsung.com>
Wed, 6 Apr 2011 06:10:41 +0000 (11:40 +0530)
Change-Id: I1c150f7df5ded96d43868d013d40a44071737680

src/lib/elm_searchbar.c

index 5b6df99..115d46f 100644 (file)
@@ -20,6 +20,7 @@ struct _Widget_Data
    Eina_Bool cancel_btn_ani_flag;
    Eina_Bool cancel_btn_show_mode;
    Eina_Bool boundary_mode;
+   Ecore_Idler *idler;
 };
 
 static void _del_hook(Evas_Object *obj);
@@ -35,6 +36,7 @@ static void _del_hook(Evas_Object *obj)
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd) return;
+   if (wd->idler) ecore_idler_del(wd->idler);
 
    free(wd);
 }
@@ -109,14 +111,23 @@ static void _clicked(void *data, Evas_Object *obj, void *event_info)
    evas_object_smart_callback_call(data, "clicked", NULL);
 }
 
-static void _changed(void *data, Evas_Object *obj, void *event_info)
+static Eina_Bool _delay_changed(void *data)
 {
    Widget_Data *wd = elm_widget_data_get(data);
 
    if (!wd) return;
+   evas_object_smart_callback_call(data, "delay-changed", NULL);
+   wd->idler = NULL;
+   return ECORE_CALLBACK_CANCEL;
+}
+
+static void _changed(void *data, Evas_Object *obj, void *event_info)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
 
-   // TODO : inform to use entry changed callback 
-//   evas_object_smart_callback_call(data, "changed", NULL);
+   if (!wd) return;
+   if (!wd->idler)
+      wd->idler = ecore_idler_add(_delay_changed, data);
 }
 
 static void _cancel_clicked(void *data, Evas_Object *obj, void *event_info)
@@ -190,9 +201,6 @@ EAPI Evas_Object *elm_searchbar_add(Evas_Object *parent)
 
    _elm_theme_object_set(obj, wd->base, "searchbar", "base", "default");
 
-   //  evas_object_size_hint_weight_set(wd->base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   //  evas_object_size_hint_align_set(wd->base, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
    // Add Entry
    wd->eb = elm_editfield_add(parent);
    snprintf(buf, sizeof(buf), "searchbar/%s", elm_widget_style_get(obj));