aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen 'Okra' Houston <smhouston88@gmail.com>2017-05-08 16:21:41 -0500
committerStephen 'Okra' Houston <smhouston88@gmail.com>2017-05-08 16:21:41 -0500
commit9474ceaa00ccddf020dc5df0ac9f953834cf7b56 (patch)
tree5f18b61cc3929e2c824909a4b163e41451cd78ab
parentEphoto: Fix a potential crash when switching directories in single view. (diff)
downloadephoto-9474ceaa00ccddf020dc5df0ac9f953834cf7b56.tar.gz
Ephoto: Implement open/closed folder icon changing and clean up some fdo icons.
-rw-r--r--src/bin/ephoto.h1
-rw-r--r--src/bin/ephoto_directory_browser.c26
-rw-r--r--src/bin/ephoto_main.c30
-rw-r--r--src/bin/ephoto_single_browser.c94
-rw-r--r--src/bin/ephoto_slideshow.c9
-rw-r--r--src/bin/ephoto_thumb_browser.c8
6 files changed, 112 insertions, 56 deletions
diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
index 33f0a69..a3edc90 100644
--- a/src/bin/ephoto.h
+++ b/src/bin/ephoto.h
@@ -247,6 +247,7 @@ struct _Ephoto
Evas_Object *pager;
Evas_Object *statusbar;
Evas_Object *folders_button;
+ Evas_Object *folders_icon;
Evas_Object *view_button;
Evas_Object *controls_left;
Evas_Object *controls_right;
diff --git a/src/bin/ephoto_directory_browser.c b/src/bin/ephoto_directory_browser.c
index e6d9846..86c44d6 100644
--- a/src/bin/ephoto_directory_browser.c
+++ b/src/bin/ephoto_directory_browser.c
@@ -240,7 +240,7 @@ _on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED,
}
static void
-_on_list_contract_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+_on_list_contract_req(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info)
{
Ephoto_Directory_Browser *db = data;
@@ -261,9 +261,13 @@ _on_list_expanded(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Ephoto_Directory_Browser *db = data;
Elm_Object_Item *it = event_info;
+ Evas_Object *icon;
Ephoto_Entry *entry;
const char *path;
+ icon = elm_object_item_part_content_get(it, "elm.swallow.icon");
+ elm_icon_standard_set(icon, "folder-open");
+
if (db->initializing)
return;
@@ -285,9 +289,13 @@ _on_list_contracted(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Ephoto_Directory_Browser *db = data;
Elm_Object_Item *it = event_info;
+ Evas_Object *icon;
Ephoto_Entry *entry;
const char *path;
+ icon = elm_object_item_part_content_get(it, "elm.swallow.icon");
+ elm_icon_standard_set(icon, "folder");
+
if (db->initializing)
return;
@@ -357,14 +365,26 @@ _dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED,
}
static Evas_Object *
-_dir_item_icon_get(void *data EINA_UNUSED, Evas_Object *obj,
+_dir_item_icon_get(void *data, Evas_Object *obj,
const char *part)
{
+ Ephoto_Entry *entry = data;
+
if (!strcmp(part, "elm.swallow.end"))
return NULL;
Evas_Object *ic = elm_icon_add(obj);
- elm_icon_standard_set(ic, "folder");
+ if (entry->item)
+ {
+ if (elm_genlist_item_expanded_get(entry->item))
+ elm_icon_standard_set(ic, "folder-open");
+ else
+ elm_icon_standard_set(ic, "folder");
+ }
+ else
+ {
+ elm_icon_standard_set(ic, "folder");
+ }
return ic;
}
diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
index 2b597b2..703e9eb 100644
--- a/src/bin/ephoto_main.c
+++ b/src/bin/ephoto_main.c
@@ -267,13 +267,15 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Ephoto *ephoto = data;
+ int ret = 0;
if (!ephoto->folders_toggle)
{
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
ephoto->folders_toggle = EINA_TRUE;
- if (elm_object_text_get(obj))
+ ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
+ if (!ret)
elm_object_text_set(obj, _("Hide Folders"));
elm_object_tooltip_text_set(obj, _("Hide Folders"));
}
@@ -282,7 +284,8 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, 0.0);
ephoto->folders_toggle = EINA_FALSE;
- if (elm_object_text_get(obj))
+ ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
+ if (!ret)
elm_object_text_set(obj, _("Show Folders"));
elm_object_tooltip_text_set(obj, _("Show Folders"));
}
@@ -333,13 +336,18 @@ _ephoto_left_pane_resized(void *data, Evas_Object *obj EINA_UNUSED,
void
ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
{
+ int ret = 0;
+
if (!ephoto->folders_toggle || !toggle)
{
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
evas_object_show(ephoto->dir_browser);
ephoto->folders_toggle = EINA_TRUE;
- elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
+ 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"));
}
else if (ephoto->folders_toggle)
{
@@ -347,7 +355,10 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
elm_panes_content_left_size_set(ephoto->layout, 0.0);
evas_object_hide(ephoto->dir_browser);
ephoto->folders_toggle = EINA_FALSE;
- elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
+ 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"));
}
}
@@ -476,6 +487,7 @@ ephoto_window_add(const char *path)
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);
@@ -624,14 +636,20 @@ ephoto_window_add(const char *path)
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, 0.0);
ephoto->folders_toggle = EINA_FALSE;
- elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
+ 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;
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
- elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
+ 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)
{
diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c
index 282c753..8fe06f2 100644
--- a/src/bin/ephoto_single_browser.c
+++ b/src/bin/ephoto_single_browser.c
@@ -1657,6 +1657,17 @@ _edit_function_item_add(Evas_Object *parent, const char *icon, const char *label
}
char *
+_item2_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
+{
+ char *txt = data;
+
+ if (txt)
+ return strdup(txt);
+ else
+ return NULL;
+}
+
+char *
_item_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
{
Evas_Object *ic = data;
@@ -1696,6 +1707,7 @@ _edit_item_add(Evas_Object *parent, Elm_Object_Item *par, const char *icon, cons
{
Evas_Object *ic;
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ Elm_Genlist_Item_Class *itc2 = elm_genlist_item_class_new();
itc = elm_genlist_item_class_new();
itc->item_style = "default";
@@ -1704,15 +1716,30 @@ _edit_item_add(Evas_Object *parent, Elm_Object_Item *par, const char *icon, cons
itc->func.state_get = NULL;
itc->func.del = NULL;
- ic = elm_icon_add(parent);
- evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
- 20*elm_config_scale_get());
- evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
- elm_icon_standard_set(ic, icon);
- evas_object_data_set(ic, "label", label);
+ itc2 = elm_genlist_item_class_new();
+ itc2->item_style = "no_icon";
+ itc2->func.text_get = _item2_text_get;
+ itc2->func.content_get = NULL;
+ itc2->func.state_get = NULL;
+ itc2->func.del = NULL;
+
+ if (icon)
+ {
+ ic = elm_icon_add(parent);
+ evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
+ 20*elm_config_scale_get());
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_icon_standard_set(ic, icon);
+ evas_object_data_set(ic, "label", label);
- elm_genlist_item_append(parent, itc, ic, par,
- ELM_GENLIST_ITEM_NONE, callback, data);
+ elm_genlist_item_append(parent, itc, ic, par,
+ ELM_GENLIST_ITEM_NONE, callback, data);
+ }
+ else
+ {
+ elm_genlist_item_append(parent, itc2, label, par,
+ ELM_GENLIST_ITEM_NONE, callback, data);
+ }
}
static void
@@ -1786,43 +1813,43 @@ _editor_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNU
_go_flip_horiz, sb);
_edit_item_add(list, par, "object-flip-vertical", _("Flip Vertical"),
_go_flip_vert, sb);
- par = elm_genlist_item_append(list, itc, _("Color"), NULL, ELM_GENLIST_ITEM_GROUP,
+ par = elm_genlist_item_append(list, itc, _("Adjustable Filters"), NULL, ELM_GENLIST_ITEM_GROUP,
NULL, NULL);
elm_genlist_item_select_mode_set(par, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- _edit_item_add(list, par, "insert-image", _("Auto Equalize"),
- _go_auto_eq, sb);
- _edit_item_add(list, par, "insert-image", _("Brightness/Contrast/Gamma"),
+ _edit_item_add(list, par, NULL, _("Brightness/Contrast/Gamma"),
_go_bcg, sb);
- _edit_item_add(list, par, "insert-image", _("Hue/Saturation/Value"),
+ _edit_item_add(list, par, NULL, _("Hue/Saturation/Value"),
_go_hsv, sb);
- _edit_item_add(list, par, "insert-image", _("Color Levels"),
+ _edit_item_add(list, par, NULL, _("Color Levels"),
_go_color, sb);
- _edit_item_add(list, par, "insert-image", _("Red Eye Removal"),
+ _edit_item_add(list, par, NULL, _("Red Eye Removal"),
_go_reye, sb);
- par = elm_genlist_item_append(list, itc, _("Filters"), NULL, ELM_GENLIST_ITEM_GROUP,
+ par = elm_genlist_item_append(list, itc, _("Quick Filters"), NULL, ELM_GENLIST_ITEM_GROUP,
NULL, NULL);
elm_genlist_item_select_mode_set(par, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- _edit_item_add(list, par, "insert-image", _("Black and White"),
+ _edit_item_add(list, par, NULL, _("Auto Equalize"),
+ _go_auto_eq, sb);
+ _edit_item_add(list, par, NULL, _("Black and White"),
_go_black_and_white, sb);
- _edit_item_add(list, par, "insert-image", _("Blur"),
+ _edit_item_add(list, par, NULL, _("Blur"),
_go_blur, sb);
- _edit_item_add(list, par, "insert-image", _("Dither"),
+ _edit_item_add(list, par, NULL, _("Dither"),
_go_dither, sb);
- _edit_item_add(list, par, "insert-image", _("Edge Detect"),
+ _edit_item_add(list, par, NULL, _("Edge Detect"),
_go_edge, sb);
- _edit_item_add(list, par, "insert-image", _("Emboss"),
+ _edit_item_add(list, par, NULL, _("Emboss"),
_go_emboss, sb);
- _edit_item_add(list, par, "insert-image", _("Invert Colors"),
+ _edit_item_add(list, par, NULL, _("Invert Colors"),
_go_invert, sb);
- _edit_item_add(list, par, "insert-image", _("Old Photo"),
+ _edit_item_add(list, par, NULL, _("Old Photo"),
_go_old_photo, sb);
- _edit_item_add(list, par, "insert-image", _("Painting"),
+ _edit_item_add(list, par, NULL, _("Painting"),
_go_painting, sb);
- _edit_item_add(list, par, "insert-image", _("Posterize"),
+ _edit_item_add(list, par, NULL, _("Posterize"),
_go_posterize, sb);
- _edit_item_add(list, par, "insert-image", _("Sharpen"),
+ _edit_item_add(list, par, NULL, _("Sharpen"),
_go_sharpen, sb);
- _edit_item_add(list, par, "insert-image", _("Sketch"),
+ _edit_item_add(list, par, NULL, _("Sketch"),
_go_sketch, sb);
vbox = elm_box_add(box);
@@ -1864,8 +1891,8 @@ _add_edit_menu_items(Ephoto_Single_Browser *sb, Evas_Object *menu)
{
Elm_Object_Item *menu_it;
- menu_it = elm_menu_item_add(menu, NULL, "insert-image", _("File"), NULL, NULL);
- elm_menu_item_add(menu, menu_it, "insert-image", _("Edit"), _editor_menu, sb);
+ menu_it = elm_menu_item_add(menu, NULL, "document-properties", _("File"), NULL, NULL);
+ elm_menu_item_add(menu, menu_it, "edit-cut", _("Edit"), _editor_menu, sb);
elm_menu_item_add(menu, menu_it, "edit-clear", _("Reset"), _reset_image, sb);
elm_menu_item_add(menu, menu_it, "document-save", _("Save"), _save_image, sb);
elm_menu_item_add(menu, menu_it, "document-save-as", _("Save As"),
@@ -2373,11 +2400,11 @@ ephoto_single_browser_show_controls(Ephoto *ephoto)
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
20*elm_config_scale_get());
ret = elm_icon_standard_set(ic, "view-list-icons");
- if (!ret)
- ret = elm_image_file_set(ic, PACKAGE_DATA_DIR "/images/grid.png", NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
but = elm_button_add(ephoto->statusbar);
+ if (!ret)
+ elm_object_text_set(but, _("View Thumbnails"));
elm_object_part_content_set(but, "icon", ic);
elm_object_tooltip_text_set(but, _("View Thumbnails"));
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
@@ -2387,9 +2414,6 @@ ephoto_single_browser_show_controls(Ephoto *ephoto)
ephoto->view_button = but;
- elm_object_tooltip_text_set(ephoto->view_button, _("View Thumbnails"));
- evas_object_smart_callback_add(ephoto->view_button, "clicked", _ephoto_main_back, sb);
-
ic = elm_icon_add(ephoto->controls_left);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
20*elm_config_scale_get());
@@ -2489,7 +2513,7 @@ ephoto_single_browser_show_controls(Ephoto *ephoto)
ic = elm_icon_add(ephoto->controls_right);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
20*elm_config_scale_get());
- ret = elm_icon_standard_set(ic, "insert-image");
+ ret = elm_icon_standard_set(ic, "edit-cut");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
but = elm_button_add(ephoto->controls_right);
diff --git a/src/bin/ephoto_slideshow.c b/src/bin/ephoto_slideshow.c
index a4b6e58..aaa632a 100644
--- a/src/bin/ephoto_slideshow.c
+++ b/src/bin/ephoto_slideshow.c
@@ -759,10 +759,6 @@ _add_icon(Evas_Object *parent, const char *icon, const char *label, Evas_Object
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
20*elm_config_scale_get());
ret = elm_icon_standard_set(ic, icon);
- if (!ret && !strcmp(icon, "view-list-details"))
- ret = elm_image_file_set(ic, PACKAGE_DATA_DIR "/images/single.png", NULL);
- else if (!ret && !strcmp(icon, "view-list-icons"))
- ret = elm_image_file_set(ic, PACKAGE_DATA_DIR "/images/grid.png", NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
but = elm_button_add(parent);
@@ -836,10 +832,7 @@ ephoto_slideshow_show_controls(Ephoto *ephoto)
elm_object_content_set(ss->notify, ss->notify_box);
evas_object_show(ss->notify_box);
- if (ephoto->prev_state == EPHOTO_STATE_SINGLE)
- but = _add_icon(ss->notify_box, "view-list-details", _("Back"), NULL);
- else
- but = _add_icon(ss->notify_box, "view-list-icons", _("Back"), NULL);
+ 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);
evas_object_smart_callback_add(but, "clicked", _first, ss);
diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c
index 6518a8a..26f3131 100644
--- a/src/bin/ephoto_thumb_browser.c
+++ b/src/bin/ephoto_thumb_browser.c
@@ -2029,14 +2029,14 @@ ephoto_thumb_browser_show_controls(Ephoto *ephoto)
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, "view-list-details");
- if (!ret)
- ret = elm_image_file_set(ic, PACKAGE_DATA_DIR "/images/single.png", NULL);
+ ret = elm_icon_standard_set(ic, "document-open");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
but = elm_button_add(ephoto->statusbar);
+ if (!ret)
+ elm_object_text_set(but, _("View Image"));
elm_object_part_content_set(but, "icon", ic);
- elm_object_tooltip_text_set(but, _("View Images"));
+ elm_object_tooltip_text_set(but, _("View Image"));
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
evas_object_smart_callback_add(but, "clicked", _view_single, tb);
elm_box_pack_after(ephoto->statusbar, but, ephoto->folders_button);