Dear discomfitor,
I found another use case for e_icon_object_set.

   it->o_proxy = e_icon_add(ng->evas);
   o = evas_object_image_add(ng->evas);
   evas_object_image_source_set(o, it->base.obj);
   evas_object_resize(o, 128, 128);
   evas_object_image_fill_set(o, 0,0,128,128);
   e_icon_object_set(it->o_proxy, o);

They are from the line 687 of E-MODULES-EXTRA/engage/src/ng_gadcon.c.
How can I implement this without using e_icon_object_set?

Daniel Juyung Seo (SeoZ)

On Fri, Jul 20, 2012 at 4:52 PM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> finally kill off the last of the e_icon_object_set uses;
>   this function was being abused in 100% of cases to do something other than 
> the intended use of just setting an evas image into an e_icon. I've added 
> e_icon_edje_object_set which is the edje version and will, hopefully, make 
> things more clear and avoid confusion in the future
>   e_widget_image now calls the proper e_icon functions and is far less likely 
> to trigger a magic failure
>
>
> Author:       discomfitor
> Date:         2012-07-20 00:52:53 -0700 (Fri, 20 Jul 2012)
> New Revision: 74213
> Trac:         http://trac.enlightenment.org/e/changeset/74213
>
> Modified:
>   trunk/e/src/bin/e_icon.c trunk/e/src/bin/e_icon.h 
> trunk/e/src/bin/e_widget_image.c trunk/e/src/bin/e_widget_image.h
>
> Modified: trunk/e/src/bin/e_icon.c
> ===================================================================
> --- trunk/e/src/bin/e_icon.c    2012-07-20 07:38:40 UTC (rev 74212)
> +++ trunk/e/src/bin/e_icon.c    2012-07-20 07:52:53 UTC (rev 74213)
> @@ -342,6 +342,35 @@
>     return EINA_TRUE;
>  }
>
> +EAPI void
> +e_icon_edje_object_set(Evas_Object *obj, Evas_Object *edje)
> +{
> +   E_Smart_Data *sd;
> +
> +   if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR();
> +   if (!(sd = evas_object_smart_data_get(obj))) return;
> +
> +   /* smart code here */
> +   if (sd->obj) evas_object_del(sd->obj);
> +   sd->loading = 0;
> +   if (sd->fdo)
> +     {
> +        eina_stringshare_del(sd->fdo);
> +        sd->fdo = NULL;
> +     }
> +
> +   if (sd->timer) ecore_timer_del(sd->timer);
> +   sd->timer = NULL;
> +   sd->frame = 0;
> +   sd->frame_count = 0;
> +   sd->edje = EINA_TRUE;
> +   sd->obj = edje;
> +
> +   if (evas_object_visible_get(obj)) evas_object_show(sd->obj);
> +   evas_object_smart_member_add(sd->obj, obj);
> +   _e_icon_smart_reconfigure(sd);
> +}
> +
>  EAPI Eina_Bool
>  e_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
>  {
> @@ -435,8 +464,8 @@
>     if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR();
>     if (!(sd = evas_object_smart_data_get(obj))) return;
>     str = evas_object_type_get(o);
> -   if ((!str) || (strcmp(str, "edje") && strcmp(str, "image")))
> -     printf(EINA_COLOR_RED"******************\ntrying to set an image object 
> of type '%s'! this is not what you 
> want!\n******************\n"EINA_COLOR_RESET, str);
> +   if ((!str) || strcmp(str, "image"))
> +     CRI(EINA_COLOR_RED"******************\ntrying to set an image object of 
> type '%s'! this is not what you want!\n******************\n"EINA_COLOR_RESET, 
> str);
>
>     if (sd->timer) ecore_timer_del(sd->timer);
>     sd->timer = NULL;
>
> Modified: trunk/e/src/bin/e_icon.h
> ===================================================================
> --- trunk/e/src/bin/e_icon.h    2012-07-20 07:38:40 UTC (rev 74212)
> +++ trunk/e/src/bin/e_icon.h    2012-07-20 07:52:53 UTC (rev 74213)
> @@ -11,7 +11,8 @@
>  EAPI Eina_Bool    e_icon_file_key_set     (Evas_Object *obj, const char 
> *file, const char *key);
>  EAPI Eina_Bool    e_icon_file_edje_set    (Evas_Object *obj, const char 
> *file, const char *part);
>  EAPI Eina_Bool    e_icon_fdo_icon_set     (Evas_Object *obj, const char 
> *icon);
> -EAPI void         e_icon_object_set       (Evas_Object *obj, Evas_Object *o);
> +EAPI void         e_icon_edje_object_set(Evas_Object *obj, Evas_Object 
> *edje);
> +EAPI void         e_icon_object_set       (Evas_Object *obj, Evas_Object *o) 
> EINA_DEPRECATED;
>  EAPI const char  *e_icon_file_get         (const Evas_Object *obj);
>  EAPI void         e_icon_smooth_scale_set (Evas_Object *obj, Eina_Bool 
> smooth);
>  EAPI Eina_Bool    e_icon_smooth_scale_get (const Evas_Object *obj);
>
> Modified: trunk/e/src/bin/e_widget_image.c
> ===================================================================
> --- trunk/e/src/bin/e_widget_image.c    2012-07-20 07:38:40 UTC (rev 74212)
> +++ trunk/e/src/bin/e_widget_image.c    2012-07-20 07:52:53 UTC (rev 74213)
> @@ -26,7 +26,7 @@
>     evas_object_show(object);
>     o = e_icon_add(evas);
>     e_icon_fill_inside_set(o, 1);
> -   e_icon_object_set(o, object);
> +   e_icon_edje_object_set(o, object);
>     wd->img = o;
>     e_widget_data_set(obj, wd);
>     e_widget_can_focus_set(obj, 0);
> @@ -54,9 +54,13 @@
>
>     o = e_icon_add(evas);
>     e_icon_fill_inside_set(o, 1);
> -   o2 = evas_object_image_add(evas);
> -   evas_object_image_file_set(o2, file, NULL);
> -   e_icon_object_set(o, o2);
> +   if (!e_icon_file_set(o, file))
> +     {
> +        evas_object_del(o);
> +        free(wd);
> +        evas_object_del(obj);
> +        return NULL;
> +     }
>
>     wd->img = o;
>     evas_object_show(o);
> @@ -99,23 +103,6 @@
>     evas_object_show(wd->img);
>  }
>
> -EAPI void
> -e_widget_image_object_set(Evas_Object *obj, Evas_Object *o)
> -{
> -   E_Widget_Data *wd;
> -   int mw, mh;
> -
> -   wd = e_widget_data_get(obj);
> -   e_icon_object_set(wd->img, o);
> -   edje_object_size_min_get(o, &mw, &mh);
> -   if (wd->minw || wd->minh)
> -     e_widget_size_min_set(obj, wd->minw, wd->minh);
> -   else
> -     e_widget_size_min_set(obj, mw, mh);
> -   evas_object_show(wd->img);
> -}
> -
> -
>  static void
>  _e_wid_del_hook(Evas_Object *obj)
>  {
>
> Modified: trunk/e/src/bin/e_widget_image.h
> ===================================================================
> --- trunk/e/src/bin/e_widget_image.h    2012-07-20 07:38:40 UTC (rev 74212)
> +++ trunk/e/src/bin/e_widget_image.h    2012-07-20 07:52:53 UTC (rev 74213)
> @@ -8,7 +8,6 @@
>  EAPI void             e_widget_image_edje_set(Evas_Object *obj, const char 
> *file, const char *part);
>  EAPI void             e_widget_image_file_set(Evas_Object *obj, const char 
> *file);
>  EAPI void             e_widget_image_file_key_set(Evas_Object *obj, const 
> char *file, const char *key);
> -EAPI void             e_widget_image_object_set(Evas_Object *obj, 
> Evas_Object *o);
>
>  #endif
>  #endif
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to