aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Houston <smhouston88@gmail.com>2017-11-28 15:01:48 -0600
committerStephen Houston <smhouston88@gmail.com>2017-11-28 15:02:52 -0600
commitaec1b6516d65930c82ea892c0654b15deacd8bce (patch)
tree47d4156454adeaecbdd9cda94db25c171b64a05a
parentAdding danish string to desktop file (diff)
downloadephoto-aec1b6516d65930c82ea892c0654b15deacd8bce.tar.gz
Ephoto: Add a gadget config so that ephoto can work as an Enlightenment sandboxed gadget.
-rw-r--r--data/desktop/meson.build16
-rw-r--r--meson.build4
-rw-r--r--src/bin/ephoto.c22
-rw-r--r--src/bin/ephoto.h6
-rw-r--r--src/bin/ephoto_main.c422
-rw-r--r--src/bin/ephoto_slideshow.c155
-rw-r--r--src/bin/meson.build3
7 files changed, 410 insertions, 218 deletions
diff --git a/data/desktop/meson.build b/data/desktop/meson.build
index eb44075..8b33cab 100644
--- a/data/desktop/meson.build
+++ b/data/desktop/meson.build
@@ -2,3 +2,19 @@ install_data('ephoto.desktop',
install_dir: join_paths(dir_data, 'applications'))
install_data('ephoto.png',
install_dir: join_paths(dir_data, 'icons'))
+host_os = host_machine.system()
+if host_os == 'linux'
+ if cc.has_header_symbol('features.h', '__UCLIBC__')
+ host_os = 'linux-uclibc'
+ elif cc.has_header_symbol('features.h', '__dietlibc__')
+ host_os = 'linux-dietlibc'
+ else
+ host_os = 'linux-gnu'
+ endif
+endif
+dep_e = dependency('enlightenment')
+release = dep_e.get_pkgconfig_variable('release')
+module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), release)
+dir_gadgets = join_paths([dir_lib, 'enlightenment/gadgets', module_arch])
+install_data('ephoto.desktop',
+ install_dir: join_paths([dir_gadgets, 'ephoto']))
diff --git a/meson.build b/meson.build
index 87f081a..2665538 100644
--- a/meson.build
+++ b/meson.build
@@ -17,6 +17,7 @@ elm = dependency('elementary', required: true, version: efl_version)
edje = dependency('edje', required: true, version: efl_version)
eipc = dependency('ecore-ipc', required: true, version: efl_version)
exif = dependency('libexif', required: false, version: '>= 0.6.0')
+depe = dependency('enlightenment', required: false)
##### check for windows dependency
if build_machine.system() == 'windows'
win = dependency('evil', version: efl_version)
@@ -66,6 +67,9 @@ endif
if exif.found() == true
cfg.set ('HAVE_LIBEXIF' , 1)
endif
+if depe.found() == true
+ cfg.set ('HAVE_E' , 1)
+endif
if get_option('nls') == true
if cc.has_header('locale.h') == true
if cc.has_header('libintl.h') == true
diff --git a/src/bin/ephoto.c b/src/bin/ephoto.c
index 826648f..8cbf01a 100644
--- a/src/bin/ephoto.c
+++ b/src/bin/ephoto.c
@@ -2,16 +2,17 @@
static void _ephoto_display_usage(void);
-EAPI_MAIN int
-elm_main(int argc, char **argv)
+int
+main(int argc, char *argv[])
{
- int r = 0;
+ int gadget = 0, r = 0;
+ elm_init(argc, (char **)argv);
eio_init();
elm_need_efreet();
elm_language_set("");
elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
- elm_app_info_set(elm_main, "ephoto", "themes/ephoto.edj");
+ elm_app_info_set(main, "ephoto", "themes/ephoto.edj");
#if HAVE_GETTEXT && ENABLE_NLS
elm_app_compile_locale_set(LOCALEDIR);
bindtextdomain(PACKAGE, elm_app_locale_dir_get());
@@ -28,6 +29,9 @@ elm_main(int argc, char **argv)
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
+ if (getenv("E_GADGET_ID"))
+ gadget = 1;
+
if (argc > 2)
{
printf("Too Many Arguments!\n");
@@ -37,7 +41,7 @@ elm_main(int argc, char **argv)
}
else if (argc < 2)
{
- Evas_Object *win = ephoto_window_add(NULL);
+ Evas_Object *win = ephoto_window_add(NULL, gadget);
if (!win)
{
@@ -61,7 +65,7 @@ elm_main(int argc, char **argv)
r = 1;
goto end;
}
- Evas_Object *win = ephoto_window_add(real);
+ Evas_Object *win = ephoto_window_add(real, gadget);
free(real);
if (!win)
@@ -71,12 +75,12 @@ elm_main(int argc, char **argv)
}
}
- elm_run();
-
+ ecore_main_loop_begin();
end:
e_thumb_shutdown();
efreet_mime_shutdown();
eio_shutdown();
+ elm_shutdown();
return r;
}
@@ -89,5 +93,3 @@ _ephoto_display_usage(void)
"ephoto filename : Specifies a file to open\n"
"ephoto dirname : Specifies a directory to open\n");
}
-
-ELM_MAIN()
diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
index dc62990..b8a5393 100644
--- a/src/bin/ephoto.h
+++ b/src/bin/ephoto.h
@@ -21,6 +21,9 @@
# include <Edje.h>
# include <Evas.h>
# include <Eio.h>
+#if HAVE_ENLIGHTENMENT
+# include <e_gadget_types.h>
+#endif
#if HAVE_GETTEXT
# include <locale.h>
@@ -45,7 +48,7 @@ typedef enum _Ephoto_Sort Ephoto_Sort;
typedef enum _Ephoto_Ipc_Domain Ephoto_Ipc_Domain;
/*main window functions*/
-Evas_Object *ephoto_window_add(const char *path);
+Evas_Object *ephoto_window_add(const char *path, int gadget);
void ephoto_title_set(Ephoto *ephoto, const char *title);
void ephoto_thumb_size_set(Ephoto *ephoto, int size);
Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent,
@@ -292,6 +295,7 @@ struct _Ephoto
const char *destination;
int thumb_gen_size;
+ int gadget;
struct
{
diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
index 1c0a787..0dcea9f 100644
--- a/src/bin/ephoto_main.c
+++ b/src/bin/ephoto_main.c
@@ -102,23 +102,31 @@ _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry)
{
_ephoto_state_set(ephoto, EPHOTO_STATE_SLIDESHOW);
ephoto_slideshow_show_controls(ephoto);
- if (ephoto->selentries)
- ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->selentries);
- else if (ephoto->searchentries)
- ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->searchentries);
- else
- ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->entries);
- ephoto_slideshow_entry_set(ephoto->slideshow, entry);
+ if (!ephoto->gadget)
+ {
+ if (ephoto->selentries)
+ ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->selentries);
+ else if (ephoto->searchentries)
+ ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->searchentries);
+ else
+ ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->entries);
+ ephoto_slideshow_entry_set(ephoto->slideshow, entry);
+ }
evas_object_show(ephoto->slideshow);
- evas_object_hide(ephoto->single_browser);
- evas_object_hide(ephoto->thumb_browser);
- elm_object_focus_set(ephoto->slideshow, EINA_TRUE);
- elm_table_unpack(ephoto->main, ephoto->statusbar);
- evas_object_hide(ephoto->dir_browser);
- elm_box_unpack(ephoto->layout, ephoto->dir_browser);
- evas_object_hide(ephoto->statusbar);
- evas_object_freeze_events_set(ephoto->single_browser, EINA_TRUE);
- evas_object_freeze_events_set(ephoto->thumb_browser, EINA_TRUE);
+ if (!ephoto->gadget)
+ {
+ evas_object_hide(ephoto->single_browser);
+ evas_object_hide(ephoto->thumb_browser);
+ elm_table_unpack(ephoto->main, ephoto->statusbar);
+ evas_object_hide(ephoto->dir_browser);
+ elm_box_unpack(ephoto->layout, ephoto->dir_browser);
+ evas_object_hide(ephoto->statusbar);
+ evas_object_freeze_events_set(ephoto->single_browser, EINA_TRUE);
+ evas_object_freeze_events_set(ephoto->thumb_browser, EINA_TRUE);
+ elm_table_unpack(ephoto->main, ephoto->statusbar);
+ }
+ if (!ephoto->gadget)
+ elm_object_focus_set(ephoto->slideshow, EINA_TRUE);
evas_object_freeze_events_set(ephoto->slideshow, EINA_FALSE);
}
@@ -241,7 +249,8 @@ _win_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
ecore_event_handler_del(handler);
}
ephoto_entries_free(ephoto);
- ephoto_config_save(ephoto);
+ if (!ephoto->gadget)
+ ephoto_config_save(ephoto);
free(ephoto->config);
free(ephoto);
}
@@ -255,6 +264,8 @@ _resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
if (elm_win_fullscreen_get(ephoto->win))
return;
+ if (ephoto->gadget)
+ return;
evas_object_geometry_get(ephoto->win, 0, 0, &w, &h);
if (w && h)
{
@@ -358,7 +369,7 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
}
Evas_Object *
-ephoto_window_add(const char *path)
+ephoto_window_add(const char *path, int gadget)
{
Ephoto *ephoto = calloc(1, sizeof(Ephoto));
Evas_Object *ic, *but;
@@ -381,7 +392,16 @@ ephoto_window_add(const char *path)
ephoto->thumb_browser_dirty = EINA_FALSE;
ephoto->entries = NULL;
ephoto->sort = EPHOTO_SORT_ALPHABETICAL_ASCENDING;
- ephoto->win = elm_win_util_standard_add("ephoto", "Ephoto");
+ ephoto->gadget = gadget;
+ if (!ephoto->gadget)
+ ephoto->win = elm_win_util_standard_add("ephoto", "Ephoto");
+ else
+ {
+ ephoto->win = elm_win_add(NULL, "ephoto", ELM_WIN_BASIC);
+ elm_win_title_set(ephoto->win, "Ephoto");
+ elm_win_alpha_set(ephoto->win, 1);
+ evas_object_size_hint_aspect_set(ephoto->win, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+ }
if (!ephoto->win)
{
free(ephoto);
@@ -426,31 +446,34 @@ ephoto_window_add(const char *path)
elm_box_pack_end(ephoto->layout, ephoto->pager);
evas_object_show(ephoto->pager);
- ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout);
- if (!ephoto->thumb_browser)
- {
- evas_object_del(ephoto->win);
- return NULL;
- }
- elm_table_pack(ephoto->pager, ephoto->thumb_browser, 0, 0, 1, 1);
- evas_object_smart_callback_add(ephoto->thumb_browser, "view",
- _ephoto_thumb_browser_view, ephoto);
- evas_object_smart_callback_add(ephoto->thumb_browser, "changed,directory",
- _ephoto_thumb_browser_changed_directory, ephoto);
- evas_object_smart_callback_add(ephoto->thumb_browser, "slideshow",
- _ephoto_thumb_browser_slideshow, ephoto);
-
- ephoto->single_browser = ephoto_single_browser_add(ephoto, ephoto->layout);
- if (!ephoto->single_browser)
+ if (!ephoto->gadget)
{
- evas_object_del(ephoto->win);
- return NULL;
+ ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout);
+ if (!ephoto->thumb_browser)
+ {
+ evas_object_del(ephoto->win);
+ return NULL;
+ }
+ elm_table_pack(ephoto->pager, ephoto->thumb_browser, 0, 0, 1, 1);
+ evas_object_smart_callback_add(ephoto->thumb_browser, "view",
+ _ephoto_thumb_browser_view, ephoto);
+ evas_object_smart_callback_add(ephoto->thumb_browser, "changed,directory",
+ _ephoto_thumb_browser_changed_directory, ephoto);
+ evas_object_smart_callback_add(ephoto->thumb_browser, "slideshow",
+ _ephoto_thumb_browser_slideshow, ephoto);
+
+ ephoto->single_browser = ephoto_single_browser_add(ephoto, ephoto->layout);
+ if (!ephoto->single_browser)
+ {
+ evas_object_del(ephoto->win);
+ return NULL;
+ }
+ elm_table_pack(ephoto->pager, ephoto->single_browser, 0, 0, 1, 1);
+ evas_object_smart_callback_add(ephoto->single_browser, "back",
+ _ephoto_single_browser_back, ephoto);
+ evas_object_smart_callback_add(ephoto->single_browser, "slideshow",
+ _ephoto_single_browser_slideshow, ephoto);
}
- elm_table_pack(ephoto->pager, ephoto->single_browser, 0, 0, 1, 1);
- evas_object_smart_callback_add(ephoto->single_browser, "back",
- _ephoto_single_browser_back, ephoto);
- evas_object_smart_callback_add(ephoto->single_browser, "slideshow",
- _ephoto_single_browser_slideshow, ephoto);
ephoto->slideshow = ephoto_slideshow_add(ephoto, ephoto->layout);
if (!ephoto->slideshow)
{
@@ -461,114 +484,116 @@ ephoto_window_add(const char *path)
evas_object_smart_callback_add(ephoto->slideshow, "back",
_ephoto_slideshow_back, ephoto);
- ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout);
- EPHOTO_WEIGHT(ephoto->dir_browser, ephoto->config->left_size, EVAS_HINT_EXPAND);
- EPHOTO_FILL(ephoto->dir_browser);
- elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
- evas_object_show(ephoto->dir_browser);
-
- ephoto->statusbar = elm_box_add(ephoto->main);
- evas_object_size_hint_min_set(ephoto->statusbar, 20 * elm_config_scale_get(),
- 20 * elm_config_scale_get());
- elm_box_horizontal_set(ephoto->statusbar, EINA_TRUE);
- EPHOTO_WEIGHT(ephoto->statusbar, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
- EPHOTO_FILL(ephoto->statusbar);
- elm_table_pack(ephoto->main, ephoto->statusbar, 0, 2, 1, 1);
- evas_object_show(ephoto->statusbar);
-
- ic = elm_icon_add(ephoto->statusbar);
- evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
- 20 * elm_config_scale_get());
- ret = elm_icon_standard_set(ic, "folder");
- evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
- ephoto->folders_icon = ic;
-
- but = elm_button_add(ephoto->statusbar);
- elm_object_part_content_set(but, "icon", ic);
- if (!ret)
- elm_object_text_set(but, _("Show Folders"));
- evas_object_smart_callback_add(but, "clicked", _folder_icon_clicked, ephoto);
- elm_object_tooltip_text_set(but, _("Show Folders"));
- elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_RIGHT);
- elm_box_pack_end(ephoto->statusbar, but);
- evas_object_show(but);
- ephoto->folders_button = but;
-
- ephoto->controls_left = elm_box_add(ephoto->statusbar);
- elm_box_horizontal_set(ephoto->controls_left, EINA_TRUE);
- EPHOTO_WEIGHT(ephoto->controls_left, EVAS_HINT_FILL, EVAS_HINT_FILL);
- EPHOTO_FILL(ephoto->controls_left);
- elm_box_pack_end(ephoto->statusbar, ephoto->controls_left);
- evas_object_show(ephoto->controls_left);
-
- ephoto->infolabel = elm_label_add(ephoto->statusbar);
- elm_object_style_set(ephoto->infolabel, "info");
- elm_label_line_wrap_set(ephoto->infolabel, ELM_WRAP_MIXED);
- elm_label_ellipsis_set(ephoto->infolabel, EINA_TRUE);
- elm_object_text_set(ephoto->infolabel, _("Information"));
- EPHOTO_EXPAND(ephoto->infolabel);
- EPHOTO_FILL(ephoto->infolabel);
-
- elm_box_pack_end(ephoto->statusbar, ephoto->infolabel);
- evas_object_show(ephoto->infolabel);
-
- ephoto->controls_right = elm_box_add(ephoto->statusbar);
- elm_box_horizontal_set(ephoto->controls_right, EINA_TRUE);
- EPHOTO_WEIGHT(ephoto->controls_right, EVAS_HINT_FILL, EVAS_HINT_FILL);
- EPHOTO_FILL(ephoto->controls_right);
- elm_box_pack_end(ephoto->statusbar, ephoto->controls_right);
- evas_object_show(ephoto->controls_right);
-
- ic = elm_icon_add(ephoto->statusbar);
- evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
- 20 * elm_config_scale_get());
- ret = elm_icon_standard_set(ic, "media-playback-start");
- evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
-
- but = elm_button_add(ephoto->statusbar);
- elm_object_part_content_set(but, "icon", ic);
- if (!ret)
- elm_object_text_set(but, _("Slideshow"));
- evas_object_smart_callback_add(but, "clicked",
- _slideshow_icon_clicked, ephoto);
- elm_object_tooltip_text_set(but, _("Slideshow"));
- elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
- elm_box_pack_end(ephoto->statusbar, but);
- evas_object_show(but);
-
- ic = elm_icon_add(ephoto->statusbar);
- evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
- 20 * elm_config_scale_get());
- ret = elm_icon_standard_set(ic, "preferences-other");
- evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
-
- but = elm_button_add(ephoto->statusbar);
- elm_object_part_content_set(but, "icon", ic);
- if (!ret)
- elm_object_text_set(but, _("Settings"));
- evas_object_smart_callback_add(but, "clicked",
- _settings_icon_clicked, ephoto);
- elm_object_tooltip_text_set(but, _("Settings"));
- elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
- elm_box_pack_end(ephoto->statusbar, but);
- evas_object_show(but);
-
- ic = elm_icon_add(ephoto->statusbar);
- evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
- 20 * elm_config_scale_get());
- ret = elm_icon_standard_set(ic, "application-exit");
- evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
-
- ephoto->exit = elm_button_add(ephoto->statusbar);
- elm_object_part_content_set(ephoto->exit, "icon", ic);
- if (!ret)
- elm_object_text_set(ephoto->exit, _("Exit"));
- evas_object_smart_callback_add(ephoto->exit, "clicked",
- _exit_icon_clicked, ephoto);
- elm_object_tooltip_text_set(ephoto->exit, _("Exit"));
- elm_object_tooltip_orient_set(ephoto->exit, ELM_TOOLTIP_ORIENT_TOP);
- evas_object_hide(ephoto->exit);
+ if (!ephoto->gadget)
+ {
+ ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout);
+ EPHOTO_WEIGHT(ephoto->dir_browser, ephoto->config->left_size, EVAS_HINT_EXPAND);
+ EPHOTO_FILL(ephoto->dir_browser);
+ elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
+ evas_object_show(ephoto->dir_browser);
+ ephoto->statusbar = elm_box_add(ephoto->main);
+ evas_object_size_hint_min_set(ephoto->statusbar, 20 * elm_config_scale_get(),
+ 20 * elm_config_scale_get());
+ elm_box_horizontal_set(ephoto->statusbar, EINA_TRUE);
+ EPHOTO_WEIGHT(ephoto->statusbar, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ EPHOTO_FILL(ephoto->statusbar);
+ elm_table_pack(ephoto->main, ephoto->statusbar, 0, 2, 1, 1);
+ evas_object_show(ephoto->statusbar);
+
+ ic = elm_icon_add(ephoto->statusbar);
+ evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
+ 20 * elm_config_scale_get());
+ ret = elm_icon_standard_set(ic, "folder");
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+ ephoto->folders_icon = ic;
+
+ but = elm_button_add(ephoto->statusbar);
+ elm_object_part_content_set(but, "icon", ic);
+ if (!ret)
+ elm_object_text_set(but, _("Show Folders"));
+ evas_object_smart_callback_add(but, "clicked", _folder_icon_clicked, ephoto);
+ elm_object_tooltip_text_set(but, _("Show Folders"));
+ elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_RIGHT);
+ elm_box_pack_end(ephoto->statusbar, but);
+ evas_object_show(but);
+ ephoto->folders_button = but;
+
+ ephoto->controls_left = elm_box_add(ephoto->statusbar);
+ elm_box_horizontal_set(ephoto->controls_left, EINA_TRUE);
+ EPHOTO_WEIGHT(ephoto->controls_left, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ EPHOTO_FILL(ephoto->controls_left);
+ elm_box_pack_end(ephoto->statusbar, ephoto->controls_left);
+ evas_object_show(ephoto->controls_left);
+
+ ephoto->infolabel = elm_label_add(ephoto->statusbar);
+ elm_object_style_set(ephoto->infolabel, "info");
+ elm_label_line_wrap_set(ephoto->infolabel, ELM_WRAP_MIXED);
+ elm_label_ellipsis_set(ephoto->infolabel, EINA_TRUE);
+ elm_object_text_set(ephoto->infolabel, _("Information"));
+ EPHOTO_EXPAND(ephoto->infolabel);
+ EPHOTO_FILL(ephoto->infolabel);
+
+ elm_box_pack_end(ephoto->statusbar, ephoto->infolabel);
+ evas_object_show(ephoto->infolabel);
+
+ ephoto->controls_right = elm_box_add(ephoto->statusbar);
+ elm_box_horizontal_set(ephoto->controls_right, EINA_TRUE);
+ EPHOTO_WEIGHT(ephoto->controls_right, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ EPHOTO_FILL(ephoto->controls_right);
+ elm_box_pack_end(ephoto->statusbar, ephoto->controls_right);
+ evas_object_show(ephoto->controls_right);
+
+ ic = elm_icon_add(ephoto->statusbar);
+ evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
+ 20 * elm_config_scale_get());
+ ret = elm_icon_standard_set(ic, "media-playback-start");
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+
+ but = elm_button_add(ephoto->statusbar);
+ elm_object_part_content_set(but, "icon", ic);
+ if (!ret)
+ elm_object_text_set(but, _("Slideshow"));
+ evas_object_smart_callback_add(but, "clicked",
+ _slideshow_icon_clicked, ephoto);
+ elm_object_tooltip_text_set(but, _("Slideshow"));
+ elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
+ elm_box_pack_end(ephoto->statusbar, but);
+ evas_object_show(but);
+
+ ic = elm_icon_add(ephoto->statusbar);
+ evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
+ 20 * elm_config_scale_get());
+ ret = elm_icon_standard_set(ic, "preferences-other");
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+
+ but = elm_button_add(ephoto->statusbar);
+ elm_object_part_content_set(but, "icon", ic);
+ if (!ret)
+ elm_object_text_set(but, _("Settings"));
+ evas_object_smart_callback_add(but, "clicked",
+ _settings_icon_clicked, ephoto);
+ elm_object_tooltip_text_set(but, _("Settings"));
+ elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
+ elm_box_pack_end(ephoto->statusbar, but);
+ evas_object_show(but);
+
+ ic = elm_icon_add(ephoto->statusbar);
+ evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
+ 20 * elm_config_scale_get());
+ ret = elm_icon_standard_set(ic, "application-exit");
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+
+ ephoto->exit = elm_button_add(ephoto->statusbar);
+ elm_object_part_content_set(ephoto->exit, "icon", ic);
+ if (!ret)
+ elm_object_text_set(ephoto->exit, _("Exit"));
+ evas_object_smart_callback_add(ephoto->exit, "clicked",
+ _exit_icon_clicked, ephoto);
+ elm_object_tooltip_text_set(ephoto->exit, _("Exit"));
+ elm_object_tooltip_orient_set(ephoto->exit, ELM_TOOLTIP_ORIENT_TOP);
+ evas_object_hide(ephoto->exit);
+ }
if ((!path) || (!ecore_file_exists(path)))
{
if (ephoto->config->open)
@@ -594,7 +619,10 @@ ephoto_window_add(const char *path)
char *rp = ecore_file_realpath(path);
eina_stringshare_replace(&ephoto->config->directory, rp);
free(rp);
- _ephoto_thumb_browser_show(ephoto, NULL);
+ if (!ephoto->gadget)
+ _ephoto_thumb_browser_show(ephoto, NULL);
+ else
+ _ephoto_slideshow_show(ephoto, NULL);
}
else
{
@@ -604,12 +632,17 @@ ephoto_window_add(const char *path)
eina_stringshare_replace(&ephoto->config->directory, rp);
free(rp);
free(dir);
- ephoto_single_browser_path_pending_set(ephoto->single_browser, path);
- evas_object_hide(ephoto->thumb_browser);
- evas_object_hide(ephoto->slideshow);
- evas_object_show(ephoto->single_browser);
- ephoto_single_browser_show_controls(ephoto);
- ephoto->state = EPHOTO_STATE_SINGLE;
+ if (!ephoto->gadget)
+ {
+ ephoto_single_browser_path_pending_set(ephoto->single_browser, path);
+ evas_object_hide(ephoto->thumb_browser);
+ evas_object_hide(ephoto->slideshow);
+ evas_object_show(ephoto->single_browser);
+ ephoto_single_browser_show_controls(ephoto);
+ ephoto->state = EPHOTO_STATE_SINGLE;
+ }
+ else
+ _ephoto_slideshow_show(ephoto, NULL);
}
snprintf(config, PATH_MAX, "%s/.config/ephoto", eina_environment_home_get());
@@ -617,36 +650,41 @@ ephoto_window_add(const char *path)
snprintf(trash, PATH_MAX, "%s/trash", ephoto->config_path);
ephoto->trash_path = eina_stringshare_add(trash);
- ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
- ephoto_directory_browser_initialize_structure(ephoto, (char *)ephoto->config->open);
- evas_object_resize(ephoto->win, ephoto->config->window_width,
- ephoto->config->window_height);
- evas_object_show(ephoto->win);
-
- if (!ephoto->config->folders)
+ if (!ephoto->gadget)
{
- evas_object_hide(ephoto->dir_browser);
- elm_box_unpack(ephoto->layout, ephoto->dir_browser);
- ephoto->folders_toggle = EINA_FALSE;
- ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
- if (!ret)
- elm_object_text_set(ephoto->folders_button, _("Show Folders"));
- elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
- }
- else
- {
- ephoto->folders_toggle = EINA_TRUE;
- ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
- if (!ret)
- elm_object_text_set(ephoto->folders_button, _("Hide Folders"));
- elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
+ ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
+ ephoto_directory_browser_initialize_structure(ephoto, (char *)ephoto->config->open);
+ evas_object_resize(ephoto->win, ephoto->config->window_width,
+ ephoto->config->window_height);
}
- if (ephoto->config->firstrun)
+ evas_object_show(ephoto->win);
+
+ if (!ephoto->gadget)
{
- _settings_icon_clicked(ephoto, NULL, NULL);
- ephoto->config->firstrun = 0;
+ if (!ephoto->config->folders)
+ {
+ evas_object_hide(ephoto->dir_browser);
+ elm_box_unpack(ephoto->layout, ephoto->dir_browser);
+ ephoto->folders_toggle = EINA_FALSE;
+ ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
+ if (!ret)
+ elm_object_text_set(ephoto->folders_button, _("Show Folders"));
+ elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
+ }
+ else
+ {
+ ephoto->folders_toggle = EINA_TRUE;
+ ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
+ if (!ret)
+ elm_object_text_set(ephoto->folders_button, _("Hide Folders"));
+ elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
+ }
+ if (ephoto->config->firstrun)
+ {
+ _settings_icon_clicked(ephoto, NULL, NULL);
+ ephoto->config->firstrun = 0;
+ }
}
-
return ephoto->win;
}
@@ -799,9 +837,18 @@ _ephoto_populate_end(void *data, Eio_File *handler EINA_UNUSED)
ed->ephoto->ls = NULL;
- if (eina_list_count(ed->ephoto->entries))
- ephoto_single_browser_entries_set(ed->ephoto->single_browser,
+ if (!ed->ephoto->gadget)
+ {
+ if (eina_list_count(ed->ephoto->entries))
+ ephoto_single_browser_entries_set(ed->ephoto->single_browser,
+ ed->ephoto->entries);
+ }
+ else
+ {
+ if (eina_list_count(ed->ephoto->entries))
+ ephoto_slideshow_entries_set(ed->ephoto->slideshow,
ed->ephoto->entries);
+ }
ecore_event_add(EPHOTO_EVENT_POPULATE_END, NULL, NULL, NULL);
free(ed);
}
@@ -963,6 +1010,13 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
if (ed->ephoto->job.change_dir)
ecore_job_del(ed->ephoto->job.change_dir);
ed->ephoto->job.change_dir = ecore_job_add(_ephoto_change_dir, ed);
+
+ if (ephoto->gadget)
+ {
+ free(rp);
+ return;
+ }
+
if (ephoto->monitor)
{
eio_monitor_del(ephoto->monitor);
diff --git a/src/bin/ephoto_slideshow.c b/src/bin/ephoto_slideshow.c
index 79c7d14..7bfe66f 100644
--- a/src/bin/ephoto_slideshow.c
+++ b/src/bin/ephoto_slideshow.c
@@ -473,11 +473,14 @@ _slideshow_transition(void *data)
snprintf(buf, PATH_MAX, "ephoto,%s", ss->ephoto->config->slideshow_transition);
elm_layout_signal_emit(ss->slideshow, buf, "ephoto");
- if (ss->ephoto->config->movess)
+ if (!ss->ephoto->gadget)
{
- elm_layout_signal_emit(ss->current_item, _slideshow_move_start_get(ss), "ephoto");
- elm_layout_signal_emit(ss->current_item, _slideshow_move_end_get(ss), "ephoto");
- _slideshow_move_randomize(ss);
+ if (ss->ephoto->config->movess)
+ {
+ elm_layout_signal_emit(ss->current_item, _slideshow_move_start_get(ss), "ephoto");
+ elm_layout_signal_emit(ss->current_item, _slideshow_move_end_get(ss), "ephoto");
+ _slideshow_move_randomize(ss);
+ }
}
if (ss->timer)
ecore_timer_del(ss->timer);
@@ -502,19 +505,25 @@ _slideshow_play(Ephoto_Slideshow *ss)
evas_object_raise(ss->current_item);
evas_object_show(ss->current_item);
}
- _slideshow_move_randomize(ss);
-
+ if (!ss->ephoto->gadget)
+ {
+ if (ss->ephoto->config->movess)
+ _slideshow_move_randomize(ss);
+ }
msg = alloca(sizeof(Edje_Message_Float_Set) + (1 * sizeof(float)));
msg->count = 1;
msg->val[0] = (float)ss->timeout;
edje_object_message_send(elm_layout_edje_get(ss->current_item),
EDJE_MESSAGE_FLOAT_SET, 1, msg);
- if (ss->ephoto->config->movess)
+ if (!ss->ephoto->gadget)
{
- elm_layout_signal_emit(ss->current_item, _slideshow_move_start_get(ss), "ephoto");
- elm_layout_signal_emit(ss->current_item, _slideshow_move_end_get(ss), "ephoto");
- _slideshow_move_randomize(ss);
+ if (ss->ephoto->config->movess)
+ {
+ elm_layout_signal_emit(ss->current_item, _slideshow_move_start_get(ss), "ephoto");
+ elm_layout_signal_emit(ss->current_item, _slideshow_move_end_get(ss), "ephoto");
+ _slideshow_move_randomize(ss);
+ }
}
if (ss->timer)
@@ -560,7 +569,8 @@ _mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_object_del(ss->notify);
ss->notify_box = NULL;
ss->notify = NULL;
- evas_object_smart_callback_call(ss->slideshow, "back", entry);
+ if (!ss->ephoto->gadget)
+ evas_object_smart_callback_call(ss->slideshow, "back", entry);
if (ss->old_item)
{
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow.item2");
@@ -778,6 +788,90 @@ _settings(void *data, Evas_Object *obj EINA_UNUSED,
}
static void
+_gadget_settings_save(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *popup = data, *fentry, *spinner;
+ Ephoto_Slideshow *ss = evas_object_data_get(popup, "slideshow");
+ const char *path;
+
+ fentry = evas_object_data_get(popup, "fentry");
+ spinner = evas_object_data_get(popup, "timeout");
+
+ ss->ephoto->config->slideshow_timeout = elm_spinner_value_get(spinner);
+ path = elm_object_text_get(fentry);
+ if (ecore_file_is_dir(path))
+ ephoto_directory_set(ss->ephoto, path, NULL, EINA_FALSE, EINA_TRUE);
+
+ evas_object_del(popup);
+}
+
+static void
+_gadget_settings(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Ephoto_Slideshow *ss = data;
+ Evas_Object *popup, *but, *table, *fentry, *label, *spinner;
+ char buf[PATH_MAX];
+
+ popup = elm_win_add(ss->ephoto->win, "win", ELM_WIN_BASIC);
+ elm_win_alpha_set(popup, 1);
+ evas_object_data_set(popup, "slideshow", ss);
+
+ table = elm_table_add(popup);
+ EPHOTO_EXPAND(table);
+ EPHOTO_FILL(table);
+ elm_win_resize_object_add(popup, table);
+ evas_object_show(table);
+
+ label = elm_label_add(table);
+ elm_object_text_set(label, _("Directory:"));
+ EPHOTO_FILL(label);
+ elm_table_pack(table, label, 0, 0, 1, 1);
+ evas_object_show(label);
+
+ fentry = elm_entry_add(table);
+ elm_entry_single_line_set(fentry, EINA_TRUE);
+ elm_entry_editable_set(fentry, EINA_TRUE);
+ elm_entry_scrollable_set(fentry, EINA_TRUE);
+ elm_object_text_set(fentry, ss->ephoto->config->directory);
+ evas_object_size_hint_weight_set(fentry, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fentry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_min_set(fentry, 300, 75);
+ elm_table_pack(table, fentry, 1, 0, 1, 1);
+ evas_object_show(fentry);
+ evas_object_data_set(popup, "fentry", fentry);
+
+ label = elm_label_add(table);
+ memset(buf, 0, PATH_MAX);
+ snprintf(buf, PATH_MAX, "%s:", _("Show Each Slide For"));
+ elm_object_text_set(label, buf);
+ EPHOTO_FILL(label);
+ elm_table_pack(table, label, 0, 1, 1, 1);
+ evas_object_show(label);
+
+ spinner = elm_spinner_add(table);
+ elm_spinner_editable_set(spinner, EINA_TRUE);
+ memset(buf, 0, PATH_MAX);
+ snprintf(buf, PATH_MAX, "%%1.0f %s", _("seconds"));
+ elm_spinner_label_format_set(spinner, buf);
+ elm_spinner_step_set(spinner, 1);
+ elm_spinner_value_set(spinner, ss->ephoto->config->slideshow_timeout);
+ elm_spinner_min_max_set(spinner, 1, 60);
+ elm_table_pack(table, spinner, 1, 1, 1, 1);
+ evas_object_show(spinner);
+ evas_object_data_set(popup, "timeout", spinner);
+
+ but = elm_button_add(table);
+ elm_object_text_set(but, _("Okay"));
+ elm_table_pack(table, but, 0, 2, 2, 1);
+ evas_object_smart_callback_add(but, "clicked", _gadget_settings_save, popup);
+ evas_object_show(but);
+
+ evas_object_show(popup);
+}
+
+static void
_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info)
{
@@ -790,7 +884,8 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
if (!strcmp(k, "Escape") || !strcmp(k, "F5"))
{
- _back(ss, NULL, NULL);
+ if (!ss->ephoto->gadget)
+ _back(ss, NULL, NULL);
}
else if (!strcmp(k, "F1"))
{
@@ -905,6 +1000,15 @@ ephoto_slideshow_show_controls(Ephoto *ephoto)
elm_object_content_set(ss->notify, ss->notify_box);
evas_object_show(ss->notify_box);
+ if (ephoto->gadget)
+ {
+ but = _add_icon(ss->notify_box, "preferences-other", _("Settings"), NULL);
+ evas_object_smart_callback_add(but, "clicked", _gadget_settings, ss);
+ elm_notify_align_set(ss->notify, 0.5, 0.5);
+ elm_notify_timeout_set(ss->notify, 3.0);
+ evas_object_show(ss->notify);
+ return;
+ }
but = _add_icon(ss->notify_box, "edit-undo", _("Back"), NULL);
evas_object_smart_callback_add(but, "clicked", _back, ss);
but = _add_icon(ss->notify_box, "go-first", _("First"), NULL);
@@ -963,8 +1067,9 @@ ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent)
"ephoto,slideshow,base");
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_DEL, _slideshow_del,
ss);
- evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_DOWN,
- _mouse_down, ss);
+ if (!ephoto->gadget)
+ evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_DOWN,
+ _mouse_down, ss);
evas_object_data_set(slideshow, "slideshow", ss);
EPHOTO_EXPAND(slideshow);
EPHOTO_FILL(slideshow);
@@ -990,6 +1095,8 @@ ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries)
if (entries)
ss->entries = entries;
+ if (ss->ephoto->gadget)
+ ephoto_slideshow_entry_set(ss->slideshow, eina_list_nth(ss->entries, 0));
}
void
@@ -1011,6 +1118,7 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
ss->timeout = ss->ephoto->config->slideshow_timeout;
_slideshow_play(ss);
+ ss->playing = 1;
if (ss->pause)
{
@@ -1050,14 +1158,17 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
evas_object_del(ss->event);
ss->event = NULL;
}
- ss->event = evas_object_rectangle_add(ss->ephoto->win);
- evas_object_smart_member_add(ss->event, ss->ephoto->win);
- evas_object_color_set(ss->event, 0, 0, 0, 0);
- evas_object_repeat_events_set(ss->event, EINA_TRUE);
- evas_object_show(ss->event);
- evas_object_event_callback_add(ss->event, EVAS_CALLBACK_KEY_DOWN, _key_down,
+ if (!ss->ephoto->gadget)
+ {
+ ss->event = evas_object_rectangle_add(ss->ephoto->win);
+ evas_object_smart_member_add(ss->event, ss->ephoto->win);
+ evas_object_color_set(ss->event, 0, 0, 0, 0);
+ evas_object_repeat_events_set(ss->event, EINA_TRUE);
+ evas_object_show(ss->event);
+ evas_object_event_callback_add(ss->event, EVAS_CALLBACK_KEY_DOWN, _key_down,
ss);
- evas_object_raise(ss->event);
- elm_object_focus_set(ss->event, EINA_TRUE);
+ evas_object_raise(ss->event);
+ elm_object_focus_set(ss->event, EINA_TRUE);
+ }
}
diff --git a/src/bin/meson.build b/src/bin/meson.build
index 73b194f..e2fdebb 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -3,7 +3,8 @@ deps = [
elm,
edje,
eipc,
- exif
+ exif,
+ depe
]
executable('ephoto', [
'ephoto.c',