Make conf toggle from e_button to edje
SVN revision: 50204
This commit is contained in:
parent
59dd1bca1d
commit
d7e1266159
|
@ -35338,6 +35338,137 @@ collections {
|
|||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*** MOD: CONF ***/
|
||||
|
||||
group {
|
||||
name: "e/modules/conf/main";
|
||||
images.image: "icon_configuration.png" COMP;
|
||||
images {
|
||||
image: "bt_base1.png" COMP;
|
||||
image: "bt_base2.png" COMP;
|
||||
image: "bt_hilight.png" COMP;
|
||||
image: "bt_shine.png" COMP;
|
||||
image: "bt_glow.png" COMP;
|
||||
}
|
||||
min: 16 16;
|
||||
max: 128 128;
|
||||
parts {
|
||||
part {
|
||||
name: "button_image";
|
||||
mouse_events: 1;
|
||||
scale: 1;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
align: 0.5 0.5;
|
||||
min: 32 16;
|
||||
image {
|
||||
normal: "bt_base2.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "clicked" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
image.normal: "bt_base1.png";
|
||||
}
|
||||
program {
|
||||
name: "button_down";
|
||||
signal: "mouse,down,1";
|
||||
source: "button_image";
|
||||
action: STATE_SET "clicked" 0.0;
|
||||
target: "button_image";
|
||||
target: "over3";
|
||||
}
|
||||
program {
|
||||
name: "button_up";
|
||||
signal: "mouse,up,1";
|
||||
source: "button_image";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "button_image";
|
||||
target: "over3";
|
||||
}
|
||||
program {
|
||||
name: "button_click";
|
||||
signal: "mouse,clicked,1";
|
||||
source: "button_image";
|
||||
action: SIGNAL_EMIT "e,action,conf" "";
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "icon";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
visible: 0;
|
||||
image.normal: "icon_configuration.png";
|
||||
rel1 {
|
||||
to: "button_image";
|
||||
relative: 0.0 0.0;
|
||||
offset: 3 3;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -4 -4;
|
||||
to: "button_image";
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "over1";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1.to: "button_image";
|
||||
rel2.to: "button_image";
|
||||
rel2.relative: 1.0 0.5;
|
||||
image {
|
||||
normal: "bt_hilight.png";
|
||||
border: 7 7 7 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "over2";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1.to: "button_image";
|
||||
rel2.to: "button_image";
|
||||
image {
|
||||
normal: "bt_shine.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "over3";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1.to: "button_image";
|
||||
rel2.to: "button_image";
|
||||
visible: 0;
|
||||
color: 255 255 255 0;
|
||||
image {
|
||||
normal: "bt_glow.png";
|
||||
border: 12 12 12 12;
|
||||
}
|
||||
fill.smooth : 0;
|
||||
}
|
||||
description {
|
||||
state: "clicked" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*** MOD: ILLUME-HOME-TOGGLE ***/
|
||||
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
typedef struct _Instance Instance;
|
||||
struct _Instance
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *o_toggle;
|
||||
};
|
||||
|
||||
/* actual module specifics */
|
||||
|
||||
static void _e_mod_action_conf_cb(E_Object *obj, const char *params);
|
||||
|
@ -19,7 +26,7 @@ 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_button_click(void *data, void *data2);
|
||||
static void _cb_action_conf(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
|
||||
static void _conf_new(void);
|
||||
static void _conf_free(void);
|
||||
|
@ -31,6 +38,8 @@ static E_Int_Menu_Augmentation *maug = NULL;
|
|||
static E_Config_DD *conf_edd = NULL;
|
||||
Config *conf = NULL;
|
||||
|
||||
static Eina_List *instances = NULL;
|
||||
|
||||
/* and actually define the gadcon class that this module provides (just 1) */
|
||||
static const E_Gadcon_Client_Class _gadcon_class =
|
||||
{
|
||||
|
@ -45,27 +54,35 @@ static const E_Gadcon_Client_Class _gadcon_class =
|
|||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
Evas_Object *o, *icon;
|
||||
E_Gadcon_Client *gcc;
|
||||
Instance *inst;
|
||||
|
||||
o = e_widget_button_add(gc->evas, NULL, NULL,
|
||||
_cb_button_click, NULL, NULL);
|
||||
inst = E_NEW(Instance, 1);
|
||||
inst->o_toggle = edje_object_add(gc->evas);
|
||||
e_theme_edje_object_set(inst->o_toggle,
|
||||
"base/theme/modules/conf",
|
||||
"e/modules/conf/main");
|
||||
|
||||
icon = e_icon_add(evas_object_evas_get(o));
|
||||
e_util_icon_theme_set(icon, "preferences-system");
|
||||
e_widget_button_icon_set(o, icon);
|
||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_toggle);
|
||||
inst->gcc->data = inst;
|
||||
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||
gcc->data = o;
|
||||
e_gadcon_client_util_menu_attach(gcc);
|
||||
edje_object_signal_callback_add(inst->o_toggle, "e,action,conf", "",
|
||||
_cb_action_conf, inst);
|
||||
|
||||
return gcc;
|
||||
instances = eina_list_append(instances, inst);
|
||||
e_gadcon_client_util_menu_attach(inst->gcc);
|
||||
|
||||
return inst->gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
evas_object_del(gcc->o_base);
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -116,6 +133,17 @@ _cb_button_click(void *data __UNUSED__, void *data2 __UNUSED__)
|
|||
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_action_conf(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Instance *inst;
|
||||
E_Action *a;
|
||||
|
||||
if (!(inst = data)) return;
|
||||
a = e_action_find("configuration");
|
||||
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue