settings: add option to show hidden files.
Add option to show hidden files to settings. Display files in file panel.
This commit is contained in:
parent
708a134120
commit
0146efc4bf
|
@ -242,6 +242,7 @@ _edi_config_init(void)
|
|||
EDI_CONFIG_VAL(D, T, version, EET_T_INT);
|
||||
EDI_CONFIG_VAL(D, T, autosave, EET_T_UCHAR);
|
||||
EDI_CONFIG_VAL(D, T, trim_whitespace, EET_T_UCHAR);
|
||||
EDI_CONFIG_VAL(D, T, show_hidden, EET_T_UCHAR);
|
||||
|
||||
EDI_CONFIG_LIST(D, T, projects, _edi_cfg_proj_edd);
|
||||
EDI_CONFIG_LIST(D, T, mime_assocs, _edi_cfg_mime_edd);
|
||||
|
@ -361,6 +362,7 @@ _edi_config_load(void)
|
|||
|
||||
_edi_config->autosave = EINA_TRUE;
|
||||
_edi_config->trim_whitespace = EINA_TRUE;
|
||||
_edi_config->show_hidden = EINA_FALSE;
|
||||
_edi_config->projects = NULL;
|
||||
_edi_config->mime_assocs = NULL;
|
||||
IFCFGEND;
|
||||
|
|
|
@ -41,6 +41,7 @@ struct _Edi_Config
|
|||
|
||||
Eina_Bool autosave;
|
||||
Eina_Bool trim_whitespace;
|
||||
Eina_Bool show_hidden;
|
||||
|
||||
Eina_List *projects;
|
||||
Eina_List *mime_assocs;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "edi_filepanel.h"
|
||||
#include "edi_file.h"
|
||||
#include "edi_config.h"
|
||||
#include "edi_content_provider.h"
|
||||
#include "mainview/edi_mainview.h"
|
||||
#include "screens/edi_file_screens.h"
|
||||
|
@ -47,6 +48,9 @@ _file_path_hidden(const char *path, Eina_Bool filter)
|
|||
{
|
||||
const char *relative;
|
||||
|
||||
if (_edi_config->show_hidden)
|
||||
return EINA_FALSE;
|
||||
|
||||
if (edi_file_path_hidden(path))
|
||||
return EINA_TRUE;
|
||||
|
||||
|
@ -783,6 +787,9 @@ static Eina_Bool
|
|||
_ls_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED,
|
||||
const Eina_File_Direct_Info *info)
|
||||
{
|
||||
if (_edi_config->show_hidden)
|
||||
return EINA_TRUE;
|
||||
|
||||
return info->path[info->name_start] != '.';
|
||||
}
|
||||
|
||||
|
@ -1098,6 +1105,23 @@ _edi_filepanel_select_next_best_path(const char *path)
|
|||
free(try);
|
||||
}
|
||||
|
||||
void
|
||||
edi_filepanel_refresh_all(void)
|
||||
{
|
||||
elm_genlist_clear(_list);
|
||||
eina_hash_free_buckets(_list_items);
|
||||
eina_hash_free_buckets(_list_statuses);
|
||||
_file_listing_empty(_root_dir, NULL);
|
||||
|
||||
free(_root_dir);
|
||||
|
||||
_root_dir = calloc(1, sizeof(Edi_Dir_Data));
|
||||
_root_dir->path = edi_project_get();
|
||||
|
||||
_file_listing_fill(_root_dir, NULL);
|
||||
elm_genlist_realized_items_update(_list);
|
||||
}
|
||||
|
||||
void
|
||||
edi_filepanel_select_path(const char *path)
|
||||
{
|
||||
|
|
|
@ -95,6 +95,12 @@ void edi_filepanel_item_update(const char *path);
|
|||
*/
|
||||
void edi_filepanel_item_update_all(void);
|
||||
|
||||
/**
|
||||
* Clear all filepanel items and do a full refresh.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
void edi_filepanel_refresh_all(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "edi_screens.h"
|
||||
#include "edi_config.h"
|
||||
#include "edi_debug.h"
|
||||
#include "edi_filepanel.h"
|
||||
#include "edi_theme.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
|
@ -769,6 +770,19 @@ _edi_settings_project_create(Evas_Object *parent)
|
|||
return frames;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_settings_behaviour_show_hidden_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
||||
void *event EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *check;
|
||||
|
||||
check = (Evas_Object *) obj;
|
||||
_edi_config->show_hidden = elm_check_state_get(check);
|
||||
_edi_config_save();
|
||||
edi_filepanel_refresh_all();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_edi_settings_behaviour_autosave_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
||||
void *event EINA_UNUSED)
|
||||
|
@ -819,6 +833,15 @@ _edi_settings_behaviour_create(Evas_Object *parent)
|
|||
_edi_settings_behaviour_trim_whitespace_cb, NULL);
|
||||
evas_object_show(check);
|
||||
|
||||
check = elm_check_add(box);
|
||||
elm_object_text_set(check, _("Show hidden files"));
|
||||
elm_check_state_set(check, _edi_config->show_hidden);
|
||||
elm_box_pack_end(box, check);
|
||||
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.5);
|
||||
evas_object_smart_callback_add(check, "changed",
|
||||
_edi_settings_behaviour_show_hidden_cb, NULL);
|
||||
evas_object_show(check);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue