* new config option to mount devices on startup
  * open-on-insert option depend on mount-on-insert, disable the checkbox accordly

SVN revision: 74459
This commit is contained in:
Davide Andreoli 2012-07-26 22:04:51 +00:00
parent 1074da1961
commit 195eb7b069
4 changed files with 31 additions and 5 deletions

View File

@ -6,6 +6,7 @@
struct _E_Config_Dialog_Data
{
int auto_mount;
int boot_mount;
int auto_open;
char *fm;
int fm_chk;
@ -80,6 +81,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
{
/* load a temp copy of the config variables */
cfdata->auto_mount = places_conf->auto_mount;
cfdata->boot_mount = places_conf->boot_mount;
cfdata->auto_open = places_conf->auto_open;
cfdata->show_menu = places_conf->show_menu;
@ -110,10 +112,23 @@ void _custom_fm_click(void *data, Evas_Object *obj)
}
}
void _mount_on_insert_click(void *data, Evas_Object *obj)
{
Evas_Object *ow = data;
if (e_widget_check_checked_get(obj))
e_widget_disabled_set(ow, 0);
else
{
e_widget_check_checked_set(ow, 0);
e_widget_disabled_set(ow, 1);
}
}
static Evas_Object *
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o = NULL, *of = NULL, *ow = NULL;
Evas_Object *o = NULL, *of = NULL, *ow = NULL, *ow1 = NULL;
o = e_widget_list_add(evas, 0, 0);
@ -129,13 +144,20 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
&(cfdata->hide_header));
e_widget_framelist_object_append(of, ow);
ow = e_widget_check_add(evas, D_("Mount volumes on insert"),
&(cfdata->auto_mount));
ow = e_widget_check_add(evas, D_("Mount volumes at boot"),
&(cfdata->boot_mount));
e_widget_framelist_object_append(of, ow);
ow1 = e_widget_check_add(evas, D_("Mount volumes on insert"),
&(cfdata->auto_mount));
e_widget_framelist_object_append(of, ow1);
ow = e_widget_check_add(evas, D_("Open filemanager on insert"),
&(cfdata->auto_open));
e_widget_framelist_object_append(of, ow);
e_widget_on_change_hook_set(ow1, _mount_on_insert_click, ow);
if (!cfdata->auto_mount)
e_widget_disabled_set(ow, 1);
ow = e_widget_check_add(evas, D_("Use a custom file manager"), &(cfdata->fm_chk));
e_widget_check_checked_set(ow, strlen(cfdata->fm) > 0 ? 1 : 0);
@ -182,6 +204,7 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
places_conf->show_menu = cfdata->show_menu;
places_conf->hide_header = cfdata->hide_header;
places_conf->auto_mount = cfdata->auto_mount;
places_conf->boot_mount = cfdata->boot_mount;
places_conf->auto_open = cfdata->auto_open;
places_conf->show_home = cfdata->show_home;
places_conf->show_desk = cfdata->show_desk;

View File

@ -78,6 +78,7 @@ e_modapi_init(E_Module *m)
E_CONFIG_VAL(D, T, version, INT);
E_CONFIG_VAL(D, T, fm, STR);
E_CONFIG_VAL(D, T, auto_mount, UCHAR);
E_CONFIG_VAL(D, T, boot_mount, UCHAR);
E_CONFIG_VAL(D, T, auto_open, UCHAR);
E_CONFIG_LIST(D, T, conf_items, conf_item_edd);
E_CONFIG_VAL(D, T, show_menu, UCHAR);

View File

@ -29,6 +29,7 @@ struct _Config
const char *fm;
unsigned char auto_mount;
unsigned char boot_mount;
unsigned char auto_open;
unsigned char show_menu;
unsigned char hide_header;

View File

@ -94,7 +94,8 @@ places_volume_add(const char *id, Eina_Bool first_time)
v->drive_type = "";
v->model = "";
v->bus = "";
v->to_mount = (places_conf->auto_mount && !first_time);
v->to_mount = ((places_conf->auto_mount && !first_time) ||
(first_time && places_conf->boot_mount));
v->force_open = (places_conf->auto_open && !first_time);
volumes = eina_list_append(volumes, v);
@ -397,7 +398,7 @@ places_volume_mount(Volume *vol)
Eina_List *opts = NULL;
char buf[256];
if (!vol || !vol->mount_func)
if (!vol || !vol->mount_func || vol->mounted)
return;
if ((!strcmp(vol->fstype, "vfat")) || (!strcmp(vol->fstype, "ntfs")))