parent
db5b5e67ea
commit
32e588dfda
|
@ -2,7 +2,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
struct _E_Config_Dialog_Data
|
struct _E_Config_Dialog_Data
|
||||||
{
|
{
|
||||||
int auto_mount;
|
int auto_mount;
|
||||||
int auto_open;
|
int auto_open;
|
||||||
|
@ -27,7 +27,7 @@ static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
|
|
||||||
/* External Functions */
|
/* External Functions */
|
||||||
E_Config_Dialog *
|
E_Config_Dialog *
|
||||||
e_int_config_places_module(E_Container *con, const char *params)
|
e_int_config_places_module(E_Container *con, const char *params)
|
||||||
{
|
{
|
||||||
E_Config_Dialog *cfd = NULL;
|
E_Config_Dialog *cfd = NULL;
|
||||||
E_Config_Dialog_View *v = NULL;
|
E_Config_Dialog_View *v = NULL;
|
||||||
|
@ -48,7 +48,7 @@ e_int_config_places_module(E_Container *con, const char *params)
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-places.edj", places_conf->module->dir);
|
snprintf(buf, sizeof(buf), "%s/e-module-places.edj", places_conf->module->dir);
|
||||||
|
|
||||||
/* create new config dialog */
|
/* create new config dialog */
|
||||||
cfd = e_config_dialog_new(con, D_("Places Configuration"), "Places",
|
cfd = e_config_dialog_new(con, D_("Places Configuration"), "Places",
|
||||||
"fileman/places", buf, 0, v, NULL);
|
"fileman/places", buf, 0, v, NULL);
|
||||||
places_conf->cfd = cfd;
|
places_conf->cfd = cfd;
|
||||||
return cfd;
|
return cfd;
|
||||||
|
@ -56,7 +56,7 @@ e_int_config_places_module(E_Container *con, const char *params)
|
||||||
|
|
||||||
/* Local Functions */
|
/* Local Functions */
|
||||||
static void *
|
static void *
|
||||||
_create_data(E_Config_Dialog *cfd)
|
_create_data(E_Config_Dialog *cfd)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata = NULL;
|
E_Config_Dialog_Data *cfdata = NULL;
|
||||||
|
|
||||||
|
@ -65,16 +65,16 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
return cfdata;
|
return cfdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
free(cfdata->fm);
|
free(cfdata->fm);
|
||||||
places_conf->cfd = NULL;
|
places_conf->cfd = NULL;
|
||||||
E_FREE(cfdata);
|
E_FREE(cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
/* load a temp copy of the config variables */
|
/* load a temp copy of the config variables */
|
||||||
cfdata->auto_mount = places_conf->auto_mount;
|
cfdata->auto_mount = places_conf->auto_mount;
|
||||||
|
@ -87,7 +87,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
cfdata->show_root = places_conf->show_root;
|
cfdata->show_root = places_conf->show_root;
|
||||||
cfdata->show_temp = places_conf->show_temp;
|
cfdata->show_temp = places_conf->show_temp;
|
||||||
cfdata->show_bookm = places_conf->show_bookm;
|
cfdata->show_bookm = places_conf->show_bookm;
|
||||||
|
|
||||||
if (places_conf->fm)
|
if (places_conf->fm)
|
||||||
cfdata->fm = strdup(places_conf->fm);
|
cfdata->fm = strdup(places_conf->fm);
|
||||||
else
|
else
|
||||||
|
@ -99,16 +99,16 @@ void _custom_fm_click(void *data, Evas_Object *obj)
|
||||||
E_Config_Dialog_Data *cfdata = data;
|
E_Config_Dialog_Data *cfdata = data;
|
||||||
|
|
||||||
if (e_widget_check_checked_get(obj))
|
if (e_widget_check_checked_get(obj))
|
||||||
e_widget_disabled_set(cfdata->entry, 0);
|
e_widget_disabled_set(cfdata->entry, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e_widget_disabled_set(cfdata->entry, 1);
|
e_widget_disabled_set(cfdata->entry, 1);
|
||||||
e_widget_entry_text_set(cfdata->entry, "");
|
e_widget_entry_text_set(cfdata->entry, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_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;
|
||||||
|
|
||||||
|
@ -169,8 +169,8 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
places_conf->show_menu = cfdata->show_menu;
|
places_conf->show_menu = cfdata->show_menu;
|
||||||
places_conf->auto_mount = cfdata->auto_mount;
|
places_conf->auto_mount = cfdata->auto_mount;
|
||||||
|
|
134
src/e_mod_main.c
134
src/e_mod_main.c
|
@ -30,10 +30,10 @@ Eina_List *instances = NULL;
|
||||||
Config *places_conf = NULL;
|
Config *places_conf = NULL;
|
||||||
extern Eina_List *volumes;
|
extern Eina_List *volumes;
|
||||||
|
|
||||||
static const E_Gadcon_Client_Class _gc_class =
|
static const E_Gadcon_Client_Class _gc_class =
|
||||||
{
|
{
|
||||||
GADCON_CLIENT_CLASS_VERSION, "Places",
|
GADCON_CLIENT_CLASS_VERSION, "Places",
|
||||||
{_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon,
|
{_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon,
|
||||||
_gc_id_new, _gc_id_del, e_gadcon_site_is_not_toolbar},
|
_gc_id_new, _gc_id_del, e_gadcon_site_is_not_toolbar},
|
||||||
E_GADCON_CLIENT_STYLE_PLAIN
|
E_GADCON_CLIENT_STYLE_PLAIN
|
||||||
};
|
};
|
||||||
|
@ -42,7 +42,7 @@ EAPI E_Module_Api e_modapi = {E_MODULE_API_VERSION, "Places"};
|
||||||
|
|
||||||
/* Module Functions */
|
/* Module Functions */
|
||||||
EAPI void *
|
EAPI void *
|
||||||
e_modapi_init(E_Module *m)
|
e_modapi_init(E_Module *m)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ e_modapi_init(E_Module *m)
|
||||||
snprintf(buf, sizeof(buf), "%s/e-module-places.edj", m->dir);
|
snprintf(buf, sizeof(buf), "%s/e-module-places.edj", m->dir);
|
||||||
|
|
||||||
/* Display this Modules config info in the main Config Panel */
|
/* Display this Modules config info in the main Config Panel */
|
||||||
e_configure_registry_category_add("fileman", 80, D_("Files"),
|
e_configure_registry_category_add("fileman", 80, D_("Files"),
|
||||||
NULL, "system-file-manager");
|
NULL, "system-file-manager");
|
||||||
e_configure_registry_item_add("fileman/places", 80, D_("Places"),
|
e_configure_registry_item_add("fileman/places", 80, D_("Places"),
|
||||||
NULL, buf, e_int_config_places_module);
|
NULL, buf, e_int_config_places_module);
|
||||||
|
|
||||||
/* Define EET Data Storage */
|
/* Define EET Data Storage */
|
||||||
|
@ -89,13 +89,13 @@ e_modapi_init(E_Module *m)
|
||||||
|
|
||||||
/* Tell E to find any existing module data. First run ? */
|
/* Tell E to find any existing module data. First run ? */
|
||||||
places_conf = e_config_domain_load("module.places", conf_edd);
|
places_conf = e_config_domain_load("module.places", conf_edd);
|
||||||
if (places_conf)
|
if (places_conf)
|
||||||
{
|
{
|
||||||
if ((places_conf->version >> 16) < MOD_CONFIG_FILE_EPOCH)
|
if ((places_conf->version >> 16) < MOD_CONFIG_FILE_EPOCH)
|
||||||
{
|
{
|
||||||
/* config too old */
|
/* config too old */
|
||||||
_places_conf_free();
|
_places_conf_free();
|
||||||
ecore_timer_add(1.0, _places_conf_timer,
|
ecore_timer_add(1.0, _places_conf_timer,
|
||||||
"Places Module Configuration data needed "
|
"Places Module Configuration data needed "
|
||||||
"upgrading. Your old configuration<br> has been"
|
"upgrading. Your old configuration<br> has been"
|
||||||
" wiped and a new set of defaults initialized. "
|
" wiped and a new set of defaults initialized. "
|
||||||
|
@ -110,12 +110,12 @@ e_modapi_init(E_Module *m)
|
||||||
"liking. Sorry for the inconvenience.<br>");
|
"liking. Sorry for the inconvenience.<br>");
|
||||||
}
|
}
|
||||||
/* Ardvarks */
|
/* Ardvarks */
|
||||||
else if (places_conf->version > MOD_CONFIG_FILE_VERSION)
|
else if (places_conf->version > MOD_CONFIG_FILE_VERSION)
|
||||||
{
|
{
|
||||||
/* config too new...wtf ? */
|
/* config too new...wtf ? */
|
||||||
_places_conf_free();
|
_places_conf_free();
|
||||||
ecore_timer_add(1.0, _places_conf_timer,
|
ecore_timer_add(1.0, _places_conf_timer,
|
||||||
"Your Places Module configuration is NEWER "
|
"Your Places Module configuration is NEWER "
|
||||||
"than the module version. This is "
|
"than the module version. This is "
|
||||||
"very<br>strange. This should not happen unless"
|
"very<br>strange. This should not happen unless"
|
||||||
" you downgraded<br>the module or "
|
" you downgraded<br>the module or "
|
||||||
|
@ -128,7 +128,7 @@ e_modapi_init(E_Module *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we don't have a config yet, or it got erased above,
|
/* if we don't have a config yet, or it got erased above,
|
||||||
* then create a default one */
|
* then create a default one */
|
||||||
if (!places_conf) _places_conf_new();
|
if (!places_conf) _places_conf_new();
|
||||||
|
|
||||||
|
@ -140,16 +140,16 @@ e_modapi_init(E_Module *m)
|
||||||
{
|
{
|
||||||
E_Int_Menu_Augmentation *maug;
|
E_Int_Menu_Augmentation *maug;
|
||||||
maug = e_int_menus_menu_augmentation_add("main/1",
|
maug = e_int_menus_menu_augmentation_add("main/1",
|
||||||
places_augmentation,
|
places_augmentation,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
e_modapi_shutdown(E_Module *m)
|
e_modapi_shutdown(E_Module *m)
|
||||||
{
|
{
|
||||||
places_shutdown();
|
places_shutdown();
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ e_modapi_shutdown(E_Module *m)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
e_modapi_save(E_Module *m)
|
e_modapi_save(E_Module *m)
|
||||||
{
|
{
|
||||||
e_config_domain_save("module.places", conf_edd, places_conf);
|
e_config_domain_save("module.places", conf_edd, places_conf);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -180,7 +180,7 @@ e_modapi_save(E_Module *m)
|
||||||
|
|
||||||
/* Gadcon Functions */
|
/* Gadcon Functions */
|
||||||
static E_Gadcon_Client *
|
static E_Gadcon_Client *
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
{
|
{
|
||||||
Instance *inst = NULL;
|
Instance *inst = NULL;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_box);
|
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_box);
|
||||||
inst->gcc->data = inst;
|
inst->gcc->data = inst;
|
||||||
|
|
||||||
evas_object_event_callback_add(inst->o_box, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(inst->o_box, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_places_cb_mouse_down, inst);
|
_places_cb_mouse_down, inst);
|
||||||
|
|
||||||
instances = eina_list_append(instances, inst);
|
instances = eina_list_append(instances, inst);
|
||||||
|
@ -204,24 +204,24 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
return inst->gcc;
|
return inst->gcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||||
{
|
{
|
||||||
Instance *inst = NULL;
|
Instance *inst = NULL;
|
||||||
|
|
||||||
if (!(inst = gcc->data)) return;
|
if (!(inst = gcc->data)) return;
|
||||||
instances = eina_list_remove(instances, inst);
|
instances = eina_list_remove(instances, inst);
|
||||||
|
|
||||||
if (inst->menu)
|
if (inst->menu)
|
||||||
{
|
{
|
||||||
e_menu_post_deactivate_callback_set(inst->menu, NULL, NULL);
|
e_menu_post_deactivate_callback_set(inst->menu, NULL, NULL);
|
||||||
e_object_del(E_OBJECT(inst->menu));
|
e_object_del(E_OBJECT(inst->menu));
|
||||||
inst->menu = NULL;
|
inst->menu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->o_box)
|
if (inst->o_box)
|
||||||
{
|
{
|
||||||
evas_object_event_callback_del(inst->o_box, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_del(inst->o_box, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_places_cb_mouse_down);
|
_places_cb_mouse_down);
|
||||||
places_empty_box(inst->o_box);
|
places_empty_box(inst->o_box);
|
||||||
evas_object_del(inst->o_box);
|
evas_object_del(inst->o_box);
|
||||||
|
@ -230,8 +230,8 @@ _gc_shutdown(E_Gadcon_Client *gcc)
|
||||||
E_FREE(inst);
|
E_FREE(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||||
{
|
{
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
|
||||||
|
@ -245,10 +245,10 @@ _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||||
case E_GADCON_ORIENT_CORNER_TR:
|
case E_GADCON_ORIENT_CORNER_TR:
|
||||||
case E_GADCON_ORIENT_CORNER_BL:
|
case E_GADCON_ORIENT_CORNER_BL:
|
||||||
case E_GADCON_ORIENT_CORNER_BR:
|
case E_GADCON_ORIENT_CORNER_BR:
|
||||||
e_gadcon_client_aspect_set(gcc, 100 * eina_list_count(volumes), 50);
|
e_gadcon_client_aspect_set(gcc, 100 * eina_list_count(volumes), 50);
|
||||||
e_gadcon_client_min_size_set(gcc, 100 * eina_list_count(volumes), 50);
|
e_gadcon_client_min_size_set(gcc, 100 * eina_list_count(volumes), 50);
|
||||||
e_box_orientation_set(inst->o_box, 1);
|
e_box_orientation_set(inst->o_box, 1);
|
||||||
break;
|
break;
|
||||||
case E_GADCON_ORIENT_FLOAT:
|
case E_GADCON_ORIENT_FLOAT:
|
||||||
case E_GADCON_ORIENT_VERT:
|
case E_GADCON_ORIENT_VERT:
|
||||||
case E_GADCON_ORIENT_LEFT:
|
case E_GADCON_ORIENT_LEFT:
|
||||||
|
@ -257,25 +257,25 @@ _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||||
case E_GADCON_ORIENT_CORNER_RT:
|
case E_GADCON_ORIENT_CORNER_RT:
|
||||||
case E_GADCON_ORIENT_CORNER_LB:
|
case E_GADCON_ORIENT_CORNER_LB:
|
||||||
case E_GADCON_ORIENT_CORNER_RB:
|
case E_GADCON_ORIENT_CORNER_RB:
|
||||||
e_gadcon_client_aspect_set(gcc, 200, 50 * eina_list_count(volumes) + 30);
|
e_gadcon_client_aspect_set(gcc, 200, 50 * eina_list_count(volumes) + 30);
|
||||||
e_gadcon_client_min_size_set(gcc, 200, 50 * eina_list_count(volumes) + 30);
|
e_gadcon_client_min_size_set(gcc, 200, 50 * eina_list_count(volumes) + 30);
|
||||||
e_box_orientation_set(inst->o_box, 0);
|
e_box_orientation_set(inst->o_box, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
places_fill_box(inst->o_box);
|
places_fill_box(inst->o_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_gc_label(E_Gadcon_Client_Class *client_class)
|
_gc_label(E_Gadcon_Client_Class *client_class)
|
||||||
{
|
{
|
||||||
return "Places";
|
return "Places";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
_gc_id_new(E_Gadcon_Client_Class *client_class)
|
_gc_id_new(E_Gadcon_Client_Class *client_class)
|
||||||
{
|
{
|
||||||
Config_Item *ci = NULL;
|
Config_Item *ci = NULL;
|
||||||
|
|
||||||
|
@ -283,8 +283,8 @@ _gc_id_new(E_Gadcon_Client_Class *client_class)
|
||||||
return ci->id;
|
return ci->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gc_id_del(E_Gadcon_Client_Class *client_class, const char *id)
|
_gc_id_del(E_Gadcon_Client_Class *client_class, const char *id)
|
||||||
{
|
{
|
||||||
// Config_Item *ci = NULL;
|
// Config_Item *ci = NULL;
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ _gc_id_del(E_Gadcon_Client_Class *client_class, const char *id)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas)
|
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas)
|
||||||
{
|
{
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
@ -309,8 +309,8 @@ _gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Conf functions */
|
/* Conf functions */
|
||||||
static void
|
static void
|
||||||
_places_conf_new(void)
|
_places_conf_new(void)
|
||||||
{
|
{
|
||||||
Config_Item *ci = NULL;
|
Config_Item *ci = NULL;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
@ -347,16 +347,16 @@ _places_conf_new(void)
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_places_conf_free(void)
|
_places_conf_free(void)
|
||||||
{
|
{
|
||||||
while (places_conf->conf_items)
|
while (places_conf->conf_items)
|
||||||
{
|
{
|
||||||
Config_Item *ci = NULL;
|
Config_Item *ci = NULL;
|
||||||
|
|
||||||
ci = places_conf->conf_items->data;
|
ci = places_conf->conf_items->data;
|
||||||
places_conf->conf_items =
|
places_conf->conf_items =
|
||||||
eina_list_remove_list(places_conf->conf_items,
|
eina_list_remove_list(places_conf->conf_items,
|
||||||
places_conf->conf_items);
|
places_conf->conf_items);
|
||||||
if (ci->id) eina_stringshare_del(ci->id);
|
if (ci->id) eina_stringshare_del(ci->id);
|
||||||
E_FREE(ci);
|
E_FREE(ci);
|
||||||
|
@ -366,29 +366,29 @@ _places_conf_free(void)
|
||||||
E_FREE(places_conf);
|
E_FREE(places_conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_places_conf_timer(void *data)
|
_places_conf_timer(void *data)
|
||||||
{
|
{
|
||||||
e_util_dialog_show("Places Configuration Updated", data);
|
e_util_dialog_show("Places Configuration Updated", data);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Config_Item *
|
static Config_Item *
|
||||||
_places_conf_item_get(const char *id)
|
_places_conf_item_get(const char *id)
|
||||||
{
|
{
|
||||||
Eina_List *l = NULL;
|
Eina_List *l = NULL;
|
||||||
Config_Item *ci = NULL;
|
Config_Item *ci = NULL;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
if (!id)
|
if (!id)
|
||||||
{
|
{
|
||||||
/* nothing passed, return a new id */
|
/* nothing passed, return a new id */
|
||||||
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, ++uuid);
|
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, ++uuid);
|
||||||
id = buf;
|
id = buf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (l = places_conf->conf_items; l; l = l->next)
|
for (l = places_conf->conf_items; l; l = l->next)
|
||||||
{
|
{
|
||||||
if (!(ci = l->data)) continue;
|
if (!(ci = l->data)) continue;
|
||||||
if ((ci->id) && (!strcmp(ci->id, id))) return ci;
|
if ((ci->id) && (!strcmp(ci->id, id))) return ci;
|
||||||
|
@ -401,8 +401,8 @@ _places_conf_item_get(const char *id)
|
||||||
return ci;
|
return ci;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_places_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
_places_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||||
{
|
{
|
||||||
Instance *inst = NULL;
|
Instance *inst = NULL;
|
||||||
Evas_Event_Mouse_Down *ev;
|
Evas_Event_Mouse_Down *ev;
|
||||||
|
@ -412,14 +412,14 @@ _places_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||||
|
|
||||||
if (!(inst = data)) return;
|
if (!(inst = data)) return;
|
||||||
ev = event;
|
ev = event;
|
||||||
if ((ev->button == 3) && (!inst->menu))
|
if ((ev->button == 3) && (!inst->menu))
|
||||||
{
|
{
|
||||||
/* grab current zone */
|
/* grab current zone */
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
zone = e_util_zone_current_get(e_manager_current_get());
|
||||||
|
|
||||||
/* create popup menu */
|
/* create popup menu */
|
||||||
inst->menu = e_menu_new();
|
inst->menu = e_menu_new();
|
||||||
e_menu_post_deactivate_callback_set(inst->menu, _places_cb_menu_post,
|
e_menu_post_deactivate_callback_set(inst->menu, _places_cb_menu_post,
|
||||||
inst);
|
inst);
|
||||||
|
|
||||||
mi = e_menu_item_new(inst->menu);
|
mi = e_menu_item_new(inst->menu);
|
||||||
|
@ -429,20 +429,20 @@ _places_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||||
|
|
||||||
/* Each Gadget Client has a utility menu from the Container */
|
/* Each Gadget Client has a utility menu from the Container */
|
||||||
e_gadcon_client_util_menu_items_append(inst->gcc, inst->menu, 0);
|
e_gadcon_client_util_menu_items_append(inst->gcc, inst->menu, 0);
|
||||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y,
|
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
/* show the menu relative to gadgets position */
|
/* show the menu relative to gadgets position */
|
||||||
e_menu_activate_mouse(inst->menu, zone, (x + ev->output.x),
|
e_menu_activate_mouse(inst->menu, zone, (x + ev->output.x),
|
||||||
(y + ev->output.y), 1, 1,
|
(y + ev->output.y), 1, 1,
|
||||||
E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
||||||
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
|
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
|
||||||
EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_places_cb_menu_post(void *data, E_Menu *menu)
|
_places_cb_menu_post(void *data, E_Menu *menu)
|
||||||
{
|
{
|
||||||
Instance *inst = NULL;
|
Instance *inst = NULL;
|
||||||
|
|
||||||
|
@ -452,8 +452,8 @@ _places_cb_menu_post(void *data, E_Menu *menu)
|
||||||
inst->menu = NULL;
|
inst->menu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_places_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi)
|
_places_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi)
|
||||||
{
|
{
|
||||||
if (!places_conf) return;
|
if (!places_conf) return;
|
||||||
if (places_conf->cfd) return;
|
if (places_conf->cfd) return;
|
||||||
|
|
|
@ -48,10 +48,10 @@ void
|
||||||
places_init(void)
|
places_init(void)
|
||||||
{
|
{
|
||||||
volumes = NULL;
|
volumes = NULL;
|
||||||
|
|
||||||
/* theme file (maybe check if found in the current theme) */
|
/* theme file (maybe check if found in the current theme) */
|
||||||
snprintf(theme_file, PATH_MAX, "%s/e-module-places.edj", places_conf->module->dir);
|
snprintf(theme_file, PATH_MAX, "%s/e-module-places.edj", places_conf->module->dir);
|
||||||
|
|
||||||
conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
|
conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
|
||||||
if (!conn)
|
if (!conn)
|
||||||
{
|
{
|
||||||
|
@ -82,14 +82,14 @@ places_shutdown(void)
|
||||||
{
|
{
|
||||||
if (poller) ecore_timer_del(poller);
|
if (poller) ecore_timer_del(poller);
|
||||||
|
|
||||||
if (conn)
|
if (conn)
|
||||||
{
|
{
|
||||||
e_dbus_signal_handler_del(conn, sh_added);
|
e_dbus_signal_handler_del(conn, sh_added);
|
||||||
e_dbus_signal_handler_del(conn, sh_removed);
|
e_dbus_signal_handler_del(conn, sh_removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (volumes)
|
while (volumes)
|
||||||
_places_volume_del((Volume*)volumes->data);
|
_places_volume_del((Volume*)volumes->data);
|
||||||
|
|
||||||
if (conn) e_dbus_connection_close(conn);
|
if (conn) e_dbus_connection_close(conn);
|
||||||
}
|
}
|
||||||
|
@ -128,28 +128,28 @@ _places_custom_volume(Evas_Object *box, const char *label, const char *icon, con
|
||||||
/* volume object */
|
/* volume object */
|
||||||
o = edje_object_add(evas_object_evas_get(box));
|
o = edje_object_add(evas_object_evas_get(box));
|
||||||
edje_object_file_set(o, theme_file, "modules/places/main");
|
edje_object_file_set(o, theme_file, "modules/places/main");
|
||||||
|
|
||||||
/* icon */
|
/* icon */
|
||||||
i = edje_object_add(evas_object_evas_get(box));
|
i = edje_object_add(evas_object_evas_get(box));
|
||||||
//edje_object_file_set(icon, theme_file, vol->icon);
|
//edje_object_file_set(icon, theme_file, vol->icon);
|
||||||
edje_object_file_set(i, e_theme_edje_file_get("base/theme/fileman", icon),
|
edje_object_file_set(i, e_theme_edje_file_get("base/theme/fileman", icon),
|
||||||
icon);
|
icon);
|
||||||
edje_object_part_swallow(o, "icon", i);
|
edje_object_part_swallow(o, "icon", i);
|
||||||
|
|
||||||
/* label */
|
/* label */
|
||||||
edje_object_part_text_set(o, "volume_label", label);
|
edje_object_part_text_set(o, "volume_label", label);
|
||||||
|
|
||||||
/* gauge */
|
/* gauge */
|
||||||
edje_object_signal_emit(o, "gauge,hide", "places");
|
edje_object_signal_emit(o, "gauge,hide", "places");
|
||||||
edje_object_part_text_set(o, "size_label", "");
|
edje_object_part_text_set(o, "size_label", "");
|
||||||
|
|
||||||
|
|
||||||
/* orient the separator*/
|
/* orient the separator*/
|
||||||
if (!e_box_orientation_get(box))
|
if (!e_box_orientation_get(box))
|
||||||
edje_object_signal_emit(o, "separator,set,horiz", "places");
|
edje_object_signal_emit(o, "separator,set,horiz", "places");
|
||||||
else
|
else
|
||||||
edje_object_signal_emit(o, "separator,set,vert", "places");
|
edje_object_signal_emit(o, "separator,set,vert", "places");
|
||||||
|
|
||||||
/* connect signals from edje */
|
/* connect signals from edje */
|
||||||
edje_object_signal_callback_add(o, "icon,activated", "places",
|
edje_object_signal_callback_add(o, "icon,activated", "places",
|
||||||
_places_custom_icon_activated_cb, (void*)uri);
|
_places_custom_icon_activated_cb, (void*)uri);
|
||||||
|
@ -158,16 +158,13 @@ _places_custom_volume(Evas_Object *box, const char *label, const char *icon, con
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
edje_object_size_min_get(o, &min_w, &min_h);
|
edje_object_size_min_get(o, &min_w, &min_h);
|
||||||
edje_object_size_max_get(o, &max_w, &max_h);
|
edje_object_size_max_get(o, &max_w, &max_h);
|
||||||
//if (!strcmp(vol->mount_point, "/"))
|
e_box_pack_end(box, o);
|
||||||
// e_box_pack_start(box, o);
|
|
||||||
//else
|
|
||||||
e_box_pack_end(box, o);
|
|
||||||
e_box_pack_options_set(o,
|
e_box_pack_options_set(o,
|
||||||
1, 0, /* fill */
|
1, 0, /* fill */
|
||||||
1, 0, /* expand */
|
1, 0, /* expand */
|
||||||
0.5, 0.0, /* align */
|
0.5, 0.0, /* align */
|
||||||
min_w, min_h, /* min */
|
min_w, min_h, /* min */
|
||||||
max_w, max_h /* max */
|
max_w, max_h /* max */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,102 +191,102 @@ places_fill_box(Evas_Object *box)
|
||||||
|
|
||||||
volumes = eina_list_sort(volumes, 0, _places_volume_sort_cb);
|
volumes = eina_list_sort(volumes, 0, _places_volume_sort_cb);
|
||||||
for (l = volumes; l; l = l->next)
|
for (l = volumes; l; l = l->next)
|
||||||
{
|
{
|
||||||
Volume *vol = l->data;
|
Volume *vol = l->data;
|
||||||
|
|
||||||
if (!vol->valid) continue;
|
if (!vol->valid) continue;
|
||||||
|
|
||||||
/* volume object */
|
/* volume object */
|
||||||
o = edje_object_add(evas_object_evas_get(box));
|
o = edje_object_add(evas_object_evas_get(box));
|
||||||
edje_object_file_set(o, theme_file, "modules/places/main");
|
edje_object_file_set(o, theme_file, "modules/places/main");
|
||||||
vol->obj = o;
|
vol->obj = o;
|
||||||
|
|
||||||
//set volume label
|
//set volume label
|
||||||
if (vol->label && strlen(vol->label) > 0)
|
if (vol->label && strlen(vol->label) > 0)
|
||||||
edje_object_part_text_set(o, "volume_label", vol->label);
|
edje_object_part_text_set(o, "volume_label", vol->label);
|
||||||
else if (vol->mount_point && !strcmp(vol->mount_point, "/"))
|
else if (vol->mount_point && !strcmp(vol->mount_point, "/"))
|
||||||
edje_object_part_text_set(o, "volume_label", D_("Filesystem"));
|
edje_object_part_text_set(o, "volume_label", D_("Filesystem"));
|
||||||
else if (vol->mount_point && strlen(vol->mount_point) > 0)
|
else if (vol->mount_point && strlen(vol->mount_point) > 0)
|
||||||
edje_object_part_text_set(o, "volume_label",
|
edje_object_part_text_set(o, "volume_label",
|
||||||
ecore_file_file_get(vol->mount_point));
|
ecore_file_file_get(vol->mount_point));
|
||||||
else
|
else
|
||||||
edje_object_part_text_set(o, "volume_label", D_("No Name"));
|
edje_object_part_text_set(o, "volume_label", D_("No Name"));
|
||||||
|
|
||||||
//set free label e gauge
|
//set free label e gauge
|
||||||
_places_update_size(o, vol);
|
_places_update_size(o, vol);
|
||||||
|
|
||||||
//choose icon
|
//choose icon
|
||||||
vol->icon = "e/icons/drive-harddisk";
|
vol->icon = "e/icons/drive-harddisk";
|
||||||
if (!strcmp(vol->drive_type, "cdrom"))
|
if (!strcmp(vol->drive_type, "cdrom"))
|
||||||
vol->icon = "e/icons/drive-optical";
|
vol->icon = "e/icons/drive-optical";
|
||||||
else if (!strcmp(vol->model, "\"PSP\" MS"))
|
else if (!strcmp(vol->model, "\"PSP\" MS"))
|
||||||
vol->icon = "modules/places/icon/psp";
|
vol->icon = "modules/places/icon/psp";
|
||||||
else if (!strcmp(vol->drive_type, "sd_mmc"))
|
else if (!strcmp(vol->drive_type, "sd_mmc"))
|
||||||
vol->icon = "modules/places/icon/sdmmc";
|
vol->icon = "modules/places/icon/sdmmc";
|
||||||
else if (!strcmp(vol->drive_type, "memory_stick"))
|
else if (!strcmp(vol->drive_type, "memory_stick"))
|
||||||
vol->icon = "modules/places/icon/ms";
|
vol->icon = "modules/places/icon/ms";
|
||||||
else if (!strcmp(vol->model, "iPod"))
|
else if (!strcmp(vol->model, "iPod"))
|
||||||
vol->icon = "modules/places/icon/ipod";
|
vol->icon = "modules/places/icon/ipod";
|
||||||
else if (!strcmp(vol->bus, "usb") && !strcmp(vol->drive_type, "disk"))
|
else if (!strcmp(vol->bus, "usb") && !strcmp(vol->drive_type, "disk"))
|
||||||
vol->icon = "e/icons/drive-removable-media";
|
vol->icon = "e/icons/drive-removable-media";
|
||||||
|
|
||||||
//set partition type tag
|
//set partition type tag
|
||||||
if (!strcmp(vol->fstype, "ext2") || !strcmp(vol->fstype, "ext3") ||
|
if (!strcmp(vol->fstype, "ext2") || !strcmp(vol->fstype, "ext3") ||
|
||||||
!strcmp(vol->fstype, "ext4") || !strcmp(vol->fstype, "reiserfs"))
|
!strcmp(vol->fstype, "ext4") || !strcmp(vol->fstype, "reiserfs"))
|
||||||
edje_object_signal_emit(o, "icon,tag,ext3", "places");
|
edje_object_signal_emit(o, "icon,tag,ext3", "places");
|
||||||
else if (!strcmp(vol->fstype, "vfat") || !strcmp(vol->fstype, "ntfs") ||
|
else if (!strcmp(vol->fstype, "vfat") || !strcmp(vol->fstype, "ntfs") ||
|
||||||
!strcmp(vol->fstype, "ntfs-3g"))
|
!strcmp(vol->fstype, "ntfs-3g"))
|
||||||
edje_object_signal_emit(o, "icon,tag,fat", "places");
|
edje_object_signal_emit(o, "icon,tag,fat", "places");
|
||||||
else if (!strcmp(vol->fstype, "hfs") || !strcmp(vol->fstype, "hfsplus"))
|
else if (!strcmp(vol->fstype, "hfs") || !strcmp(vol->fstype, "hfsplus"))
|
||||||
edje_object_signal_emit(o, "icon,tag,hfs", "places");
|
edje_object_signal_emit(o, "icon,tag,hfs", "places");
|
||||||
else if (!strcmp(vol->fstype, "udf"))
|
else if (!strcmp(vol->fstype, "udf"))
|
||||||
edje_object_signal_emit(o, "icon,tag,dvd", "places");
|
edje_object_signal_emit(o, "icon,tag,dvd", "places");
|
||||||
|
|
||||||
//set icon
|
//set icon
|
||||||
icon = edje_object_add(evas_object_evas_get(box));
|
icon = edje_object_add(evas_object_evas_get(box));
|
||||||
if (strncmp(vol->icon, "e/", 2))
|
if (strncmp(vol->icon, "e/", 2))
|
||||||
edje_object_file_set(icon, theme_file, vol->icon);
|
edje_object_file_set(icon, theme_file, vol->icon);
|
||||||
else
|
else
|
||||||
edje_object_file_set(icon,
|
edje_object_file_set(icon,
|
||||||
e_theme_edje_file_get("base/theme/fileman",
|
e_theme_edje_file_get("base/theme/fileman",
|
||||||
vol->icon), vol->icon);
|
vol->icon), vol->icon);
|
||||||
edje_object_part_swallow(o, "icon", icon);
|
edje_object_part_swallow(o, "icon", icon);
|
||||||
|
|
||||||
//set mount/eject icon
|
//set mount/eject icon
|
||||||
if (vol->requires_eject || (vol->mounted && strcmp(vol->mount_point, "/")) ||
|
if (vol->requires_eject || (vol->mounted && strcmp(vol->mount_point, "/")) ||
|
||||||
!strcmp(vol->bus, "usb")) //Some usb key don't have requires_eject set (probably an hal error)
|
!strcmp(vol->bus, "usb")) //Some usb key don't have requires_eject set (probably an hal error)
|
||||||
edje_object_signal_emit(o, "icon,eject,show", "places");
|
edje_object_signal_emit(o, "icon,eject,show", "places");
|
||||||
else
|
else
|
||||||
edje_object_signal_emit(o, "icon,eject,hide", "places");
|
edje_object_signal_emit(o, "icon,eject,hide", "places");
|
||||||
|
|
||||||
/* orient the separator*/
|
/* orient the separator*/
|
||||||
if (!e_box_orientation_get(box))
|
if (!e_box_orientation_get(box))
|
||||||
edje_object_signal_emit(o, "separator,set,horiz", "places");
|
edje_object_signal_emit(o, "separator,set,horiz", "places");
|
||||||
else
|
else
|
||||||
edje_object_signal_emit(o, "separator,set,vert", "places");
|
edje_object_signal_emit(o, "separator,set,vert", "places");
|
||||||
|
|
||||||
/* connect signals from edje */
|
|
||||||
edje_object_signal_callback_add(o, "icon,activated", "places",
|
|
||||||
_places_icon_activated_cb, vol);
|
|
||||||
edje_object_signal_callback_add(o, "eject,activated", "places",
|
|
||||||
_places_eject_activated_cb, vol);
|
|
||||||
|
|
||||||
/* pack the volume in the box */
|
/* connect signals from edje */
|
||||||
evas_object_show(o);
|
edje_object_signal_callback_add(o, "icon,activated", "places",
|
||||||
edje_object_size_min_get(o, &min_w, &min_h);
|
_places_icon_activated_cb, vol);
|
||||||
edje_object_size_max_get(o, &max_w, &max_h);
|
edje_object_signal_callback_add(o, "eject,activated", "places",
|
||||||
if (!strcmp(vol->mount_point, "/"))
|
_places_eject_activated_cb, vol);
|
||||||
e_box_pack_start(box, o);
|
|
||||||
else
|
/* pack the volume in the box */
|
||||||
e_box_pack_end(box, o);
|
evas_object_show(o);
|
||||||
e_box_pack_options_set(o,
|
edje_object_size_min_get(o, &min_w, &min_h);
|
||||||
1, 0, /* fill */
|
edje_object_size_max_get(o, &max_w, &max_h);
|
||||||
1, 0, /* expand */
|
if (!strcmp(vol->mount_point, "/"))
|
||||||
0.5, 0.0, /* align */
|
e_box_pack_start(box, o);
|
||||||
min_w, min_h, /* min */
|
else
|
||||||
max_w, max_h /* max */
|
e_box_pack_end(box, o);
|
||||||
);
|
e_box_pack_options_set(o,
|
||||||
}
|
1, 0, /* fill */
|
||||||
|
1, 0, /* expand */
|
||||||
|
0.5, 0.0, /* align */
|
||||||
|
min_w, min_h, /* min */
|
||||||
|
max_w, max_h /* max */
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -300,23 +297,23 @@ places_empty_box(Evas_Object *box)
|
||||||
e_box_freeze(box);
|
e_box_freeze(box);
|
||||||
count = e_box_pack_count_get(box);
|
count = e_box_pack_count_get(box);
|
||||||
while (count >= 0)
|
while (count >= 0)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Evas_Object *swal;
|
Evas_Object *swal;
|
||||||
|
|
||||||
o = e_box_pack_object_nth(box, count);
|
o = e_box_pack_object_nth(box, count);
|
||||||
swal = edje_object_part_swallow_get(o, "icon");
|
swal = edje_object_part_swallow_get(o, "icon");
|
||||||
if (swal)
|
if (swal)
|
||||||
{
|
{
|
||||||
edje_object_part_unswallow(o, swal);
|
edje_object_part_unswallow(o, swal);
|
||||||
evas_object_del(swal);
|
evas_object_del(swal);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_box_unpack(o);
|
e_box_unpack(o);
|
||||||
evas_object_del(o);
|
evas_object_del(o);
|
||||||
|
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
e_box_thaw(box);
|
e_box_thaw(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,33 +330,34 @@ places_parse_bookmarks(E_Menu *em)
|
||||||
snprintf(buf, sizeof(buf), "%s/.gtk-bookmarks", e_user_homedir_get());
|
snprintf(buf, sizeof(buf), "%s/.gtk-bookmarks", e_user_homedir_get());
|
||||||
fp = fopen(buf, "r");
|
fp = fopen(buf, "r");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
while(fgets(line, sizeof(line), fp))
|
while(fgets(line, sizeof(line), fp))
|
||||||
{
|
{
|
||||||
alias = NULL;
|
alias = NULL;
|
||||||
line[strlen(line) - 1] = '\0';
|
line[strlen(line) - 1] = '\0';
|
||||||
alias = strchr(line, ' ');
|
alias = strchr(line, ' ');
|
||||||
if (alias)
|
if (alias)
|
||||||
{
|
{
|
||||||
line[alias-line] = '\0';
|
line[alias-line] = '\0';
|
||||||
alias++;
|
alias++;
|
||||||
}
|
}
|
||||||
uri = efreet_uri_decode(line);
|
uri = efreet_uri_decode(line);
|
||||||
if (uri && uri->path)
|
if (uri && uri->path)
|
||||||
{
|
{
|
||||||
if (ecore_file_exists(uri->path))
|
if (ecore_file_exists(uri->path))
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_label_set(mi, alias ? alias :
|
e_menu_item_label_set(mi, alias ? alias :
|
||||||
ecore_file_file_get(uri->path));
|
ecore_file_file_get(uri->path));
|
||||||
e_util_menu_item_theme_icon_set(mi, "folder");
|
e_util_menu_item_theme_icon_set(mi, "folder");
|
||||||
e_menu_item_callback_set(mi, _places_run_fm, strdup(uri->path)); //TODO free somewhere
|
e_menu_item_callback_set(mi, _places_run_fm,
|
||||||
}
|
strdup(uri->path)); //TODO free somewhere
|
||||||
}
|
}
|
||||||
if (uri) efreet_uri_free(uri);
|
}
|
||||||
}
|
if (uri) efreet_uri_free(uri);
|
||||||
fclose(fp);
|
}
|
||||||
}
|
fclose(fp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -376,97 +374,97 @@ places_generate_menu(void *data, E_Menu *em)
|
||||||
|
|
||||||
/* Home */
|
/* Home */
|
||||||
if (places_conf->show_home)
|
if (places_conf->show_home)
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_label_set(mi, D_("Home"));
|
e_menu_item_label_set(mi, D_("Home"));
|
||||||
e_util_menu_item_theme_icon_set(mi, "user-home");
|
e_util_menu_item_theme_icon_set(mi, "user-home");
|
||||||
e_menu_item_callback_set(mi, _places_run_fm, (char*)e_user_homedir_get());
|
e_menu_item_callback_set(mi, _places_run_fm, (char*)e_user_homedir_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Desktop */
|
/* Desktop */
|
||||||
if (places_conf->show_desk)
|
if (places_conf->show_desk)
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_label_set(mi, D_("Desktop"));
|
e_menu_item_label_set(mi, D_("Desktop"));
|
||||||
e_util_menu_item_theme_icon_set(mi, "user-desktop");
|
e_util_menu_item_theme_icon_set(mi, "user-desktop");
|
||||||
snprintf(buf, sizeof(buf), "%s/Desktop", (char*)e_user_homedir_get());
|
snprintf(buf, sizeof(buf), "%s/Desktop", (char*)e_user_homedir_get());
|
||||||
e_menu_item_callback_set(mi, _places_run_fm, strdup(buf)); //TODO free somewhere
|
e_menu_item_callback_set(mi, _places_run_fm, strdup(buf)); //TODO free somewhere
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trash */
|
/* Trash */
|
||||||
if (places_conf->show_trash)
|
if (places_conf->show_trash)
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_label_set(mi, D_("Trash"));
|
e_menu_item_label_set(mi, D_("Trash"));
|
||||||
e_util_menu_item_theme_icon_set(mi, "folder");
|
e_util_menu_item_theme_icon_set(mi, "folder");
|
||||||
e_menu_item_callback_set(mi, _places_run_fm, "trash:///");
|
e_menu_item_callback_set(mi, _places_run_fm, "trash:///");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File System */
|
/* File System */
|
||||||
if (places_conf->show_root)
|
if (places_conf->show_root)
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_label_set(mi, D_("Filesystem"));
|
e_menu_item_label_set(mi, D_("Filesystem"));
|
||||||
e_util_menu_item_theme_icon_set(mi, "drive-harddisk");
|
e_util_menu_item_theme_icon_set(mi, "drive-harddisk");
|
||||||
e_menu_item_callback_set(mi, _places_run_fm, "/");
|
e_menu_item_callback_set(mi, _places_run_fm, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Temp */
|
/* Temp */
|
||||||
if (places_conf->show_temp)
|
if (places_conf->show_temp)
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_label_set(mi, D_("Temp"));
|
e_menu_item_label_set(mi, D_("Temp"));
|
||||||
e_util_menu_item_theme_icon_set(mi, "user-temp");
|
e_util_menu_item_theme_icon_set(mi, "user-temp");
|
||||||
e_menu_item_callback_set(mi, _places_run_fm, "/tmp");
|
e_menu_item_callback_set(mi, _places_run_fm, "/tmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
//separator
|
//separator
|
||||||
if (places_conf->show_home || places_conf->show_desk ||
|
if (places_conf->show_home || places_conf->show_desk ||
|
||||||
places_conf->show_trash || places_conf->show_root ||
|
places_conf->show_trash || places_conf->show_root ||
|
||||||
places_conf->show_temp)
|
places_conf->show_temp)
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_separator_set(mi, 1);
|
e_menu_item_separator_set(mi, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Volumes */
|
/* Volumes */
|
||||||
Eina_Bool volumes_visible = 0;
|
Eina_Bool volumes_visible = 0;
|
||||||
const Eina_List *l;
|
const Eina_List *l;
|
||||||
Volume *vol;
|
Volume *vol;
|
||||||
EINA_LIST_FOREACH(volumes, l, vol)
|
EINA_LIST_FOREACH(volumes, l, vol)
|
||||||
{
|
{
|
||||||
if (!vol->valid) continue;
|
if (!vol->valid) continue;
|
||||||
if (vol->mount_point && !strcmp(vol->mount_point, "/")) continue;
|
if (vol->mount_point && !strcmp(vol->mount_point, "/")) continue;
|
||||||
|
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
if ((vol->label) && (vol->label[0] != '\0'))
|
if ((vol->label) && (vol->label[0] != '\0'))
|
||||||
e_menu_item_label_set(mi, vol->label);
|
e_menu_item_label_set(mi, vol->label);
|
||||||
else
|
else
|
||||||
e_menu_item_label_set(mi, ecore_file_file_get(vol->mount_point));
|
e_menu_item_label_set(mi, ecore_file_file_get(vol->mount_point));
|
||||||
|
|
||||||
if (vol->icon)
|
if (vol->icon)
|
||||||
{
|
{
|
||||||
if (strncmp(vol->icon, "e/", 2))
|
if (strncmp(vol->icon, "e/", 2))
|
||||||
e_menu_item_icon_edje_set(mi, theme_file, vol->icon);
|
e_menu_item_icon_edje_set(mi, theme_file, vol->icon);
|
||||||
else
|
else
|
||||||
e_menu_item_icon_edje_set(mi,
|
e_menu_item_icon_edje_set(mi,
|
||||||
e_theme_edje_file_get("base/theme/fileman",
|
e_theme_edje_file_get("base/theme/fileman",
|
||||||
vol->icon), vol->icon);
|
vol->icon), vol->icon);
|
||||||
}
|
}
|
||||||
e_menu_item_callback_set(mi, places_menu_click_cb, (void*)vol);
|
e_menu_item_callback_set(mi, places_menu_click_cb, (void*)vol);
|
||||||
volumes_visible = 1;
|
volumes_visible = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Favorites */
|
/* Favorites */
|
||||||
if (places_conf->show_bookm)
|
if (places_conf->show_bookm)
|
||||||
{
|
{
|
||||||
if (volumes_visible)
|
if (volumes_visible)
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(em);
|
mi = e_menu_item_new(em);
|
||||||
e_menu_item_separator_set(mi, 1);
|
e_menu_item_separator_set(mi, 1);
|
||||||
}
|
}
|
||||||
places_parse_bookmarks(em);
|
places_parse_bookmarks(em);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_menu_pre_activate_callback_set(em, NULL, NULL);
|
e_menu_pre_activate_callback_set(em, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -523,7 +521,7 @@ _places_volume_add(const char *udi)
|
||||||
{
|
{
|
||||||
Volume *v;
|
Volume *v;
|
||||||
if (!udi) return;
|
if (!udi) return;
|
||||||
|
|
||||||
v = E_NEW(Volume, 1);
|
v = E_NEW(Volume, 1);
|
||||||
if (!v) return;
|
if (!v) return;
|
||||||
|
|
||||||
|
@ -533,16 +531,16 @@ _places_volume_add(const char *udi)
|
||||||
v->icon = NULL;
|
v->icon = NULL;
|
||||||
v->to_mount = 0;
|
v->to_mount = 0;
|
||||||
v->force_open = 0;
|
v->force_open = 0;
|
||||||
|
|
||||||
if (places_conf->auto_mount)
|
if (places_conf->auto_mount)
|
||||||
v->to_mount = 1;
|
v->to_mount = 1;
|
||||||
|
|
||||||
if (places_conf->auto_open)
|
if (places_conf->auto_open)
|
||||||
v->force_open = 1;
|
v->force_open = 1;
|
||||||
|
|
||||||
volumes = eina_list_append(volumes, v);
|
volumes = eina_list_append(volumes, v);
|
||||||
e_hal_device_get_all_properties(conn, v->udi, _places_volume_properties_cb, v);
|
e_hal_device_get_all_properties(conn, v->udi, _places_volume_properties_cb, v);
|
||||||
|
|
||||||
v->sh_prop = e_dbus_signal_handler_add(conn, "org.freedesktop.Hal", v->udi,
|
v->sh_prop = e_dbus_signal_handler_add(conn, "org.freedesktop.Hal", v->udi,
|
||||||
"org.freedesktop.Hal.Device",
|
"org.freedesktop.Hal.Device",
|
||||||
"PropertyModified",
|
"PropertyModified",
|
||||||
|
@ -571,28 +569,28 @@ _places_human_size_get(unsigned long long size)
|
||||||
{
|
{
|
||||||
double dsize;
|
double dsize;
|
||||||
char hum[32], *suffix;
|
char hum[32], *suffix;
|
||||||
|
|
||||||
dsize = (double)size;
|
dsize = (double)size;
|
||||||
if (dsize < 1024)
|
if (dsize < 1024)
|
||||||
snprintf(hum, sizeof(hum), "%.0fb", dsize);
|
snprintf(hum, sizeof(hum), "%.0fb", dsize);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dsize /= 1024.0;
|
dsize /= 1024.0;
|
||||||
if (dsize < 1024)
|
if (dsize < 1024)
|
||||||
suffix = "KB";
|
suffix = "KB";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dsize /= 1024.0;
|
dsize /= 1024.0;
|
||||||
if (dsize < 1024)
|
if (dsize < 1024)
|
||||||
suffix = "MB";
|
suffix = "MB";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dsize /= 1024.0;
|
dsize /= 1024.0;
|
||||||
suffix = "GB";
|
suffix = "GB";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snprintf(hum, sizeof(hum), "%.1f%s", dsize, suffix);
|
snprintf(hum, sizeof(hum), "%.1f%s", dsize, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
return eina_stringshare_add(hum);
|
return eina_stringshare_add(hum);
|
||||||
}
|
}
|
||||||
|
@ -604,7 +602,7 @@ _places_free_space_get(const char *mount)
|
||||||
//printf("GET SPACE of %s\n", mount);
|
//printf("GET SPACE of %s\n", mount);
|
||||||
if (!mount) return 0;
|
if (!mount) return 0;
|
||||||
if (statvfs(mount, &s) != 0)
|
if (statvfs(mount, &s) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
//printf(" SPACE %d\n", (s.f_bfree * s.f_bsize));
|
//printf(" SPACE %d\n", (s.f_bfree * s.f_bsize));
|
||||||
return (unsigned long long)s.f_bavail * (unsigned long long)s.f_bsize;
|
return (unsigned long long)s.f_bavail * (unsigned long long)s.f_bsize;
|
||||||
}
|
}
|
||||||
|
@ -616,7 +614,7 @@ _places_error_show(const char *title, const char *text1, const char *text2, cons
|
||||||
E_Dialog *dia;
|
E_Dialog *dia;
|
||||||
|
|
||||||
snprintf(str, sizeof(str),"%s<br><br>%s<br>%s", text1, text2, text3);
|
snprintf(str, sizeof(str),"%s<br><br>%s<br>%s", text1, text2, text3);
|
||||||
|
|
||||||
dia = e_dialog_new(NULL, "E", "_places_error");
|
dia = e_dialog_new(NULL, "E", "_places_error");
|
||||||
e_dialog_title_set(dia, title);
|
e_dialog_title_set(dia, title);
|
||||||
e_dialog_icon_set(dia, "drive-harddisk", 64);
|
e_dialog_icon_set(dia, "drive-harddisk", 64);
|
||||||
|
@ -641,8 +639,8 @@ _places_run_fm(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
|
|
||||||
if (places_conf->fm && (places_conf->fm[0] != '\0'))
|
if (places_conf->fm && (places_conf->fm[0] != '\0'))
|
||||||
{
|
{
|
||||||
_places_run_fm_external(places_conf->fm, directory);
|
_places_run_fm_external(places_conf->fm, directory);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
E_Action *act = e_action_find("fileman");
|
E_Action *act = e_action_find("fileman");
|
||||||
|
@ -661,44 +659,44 @@ _places_update_size(Evas_Object *obj, Volume *vol)
|
||||||
char buf2[16];
|
char buf2[16];
|
||||||
const char *tot_h, *free_h;
|
const char *tot_h, *free_h;
|
||||||
unsigned long long free;
|
unsigned long long free;
|
||||||
|
|
||||||
//Free label
|
//Free label
|
||||||
tot_h = _places_human_size_get(vol->size);
|
tot_h = _places_human_size_get(vol->size);
|
||||||
if (vol->mounted)
|
if (vol->mounted)
|
||||||
{
|
{
|
||||||
free = _places_free_space_get(vol->mount_point);
|
free = _places_free_space_get(vol->mount_point);
|
||||||
free_h = _places_human_size_get(free);
|
free_h = _places_human_size_get(free);
|
||||||
snprintf(buf, sizeof(buf), "%s %s %s",free_h, D_("free of"),tot_h);
|
snprintf(buf, sizeof(buf), "%s %s %s", free_h, D_("free of"), tot_h);
|
||||||
edje_object_part_text_set(obj, "size_label", buf);
|
edje_object_part_text_set(obj, "size_label", buf);
|
||||||
eina_stringshare_del(free_h);
|
eina_stringshare_del(free_h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), D_("%s Not Mounted"), tot_h);
|
snprintf(buf, sizeof(buf), D_("%s Not Mounted"), tot_h);
|
||||||
edje_object_part_text_set(obj, "size_label", buf);
|
edje_object_part_text_set(obj, "size_label", buf);
|
||||||
}
|
}
|
||||||
eina_stringshare_del(tot_h);
|
eina_stringshare_del(tot_h);
|
||||||
|
|
||||||
//Gauge
|
//Gauge
|
||||||
int percent;
|
int percent;
|
||||||
Edje_Message_Float msg_float;
|
Edje_Message_Float msg_float;
|
||||||
|
|
||||||
if (vol->mounted)
|
if (vol->mounted)
|
||||||
{
|
{
|
||||||
percent = 100 - (((long double)free / (long double)vol->size) * 100);
|
percent = 100 - (((long double)free / (long double)vol->size) * 100);
|
||||||
snprintf(buf2, sizeof(buf2), "%d%%", percent);
|
snprintf(buf2, sizeof(buf2), "%d%%", percent);
|
||||||
edje_object_part_text_set(obj, "percent_label", buf2);
|
edje_object_part_text_set(obj, "percent_label", buf2);
|
||||||
|
|
||||||
msg_float.val = (float)percent / 100;
|
msg_float.val = (float)percent / 100;
|
||||||
edje_object_message_send(obj, EDJE_MESSAGE_FLOAT, 1, &msg_float);
|
edje_object_message_send(obj, EDJE_MESSAGE_FLOAT, 1, &msg_float);
|
||||||
edje_object_part_text_set(obj, "eject_label", D_("unmount"));
|
edje_object_part_text_set(obj, "eject_label", D_("unmount"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
edje_object_signal_emit(obj, "gauge,hide", "places");
|
edje_object_signal_emit(obj, "gauge,hide", "places");
|
||||||
edje_object_part_text_set(obj, "percent_label", "");
|
edje_object_part_text_set(obj, "percent_label", "");
|
||||||
edje_object_part_text_set(obj, "eject_label", D_("eject"));
|
edje_object_part_text_set(obj, "eject_label", D_("eject"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -708,11 +706,12 @@ _places_mount_volume(Volume *vol)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
if ((!strcmp(vol->fstype, "vfat")) || (!strcmp(vol->fstype, "ntfs")))
|
if ((!strcmp(vol->fstype, "vfat")) || (!strcmp(vol->fstype, "ntfs")))
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "uid=%i", (int)getuid());
|
snprintf(buf, sizeof(buf), "uid=%i", (int)getuid());
|
||||||
opt = eina_list_append(opt, buf);
|
opt = eina_list_append(opt, buf);
|
||||||
}
|
}
|
||||||
e_hal_device_volume_mount(conn, vol->udi, vol->mount_point, vol->fstype, opt, _places_mount_cb, vol);
|
e_hal_device_volume_mount(conn, vol->udi, vol->mount_point, vol->fstype,
|
||||||
|
opt, _places_mount_cb, vol);
|
||||||
vol->to_mount = 0;
|
vol->to_mount = 0;
|
||||||
eina_list_free(opt);
|
eina_list_free(opt);
|
||||||
}
|
}
|
||||||
|
@ -728,12 +727,12 @@ _places_icon_activated_cb(void *data, Evas_Object *o, const char *emission, cons
|
||||||
vol = data;
|
vol = data;
|
||||||
|
|
||||||
if (vol->mounted)
|
if (vol->mounted)
|
||||||
_places_run_fm((void*)vol->mount_point, NULL, NULL);
|
_places_run_fm((void*)vol->mount_point, NULL, NULL);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vol->force_open = 1;
|
vol->force_open = 1;
|
||||||
_places_mount_volume(vol);
|
_places_mount_volume(vol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -749,10 +748,10 @@ _places_eject_activated_cb(void *data, Evas_Object *o, const char *emission, con
|
||||||
Volume *vol = data;
|
Volume *vol = data;
|
||||||
|
|
||||||
if (vol->mounted)
|
if (vol->mounted)
|
||||||
e_hal_device_volume_unmount(conn, vol->udi, NULL, _places_unmount_cb, vol);
|
e_hal_device_volume_unmount(conn, vol->udi, NULL, _places_unmount_cb, vol);
|
||||||
else
|
else
|
||||||
e_hal_device_volume_eject(conn, vol->udi, NULL, _places_eject_cb, vol);
|
e_hal_device_volume_eject(conn, vol->udi, NULL, _places_eject_cb, vol);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************/
|
/***********************/
|
||||||
|
@ -764,10 +763,10 @@ _places_open_when_mounted(void *data)
|
||||||
Volume *vol = data;
|
Volume *vol = data;
|
||||||
|
|
||||||
if (vol->mount_point)
|
if (vol->mount_point)
|
||||||
{
|
{
|
||||||
_places_run_fm((void*)vol->mount_point, NULL, NULL);
|
_places_run_fm((void*)vol->mount_point, NULL, NULL);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -778,17 +777,17 @@ _places_mount_cb(void *user_data, void *method_return, DBusError *error)
|
||||||
Volume *vol = user_data;
|
Volume *vol = user_data;
|
||||||
|
|
||||||
if (dbus_error_is_set(error))
|
if (dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
_places_error_show("Mount Error", "Can't mount device.",error->name, error->message);
|
_places_error_show("Mount Error", "Can't mount device.",error->name, error->message);
|
||||||
dbus_error_free(error);
|
dbus_error_free(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vol->force_open)
|
if (vol->force_open)
|
||||||
{
|
{
|
||||||
ecore_timer_add(0.1, _places_open_when_mounted, vol);
|
ecore_timer_add(0.1, _places_open_when_mounted, vol);
|
||||||
vol->force_open = 0;
|
vol->force_open = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -797,10 +796,10 @@ _places_unmount_cb(void *user_data, void *method_return, DBusError *error)
|
||||||
Volume *vol = user_data;
|
Volume *vol = user_data;
|
||||||
|
|
||||||
if (dbus_error_is_set(error))
|
if (dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
_places_error_show("Unmount Error", "Can't unmount device.",error->name, error->message);
|
_places_error_show("Unmount Error", "Can't unmount device.",error->name, error->message);
|
||||||
dbus_error_free(error);
|
dbus_error_free(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -809,10 +808,11 @@ _places_eject_cb(void *user_data, void *method_return, DBusError *error)
|
||||||
Volume *vol = user_data;
|
Volume *vol = user_data;
|
||||||
|
|
||||||
if (dbus_error_is_set(error))
|
if (dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
_places_error_show("Eject Error", "Can't eject device.",error->name, error->message);
|
_places_error_show("Eject Error", "Can't eject device.",
|
||||||
dbus_error_free(error);
|
error->name, error->message);
|
||||||
}
|
dbus_error_free(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dbus CB - Generic device added */
|
/* Dbus CB - Generic device added */
|
||||||
|
@ -826,8 +826,7 @@ _places_device_add_cb(void *data, DBusMessage *msg)
|
||||||
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
|
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
//printf("PLACES DBUS CB UDI:%s\n", udi);
|
//printf("PLACES DBUS CB UDI:%s\n", udi);
|
||||||
e_hal_device_query_capability(conn, udi, "volume",
|
e_hal_device_query_capability(conn, udi, "volume", _places_volume_cb,
|
||||||
_places_volume_cb,
|
|
||||||
(void*)eina_stringshare_add(udi));
|
(void*)eina_stringshare_add(udi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,13 +843,13 @@ _places_device_rem_cb(void *data, DBusMessage *msg)
|
||||||
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
|
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(volumes, l, v)
|
EINA_LIST_FOREACH(volumes, l, v)
|
||||||
if (!strcmp(v->udi, udi))
|
if (!strcmp(v->udi, udi))
|
||||||
{
|
{
|
||||||
//~ printf("PLACES Removed %s\n", v->udi);
|
//~ printf("PLACES Removed %s\n", v->udi);
|
||||||
_places_volume_del(v);
|
_places_volume_del(v);
|
||||||
places_update_all_gadgets();
|
places_update_all_gadgets();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dbus CB - Called when a device change some properties */
|
/* Dbus CB - Called when a device change some properties */
|
||||||
|
@ -869,19 +868,19 @@ _places_volume_all_cb(void *user_data, void *reply_data, DBusError *error)
|
||||||
E_Hal_Manager_Find_Device_By_Capability_Return *ret = reply_data;
|
E_Hal_Manager_Find_Device_By_Capability_Return *ret = reply_data;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *udi;
|
char *udi;
|
||||||
|
|
||||||
if (!ret || !ret->strings) return;
|
if (!ret || !ret->strings) return;
|
||||||
|
|
||||||
if (dbus_error_is_set(error))
|
if (dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
// XXX handle...
|
// XXX handle...
|
||||||
dbus_error_free(error);
|
dbus_error_free(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(ret->strings, l, udi)
|
EINA_LIST_FOREACH(ret->strings, l, udi)
|
||||||
_places_volume_add(udi);
|
_places_volume_add(udi);
|
||||||
|
|
||||||
//TODO free ret??
|
//TODO free ret??
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,10 +893,10 @@ _places_volume_cb(void *user_data, void *reply_data, DBusError *error)
|
||||||
E_Hal_Device_Query_Capability_Return *ret = reply_data;
|
E_Hal_Device_Query_Capability_Return *ret = reply_data;
|
||||||
|
|
||||||
if (ret && ret->boolean)
|
if (ret && ret->boolean)
|
||||||
{
|
{
|
||||||
//~ printf("PLACES DBUS CB UDI:%s\n", udi);
|
//~ printf("PLACES DBUS CB UDI:%s\n", udi);
|
||||||
_places_volume_add(udi);
|
_places_volume_add(udi);
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_stringshare_del(udi);
|
eina_stringshare_del(udi);
|
||||||
}
|
}
|
||||||
|
@ -913,12 +912,12 @@ _places_volume_properties_cb(void *data, void *reply_data, DBusError *error)
|
||||||
|
|
||||||
/* skip volumes with volume.ignore set */
|
/* skip volumes with volume.ignore set */
|
||||||
if (e_hal_property_bool_get(reply, "volume.ignore", &err) || err)
|
if (e_hal_property_bool_get(reply, "volume.ignore", &err) || err)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* skip volumes that aren't filesystems */
|
/* skip volumes that aren't filesystems */
|
||||||
str = e_hal_property_string_get(reply, "volume.fsusage", &err);
|
str = e_hal_property_string_get(reply, "volume.fsusage", &err);
|
||||||
if (err || !str || strcmp(str, "filesystem"))
|
if (err || !str || strcmp(str, "filesystem"))
|
||||||
return;
|
return;
|
||||||
//~ v->uuid = e_hal_property_string_get(ret, "volume.uuid", &err);
|
//~ v->uuid = e_hal_property_string_get(ret, "volume.uuid", &err);
|
||||||
//~ if (err) goto error;
|
//~ if (err) goto error;
|
||||||
|
|
||||||
|
@ -934,7 +933,7 @@ _places_volume_properties_cb(void *data, void *reply_data, DBusError *error)
|
||||||
if (!err) v->fstype = eina_stringshare_add(str);
|
if (!err) v->fstype = eina_stringshare_add(str);
|
||||||
|
|
||||||
v->size = e_hal_property_uint64_get(reply, "volume.size", &err);
|
v->size = e_hal_property_uint64_get(reply, "volume.size", &err);
|
||||||
|
|
||||||
//~ v->partition = e_hal_property_bool_get(ret, "volume.is_partition", &err);
|
//~ v->partition = e_hal_property_bool_get(ret, "volume.is_partition", &err);
|
||||||
//~ if (err) goto error;
|
//~ if (err) goto error;
|
||||||
|
|
||||||
|
@ -946,9 +945,10 @@ _places_volume_properties_cb(void *data, void *reply_data, DBusError *error)
|
||||||
|
|
||||||
str = e_hal_property_string_get(reply, "info.parent", &err);
|
str = e_hal_property_string_get(reply, "info.parent", &err);
|
||||||
if (!err && str)
|
if (!err && str)
|
||||||
{
|
{
|
||||||
e_hal_device_get_all_properties(conn, str, _places_storage_properties_cb, v);
|
e_hal_device_get_all_properties(conn, str,
|
||||||
}
|
_places_storage_properties_cb, v);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -963,15 +963,15 @@ _places_storage_properties_cb(void *data, void *reply_data, DBusError *error)
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if (!v) return;
|
if (!v) return;
|
||||||
if (dbus_error_is_set(error))
|
if (dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
dbus_error_free(error);
|
dbus_error_free(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = e_hal_property_string_get(ret, "storage.bus", &err);
|
str = e_hal_property_string_get(ret, "storage.bus", &err);
|
||||||
if (!err) v->bus = eina_stringshare_add(str);
|
if (!err) v->bus = eina_stringshare_add(str);
|
||||||
|
|
||||||
str = e_hal_property_string_get(ret, "storage.drive_type", &err);
|
str = e_hal_property_string_get(ret, "storage.drive_type", &err);
|
||||||
if (!err) v->drive_type = eina_stringshare_add(str);
|
if (!err) v->drive_type = eina_stringshare_add(str);
|
||||||
|
|
||||||
|
@ -993,29 +993,31 @@ _places_storage_properties_cb(void *data, void *reply_data, DBusError *error)
|
||||||
//~ s->media_size = e_hal_property_uint64_get(ret, "storage.removable.media_size", &err);
|
//~ s->media_size = e_hal_property_uint64_get(ret, "storage.removable.media_size", &err);
|
||||||
//~ }
|
//~ }
|
||||||
|
|
||||||
|
|
||||||
//~ s->hotpluggable = e_hal_property_bool_get(ret, "storage.hotpluggable", &err);
|
//~ s->hotpluggable = e_hal_property_bool_get(ret, "storage.hotpluggable", &err);
|
||||||
//~ s->media_check_enabled = e_hal_property_bool_get(ret, "storage.media_check_enabled", &err);
|
//~ s->media_check_enabled = e_hal_property_bool_get(ret, "storage.media_check_enabled", &err);
|
||||||
|
|
||||||
//~ s->icon.drive = e_hal_property_string_get(ret, "storage.icon.drive", &err);
|
//~ s->icon.drive = e_hal_property_string_get(ret, "storage.icon.drive", &err);
|
||||||
//~ s->icon.volume = e_hal_property_string_get(ret, "storage.icon.volume", &err);
|
//~ s->icon.volume = e_hal_property_string_get(ret, "storage.icon.volume", &err);
|
||||||
|
|
||||||
//_places_print_volume(v); //Use this for debug
|
//_places_print_volume(v); //Use this for debug
|
||||||
v->valid = 1;
|
v->valid = 1;
|
||||||
|
|
||||||
if (v->to_mount && !v->mounted)
|
if (v->to_mount && !v->mounted)
|
||||||
{
|
{
|
||||||
Eina_Bool enabled;
|
Eina_Bool enabled;
|
||||||
|
|
||||||
enabled = e_hal_property_bool_get(ret, "storage.automount_enabled_hint", &err);
|
enabled = e_hal_property_bool_get(ret, "storage.automount_enabled_hint",
|
||||||
if (err)
|
&err);
|
||||||
enabled = 1; /* assume no property it is enabled */
|
if (err)
|
||||||
|
enabled = 1; /* assume no property it is enabled */
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
_places_mount_volume(v);
|
_places_mount_volume(v);
|
||||||
}
|
}
|
||||||
v->to_mount = 0;
|
v->to_mount = 0;
|
||||||
|
|
||||||
places_update_all_gadgets(); //TODO Update only this volume, not all
|
places_update_all_gadgets(); //TODO Update only this volume, not all
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue