Ephoto: Fix Ephoto's genlist selection

This commit is contained in:
Stephen okra Houston 2016-07-25 11:05:08 -05:00
parent ca0243286d
commit 1bb0c660a0
2 changed files with 58 additions and 39 deletions

View File

@ -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 *

View File

@ -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;