2007-08-05 01:07:39 -07:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2010-07-12 13:51:40 -07:00
|
|
|
typedef struct _Instance Instance;
|
|
|
|
struct _Instance
|
|
|
|
{
|
|
|
|
E_Gadcon_Client *gcc;
|
2012-06-14 03:07:33 -07:00
|
|
|
Evas_Object *o_toggle;
|
2010-07-12 13:51:40 -07:00
|
|
|
};
|
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
/* actual module specifics */
|
|
|
|
|
2012-06-14 03:07:33 -07:00
|
|
|
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 void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi);
|
|
|
|
static void _config_pre_activate_cb(void *data, E_Menu *m);
|
2007-08-05 01:07:39 -07:00
|
|
|
|
2008-11-20 19:59:30 -08:00
|
|
|
/* gadcon requirements */
|
|
|
|
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
2012-06-14 03:07:33 -07:00
|
|
|
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
|
|
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
2012-07-27 01:25:22 -07:00
|
|
|
static const char *_gc_label(const E_Gadcon_Client_Class *client_class);
|
|
|
|
static Evas_Object *_gc_icon(const E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
|
|
static const char *_gc_id_new(const E_Gadcon_Client_Class *client_class);
|
2012-06-14 03:07:33 -07:00
|
|
|
static void _cb_action_conf(void *data, Evas_Object *obj, const char *emission, const char *source);
|
2009-12-16 12:07:35 -08:00
|
|
|
|
2012-06-14 03:07:33 -07:00
|
|
|
static void _conf_new(void);
|
|
|
|
static void _conf_free(void);
|
2010-02-27 09:04:55 -08:00
|
|
|
|
2010-02-27 14:38:35 -08:00
|
|
|
static E_Module *conf_module = NULL;
|
|
|
|
static E_Action *act = NULL;
|
|
|
|
static E_Int_Menu_Augmentation *maug = NULL;
|
2010-02-27 09:04:55 -08:00
|
|
|
static E_Config_DD *conf_edd = NULL;
|
|
|
|
Config *conf = NULL;
|
|
|
|
|
2010-07-12 13:51:40 -07:00
|
|
|
static Eina_List *instances = NULL;
|
|
|
|
|
2008-11-20 19:59:30 -08:00
|
|
|
/* and actually define the gadcon class that this module provides (just 1) */
|
|
|
|
static const E_Gadcon_Client_Class _gadcon_class =
|
2012-06-14 03:07:33 -07:00
|
|
|
{
|
|
|
|
GADCON_CLIENT_CLASS_VERSION, "configuration",
|
|
|
|
{
|
2010-03-01 04:36:19 -08:00
|
|
|
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
|
|
e_gadcon_site_is_not_toolbar
|
2012-06-14 03:07:33 -07:00
|
|
|
},
|
|
|
|
E_GADCON_CLIENT_STYLE_PLAIN
|
|
|
|
};
|
2008-11-20 19:59:30 -08:00
|
|
|
|
|
|
|
static E_Gadcon_Client *
|
|
|
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|
|
|
{
|
2010-07-12 13:51:40 -07:00
|
|
|
Instance *inst;
|
|
|
|
|
|
|
|
inst = E_NEW(Instance, 1);
|
|
|
|
inst->o_toggle = edje_object_add(gc->evas);
|
|
|
|
e_theme_edje_object_set(inst->o_toggle,
|
2012-06-14 03:07:33 -07:00
|
|
|
"base/theme/modules/conf",
|
|
|
|
"e/modules/conf/main");
|
2009-12-16 12:07:35 -08:00
|
|
|
|
2010-07-12 13:51:40 -07:00
|
|
|
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_toggle);
|
|
|
|
inst->gcc->data = inst;
|
2009-12-16 12:07:35 -08:00
|
|
|
|
2010-07-12 13:51:40 -07:00
|
|
|
edje_object_signal_callback_add(inst->o_toggle, "e,action,conf", "",
|
2012-06-14 03:07:33 -07:00
|
|
|
_cb_action_conf, inst);
|
2009-12-16 12:07:35 -08:00
|
|
|
|
2010-07-12 13:51:40 -07:00
|
|
|
instances = eina_list_append(instances, inst);
|
|
|
|
e_gadcon_client_util_menu_attach(inst->gcc);
|
2007-08-05 01:07:39 -07:00
|
|
|
|
2010-07-12 13:51:40 -07:00
|
|
|
return inst->gcc;
|
2008-11-20 19:59:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
|
|
{
|
2010-07-12 13:51:40 -07:00
|
|
|
Instance *inst;
|
|
|
|
|
|
|
|
if (!(inst = gcc->data)) return;
|
|
|
|
instances = eina_list_remove(instances, inst);
|
|
|
|
if (inst->o_toggle) evas_object_del(inst->o_toggle);
|
|
|
|
E_FREE(inst);
|
2008-11-20 19:59:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-01 04:57:05 -08:00
|
|
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__)
|
2008-11-20 19:59:30 -08:00
|
|
|
{
|
|
|
|
Evas_Coord mw, mh;
|
2010-01-04 21:32:39 -08:00
|
|
|
|
2008-11-20 19:59:30 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-11-14 13:46:57 -08:00
|
|
|
static const char *
|
2012-07-27 01:25:22 -07:00
|
|
|
_gc_label(const E_Gadcon_Client_Class *client_class __UNUSED__)
|
2008-11-20 19:59:30 -08:00
|
|
|
{
|
2009-12-16 12:07:35 -08:00
|
|
|
return _("Settings");
|
2008-11-20 19:59:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2012-07-27 01:25:22 -07:00
|
|
|
_gc_icon(const E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas)
|
2008-11-20 19:59:30 -08:00
|
|
|
{
|
|
|
|
Evas_Object *o;
|
2009-12-22 11:47:35 -08:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
2008-11-20 19:59:30 -08:00
|
|
|
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 *
|
2012-07-27 01:25:22 -07:00
|
|
|
_gc_id_new(const E_Gadcon_Client_Class *client_class __UNUSED__)
|
2008-11-20 19:59:30 -08:00
|
|
|
{
|
|
|
|
return _gadcon_class.name;
|
|
|
|
}
|
|
|
|
|
2010-08-19 09:53:20 -07:00
|
|
|
/*
|
2012-06-14 03:07:33 -07:00
|
|
|
static void
|
|
|
|
_cb_button_click(void *data __UNUSED__, void *data2 __UNUSED__)
|
|
|
|
{
|
2008-11-20 19:59:30 -08:00
|
|
|
E_Action *a;
|
2008-11-26 17:50:00 -08:00
|
|
|
|
2009-12-16 12:07:35 -08:00
|
|
|
a = e_action_find("configuration");
|
|
|
|
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
2012-06-14 03:07:33 -07:00
|
|
|
}
|
|
|
|
*/
|
2007-08-05 01:07:39 -07:00
|
|
|
|
2010-07-12 13:51:40 -07:00
|
|
|
static void
|
2010-08-19 09:53:20 -07:00
|
|
|
_cb_action_conf(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
2010-07-12 13:51:40 -07:00
|
|
|
{
|
|
|
|
Instance *inst;
|
|
|
|
E_Action *a;
|
|
|
|
|
|
|
|
if (!(inst = data)) return;
|
|
|
|
a = e_action_find("configuration");
|
|
|
|
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2010-03-01 04:36:19 -08:00
|
|
|
static void
|
2014-11-02 18:35:13 -08:00
|
|
|
_e_mod_run_cb(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi __UNUSED__)
|
2010-02-27 09:04:55 -08:00
|
|
|
{
|
2010-02-27 14:38:35 -08:00
|
|
|
Eina_List *l;
|
|
|
|
E_Configure_Cat *ecat;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
|
|
|
|
{
|
|
|
|
if ((ecat->pri >= 0) && (ecat->items))
|
|
|
|
{
|
|
|
|
E_Configure_It *eci;
|
|
|
|
Eina_List *ll;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ecat->items, ll, eci)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
if ((eci->pri >= 0) && (eci == data))
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/%s", ecat->cat, eci->item);
|
2014-11-02 18:35:13 -08:00
|
|
|
e_configure_registry_call(buf, NULL, NULL);
|
2010-02-27 14:38:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-02-27 09:04:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_config_pre_activate_cb(void *data, E_Menu *m)
|
|
|
|
{
|
2010-02-27 14:38:35 -08:00
|
|
|
E_Configure_Cat *ecat = data;
|
|
|
|
E_Configure_It *eci;
|
|
|
|
Eina_List *l;
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
2010-03-01 04:50:44 -08:00
|
|
|
e_menu_pre_activate_callback_set(m, NULL, NULL);
|
2010-02-27 14:38:35 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ecat->items, l, eci)
|
|
|
|
{
|
|
|
|
if (eci->pri >= 0)
|
|
|
|
{
|
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, eci->label);
|
2010-03-01 04:36:19 -08:00
|
|
|
if (eci->icon)
|
2010-02-27 14:38:35 -08:00
|
|
|
{
|
|
|
|
if (eci->icon_file)
|
|
|
|
e_menu_item_icon_edje_set(mi, eci->icon_file, eci->icon);
|
|
|
|
else
|
|
|
|
e_util_menu_item_theme_icon_set(mi, eci->icon);
|
|
|
|
}
|
|
|
|
e_menu_item_callback_set(mi, _e_mod_run_cb, eci);
|
|
|
|
}
|
|
|
|
}
|
2010-02-27 09:04:55 -08:00
|
|
|
}
|
|
|
|
|
2012-08-04 03:14:56 -07:00
|
|
|
static void
|
2015-03-13 14:44:24 -07:00
|
|
|
_config_item_activate_cb(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi __UNUSED__)
|
2012-08-04 03:14:56 -07:00
|
|
|
{
|
|
|
|
E_Configure_Cat *ecat = data;
|
2015-03-13 14:44:24 -07:00
|
|
|
e_configure_show(e_comp, ecat ? ecat->cat : NULL);
|
2012-08-04 03:14:56 -07:00
|
|
|
}
|
|
|
|
|
2010-03-01 04:50:44 -08:00
|
|
|
static void
|
|
|
|
_config_all_pre_activate_cb(void *data __UNUSED__, E_Menu *m)
|
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
E_Configure_Cat *ecat;
|
|
|
|
|
|
|
|
e_menu_pre_activate_callback_set(m, NULL, NULL);
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
|
|
|
|
{
|
2012-06-14 03:07:33 -07:00
|
|
|
E_Menu_Item *mi;
|
|
|
|
E_Menu *sub;
|
2010-03-01 04:50:44 -08:00
|
|
|
|
|
|
|
if ((ecat->pri < 0) || (!ecat->items)) continue;
|
|
|
|
|
2012-06-14 03:07:33 -07:00
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, ecat->label);
|
|
|
|
if (ecat->icon)
|
|
|
|
{
|
|
|
|
if (ecat->icon_file)
|
|
|
|
e_menu_item_icon_edje_set(mi, ecat->icon_file, ecat->icon);
|
|
|
|
else
|
|
|
|
e_util_menu_item_theme_icon_set(mi, ecat->icon);
|
|
|
|
}
|
2012-08-04 03:14:56 -07:00
|
|
|
e_menu_item_callback_set(mi, _config_item_activate_cb, ecat);
|
2012-06-14 03:07:33 -07:00
|
|
|
sub = e_menu_new();
|
|
|
|
e_menu_item_submenu_set(mi, sub);
|
2012-09-03 01:30:39 -07:00
|
|
|
e_object_unref(E_OBJECT(sub));
|
2012-06-14 03:07:33 -07:00
|
|
|
e_menu_pre_activate_callback_set(sub, _config_pre_activate_cb, ecat);
|
2010-03-01 04:50:44 -08:00
|
|
|
}
|
|
|
|
}
|
2010-02-27 09:04:55 -08:00
|
|
|
|
|
|
|
/* menu item add hook */
|
|
|
|
void
|
2010-03-01 04:50:44 -08:00
|
|
|
e_mod_config_menu_add(void *data __UNUSED__, E_Menu *m)
|
2010-02-27 09:04:55 -08:00
|
|
|
{
|
2010-02-27 14:38:35 -08:00
|
|
|
E_Menu_Item *mi;
|
|
|
|
E_Menu *sub;
|
|
|
|
|
2010-03-01 04:50:44 -08:00
|
|
|
e_menu_pre_activate_callback_set(m, NULL, NULL);
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2010-03-01 04:50:44 -08:00
|
|
|
sub = e_menu_new();
|
|
|
|
e_menu_pre_activate_callback_set(sub, _config_all_pre_activate_cb, NULL);
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2010-03-01 04:50:44 -08:00
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, _("All"));
|
|
|
|
e_menu_item_submenu_set(mi, sub);
|
2013-11-26 09:56:53 -08:00
|
|
|
e_menu_item_callback_set(mi, _config_item_activate_cb, NULL);
|
2012-09-03 01:30:39 -07:00
|
|
|
e_object_unref(E_OBJECT(sub));
|
2010-02-27 09:04:55 -08:00
|
|
|
}
|
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
/* module setup */
|
2009-12-22 11:47:35 -08:00
|
|
|
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Conf" };
|
2007-08-05 01:07:39 -07:00
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
e_modapi_init(E_Module *m)
|
|
|
|
{
|
2010-02-27 09:04:55 -08:00
|
|
|
char buf[PATH_MAX];
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
conf_module = m;
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
/* add module supplied action */
|
|
|
|
act = e_action_add("configuration");
|
|
|
|
if (act)
|
|
|
|
{
|
2012-06-14 03:07:33 -07:00
|
|
|
act->func.go = _e_mod_action_conf_cb;
|
2012-12-16 08:58:17 -08:00
|
|
|
e_action_predef_name_set(N_("Launch"), N_("Settings Panel"),
|
2009-12-22 11:47:35 -08:00
|
|
|
"configuration", NULL, NULL, 0);
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
2010-03-01 04:36:19 -08:00
|
|
|
maug =
|
|
|
|
e_int_menus_menu_augmentation_add_sorted("config/0", _("Settings Panel"),
|
2009-12-16 12:07:35 -08:00
|
|
|
_e_mod_menu_add, NULL, NULL, NULL);
|
2007-08-05 01:07:39 -07:00
|
|
|
e_module_delayed_set(m, 1);
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2010-02-27 09:04:55 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s/e-module-conf.edj",
|
|
|
|
e_module_dir_get(conf_module));
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2010-03-01 04:36:19 -08:00
|
|
|
e_configure_registry_category_add("advanced", 80, _("Advanced"),
|
2010-02-27 09:04:55 -08:00
|
|
|
NULL, "preferences-advanced");
|
2010-03-01 04:36:19 -08:00
|
|
|
e_configure_registry_item_add("advanced/conf", 110, _("Configuration Panel"),
|
2010-02-27 09:04:55 -08:00
|
|
|
NULL, buf, e_int_config_conf_module);
|
|
|
|
|
|
|
|
conf_edd = E_CONFIG_DD_NEW("Config", Config);
|
2010-03-01 04:36:19 -08:00
|
|
|
#undef T
|
|
|
|
#undef D
|
|
|
|
#define T Config
|
|
|
|
#define D conf_edd
|
2010-02-27 09:04:55 -08:00
|
|
|
E_CONFIG_VAL(D, T, version, INT);
|
|
|
|
E_CONFIG_VAL(D, T, menu_augmentation, INT);
|
|
|
|
|
|
|
|
conf = e_config_domain_load("module.conf", conf_edd);
|
2010-03-01 04:36:19 -08:00
|
|
|
if (conf)
|
2010-02-27 09:04:55 -08:00
|
|
|
{
|
2013-01-14 15:42:40 -08:00
|
|
|
if (!e_util_module_config_check(_("Configuration Panel"), conf->version, MOD_CONFIG_FILE_VERSION))
|
2012-08-30 01:04:35 -07:00
|
|
|
_conf_free();
|
2010-02-27 09:04:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!conf) _conf_new();
|
|
|
|
conf->module = m;
|
2010-03-01 04:36:19 -08:00
|
|
|
|
2010-02-27 09:04:55 -08:00
|
|
|
if (conf->menu_augmentation)
|
|
|
|
{
|
2010-03-01 04:36:19 -08:00
|
|
|
conf->aug =
|
2010-03-01 04:50:44 -08:00
|
|
|
e_int_menus_menu_augmentation_add
|
2012-06-14 03:07:33 -07:00
|
|
|
("config/2", e_mod_config_menu_add, NULL, NULL, NULL);
|
2010-02-27 09:04:55 -08:00
|
|
|
}
|
|
|
|
|
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
|
2010-03-01 04:57:05 -08:00
|
|
|
e_modapi_shutdown(E_Module *m __UNUSED__)
|
2007-08-05 01:07:39 -07:00
|
|
|
{
|
2007-08-18 03:45:38 -07:00
|
|
|
e_configure_del();
|
2010-02-27 09:04:55 -08:00
|
|
|
|
|
|
|
e_configure_registry_item_del("advanced/conf");
|
|
|
|
e_configure_registry_category_del("advanced");
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2010-02-27 09:04:55 -08:00
|
|
|
if (conf->cfd) e_object_del(E_OBJECT(conf->cfd));
|
|
|
|
conf->cfd = NULL;
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2008-11-20 19:59:30 -08:00
|
|
|
e_gadcon_provider_unregister(&_gadcon_class);
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
/* remove module-supplied menu additions */
|
|
|
|
if (maug)
|
|
|
|
{
|
2012-06-14 03:07:33 -07:00
|
|
|
e_int_menus_menu_augmentation_del("config/0", maug);
|
|
|
|
maug = NULL;
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
2010-02-27 09:04:55 -08:00
|
|
|
if (conf->aug)
|
|
|
|
{
|
2010-03-01 04:50:44 -08:00
|
|
|
e_int_menus_menu_augmentation_del("config/2", conf->aug);
|
2010-02-27 14:38:35 -08:00
|
|
|
conf->aug = NULL;
|
2010-02-27 09:04:55 -08:00
|
|
|
}
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
/* remove module-supplied action */
|
|
|
|
if (act)
|
|
|
|
{
|
2012-12-16 08:58:17 -08:00
|
|
|
e_action_predef_name_del("Launch", "Settings Panel");
|
2012-06-14 03:07:33 -07:00
|
|
|
e_action_del("configuration");
|
|
|
|
act = NULL;
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
|
|
|
conf_module = NULL;
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2010-02-27 09:04:55 -08:00
|
|
|
E_FREE(conf);
|
|
|
|
E_CONFIG_DD_FREE(conf_edd);
|
2010-02-27 14:38:35 -08:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2010-03-01 04:57:05 -08:00
|
|
|
e_modapi_save(E_Module *m __UNUSED__)
|
2007-08-05 01:07:39 -07:00
|
|
|
{
|
2010-02-27 09:04:55 -08:00
|
|
|
e_config_domain_save("module.conf", conf_edd, conf);
|
2007-08-05 01:07:39 -07:00
|
|
|
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;
|
2010-01-04 21:32:39 -08:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
if (obj)
|
|
|
|
{
|
2012-06-14 03:07:33 -07:00
|
|
|
if (obj->type == E_MANAGER_TYPE)
|
2015-03-13 14:47:36 -07:00
|
|
|
zone = e_zone_current_get();
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
else if (obj->type == E_COMP_TYPE)
|
2015-03-13 14:19:17 -07:00
|
|
|
zone = e_zone_current_get();
|
2012-06-14 03:07:33 -07:00
|
|
|
else if (obj->type == E_ZONE_TYPE)
|
2010-01-04 21:32:39 -08:00
|
|
|
zone = ((E_Zone *)obj);
|
2012-06-14 03:07:33 -07:00
|
|
|
else
|
2015-03-13 14:47:36 -07:00
|
|
|
zone = e_zone_current_get();
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
2015-03-13 14:47:36 -07:00
|
|
|
if (!zone) zone = e_zone_current_get();
|
2010-01-04 21:32:39 -08:00
|
|
|
if ((zone) && (params))
|
2014-11-02 18:35:13 -08:00
|
|
|
e_configure_registry_call(params, NULL, params);
|
2009-03-19 11:28:01 -07:00
|
|
|
else if (zone)
|
2015-03-13 14:44:24 -07:00
|
|
|
e_configure_show(e_comp, params);
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* menu item callback(s) */
|
2010-03-01 04:36:19 -08:00
|
|
|
static void
|
2015-03-13 14:44:24 -07:00
|
|
|
_e_mod_conf_cb(void *data __UNUSED__, E_Menu *m EINA_UNUSED, E_Menu_Item *mi __UNUSED__)
|
2007-08-05 01:07:39 -07:00
|
|
|
{
|
2015-03-13 14:44:24 -07:00
|
|
|
e_configure_show(e_comp, NULL);
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2010-02-27 14:38:35 -08:00
|
|
|
E_Menu *m;
|
2010-01-04 21:32:39 -08:00
|
|
|
|
2010-02-27 14:38:35 -08:00
|
|
|
if (!(m = e_menu_new())) return 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
|
|
|
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
|
2010-03-01 04:57:05 -08:00
|
|
|
_e_mod_menu_add(void *data __UNUSED__, E_Menu *m)
|
2007-08-05 01:07:39 -07:00
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
2009-12-22 11:47:35 -08:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
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());
|
2012-09-03 01:30:39 -07:00
|
|
|
e_object_unref(E_OBJECT(mi->submenu));
|
2007-08-05 01:07:39 -07:00
|
|
|
}
|
2010-02-27 09:04:55 -08:00
|
|
|
|
2010-03-01 04:36:19 -08:00
|
|
|
static void
|
|
|
|
_conf_new(void)
|
2010-02-27 09:04:55 -08:00
|
|
|
{
|
|
|
|
conf = E_NEW(Config, 1);
|
2012-12-21 15:57:05 -08:00
|
|
|
conf->menu_augmentation = 1;
|
2010-02-27 09:04:55 -08:00
|
|
|
|
2012-12-21 15:57:05 -08:00
|
|
|
conf->version = MOD_CONFIG_FILE_VERSION;
|
|
|
|
e_config_save_queue();
|
2010-02-27 09:04:55 -08:00
|
|
|
}
|
|
|
|
|
2010-03-01 04:36:19 -08:00
|
|
|
static void
|
|
|
|
_conf_free(void)
|
2010-02-27 09:04:55 -08:00
|
|
|
{
|
|
|
|
E_FREE(conf);
|
|
|
|
}
|