Enlightenment CVS committal
Author : titan
Project : e17
Module : proto
Dir : e17/proto/ephoto/src
Modified Files:
ephoto.c ephoto.h ephoto_callbacks.c
Log Message:
More rewrite.. still not quite usable.. for an idea visit..
www.ecoding.org/files/images/ephoto_better.png
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- ephoto.c 5 Sep 2006 18:57:30 -0000 1.67
+++ ephoto.c 5 Sep 2006 22:28:38 -0000 1.68
@@ -1,5 +1,5 @@
#include "ephoto.h"
-Main *m = NULL;
+Main *m;
int
main(int argc, char **argv)
@@ -8,18 +8,12 @@
char *home;
char ephoto_path[PATH_MAX];
char ephoto_complete[PATH_MAX];
- int argint = 1;
- int i = 0;
-
+ m = NULL;
+
if (!ewl_init(&argc, argv))
{
printf("Unable to init ewl\n");
return 1;
- }
-
- while ( argint < argc )
- {
- argint++;
}
home = getenv("HOME");
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- ephoto.h 5 Sep 2006 18:57:30 -0000 1.31
+++ ephoto.h 5 Sep 2006 22:28:38 -0000 1.32
@@ -3,13 +3,17 @@
#include <Ecore_File.h>
#include <Ewl.h>
+#include <fnmatch.h>
+#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+#include <strings.h>
void destroy_cb(Ewl_Widget *w, void *event, void *data);
void populate_albums(Ewl_Widget *w, void *event, void *data);
void populate_browser(Ewl_Widget *w, void *event, void *data);
+void populate_images(Ewl_Widget *w, void *event, void *data);
typedef struct _Main Main;
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto_callbacks.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ephoto_callbacks.c 5 Sep 2006 18:57:30 -0000 1.9
+++ ephoto_callbacks.c 5 Sep 2006 22:28:38 -0000 1.10
@@ -15,6 +15,8 @@
char *album;
char *home;
char path[PATH_MAX];
+ char full_path[PATH_MAX];
+ const char *image_path;
Ecore_List *albums;
Ewl_Widget *hbox;
Ewl_Widget *image;
@@ -23,7 +25,7 @@
Ewl_Widget *row;
home = getenv("HOME");
- snprintf(path, PATH_MAX, "%s/.ephoto/", home);
+ snprintf(path, PATH_MAX, "%s/.ephoto", home);
if (!ecore_file_exists(path)) ecore_file_mkdir(path);
@@ -33,14 +35,18 @@
while(!ecore_list_is_empty(albums))
{
album = ecore_list_remove_first(albums);
+ snprintf(full_path, PATH_MAX, "%s/%s", path, album);
hbox = ewl_hbox_new();
ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
ewl_box_spacing_set(EWL_BOX(hbox), 5);
ewl_widget_show(hbox);
-
+
+ image_path = ewl_icon_theme_icon_path_get(EWL_ICON_IMAGE_X_GENERIC,
+ EWL_ICON_SIZE_LARGE);
image = ewl_image_new();
+ ewl_image_file_set(EWL_IMAGE(image), image_path, NULL);
ewl_container_child_append(EWL_CONTAINER(hbox), image);
ewl_widget_show(image);
text = ewl_text_new();
@@ -54,8 +60,8 @@
children[1] = NULL;
row = ewl_tree_row_add(EWL_TREE(m->albums), NULL, children);
- ewl_widget_name_set(row, album);
- //ewl_callback_append(row, EWL_CALLBACK_CLICKED, NULL, NULL);
+ ewl_callback_append(row, EWL_CALLBACK_CLICKED, populate_images, NULL);
+ ewl_widget_name_set(row, full_path);
}
}
@@ -63,7 +69,10 @@
{
char *directory;
char *file;
- Ecore_List *files;
+ char full_path[PATH_MAX];
+ const char *image_path;
+ Ecore_List *ls;
+ Ecore_List *directories;
Ewl_Widget *hbox;
Ewl_Widget *image;
Ewl_Widget *text;
@@ -72,20 +81,33 @@
directory = data;
- files = ecore_list_new();
- files = ecore_file_ls(directory);
+ ls = ecore_list_new();
+ directories = ecore_list_new();
+
+ ls = ecore_file_ls(directory);
- while (!ecore_list_is_empty(files))
+ while (!ecore_list_is_empty(ls))
{
- file = ecore_list_remove_first(files);
+ file = ecore_list_remove_first(ls);
+ if (ecore_file_is_dir(file) && strncmp(file, ".", 1))
+ ecore_list_append(directories, file);
+ }
+ while (!ecore_list_is_empty(directories))
+ {
+ file = ecore_list_remove_first(directories);
+ snprintf(full_path, PATH_MAX, "%s/%s", directory, file);
+
hbox = ewl_hbox_new();
ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
ewl_box_spacing_set(EWL_BOX(hbox), 5);
ewl_widget_show(hbox);
+ image_path = ewl_icon_theme_icon_path_get(EWL_ICON_FOLDER,
+ EWL_ICON_SIZE_LARGE);
image = ewl_image_new();
+ ewl_image_file_set(EWL_IMAGE(image), image_path, NULL);
ewl_container_child_append(EWL_CONTAINER(hbox), image);
ewl_widget_show(image);
@@ -100,6 +122,78 @@
children[1] = NULL;
row = ewl_tree_row_add(EWL_TREE(m->browser), NULL, children);
- ewl_widget_name_set(row, file);
+ ewl_callback_append(row, EWL_CALLBACK_CLICKED, populate_images, NULL);
+ ewl_widget_name_set(row, full_path);
+ }
+}
+
+void populate_images(Ewl_Widget *w, void *event, void *data)
+{
+ FILE *file_ptr;
+ const char *dir;
+ char *image;
+ char full_path[PATH_MAX];
+ char text[PATH_MAX];
+ Ecore_List *ls;
+ Ecore_List *images;
+
+ ls = ecore_list_new();
+ images = ecore_list_new();
+ dir = ewl_widget_name_get(w);
+
+ if (ecore_file_is_dir(dir))
+ {
+ ls = ecore_file_ls(dir);
+ while(!ecore_list_is_empty(ls))
+ {
+ snprintf(full_path, PATH_MAX, "%s/%s", dir, ecore_list_remove_first(ls));
+ image = strdup(full_path);
+ if (fnmatch("*.[Jj][Pp][Ee][Gg]", image, 0) == 0)
+ {
+ ecore_list_append(images, image);
+ }
+ if (fnmatch("*.[Jj][Pp][Gg]", image, 0) == 0)
+ {
+ ecore_list_append(images, image);
+ }
+ if (fnmatch("*.[Pp][Nn][Gg]", image, 0) == 0)
+ {
+ ecore_list_append(images, image);
+ }
+ if (fnmatch("*.[Gg][Ii][Ff]", image, 0) == 0)
+ {
+ ecore_list_append(images, image);
+ }
+ if (fnmatch("*.[Ss][Vv][Gg]", image, 0) == 0)
+ {
+ ecore_list_append(images, image);
+ }
+ free(image);
+ }
+ }
+ else
+ {
+ file_ptr = fopen(dir, "r");
+ if (file_ptr != NULL)
+ {
+ while(fgets(text,PATH_MAX,file_ptr) != NULL)
+ {
+ if (strncmp(text, "#", 1)) ecore_list_append(images, strdup(text));
+ }
+ fclose(file_ptr);
+ }
+ }
+
+ while(!ecore_list_is_empty(images))
+ {
+ image = ecore_list_remove_first(images);
+
+ m->icon = ewl_icon_new();
+ ewl_box_orientation_set(EWL_BOX(m->icon), EWL_ORIENTATION_VERTICAL);
+ ewl_icon_image_set(EWL_ICON(m->icon), full_path, NULL);
+ //ewl_icon_label_set(EWL_ICON(m->icon), image);
+ ewl_icon_constrain_set(EWL_ICON(m->icon), 64);
+ ewl_container_child_append(EWL_CONTAINER(m->viewer_freebox), m->icon);
+ ewl_widget_show(m->icon);
}
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs