Ephoto: Only show the exit button when the window is fullscreen.

master
Stephen okra Houston 6 years ago
parent bce27ed4d4
commit 1aa4e97d4d
  1. 1
      src/bin/ephoto.h
  2. 15
      src/bin/ephoto_main.c
  3. 29
      src/bin/ephoto_single_browser.c
  4. 60
      src/bin/ephoto_slideshow.c
  5. 15
      src/bin/ephoto_thumb_browser.c

@ -249,6 +249,7 @@ struct _Ephoto
Evas_Object *controls_left;
Evas_Object *controls_right;
Evas_Object *infolabel;
Evas_Object *exit;
Evas_Object *thumb_browser;
Evas_Object *single_browser;

@ -639,16 +639,15 @@ ephoto_window_add(const char *path)
ret = elm_icon_standard_set(ic, "application-exit");
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);
ephoto->exit = elm_button_add(ephoto->statusbar);
elm_object_part_content_set(ephoto->exit, "icon", ic);
if (!ret)
elm_object_text_set(but, _("Exit"));
evas_object_smart_callback_add(but, "clicked",
elm_object_text_set(ephoto->exit, _("Exit"));
evas_object_smart_callback_add(ephoto->exit, "clicked",
_exit_icon_clicked, ephoto);
elm_object_tooltip_text_set(but, _("Exit"));
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
elm_box_pack_end(ephoto->statusbar, but);
evas_object_show(but);
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)))
{

@ -245,8 +245,18 @@ _image_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
if ((ev->button == 1) && (ev->flags == EVAS_BUTTON_DOUBLE_CLICK))
{
elm_win_fullscreen_set(sb->ephoto->win,
!elm_win_fullscreen_get(sb->ephoto->win));
if (!elm_win_fullscreen_get(sb->ephoto->win))
{
elm_win_fullscreen_set(sb->ephoto->win, EINA_TRUE);
elm_box_pack_end(sb->ephoto->statusbar, sb->ephoto->exit);
evas_object_show(sb->ephoto->exit);
}
else
{
elm_win_fullscreen_set(sb->ephoto->win, EINA_FALSE);
elm_box_unpack(sb->ephoto->statusbar, sb->ephoto->exit);
evas_object_hide(sb->ephoto->exit);
}
}
ecore_timer_del(_1s_hold);
_1s_hold = NULL;
@ -2012,9 +2022,18 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
}
else if (!strcmp(k, "F11"))
{
Evas_Object *win = sb->ephoto->win;
elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win));
if (!elm_win_fullscreen_get(sb->ephoto->win))
{
elm_win_fullscreen_set(sb->ephoto->win, EINA_TRUE);
elm_box_pack_end(sb->ephoto->statusbar, sb->ephoto->exit);
evas_object_show(sb->ephoto->exit);
}
else
{
elm_win_fullscreen_set(sb->ephoto->win, EINA_FALSE);
elm_box_unpack(sb->ephoto->statusbar, sb->ephoto->exit);
evas_object_hide(sb->ephoto->exit);
}
}
}

