Add many changes, some functional, some not. Added back a file system

image viewing tab, done various cleanups/work. I basically wanted to get
what I had into the repository and keep up the work on the new stuff and
get the changes going.


SVN revision: 36339
This commit is contained in:
titan 2008-09-30 05:39:25 +00:00 committed by titan
parent 4c3bc8abc6
commit 00320aef4c
17 changed files with 699 additions and 368 deletions

View File

@ -67,17 +67,6 @@ dnl Set PACKAGE_SOURCE_DIR in config.h.
packagesrcdir=`cd $srcdir && pwd`
AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [Source code directory])
PKG_CHECK_MODULES([SQLITE], sqlite3,
[
have_sqlite3="Yes"
],
[
have_sqlite3="No"
echo "Sqlite3 was not found by pkg-config!";
AC_MSG_ERROR([Ephoto needs sqlite3 to compile.])
]
)
PKG_CHECK_MODULES([EXIF], libexif >= 0.6.13,
[
have_exif="Yes"
@ -99,14 +88,25 @@ PKG_CHECK_MODULES([EVAS], evas,
]
)
PKG_CHECK_MODULES([ECORE], ecore-file,
PKG_CHECK_MODULES([ECORE_FILE], ecore-file,
[
have_ecore="Yes"
have_ecoref="Yes"
],
[
have_ecore="No"
echo "Ecore was not found by pkg-config!";
AC_MSG_ERROR([Ephoto needs ecore to compile.])
have_ecoref="No"
echo "Ecore_File was not found by pkg-config!";
AC_MSG_ERROR([Ephoto needs ecore_file to compile.])
]
)
PKG_CHECK_MODULES([ECORE_EVAS], ecore-evas,
[
have_ecoree="Yes"
],
[
have_ecoree="No"
echo "Ecore_Evas was not found by pkg-config!";
AC_MSG_ERROR([Ephoto needs ecore_evas to compile.])
]
)
@ -187,13 +187,13 @@ echo
echo "Configuration Options Summary:"
echo
echo " Evas ............: $have_evas"
echo " Ecore ...........: $have_ecore"
echo " Ecore_File.......: $have_ecoref"
echo " Ecore_Evas.......: $have_ecoree"
echo " Edje ............: $have_edje"
echo " Efreet_Mime .....: $have_efreet_mime"
echo " Epsilon .........: $have_epsilon"
echo " Ewl .............: $have_ewl"
echo " Libexif .........: $have_exif"
echo " Sqlite3 .........: $have_sqlite3"
echo
echo "Installation Path.........: $prefix"
echo

View File

@ -14,6 +14,7 @@ FILES = add.png \
go-home.png \
go-down.png \
go-next.png \
go-previous.png \
image.png \
in.png \
list_view.png \

BIN
data/images/go-previous.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -138,7 +138,7 @@ changequote([,])dnl
], [])[extern int _nl_msg_cat_cntr;
extern int *_nl_domain_bindings;],
[bindtextdomain ("", "");
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
return (long) gettext ("")]ifelse([$2], [need-ngettext], [ + (long) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
gt_cv_func_gnugettext_libc=yes,
gt_cv_func_gnugettext_libc=no)])
@ -174,7 +174,7 @@ extern
#endif
const char *_nl_expand_alias ();],
[bindtextdomain ("", "");
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
return (long) gettext ("")]ifelse([$2], [need-ngettext], [ + (long) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
gt_cv_func_gnugettext_libintl=yes,
gt_cv_func_gnugettext_libintl=no)
dnl Now see whether libintl exists and depends on libiconv.
@ -195,7 +195,7 @@ extern
#endif
const char *_nl_expand_alias ();],
[bindtextdomain ("", "");
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
return (long) gettext ("")]ifelse([$2], [need-ngettext], [ + (long) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
[LIBINTL="$LIBINTL $LIBICONV"
LTLIBINTL="$LTLIBINTL $LTLIBICONV"
gt_cv_func_gnugettext_libintl=yes

View File

@ -10,19 +10,21 @@ ephoto_SOURCES = ephoto.c \
ephoto_database.c \
ephoto_dialogs.c \
ephoto_exif.c \
ephoto_fsystem.c \
ephoto_gui.c \
ephoto_imaging.c \
ephoto_import.c \
ephoto_main.c \
ephoto_nls.c \
ephoto_normal_view.c \
ephoto_simple.c \
ephoto_single_view.c \
ephoto_slideshow.c \
ephoto_utils.c
ephoto_CFLAGS = @EWL_CFLAGS@ @SQLITE_CFLAGS@ @EXIF_CFLAGS@ @EFREET_MIME_CFLAGS@ @EPSILON_CFLAGS@ -Wall
ephoto_CFLAGS = @EWL_CFLAGS@ @EXIF_CFLAGS@ @EFREET_MIME_CFLAGS@ @EPSILON_CFLAGS@ -Wall
ephoto_LDADD = @EWL_LIBS@ @SQLITE_LIBS@ @EXIF_LIBS@ @EFREET_MIME_LIBS@ @EPSILON_LIBS@
ephoto_LDADD = @EWL_LIBS@ @EXIF_LIBS@ @EFREET_MIME_LIBS@ @EPSILON_LIBS@
EXTRA_DIST = \
ephoto.h

View File

@ -5,11 +5,8 @@ Ephoto_Main *em;
int
main(int argc, char **argv)
{
if (!ewl_init(&argc, argv))
{
printf("Ewl is not usable, check your installation!\n");
return 1;
}
char *arg;
int i;
#ifdef ENABLE_NLS
setlocale(LC_MESSAGES, "");
@ -18,10 +15,41 @@ main(int argc, char **argv)
textdomain(PACKAGE);
#endif
for (i=0; i < argc; i++)
{
arg = argv[i];
if (!strcmp(arg, "-h"))
{
printf("Ephoto Help\n"
"ephoto -h: This help page.\n"
"ephoto -s /path/to/image: Simple image viewer.\n");
return 0;
}
if (!strcmp(arg, "-s") && i <= (argc-2))
{
i++;
arg = argv[i];
if (ecore_file_exists(arg))
{
if (!ecore_init())
{
printf("Error - Could not load Ecore.\n");
return 1;
}
show_ephoto_simple(arg);
ecore_main_loop_begin();
ecore_shutdown();
return 0;
}
}
}
if (!ewl_init(&argc, argv))
{
printf("Ewl is not usable, check your installation!\n");
return 1;
}
create_main();
ewl_main();
return 0;
}

View File

@ -7,8 +7,10 @@
#include "config.h"
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Ecore_Data.h>
#include <Ecore_File.h>
#include <Edje.h>
#include <Efreet_Mime.h>
#include <Epsilon.h>
#include <Evas.h>
@ -16,9 +18,6 @@
#include <libgen.h>
#include <limits.h>
#include <math.h>
#include <pthread.h>
#include <sched.h>
#include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -49,23 +48,18 @@
void show_albums(Ewl_Widget *c);
void populate_albums(Ewl_Widget *w, void *event, void *data);
void show_add_album_dialog(Ewl_Widget *w, void *event, void *data);
void *get_albums_pre();
void *get_aimages_pre();
void *create_athumb();
/*ephoto_database.c*/
sqlite3 *ephoto_db_init(void);
void ephoto_db_add_album(sqlite3 *db, const char *name,
void ephoto_db_init(void);
void ephoto_db_add_album(const char *name,
const char *description);
void ephoto_db_delete_album(sqlite3 *db, const char *name);
Ecore_List *ephoto_db_list_albums(sqlite3 *db);
void ephoto_db_add_image(sqlite3 *db, const char *album,
const char *name,
void ephoto_db_delete_album(const char *name);
Ecore_List *ephoto_db_list_albums();
void ephoto_db_add_images(const char *album,
Ecore_List *images);
void ephoto_db_delete_image(const char *album,
const char *path);
void ephoto_db_delete_image(sqlite3 *db, const char *album,
const char *path);
Ecore_List *ephoto_db_list_images(sqlite3 *db, const char *album);
void ephoto_db_close(sqlite3 *db);
Ecore_List *ephoto_db_list_images(const char *album);
/*ephoto_dialogs.c*/
void about_dialog(Ewl_Widget *w, void *event, void *data);
@ -80,9 +74,6 @@ void display_exif(Ewl_Widget *w, void *event, void *data);
/*ephoto_fsystem.c*/
void show_fsystem(Ewl_Widget *c);
void populate_fsystem(Ewl_Widget *w, void *event, void *data);
void *get_directories_pre();
void *get_fimages_pre();
void *create_fthumb();
/*ephoto_gui.c*/
Ewl_Widget *add_box(Ewl_Widget *c, Ewl_Orientation o, int spacing);
@ -91,7 +82,7 @@ Ewl_Widget *add_button(Ewl_Widget *c, char *lbl, const char *img,
void *data);
Ewl_Widget *add_entry(Ewl_Widget *c, char *txt, void *cb,
void *data);
Ewl_Widget *add_icon(Ewl_Widget *c, char *lbl, const char *img,
Ewl_Widget *add_icon(Ewl_Widget *c, const char *lbl, const char *img,
int thumb,
void *cb,
void *data);
@ -99,15 +90,15 @@ Ewl_Widget *add_image(Ewl_Widget *c,
const char *img, int thumb,
void *cb,
void *data);
Ewl_Widget *add_label(Ewl_Widget *c, char *lbl);
Ewl_Widget *add_label(Ewl_Widget *c, const char *lbl);
Ewl_Widget *add_menubar(Ewl_Widget *c);
Ewl_Widget *add_menu(Ewl_Widget *c, char *lbl);
Ewl_Widget *add_menu_item(Ewl_Widget *c, char *lbl,
Ewl_Widget *add_menu(Ewl_Widget *c, const char *lbl);
Ewl_Widget *add_menu_item(Ewl_Widget *c, const char *lbl,
const char *img,
void *cb,
void *data);
Ewl_Widget *add_text(Ewl_Widget *c, char *text);
Ewl_Widget *add_window(char *title, int w, int h, void *cb,
Ewl_Widget *add_window(const char *title, int w, int h, void *cb,
void *data);
/*ephoto_imaging.c*/
@ -137,6 +128,9 @@ Ewl_Widget *add_normal_view(Ewl_Widget *c);
void freebox_image_clicked(Ewl_Widget *w, void *event, void *data);
void show_normal_view(Ewl_Widget *w, void *event, void *data);
/*ephoto_simple.c*/
void show_ephoto_simple(const char *img);
/*ephoto_single_view.c*/
Ewl_Widget *add_single_view(Ewl_Widget *c);
void show_single_view(Ewl_Widget *w, void *event, void *data);
@ -159,7 +153,6 @@ struct _Ephoto_Main
{
char *current_album;
char *current_directory;
Ecore_Hash *types;
Ecore_List *albums;
Ecore_List *fsystem;
Ecore_List *images;
@ -169,13 +162,13 @@ struct _Ephoto_Main
Ewl_Widget *fbox;
Ewl_Widget *ftree;
Ewl_Widget *fthumb_size;
Ewl_Widget *info;
Ewl_Widget *scroll;
Ewl_Widget *simage;
Ewl_Widget *single_vbox;
Ewl_Widget *view;
Ewl_Widget *view_box;
Ewl_Widget *win;
sqlite3 *db;
};
extern Ephoto_Main *em;

View File

@ -16,7 +16,7 @@ void
show_albums(Ewl_Widget *c)
{
em->atree = add_atree(c);
ewl_object_maximum_w_set(EWL_OBJECT(em->atree), 180);
ewl_object_maximum_w_set(EWL_OBJECT(em->atree), 180);
populate_albums(NULL, NULL, NULL);
}
@ -52,8 +52,9 @@ add_atree(Ewl_Widget *c)
ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_FILL);
ewl_object_minimum_w_set(EWL_OBJECT(tree), 180);
ewl_container_child_prepend(EWL_CONTAINER(c), tree);
ewl_container_child_append(EWL_CONTAINER(c), tree);
ewl_widget_show(tree);
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), tree, "Albums");
return tree;
}
@ -125,7 +126,7 @@ rc_remove(Ewl_Widget *w, void *event, void *data)
Ewl_Widget *icon;
icon = data;
ephoto_db_delete_album(em->db, ewl_icon_label_get(EWL_ICON(icon)));
ephoto_db_delete_album(ewl_icon_label_get(EWL_ICON(icon)));
populate_albums(NULL, NULL, NULL);
}
@ -146,9 +147,7 @@ void
populate_albums(Ewl_Widget *w, void *event, void *data)
{
const char *album;
pthread_t album_worker;
int ret1;
album = NULL;
if (w)
@ -160,16 +159,10 @@ populate_albums(Ewl_Widget *w, void *event, void *data)
if (!ecore_list_empty_is(em->albums))
ecore_list_destroy(em->albums);
em->albums = ecore_list_new();
ret1 = pthread_create(&album_worker, NULL, get_albums_pre, NULL);
if (ret1)
{
printf("ERROR: Couldn't create thread!\n");
return;
}
pthread_join(album_worker, NULL);
em->albums = ecore_dlist_new();
em->albums = ephoto_db_list_albums();
ecore_dlist_first_goto(em->albums);
ewl_mvc_data_set(EWL_MVC(em->atree), em->albums);
populate_images(NULL, NULL, NULL);
return;
@ -178,41 +171,15 @@ populate_albums(Ewl_Widget *w, void *event, void *data)
static void
populate_images(Ewl_Widget *w, void *event, void *data)
{
pthread_t image_worker;
int ret1;
if (!ecore_list_empty_is(em->images))
ecore_dlist_destroy(em->images);
em->images = ecore_dlist_new();
if (em->fbox) ewl_container_reset(EWL_CONTAINER(em->fbox));
ret1 = pthread_create(&image_worker, NULL, get_aimages_pre, NULL);
if (ret1)
{ printf("ERROR: Couldn't create thread!\n");
return;
}
pthread_join(image_worker, NULL);
em->images = ephoto_db_list_images(em->current_album);
ecore_dlist_first_goto(em->images);
ewl_mvc_data_set(EWL_MVC(em->fbox), em->images);
return;
}
void *
get_albums_pre()
{
em->albums = ephoto_db_list_albums(em->db);
ecore_dlist_first_goto(em->albums);
ewl_mvc_data_set(EWL_MVC(em->atree), em->albums);
pthread_exit(NULL);
}
void *
get_aimages_pre()
{
em->images = ephoto_db_list_images(em->db, em->current_album);
ecore_dlist_first_goto(em->images);
pthread_exit(NULL);
}

View File

@ -1,28 +1,13 @@
#include "ephoto.h"
static int get_album_id(void *notused, int argc, char **argv, char **col);
static int get_image_id(void *notused, int argc, char **argv, char **col);
static int list_albums(void *notused, int argc, char **argv, char **col);
static int list_images(void *notused, int argc, char **argv, char **col);
static int list_image_ids(void *notused, int argc, char **argv, char **col);
static int image_id, album_id;
static Ecore_List *albums, *images_list, *image_ids;
sqlite3 *
void
ephoto_db_init(void)
{
char path[PATH_MAX];
char path2[PATH_MAX];
sqlite3 *db;
FILE *f;
albums = ecore_list_new();
images_list = ecore_dlist_new();
image_ids = ecore_list_new();
snprintf(path, PATH_MAX, "%s/.ephoto/.ephoto_database",
getenv("HOME"));
snprintf(path, PATH_MAX, "%s/.ephoto/.albums", getenv("HOME"));
snprintf(path2, PATH_MAX, "%s/.ephoto", getenv("HOME"));
if (!ecore_file_exists(path))
@ -31,234 +16,128 @@ ephoto_db_init(void)
{
ecore_file_mkdir(path2);
}
sqlite3_open(path, &db);
sqlite3_exec(db, "CREATE TABLE 'albums'( "
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
"name VARCHAR( 255 ) NOT NULL, "
"description VARCHAR( 255 ) NULL);", 0, 0, 0);
sqlite3_exec(db, "CREATE TABLE images( "
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
"name VARCHAR( 255 ) NULL, "
"path VARCHAR( 255 ) NOT NULL);", 0, 0, 0);
sqlite3_exec(db, "CREATE TABLE album_images( "
"image_id INTEGER NOT NULL, "
"album_id INTEGER NOT NULL);", 0, 0, 0);
ephoto_db_add_album(db, "Complete Library",
"Contains every tagged image!");
f = fopen(path, "w");
if (!f)
return;
fprintf(f, "#Ephoto Albums\n");
fclose(f);
ephoto_db_add_album("Complete Library",
"Every Image In The Collection");
}
else
{
sqlite3_open(path, &db);
}
return db;
}
static int
get_image_id(void *notused, int argc, char **argv, char **col)
{
int i;
notused = 0;
i = 0;
image_id = atoi(argv[i] ? argv[i] : "NULL");
return 0;
}
static int
get_album_id(void *notused, int argc, char **argv, char **col)
{
int i;
notused = 0;
i = 0;
album_id = atoi(argv[i] ? argv[i] : "NULL");
return 0;
}
void
ephoto_db_add_album(sqlite3 *db, const char *name, const char *description)
{
char command[PATH_MAX];
snprintf(command, PATH_MAX,
"INSERT or IGNORE INTO albums(name, description) "
"VALUES('%s', '%s');", name, description);
sqlite3_exec(db, command, 0, 0, 0);
return;
}
void
ephoto_db_delete_album(sqlite3 *db, const char *name)
{
char command[PATH_MAX];
snprintf(command, PATH_MAX, "DELETE FROM albums WHERE name = '%s';",
name);
sqlite3_exec(db, command, 0, 0, 0);
snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = '%s';",
name);
sqlite3_exec(db, command, get_album_id, 0, 0);
snprintf(command, PATH_MAX,
"DELETE FROM album_images WHERE album_id = '%d';",
album_id);
sqlite3_exec(db, command, 0, 0, 0);
return;
}
void
ephoto_db_add_image(sqlite3 *db, const char *album, const char *name, const char *path)
{
char command[PATH_MAX];
snprintf(command, PATH_MAX, "INSERT or IGNORE INTO images(name, path) "
"VALUES('%s', '%s');", name, path);
sqlite3_exec(db, command, 0, 0, 0);
snprintf(command, PATH_MAX, "SELECT id FROM images WHERE path = '%s';",
path);
sqlite3_exec(db, command, get_image_id, 0, 0);
snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = '%s';",
album);
sqlite3_exec(db, command, get_album_id, 0, 0);
snprintf(command, PATH_MAX,
"INSERT or IGNORE into album_images(image_id, album_id) "
"VALUES('%d', '%d');", image_id, album_id);
sqlite3_exec(db, command, 0, 0, 0);
return;
}
snprintf(command, PATH_MAX,
"SELECT id FROM albums WHERE name = 'Complete Library';");
sqlite3_exec(db, command, get_album_id, 0, 0);
snprintf(command, PATH_MAX,
"INSERT into album_images(image_id, album_id) "
"VALUES('%d', '%d');", image_id, album_id);
sqlite3_exec(db, command, 0, 0, 0);
void
ephoto_db_add_album(const char *name, const char *description)
{
char path[PATH_MAX], path2[PATH_MAX];
FILE *a;
FILE *f;
snprintf(path, PATH_MAX, "%s/.ephoto/.albums", getenv("HOME"));
snprintf(path2, PATH_MAX, "%s/.ephoto/.%s", getenv("HOME"), name);
f = fopen(path, "a+");
fprintf(f, "%s\n", name);
fprintf(f, "/*%s\n", description);
fclose(f);
a = fopen(path2, "w");
fprintf(a, "#%s\n", name);
fprintf(a, "#%s\n", description);
fclose(a);
return;
}
void
ephoto_db_delete_image(sqlite3 *db, const char *album, const char *path)
ephoto_db_delete_album(const char *name)
{
char command[PATH_MAX];
return;
}
snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = '%s';",
album);
sqlite3_exec(db, command, get_album_id, 0, 0);
snprintf(command, PATH_MAX, "SELECT id FROM images WHERE path = '%s';",
path);
sqlite3_exec(db, command, get_image_id, 0, 0);
snprintf(command, PATH_MAX, "DELETE FROM album_images WHERE "
"image_id = '%d' AND album_id = '%d';",
image_id, album_id);
sqlite3_exec(db, command, 0, 0, 0);
void
ephoto_db_add_images(const char *album, Ecore_List *images)
{
char path[PATH_MAX];
char path2[PATH_MAX];
char *image;
FILE *a;
FILE *cl;
snprintf(path, PATH_MAX, "%s/.ephoto/.%s", getenv("HOME"), album);
snprintf(path2, PATH_MAX, "%s/.ephoto/.Complete Library", getenv("HOME"));
a = fopen(path, "a+");
cl = fopen(path2, "a+");
while (!ecore_list_empty_is(images))
{
image = ecore_list_first_remove(images);
fprintf(a, "%s\n", image);
fprintf(cl, "%s\n", image);
}
fclose(a);
fclose(cl);
return;
}
void
ephoto_db_delete_image(const char *album, const char *path)
{
return;
}
static int
list_albums(void *notused, int argc, char **argv, char **col)
{
int i;
notused = 0;
for(i = 0; i < argc; i++)
{
ecore_list_append(albums, strdup(argv[i] ? argv[i] : "NULL"));
}
return 0;
}
Ecore_List *
ephoto_db_list_albums(sqlite3 *db)
ephoto_db_list_albums()
{
if(!ecore_list_empty_is(albums))
char album[PATH_MAX], path[PATH_MAX];
Ecore_List *albums;
FILE *f;
snprintf(path, PATH_MAX, "%s/.ephoto/.albums", getenv("HOME"));
f = fopen(path, "r");
albums = ecore_dlist_new();
while(fgets(album, PATH_MAX, f))
{
ecore_list_destroy(albums);
if (strncmp(album, "#", 1) && strncmp(album, "/*", 1))
{
album[strlen(album)-1] = '\0';
ecore_dlist_append(albums, strdup(album));
}
}
albums = ecore_list_new();
sqlite3_exec(db, "SELECT name FROM albums;", list_albums, 0, 0);
fclose(f);
ecore_dlist_first_goto(albums);
return albums;
}
static int
list_images(void *notused, int argc, char **argv, char **col)
{
int i;
notused = 0;
for(i = 0; i < argc; i++)
{
ecore_dlist_append(images_list,
strdup(argv[i] ? argv[i] : "NULL"));
}
return 0;
}
static int
list_image_ids(void *notused, int argc, char **argv, char **col)
{
int i;
notused = 0;
for(i = 0; i < argc; i++)
{
ecore_list_append(image_ids,
strdup(argv[i] ? argv[i] : "NULL"));
}
return 0;
}
Ecore_List *
ephoto_db_list_images(sqlite3 *db, const char *album)
ephoto_db_list_images(const char *album)
{
char command[PATH_MAX];
char *id;
char image[PATH_MAX];
char path[PATH_MAX];
Ecore_List *images;
FILE *a;
if(!ecore_list_empty_is(images_list))
{
ecore_dlist_destroy(images_list);
}
if(!ecore_list_empty_is(image_ids))
{
ecore_list_destroy(image_ids);
}
images_list = ecore_dlist_new();
image_ids = ecore_list_new();
images = ecore_dlist_new();
snprintf(path, PATH_MAX, "%s/.ephoto/.%s", getenv("HOME"), album);
a = fopen(path, "r");
snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = '%s';",
album);
sqlite3_exec(db, command, get_album_id, 0, 0);
snprintf(command, PATH_MAX,
"SELECT image_id FROM album_images WHERE album_id = '%d';",
album_id);
sqlite3_exec(db, command, list_image_ids, 0, 0);
while(!ecore_list_empty_is(image_ids))
while(fgets(image, PATH_MAX, a))
{
id = ecore_list_first_remove(image_ids);
snprintf(command, PATH_MAX, "SELECT path FROM images WHERE id"
" = '%s'", id);
sqlite3_exec(db, command, list_images, 0, 0);
if (strncmp(image, "#", 1))
{
image[strlen(image)-1] = '\0';
ecore_dlist_append(images, strdup(image));
}
}
return images_list;
ecore_dlist_first_goto(images);
fclose(a);
return images;
}
void
ephoto_db_close(sqlite3 *db)
{
sqlite3_close(db);
return;
}

169
src/bin/ephoto_fsystem.c Executable file
View File

@ -0,0 +1,169 @@
#include "ephoto.h"
static Ewl_Widget *add_ftree(Ewl_Widget *c);
static Ewl_Widget *fsystem_view_new(void *data, unsigned int row,
unsigned int column);
static Ewl_Widget *fsystem_header_fetch(void *data,
unsigned int column);
static void *fsystem_data_fetch(void *data, unsigned int row,
unsigned int column);
static unsigned int fsystem_data_count(void *data);
static void directory_clicked(Ewl_Widget *w, void *event, void *data);
static void populate_images(Ewl_Widget *w, void *event, void *data);
void
show_fsystem(Ewl_Widget *c)
{
em->ftree = add_ftree(c);
ewl_object_maximum_w_set(EWL_OBJECT(em->ftree), 180);
populate_fsystem(NULL, NULL, NULL);
}
static unsigned int
highlight_cb(void *data, unsigned int row)
{
return 0;
}
static Ewl_Widget *
add_ftree(Ewl_Widget *c)
{
Ewl_Widget *tree;
Ewl_Model *model;
Ewl_View *view;
model = ewl_model_new();
ewl_model_data_fetch_set(model, fsystem_data_fetch);
ewl_model_data_count_set(model, fsystem_data_count);
ewl_model_data_highlight_set(model, highlight_cb);
view = ewl_view_new();
ewl_view_widget_fetch_set(view, fsystem_view_new);
ewl_view_header_fetch_set(view, fsystem_header_fetch);
tree = ewl_tree_new();
ewl_tree_headers_visible_set(EWL_TREE(tree), TRUE);
ewl_tree_fixed_rows_set(EWL_TREE(tree), TRUE);
ewl_tree_column_count_set(EWL_TREE(tree), 1);
ewl_mvc_model_set(EWL_MVC(tree), model);
ewl_mvc_view_set(EWL_MVC(tree), view);
ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_FILL);
ewl_object_minimum_w_set(EWL_OBJECT(tree), 180);
ewl_container_child_append(EWL_CONTAINER(c), tree);
ewl_widget_show(tree);
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), tree, "File System");
return tree;
}
static Ewl_Widget *
fsystem_view_new(void *data, unsigned int row, unsigned int column)
{
char *directory;
Ewl_Widget *icon;
directory = data;
icon = add_icon(NULL, basename(directory),
PACKAGE_DATA_DIR "/images/folder.png", 0,
directory_clicked, NULL);
ewl_icon_constrain_set(EWL_ICON(icon), 25);
ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_HORIZONTAL);
ewl_object_alignment_set(EWL_OBJECT(icon), EWL_FLAG_ALIGN_LEFT);
ewl_object_fill_policy_set(EWL_OBJECT(icon), EWL_FLAG_FILL_ALL);
ewl_widget_name_set(icon, directory);
return icon;
}
static Ewl_Widget *
fsystem_header_fetch(void *data, unsigned int column)
{
Ewl_Widget *label;
label = add_label(NULL, "File System");
return label;
}
static void *
fsystem_data_fetch(void *data, unsigned int row, unsigned int column)
{
const char *directory;
void *val = NULL;
directory = ecore_list_index_goto(em->fsystem, row);
if (directory)
{
val = (void *)directory;
}
return val;
}
static unsigned int
fsystem_data_count(void *data)
{
int val;
val = ecore_list_count(em->fsystem);
return val;
}
static void directory_clicked(Ewl_Widget *w, void *event, void *data)
{
const char *dir_clicked, *path;
dir_clicked = ewl_widget_name_get(w);
if (!strcmp(dir_clicked, ".."))
path = dirname(em->current_directory);
else
path = dir_clicked;
em->current_directory = strdup(path);
populate_fsystem(NULL, NULL, NULL);
}
void
populate_fsystem(Ewl_Widget *w, void *event, void *data)
{
const char *directory;
directory = NULL;
if (w)
{
directory = ewl_widget_name_get(w);
em->current_directory = strdup(directory);
}
if (!ecore_list_empty_is(em->fsystem))
ecore_list_destroy(em->fsystem);
em->fsystem = ecore_list_new();
em->fsystem = get_directories(em->current_directory);
ecore_list_first_goto(em->fsystem);
ewl_mvc_data_set(EWL_MVC(em->ftree), em->fsystem);
populate_images(NULL, NULL, NULL);
return;
}
static void
populate_images(Ewl_Widget *w, void *event, void *data)
{
if (!ecore_dlist_empty_is(em->images))
ecore_dlist_destroy(em->images);
em->images = ecore_dlist_new();
if (em->fbox) ewl_container_reset(EWL_CONTAINER(em->fbox));
em->images = get_images(em->current_directory);
ecore_dlist_first_goto(em->images);
ewl_mvc_data_set(EWL_MVC(em->fbox), em->images);
return;
}

View File

@ -46,7 +46,7 @@ add_entry(Ewl_Widget *c, char *txt, void *cb, void *data)
}
Ewl_Widget *
add_icon(Ewl_Widget *c, char *lbl, const char *img, int thumb, void *cb, void *data)
add_icon(Ewl_Widget *c, const char *lbl, const char *img, int thumb, void *cb, void *data)
{
Ewl_Widget *icon;
@ -101,7 +101,7 @@ add_image(Ewl_Widget *c, const char *img, int thumb, void *cb, void *data)
}
Ewl_Widget *
add_label(Ewl_Widget *c, char *lbl)
add_label(Ewl_Widget *c, const char *lbl)
{
Ewl_Widget *label;
@ -130,7 +130,7 @@ add_menubar(Ewl_Widget *c)
}
Ewl_Widget *
add_menu(Ewl_Widget *c, char *lbl)
add_menu(Ewl_Widget *c, const char *lbl)
{
Ewl_Widget *menu;
@ -145,7 +145,7 @@ add_menu(Ewl_Widget *c, char *lbl)
}
Ewl_Widget *
add_menu_item(Ewl_Widget *c, char *lbl, const char *img, void *cb, void *data)
add_menu_item(Ewl_Widget *c, const char *lbl, const char *img, void *cb, void *data)
{
Ewl_Widget *mi;
@ -180,7 +180,7 @@ add_text(Ewl_Widget *c, char *txt)
}
Ewl_Widget *
add_window(char *title, int w, int h, void *cb, void *data)
add_window(const char *title, int w, int h, void *cb, void *data)
{
Ewl_Widget *win;

View File

@ -42,13 +42,10 @@ import(Ewl_Widget *w, void *event, void *data)
if (!name)
return;
else
ephoto_db_add_album(em->db, name, desc);
ephoto_db_add_album(name, desc);
while (!ecore_list_empty_is(selected_images))
{
image = ecore_list_first_remove(selected_images);
ephoto_db_add_image(em->db, name, basename(image), image);
}
image = ecore_list_first_remove(selected_images);
ephoto_db_add_images(name, selected_images);
ewl_widget_destroy(win);
populate_albums(NULL, NULL, NULL);

View File

@ -7,11 +7,9 @@ static void
destroy(Ewl_Widget *w, void *event, void *data)
{
ewl_widget_destroy(em->win);
ecore_hash_destroy(em->types);
ecore_list_destroy(em->albums);
ecore_list_destroy(em->fsystem);
ecore_dlist_destroy(em->images);
ephoto_db_close(em->db);
free(em->current_album);
free(em->current_directory);
free(em);
@ -32,20 +30,13 @@ create_main(void)
em->fsystem = ecore_list_new();
em->images = ecore_dlist_new();
em->types = ecore_hash_new(ecore_str_hash, ecore_str_compare);
ecore_hash_set(em->types, "image/gif", "image");
ecore_hash_set(em->types, "image/jpeg", "image");
ecore_hash_set(em->types, "image/png", "image");
ecore_hash_set(em->types, "image/svg+xml", "image");
ecore_hash_set(em->types, "image/tiff", "image");
em->current_album = strdup("Complete Library");
em->db = ephoto_db_init();
ephoto_db_init();
getcwd(buf, PATH_MAX);
em->current_directory = strdup(buf);
em->win = add_window("Ephoto - Photo Management", 600, 400, destroy, NULL);
em->win = add_window("Ephoto - Photo Management", 800, 600, destroy, NULL);
vbox = add_box(em->win, EWL_ORIENTATION_VERTICAL, 5);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);

View File

@ -2,6 +2,9 @@
static void change_size(Ewl_Widget *w, void *event, void *data);
static void thumb_clicked(Ewl_Widget *w, void *event, void *data);
static void update_info(Ewl_Widget *w, void *event, void *data);
static Ewl_Widget *fbox_widget_fetch(void *data, unsigned int row, unsigned int column);
static void populate(Ewl_Widget *w, void *event, void *data);
static void
change_size(Ewl_Widget *w, void *event, void *data)
@ -27,6 +30,20 @@ thumb_clicked(Ewl_Widget *w, void *event, void *data)
}
}
static void
update_info(Ewl_Widget *w, void *event, void *data)
{
char info[PATH_MAX];
if (ewl_container_child_count_get(EWL_CONTAINER(em->fbox)) == 0)
return;
snprintf(info, PATH_MAX, "%d images; %d selected;",
ewl_container_child_count_get(EWL_CONTAINER(em->fbox)),
ewl_mvc_selected_count_get(EWL_MVC(em->fbox)));
ewl_label_text_set(EWL_LABEL(em->info), info);
}
static Ewl_Widget *
fbox_widget_fetch(void *data, unsigned int row, unsigned int column)
{
@ -44,10 +61,19 @@ fbox_widget_fetch(void *data, unsigned int row, unsigned int column)
return image;
}
static void
populate(Ewl_Widget *w, void *event, void *data)
{
if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(w)) == em->atree)
populate_albums(NULL, NULL, NULL);
else
populate_fsystem(NULL, NULL, NULL);
}
Ewl_Widget *
add_normal_view(Ewl_Widget *c)
{
Ewl_Widget *avbox, *box, *button, *hbox, *image, *vbox;
Ewl_Widget *nb, *box, *button, *hbox, *image, *footer;
Ewl_View *view;
em->fbox_vbox = add_box(c, EWL_ORIENTATION_VERTICAL, 5);
@ -55,29 +81,19 @@ add_normal_view(Ewl_Widget *c)
EWL_FLAG_FILL_ALL);
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), em->fbox_vbox,
"Normal");
hbox = add_box(em->fbox_vbox, EWL_ORIENTATION_HORIZONTAL, 5);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
avbox = add_box(hbox, EWL_ORIENTATION_VERTICAL, 2);
ewl_object_fill_policy_set(EWL_OBJECT(avbox), EWL_FLAG_FILL_VFILL);
ewl_object_minimum_w_set(EWL_OBJECT(avbox), 220);
box = add_box(avbox, EWL_ORIENTATION_HORIZONTAL, 2);
ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_SHRINK);
button = add_button(box, "Import", PACKAGE_DATA_DIR "/images/add.png",
ephoto_import_dialog, NULL);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
button = add_button(box, "Export",
PACKAGE_DATA_DIR "/images/emblem-photos.png", NULL, NULL);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
vbox = add_box(hbox, EWL_ORIENTATION_VERTICAL, 2);
nb = ewl_notebook_new();
ewl_notebook_tabbar_homogeneous_set(EWL_NOTEBOOK(nb), TRUE);
ewl_object_fill_policy_set(EWL_OBJECT(nb), EWL_FLAG_FILL_VFILL);
ewl_object_minimum_w_set(EWL_OBJECT(nb), 220);
ewl_container_child_append(EWL_CONTAINER(hbox), nb);
ewl_callback_append(nb, EWL_CALLBACK_CLICKED, populate, NULL);
ewl_widget_show(nb);
em->scroll = ewl_scrollpane_new();
ewl_container_child_append(EWL_CONTAINER(vbox), em->scroll);
ewl_container_child_append(EWL_CONTAINER(hbox), em->scroll);
ewl_widget_show(em->scroll);
view = ewl_view_new();
@ -86,15 +102,43 @@ add_normal_view(Ewl_Widget *c)
em->fbox = ewl_hfreebox_mvc_new();
ewl_mvc_model_set(EWL_MVC(em->fbox), ewl_model_ecore_list_instance());
ewl_mvc_view_set(EWL_MVC(em->fbox), view);
ewl_mvc_selection_mode_set(EWL_MVC(em->fbox), EWL_SELECTION_MODE_SINGLE);
ewl_mvc_selection_mode_set(EWL_MVC(em->fbox), EWL_SELECTION_MODE_MULTI);
ewl_object_fill_policy_set(EWL_OBJECT(em->fbox), EWL_FLAG_FILL_ALL);
ewl_container_child_append(EWL_CONTAINER(em->scroll), em->fbox);
ewl_callback_append(em->fbox, EWL_CALLBACK_VALUE_CHANGED, update_info, NULL);
ewl_widget_show(em->fbox);
show_albums(avbox);
show_albums(nb);
show_fsystem(nb);
box = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 10);
ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_SHRINK);
footer = ewl_grid_new();
ewl_grid_dimensions_set(EWL_GRID(footer), 3, 1);
ewl_grid_row_fixed_h_set(EWL_GRID(footer), 0, 40);
ewl_container_child_append(EWL_CONTAINER(em->fbox_vbox), footer);
ewl_object_fill_policy_set(EWL_OBJECT(footer), EWL_FLAG_FILL_HFILL);
ewl_widget_show(footer);
box = add_box(footer, EWL_ORIENTATION_HORIZONTAL, 2);
ewl_grid_child_position_set(EWL_GRID(footer), box, 0,1,0,0);
ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_SHRINK);
ewl_object_alignment_set(EWL_OBJECT(box), EWL_FLAG_ALIGN_LEFT);
button = add_button(box, "Import", PACKAGE_DATA_DIR "/images/add.png",
ephoto_import_dialog, NULL);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
button = add_button(box, "Export",
PACKAGE_DATA_DIR "/images/emblem-photos.png", NULL, NULL);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
em->info = add_label(footer, "Images");
ewl_grid_child_position_set(EWL_GRID(footer), em->info, 1,2,0,0);
ewl_object_alignment_set(EWL_OBJECT(em->info), EWL_FLAG_ALIGN_CENTER);
box = add_box(footer, EWL_ORIENTATION_HORIZONTAL, 2);
ewl_grid_child_position_set(EWL_GRID(footer), box, 2,3,0,0);
ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_SHRINK);
ewl_object_alignment_set(EWL_OBJECT(box), EWL_FLAG_ALIGN_RIGHT);
image = add_image(box, PACKAGE_DATA_DIR "/images/image.png", 0, NULL, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 20);
@ -113,6 +157,8 @@ add_normal_view(Ewl_Widget *c)
image = add_image(box, PACKAGE_DATA_DIR "/images/image.png", 0, NULL, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 32);
populate_albums(NULL, NULL, NULL);
return em->fbox_vbox;
}

252
src/bin/ephoto_simple.c Normal file
View File

@ -0,0 +1,252 @@
#include "ephoto.h"
typedef struct image_data image_data;
struct image_data {
Evas_Object *clip;
Evas_Object *image;
};
static void
image_smart_add(Evas_Object *obj)
{
Evas *e;
image_data *id;
id = NULL;
id = calloc(1, sizeof(image_data));
e = evas_object_evas_get(obj);
id->clip = evas_object_rectangle_add(e);
id->image = evas_object_image_add(e);
evas_object_clip_set(id->image, id->clip);
evas_object_show(id->image);
evas_object_smart_member_add(id->clip, obj);
evas_object_smart_member_add(id->image, obj);
evas_object_smart_data_set(obj, id);
}
static void
image_smart_del(Evas_Object *obj)
{
image_data *id;
id = evas_object_smart_data_get(obj);
evas_object_del(id->clip);
evas_object_del(id->image);
free(id);
}
static void
image_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
image_data *id;
id = evas_object_smart_data_get(obj);
evas_object_move(id->clip, x, y);
evas_object_move(id->image, x, y);
}
static void
image_smart_recalculate(Evas_Object *img, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
int iw, ih, fw, fh;
double is, nw, nh, ns;
evas_object_image_size_get(img, &iw, &ih);
if (w == 0 || h == 0 || iw == 0 || ih == 0)
{
evas_object_image_fill_set(img, 0, 0, 1, 1);
evas_object_resize(img, 0, 0);
return;
}
is = (double)iw / (double)ih;
nw = (double)w / (double)iw;
nh = (double)h / (double)ih;
ns = (nw < nh) ? nw : nh;
fw = iw * ns;
fh = fw / is;
evas_object_move(img, x+(w-fw)/2, y+(h-fh)/2);
evas_object_resize(img, fw, fh);
evas_object_image_fill_set(img, 0, 0, fw, fh);
}
static void
image_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
image_data *id;
Evas_Coord x, y;
id = evas_object_smart_data_get(obj);
evas_object_resize(id->clip, w, h);
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
image_smart_recalculate(id->image, x, y, w, h);
}
static void
image_smart_show(Evas_Object *obj)
{
image_data *id;
id = evas_object_smart_data_get(obj);
evas_object_show(id->clip);
}
static void
image_smart_hide(Evas_Object *obj)
{
image_data *id;
id = evas_object_smart_data_get(obj);
evas_object_hide(id->clip);
}
static void
image_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
{
image_data *id;
id = evas_object_smart_data_get(obj);
evas_object_clip_set(id->clip, clip);
}
static void
image_smart_clip_unset(Evas_Object *obj)
{
image_data *id;
id = evas_object_smart_data_get(obj);
evas_object_clip_unset(id->clip);
}
static Evas_Smart *
image_smart_class(void)
{
static Evas_Smart *s;
static const Evas_Smart_Class sc = {
"Image_Smart",
EVAS_SMART_CLASS_VERSION,
image_smart_add,
image_smart_del,
image_smart_move,
image_smart_resize,
image_smart_show,
image_smart_hide,
NULL,
image_smart_clip_set,
image_smart_clip_unset,
NULL
};
s = evas_smart_class_new(&sc);
return(s);
}
static Evas_Object *
image_add(Evas *e)
{
Evas_Smart *smart;
smart = image_smart_class();
return evas_object_smart_add(e, smart);
}
static void
image_file_set(Evas_Object *obj, const char *img)
{
Evas_Coord x, y, w, h;
image_data *id;
id = evas_object_smart_data_get(obj);
evas_object_image_file_set(id->image, img, NULL);
evas_object_geometry_get(obj, &x, &y, &w, &h);
image_smart_recalculate(id->image, x, y, w, h);
}
static void
window_resize(Ecore_Evas *ee)
{
Evas_Object *interface;
Evas_Coord w, h;
Evas *e;
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
e = ecore_evas_get(ee);
interface = evas_object_name_find(e, "interface");
evas_object_resize(interface, w, h);
}
static void
close_ephoto_simple(Ecore_Evas *ee)
{
ecore_evas_shutdown();
ecore_main_loop_quit();
edje_shutdown();
}
void
show_ephoto_simple(const char *img)
{
Ecore_Evas *ee;
Evas *e;
Evas_Object *interface, *i;
if (!ecore_init())
{
printf("Error - Could not initialize Ecore.\n");
return;
}
if (!ecore_evas_init())
{
printf("Error - Could not initialize Ecore_Evas.\n");
return;
}
ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
if (!ee)
{
printf("Error - Could not create the Ecore_Evas window.\n");
return;
}
ecore_evas_size_min_set(ee, 400, 400);
ecore_evas_title_set(ee, "Ephoto Simple Viewer");
ecore_evas_name_class_set(ee, "Ephoto Simple Viewer", "Ephoto Simple Viewer");
ecore_evas_callback_resize_set(ee, window_resize);
ecore_evas_callback_delete_request_set(ee, close_ephoto_simple);
ecore_evas_callback_destroy_set(ee, close_ephoto_simple);
ecore_evas_borderless_set(ee, 1);
ecore_evas_shaped_set(ee, 1);
edje_init();
e = ecore_evas_get(ee);
interface = edje_object_add(e);
edje_object_file_set(interface, "/home/okra/coding/dev/e/ephoto/data/themes/ephoto/ephoto.edj", "ephoto");
evas_object_name_set(interface, "interface");
evas_object_move(interface, 0, 0);
evas_object_resize(interface, 400, 400);
evas_object_show(interface);
i = image_add(e);
image_file_set(i, img);
evas_object_name_set(i, "image_smart");
edje_object_part_swallow(interface, "image", i);
ecore_evas_resize(ee, 400, 400);
ecore_evas_show(ee);
return;
}

View File

@ -33,7 +33,7 @@ set_image_file(Ewl_Widget *w, void *event, void *data)
Ewl_Widget *
add_single_view(Ewl_Widget *c)
{
Ewl_Widget *ibox, *bhbox;
Ewl_Widget *ibox, *bhbox, *button;
em->ewin = NULL;
@ -47,7 +47,7 @@ add_single_view(Ewl_Widget *c)
ewl_widget_show(ibox);
em->simage = add_image(ibox, NULL, 0, NULL, NULL);
ewl_object_alignment_set(EWL_OBJECT(em->simage),
ewl_object_alignment_set(EWL_OBJECT(em->simage),
EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(em->simage),
EWL_FLAG_FILL_SHRINK);
@ -56,6 +56,12 @@ add_single_view(Ewl_Widget *c)
ewl_object_alignment_set(EWL_OBJECT(bhbox), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(bhbox), EWL_FLAG_FILL_SHRINK);
button = add_button(bhbox, "Back", PACKAGE_DATA_DIR "/images/go-previous.png",
show_normal_view, NULL);
ewl_button_image_size_set(EWL_BUTTON(button), 22, 22);
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
add_standard_edit_tools(bhbox);
return em->single_vbox;

View File

@ -130,7 +130,7 @@ get_images(const char *directory)
snprintf(path, PATH_MAX, "%s%s",
directory, file);
type = efreet_mime_type_get(strdup(path));
if ((ecore_hash_get(em->types, type)) == "image")
if (!strncmp(type, "image", 5))
ecore_dlist_append(files, strdup(path));
}
}