From 1bb0c660a05c62354f5db1a74ef8c4f65e155921 Mon Sep 17 00:00:00 2001 From: Stephen okra Houston Date: Mon, 25 Jul 2016 11:05:08 -0500 Subject: [PATCH] Ephoto: Fix Ephoto's genlist selection --- src/bin/ephoto_config.c | 25 ++++++----- src/bin/ephoto_directory_browser.c | 72 +++++++++++++++++++----------- 2 files changed, 58 insertions(+), 39 deletions(-) diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c index e939d31..c5802f5 100644 --- a/src/bin/ephoto_config.c +++ b/src/bin/ephoto_config.c @@ -196,12 +196,21 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent) elm_object_content_set(frame, table); evas_object_show(table); + check = elm_check_add(table); + elm_object_text_set(check, _("Moving Slideshow")); + evas_object_size_hint_align_set(check, 0.0, EVAS_HINT_FILL); + evas_object_size_hint_align_set(check, 0.5, 0.5); + elm_check_state_set(check, ephoto->config->movess); + elm_table_pack(table, check, 0, 0, 2, 1); + evas_object_show(check); + ephoto->config->slide_move = check; + 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); evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL); - elm_table_pack(table, label, 0, 0, 1, 1); + elm_table_pack(table, label, 0, 1, 1, 1); evas_object_show(label); spinner = elm_spinner_add(table); @@ -213,7 +222,7 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent) elm_spinner_step_set(spinner, 1); elm_spinner_value_set(spinner, ephoto->config->slideshow_timeout); elm_spinner_min_max_set(spinner, 1, 60); - elm_table_pack(table, spinner, 1, 0, 1, 1); + elm_table_pack(table, spinner, 1, 1, 1, 1); evas_object_show(spinner); ephoto->config->slide_time = spinner; @@ -222,7 +231,7 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent) snprintf(buf, PATH_MAX, "%s:", _("Slide Transition")); elm_object_text_set(label, buf); evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL); - elm_table_pack(table, label, 0, 1, 1, 1); + elm_table_pack(table, label, 0, 2, 1, 1); evas_object_show(label); transitions = _ephoto_transitions_list_get(edje_object_data_get(elm_layout_edje_get @@ -238,17 +247,9 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent) evas_object_size_hint_weight_set(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(hoversel, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_table_pack(table, hoversel, 1, 1, 1, 1); + elm_table_pack(table, hoversel, 1, 2, 1, 1); evas_object_show(hoversel); ephoto->config->slide_trans = hoversel; - - check = elm_check_add(table); - elm_object_text_set(check, _("Moving Slideshow")); - evas_object_size_hint_align_set(check, 0.0, EVAS_HINT_FILL); - elm_check_state_set(check, ephoto->config->movess); - elm_table_pack(table, check, 0, 2, 2, 1); - evas_object_show(check); - ephoto->config->slide_move = check; } static Evas_Object * diff --git a/src/bin/ephoto_directory_browser.c b/src/bin/ephoto_directory_browser.c index 8581050..ac637f3 100644 --- a/src/bin/ephoto_directory_browser.c +++ b/src/bin/ephoto_directory_browser.c @@ -39,7 +39,8 @@ struct _Ephoto_Directory_Browser const char *back_directory; }; -static Elm_Genlist_Item_Class _ephoto_dir_class; +static Elm_Genlist_Item_Class *_ephoto_dir_class; +static Elm_Genlist_Item_Class *_ephoto_dir_tree_class; static char * _drag_data_extract(char **drag_data); @@ -446,7 +447,7 @@ _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED, evas_object_show(but); db->fsel = elm_genlist_add(db->leftbox); - elm_genlist_select_mode_set(db->fsel, ELM_OBJECT_SELECT_MODE_NONE); + elm_genlist_select_mode_set(db->fsel, ELM_OBJECT_SELECT_MODE_ALWAYS); elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE); evas_object_size_hint_weight_set(db->fsel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -673,7 +674,7 @@ _ephoto_directory_view_add(Ephoto_Directory_Browser *db) evas_object_show(db->leftbox); db->fsel = elm_genlist_add(db->leftbox); - elm_genlist_select_mode_set(db->fsel, ELM_OBJECT_SELECT_MODE_NONE); + elm_genlist_select_mode_set(db->fsel, ELM_OBJECT_SELECT_MODE_ALWAYS); elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE); evas_object_size_hint_weight_set(db->fsel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -734,7 +735,7 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED, if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_TREE && elm_genlist_item_expanded_get(entry->item) == EINA_TRUE) { - ic = &_ephoto_dir_class; + ic = _ephoto_dir_tree_class; snprintf(buf, PATH_MAX, "%s", path); e = ephoto_entry_new(entry->ephoto, path, basename(buf), EINA_FILE_DIR); @@ -750,7 +751,7 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED, { Elm_Object_Item *parent; - ic = &_ephoto_dir_class; + ic = _ephoto_dir_class; parent = elm_genlist_item_insert_before(entry->genlist, ic, entry, entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, NULL); @@ -783,7 +784,7 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED, { Elm_Object_Item *parent; - ic = &_ephoto_dir_class; + ic = _ephoto_dir_tree_class; parent = elm_genlist_item_insert_before(entry->genlist, ic, entry, entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL, NULL); @@ -848,7 +849,7 @@ _top_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED, e = ephoto_entry_new(db->ephoto, path, basename(buf), EINA_FILE_DIR); e->genlist = db->fsel; - ic = &_ephoto_dir_class; + ic = _ephoto_dir_class; e->item = elm_genlist_item_append(db->fsel, ic, e, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); @@ -921,16 +922,20 @@ _todo_items_process(void *data) if (entry->is_dir && !entry->item) { const Elm_Genlist_Item_Class *ic; - - ic = &_ephoto_dir_class; if (_check_for_subdirs(entry)) - entry->item = - elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); + { + ic = _ephoto_dir_tree_class; + entry->item = + elm_genlist_item_sorted_insert(db->fsel, ic, entry, + entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); + } else - entry->item = - elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); + { + ic = _ephoto_dir_class; + entry->item = + elm_genlist_item_sorted_insert(db->fsel, ic, entry, + entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); + } if (!entry->item) { ephoto_entry_free(db->ephoto, entry); @@ -1099,15 +1104,20 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto) if (entry->is_dir && !entry->item) { const Elm_Genlist_Item_Class *ic; - ic = &_ephoto_dir_class; if (_check_for_subdirs(entry)) - entry->item = - elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); + { + ic = _ephoto_dir_tree_class; + entry->item = + elm_genlist_item_sorted_insert(db->fsel, ic, entry, + entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); + } else - entry->item = - elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); + { + ic = _ephoto_dir_class; + entry->item = + elm_genlist_item_sorted_insert(db->fsel, ic, entry, + entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); + } if (!entry->item) { ephoto_entry_free(db->ephoto, entry); @@ -1146,11 +1156,19 @@ ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent) db = calloc(1, sizeof(Ephoto_Directory_Browser)); EINA_SAFETY_ON_NULL_GOTO(db, error); - _ephoto_dir_class.item_style = "tree_effect"; - _ephoto_dir_class.func.text_get = _dir_item_text_get; - _ephoto_dir_class.func.content_get = _dir_item_icon_get; - _ephoto_dir_class.func.state_get = NULL; - _ephoto_dir_class.func.del = _dir_item_del; + _ephoto_dir_class = elm_genlist_item_class_new(); + _ephoto_dir_class->item_style = "default"; + _ephoto_dir_class->func.text_get = _dir_item_text_get; + _ephoto_dir_class->func.content_get = _dir_item_icon_get; + _ephoto_dir_class->func.state_get = NULL; + _ephoto_dir_class->func.del = _dir_item_del; + + _ephoto_dir_tree_class = elm_genlist_item_class_new(); + _ephoto_dir_tree_class->item_style = "default"; + _ephoto_dir_tree_class->func.text_get = _dir_item_text_get; + _ephoto_dir_tree_class->func.content_get = _dir_item_icon_get; + _ephoto_dir_tree_class->func.state_get = NULL; + _ephoto_dir_tree_class->func.del = _dir_item_del; db->ephoto = ephoto; db->dir_current = NULL;