@ -44,6 +44,7 @@ struct _Ephoto_Slideshow
Evas_Object *pause_after;
Evas_Object *fullscreen;
Evas_Object *fullscreen_after;
Evas_Object *exit;
Ephoto_Entry *entry;
Eina_Bool playing;
Eina_Bool timer_end;
@ -466,7 +467,16 @@ _mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_object_del(ss->notify);
elm_layout_content_set(ss->ephoto->layout, "ephoto.swallow.controls",
ss->ephoto->statusbar);
if (elm_win_fullscreen_get(ss->ephoto->win))
{
elm_box_pack_end(ss->ephoto->statusbar, ss->ephoto->exit);
evas_object_show(ss->ephoto->exit);
}
else
{
elm_box_unpack(ss->ephoto->statusbar, ss->ephoto->exit);
evas_object_hide(ss->ephoto->exit);
}
if (ss->current_item)
entry = evas_object_data_get(ss->current_item, "entry");
else
@ -525,7 +535,16 @@ _back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
evas_object_del(ss->notify);
elm_layout_content_set(ss->ephoto->layout, "ephoto.swallow.controls",
ss->ephoto->statusbar);
if (elm_win_fullscreen_get(ss->ephoto->win))
{
elm_box_pack_end(ss->ephoto->statusbar, ss->ephoto->exit);
evas_object_show(ss->ephoto->exit);
}
else
{
elm_box_unpack(ss->ephoto->statusbar, ss->ephoto->exit);
evas_object_hide(ss->ephoto->exit);
}
if (ss->current_item)
entry = evas_object_data_get(ss->current_item, "entry");
else
@ -658,7 +677,9 @@ _fullscreen(void *data, Evas_Object *obj EINA_UNUSED,
ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss);
elm_win_fullscreen_set(ss->ephoto->win, EINA_FALSE);
elm_win_fullscreen_set(ss->ephoto->win, EINA_FALSE);
elm_box_unpack(ss->notify, ss->exit);
evas_object_hide(ss->exit);
}
else
{
@ -667,7 +688,9 @@ _fullscreen(void *data, Evas_Object *obj EINA_UNUSED,
ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss);
elm_win_fullscreen_set(ss->ephoto->win, EINA_TRUE);
elm_win_fullscreen_set(ss->ephoto->win, EINA_TRUE);
elm_box_pack_end(ss->notify, ss->exit);
evas_object_show(ss->exit);
}
}
@ -698,9 +721,7 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
}
else if (!strcmp(k, "F11"))
{
Evas_Object *win = ss->ephoto->win;
elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win));
_fullscreen(ss, NULL, NULL);
}
else if (!strcmp(k, "space"))
{
@ -803,6 +824,11 @@ ephoto_slideshow_show_controls(Ephoto *ephoto)
ss->fullscreen_after =
_add_icon(ss->notify, "preferences-other", _("Settings"), NULL);
evas_object_smart_callback_add(ss->fullscreen_after, "clicked", _settings, ss);
ss->exit =
_add_icon(ss->notify, "application-exit", _("Exit"), NULL);
evas_object_smart_callback_add(ss->exit, "clicked", _fullscreen, ss);
elm_box_unpack(ss->notify, ss->exit);
evas_object_hide(ss->exit);
elm_layout_content_set(ephoto->layout, "ephoto.swallow.controls", ss->notify);
}
@ -888,23 +914,27 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
}
if (ss->fullscreen)
{
evas_object_del(ss->fullscreen);
if (elm_win_fullscreen_get(ss->ephoto->win))
{
evas_object_del(ss->fullscreen);
if (!elm_win_fullscreen_get(ss->ephoto->win))
{
ss->fullscreen =
_add_icon(ss->notify, "view-restore", _("Normal"),
_add_icon(ss->notify, "view-fullscreen", _("Fullscreen"),
ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss);
}
elm_box_unpack(ss->notify, ss->exit);
evas_object_hide(ss->exit);
}
else
{
{
ss->fullscreen =
_add_icon(ss->notify, "view-fullscreen", _("Fullscreen"),
_add_icon(ss->notify, "view-restore", _("Normal"),
ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss);
}
elm_box_pack_end(ss->notify, ss->exit);
evas_object_show(ss->exit);
}
}
if (ss->event)
{

@ -1826,9 +1826,18 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
}
else if (!strcasecmp(k, "F11"))
{
Evas_Object *win = tb->ephoto->win;
elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win));
if (!elm_win_fullscreen_get(tb->ephoto->win))
{
elm_win_fullscreen_set(tb->ephoto->win, EINA_TRUE);
elm_box_pack_end(tb->ephoto->statusbar, tb->ephoto->exit);
evas_object_show(tb->ephoto->exit);
}
else
{
elm_win_fullscreen_set(tb->ephoto->win, EINA_FALSE);
elm_box_unpack(tb->ephoto->statusbar, tb->ephoto->exit);
evas_object_hide(tb->ephoto->exit);
}
}
else if (!strcasecmp(k, "Escape"))
{

Loading…
Cancel
Save