Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/bin


Modified Files:
        ewl_image_test.c 


Log Message:
Make the image test a little more intuitive.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_image_test.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ewl_image_test.c    21 Oct 2005 04:13:03 -0000      1.7
+++ ewl_image_test.c    17 Nov 2005 23:32:15 -0000      1.8
@@ -64,8 +64,27 @@
 }
 
 static void
-__image_load_cb(Ewl_Widget * w __UNUSED__, void *ev_data __UNUSED__, 
-                               void *user_data __UNUSED__)
+__image_remove_cb(Ewl_Widget * w __UNUSED__, void *ev_data __UNUSED__,
+                                       void *user_data __UNUSED__)
+{
+       char *img = NULL;
+
+       img = ecore_dlist_remove(images);
+       if (img)
+               free(img);
+
+       img = ecore_dlist_current(images);
+
+       if (!img) img = ecore_dlist_goto_last(images);
+
+       ewl_text_text_set(EWL_TEXT(entry_path), img);
+       ewl_image_file_set(EWL_IMAGE(image), img, NULL);
+
+       ewl_widget_configure(image_win);
+}
+
+static void
+__image_load()
 {
        char *img = NULL;
 
@@ -105,7 +124,7 @@
 {
        Ewl_Widget     *scrollpane;
        Ewl_Widget     *button_hbox;
-       Ewl_Widget     *button_prev, *button_load, *button_next;
+       Ewl_Widget     *button_prev, *button_remove, *button_next;
        char           *image_file = NULL;
 
        image_button = w;
@@ -166,20 +185,21 @@
 
        entry_path = ewl_entry_new();
        ewl_text_text_set(EWL_TEXT(entry_path), image_file);
-       ewl_object_fill_policy_set(EWL_OBJECT(entry_path), EWL_FLAG_FILL_HFILL);
+       ewl_object_fill_policy_set(EWL_OBJECT(entry_path),
+                                  EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
        ewl_object_alignment_set(EWL_OBJECT(entry_path), EWL_FLAG_ALIGN_CENTER);
        ewl_container_child_append(EWL_CONTAINER(button_hbox), entry_path);
        ewl_widget_show(entry_path);
 
-       button_load = ewl_button_new();
-       ewl_button_label_set(EWL_BUTTON(button_load), "Browse...");
-       ewl_callback_append(button_load, EWL_CALLBACK_CLICKED,
+       button_remove = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(button_remove), "Browse...");
+       ewl_callback_append(button_remove, EWL_CALLBACK_CLICKED,
                            __create_image_fd_cb, entry_path);
-       ewl_object_fill_policy_set(EWL_OBJECT(button_load), EWL_FLAG_FILL_NONE);
-       ewl_object_alignment_set(EWL_OBJECT(button_load),
+       ewl_object_fill_policy_set(EWL_OBJECT(button_remove), 
EWL_FLAG_FILL_NONE);
+       ewl_object_alignment_set(EWL_OBJECT(button_remove),
                                 EWL_FLAG_ALIGN_CENTER);
-       ewl_container_child_append(EWL_CONTAINER(button_hbox), button_load);
-       ewl_widget_show(button_load);
+       ewl_container_child_append(EWL_CONTAINER(button_hbox), button_remove);
+       ewl_widget_show(button_remove);
 
        button_hbox = ewl_hbox_new();
        ewl_box_spacing_set(EWL_BOX(button_hbox), 5);
@@ -192,24 +212,24 @@
 
        button_prev = ewl_button_new();
        ewl_button_label_set(EWL_BUTTON(button_prev), "Previous");
-       button_load = ewl_button_new();
-       ewl_button_label_set(EWL_BUTTON(button_load), "Load");
+       button_remove = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(button_remove), "Remove");
        button_next = ewl_button_new();
        ewl_button_label_set(EWL_BUTTON(button_next), "Next");
 
        ewl_container_child_append(EWL_CONTAINER(button_hbox), button_prev);
-       ewl_container_child_append(EWL_CONTAINER(button_hbox), button_load);
+       ewl_container_child_append(EWL_CONTAINER(button_hbox), button_remove);
        ewl_container_child_append(EWL_CONTAINER(button_hbox), button_next);
 
        ewl_callback_append(button_prev, EWL_CALLBACK_CLICKED,
                            __image_goto_prev_cb, NULL);
-       ewl_callback_append(button_load, EWL_CALLBACK_CLICKED,
-                           __image_load_cb, NULL);
+       ewl_callback_append(button_remove, EWL_CALLBACK_CLICKED,
+                           __image_remove_cb, NULL);
        ewl_callback_append(button_next, EWL_CALLBACK_CLICKED,
                            __image_goto_next_cb, NULL);
 
        ewl_widget_show(button_prev);
-       ewl_widget_show(button_load);
+       ewl_widget_show(button_remove);
        ewl_widget_show(button_next);
 
 
@@ -268,6 +288,7 @@
                path = ewl_filedialog_file_get (EWL_FILEDIALOG (w)));
                if (path) {
                        ewl_text_text_set(EWL_TEXT(entry), path);
+                       __image_load();
                        // FREE(path); FIXME: Is text widget allocated 
correctly?
                }
                ewl_widget_destroy(fdwin);




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to