158 lines
4.0 KiB
Raw Normal View History

#ifndef _EPHOTO_H_
#define _EPHOTO_H_
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <Eet.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Ecore_File.h>
#include <Efreet_Mime.h>
#include <Elementary.h>
#include <Eina.h>
#include <Edje.h>
#include <Evas.h>
#include <Eio.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include "config.h"
typedef struct _Ephoto_Config Ephoto_Config;
typedef struct _Ephoto Ephoto;
typedef enum _Ephoto_State Ephoto_State;
typedef enum _Ephoto_Orient Ephoto_Orient;
/*Main Functions*/
void ephoto_create_main_window(const char *directory, const char *image);
void ephoto_thumb_size_set(int size);
Evas_Object *ephoto_thumb_add(Evas_Object *parent, const char *path);
/* Configuration */
Eina_Bool ephoto_config_init(Ephoto *em);
void ephoto_config_save(Ephoto *em, Eina_Bool instant);
void ephoto_config_free(Ephoto *em);
/* Preferences */
void ephoto_show_preferences(Ephoto *em);
/*Ephoto Flow Browser*/
Evas_Object *ephoto_create_flow_browser(Evas_Object *parent);
void ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image);
/* smart callbacks called:
* "delete,request" - the user requested to delete the flow browser, typically called when go_back button is pressed or Escape key is typed.
/*Ephoto Slideshow*/
void ephoto_create_slideshow(void);
void ephoto_show_slideshow(int view, const char *current_image);
void ephoto_hide_slideshow(void);
void ephoto_delete_slideshow(void);
/* Ephoto Directory Thumb */
Evas_Object *ephoto_directory_thumb_add(Evas_Object *parent, const char *path);
/*Ephoto Thumb Browser*/
Evas_Object *ephoto_create_thumb_browser(Evas_Object *parent);
void ephoto_populate_thumbnails(Evas_Object *obj);
/* smart callbacks called:
* "selected" - an item in the thumb browser is selected. The selected file is passed as event_info argument.
* "directory,changed" - the user selected a new directory. The selected directory is passed as event_info argument.
/* Enum for the state machine */
enum _Ephoto_State
enum _Ephoto_Orient
struct _Ephoto_Config
int config_version;
int thumb_size;
int thumb_gen_size;
int remember_directory;
const char *directory;
double slideshow_timeout;
const char *slideshow_transition;
const char *editor;
int sort_images;
/*Ephoto Main Structure*/
struct _Ephoto
Evas *e;
Evas_Object *win;
Evas_Object *bg;
Evas_Object *layout;
Evas_Object *flow_browser;
Evas_Object *slideshow;
Evas_Object *slideshow_notify;
Evas_Object *thumb_browser;
Evas_Object *prefs_win;
Eina_List *images;
Ephoto_State state;
Ephoto_Config *config;
Eet_Data_Descriptor *config_edd;
Ecore_Timer *config_save;
extern Ephoto *em;
extern int __log_domain;
#define DBG(...) EINA_LOG_DOM_DBG(__log_domain, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(__log_domain, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(__log_domain, __VA_ARGS__)
static inline Eina_Bool
_ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
const char *type, *bname, *ext;
bname = info->path + info->name_start;
if (bname[0] == '.') return EINA_FALSE;
if ((info->dirent->d_type != DT_REG) && (info->dirent->d_type != DT_UNKNOWN))
return EINA_FALSE;
ext = info->path + info->path_length - 1;
for (; ext > bname; ext--) if (*ext == '.') break;
if (*ext == '.')
if ((strcasecmp(ext, "jpg") == 0) ||
(strcasecmp(ext, "jpeg") == 0) ||
(strcasecmp(ext, "png") == 0))
return EINA_TRUE;
if (!(type = efreet_mime_type_get(info->path))) return EINA_FALSE;
return strncmp(type, "image/", sizeof("image/") - 1) == 0;