Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin Modified Files: Makefile.am main.c Log Message: - install and show the new test source - seems to be an issue with the scrollpane resetting when we change tests. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- Makefile.am 2 Mar 2006 06:34:28 -0000 1.20 +++ Makefile.am 3 Mar 2006 02:52:20 -0000 1.21 @@ -53,7 +53,7 @@ ewl_test_LDADD = $(top_builddir)/src/lib/libewl.la @EDJE_LIBS@ @ECORE_LIBS@ @EVAS_LIBS@ @EMOTION_LIBS@ ewl_test2_DEPENDENCIES = $(top_builddir)/src/lib/libewl.la -ewl_test2_SOURCES = Test.h main.c +ewl_test2_SOURCES = Ewl_Test2.h main.c ewl_test2_LDADD = $(top_builddir)/src/lib/libewl.la @EDJE_LIBS@ @ECORE_LIBS@ @EVAS_LIBS@ @EMOTION_LIBS@ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- main.c 2 Mar 2006 23:52:49 -0000 1.2 +++ main.c 3 Mar 2006 02:52:20 -0000 1.3 @@ -3,9 +3,12 @@ #include <string.h> #include <stdlib.h> #include <limits.h> +#include <dlfcn.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> #include <Ecore_File.h> #include <Ecore_Data.h> -#include <dlfcn.h> #define MAIN_WIDTH 640 #define MAIN_HEIGHT 320 @@ -17,6 +20,7 @@ static void run_test_boxed(Ewl_Widget *w, void *ev, void *data); static void run_window_test(Ewl_Test *test, int width, int height); static int create_main_test_window(Ewl_Container *win); +static void fill_source_text(Ewl_Test *text); static void ewl_test_cb_delete_window(Ewl_Widget *w, void *ev, void *data); @@ -140,6 +144,8 @@ n = ewl_widget_name_find("notebook"); ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), c); + + fill_source_text(t); } static void @@ -221,7 +227,7 @@ create_main_test_window(Ewl_Container *box) { Ewl_Test *t; - Ewl_Widget *note, *tree, *o; + Ewl_Widget *note, *tree, *o, *o2; Ewl_Widget *sim, *adv, *misc, *container; char *entries[1]; @@ -273,9 +279,13 @@ run_test_boxed, t); } + o2 = ewl_scrollpane_new(); + ewl_container_child_append(EWL_CONTAINER(note), o2); + ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o2, "Source"); + ewl_widget_show(o2); + o = ewl_text_new(); - ewl_container_child_append(EWL_CONTAINER(note), o); - ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o, "Source"); + ewl_container_child_append(EWL_CONTAINER(o2), o); ewl_widget_name_set(o, "source_text"); ewl_widget_show(o); @@ -294,5 +304,32 @@ return 1; } +static void +fill_source_text(Ewl_Test *test) +{ + Ewl_Widget *txt; + FILE *file; + struct stat buf; + char filename[PATH_MAX]; + + snprintf(filename, sizeof(filename), PACKAGE_DATA_DIR "/examples/%s", + test->filename); + file = fopen(filename, "r"); + if (file) + { + char *str; + + txt = ewl_widget_name_find("source_text"); + stat(filename, &buf); + str = malloc(sizeof(char) * (buf.st_size + 1)); + + fread(str, buf.st_size, 1, file); + str[buf.st_size] = '\0'; + + ewl_text_text_set(EWL_TEXT(txt), str); + free(str); + } + fclose(file); +} ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs