Add the ability to specify a directory or file to run ephoto with.
SVN revision: 50176
This commit is contained in:
parent
f4d5a08859
commit
f1a200c4c3
|
@ -1,5 +1,7 @@
|
|||
#include "ephoto.h"
|
||||
|
||||
static void _ephoto_display_usage(void);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
@ -7,7 +9,55 @@ main(int argc, char **argv)
|
|||
elm_need_efreet();
|
||||
elm_init(argc, argv);
|
||||
|
||||
ephoto_create_main_window();
|
||||
if (argc > 2)
|
||||
{
|
||||
printf("Too Many Arguments!\n");
|
||||
_ephoto_display_usage();
|
||||
|
||||
elm_shutdown();
|
||||
efreet_mime_shutdown();
|
||||
ethumb_client_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (argc < 2)
|
||||
{
|
||||
ephoto_create_main_window(NULL, NULL);
|
||||
}
|
||||
else if (!strncmp(argv[1], "--help", 6))
|
||||
{
|
||||
_ephoto_display_usage();
|
||||
|
||||
elm_shutdown();
|
||||
efreet_mime_shutdown();
|
||||
ethumb_client_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (ecore_file_is_dir(argv[1]))
|
||||
{
|
||||
ephoto_create_main_window(argv[1], NULL);
|
||||
}
|
||||
else if (ecore_file_exists(argv[1]))
|
||||
{
|
||||
char *directory;
|
||||
const char *image;
|
||||
|
||||
image = eina_stringshare_add(argv[1]);
|
||||
directory = ecore_file_dir_get(argv[1]);
|
||||
ephoto_create_main_window(directory, image);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Incorrect Argument!\n");
|
||||
_ephoto_display_usage();
|
||||
|
||||
elm_shutdown();
|
||||
efreet_mime_shutdown();
|
||||
ethumb_client_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
elm_run();
|
||||
|
||||
|
@ -18,3 +68,13 @@ main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*Display useage commands for ephoto*/
|
||||
static void
|
||||
_ephoto_display_usage(void)
|
||||
{
|
||||
printf("Ephoto Useage: \n"
|
||||
"ephoto --help : This page\n"
|
||||
"ephoto filename : Specifies a file to open\n"
|
||||
"ephoto dirname : Specifies a directory to open\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "config.h"
|
||||
|
||||
/*Main Functions*/
|
||||
void ephoto_create_main_window(void);
|
||||
void ephoto_create_main_window(const char *directory, const char *image);
|
||||
|
||||
/*Ephoto Flow Browser*/
|
||||
void ephoto_create_flow_browser(void);
|
||||
|
@ -33,7 +33,7 @@ void ephoto_hide_flow_browser(void);
|
|||
void ephoto_delete_flow_browser(void);
|
||||
|
||||
/*Ephoto Thumb Browser*/
|
||||
void ephoto_create_thumb_browser(void);
|
||||
void ephoto_create_thumb_browser(const char *directory);
|
||||
void ephoto_show_thumb_browser(void);
|
||||
void ephoto_hide_thumb_browser(void);
|
||||
void ephoto_delete_thumb_browser(void);
|
||||
|
|
|
@ -70,10 +70,35 @@ void
|
|||
ephoto_show_flow_browser(const char *current_image)
|
||||
{
|
||||
const char *file_type;
|
||||
Elm_Toolbar_Item *o;
|
||||
|
||||
iter = eina_list_data_find_list(em->images, current_image);
|
||||
if (iter == NULL)
|
||||
iter = eina_list_nth_list(em->images, 0);
|
||||
{
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "First");
|
||||
elm_toolbar_item_disabled_set(o, EINA_TRUE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Previous");
|
||||
elm_toolbar_item_disabled_set(o, EINA_TRUE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Next");
|
||||
elm_toolbar_item_disabled_set(o, EINA_TRUE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Last");
|
||||
elm_toolbar_item_disabled_set(o, EINA_TRUE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Slideshow");
|
||||
elm_toolbar_item_disabled_set(o, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "First");
|
||||
elm_toolbar_item_disabled_set(o, EINA_FALSE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Previous");
|
||||
elm_toolbar_item_disabled_set(o, EINA_FALSE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Next");
|
||||
elm_toolbar_item_disabled_set(o, EINA_FALSE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Last");
|
||||
elm_toolbar_item_disabled_set(o, EINA_FALSE);
|
||||
o = elm_toolbar_item_find_by_label(toolbar, "Slideshow");
|
||||
elm_toolbar_item_disabled_set(o, EINA_FALSE);
|
||||
}
|
||||
|
||||
elm_box_unpack(em->flow_browser, image);
|
||||
elm_box_unpack(em->flow_browser, image2);
|
||||
|
|
|
@ -8,7 +8,7 @@ static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event
|
|||
|
||||
/*Create the main ephoto window*/
|
||||
void
|
||||
ephoto_create_main_window(void)
|
||||
ephoto_create_main_window(const char *directory, const char *image)
|
||||
{
|
||||
em = calloc(1, sizeof(Ephoto));
|
||||
|
||||
|
@ -37,8 +37,15 @@ ephoto_create_main_window(void)
|
|||
evas_object_size_hint_fill_set(em->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(em->box);
|
||||
|
||||
ephoto_create_thumb_browser();
|
||||
ephoto_create_thumb_browser(directory);
|
||||
ephoto_create_flow_browser();
|
||||
if (image)
|
||||
{
|
||||
ephoto_show_flow_browser(image);
|
||||
eina_stringshare_del(image);
|
||||
}
|
||||
else
|
||||
ephoto_show_thumb_browser();
|
||||
}
|
||||
|
||||
/*Delete the main ephoto window*/
|
||||
|
|
|
@ -32,7 +32,7 @@ struct _Ephoto_Thumb_Data
|
|||
|
||||
/*Create the thumbnail browser object*/
|
||||
void
|
||||
ephoto_create_thumb_browser(void)
|
||||
ephoto_create_thumb_browser(const char *directory)
|
||||
{
|
||||
Evas_Object *o;
|
||||
char buf[PATH_MAX];
|
||||
|
@ -41,16 +41,22 @@ ephoto_create_thumb_browser(void)
|
|||
|
||||
ec = ethumb_client_connect(_ephoto_thumber_connected, NULL, NULL);
|
||||
|
||||
if (!directory)
|
||||
{
|
||||
getcwd(buf, PATH_MAX);
|
||||
current_directory = eina_stringshare_add(buf);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
current_directory = eina_stringshare_add(directory);
|
||||
}
|
||||
toolbar = elm_toolbar_add(em->win);
|
||||
elm_toolbar_icon_size_set(toolbar, 24);
|
||||
elm_toolbar_homogenous_set(toolbar, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, 0.5);
|
||||
elm_box_pack_end(em->box, toolbar);
|
||||
evas_object_show(toolbar);
|
||||
// evas_object_show(toolbar);
|
||||
|
||||
o = elm_icon_add(em->win);
|
||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/change_directory.png", NULL);
|
||||
|
@ -77,21 +83,21 @@ ephoto_create_thumb_browser(void)
|
|||
evas_object_size_hint_fill_set(em->thumb_browser, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_object_style_set(em->thumb_browser, "ephoto");
|
||||
elm_box_pack_end(em->box, em->thumb_browser);
|
||||
evas_object_show(em->thumb_browser);
|
||||
// evas_object_show(em->thumb_browser);
|
||||
|
||||
thbox = elm_box_add(em->win);
|
||||
elm_box_horizontal_set(thbox, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(thbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_fill_set(thbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(em->box, thbox);
|
||||
evas_object_show(thbox);
|
||||
// evas_object_show(thbox);
|
||||
|
||||
dir_label = elm_label_add(em->win);
|
||||
elm_label_label_set(dir_label, buf);
|
||||
evas_object_size_hint_weight_set(dir_label, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(dir_label, 0.01, 0.5);
|
||||
elm_box_pack_end(thbox, dir_label);
|
||||
evas_object_show(dir_label);
|
||||
// evas_object_show(dir_label);
|
||||
|
||||
thumb_slider = elm_slider_add(em->win);
|
||||
elm_slider_label_set(thumb_slider, "Thumb Size:");
|
||||
|
@ -99,7 +105,7 @@ ephoto_create_thumb_browser(void)
|
|||
elm_slider_min_max_set(thumb_slider, 0, 100);
|
||||
elm_slider_value_set(thumb_slider, 50);
|
||||
elm_box_pack_end(thbox, thumb_slider);
|
||||
evas_object_show(thumb_slider);
|
||||
// evas_object_show(thumb_slider);
|
||||
evas_object_smart_callback_add(thumb_slider, "changed",
|
||||
_ephoto_slider_changed, NULL);
|
||||
cur_val = 50;
|
||||
|
|
Loading…
Reference in New Issue