summaryrefslogtreecommitdiff
path: root/src/bin/playbacks_view.c
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@gmail.com>2014-05-17 01:08:22 -0300
committerFlavio Ceolin <flavio.ceolin@gmail.com>2014-05-17 11:01:25 -0300
commitf5a44fe80fe0ae34fe9ec9587fea7ead67defd1b (patch)
treeeafc69d895746522f07ec9db94be73533261526a /src/bin/playbacks_view.c
parente1c2ae60f826e8d5d0245029345c717ac8b9d884 (diff)
Checking when pulseadio dies
Informing the app/module that pulseaudio dies when then handling this situation properly avoiding crashes (in case of the module, avoiding crash the entire enlightenment).
Diffstat (limited to 'src/bin/playbacks_view.c')
-rw-r--r--src/bin/playbacks_view.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bin/playbacks_view.c b/src/bin/playbacks_view.c
index 80d6a33..9cdad99 100644
--- a/src/bin/playbacks_view.c
+++ b/src/bin/playbacks_view.c
@@ -19,6 +19,7 @@ struct Playbacks_View
19 Eina_List *inputs; 19 Eina_List *inputs;
20 Eina_List *sinks; 20 Eina_List *sinks;
21 21
22 Ecore_Event_Handler *disconnected;
22 Ecore_Event_Handler *sink_input_added; 23 Ecore_Event_Handler *sink_input_added;
23 Ecore_Event_Handler *sink_input_changed; 24 Ecore_Event_Handler *sink_input_changed;
24 Ecore_Event_Handler *sink_input_removed; 25 Ecore_Event_Handler *sink_input_removed;
@@ -41,6 +42,25 @@ struct Sink_Input
41 Elm_Object_Item *item; 42 Elm_Object_Item *item;
42}; 43};
43 44
45 static Eina_Bool
46_disconnected_cb(void *data, int type EINA_UNUSED, void *info EINA_UNUSED)
47{
48 struct Playbacks_View *pv = data;
49 struct Sink_Input *si;
50 struct Sink *sink;
51
52 EINA_LIST_FREE(pv->inputs, si)
53 elm_object_item_del(si->item);
54
55 EINA_LIST_FREE(pv->sinks, sink)
56 {
57 eina_stringshare_del(sink->name);
58 free(sink);
59 }
60
61 return ECORE_CALLBACK_PASS_ON;
62}
63
44static Eina_Bool 64static Eina_Bool
45_sink_input_add_cb(void *data, int type EINA_UNUSED, 65_sink_input_add_cb(void *data, int type EINA_UNUSED,
46 void *info) 66 void *info)
@@ -184,6 +204,7 @@ _del_cb(void *data,
184 pv->_handle = NULL; \ 204 pv->_handle = NULL; \
185 } 205 }
186 206
207 ECORE_EVENT_HANDLER_DEL(disconnected)
187 ECORE_EVENT_HANDLER_DEL(sink_input_added) 208 ECORE_EVENT_HANDLER_DEL(sink_input_added)
188 ECORE_EVENT_HANDLER_DEL(sink_input_changed) 209 ECORE_EVENT_HANDLER_DEL(sink_input_changed)
189 ECORE_EVENT_HANDLER_DEL(sink_input_removed) 210 ECORE_EVENT_HANDLER_DEL(sink_input_removed)
@@ -334,6 +355,8 @@ playbacks_view_add(Evas_Object *parent)
334 pv->genlist = elm_genlist_add(layout); 355 pv->genlist = elm_genlist_add(layout);
335 EINA_SAFETY_ON_NULL_GOTO(pv->genlist, err_genlist); 356 EINA_SAFETY_ON_NULL_GOTO(pv->genlist, err_genlist);
336 357
358 pv->disconnected = ecore_event_handler_add(DISCONNECTED,
359 _disconnected_cb, pv);
337 pv->sink_input_added = ecore_event_handler_add(SINK_INPUT_ADDED, 360 pv->sink_input_added = ecore_event_handler_add(SINK_INPUT_ADDED,
338 _sink_input_add_cb, pv); 361 _sink_input_add_cb, pv);
339 pv->sink_input_added = ecore_event_handler_add(SINK_INPUT_CHANGED, 362 pv->sink_input_added = ecore_event_handler_add(SINK_INPUT_CHANGED,