2011-08-27 20:22:49 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2008-12-06 10:51:04 -08:00
|
|
|
#include <e.h>
|
|
|
|
#include <E_DBus.h>
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
#include "e_mod_places.h"
|
|
|
|
|
|
|
|
/* Local Function Prototypes */
|
|
|
|
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
|
|
|
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
|
|
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
|
|
|
static char *_gc_label(E_Gadcon_Client_Class *client_class);
|
|
|
|
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
|
|
|
static void _gc_id_del(E_Gadcon_Client_Class *client_class, const char *id);
|
|
|
|
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
|
|
|
|
|
|
static void _places_conf_new(void);
|
|
|
|
static void _places_conf_free(void);
|
2010-07-07 17:57:17 -07:00
|
|
|
static Eina_Bool _places_conf_timer(void *data);
|
2008-12-06 10:51:04 -08:00
|
|
|
static Config_Item *_places_conf_item_get(const char *id);
|
|
|
|
static void _places_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event);
|
|
|
|
static void _places_cb_menu_post(void *data, E_Menu *menu);
|
|
|
|
static void _places_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi);
|
|
|
|
|
|
|
|
/* Local Variables */
|
|
|
|
static int uuid = 0;
|
|
|
|
static E_Config_DD *conf_edd = NULL;
|
|
|
|
static E_Config_DD *conf_item_edd = NULL;
|
|
|
|
Eina_List *instances = NULL;
|
|
|
|
Config *places_conf = NULL;
|
|
|
|
extern Eina_List *volumes;
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static const E_Gadcon_Client_Class _gc_class =
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2010-08-25 01:23:59 -07:00
|
|
|
GADCON_CLIENT_CLASS_VERSION, "Places",
|
|
|
|
{_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon,
|
List of changes:
1. Gadcon sities:
-- 'E_Gadcon_Site' enum to list all available sities,
-- added 'is_site' callback for distinguish gadcon sities,
-- 'e_gadcon_site_is_*' helpers written to use in gadget modules,
-- gadcon config dialogs modified to show only gadgets that appropriate
to selected gadcon site,
-- all gadget modules updated for using new callback.
When callback is not provided in module, then gadget can be used in
any gadcon site.
2. Filemanager:
-- added error icon to unexisting path dialog,
-- added callback 'func.abort' to 'E_Fm2_Op_Registry_Entry' to specify
abort operation sequence (if not provided, then operation is not
cancelable),
-- added parameter to 'e_fm2_op_registry_entry_add' to specify abort
method on construct 'E_Fm2_Op_Registry_Entry' or make non-cancelable
operation if this function is not provided,
-- added 'e_fm2_operation_abort' call to cancel efm2 operation,
-- added method '_e_fm2_operation_abort_internal' that represent efm2
default handler of operation cancelling,
-- 'done' and 'total' fields of 'E_Fm2_Op_Registry_Entry' changed to
off_t type, also all message handlers modified to work with it
(to show progress for large files correctly),
-- improved file operation progress processing,
-- added cancel button to operation progress gadget in filemanager window,
-- added delete file glyph to operation progress gadget,
-- improved status message for efm2 operation progress.
3. Filemanager slave:
-- fixed critical bug in message handling via stdin/stdout,
-- fixed critical bug in removing task from list,
-- improved 'E_FM_OP_ABORT' handling,
-- fix rollback counting on moving files.
4. Fileman_opinfo module:
-- a new theme writed: status string and gadget for view operation status
in summary and detail modes,
-- summary mode: operation glyph, state message, progressbar, abort button,
-- detail mode: all for summary + from filename, to filename,
-- summary/detailed button works as trigger,
-- added source of module theme and used images.
4. Pathbar module:
-- non-critical fix, just for safety.
Also patch contains several minor updates to serve main task.
SVN revision: 41224
2009-06-29 07:38:03 -07:00
|
|
|
_gc_id_new, _gc_id_del, e_gadcon_site_is_not_toolbar},
|
2008-12-06 10:51:04 -08:00
|
|
|
E_GADCON_CLIENT_STYLE_PLAIN
|
|
|
|
};
|
|
|
|
|
|
|
|
EAPI E_Module_Api e_modapi = {E_MODULE_API_VERSION, "Places"};
|
|
|
|
|
2008-12-06 17:33:06 -08:00
|
|
|
/* Module Functions */
|
2008-12-06 10:51:04 -08:00
|
|
|
EAPI void *
|
2010-08-25 01:23:59 -07:00
|
|
|
e_modapi_init(E_Module *m)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2010-08-25 00:48:16 -07:00
|
|
|
char buf[PATH_MAX];
|
2008-12-06 10:51:04 -08:00
|
|
|
|
|
|
|
/* Set up module's message catalogue */
|
|
|
|
snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m));
|
|
|
|
bindtextdomain(PACKAGE, buf);
|
|
|
|
bind_textdomain_codeset(PACKAGE, "UTF-8");
|
|
|
|
|
|
|
|
/* Location of theme to load for this module */
|
|
|
|
snprintf(buf, sizeof(buf), "%s/e-module-places.edj", m->dir);
|
|
|
|
|
|
|
|
/* Display this Modules config info in the main Config Panel */
|
2010-08-25 01:23:59 -07:00
|
|
|
e_configure_registry_category_add("fileman", 80, D_("Files"),
|
2009-03-28 06:30:14 -07:00
|
|
|
NULL, "system-file-manager");
|
2010-08-25 01:23:59 -07:00
|
|
|
e_configure_registry_item_add("fileman/places", 80, D_("Places"),
|
2008-12-06 10:51:04 -08:00
|
|
|
NULL, buf, e_int_config_places_module);
|
|
|
|
|
|
|
|
/* Define EET Data Storage */
|
|
|
|
conf_item_edd = E_CONFIG_DD_NEW("Config_Item", Config_Item);
|
|
|
|
#undef T
|
|
|
|
#undef D
|
|
|
|
#define T Config_Item
|
|
|
|
#define D conf_item_edd
|
|
|
|
E_CONFIG_VAL(D, T, id, STR);
|
|
|
|
E_CONFIG_VAL(D, T, switch2, INT);
|
|
|
|
|
|
|
|
conf_edd = E_CONFIG_DD_NEW("Config", Config);
|
|
|
|
#undef T
|
|
|
|
#undef D
|
|
|
|
#define T Config
|
|
|
|
#define D conf_edd
|
|
|
|
E_CONFIG_VAL(D, T, version, INT);
|
|
|
|
E_CONFIG_VAL(D, T, fm, STR);
|
2009-02-01 16:35:45 -08:00
|
|
|
E_CONFIG_VAL(D, T, auto_mount, UCHAR);
|
|
|
|
E_CONFIG_VAL(D, T, auto_open, UCHAR);
|
2008-12-06 17:33:06 -08:00
|
|
|
E_CONFIG_LIST(D, T, conf_items, conf_item_edd);
|
2009-06-06 17:42:11 -07:00
|
|
|
E_CONFIG_VAL(D, T, show_menu, UCHAR);
|
2009-02-01 16:35:45 -08:00
|
|
|
E_CONFIG_VAL(D, T, show_home, UCHAR);
|
|
|
|
E_CONFIG_VAL(D, T, show_desk, UCHAR);
|
|
|
|
E_CONFIG_VAL(D, T, show_trash, UCHAR);
|
|
|
|
E_CONFIG_VAL(D, T, show_root, UCHAR);
|
|
|
|
E_CONFIG_VAL(D, T, show_temp, UCHAR);
|
|
|
|
E_CONFIG_VAL(D, T, show_bookm, UCHAR);
|
2008-12-06 10:51:04 -08:00
|
|
|
|
|
|
|
/* Tell E to find any existing module data. First run ? */
|
|
|
|
places_conf = e_config_domain_load("module.places", conf_edd);
|
2010-08-25 01:23:59 -07:00
|
|
|
if (places_conf)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2010-08-25 01:23:59 -07:00
|
|
|
if ((places_conf->version >> 16) < MOD_CONFIG_FILE_EPOCH)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
/* config too old */
|
|
|
|
_places_conf_free();
|
2010-08-25 01:23:59 -07:00
|
|
|
ecore_timer_add(1.0, _places_conf_timer,
|
2008-12-06 10:51:04 -08:00
|
|
|
"Places Module Configuration data needed "
|
|
|
|
"upgrading. Your old configuration<br> has been"
|
|
|
|
" wiped and a new set of defaults initialized. "
|
|
|
|
"This<br>will happen regularly during "
|
|
|
|
"development, so don't report a<br>bug. "
|
|
|
|
"This simply means the module needs "
|
|
|
|
"new configuration<br>data by default for "
|
|
|
|
"usable functionality that your old<br>"
|
|
|
|
"configuration simply lacks. This new set of "
|
|
|
|
"defaults will fix<br>that by adding it in. "
|
|
|
|
"You can re-configure things now to your<br>"
|
|
|
|
"liking. Sorry for the inconvenience.<br>");
|
|
|
|
}
|
|
|
|
/* Ardvarks */
|
2010-08-25 01:23:59 -07:00
|
|
|
else if (places_conf->version > MOD_CONFIG_FILE_VERSION)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
/* config too new...wtf ? */
|
|
|
|
_places_conf_free();
|
2010-08-25 01:23:59 -07:00
|
|
|
ecore_timer_add(1.0, _places_conf_timer,
|
|
|
|
"Your Places Module configuration is NEWER "
|
2008-12-06 10:51:04 -08:00
|
|
|
"than the module version. This is "
|
|
|
|
"very<br>strange. This should not happen unless"
|
|
|
|
" you downgraded<br>the module or "
|
|
|
|
"copied the configuration from a place where"
|
|
|
|
"<br>a newer version of the module "
|
|
|
|
"was running. This is bad and<br>as a "
|
|
|
|
"precaution your configuration has been now "
|
|
|
|
"restored to<br>defaults. Sorry for the "
|
|
|
|
"inconvenience.<br>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
/* if we don't have a config yet, or it got erased above,
|
2008-12-06 10:51:04 -08:00
|
|
|
* then create a default one */
|
|
|
|
if (!places_conf) _places_conf_new();
|
|
|
|
|
|
|
|
places_conf->module = m;
|
|
|
|
e_gadcon_provider_register(&_gc_class);
|
|
|
|
places_init();
|
2009-06-06 17:42:11 -07:00
|
|
|
|
|
|
|
if (places_conf->show_menu)
|
|
|
|
{
|
|
|
|
E_Int_Menu_Augmentation *maug;
|
|
|
|
maug = e_int_menus_menu_augmentation_add("main/1",
|
2010-08-25 01:23:59 -07:00
|
|
|
places_augmentation,
|
|
|
|
NULL, NULL, NULL);
|
2009-06-06 17:42:11 -07:00
|
|
|
}
|
2008-12-06 17:33:06 -08:00
|
|
|
|
2008-12-06 10:51:04 -08:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2008-12-06 17:33:06 -08:00
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
EAPI int
|
|
|
|
e_modapi_shutdown(E_Module *m)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
places_shutdown();
|
|
|
|
|
|
|
|
e_configure_registry_item_del("extensions/places");
|
|
|
|
e_configure_registry_category_del("extensions");
|
|
|
|
|
|
|
|
/* Kill the config dialog */
|
|
|
|
if (places_conf->cfd) e_object_del(E_OBJECT(places_conf->cfd));
|
|
|
|
places_conf->cfd = NULL;
|
|
|
|
|
|
|
|
/* Tell E the module is now unloaded. Gets removed from shelves, etc. */
|
|
|
|
places_conf->module = NULL;
|
|
|
|
e_gadcon_provider_unregister(&_gc_class);
|
|
|
|
|
|
|
|
_places_conf_free();
|
|
|
|
|
|
|
|
E_CONFIG_DD_FREE(conf_item_edd);
|
|
|
|
E_CONFIG_DD_FREE(conf_edd);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
EAPI int
|
|
|
|
e_modapi_save(E_Module *m)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
e_config_domain_save("module.places", conf_edd, places_conf);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-12-06 17:33:06 -08:00
|
|
|
/* Gadcon Functions */
|
2008-12-06 10:51:04 -08:00
|
|
|
static E_Gadcon_Client *
|
2010-08-25 01:23:59 -07:00
|
|
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Instance *inst = NULL;
|
|
|
|
|
|
|
|
inst = E_NEW(Instance, 1);
|
|
|
|
inst->conf_item = _places_conf_item_get(id);
|
|
|
|
|
|
|
|
inst->o_box = e_box_add(gc->evas);
|
|
|
|
e_box_homogenous_set(inst->o_box, 0);
|
|
|
|
e_box_orientation_set(inst->o_box, 0);
|
2009-02-13 05:15:43 -08:00
|
|
|
e_box_align_set(inst->o_box, 0.0, 0.0);
|
2008-12-06 17:33:06 -08:00
|
|
|
|
2008-12-06 10:51:04 -08:00
|
|
|
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_box);
|
|
|
|
inst->gcc->data = inst;
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
evas_object_event_callback_add(inst->o_box, EVAS_CALLBACK_MOUSE_DOWN,
|
2008-12-06 10:51:04 -08:00
|
|
|
_places_cb_mouse_down, inst);
|
|
|
|
|
|
|
|
instances = eina_list_append(instances, inst);
|
|
|
|
places_fill_box(inst->o_box);
|
|
|
|
|
|
|
|
return inst->gcc;
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Instance *inst = NULL;
|
|
|
|
|
|
|
|
if (!(inst = gcc->data)) return;
|
|
|
|
instances = eina_list_remove(instances, inst);
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
if (inst->menu)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
e_menu_post_deactivate_callback_set(inst->menu, NULL, NULL);
|
|
|
|
e_object_del(E_OBJECT(inst->menu));
|
|
|
|
inst->menu = NULL;
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
if (inst->o_box)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2010-08-25 01:23:59 -07:00
|
|
|
evas_object_event_callback_del(inst->o_box, EVAS_CALLBACK_MOUSE_DOWN,
|
2008-12-06 10:51:04 -08:00
|
|
|
_places_cb_mouse_down);
|
|
|
|
places_empty_box(inst->o_box);
|
|
|
|
evas_object_del(inst->o_box);
|
|
|
|
}
|
|
|
|
|
|
|
|
E_FREE(inst);
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2008-12-06 18:50:11 -08:00
|
|
|
Instance *inst;
|
|
|
|
|
|
|
|
inst = gcc->data;
|
|
|
|
switch (orient)
|
|
|
|
{
|
|
|
|
case E_GADCON_ORIENT_HORIZ:
|
|
|
|
case E_GADCON_ORIENT_TOP:
|
|
|
|
case E_GADCON_ORIENT_BOTTOM:
|
|
|
|
case E_GADCON_ORIENT_CORNER_TL:
|
|
|
|
case E_GADCON_ORIENT_CORNER_TR:
|
|
|
|
case E_GADCON_ORIENT_CORNER_BL:
|
|
|
|
case E_GADCON_ORIENT_CORNER_BR:
|
2010-08-25 01:23:59 -07:00
|
|
|
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_box_orientation_set(inst->o_box, 1);
|
|
|
|
break;
|
2008-12-06 18:50:11 -08:00
|
|
|
case E_GADCON_ORIENT_FLOAT:
|
|
|
|
case E_GADCON_ORIENT_VERT:
|
|
|
|
case E_GADCON_ORIENT_LEFT:
|
|
|
|
case E_GADCON_ORIENT_RIGHT:
|
|
|
|
case E_GADCON_ORIENT_CORNER_LT:
|
|
|
|
case E_GADCON_ORIENT_CORNER_RT:
|
|
|
|
case E_GADCON_ORIENT_CORNER_LB:
|
|
|
|
case E_GADCON_ORIENT_CORNER_RB:
|
2010-08-25 01:23:59 -07:00
|
|
|
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_box_orientation_set(inst->o_box, 0);
|
|
|
|
break;
|
2008-12-06 18:50:11 -08:00
|
|
|
default:
|
2010-08-25 01:23:59 -07:00
|
|
|
break;
|
2008-12-06 18:50:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
places_fill_box(inst->o_box);
|
2008-12-06 10:51:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2010-08-25 01:23:59 -07:00
|
|
|
_gc_label(E_Gadcon_Client_Class *client_class)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
return "Places";
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
2010-08-25 01:23:59 -07:00
|
|
|
_gc_id_new(E_Gadcon_Client_Class *client_class)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Config_Item *ci = NULL;
|
|
|
|
|
|
|
|
ci = _places_conf_item_get(NULL);
|
|
|
|
return ci->id;
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_gc_id_del(E_Gadcon_Client_Class *client_class, const char *id)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2008-12-06 17:33:06 -08:00
|
|
|
// Config_Item *ci = NULL;
|
2008-12-06 10:51:04 -08:00
|
|
|
|
2008-12-06 17:33:06 -08:00
|
|
|
// if (!(ci = _places_conf_item_get(id))) return;
|
2008-12-06 10:51:04 -08:00
|
|
|
|
2008-12-06 17:33:06 -08:00
|
|
|
// if (ci->id) eina_stringshare_del(ci->id);
|
2008-12-06 10:51:04 -08:00
|
|
|
|
2008-12-06 17:33:06 -08:00
|
|
|
// places_conf->conf_items = eina_list_remove(places_conf->conf_items, ci);
|
|
|
|
// E_FREE(ci);
|
2008-12-06 10:51:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2010-08-25 01:23:59 -07:00
|
|
|
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Evas_Object *o = NULL;
|
2010-08-25 00:48:16 -07:00
|
|
|
char buf[PATH_MAX];
|
2008-12-06 10:51:04 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s/e-module-places.edj", places_conf->module->dir);
|
|
|
|
o = edje_object_add(evas);
|
|
|
|
edje_object_file_set(o, buf, "icon");
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
2008-12-06 17:33:06 -08:00
|
|
|
/* Conf functions */
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_places_conf_new(void)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Config_Item *ci = NULL;
|
|
|
|
char buf[128];
|
|
|
|
|
|
|
|
places_conf = E_NEW(Config, 1);
|
|
|
|
places_conf->version = (MOD_CONFIG_FILE_EPOCH << 16);
|
|
|
|
|
|
|
|
#define IFMODCFG(v) if ((places_conf->version & 0xffff) < v) {
|
|
|
|
#define IFMODCFGEND }
|
|
|
|
|
|
|
|
/* setup defaults */
|
|
|
|
IFMODCFG(0x008d);
|
|
|
|
places_conf->auto_mount = 0;
|
|
|
|
places_conf->auto_open = 0;
|
2009-02-01 16:35:45 -08:00
|
|
|
places_conf->show_home = 1;
|
|
|
|
places_conf->show_desk = 1;
|
|
|
|
places_conf->show_trash = 0;
|
|
|
|
places_conf->show_root = 0;
|
|
|
|
places_conf->show_temp = 0;
|
|
|
|
places_conf->show_bookm = 1;
|
2008-12-06 10:51:04 -08:00
|
|
|
_places_conf_item_get(NULL);
|
|
|
|
IFMODCFGEND;
|
|
|
|
|
|
|
|
IFMODCFG(0x008e);
|
|
|
|
places_conf->fm = NULL;
|
|
|
|
IFMODCFGEND;
|
|
|
|
|
|
|
|
/* update the version */
|
|
|
|
places_conf->version = MOD_CONFIG_FILE_VERSION;
|
|
|
|
|
|
|
|
/* setup limits on the config properties here (if needed) */
|
|
|
|
|
|
|
|
/* save the config to disk */
|
|
|
|
e_config_save_queue();
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_places_conf_free(void)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2010-08-25 01:23:59 -07:00
|
|
|
while (places_conf->conf_items)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Config_Item *ci = NULL;
|
|
|
|
|
|
|
|
ci = places_conf->conf_items->data;
|
2010-08-25 01:23:59 -07:00
|
|
|
places_conf->conf_items =
|
|
|
|
eina_list_remove_list(places_conf->conf_items,
|
2008-12-06 10:51:04 -08:00
|
|
|
places_conf->conf_items);
|
|
|
|
if (ci->id) eina_stringshare_del(ci->id);
|
|
|
|
E_FREE(ci);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (places_conf->fm) eina_stringshare_del(places_conf->fm);
|
|
|
|
E_FREE(places_conf);
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_places_conf_timer(void *data)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2011-08-27 20:22:49 -07:00
|
|
|
e_util_dialog_show("Places Configuration Updated %s", (char*)data);
|
2010-07-07 17:57:17 -07:00
|
|
|
return EINA_FALSE;
|
2008-12-06 10:51:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Config_Item *
|
2010-08-25 01:23:59 -07:00
|
|
|
_places_conf_item_get(const char *id)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Eina_List *l = NULL;
|
|
|
|
Config_Item *ci = NULL;
|
|
|
|
char buf[128];
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
if (!id)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
/* nothing passed, return a new id */
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, ++uuid);
|
|
|
|
id = buf;
|
|
|
|
}
|
2010-08-25 01:23:59 -07:00
|
|
|
else
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2010-08-25 01:23:59 -07:00
|
|
|
for (l = places_conf->conf_items; l; l = l->next)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
if (!(ci = l->data)) continue;
|
|
|
|
if ((ci->id) && (!strcmp(ci->id, id))) return ci;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ci = E_NEW(Config_Item, 1);
|
|
|
|
ci->id = eina_stringshare_add(id);
|
|
|
|
ci->switch2 = 0;
|
|
|
|
places_conf->conf_items = eina_list_append(places_conf->conf_items, ci);
|
|
|
|
return ci;
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_places_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Instance *inst = NULL;
|
|
|
|
Evas_Event_Mouse_Down *ev;
|
|
|
|
E_Zone *zone = NULL;
|
|
|
|
E_Menu_Item *mi = NULL;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
if (!(inst = data)) return;
|
|
|
|
ev = event;
|
2010-08-25 01:23:59 -07:00
|
|
|
if ((ev->button == 3) && (!inst->menu))
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
2011-03-17 10:24:53 -07:00
|
|
|
E_Menu *m;
|
2010-09-09 07:50:27 -07:00
|
|
|
|
2008-12-06 10:51:04 -08:00
|
|
|
/* grab current zone */
|
|
|
|
zone = e_util_zone_current_get(e_manager_current_get());
|
|
|
|
|
|
|
|
/* create popup menu */
|
2011-03-17 10:24:53 -07:00
|
|
|
m = e_menu_new();
|
2010-09-09 07:50:27 -07:00
|
|
|
|
2011-03-17 10:24:53 -07:00
|
|
|
mi = e_menu_item_new(m);
|
2010-09-09 07:50:27 -07:00
|
|
|
e_menu_item_label_set(mi, D_("Settings"));
|
2009-03-28 06:30:14 -07:00
|
|
|
e_util_menu_item_theme_icon_set(mi, "preferences-system");
|
2008-12-06 10:51:04 -08:00
|
|
|
e_menu_item_callback_set(mi, _places_cb_menu_configure, NULL);
|
|
|
|
|
|
|
|
/* Each Gadget Client has a utility menu from the Container */
|
2011-03-17 10:24:53 -07:00
|
|
|
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
|
|
|
|
e_menu_post_deactivate_callback_set(m, _places_cb_menu_post, inst);
|
|
|
|
inst->menu = m;
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y,
|
2008-12-06 10:51:04 -08:00
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
/* show the menu relative to gadgets position */
|
2011-03-17 10:24:53 -07:00
|
|
|
e_menu_activate_mouse(m, zone, (x + ev->output.x),
|
2010-08-25 01:23:59 -07:00
|
|
|
(y + ev->output.y), 1, 1,
|
2008-12-06 10:51:04 -08:00
|
|
|
E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
2010-08-25 01:23:59 -07:00
|
|
|
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
|
2008-12-06 10:51:04 -08:00
|
|
|
EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_places_cb_menu_post(void *data, E_Menu *menu)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
Instance *inst = NULL;
|
|
|
|
|
|
|
|
if (!(inst = data)) return;
|
|
|
|
if (!inst->menu) return;
|
|
|
|
e_object_del(E_OBJECT(inst->menu));
|
|
|
|
inst->menu = NULL;
|
|
|
|
}
|
|
|
|
|
2010-08-25 01:23:59 -07:00
|
|
|
static void
|
|
|
|
_places_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi)
|
2008-12-06 10:51:04 -08:00
|
|
|
{
|
|
|
|
if (!places_conf) return;
|
|
|
|
if (places_conf->cfd) return;
|
2010-01-11 02:23:02 -08:00
|
|
|
e_int_config_places_module(mn->zone->container, NULL);
|
2008-12-06 10:51:04 -08:00
|
|
|
}
|