* Enlightenment SVN <no-re...@enlightenment.org> [2010-09-27 12:52:56 -0700]:

Forgot to mention this comes from a set of contributions to Elementary
from Samsung Electronics. Patch revised and modified by Profusion
Embedded Systems.


> Log:
>   Elm notify's new signal: "timeout".
>   Also changing elm_notify_timeout_set()'s behavior: it won't init the
>   timer itself, unless there was a previous one running.
>   
>   
> Author:       glima
> Date:         2010-09-27 12:52:56 -0700 (Mon, 27 Sep 2010)
> New Revision: 52810
> 
> Modified:
>   trunk/TMP/st/elementary/src/bin/test_notify.c 
> trunk/TMP/st/elementary/src/lib/Elementary.h.in 
> trunk/TMP/st/elementary/src/lib/elm_notify.c 
> 
> Modified: trunk/TMP/st/elementary/src/bin/test_notify.c
> ===================================================================
> --- trunk/TMP/st/elementary/src/bin/test_notify.c     2010-09-27 19:37:09 UTC 
> (rev 52809)
> +++ trunk/TMP/st/elementary/src/bin/test_notify.c     2010-09-27 19:52:56 UTC 
> (rev 52810)
> @@ -5,6 +5,11 @@
>  _bt(void *data, Evas_Object *obj, void *event_info)
>  {
>     Evas_Object *notify = data;
> +   int timeout = elm_notify_timeout_get(notify);
> +
> +   if (timeout > 0)
> +       elm_notify_timer_init(notify);
> +
>     evas_object_show(notify);
>  }
>  
> @@ -15,6 +20,18 @@
>     evas_object_hide(notify);
>  }
>  
> +static void
> +_notify_timeout(void *data, Evas_Object *obj, void *event_info)
> +{
> +   printf("Notify timed out!\n");
> +}
> +
> +static void
> +_notify_block(void *data, Evas_Object *obj, void *event_info)
> +{
> +   printf("Notify block area clicked!!\n");
> +}
> +
>  void
>  test_notify(void *data, Evas_Object *obj, void *event_info)
>  {
> @@ -64,6 +81,8 @@
>     evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, 
> EVAS_HINT_EXPAND);
>     elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
>     elm_notify_timeout_set(notify, 5);
> +   evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
> +   evas_object_smart_callback_add(notify, "block,clicked", _notify_block, 
> NULL);
>  
>     bx = elm_box_add(win);
>     elm_notify_content_set(notify, bx);
> @@ -92,6 +111,7 @@
>     evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, 
> EVAS_HINT_EXPAND);
>     elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_LEFT);
>     elm_notify_timeout_set(notify, 10);
> +   evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
>  
>     bx = elm_box_add(win);
>     elm_notify_content_set(notify, bx);
> @@ -119,6 +139,7 @@
>     evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, 
> EVAS_HINT_EXPAND);
>     elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_CENTER);
>     elm_notify_timeout_set(notify, 10);
> +   evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
>  
>     bx = elm_box_add(win);
>     elm_notify_content_set(notify, bx);
> 
> Modified: trunk/TMP/st/elementary/src/lib/Elementary.h.in
> ===================================================================
> --- trunk/TMP/st/elementary/src/lib/Elementary.h.in   2010-09-27 19:37:09 UTC 
> (rev 52809)
> +++ trunk/TMP/st/elementary/src/lib/Elementary.h.in   2010-09-27 19:52:56 UTC 
> (rev 52810)
> @@ -767,6 +767,8 @@
>     EAPI void         elm_notify_repeat_events_set(Evas_Object *obj, 
> Eina_Bool repeat);
>     EAPI Eina_Bool    elm_notify_repeat_events_get(const Evas_Object *obj);
>     /* smart callbacks called:
> +    * "timeout" - when timeout happens on notify and it's hidden
> +    * "block,clicked" - when it's hidden by a click outside of the notify's 
> view
>      */
>  
>     typedef enum _Elm_Hover_Axis
> 
> Modified: trunk/TMP/st/elementary/src/lib/elm_notify.c
> ===================================================================
> --- trunk/TMP/st/elementary/src/lib/elm_notify.c      2010-09-27 19:37:09 UTC 
> (rev 52809)
> +++ trunk/TMP/st/elementary/src/lib/elm_notify.c      2010-09-27 19:52:56 UTC 
> (rev 52810)
> @@ -37,6 +37,14 @@
>  static void _hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
>  static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
>  
> +static const char SIG_BLOCK_CLICKED[] = "block,clicked";
> +static const char SIG_TIMEOUT[] = "timeout";
> +static const Evas_Smart_Cb_Description _signals[] = {
> +  {SIG_BLOCK_CLICKED, ""},
> +  {SIG_TIMEOUT, ""},
> +  {NULL, NULL}
> +};
> +
>  static void
>  _del_pre_hook(Evas_Object *obj)
>  {
> @@ -161,7 +169,7 @@
>  {
>     Widget_Data *wd = elm_widget_data_get(data);
>     if (!wd) return;
> -   evas_object_smart_callback_call(data, "block,clicked", NULL);
> +   evas_object_smart_callback_call(data, SIG_BLOCK_CLICKED, NULL);
>  }
>  
>  static void
> @@ -238,6 +246,7 @@
>     if (!wd) return ECORE_CALLBACK_CANCEL;
>     wd->timer = NULL;
>     evas_object_hide(obj);
> +   evas_object_smart_callback_call(obj, SIG_TIMEOUT, NULL);
>     return ECORE_CALLBACK_CANCEL;
>  }
>  
> @@ -332,6 +341,8 @@
>     evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj);
>  
>     _sizing_eval(obj);
> +
> +   evas_object_smart_callbacks_descriptions_set(obj, _signals);
>     return obj;
>  }
>  
> @@ -495,11 +506,15 @@
>  }
>  
>  /**
> - * Set the time before the notify window is hidden. <br>
> - * Set a value < 0 to disable the timer
> + * Set the time before the notify window is hidden. Set a value < 0
> + * to disable a running timer.
>   *
>   * @param obj The notify object
>   * @param time the new timeout
> + *
> + * @note If the value is > 0 and there was a previous (unfinished)
> + * timer running, it will be <b>re-issued</b> with the new value.
> + *
>   */
>  EAPI void
>  elm_notify_timeout_set(Evas_Object *obj, int timeout)
> @@ -508,6 +523,10 @@
>     Widget_Data *wd = elm_widget_data_get(obj);
>     if (!wd) return;
>     wd->timeout = timeout;
> +
> +   if (!wd->timer)
> +       return;
> +
>     elm_notify_timer_init(obj);
>  }
>  
> @@ -525,7 +544,7 @@
>  }
>  
>  /**
> - * Re-init the timer
> + * (Re) init the timer
>   * @param obj The notify object
>   */
>  EAPI void
> @@ -563,7 +582,8 @@
>       wd->block_events = edje_object_add(evas_object_evas_get(obj));
>       _block_events_theme_apply(obj);
>          elm_widget_resize_object_set(obj, wd->block_events);
> -     edje_object_signal_callback_add(wd->block_events, "elm,action,clicked", 
> "elm", _signal_block_clicked, obj);
> +     edje_object_signal_callback_add(wd->block_events, "elm,action,clicked",
> +                                        "elm", _signal_block_clicked, obj);
>       }
>     else
>       evas_object_del(wd->block_events);
> 
> 
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

-- 
Gustavo Lima Chaves
Computer Engineer @ ProFUSION Embedded Systems

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to