2008-08-30 18:51:27 -07:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2012-09-03 14:58:20 -07:00
|
|
|
#include "E_Connman.h"
|
|
|
|
|
2012-09-05 01:15:41 -07:00
|
|
|
E_Module *connman_mod = NULL;
|
2012-09-03 14:57:16 -07:00
|
|
|
static char tmpbuf[4096]; /* general purpose buffer, just use immediately */
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
const char _e_connman_name[] = "connman";
|
2012-12-16 00:57:55 -08:00
|
|
|
const char _e_connman_Name[] = N_("Connection Manager");
|
2012-09-03 14:57:16 -07:00
|
|
|
int _e_connman_log_dom = -1;
|
2009-12-31 13:44:33 -08:00
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
const char *
|
|
|
|
e_connman_theme_path(void)
|
2009-12-31 17:12:53 -08:00
|
|
|
{
|
2012-09-03 14:57:16 -07:00
|
|
|
#define TF "/e-module-connman.edj"
|
|
|
|
size_t dirlen;
|
2009-12-31 17:12:53 -08:00
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
dirlen = strlen(connman_mod->dir);
|
|
|
|
if (dirlen >= sizeof(tmpbuf) - sizeof(TF))
|
|
|
|
return NULL;
|
2009-12-31 17:12:53 -08:00
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
memcpy(tmpbuf, connman_mod->dir, dirlen);
|
|
|
|
memcpy(tmpbuf + dirlen, TF, sizeof(TF));
|
2009-12-31 17:12:53 -08:00
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
return tmpbuf;
|
|
|
|
#undef TF
|
2009-12-31 17:12:53 -08:00
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_econnman_service_new_icon(struct Connman_Service *cs, Evas *evas)
|
2012-09-03 14:59:16 -07:00
|
|
|
{
|
|
|
|
const char *type = econnman_service_type_to_str(cs->type);
|
2012-09-03 15:01:30 -07:00
|
|
|
Edje_Message_Int_Set *msg;
|
2012-09-03 14:59:16 -07:00
|
|
|
Evas_Object *icon;
|
|
|
|
char buf[128];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "e/modules/connman/icon/%s", type);
|
|
|
|
icon = edje_object_add(evas);
|
|
|
|
e_theme_edje_object_set(icon, "base/theme/modules/connman", buf);
|
|
|
|
|
2012-09-03 15:01:30 -07:00
|
|
|
msg = malloc(sizeof(*msg) + sizeof(int));
|
|
|
|
msg->count = 2;
|
|
|
|
msg->val[0] = cs->state;
|
|
|
|
msg->val[1] = cs->strength;
|
2012-09-03 14:59:16 -07:00
|
|
|
|
2012-09-03 15:01:30 -07:00
|
|
|
edje_object_message_send(icon, EDJE_MESSAGE_INT_SET, 1, msg);
|
|
|
|
free(msg);
|
2012-09-03 14:59:20 -07:00
|
|
|
|
2012-09-03 14:59:16 -07:00
|
|
|
return icon;
|
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_econnman_service_new_end(struct Connman_Service *cs, Evas *evas)
|
2012-09-03 15:01:18 -07:00
|
|
|
{
|
|
|
|
Eina_Iterator *iter;
|
|
|
|
Evas_Object *end;
|
|
|
|
void *security;
|
|
|
|
char buf[128];
|
|
|
|
|
|
|
|
end = edje_object_add(evas);
|
|
|
|
e_theme_edje_object_set(end, "base/theme/modules/connman",
|
|
|
|
"e/modules/connman/end");
|
|
|
|
|
|
|
|
if (!cs->security)
|
|
|
|
return end;
|
|
|
|
|
|
|
|
iter = eina_array_iterator_new(cs->security);
|
|
|
|
while (eina_iterator_next(iter, &security))
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "e,security,%s", (const char *)security);
|
|
|
|
edje_object_signal_emit(end, buf, "e");
|
|
|
|
}
|
|
|
|
eina_iterator_free(iter);
|
|
|
|
|
|
|
|
return end;
|
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
|
|
|
_econnman_disconnect_cb(void *data, const char *error)
|
2012-09-03 15:00:10 -07:00
|
|
|
{
|
|
|
|
const char *path = data;
|
|
|
|
|
|
|
|
if (error == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ERR("Could not disconnect %s: %s", path, error);
|
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
|
|
|
_econnman_connect_cb(void *data, const char *error)
|
2012-09-03 15:00:10 -07:00
|
|
|
{
|
|
|
|
const char *path = data;
|
|
|
|
|
|
|
|
if (error == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ERR("Could not connect %s: %s", path, error);
|
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
|
|
|
_econnman_popup_selected_cb(void *data)
|
2012-09-03 15:00:10 -07:00
|
|
|
{
|
|
|
|
E_Connman_Instance *inst = data;
|
|
|
|
const char *path;
|
|
|
|
struct Connman_Service *cs;
|
|
|
|
|
|
|
|
path = e_widget_ilist_selected_value_get(inst->ui.popup.list);
|
|
|
|
if (path == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
cs = econnman_manager_find_service(inst->ctxt->cm, path);
|
2013-01-02 12:38:25 -08:00
|
|
|
if (!cs)
|
2012-09-03 15:00:10 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
switch (cs->state)
|
|
|
|
{
|
|
|
|
case CONNMAN_STATE_READY:
|
|
|
|
case CONNMAN_STATE_ONLINE:
|
|
|
|
INF("Disconnect %s", path);
|
2012-09-13 18:24:36 -07:00
|
|
|
econnman_service_disconnect(cs, _econnman_disconnect_cb,
|
|
|
|
(void *) path);
|
2012-09-03 15:00:10 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
INF("Connect %s", path);
|
|
|
|
econnman_service_connect(cs, _econnman_connect_cb, (void *) path);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
|
|
|
_econnman_popup_update(struct Connman_Manager *cm, E_Connman_Instance *inst)
|
2012-09-03 14:59:11 -07:00
|
|
|
{
|
|
|
|
Evas_Object *list = inst->ui.popup.list;
|
2012-09-12 06:35:32 -07:00
|
|
|
Evas_Object *powered = inst->ui.popup.powered;
|
2012-09-03 14:59:16 -07:00
|
|
|
Evas *evas = evas_object_evas_get(list);
|
2012-09-03 14:59:11 -07:00
|
|
|
struct Connman_Service *cs;
|
2012-09-03 15:04:57 -07:00
|
|
|
const char *hidden = "«hidden»";
|
2012-09-03 14:59:11 -07:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(cm);
|
|
|
|
|
|
|
|
e_widget_ilist_freeze(list);
|
|
|
|
e_widget_ilist_clear(list);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(cm->services, cs)
|
2012-09-03 14:59:16 -07:00
|
|
|
{
|
|
|
|
Evas_Object *icon = _econnman_service_new_icon(cs, evas);
|
2012-09-03 15:01:18 -07:00
|
|
|
Evas_Object *end = _econnman_service_new_end(cs, evas);
|
2012-09-03 15:04:57 -07:00
|
|
|
e_widget_ilist_append_full(list, icon, end, cs->name ?: hidden,
|
2012-09-03 15:01:18 -07:00
|
|
|
_econnman_popup_selected_cb,
|
2013-01-02 12:38:25 -08:00
|
|
|
inst, cs->path);
|
2012-09-03 14:59:16 -07:00
|
|
|
}
|
2012-09-03 14:59:11 -07:00
|
|
|
|
|
|
|
e_widget_ilist_thaw(list);
|
|
|
|
e_widget_ilist_go(list);
|
2012-09-12 06:35:32 -07:00
|
|
|
|
|
|
|
if (inst->ctxt)
|
|
|
|
{
|
|
|
|
inst->ctxt->powered = cm->powered;
|
|
|
|
}
|
|
|
|
e_widget_check_checked_set(powered, cm->powered);
|
2012-09-03 14:59:11 -07:00
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
void
|
|
|
|
econnman_mod_services_changed(struct Connman_Manager *cm)
|
2012-09-03 14:59:11 -07:00
|
|
|
{
|
|
|
|
E_Connman_Module_Context *ctxt = connman_mod->data;
|
|
|
|
const Eina_List *l;
|
|
|
|
E_Connman_Instance *inst;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ctxt->instances, l, inst)
|
|
|
|
{
|
|
|
|
if (!inst->popup)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
_econnman_popup_update(cm, inst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-03 15:07:01 -07:00
|
|
|
static void
|
2012-09-05 19:18:32 -07:00
|
|
|
_econnman_app_launch(E_Connman_Instance *inst)
|
2012-09-03 15:07:01 -07:00
|
|
|
{
|
2014-08-06 20:13:13 -07:00
|
|
|
Efreet_Desktop *desktop;
|
2012-09-05 19:18:32 -07:00
|
|
|
E_Zone *zone;
|
|
|
|
|
2014-08-06 20:13:13 -07:00
|
|
|
desktop = efreet_util_desktop_file_id_find("econnman.desktop");
|
2012-09-05 19:18:32 -07:00
|
|
|
if (!desktop)
|
|
|
|
{
|
|
|
|
e_util_dialog_internal
|
|
|
|
(_("Missing Application"),
|
|
|
|
_("This module wants to execute an external application "
|
|
|
|
"EConnMan that does not exist.<br>"
|
|
|
|
"Please install <b>EConnMan</b> application."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
zone = e_gadcon_client_zone_get(inst->gcc);
|
|
|
|
if (!zone)
|
|
|
|
zone = e_util_zone_current_get(e_manager_current_get());
|
|
|
|
|
|
|
|
e_exec(zone, desktop, NULL, NULL, "econnman/app");
|
|
|
|
efreet_desktop_free(desktop);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-05-07 02:37:22 -07:00
|
|
|
_econnman_configure_cb(void *data, void *data2 EINA_UNUSED)
|
2012-09-05 19:18:32 -07:00
|
|
|
{
|
|
|
|
E_Connman_Instance *inst = data;
|
2012-09-10 21:42:08 -07:00
|
|
|
econnman_popup_del(inst);
|
2012-09-05 19:18:32 -07:00
|
|
|
_econnman_app_launch(inst);
|
2012-09-03 15:07:01 -07:00
|
|
|
}
|
|
|
|
|
2012-09-12 06:35:32 -07:00
|
|
|
static void
|
2014-05-07 02:37:22 -07:00
|
|
|
_econnman_powered_changed(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED)
|
2012-09-12 06:35:32 -07:00
|
|
|
{
|
|
|
|
E_Connman_Instance *inst = data;
|
|
|
|
E_Connman_Module_Context *ctxt = inst->ctxt;
|
2012-09-13 18:24:36 -07:00
|
|
|
|
2012-09-12 06:35:32 -07:00
|
|
|
if (!ctxt) return;
|
|
|
|
if (!ctxt->cm) return;
|
|
|
|
econnman_powered_set(ctxt->cm, ctxt->powered);
|
|
|
|
}
|
|
|
|
|
2012-12-02 19:38:58 -08:00
|
|
|
static void
|
|
|
|
_e_connman_widget_size_set(E_Connman_Instance *inst, Evas_Object *widget, Evas_Coord percent_w, Evas_Coord percent_h, Evas_Coord min_w, Evas_Coord min_h, Evas_Coord max_w, Evas_Coord max_h)
|
|
|
|
{
|
|
|
|
Evas_Coord w, h, zw, zh;
|
|
|
|
E_Zone *zone;
|
|
|
|
|
|
|
|
zone = e_gadcon_client_zone_get(inst->gcc);
|
|
|
|
e_zone_useful_geometry_get(zone, NULL, NULL, &zw, &zh);
|
|
|
|
|
|
|
|
w = zw * percent_w / 100.0;
|
|
|
|
h = zh * percent_h / 100.0;
|
|
|
|
|
|
|
|
if (w < min_w)
|
|
|
|
w = min_w;
|
|
|
|
else if (w > max_w)
|
|
|
|
w = max_w;
|
|
|
|
if (h < min_h)
|
|
|
|
h = min_h;
|
|
|
|
else if (h > max_h)
|
|
|
|
h = max_h;
|
|
|
|
|
|
|
|
e_widget_size_min_set(widget, w, h);
|
|
|
|
}
|
|
|
|
|
2013-02-18 05:43:47 -08:00
|
|
|
static void
|
|
|
|
_econnman_popup_del_cb(void *obj)
|
|
|
|
{
|
|
|
|
econnman_popup_del(e_object_data_get(obj));
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
_econnman_popup_del(void *data, Evas_Object *obj EINA_UNUSED)
|
|
|
|
{
|
|
|
|
E_Connman_Instance *inst = data;
|
|
|
|
|
|
|
|
E_FREE_FUNC(inst->popup, e_object_del);
|
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
|
|
|
_econnman_popup_new(E_Connman_Instance *inst)
|
2012-09-03 14:59:11 -07:00
|
|
|
{
|
|
|
|
E_Connman_Module_Context *ctxt = inst->ctxt;
|
2012-09-12 06:35:32 -07:00
|
|
|
Evas_Object *list, *bt, *ck;
|
2012-09-03 15:07:01 -07:00
|
|
|
Evas *evas;
|
2012-09-03 14:59:11 -07:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(inst->popup == NULL);
|
|
|
|
|
|
|
|
if (!ctxt->cm)
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
inst->popup = e_gadcon_popup_new(inst->gcc, 0);
|
2015-03-13 12:12:20 -07:00
|
|
|
evas = e_comp->evas;
|
2012-09-03 14:59:11 -07:00
|
|
|
|
2012-09-03 15:07:01 -07:00
|
|
|
list = e_widget_list_add(evas, 0, 0);
|
2012-09-03 14:59:11 -07:00
|
|
|
inst->ui.popup.list = e_widget_ilist_add(evas, 24, 24, NULL);
|
2014-06-27 09:15:21 -07:00
|
|
|
e_widget_size_min_set(inst->ui.popup.list, 60, 100);
|
2012-09-03 15:07:01 -07:00
|
|
|
e_widget_list_object_append(list, inst->ui.popup.list, 1, 1, 0.5);
|
2012-09-03 14:59:11 -07:00
|
|
|
|
2012-09-12 06:35:32 -07:00
|
|
|
ck = e_widget_check_add(evas, _("Wifi On"), &(ctxt->powered));
|
|
|
|
inst->ui.popup.powered = ck;
|
|
|
|
e_widget_list_object_append(list, ck, 1, 0, 0.5);
|
2012-09-13 18:24:36 -07:00
|
|
|
evas_object_smart_callback_add(ck, "changed",
|
2012-09-12 06:35:32 -07:00
|
|
|
_econnman_powered_changed, inst);
|
2012-09-13 18:24:36 -07:00
|
|
|
|
2012-09-03 14:59:11 -07:00
|
|
|
_econnman_popup_update(ctxt->cm, inst);
|
|
|
|
|
2014-08-11 07:45:58 -07:00
|
|
|
if (efreet_util_desktop_file_id_find("econnman.desktop"))
|
|
|
|
{
|
|
|
|
bt = e_widget_button_add(evas, _("Configure"), NULL,
|
|
|
|
_econnman_configure_cb, inst, NULL);
|
|
|
|
e_widget_list_object_append(list, bt, 1, 0, 0.5);
|
|
|
|
}
|
2012-09-03 15:07:01 -07:00
|
|
|
|
2012-12-02 19:38:58 -08:00
|
|
|
/* 30,40 % -- min vga, max uvga */
|
2014-06-27 09:15:21 -07:00
|
|
|
_e_connman_widget_size_set(inst, list, 10, 30, 192, 192, 384, 384);
|
2012-09-03 15:07:01 -07:00
|
|
|
e_gadcon_popup_content_set(inst->popup, list);
|
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_comp_object_util_autoclose(inst->popup->comp_object, _econnman_popup_del, NULL, inst);
|
2012-09-03 14:59:11 -07:00
|
|
|
e_gadcon_popup_show(inst->popup);
|
2013-02-18 05:43:47 -08:00
|
|
|
e_object_data_set(E_OBJECT(inst->popup), inst);
|
|
|
|
E_OBJECT_DEL_SET(inst->popup, _econnman_popup_del_cb);
|
2012-09-03 14:59:11 -07:00
|
|
|
}
|
|
|
|
|
2012-09-05 01:15:41 -07:00
|
|
|
void
|
|
|
|
econnman_popup_del(E_Connman_Instance *inst)
|
2012-09-03 14:59:11 -07:00
|
|
|
{
|
2013-02-19 04:58:25 -08:00
|
|
|
E_FREE_FUNC(inst->popup, e_object_del);
|
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
|
|
|
inst->ui.popup.powered = inst->ui.popup.list = NULL;
|
2012-09-03 14:59:11 -07:00
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
2014-05-07 02:37:22 -07:00
|
|
|
_econnman_mod_manager_update_inst(E_Connman_Module_Context *ctxt EINA_UNUSED,
|
2012-09-13 18:24:36 -07:00
|
|
|
E_Connman_Instance *inst,
|
|
|
|
enum Connman_State state,
|
|
|
|
enum Connman_Service_Type type)
|
2012-09-03 14:58:20 -07:00
|
|
|
{
|
|
|
|
Evas_Object *o = inst->ui.gadget;
|
2012-09-03 15:06:53 -07:00
|
|
|
Edje_Message_Int_Set *msg;
|
|
|
|
const char *typestr;
|
2012-09-03 15:01:24 -07:00
|
|
|
char buf[128];
|
2012-09-03 14:58:20 -07:00
|
|
|
|
2012-09-03 15:06:53 -07:00
|
|
|
msg = malloc(sizeof(*msg) + sizeof(int));
|
|
|
|
msg->count = 2;
|
|
|
|
msg->val[0] = state;
|
|
|
|
/* FIXME check if it's possible to receive strenght as props of cm */
|
|
|
|
if (type == -1)
|
|
|
|
msg->val[1] = 0;
|
2012-09-03 15:01:24 -07:00
|
|
|
else
|
2012-09-03 15:06:53 -07:00
|
|
|
msg->val[1] = 100;
|
2012-09-03 14:58:20 -07:00
|
|
|
|
2012-09-03 15:06:53 -07:00
|
|
|
edje_object_message_send(o, EDJE_MESSAGE_INT_SET, 1, msg);
|
|
|
|
free(msg);
|
2012-09-03 14:59:30 -07:00
|
|
|
|
2012-09-03 15:01:24 -07:00
|
|
|
typestr = econnman_service_type_to_str(type);
|
|
|
|
snprintf(buf, sizeof(buf), "e,changed,technology,%s", typestr);
|
|
|
|
edje_object_signal_emit(o, buf, "e");
|
2012-09-03 14:58:20 -07:00
|
|
|
|
|
|
|
DBG("state=%d type=%d", state, type);
|
|
|
|
}
|
|
|
|
|
2012-09-22 07:12:12 -07:00
|
|
|
static enum Connman_Service_Type _econnman_manager_service_type_get(
|
|
|
|
struct Connman_Manager *cm)
|
2012-09-03 14:58:20 -07:00
|
|
|
{
|
|
|
|
DBG("cm->services=%p", cm->services);
|
|
|
|
|
2012-09-03 15:06:53 -07:00
|
|
|
if ((cm->services) && ((cm->state == CONNMAN_STATE_ONLINE) ||
|
|
|
|
(cm->state == CONNMAN_STATE_READY)))
|
|
|
|
/* FIXME would be nice to represent "configuring state".
|
|
|
|
theme already supports it */
|
|
|
|
/* (cm->state == CONNMAN_STATE_ASSOCIATION) ||
|
|
|
|
(cm->state == CONNMAN_STATE_CONFIGURATION))) */
|
2012-09-03 14:58:20 -07:00
|
|
|
{
|
|
|
|
struct Connman_Service *cs = EINA_INLIST_CONTAINER_GET(cm->services,
|
|
|
|
struct Connman_Service);
|
2012-09-22 07:12:12 -07:00
|
|
|
return cs->type;
|
2012-09-03 14:58:20 -07:00
|
|
|
}
|
2012-09-22 07:12:12 -07:00
|
|
|
return CONNMAN_SERVICE_TYPE_NONE;
|
|
|
|
}
|
2012-09-03 14:58:20 -07:00
|
|
|
|
2012-09-22 07:12:12 -07:00
|
|
|
void
|
|
|
|
econnman_mod_manager_update(struct Connman_Manager *cm)
|
|
|
|
{
|
|
|
|
enum Connman_Service_Type type;
|
|
|
|
E_Connman_Module_Context *ctxt = connman_mod->data;
|
|
|
|
E_Connman_Instance *inst;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(cm);
|
|
|
|
|
|
|
|
type = _econnman_manager_service_type_get(cm);
|
2012-09-03 14:58:20 -07:00
|
|
|
EINA_LIST_FOREACH(ctxt->instances, l, inst)
|
|
|
|
_econnman_mod_manager_update_inst(ctxt, inst, cm->state, type);
|
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
|
|
|
_econnman_gadget_setup(E_Connman_Instance *inst)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
E_Connman_Module_Context *ctxt = inst->ctxt;
|
2012-09-03 14:58:15 -07:00
|
|
|
Evas_Object *o = inst->ui.gadget;
|
2009-12-31 13:44:33 -08:00
|
|
|
|
2012-09-03 14:59:06 -07:00
|
|
|
DBG("has_manager=%d", ctxt->cm != NULL);
|
2012-09-03 14:58:47 -07:00
|
|
|
|
2012-09-03 14:59:06 -07:00
|
|
|
if (!ctxt->cm)
|
2009-12-31 13:44:33 -08:00
|
|
|
{
|
2011-03-21 13:32:57 -07:00
|
|
|
edje_object_signal_emit(o, "e,unavailable", "e");
|
|
|
|
edje_object_signal_emit(o, "e,changed,connected,no", "e");
|
2010-01-01 21:25:27 -08:00
|
|
|
}
|
2009-12-31 13:44:33 -08:00
|
|
|
else
|
2012-09-03 14:58:15 -07:00
|
|
|
edje_object_signal_emit(o, "e,available", "e");
|
2009-12-31 17:12:53 -08:00
|
|
|
|
2012-09-03 14:58:15 -07:00
|
|
|
return;
|
2012-09-03 14:57:16 -07:00
|
|
|
}
|
2009-12-31 17:12:53 -08:00
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
void
|
|
|
|
econnman_mod_manager_inout(struct Connman_Manager *cm)
|
2012-09-03 14:58:31 -07:00
|
|
|
{
|
|
|
|
E_Connman_Module_Context *ctxt = connman_mod->data;
|
|
|
|
const Eina_List *l;
|
|
|
|
E_Connman_Instance *inst;
|
|
|
|
|
2012-09-03 14:59:06 -07:00
|
|
|
DBG("Manager %s", cm ? "in" : "out");
|
|
|
|
ctxt->cm = cm;
|
2012-09-03 14:58:31 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ctxt->instances, l, inst)
|
|
|
|
_econnman_gadget_setup(inst);
|
2012-09-03 14:58:37 -07:00
|
|
|
|
2012-09-03 14:59:30 -07:00
|
|
|
if (ctxt->cm)
|
|
|
|
econnman_mod_manager_update(cm);
|
2012-09-03 14:58:31 -07:00
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
2014-05-07 02:37:22 -07:00
|
|
|
_econnman_menu_cb_configure(void *data, E_Menu *menu EINA_UNUSED,
|
|
|
|
E_Menu_Item *mi EINA_UNUSED)
|
2012-09-03 14:59:50 -07:00
|
|
|
{
|
2012-09-05 19:18:32 -07:00
|
|
|
E_Connman_Instance *inst = data;
|
|
|
|
_econnman_app_launch(inst);
|
2012-09-03 14:59:50 -07:00
|
|
|
}
|
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static void
|
|
|
|
_econnman_menu_new(E_Connman_Instance *inst, Evas_Event_Mouse_Down *ev)
|
2012-09-03 14:59:50 -07:00
|
|
|
{
|
|
|
|
E_Menu *m;
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
m = e_menu_new();
|
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, _("Settings"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "configure");
|
|
|
|
e_menu_item_callback_set(mi, _econnman_menu_cb_configure, inst);
|
|
|
|
|
|
|
|
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
|
|
|
|
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, NULL, NULL);
|
|
|
|
e_menu_activate_mouse(m,
|
|
|
|
e_util_zone_current_get(e_manager_current_get()),
|
|
|
|
x + ev->output.x, y + ev->output.y, 1, 1,
|
|
|
|
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
|
|
|
|
}
|
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
static void
|
2014-05-07 02:37:22 -07:00
|
|
|
_econnman_cb_mouse_down(void *data, Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED, void *event)
|
2012-09-03 14:57:16 -07:00
|
|
|
{
|
2012-09-03 14:59:11 -07:00
|
|
|
E_Connman_Instance *inst = data;
|
|
|
|
Evas_Event_Mouse_Down *ev = event;
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ev->button == 1)
|
|
|
|
{
|
|
|
|
if (!inst->popup)
|
|
|
|
_econnman_popup_new(inst);
|
|
|
|
}
|
2012-09-03 14:59:50 -07:00
|
|
|
else if (ev->button == 3)
|
|
|
|
_econnman_menu_new(inst, ev);
|
2012-09-03 14:57:16 -07:00
|
|
|
}
|
2009-12-31 17:12:53 -08:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
/* Gadcon Api Functions */
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
static E_Gadcon_Client *
|
2012-09-03 14:57:16 -07:00
|
|
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
2009-12-31 13:44:33 -08:00
|
|
|
{
|
|
|
|
E_Connman_Instance *inst;
|
|
|
|
E_Connman_Module_Context *ctxt;
|
2012-09-22 07:12:12 -07:00
|
|
|
enum Connman_Service_Type type;
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
if (!connman_mod)
|
2010-03-11 16:16:21 -08:00
|
|
|
return NULL;
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
ctxt = connman_mod->data;
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
inst = E_NEW(E_Connman_Instance, 1);
|
|
|
|
inst->ctxt = ctxt;
|
|
|
|
inst->ui.gadget = edje_object_add(gc->evas);
|
|
|
|
e_theme_edje_object_set(inst->ui.gadget, "base/theme/modules/connman",
|
2011-03-21 13:32:57 -07:00
|
|
|
"e/modules/connman/main");
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->ui.gadget);
|
|
|
|
inst->gcc->data = inst;
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
evas_object_event_callback_add
|
2012-09-03 14:59:01 -07:00
|
|
|
(inst->ui.gadget, EVAS_CALLBACK_MOUSE_DOWN, _econnman_cb_mouse_down, inst);
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2012-09-03 14:58:15 -07:00
|
|
|
_econnman_gadget_setup(inst);
|
2009-06-07 01:56:16 -07:00
|
|
|
|
2012-09-22 07:12:12 -07:00
|
|
|
if (ctxt->cm)
|
|
|
|
{
|
|
|
|
/* Update main icon with the current state */
|
|
|
|
type = _econnman_manager_service_type_get(ctxt->cm);
|
|
|
|
_econnman_mod_manager_update_inst(ctxt, inst, ctxt->cm->state, type);
|
|
|
|
}
|
2009-12-31 13:44:33 -08:00
|
|
|
ctxt->instances = eina_list_append(ctxt->instances, inst);
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
return inst->gcc;
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-12-31 13:44:33 -08:00
|
|
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
E_Connman_Module_Context *ctxt;
|
|
|
|
E_Connman_Instance *inst;
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
if (!connman_mod)
|
2010-03-11 16:16:21 -08:00
|
|
|
return;
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
ctxt = connman_mod->data;
|
|
|
|
if (!ctxt)
|
2010-03-11 16:16:21 -08:00
|
|
|
return;
|
2009-12-31 13:44:33 -08:00
|
|
|
|
|
|
|
inst = gcc->data;
|
|
|
|
if (!inst)
|
2010-03-11 16:16:21 -08:00
|
|
|
return;
|
2009-12-31 13:44:33 -08:00
|
|
|
|
2012-09-03 14:59:11 -07:00
|
|
|
if (inst->popup)
|
2012-09-05 01:15:41 -07:00
|
|
|
econnman_popup_del(inst);
|
2012-09-03 14:59:11 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
evas_object_del(inst->ui.gadget);
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
ctxt->instances = eina_list_remove(ctxt->instances, inst);
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
E_FREE(inst);
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-05-07 02:37:22 -07:00
|
|
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
e_gadcon_client_aspect_set(gcc, 16, 16);
|
|
|
|
e_gadcon_client_min_size_set(gcc, 16, 16);
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
2011-11-14 14:04:27 -08:00
|
|
|
static const char *
|
2014-05-07 02:37:22 -07:00
|
|
|
_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2011-11-14 14:04:27 -08:00
|
|
|
return _(_e_connman_Name);
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
static Evas_Object *
|
2014-05-07 02:37:22 -07:00
|
|
|
_gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
Evas_Object *o;
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
o = edje_object_add(evas);
|
|
|
|
edje_object_file_set(o, e_connman_theme_path(), "icon");
|
|
|
|
return o;
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
static const char *
|
2014-05-07 02:37:22 -07:00
|
|
|
_gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
E_Connman_Module_Context *ctxt;
|
|
|
|
Eina_List *instances;
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
if (!connman_mod)
|
2010-03-11 16:16:21 -08:00
|
|
|
return NULL;
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
ctxt = connman_mod->data;
|
|
|
|
if (!ctxt)
|
2010-03-11 16:16:21 -08:00
|
|
|
return NULL;
|
2009-12-31 13:44:33 -08:00
|
|
|
|
|
|
|
instances = ctxt->instances;
|
|
|
|
snprintf(tmpbuf, sizeof(tmpbuf), "connman.%d", eina_list_count(instances));
|
|
|
|
return tmpbuf;
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
static const E_Gadcon_Client_Class _gc_class =
|
2011-03-21 13:32:57 -07:00
|
|
|
{
|
|
|
|
GADCON_CLIENT_CLASS_VERSION, _e_connman_name,
|
|
|
|
{
|
2010-03-11 16:16:21 -08:00
|
|
|
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
|
|
e_gadcon_site_is_not_toolbar
|
2011-03-21 13:32:57 -07:00
|
|
|
},
|
|
|
|
E_GADCON_CLIENT_STYLE_PLAIN
|
|
|
|
};
|
2009-12-31 13:44:33 -08:00
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, _e_connman_Name };
|
2009-12-31 13:44:33 -08:00
|
|
|
|
2012-09-13 18:24:36 -07:00
|
|
|
static E_Config_Dialog *
|
2014-11-02 18:35:13 -08:00
|
|
|
_econnman_config(Evas_Object *parent, const char *params EINA_UNUSED)
|
2010-02-02 10:28:50 -08:00
|
|
|
{
|
|
|
|
E_Connman_Module_Context *ctxt;
|
|
|
|
|
|
|
|
if (!connman_mod)
|
2010-03-11 16:16:21 -08:00
|
|
|
return NULL;
|
2010-02-02 10:28:50 -08:00
|
|
|
|
|
|
|
ctxt = connman_mod->data;
|
|
|
|
if (!ctxt)
|
2010-03-11 16:16:21 -08:00
|
|
|
return NULL;
|
2010-02-02 10:28:50 -08:00
|
|
|
|
|
|
|
if (!ctxt->conf_dialog)
|
2014-11-02 18:35:13 -08:00
|
|
|
ctxt->conf_dialog = e_connman_config_dialog_new(NULL, ctxt);
|
2010-02-02 10:28:50 -08:00
|
|
|
|
|
|
|
return ctxt->conf_dialog;
|
|
|
|
}
|
|
|
|
|
2010-03-11 16:16:21 -08:00
|
|
|
static const char _reg_cat[] = "extensions";
|
|
|
|
static const char _reg_item[] = "extensions/connman";
|
2010-02-02 10:29:37 -08:00
|
|
|
|
|
|
|
static void
|
2012-09-03 14:58:15 -07:00
|
|
|
_econnman_configure_registry_register(void)
|
2010-02-02 10:29:37 -08:00
|
|
|
{
|
2010-03-11 16:16:21 -08:00
|
|
|
e_configure_registry_category_add(_reg_cat, 90, _("Extensions"), NULL,
|
2011-03-21 13:32:57 -07:00
|
|
|
"preferences-extensions");
|
2010-02-02 10:29:37 -08:00
|
|
|
e_configure_registry_item_add(_reg_item, 110, _(_e_connman_Name), NULL,
|
2011-03-21 13:32:57 -07:00
|
|
|
e_connman_theme_path(),
|
2012-09-03 14:58:15 -07:00
|
|
|
_econnman_config);
|
2010-02-02 10:29:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-09-03 14:58:15 -07:00
|
|
|
_econnman_configure_registry_unregister(void)
|
2010-02-02 10:29:37 -08:00
|
|
|
{
|
|
|
|
e_configure_registry_item_del(_reg_item);
|
|
|
|
e_configure_registry_category_del(_reg_cat);
|
|
|
|
}
|
|
|
|
|
2010-02-13 04:14:44 -08:00
|
|
|
EAPI void *
|
|
|
|
e_modapi_init(E_Module *m)
|
|
|
|
{
|
|
|
|
E_Connman_Module_Context *ctxt;
|
2013-04-23 08:08:29 -07:00
|
|
|
Eldbus_Connection *c;
|
2010-02-13 04:14:44 -08:00
|
|
|
|
2010-02-13 04:16:14 -08:00
|
|
|
if (_e_connman_log_dom < 0)
|
|
|
|
{
|
2012-09-03 15:05:29 -07:00
|
|
|
_e_connman_log_dom = eina_log_domain_register("econnman",
|
|
|
|
EINA_COLOR_ORANGE);
|
2011-03-21 13:32:57 -07:00
|
|
|
if (_e_connman_log_dom < 0)
|
|
|
|
{
|
|
|
|
EINA_LOG_CRIT("could not register logging domain econnman");
|
|
|
|
goto error_log_domain;
|
|
|
|
}
|
2010-02-13 04:16:14 -08:00
|
|
|
}
|
|
|
|
|
2012-09-03 15:05:29 -07:00
|
|
|
ctxt = E_NEW(E_Connman_Module_Context, 1);
|
|
|
|
if (!ctxt)
|
|
|
|
goto error_connman_context;
|
2013-04-23 08:08:29 -07:00
|
|
|
eldbus_init();
|
|
|
|
c = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
|
2012-09-03 15:05:29 -07:00
|
|
|
if (!c)
|
|
|
|
goto error_dbus_bus_get;
|
|
|
|
if (!e_connman_system_init(c))
|
|
|
|
goto error_connman_system_init;
|
|
|
|
|
|
|
|
ctxt->conf_dialog = NULL;
|
|
|
|
connman_mod = m;
|
|
|
|
|
2012-09-03 14:58:15 -07:00
|
|
|
_econnman_configure_registry_register();
|
2009-12-31 13:44:33 -08:00
|
|
|
e_gadcon_provider_register(&_gc_class);
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
return ctxt;
|
2010-02-13 04:14:44 -08:00
|
|
|
|
2011-03-21 13:32:57 -07:00
|
|
|
error_connman_system_init:
|
2013-04-23 08:08:29 -07:00
|
|
|
eldbus_connection_unref(c);
|
2011-03-21 13:32:57 -07:00
|
|
|
error_dbus_bus_get:
|
2012-09-03 15:05:29 -07:00
|
|
|
E_FREE(ctxt);
|
|
|
|
error_connman_context:
|
|
|
|
eina_log_domain_unregister(_e_connman_log_dom);
|
|
|
|
error_log_domain:
|
|
|
|
_e_connman_log_dom = -1;
|
2010-02-13 04:14:44 -08:00
|
|
|
return NULL;
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-09-03 14:58:15 -07:00
|
|
|
_econnman_instances_free(E_Connman_Module_Context *ctxt)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
while (ctxt->instances)
|
2010-01-01 09:15:16 -08:00
|
|
|
{
|
2012-09-03 14:58:15 -07:00
|
|
|
E_Connman_Instance *inst = ctxt->instances->data;
|
|
|
|
ctxt->instances = eina_list_remove_list(ctxt->instances,
|
|
|
|
ctxt->instances);
|
2011-03-21 13:32:57 -07:00
|
|
|
e_object_del(E_OBJECT(inst->gcc));
|
2010-01-01 09:15:16 -08:00
|
|
|
}
|
2008-08-30 18:51:27 -07:00
|
|
|
}
|
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
EAPI int
|
|
|
|
e_modapi_shutdown(E_Module *m)
|
2008-08-30 18:51:27 -07:00
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
E_Connman_Module_Context *ctxt;
|
2008-08-30 18:51:27 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
ctxt = m->data;
|
|
|
|
if (!ctxt)
|
2010-01-01 09:15:16 -08:00
|
|
|
return 0;
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2012-09-03 15:05:29 -07:00
|
|
|
e_connman_system_shutdown();
|
2013-04-23 08:08:29 -07:00
|
|
|
eldbus_shutdown();
|
2012-09-03 15:05:29 -07:00
|
|
|
|
2012-09-03 14:58:15 -07:00
|
|
|
_econnman_instances_free(ctxt);
|
|
|
|
_econnman_configure_registry_unregister();
|
2009-12-31 13:44:33 -08:00
|
|
|
e_gadcon_provider_unregister(&_gc_class);
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2009-12-31 13:44:33 -08:00
|
|
|
E_FREE(ctxt);
|
|
|
|
connman_mod = NULL;
|
2008-10-09 15:07:32 -07:00
|
|
|
|
2012-09-03 15:05:29 -07:00
|
|
|
eina_log_domain_unregister(_e_connman_log_dom);
|
|
|
|
_e_connman_log_dom = -1;
|
|
|
|
|
2008-08-30 18:51:27 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
e_modapi_save(E_Module *m)
|
|
|
|
{
|
2009-12-31 13:44:33 -08:00
|
|
|
E_Connman_Module_Context *ctxt;
|
|
|
|
|
|
|
|
ctxt = m->data;
|
|
|
|
if (!ctxt)
|
2010-01-01 09:15:16 -08:00
|
|
|
return 0;
|
2008-08-30 18:51:27 -07:00
|
|
|
return 1;
|
|
|
|
}
|