aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2013-02-22 14:43:53 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2013-02-22 14:45:39 +0000
commit54d7ec07d28358875804ece7dd881fdf79efe0de (patch)
tree1ebdf26876a87489886ccfff7367db2b0554c982
parent640b4c5de932ba965be553a97412beb670364896 (diff)
downloadenlightenment-devs/stefan/music-control.tar.gz
enlightenment-devs/stefan/music-control.tar.xz
enlightenment-devs/stefan/music-control.zip
WIP: Start UI controls for pause on desklock featuredevs/stefan/music-control
NOt working. Crashes your E and set your house on fire.
-rw-r--r--src/modules/music-control/e_mod_main.c7
-rw-r--r--src/modules/music-control/private.h1
-rw-r--r--src/modules/music-control/ui.c10
3 files changed, 16 insertions, 2 deletions
diff --git a/src/modules/music-control/e_mod_main.c b/src/modules/music-control/e_mod_main.c
index 7d7d114db..ad1403ced 100644
--- a/src/modules/music-control/e_mod_main.c
+++ b/src/modules/music-control/e_mod_main.c
@@ -276,6 +276,7 @@ e_modapi_init(E_Module *m)
#define T Music_Control_Config
#define D ctxt->conf_edd
E_CONFIG_VAL(D, T, player_selected, INT);
+ E_CONFIG_VAL(D, T, pause_on_desklock, INT);
ctxt->config = e_config_domain_load(MUSIC_CONTROL_DOMAIN, ctxt->conf_edd);
if (!ctxt->config)
ctxt->config = calloc(1, sizeof(Music_Control_Config));
@@ -286,7 +287,8 @@ e_modapi_init(E_Module *m)
e_gadcon_provider_register(&_gc_class);
- desklock_handler = ecore_event_handler_add(E_EVENT_DESKLOCK, _desklock_cb, ctxt);
+ if (ctxt->config->pause_on_desklock)
+ desklock_handler = ecore_event_handler_add(E_EVENT_DESKLOCK, _desklock_cb, ctxt);
return ctxt;
@@ -305,7 +307,8 @@ e_modapi_shutdown(E_Module *m)
free(ctxt->config);
E_CONFIG_DD_FREE(ctxt->conf_edd);
- ecore_event_handler_del(desklock_handler);
+ if (desklock_handler)
+ ecore_event_handler_del(desklock_handler);
media_player2_player_proxy_unref(ctxt->mpris2_player);
mpris_media_player2_proxy_unref(ctxt->mrpis2);
diff --git a/src/modules/music-control/private.h b/src/modules/music-control/private.h
index abfdb7918..ef8ba1f20 100644
--- a/src/modules/music-control/private.h
+++ b/src/modules/music-control/private.h
@@ -8,6 +8,7 @@
typedef struct _Music_Control_Config
{
int player_selected;
+ int pause_on_desklock;
} Music_Control_Config;
typedef struct _E_Music_Control_Module_Context
diff --git a/src/modules/music-control/ui.c b/src/modules/music-control/ui.c
index 9f5375d06..b572c39d9 100644
--- a/src/modules/music-control/ui.c
+++ b/src/modules/music-control/ui.c
@@ -94,6 +94,7 @@ music_control_popup_del(E_Music_Control_Instance *inst)
struct _E_Config_Dialog_Data
{
int index;
+ int pause_on_desklock;
};
static Evas_Object *
@@ -119,6 +120,11 @@ _cfg_widgets_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfda
}
ob = e_widget_label_add(evas, "* Your player must be configured to export the DBus interface MPRIS2.");
e_widget_framelist_object_append(of, ob);
+
+ ob = e_widget_check_add(evas, "Pause music when locking screen", &(cfdata->pause_on_desklock));
+ e_widget_framelist_object_append(of, ob);
+
+ e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
@@ -130,6 +136,7 @@ _cfg_data_create(E_Config_Dialog *cfd)
E_Music_Control_Instance *inst = cfd->data;
E_Config_Dialog_Data *cfdata = calloc(1, sizeof(E_Config_Dialog_Data));
cfdata->index = inst->ctxt->config->player_selected;
+ cfdata->pause_on_desklock = inst->ctxt->config->pause_on_desklock;
return cfdata;
}
@@ -151,6 +158,9 @@ static int
_cfg_data_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
E_Music_Control_Instance *inst = cfd->data;
+
+ inst->ctxt->config->pause_on_desklock = cfdata->pause_on_desklock;
+
if (inst->ctxt->config->player_selected == cfdata->index)
return 1;