WIP
This commit is contained in:
parent
ce323cdaf8
commit
7a6e205002
1 changed files with 37 additions and 28 deletions
|
|
@ -63,20 +63,8 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
inst = E_NEW(Instance, 1);
|
inst = E_NEW(Instance, 1);
|
||||||
if (!inst) return NULL;
|
if (!inst) return NULL;
|
||||||
|
|
||||||
/* Create gadcon client */
|
/* Create edje object */
|
||||||
gcc = e_gadcon_client_new(gc, name, id, style, NULL);
|
o = edje_object_add(gc->evas);
|
||||||
if (!gcc)
|
|
||||||
{
|
|
||||||
E_FREE(inst);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gcc->data = inst;
|
|
||||||
inst->gcc = gcc;
|
|
||||||
|
|
||||||
/* Create icon */
|
|
||||||
o = edje_object_add(gcc->gadcon->evas);
|
|
||||||
inst->icon = o;
|
|
||||||
|
|
||||||
/* Load theme */
|
/* Load theme */
|
||||||
char theme_path[PATH_MAX];
|
char theme_path[PATH_MAX];
|
||||||
|
|
@ -92,19 +80,24 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
|
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
/* Pass the object directly to e_gadcon_client_new */
|
||||||
|
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||||
|
if (!gcc)
|
||||||
|
{
|
||||||
|
evas_object_del(o);
|
||||||
|
E_FREE(inst);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gcc->data = inst;
|
||||||
|
inst->gcc = gcc;
|
||||||
|
inst->icon = o;
|
||||||
|
inst->gadget = o;
|
||||||
|
|
||||||
/* Add mouse event handler */
|
/* Add mouse event handler */
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_gadget_mouse_down_cb, inst);
|
_gadget_mouse_down_cb, inst);
|
||||||
|
|
||||||
/* Set the icon as the gadcon's visual object */
|
|
||||||
inst->gadget = o;
|
|
||||||
gcc->o_base = o;
|
|
||||||
|
|
||||||
/* Set size constraints */
|
|
||||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
|
||||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
|
||||||
e_gadcon_client_show(gcc);
|
|
||||||
|
|
||||||
/* Get first available device */
|
/* Get first available device */
|
||||||
Eina_List *devices = iwd_devices_get();
|
Eina_List *devices = iwd_devices_get();
|
||||||
if (devices && eina_list_count(devices) > 0)
|
if (devices && eina_list_count(devices) > 0)
|
||||||
|
|
@ -166,8 +159,21 @@ _gc_shutdown(E_Gadcon_Client *gcc)
|
||||||
static void
|
static void
|
||||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED)
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED)
|
||||||
{
|
{
|
||||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
Instance *inst;
|
||||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
Evas_Coord mw, mh;
|
||||||
|
|
||||||
|
inst = gcc->data;
|
||||||
|
if (!inst || !inst->icon) return;
|
||||||
|
|
||||||
|
mw = 0;
|
||||||
|
mh = 0;
|
||||||
|
edje_object_size_min_get(inst->icon, &mw, &mh);
|
||||||
|
if ((mw < 1) || (mh < 1))
|
||||||
|
edje_object_size_min_calc(inst->icon, &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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gadcon label */
|
/* Gadcon label */
|
||||||
|
|
@ -213,10 +219,13 @@ _gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas)
|
||||||
|
|
||||||
/* Generate new ID */
|
/* Generate new ID */
|
||||||
static const char *
|
static const char *
|
||||||
_gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
|
_gc_id_new(const E_Gadcon_Client_Class *client_class)
|
||||||
{
|
{
|
||||||
static char buf[32];
|
static char buf[128];
|
||||||
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, rand());
|
Mod *mod = iwd_mod;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%s.%d", client_class->name,
|
||||||
|
mod ? eina_list_count(mod->instances) + 1 : 1);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue