2007-08-05 01:07:39 -07:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
|
|
|
/* actual module specifics */
|
|
|
|
|
|
|
|
static void _e_mod_action_conf_cb(E_Object *obj, const char *params);
|
|
|
|
static void _e_mod_conf_cb(void *data, E_Menu *m, E_Menu_Item *mi);
|
|
|
|
static void _e_mod_menu_add(void *data, E_Menu *m);
|
|
|
|
|
|
|
|
static E_Module *conf_module = NULL;
|
|
|
|
static E_Action *act = NULL;
|
|
|
|
static E_Int_Menu_Augmentation *maug = NULL;
|
|
|
|
|
|
|
|
/**/
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
2008-11-20 19:59:30 -08:00
|
|
|
/* gadget */
|
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
|
|
|
/* gadcon requirements */
|
|
|
|
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 Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
|
|
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
|
|
|
static void _cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
|
|
|
/* and actually define the gadcon class that this module provides (just 1) */
|
|
|
|
static const E_Gadcon_Client_Class _gadcon_class =
|
|
|
|
{
|
|
|
|
GADCON_CLIENT_CLASS_VERSION,
|
|
|
|
"configuration",
|
|
|
|
{
|
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_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
|
|
e_gadcon_site_is_not_toolbar
|
2008-11-20 19:59:30 -08:00
|
|
|
},
|
|
|
|
E_GADCON_CLIENT_STYLE_PLAIN
|
|
|
|
};
|
|
|
|
|
|
|
|
static E_Gadcon_Client *
|
|
|
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
E_Gadcon_Client *gcc;
|
|
|
|
|
2009-03-04 18:39:50 -08:00
|
|
|
o = e_icon_add(gc->evas);
|
|
|
|
e_util_icon_theme_set(o, "preferences-system");
|
2008-11-20 19:59:30 -08:00
|
|
|
evas_object_show(o);
|
|
|
|
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
|
|
|
gcc->data = o;
|
|
|
|
e_gadcon_client_util_menu_attach(gcc);
|
2007-08-05 01:07:39 -07:00
|
|
|
|
2008-11-20 19:59:30 -08:00
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
|
|
|
|
_cb_mouse_up, NULL);
|
|
|
|
return gcc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
|
|
{
|
|
|
|
evas_object_del(gcc->o_base);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
|
|
|
{
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
|
|
|
|
mw = 0, mh = 0;
|
|
|
|
edje_object_size_min_get(gcc->o_base, &mw, &mh);
|
|
|
|
if ((mw < 1) || (mh < 1))
|
|
|
|
edje_object_size_min_calc(gcc->o_base, &mw, &mh);
|
|
|
|
if (mw < 4) mw = 4;
|
|
|
|
if (mh < 4) mh = 4;
|
|
|
|
e_gadcon_client_aspect_set(gcc, mw, mh);
|
|
|
|
e_gadcon_client_min_size_set(gcc, mw, mh);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_gc_label(E_Gadcon_Client_Class *client_class)
|
|
|
|
{
|
2008-11-22 00:42:54 -08:00
|
|
|
return "Settings";
|
2008-11-20 19:59:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
char buf[4096];
|
|
|
|
|
|
|
|
o = edje_object_add(evas);
|
|
|
|
snprintf(buf, sizeof(buf), "%s/e-module-conf.edj",
|
|
|
|
e_module_dir_get(conf_module));
|
|
|
|
edje_object_file_set(o, buf, "icon");
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
_gc_id_new(E_Gadcon_Client_Class *client_class)
|
|
|
|
{
|
|
|
|
return _gadcon_class.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
E_Action *a;
|
2008-11-26 17:50:00 -08:00
|
|
|
|
2008-11-20 19:59:30 -08:00
|
|
|
a = e_action_find("configuration");
|
|
|
|
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
|
|
|
}
|
2007-08-05 01:07:39 -07:00
|
|
|
/**/
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/**/
|
|
|
|
/* module setup */
|
|
|
|
EAPI E_Module_Api e_modapi =
|
|
|
|
{
|
|
|
|
E_MODULE_API_VERSION,
|
|
|
|
"Conf"
|
|
|
|
};
|
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
e_modapi_init(E_Module *m)
|
|
|
|
{
|
|
|
|
conf_module = m;
|
|
|
|
/* add module supplied action */
|
|
|
|
act = e_action_add("configuration");
|
|
|
|
if (act)
|
|
|
|
{
|
|
|
|
act->func.go = _e_mod_action_conf_cb;
|
2008-11-22 00:42:54 -08:00
|
|
|
e_action_predef_name_set(_("Launch"), _("Settings Panel"), "configuration",
|
2007-08-05 01:07:39 -07:00
|
|
|
NULL, NULL, 0);
|
|
|
|
}
|
2009-04-18 23:21:35 -07:00
|
|
|
maug = e_int_menus_menu_augmentation_add_sorted
|
|
|
|
("config/0", _("Settings Panel"), _e_mod_menu_add, NULL, NULL, NULL);
|
2007-08-05 01:07:39 -07:00
|
|
|
e_module_delayed_set(m, 1);
|
2008-11-20 19:59:30 -08:00
|
|
|
e_gadcon_provider_register(&_gadcon_class);
|
2007-08-05 01:07:39 -07:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
e_modapi_shutdown(E_Module *m)
|
|
|
|
{
|
2007-08-18 03:45:38 -07:00
|
|
|
e_configure_del();
|
2008-11-20 19:59:30 -08:00
|
|
|
e_gadcon_provider_unregister(&_gadcon_class);
|
2007-08-05 01:07:39 -07:00
|
|
|
/* remove module-supplied menu additions */
|
|
|
|
if (maug)
|
|
|
|
{
|
|
|
|
e_int_menus_menu_augmentation_del("config/0", maug);
|
|
|
|
maug = NULL;
|
|
|
|
}
|
|
|
|
/* remove module-supplied action */
|
|
|
|
if (act)
|
|
|
|
{
|
2008-11-22 00:42:54 -08:00
|
|
|
e_action_predef_name_del(_("Launch"), _("Settings Panel"));
|
2007-08-05 01:07:39 -07:00
|
|
|
e_action_del("configuration");
|
|
|
|
act = NULL;
|
|
|
|
}
|
|
|
|
conf_module = NULL;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
e_modapi_save(E_Module *m)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* action callback */
|
|
|
|
static void
|
|
|
|
_e_mod_action_conf_cb(E_Object *obj, const char *params)
|
|
|
|
{
|
2007-09-13 14:10:02 -07:00
|
|
|
E_Zone *zone = NULL;
|
2007-08-05 01:07:39 -07:00
|
|
|
|
|
|
|
if (obj)
|
|
|
|
{
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
|
2009-03-19 11:28:01 -07:00
|
|
|
if (zone && params)
|
|
|
|
e_configure_registry_call(params, zone->container, params);
|
|
|
|
else if (zone)
|
|
|
|
e_configure_show(zone->container);
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* menu item callback(s) */
|
|
|
|
static void
|
|
|
|
_e_mod_conf_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
e_configure_show(m->zone->container);
|
|
|
|
}
|
|
|
|
|
add "modes" configuration, now "presentation" and "offline".
They are presented as a submenu with check items. Need to implement
support in modules, so they'll check for these variables.
DESIGNERS: could you please provide the following icons:
* preferences-modes: contain the other icons
* preferences-modes-presentation: system is in presentation mode,
no screensaver, locks and dpms will be available.
* preferences-modes-offline: system is offline, modules that keep
polling internet services (weather, forecasts, ...) should stop
and show "I'm offline" emblem. When network systems (network
manager, connman, exhalt...) are integrated, they will change
this state as well.
SVN revision: 40375
2009-04-25 09:07:45 -07:00
|
|
|
static void
|
|
|
|
_e_mod_mode_presentation_toggle(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
e_config->mode.presentation = !e_config->mode.presentation;
|
|
|
|
e_menu_item_toggle_set(mi, e_config->mode.presentation);
|
|
|
|
e_config_mode_changed();
|
|
|
|
e_config_save_queue();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_mod_mode_offline_toggle(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
e_config->mode.offline = !e_config->mode.offline;
|
|
|
|
e_menu_item_toggle_set(mi, e_config->mode.offline);
|
|
|
|
e_config_mode_changed();
|
|
|
|
e_config_save_queue();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_mod_submenu_modes_fill(void *data __UNUSED__, E_Menu *m)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_check_set(mi, 1);
|
|
|
|
e_menu_item_toggle_set(mi, e_config->mode.presentation);
|
|
|
|
e_menu_item_label_set(mi, _("Presentation"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "preferences-modes-presentation");
|
|
|
|
e_menu_item_callback_set(mi, _e_mod_mode_presentation_toggle, NULL);
|
|
|
|
|
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_check_set(mi, 1);
|
|
|
|
e_menu_item_toggle_set(mi, e_config->mode.offline);
|
|
|
|
e_menu_item_label_set(mi, _("Offline"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "preferences-modes-offline");
|
|
|
|
e_menu_item_callback_set(mi, _e_mod_mode_offline_toggle, NULL);
|
|
|
|
|
|
|
|
e_menu_pre_activate_callback_set(m, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static E_Menu *
|
|
|
|
_e_mod_submenu_modes_get(void)
|
|
|
|
{
|
|
|
|
E_Menu *m = e_menu_new();
|
|
|
|
if (!m) return NULL;
|
|
|
|
e_menu_pre_activate_callback_set(m, _e_mod_submenu_modes_fill, NULL);
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
/* menu item add hook */
|
|
|
|
static void
|
|
|
|
_e_mod_menu_add(void *data, E_Menu *m)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
mi = e_menu_item_new(m);
|
2008-11-22 00:42:54 -08:00
|
|
|
e_menu_item_label_set(mi, _("Settings Panel"));
|
2009-03-04 12:46:05 -08:00
|
|
|
e_util_menu_item_theme_icon_set(mi, "preferences-system");
|
2007-08-05 01:07:39 -07:00
|
|
|
e_menu_item_callback_set(mi, _e_mod_conf_cb, NULL);
|
add "modes" configuration, now "presentation" and "offline".
They are presented as a submenu with check items. Need to implement
support in modules, so they'll check for these variables.
DESIGNERS: could you please provide the following icons:
* preferences-modes: contain the other icons
* preferences-modes-presentation: system is in presentation mode,
no screensaver, locks and dpms will be available.
* preferences-modes-offline: system is offline, modules that keep
polling internet services (weather, forecasts, ...) should stop
and show "I'm offline" emblem. When network systems (network
manager, connman, exhalt...) are integrated, they will change
this state as well.
SVN revision: 40375
2009-04-25 09:07:45 -07:00
|
|
|
|
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, _("Modes"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "preferences-modes");
|
|
|
|
e_menu_item_submenu_set(mi, _e_mod_submenu_modes_get());
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|