forked from enlightenment/ephoto
parent
f435afdb47
commit
34cf1d26e4
|
@ -13,6 +13,7 @@ ephoto_SOURCES = ephoto.c \
|
|||
ephoto_main.c \
|
||||
ephoto_nls.c \
|
||||
ephoto_normal_view.c \
|
||||
ephoto_slideshow.c \
|
||||
ephoto_utils.c
|
||||
|
||||
ephoto_CFLAGS = @ewl_cflags@ -Wall -Werror
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _EPHOTO_H_
|
||||
|
||||
#include "config.h"
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_Data.h>
|
||||
#include <Ecore_File.h>
|
||||
#include <Evas.h>
|
||||
|
@ -85,8 +86,8 @@ Ewl_Widget *add_ltree(Ewl_Widget *c);
|
|||
Ewl_Widget *add_normal_view(Ewl_Widget *c);
|
||||
void set_info(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
/* Ephoto Thumbnail */
|
||||
void generate_thumbnail(Ewl_Widget *image, char *path);
|
||||
/* Ephoto Slideshow */
|
||||
void start_slideshow(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
/* Ephoto Utilities*/
|
||||
const char *file_size_get(int size);
|
||||
|
|
|
@ -143,12 +143,11 @@ void create_main_gui(void)
|
|||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/get_exif.png", display_exif_dialog, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "View Exif Data");
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/stock_fullscreen.png", window_fullscreen, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "Toggle Fullscreen");
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/x-office-presentation.png", NULL, NULL);
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/x-office-presentation.png", start_slideshow, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "Start a Slideshow");
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
#include "ephoto.h"
|
||||
|
||||
static int change_picture(void *data);
|
||||
static void destroy(Ewl_Widget *w, void *event, void *data);
|
||||
static void show_first_image(Ewl_Widget *w, void *event, void *data);
|
||||
static Ecore_Timer *change;
|
||||
static Ewl_Widget *win;
|
||||
|
||||
static int change_picture(void *data)
|
||||
{
|
||||
char *image_path;
|
||||
Ewl_Widget *image;
|
||||
|
||||
image = data;
|
||||
|
||||
ecore_dlist_next(em->images);
|
||||
image_path = ecore_dlist_current(em->images);
|
||||
|
||||
if(!image_path)
|
||||
{
|
||||
ecore_timer_del(change);
|
||||
ewl_widget_destroy(win);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ewl_image_file_set(EWL_IMAGE(image), image_path, NULL);
|
||||
|
||||
free(image_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void destroy(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
ewl_widget_destroy(win);
|
||||
}
|
||||
|
||||
static void show_first_image(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
char *image_path;
|
||||
|
||||
ecore_dlist_goto_first(em->images);
|
||||
image_path = ecore_dlist_current(em->images);
|
||||
|
||||
ewl_container_reset(EWL_CONTAINER(w));
|
||||
ewl_image_file_set(EWL_IMAGE(w), image_path, NULL);
|
||||
|
||||
change = ecore_timer_add(5, change_picture, w);
|
||||
|
||||
free(image_path);
|
||||
return;
|
||||
}
|
||||
|
||||
void start_slideshow(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
Ewl_Widget *cell, *image;
|
||||
|
||||
win = ewl_window_new();
|
||||
ewl_window_title_set(EWL_WINDOW(win), "Ephoto Slideshow!");
|
||||
ewl_window_name_set(EWL_WINDOW(win), "Ephoto Slideshow!");
|
||||
ewl_window_fullscreen_set(EWL_WINDOW(win), 1);
|
||||
ewl_callback_append(win, EWL_CALLBACK_CLICKED, destroy, NULL);
|
||||
ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, destroy, NULL);
|
||||
ewl_widget_show(win);
|
||||
|
||||
cell = ewl_cell_new();
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_ALL);
|
||||
ewl_container_child_append(EWL_CONTAINER(win), cell);
|
||||
ewl_widget_show(cell);
|
||||
|
||||
image = add_image(cell, NULL, 0, NULL, NULL);
|
||||
ewl_image_proportional_set(EWL_IMAGE(image), TRUE);
|
||||
ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(image), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_callback_append(image, EWL_CALLBACK_SHOW, show_first_image, NULL);
|
||||
ewl_widget_show(image);
|
||||
|
||||
return;
|
||||
}
|
Loading…
Reference in New Issue