enlightenment/src/modules/everything/evry_plug_settings.c

221 lines
4.6 KiB
C
Raw Normal View History

#include "e.h"
#include "evry_api.h"
typedef struct _Plugin Plugin;
typedef struct _Settings_Item Settings_Item;
struct _Plugin
{
Evry_Plugin base;
Eina_List *items;
Eina_List *categories;
Eina_Bool parent;
};
struct _Settings_Item
{
Evry_Item base;
E_Configure_Cat *ecat;
E_Configure_It *eci;
};
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Evry_Plugin *p;
static Evry_Action *act;
static Evry_Type E_SETTINGS;
static void
_finish(Evry_Plugin *plugin)
{
Settings_Item *it;
GET_PLUGIN(pl, plugin);
EVRY_PLUGIN_ITEMS_CLEAR(pl);
EINA_LIST_FREE (pl->items, it)
EVRY_ITEM_FREE(it);
EINA_LIST_FREE (pl->categories, it)
EVRY_ITEM_FREE(it);
E_FREE(pl);
}
static Evas_Object *
_icon_get(Evry_Item *item, Evas *e EINA_UNUSED)
{
Settings_Item *it = (Settings_Item *)item;
if (!item->icon)
{
if (it->eci && it->eci->icon)
item->icon = eina_stringshare_add(it->eci->icon);
else if (it->ecat->icon)
item->icon = eina_stringshare_add(it->ecat->icon);
}
return NULL;
}
static Evry_Plugin *
_browse(Evry_Plugin *plugin, const Evry_Item *item)
{
Plugin *pl;
Eina_List *l;
Settings_Item *it, *it2;
if (!CHECK_TYPE(item, E_SETTINGS))
return NULL;
it = (Settings_Item *)item;
EVRY_PLUGIN_INSTANCE(pl, plugin);
pl->parent = EINA_TRUE;
GET_PLUGIN(parent, item->plugin);
EINA_LIST_FOREACH (parent->items, l, it2)
{
if (it2->ecat == it->ecat)
{
EVRY_ITEM_REF(it2);
pl->items = eina_list_append(pl->items, it2);
}
}
return EVRY_PLUGIN(pl);
}
static Evry_Plugin *
_begin(Evry_Plugin *plugin, const Evry_Item *item EINA_UNUSED)
{
Plugin *pl;
EVRY_PLUGIN_INSTANCE(pl, plugin);
return EVRY_PLUGIN(pl);
}
static int
_fetch(Evry_Plugin *plugin, const char *input)
{
int len = input ? strlen(input) : 0;
GET_PLUGIN(pl, plugin);
EVRY_PLUGIN_ITEMS_CLEAR(pl);
if ((!pl->parent) && (len < plugin->config->min_query))
return 0;
if (!pl->categories && !pl->items)
{
Settings_Item *it;
Eina_List *l, *ll;
E_Configure_Cat *ecat;
E_Configure_It *eci;
EINA_LIST_FOREACH (e_configure_registry, l, ecat)
{
if ((ecat->pri < 0) || (!ecat->items)) continue;
if (!strcmp(ecat->cat, "system")) continue;
it = EVRY_ITEM_NEW(Settings_Item, pl, ecat->label, _icon_get, NULL);
it->ecat = ecat;
EVRY_ITEM(it)->browseable = EINA_TRUE;
pl->categories = eina_list_append(pl->categories, it);
EINA_LIST_FOREACH (ecat->items, ll, eci)
{
if (eci->pri < 0) continue;
it = EVRY_ITEM_NEW(Settings_Item, pl, eci->label, _icon_get, NULL);
it->eci = eci;
it->ecat = ecat;
EVRY_ITEM_DETAIL_SET(it, ecat->label);
pl->items = eina_list_append(pl->items, it);
}
}
}
EVRY_PLUGIN_ITEMS_ADD(pl, pl->categories, input, 1, 1);
if (input || pl->parent)
EVRY_PLUGIN_ITEMS_ADD(pl, pl->items, input, 1, 1);
return EVRY_PLUGIN_HAS_ITEMS(pl);
}
static int
_action_check(Evry_Action *action EINA_UNUSED, const Evry_Item *item)
{
return !!(((Settings_Item *)item)->eci);
}
static int
_action(Evry_Action *action)
{
char buf[1024];
Settings_Item *it;
it = (Settings_Item *)action->it1.item;
snprintf(buf, sizeof(buf), "%s/%s", it->ecat->cat, it->eci->item);
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
e_configure_registry_call(buf, NULL, NULL);
return EVRY_ACTION_FINISHED;
}
static int
_plugins_init(const Evry_API *_api)
{
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE;
E_SETTINGS = evry->type_register("E_SETTINGS");
p = EVRY_PLUGIN_BASE(N_("Settings"), "configure", E_SETTINGS, _begin, _finish, _fetch);
p->browse = &_browse;
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 10);
act = EVRY_ACTION_NEW(N_("Show Dialog"), E_SETTINGS, 0,
"preferences-advanced", _action, _action_check);
evry->action_register(act, 0);
return EINA_TRUE;
}
static void
_plugins_shutdown(void)
{
EVRY_PLUGIN_FREE(p);
EVRY_ACTION_FREE(act);
}
/***************************************************************************/
Eina_Bool
evry_plug_settings_init(E_Module *m EINA_UNUSED)
{
EVRY_MODULE_NEW(evry_module, evry, _plugins_init, _plugins_shutdown);
return EINA_TRUE;
}
void
evry_plug_settings_shutdown(void)
{
EVRY_MODULE_FREE(evry_module);
}
void
evry_plug_settings_save(void){}