2007-08-12 02:54:33 -07:00
# include "e_mod_main.h"
/* actual module specifics */
2011-01-05 14:36:21 -08:00
static void _e_mod_action_fileman_cb ( E_Object * obj ,
const char * params ) ;
2012-12-28 02:02:21 -08:00
static void _e_mod_action_fileman_reset_cb ( E_Object * obj EINA_UNUSED , const char * params EINA_UNUSED ) ;
2012-09-14 03:17:31 -07:00
static void _e_mod_menu_add ( void * data , E_Menu * m ) ;
2011-01-05 14:36:21 -08:00
static void _e_mod_fileman_config_load ( void ) ;
static void _e_mod_fileman_config_free ( void ) ;
static Eina_Bool _e_mod_zone_add ( void * data ,
int type ,
void * event ) ;
2007-08-12 02:54:33 -07:00
static E_Module * conf_module = NULL ;
static E_Action * act = NULL ;
2012-12-28 02:02:21 -08:00
static E_Action * act2 = NULL ;
2007-08-12 02:54:33 -07:00
static E_Int_Menu_Augmentation * maug = NULL ;
2007-12-13 21:57:16 -08:00
static Ecore_Event_Handler * zone_add_handler = NULL ;
2013-01-03 06:47:40 -08:00
static Eina_Inlist * cfg_opts = NULL ;
2007-08-12 02:54:33 -07:00
2012-09-13 00:18:13 -07:00
static E_Config_DD * paths_edd = NULL , * conf_edd = NULL ;
2007-08-12 02:54:33 -07:00
Config * fileman_config = NULL ;
/* module setup */
EAPI E_Module_Api e_modapi =
{
E_MODULE_API_VERSION ,
2011-01-05 14:36:21 -08:00
" Fileman "
2007-08-12 02:54:33 -07:00
} ;
EAPI void *
e_modapi_init ( E_Module * m )
{
2008-10-22 04:49:33 -07:00
Eina_List * l , * ll , * lll ;
2007-08-12 02:54:33 -07:00
E_Manager * man ;
E_Container * con ;
E_Zone * zone ;
2011-01-05 14:36:21 -08:00
2007-08-12 02:54:33 -07:00
conf_module = m ;
2007-08-12 17:00:13 -07:00
/* Setup Entry in Config Panel */
2012-08-07 07:08:22 -07:00
e_configure_registry_category_add ( " fileman " , 100 , _ ( " Files " ) ,
2011-01-05 14:36:21 -08:00
NULL , " system-file-manager " ) ;
e_configure_registry_item_add ( " fileman/fileman " , 10 , _ ( " File Manager " ) ,
NULL , " system-file-manager " ,
e_int_config_fileman ) ;
2011-04-30 20:00:56 -07:00
e_configure_registry_item_add ( " fileman/file_icons " , 20 , _ ( " File Icons " ) ,
NULL , " preferences-file-icons " ,
e_int_config_mime ) ;
2007-08-12 02:54:33 -07:00
/* Setup Config edd */
_e_mod_fileman_config_load ( ) ;
2013-01-03 06:47:40 -08:00
e_configure_option_category_tag_add ( _ ( " files " ) , _ ( " files " ) ) ;
e_configure_option_category_icon_set ( _ ( " files " ) , " system-file-manager " ) ;
2011-01-05 14:36:21 -08:00
2007-08-12 02:54:33 -07:00
/* add module supplied action */
act = e_action_add ( " fileman " ) ;
if ( act )
{
2011-01-05 14:36:21 -08:00
act - > func . go = _e_mod_action_fileman_cb ;
2012-12-16 08:58:17 -08:00
e_action_predef_name_set ( N_ ( " Launch " ) , N_ ( " File Manager " ) ,
2011-01-05 14:36:21 -08:00
" fileman " , NULL , " syntax: /path/to/dir or ~/path/to/dir or favorites or desktop, examples: /boot/grub, ~/downloads " , 1 ) ;
2007-08-12 02:54:33 -07:00
}
2012-12-28 02:02:21 -08:00
act2 = e_action_add ( " fileman_reset " ) ;
if ( act2 )
act2 - > func . go = _e_mod_action_fileman_reset_cb ;
2012-08-06 07:01:53 -07:00
maug = e_int_menus_menu_augmentation_add_sorted ( " main/1 " , _ ( " Navigate " ) , _e_mod_menu_add , NULL , NULL , NULL ) ;
2007-08-12 02:54:33 -07:00
e_module_delayed_set ( m , 1 ) ;
2012-09-14 05:46:23 -07:00
e_fwin_init ( ) ;
2007-08-12 02:54:33 -07:00
/* Hook into zones */
for ( l = e_manager_list ( ) ; l ; l = l - > next )
{
2011-01-05 14:36:21 -08:00
man = l - > data ;
for ( ll = man - > containers ; ll ; ll = ll - > next )
{
con = ll - > data ;
for ( lll = con - > zones ; lll ; lll = lll - > next )
{
zone = lll - > data ;
2007-12-13 21:57:16 -08:00
if ( e_fwin_zone_find ( zone ) ) continue ;
2012-12-27 07:05:44 -08:00
if ( e_config - > show_desktop_icons )
2012-09-13 00:18:13 -07:00
e_fwin_zone_new ( zone , e_mod_fileman_path_find ( zone ) ) ;
2011-01-05 14:36:21 -08:00
}
}
2007-08-12 02:54:33 -07:00
}
2007-12-13 21:57:16 -08:00
zone_add_handler = ecore_event_handler_add ( E_EVENT_ZONE_ADD ,
2011-01-05 14:36:21 -08:00
_e_mod_zone_add , NULL ) ;
2007-12-13 21:57:16 -08:00
/* FIXME: add system event for new zone creation, and on creation, add an fwin to the zone */
2008-11-29 22:39:54 -08:00
e_fileman_dbus_init ( ) ;
2011-08-09 08:47:22 -07:00
e_fwin_nav_init ( ) ;
2007-08-12 02:54:33 -07:00
return m ;
}
EAPI int
2010-08-19 09:29:01 -07:00
e_modapi_shutdown ( E_Module * m __UNUSED__ )
2007-08-12 02:54:33 -07:00
{
2008-10-22 04:49:33 -07:00
Eina_List * l , * ll , * lll ;
2007-08-12 02:54:33 -07:00
E_Manager * man ;
E_Container * con ;
E_Zone * zone ;
2011-04-30 20:00:56 -07:00
E_Config_Dialog * cfd ;
2007-08-12 02:54:33 -07:00
2008-11-29 22:39:54 -08:00
e_fileman_dbus_shutdown ( ) ;
2007-12-13 21:57:16 -08:00
ecore_event_handler_del ( zone_add_handler ) ;
zone_add_handler = NULL ;
2011-01-05 14:36:21 -08:00
2007-08-12 02:54:33 -07:00
/* Unhook zone fm */
for ( l = e_manager_list ( ) ; l ; l = l - > next )
{
2011-01-05 14:36:21 -08:00
man = l - > data ;
for ( ll = man - > containers ; ll ; ll = ll - > next )
{
con = ll - > data ;
for ( lll = con - > zones ; lll ; lll = lll - > next )
{
zone = lll - > data ;
if ( ! zone ) continue ;
e_fwin_zone_shutdown ( zone ) ;
}
}
}
2011-08-09 08:47:22 -07:00
e_fwin_nav_shutdown ( ) ;
2007-08-12 02:54:33 -07:00
/* remove module-supplied menu additions */
if ( maug )
{
2011-01-05 14:36:21 -08:00
e_int_menus_menu_augmentation_del ( " main/1 " , maug ) ;
maug = NULL ;
2007-08-12 02:54:33 -07:00
}
2012-09-14 05:46:23 -07:00
e_fwin_shutdown ( ) ;
2007-08-12 02:54:33 -07:00
/* remove module-supplied action */
if ( act )
{
2012-12-16 08:58:17 -08:00
e_action_predef_name_del ( " Launch " , " File Manager " ) ;
2011-01-05 14:36:21 -08:00
e_action_del ( " fileman " ) ;
act = NULL ;
2007-08-12 02:54:33 -07:00
}
2012-12-28 02:02:21 -08:00
if ( act2 )
{
e_action_del ( " fileman_reset " ) ;
act2 = NULL ;
}
2011-04-30 20:00:56 -07:00
while ( ( cfd = e_config_dialog_get ( " E " , " fileman/mime_edit_dialog " ) ) )
e_object_del ( E_OBJECT ( cfd ) ) ;
while ( ( cfd = e_config_dialog_get ( " E " , " fileman/file_icons " ) ) )
e_object_del ( E_OBJECT ( cfd ) ) ;
while ( ( cfd = e_config_dialog_get ( " E " , " fileman/fileman " ) ) )
e_object_del ( E_OBJECT ( cfd ) ) ;
e_configure_registry_item_del ( " fileman/file_icons " ) ;
2007-08-12 17:00:13 -07:00
e_configure_registry_item_del ( " fileman/fileman " ) ;
e_configure_registry_category_del ( " fileman " ) ;
2011-01-05 14:36:21 -08:00
2012-07-31 01:04:22 -07:00
e_config_domain_save ( " module.fileman " , conf_edd , fileman_config ) ;
2013-01-03 06:47:40 -08:00
e_configure_option_category_tag_del ( _ ( " files " ) , _ ( " files " ) ) ;
2013-01-04 05:30:09 -08:00
e_configure_option_tag_alias_del ( _ ( " files " ) , _ ( " filemanager " ) ) ;
e_configure_option_tag_alias_del ( _ ( " files " ) , _ ( " file manager " ) ) ;
2013-01-03 06:47:40 -08:00
E_CONFIGURE_OPTION_LIST_CLEAR ( cfg_opts ) ;
2007-08-12 22:05:26 -07:00
_e_mod_fileman_config_free ( ) ;
2007-08-12 02:54:33 -07:00
E_CONFIG_DD_FREE ( conf_edd ) ;
2012-09-13 00:18:13 -07:00
E_CONFIG_DD_FREE ( paths_edd ) ;
2008-10-15 08:12:56 -07:00
2009-11-23 21:25:23 -08:00
//eina_shutdown();
2008-10-15 08:12:56 -07:00
2007-08-12 02:54:33 -07:00
conf_module = NULL ;
return 1 ;
}
EAPI int
2010-08-19 09:29:01 -07:00
e_modapi_save ( E_Module * m __UNUSED__ )
2007-08-12 02:54:33 -07:00
{
e_config_domain_save ( " module.fileman " , conf_edd , fileman_config ) ;
return 1 ;
}
/* action callback */
2012-12-28 02:02:21 -08:00
static void
_e_mod_action_fileman_reset_cb ( E_Object * obj EINA_UNUSED , const char * params EINA_UNUSED )
{
e_fwin_reload_all ( ) ;
}
2007-08-12 02:54:33 -07:00
static void
2011-01-05 14:36:21 -08:00
_e_mod_action_fileman_cb ( E_Object * obj ,
const char * params )
2007-08-12 02:54:33 -07:00
{
2007-09-13 14:18:44 -07:00
E_Zone * zone = NULL ;
2011-01-05 14:36:21 -08:00
2007-08-12 02:54:33 -07:00
if ( obj )
{
2011-01-05 14:36:21 -08:00
if ( obj - > type = = E_MANAGER_TYPE )
zone = e_util_zone_current_get ( ( E_Manager * ) obj ) ;
else if ( obj - > type = = E_CONTAINER_TYPE )
zone = e_util_zone_current_get ( ( ( E_Container * ) obj ) - > manager ) ;
else if ( obj - > type = = E_ZONE_TYPE )
zone = e_util_zone_current_get ( ( ( E_Zone * ) obj ) - > container - > manager ) ;
else
zone = e_util_zone_current_get ( e_manager_current_get ( ) ) ;
2007-08-12 02:54:33 -07:00
}
if ( ! zone ) zone = e_util_zone_current_get ( e_manager_current_get ( ) ) ;
2007-09-18 18:29:04 -07:00
if ( zone )
{
2011-01-05 14:36:21 -08:00
if ( params & & params [ 0 ] = = ' / ' )
e_fwin_new ( zone - > container , " / " , params ) ;
else if ( params & & params [ 0 ] = = ' ~ ' )
e_fwin_new ( zone - > container , " ~/ " , params + 1 ) ;
2011-01-05 16:57:27 -08:00
else if ( params & & strcmp ( params , " (none) " ) ) /* avoid matching paths that no longer exist */
2011-01-05 14:36:21 -08:00
{
char * path ;
path = e_util_shell_env_path_eval ( params ) ;
if ( path )
{
e_fwin_new ( zone - > container , path , " / " ) ;
free ( path ) ;
}
}
else
e_fwin_new ( zone - > container , " favorites " , " / " ) ;
2007-09-18 18:29:04 -07:00
}
2007-08-12 02:54:33 -07:00
}
2009-03-02 14:46:40 -08:00
void
2012-09-14 03:17:31 -07:00
_e_mod_menu_add ( void * data __UNUSED__ , E_Menu * m )
2012-07-30 04:48:28 -07:00
{
2012-09-16 21:11:27 -07:00
e_mod_menu_add ( m , NULL ) ;
2007-08-12 02:54:33 -07:00
}
2013-01-03 06:47:40 -08:00
static Eina_List *
_cfg_view_mode_info_cb ( E_Configure_Option * co )
{
Eina_List * ret = NULL ;
E_Configure_Option_Info * oi ;
int x ;
const char * name [ ] =
{
" Grid-placed icons " , //1
" Custom-placed icons " , //2
NULL , //3
NULL , //4
" List icons " //5
} ;
for ( x = E_FM2_VIEW_MODE_GRID_ICONS ; x < = E_FM2_VIEW_MODE_LIST ; x + + )
{
if ( ! name [ x ] ) continue ;
oi = e_configure_option_info_new ( co , _ ( name [ x - 1 ] ) , ( intptr_t * ) ( long ) x ) ;
oi - > current = ( * ( int * ) co - > valptr = = x ) ;
ret = eina_list_append ( ret , oi ) ;
}
return ret ;
}
static Eina_List *
_cfg_toolbar_orient_cb_info_cb ( E_Configure_Option * co )
{
Eina_List * ret = NULL ;
E_Configure_Option_Info * oi ;
int x ;
const char * name [ ] =
{
" Top " ,
" Bottom "
} ;
for ( x = E_GADCON_ORIENT_TOP ; x < = E_GADCON_ORIENT_BOTTOM ; x + + )
{
oi = e_configure_option_info_new ( co , _ ( name [ x - E_GADCON_ORIENT_TOP ] ) , ( intptr_t * ) ( long ) x ) ;
oi - > current = ( * ( int * ) co - > valptr = = x ) ;
ret = eina_list_append ( ret , oi ) ;
}
return ret ;
}
2007-08-12 02:54:33 -07:00
/* Abstract fileman config load/create to one function for maintainability */
2011-01-05 14:36:21 -08:00
static void
_e_mod_fileman_config_load ( void )
2007-08-12 02:54:33 -07:00
{
2012-09-13 00:18:13 -07:00
# undef T
# undef D
# define T Fileman_Path
# define D paths_edd
paths_edd = E_CONFIG_DD_NEW ( " Fileman_Path " , Fileman_Path ) ;
E_CONFIG_VAL ( D , T , dev , STR ) ;
E_CONFIG_VAL ( D , T , path , STR ) ;
E_CONFIG_VAL ( D , T , zone , UINT ) ;
E_CONFIG_VAL ( D , T , desktop_mode , INT ) ;
2007-08-12 02:54:33 -07:00
conf_edd = E_CONFIG_DD_NEW ( " Fileman_Config " , Config ) ;
# undef T
# undef D
# define T Config
# define D conf_edd
2007-08-12 22:05:26 -07:00
E_CONFIG_VAL ( D , T , config_version , INT ) ;
2007-08-12 02:54:33 -07:00
E_CONFIG_VAL ( D , T , view . mode , INT ) ;
E_CONFIG_VAL ( D , T , view . open_dirs_in_place , UCHAR ) ;
E_CONFIG_VAL ( D , T , view . selector , UCHAR ) ;
E_CONFIG_VAL ( D , T , view . single_click , UCHAR ) ;
E_CONFIG_VAL ( D , T , view . no_subdir_jump , UCHAR ) ;
E_CONFIG_VAL ( D , T , view . no_subdir_drop , UCHAR ) ;
E_CONFIG_VAL ( D , T , view . always_order , UCHAR ) ;
E_CONFIG_VAL ( D , T , view . link_drop , UCHAR ) ;
E_CONFIG_VAL ( D , T , view . fit_custom_pos , UCHAR ) ;
2007-08-12 14:10:02 -07:00
E_CONFIG_VAL ( D , T , view . show_full_path , UCHAR ) ;
2007-11-09 15:33:23 -08:00
E_CONFIG_VAL ( D , T , view . show_toolbar , UCHAR ) ;
2012-07-31 06:31:35 -07:00
E_CONFIG_VAL ( D , T , view . show_sidebar , UCHAR ) ;
2012-08-06 06:18:15 -07:00
E_CONFIG_VAL ( D , T , view . desktop_navigation , UCHAR ) ;
2007-08-12 02:54:33 -07:00
E_CONFIG_VAL ( D , T , icon . icon . w , INT ) ;
E_CONFIG_VAL ( D , T , icon . icon . h , INT ) ;
E_CONFIG_VAL ( D , T , icon . list . w , INT ) ;
E_CONFIG_VAL ( D , T , icon . list . h , INT ) ;
E_CONFIG_VAL ( D , T , icon . fixed . w , UCHAR ) ;
E_CONFIG_VAL ( D , T , icon . fixed . h , UCHAR ) ;
E_CONFIG_VAL ( D , T , icon . extension . show , UCHAR ) ;
2012-09-21 00:08:21 -07:00
E_CONFIG_VAL ( D , T , icon . max_thumb_size , UINT ) ;
2007-08-12 02:54:33 -07:00
E_CONFIG_VAL ( D , T , list . sort . no_case , UCHAR ) ;
2012-09-03 07:26:26 -07:00
E_CONFIG_VAL ( D , T , list . sort . extension , UCHAR ) ;
2012-09-04 23:41:42 -07:00
E_CONFIG_VAL ( D , T , list . sort . mtime , UCHAR ) ;
2012-09-04 03:47:39 -07:00
E_CONFIG_VAL ( D , T , list . sort . size , UCHAR ) ;
2007-08-12 02:54:33 -07:00
E_CONFIG_VAL ( D , T , list . sort . dirs . first , UCHAR ) ;
E_CONFIG_VAL ( D , T , list . sort . dirs . last , UCHAR ) ;
E_CONFIG_VAL ( D , T , selection . single , UCHAR ) ;
E_CONFIG_VAL ( D , T , selection . windows_modifiers , UCHAR ) ;
E_CONFIG_VAL ( D , T , theme . background , STR ) ;
E_CONFIG_VAL ( D , T , theme . frame , STR ) ;
E_CONFIG_VAL ( D , T , theme . icons , STR ) ;
E_CONFIG_VAL ( D , T , theme . fixed , UCHAR ) ;
2012-07-13 00:53:26 -07:00
E_CONFIG_VAL ( D , T , tooltip . delay , DOUBLE ) ;
E_CONFIG_VAL ( D , T , tooltip . size , DOUBLE ) ;
2012-08-13 07:12:45 -07:00
E_CONFIG_VAL ( D , T , tooltip . enable , UCHAR ) ;
2012-09-13 03:49:22 -07:00
E_CONFIG_VAL ( D , T , view . spring_delay , INT ) ;
2012-12-18 07:12:22 -08:00
E_CONFIG_VAL ( D , T , view . toolbar_orient , UINT ) ;
2012-09-13 00:18:13 -07:00
E_CONFIG_LIST ( D , T , paths , paths_edd ) ;
2011-01-05 14:36:21 -08:00
2007-08-12 02:54:33 -07:00
fileman_config = e_config_domain_load ( " module.fileman " , conf_edd ) ;
2011-01-05 14:36:21 -08:00
if ( fileman_config )
2007-08-12 22:05:26 -07:00
{
2012-08-30 01:04:35 -07:00
if ( ! e_util_module_config_check ( " Fileman " , fileman_config - > config_version , MOD_CONFIG_FILE_VERSION ) )
_e_mod_fileman_config_free ( ) ;
2007-08-12 22:05:26 -07:00
}
2011-01-05 14:36:21 -08:00
if ( ! fileman_config )
2007-08-12 02:54:33 -07:00
{
2011-01-05 14:36:21 -08:00
fileman_config = E_NEW ( Config , 1 ) ;
2012-12-21 15:57:05 -08:00
fileman_config - > view . mode = E_FM2_VIEW_MODE_GRID_ICONS ;
2012-12-27 07:05:44 -08:00
e_config - > show_desktop_icons = 1 ;
2012-12-21 15:57:05 -08:00
fileman_config - > icon . icon . w = 48 ;
fileman_config - > icon . icon . h = 48 ;
fileman_config - > icon . extension . show = 1 ;
fileman_config - > list . sort . no_case = 1 ;
fileman_config - > list . sort . dirs . first = 1 ;
fileman_config - > view . show_toolbar = 1 ;
fileman_config - > view . open_dirs_in_place = 1 ;
fileman_config - > tooltip . delay = 1.0 ;
fileman_config - > tooltip . size = 30.0 ;
fileman_config - > view . show_sidebar = 1 ;
fileman_config - > tooltip . enable = 1 ;
fileman_config - > view . spring_delay = 1 ;
fileman_config - > icon . max_thumb_size = 5 ;
fileman_config - > view . toolbar_orient = E_GADCON_ORIENT_TOP ;
2007-08-12 02:54:33 -07:00
}
2011-01-05 14:36:21 -08:00
fileman_config - > config_version = MOD_CONFIG_FILE_VERSION ;
2013-01-03 06:47:40 -08:00
fileman_config - > icon . icon . h = fileman_config - > icon . icon . w ;
2011-01-05 14:36:21 -08:00
/* UCHAR's give nasty compile warnings about comparisons so not gonna limit those */
E_CONFIG_LIMIT ( fileman_config - > view . mode , E_FM2_VIEW_MODE_ICONS , E_FM2_VIEW_MODE_LIST ) ;
E_CONFIG_LIMIT ( fileman_config - > icon . icon . w , 16 , 256 ) ;
E_CONFIG_LIMIT ( fileman_config - > icon . icon . h , 16 , 256 ) ;
E_CONFIG_LIMIT ( fileman_config - > icon . list . w , 16 , 256 ) ;
E_CONFIG_LIMIT ( fileman_config - > icon . list . h , 16 , 256 ) ;
2012-07-13 00:53:26 -07:00
E_CONFIG_LIMIT ( fileman_config - > tooltip . delay , 0.0 , 5.0 ) ;
E_CONFIG_LIMIT ( fileman_config - > tooltip . size , 10.0 , 75.0 ) ;
2012-09-13 03:49:22 -07:00
E_CONFIG_LIMIT ( fileman_config - > view . spring_delay , 1 , 10 ) ;
2012-10-02 23:41:32 -07:00
E_CONFIG_LIMIT ( fileman_config - > icon . max_thumb_size , 0 , 1024 ) ;
2012-07-13 00:53:26 -07:00
2012-12-18 06:55:43 -08:00
fileman_config - > view . menu_shows_files = 0 ;
2013-01-03 06:47:40 -08:00
{
E_Configure_Option * co ;
E_CONFIGURE_OPTION_ADD ( co , ENUM , view . mode , fileman_config , " Default view mode " , _ ( " files " ) ) ;
co - > info_cb = _cfg_view_mode_info_cb ;
E_CONFIGURE_OPTION_ICON ( co , " system-file-manager " ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , DOUBLE_INT , icon . icon . w , fileman_config , " Icon size " , _ ( " files " ) , _ ( " image " ) ) ;
E_CONFIGURE_OPTION_MINMAX_STEP_FMT ( co , 16 , 256 , 1 , " %1.0f pixels " ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , icon . extension . show , fileman_config , " Show file extensions " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , view . show_full_path , fileman_config , " Show full path in filemanager window titles " , _ ( " files " ) , _ ( " border " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , view . show_toolbar , fileman_config , " Show path toolbar in filemanager windows " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , ENUM , view . toolbar_orient , fileman_config , " Filemanager path toolbar position " , _ ( " files " ) ) ;
co - > info_cb = _cfg_toolbar_orient_cb_info_cb ;
E_CONFIGURE_OPTION_ICON ( co , " system-file-manager " ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , view . show_sidebar , fileman_config , " Show favorites sidebar in filemanager windows " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , list . sort . no_case , fileman_config , " Ignore letter case when sorting files " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , list . sort . extension , fileman_config , " Group files by extension " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , list . sort . mtime , fileman_config , " Sort files by modification time " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , list . sort . size , fileman_config , " Sort files by size " , _ ( " files " ) , _ ( " size " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
/* FIXME: exclusive */
E_CONFIGURE_OPTION_ADD ( co , BOOL , list . sort . dirs . first , fileman_config , " Sort directories first " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , list . sort . dirs . last , fileman_config , " Sort directories last " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , view . open_dirs_in_place , fileman_config , " Open directories in place " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , view . single_click , fileman_config , " Use single click to open files " , _ ( " files " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , selection . windows_modifiers , fileman_config , " Use alternate (Mac-style) selection modifiers " , _ ( " files " ) , _ ( " key " ) ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , BOOL , view . desktop_navigation , fileman_config , " Allow navigation on desktop " , _ ( " files " ) ) ;
E_CONFIGURE_OPTION_HELP ( co , " Normally, icons on the desktop come from $XDG_HOME_DIR/Desktop[-$SCREEN]. "
" With this option enabled, the desktop can freely change directories using the Navigate "
" menu or type buffer. " ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , DOUBLE_UINT , icon . max_thumb_size , fileman_config , " Maximum file size for which thumbnails should be generated " , _ ( " files " ) , _ ( " size " ) , _ ( " image " ) ) ;
E_CONFIGURE_OPTION_MINMAX_STEP_FMT ( co , 0 , 512 , 1 , " %1.0f MiB " ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , DOUBLE , view . spring_delay , fileman_config , " Spring folder delay " , _ ( " files " ) , _ ( " delay " ) ) ;
E_CONFIGURE_OPTION_HELP ( co , " A \" spring folder \" is the action that occurs when dragging a file onto a folder: "
" the folder will \" spring \" open and create a new window to continue the drag operation in. " ) ;
E_CONFIGURE_OPTION_MINMAX_STEP_FMT ( co , 1 , 10 , 1 , " %1.0f seconds " ) ;
co - > funcs [ 1 ] . none = co - > funcs [ 0 ] . none = e_fwin_reload_all ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
E_CONFIGURE_OPTION_ADD ( co , CUSTOM , paths , fileman_config , " File icons " , _ ( " files " ) , _ ( " image " ) ) ;
co - > info = eina_stringshare_add ( " fileman/file_icons " ) ;
E_CONFIGURE_OPTION_ICON ( co , " preferences-file-icons " ) ;
cfg_opts = eina_inlist_append ( cfg_opts , EINA_INLIST_GET ( co ) ) ;
2013-01-04 05:30:09 -08:00
e_configure_option_tag_alias_add ( _ ( " files " ) , _ ( " filemanager " ) ) ;
e_configure_option_tag_alias_add ( _ ( " files " ) , _ ( " file manager " ) ) ;
2013-01-03 06:47:40 -08:00
}
2011-01-05 14:36:21 -08:00
e_config_save_queue ( ) ;
2007-08-12 02:54:33 -07:00
}
2007-08-12 22:05:26 -07:00
2012-09-13 00:18:13 -07:00
static void
_e_mod_fileman_path_free ( Fileman_Path * path )
{
if ( ! path ) return ;
eina_stringshare_del ( path - > dev ) ;
eina_stringshare_del ( path - > path ) ;
free ( path ) ;
}
2007-08-12 22:05:26 -07:00
static void
2011-01-05 14:36:21 -08:00
_e_mod_fileman_config_free ( void )
2007-08-12 22:05:26 -07:00
{
2012-09-12 09:42:29 -07:00
eina_stringshare_del ( fileman_config - > theme . background ) ;
eina_stringshare_del ( fileman_config - > theme . frame ) ;
eina_stringshare_del ( fileman_config - > theme . icons ) ;
2012-09-13 00:18:13 -07:00
E_FREE_LIST ( fileman_config - > paths , _e_mod_fileman_path_free ) ;
2011-01-05 14:36:21 -08:00
E_FREE ( fileman_config ) ;
2007-08-12 22:05:26 -07:00
}
2010-06-24 09:19:12 -07:00
static Eina_Bool
2011-01-05 14:36:21 -08:00
_e_mod_zone_add ( __UNUSED__ void * data ,
int type ,
void * event )
2007-12-13 21:57:16 -08:00
{
E_Event_Zone_Add * ev ;
E_Zone * zone ;
2011-01-05 14:36:21 -08:00
2010-06-24 09:19:12 -07:00
if ( type ! = E_EVENT_ZONE_ADD ) return ECORE_CALLBACK_PASS_ON ;
2007-12-13 21:57:16 -08:00
ev = event ;
zone = ev - > zone ;
2010-06-24 09:19:12 -07:00
if ( e_fwin_zone_find ( zone ) ) return ECORE_CALLBACK_PASS_ON ;
2012-12-27 07:05:44 -08:00
if ( e_config - > show_desktop_icons )
2012-09-13 00:18:13 -07:00
e_fwin_zone_new ( zone , e_mod_fileman_path_find ( zone ) ) ;
return ECORE_CALLBACK_PASS_ON ;
}
Fileman_Path *
e_mod_fileman_path_find ( E_Zone * zone )
{
Eina_List * l ;
Fileman_Path * path ;
EINA_LIST_FOREACH ( fileman_config - > paths , l , path )
2012-11-26 01:01:26 -08:00
if ( path - > zone = = zone - > container - > num + zone - > num ) break ;
if ( l & & fileman_config - > view . desktop_navigation ) return path ;
if ( l )
{
eina_stringshare_replace ( & path - > path , NULL ) ;
2012-11-26 02:01:55 -08:00
eina_stringshare_replace ( & path - > dev , " desktop " ) ;
2012-11-26 01:01:26 -08:00
}
else
{
path = E_NEW ( Fileman_Path , 1 ) ;
path - > zone = zone - > container - > num + zone - > num ;
path - > dev = eina_stringshare_add ( " desktop " ) ;
fileman_config - > paths = eina_list_append ( fileman_config - > paths , path ) ;
}
2012-09-13 01:23:45 -07:00
path - > desktop_mode = E_FM2_VIEW_MODE_CUSTOM_ICONS ;
2012-09-13 00:18:13 -07:00
if ( ( zone - > container - > num = = 0 ) & & ( zone - > num = = 0 ) )
path - > path = eina_stringshare_add ( " / " ) ;
2011-01-05 14:36:21 -08:00
else
2012-11-26 01:01:26 -08:00
path - > path = eina_stringshare_printf ( " %d " , ( zone - > container - > num + zone - > num ) ) ;
2012-09-13 00:18:13 -07:00
return path ;
2007-12-13 21:57:16 -08:00
}