Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entrance

Dir     : e17/apps/entrance/src/client


Modified Files:
        Makefile.am entrance_user.c entrance_x_session.c 
Added Files:
        entrance_smart.c entrance_smart.h 


Log Message:
o add entrance_smart.[ch] - Evas Smart Object handle user and session instances
 - Edje - the edje part we're swallowing(User or Session group from themes)
 - Avatar - the swallowed image/edje (no longer autocleaned up by edje lib)
o entrance_x_session.c - use entrance_smart object
o entrance_user.c - use entrance_smart object

This just keeps the rest of the code from getting cluttered with simple
repetitive crap we have to do ourselves. This also fixes entrance_edit w/o
actually modifying any source. :D  


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- Makefile.am 23 May 2004 14:04:22 -0000      1.14
+++ Makefile.am 27 Jun 2004 17:05:27 -0000      1.15
@@ -12,6 +12,7 @@
        entrance_user.c entrance_user.h \
        entrance_x_session.c entrance_x_session.h \
        entrance_ipc.c entrance_ipc.h \
+       entrance_smart.c entrance_smart.h \
        util.c util.h \
        entrance.h main.c 
 
@@ -22,6 +23,6 @@
 
 entrance_edit_SOURCES = entrance_edit.c \
                entrance_config.c entrance_user.c \
-               util.c entrance_x_session.c
+               util.c entrance_x_session.c entrance_smart.c
 entrance_edit_LDADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@ \
 @esmart_libs@ -lesmart_container -lesmart_text_entry
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_user.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- entrance_user.c     25 Mar 2004 05:29:22 -0000      1.9
+++ entrance_user.c     27 Jun 2004 17:05:27 -0000      1.10
@@ -1,4 +1,5 @@
 #include "entrance_user.h"
+#include "entrance_smart.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <Evas.h>
@@ -89,32 +90,37 @@
 entrance_user_edje_get(Entrance_User * e, Evas_Object * edje,
                        const char *file)
 {
-   Evas_Object *o = NULL;
-   Evas_Object *oo = NULL;
    Evas_Coord w, h;
+   Evas_Object *o = NULL;
+   Evas_Object *result = NULL;
+   Evas_Object *avatar = NULL;
 
    if (e && edje)
    {
+      result = entrance_smart_add(evas_object_evas_get(edje));
       o = edje_object_add(evas_object_evas_get(edje));
+      entrance_smart_edje_set(result, o);
       if (edje_object_file_set(o, file, "User"))
       {
          evas_object_layer_set(o, 0);
          evas_object_move(o, -9999, -9999);
          edje_object_size_min_get(o, &w, &h);
          if ((w > 0) && (h > 0))
-            evas_object_resize(o, w, h);
+            evas_object_resize(result, w, h);
 
          if (edje_object_part_exists(o, "EntranceUserIcon"))
          {
-            oo = _entrance_user_icon_load(edje, e->icon);
-            if (!strcmp(evas_object_type_get(oo), "image"))
+            if ((avatar = _entrance_user_icon_load(edje, e->icon)))
             {
-
-               edje_object_part_geometry_get(oo, "EntranceUserIcon", NULL,
-                                             NULL, &w, &h);
-               evas_object_image_fill_set(oo, 0.0, 0.0, w, h);
+               if (!strcmp(evas_object_type_get(avatar), "image"))
+               {
+                  edje_object_part_geometry_get(avatar, "EntranceUserIcon",
+                                                NULL, NULL, &w, &h);
+                  evas_object_image_fill_set(avatar, 0.0, 0.0, w, h);
+               }
+               entrance_smart_avatar_set(result, avatar);
+               edje_object_part_swallow(o, "EntranceUserIcon", avatar);
             }
-            edje_object_part_swallow(o, "EntranceUserIcon", oo);
          }
          if (edje_object_part_exists(o, "EntranceUserName"))
          {
@@ -127,16 +133,16 @@
                                          user_selected_cb, e);
          edje_object_signal_callback_add(o, "UserUnSelected", "",
                                          user_unselected_cb, e);
-         evas_object_show(o);
+         evas_object_show(result);
       }
       else
       {
          fprintf(stderr, "Failed on: %s(%s)\n", e->name, file);
-         evas_object_del(o);
-         o = NULL;
+         evas_object_del(result);
+         result = NULL;
       }
    }
-   return (o);
+   return (result);
 }
 
 /**
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_x_session.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- entrance_x_session.c        10 Mar 2004 22:53:51 -0000      1.4
+++ entrance_x_session.c        27 Jun 2004 17:05:27 -0000      1.5
@@ -1,5 +1,6 @@
 #include "entrance.h"
 #include "entrance_x_session.h"
+#include "entrance_smart.h"
 #include <Edje.h>
 
 extern void session_item_selected_cb(void *data, Evas_Object * o,
@@ -91,28 +92,32 @@
                             const char *themefile)
 {
    Evas_Coord w, h;
-   Evas_Object *oo = NULL;
    Evas_Object *edje = NULL;
+   Evas_Object *avatar = NULL;
+   Evas_Object *result = NULL;
 
    if (!o || !themefile || !e)
       return (NULL);
 
+   result = entrance_smart_add(evas_object_evas_get(o));
    edje = edje_object_add(evas_object_evas_get(o));
+   entrance_smart_edje_set(result, edje);
    if (edje_object_file_set(edje, themefile, "Session") > 0)
    {
       evas_object_layer_set(edje, 0);
       evas_object_move(edje, -9999, -9999);
       edje_object_size_min_get(edje, &w, &h);
       if ((w > 0) && (h > 0))
-         evas_object_resize(edje, w, h);
+         evas_object_resize(result, w, h);
       else
-         evas_object_resize(edje, 150, 50);
+         evas_object_resize(result, 150, 50);
 
       if (edje_object_part_exists(edje, "EntranceSessionIcon"))
       {
-         if ((oo = entrance_x_session_icon_load(o, e->icon)))
+         if ((avatar = entrance_x_session_icon_load(o, e->icon)))
          {
-            edje_object_part_swallow(edje, "EntranceSessionIcon", oo);
+            entrance_smart_avatar_set(result, avatar);
+            edje_object_part_swallow(edje, "EntranceSessionIcon", avatar);
          }
       }
       if (edje_object_part_exists(edje, "EntranceSessionTitle"))
@@ -125,13 +130,13 @@
       edje_object_signal_callback_add(edje, "SessionUnSelected", "",
                                       session_item_selected_cb,
                                       (Entrance_X_Session *) e);
-      evas_object_show(edje);
+      evas_object_show(result);
    }
    else
    {
       fprintf(stderr, "Failed on: %s\n", themefile);
-      evas_object_del(edje);
-      edje = NULL;
+      evas_object_del(result);
+      result = NULL;
    }
-   return (edje);
+   return (result);
 }




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to