Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_icon.c ewl_icon.h 


Log Message:
- store the constrain in the icon so it can be set before the image is set

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_icon.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_icon.c  1 Apr 2007 21:48:06 -0000       1.37
+++ ewl_icon.c  3 Jul 2007 02:47:43 -0000       1.38
@@ -114,6 +114,7 @@
         */
        icon->thumbnailing = TRUE;
        icon->complex_label = TRUE;
+       icon->constrain = 16;
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
@@ -198,7 +199,6 @@
 ewl_icon_image_set(Ewl_Icon *icon, const char *file, const char *key)
 {
        Ewl_Widget *img;
-       int constrain = 16;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("icon", icon);
@@ -206,23 +206,21 @@
        DCHECK_TYPE("icon", icon, EWL_ICON_TYPE);
 
        if (icon->image)
-       {
-               constrain = ewl_icon_constrain_get(icon);
                ewl_widget_destroy(icon->image);
-       }
 
        img = ewl_image_new();
        ewl_image_file_set(EWL_IMAGE(img), file, key);
 
-       if (icon->thumbnailing) {
+       if (icon->thumbnailing)
+       {
                icon->image = ewl_image_thumbnail_get(EWL_IMAGE(img));
                ewl_callback_append(icon->image, EWL_CALLBACK_VALUE_CHANGED,
                                        ewl_icon_cb_thumb_value_changed, icon);
-               ewl_icon_constrain_set(icon, constrain);
        }
        else
                icon->image = img;
 
+       ewl_icon_constrain_set(icon, icon->constrain);
        ewl_image_proportional_set(EWL_IMAGE(icon->image), TRUE);
        ewl_object_alignment_set(EWL_OBJECT(icon->image), 
                                                EWL_FLAG_ALIGN_CENTER);
@@ -461,6 +459,7 @@
        DCHECK_PARAM_PTR("icon", icon);
        DCHECK_TYPE("icon", icon, EWL_ICON_TYPE);
 
+       icon->constrain = val;
        if (icon->image)
                ewl_image_constrain_set(EWL_IMAGE(icon->image), val);
 
@@ -475,15 +474,11 @@
 unsigned int
 ewl_icon_constrain_get(Ewl_Icon *icon)
 {
-       unsigned int constrain = 0;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("icon", icon, 0);
        DCHECK_TYPE_RET("icon", icon, EWL_ICON_TYPE, 0);
 
-       constrain = ewl_image_constrain_get(EWL_IMAGE(icon->image));
-
-       DRETURN_INT(constrain, DLEVEL_STABLE);
+       DRETURN_INT(icon->constrain, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_icon.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ewl_icon.h  11 Mar 2007 22:35:56 -0000      1.16
+++ ewl_icon.h  3 Jul 2007 02:47:43 -0000       1.17
@@ -51,6 +51,8 @@
 
        char *label_text;       /**< The label text */
 
+       unsigned int constrain;         /**< The image constrain value */
+
        Ewl_Icon_Type type;             /**< The icons type */
        Ewl_Icon_Part hidden;           /**< The hidden part */
        unsigned char editable:1;       /**< Is the icon editable? */



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to