e: Initial commit of music control module
demarchi: There are some coding style issues, particularly on .edc files, but they will be fixed on a later commit. Patch by: José Roberto de Souza <zehortigoza@profusion.mobi> SVN revision: 81988
This commit is contained in:
parent
29680fffca
commit
996fdc6351
|
@ -674,6 +674,12 @@ define([CHECK_MODULE_TEMPERATURE],
|
|||
AC_E_CHECK_PKG(TEMPERATURE, [ ecore >= $efl_version ecore-file >= $efl_version eina >= $efl_version ], [], [TEMPERATURE=false])
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(MUSIC_CONTROL, false)
|
||||
define([CHECK_MODULE_MUSIC_CONTROL],
|
||||
[
|
||||
AC_E_CHECK_PKG(MUSIC_CONTROL, [ ecore >= 1.2.0 eina >= 1.2.0 edbus2 ], [], [MUSIC_CONTROL=false])
|
||||
])
|
||||
|
||||
##have_exchange=no
|
||||
##AC_ARG_ENABLE(exchange,
|
||||
## AC_HELP_STRING([--disable-exchange], [disable Exchange support @<:@default=detect@:>@]),
|
||||
|
@ -863,6 +869,7 @@ AC_E_OPTIONAL_MODULE([conf_randr], true)
|
|||
AC_E_OPTIONAL_MODULE([xkbswitch], true)
|
||||
AC_E_OPTIONAL_MODULE([tiling], true)
|
||||
AC_E_OPTIONAL_MODULE([access], true)
|
||||
AC_E_OPTIONAL_MODULE([music_control], true, [CHECK_MODULE_MUSIC_CONTROL])
|
||||
|
||||
SUSPEND=""
|
||||
HIBERNATE=""
|
||||
|
@ -969,6 +976,7 @@ src/modules/tasks/module.desktop
|
|||
src/modules/xkbswitch/module.desktop
|
||||
src/modules/tiling/module.desktop
|
||||
src/modules/access/module.desktop
|
||||
src/modules/music-control/module.desktop
|
||||
data/Makefile
|
||||
data/images/Makefile
|
||||
data/flags/Makefile
|
||||
|
|
|
@ -226,6 +226,10 @@ if USE_MODULE_ACCESS
|
|||
include Makefile_access.am
|
||||
endif
|
||||
|
||||
if USE_MODULE_MUSIC_CONTROL
|
||||
include Makefile_music_control.am
|
||||
endif
|
||||
|
||||
#if HAVE_WAYLAND_DRM
|
||||
#include Makefile_wl_drm.am
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
music_controldir = $(MDIR)/music-control
|
||||
music_control_DATA = music-control/e-module-music-control.edj \
|
||||
music-control/module.desktop
|
||||
|
||||
EXTRA_DIST += $(music_control_DATA)
|
||||
|
||||
music_controlpkgdir = $(MDIR)/music-control/$(MODULE_ARCH)
|
||||
music_controlpkg_LTLIBRARIES = music-control/module.la
|
||||
|
||||
music_control_module_la_DEPENDENCIES = $(MDEPENDENCIES)
|
||||
music_control_module_la_CFLAGS = $(AM_CFLAGS) -Wno-unused-parameter
|
||||
music_control_module_la_LIBADD = @MUSIC_CONTROL_LIBS@
|
||||
music_control_module_la_SOURCES = music-control/e_mod_main.h \
|
||||
music-control/e_mod_main.c
|
|
@ -0,0 +1,76 @@
|
|||
images {
|
||||
image: "images/icon.png" COMP;
|
||||
}
|
||||
|
||||
collections {
|
||||
group {
|
||||
name: "icon";
|
||||
max: 24 24;
|
||||
parts {
|
||||
part {
|
||||
name: "image";
|
||||
mouse_events: 0;
|
||||
type: IMAGE;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image.normal: "images/icon.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group {
|
||||
name: "modules/music-control/main";
|
||||
min: 16 16;
|
||||
max: 128 128;
|
||||
parts {
|
||||
part {
|
||||
name: "icon";
|
||||
mouse_events: 0;
|
||||
type: IMAGE;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
rel1.offset: 2 2;
|
||||
rel2.offset: -3 -3;
|
||||
image.normal: "images/icon.png";
|
||||
}
|
||||
description {
|
||||
state: "bigger" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.offset: -2 -2;
|
||||
rel2.offset: 3 3;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "event";
|
||||
mouse_events: 1;
|
||||
type: RECT;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program {
|
||||
name: "mouse_in";
|
||||
signal: "mouse,in";
|
||||
source: "event";
|
||||
action: STATE_SET "bigger" 0.0;
|
||||
transition: LINEAR 0.1;
|
||||
target: "icon";
|
||||
}
|
||||
program {
|
||||
name: "mouse_out";
|
||||
signal: "mouse,out";
|
||||
source: "event";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 0.2;
|
||||
target: "icon";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,177 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
static E_Module *music_control_mod = NULL;
|
||||
|
||||
static char tmpbuf[4096]; /* general purpose buffer, just use immediately */
|
||||
|
||||
static const char _e_music_control_Name[] = "Music controller";
|
||||
|
||||
static void
|
||||
_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
|
||||
{
|
||||
E_Music_Control_Instance *inst = data;
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
|
||||
printf("event mouse down button=%d\n", ev->button);
|
||||
}
|
||||
|
||||
static const char *
|
||||
_edj_path_get(void)
|
||||
{
|
||||
#define TF "/e-module-music-control.edj"
|
||||
size_t dirlen;
|
||||
|
||||
dirlen = strlen(music_control_mod->dir);
|
||||
if (dirlen >= sizeof(tmpbuf) - sizeof(TF))
|
||||
return NULL;
|
||||
|
||||
memcpy(tmpbuf, music_control_mod->dir, dirlen);
|
||||
memcpy(tmpbuf + dirlen, TF, sizeof(TF));
|
||||
|
||||
return tmpbuf;
|
||||
#undef TF
|
||||
}
|
||||
|
||||
/* Gadcon Api Functions */
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
E_Music_Control_Instance *inst;
|
||||
E_Music_Control_Module_Context *ctxt;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(music_control_mod, NULL);
|
||||
ctxt = music_control_mod->data;
|
||||
|
||||
inst = calloc(1, sizeof(E_Music_Control_Instance));
|
||||
inst->ctxt = ctxt;
|
||||
inst->gadget = edje_object_add(gc->evas);
|
||||
edje_object_file_set(inst->gadget, _edj_path_get(),
|
||||
"modules/music-control/main");
|
||||
/*e_theme_edje_object_set(inst->gadget, "base/theme/modules/music-control",
|
||||
"e/modules/music-control/main");*/
|
||||
|
||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->gadget);
|
||||
inst->gcc->data = inst;
|
||||
|
||||
|
||||
evas_object_event_callback_add(inst->gadget, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down, inst);
|
||||
|
||||
return inst->gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
E_Music_Control_Instance *inst;
|
||||
E_Music_Control_Module_Context *ctxt;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(music_control_mod);
|
||||
|
||||
ctxt = music_control_mod->data;
|
||||
inst = gcc->data;
|
||||
|
||||
evas_object_del(inst->gadget);
|
||||
ctxt->instances = eina_list_remove(ctxt->instances, inst);
|
||||
|
||||
free(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||
{
|
||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_label(const E_Gadcon_Client_Class *client_class)
|
||||
{
|
||||
return _e_music_control_Name;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(const E_Gadcon_Client_Class *client_class, Evas *evas)
|
||||
{
|
||||
Evas_Object *o = edje_object_add(evas);
|
||||
edje_object_file_set(o, _edj_path_get(), "icon");
|
||||
return o;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(const E_Gadcon_Client_Class *client_class)
|
||||
{
|
||||
E_Music_Control_Module_Context *ctxt;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(music_control_mod, NULL);
|
||||
ctxt = music_control_mod->data;
|
||||
|
||||
snprintf(tmpbuf, sizeof(tmpbuf), "music-control.%d",
|
||||
eina_list_count(ctxt->instances));
|
||||
return tmpbuf;
|
||||
}
|
||||
|
||||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION, "music-control",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
||||
e_gadcon_site_is_not_toolbar
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, _e_music_control_Name };
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
E_Music_Control_Module_Context *ctxt;
|
||||
|
||||
ctxt = calloc(1, sizeof(E_Music_Control_Module_Context));
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ctxt, NULL);
|
||||
edbus_init();
|
||||
ctxt->conn = edbus_connection_get(EDBUS_CONNECTION_TYPE_SESSION);
|
||||
EINA_SAFETY_ON_NULL_GOTO(ctxt->conn, error_dbus_bus_get);
|
||||
|
||||
music_control_mod = m;
|
||||
|
||||
e_gadcon_provider_register(&_gc_class);
|
||||
|
||||
return ctxt;
|
||||
|
||||
error_dbus_bus_get:
|
||||
free(ctxt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
E_Music_Control_Module_Context *ctxt;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(music_control_mod, 0);
|
||||
ctxt = music_control_mod->data;
|
||||
|
||||
edbus_connection_unref(ctxt->conn);
|
||||
edbus_shutdown();
|
||||
|
||||
e_gadcon_provider_unregister(&_gc_class);
|
||||
|
||||
if (eina_list_count(ctxt->instances))
|
||||
ERR("Live instances.");
|
||||
|
||||
free(ctxt);
|
||||
music_control_mod = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
E_Music_Control_Module_Context *ctxt;
|
||||
|
||||
ctxt = m->data;
|
||||
if (!ctxt)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef E_MOD_MAIN_H
|
||||
#define E_MOD_MAIN_H
|
||||
|
||||
#include "config.h"
|
||||
#include <e.h>
|
||||
#include <eina_log.h>
|
||||
|
||||
typedef struct _E_Music_Control_Module_Context
|
||||
{
|
||||
Eina_List *instances;
|
||||
EDBus_Connection *conn;
|
||||
} E_Music_Control_Module_Context;
|
||||
|
||||
typedef struct _E_Music_Control_Instance
|
||||
{
|
||||
E_Music_Control_Module_Context *ctxt;
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *gadget;
|
||||
} E_Music_Control_Instance;
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
EAPI void *e_modapi_init(E_Module *m);
|
||||
EAPI int e_modapi_shutdown(E_Module *m);
|
||||
EAPI int e_modapi_save(E_Module *m);
|
||||
|
||||
#endif
|
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Music Control
|
||||
Icon=e-module-music-control
|
||||
Comment=Control your music in your shelf
|
||||
X-Enlightenment-ModuleType=utils
|
Loading…
Reference in New Issue