summaryrefslogtreecommitdiff
path: root/src/bin/sinks_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/sinks_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 '')
-rw-r--r--src/bin/sinks_view.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/bin/sinks_view.c b/src/bin/sinks_view.c
index b8514fd..55003ee 100644
--- a/src/bin/sinks_view.c
+++ b/src/bin/sinks_view.c
@@ -29,6 +29,7 @@ struct Sinks_View
29 Elm_Genlist_Item_Class *itc; 29 Elm_Genlist_Item_Class *itc;
30 30
31 Eina_List *sinks; 31 Eina_List *sinks;
32 Ecore_Event_Handler *disconnected;
32 Ecore_Event_Handler *sink_added; 33 Ecore_Event_Handler *sink_added;
33 Ecore_Event_Handler *sink_changed; 34 Ecore_Event_Handler *sink_changed;
34 Ecore_Event_Handler *sink_removed; 35 Ecore_Event_Handler *sink_removed;
@@ -36,6 +37,18 @@ struct Sinks_View
36 37
37 38
38static Eina_Bool 39static Eina_Bool
40_disconnected_cb(void *data, int type EINA_UNUSED, void *info EINA_UNUSED)
41{
42 struct Sinks_View *sv = data;
43 struct Sink *sink;
44
45 EINA_LIST_FREE(sv->sinks, sink)
46 elm_object_item_del(sink->item);
47
48 return ECORE_CALLBACK_PASS_ON;
49}
50
51static Eina_Bool
39_sink_add_cb(void *data, int type EINA_UNUSED, void *info) 52_sink_add_cb(void *data, int type EINA_UNUSED, void *info)
40{ 53{
41 struct Sinks_View *sv = data; 54 struct Sinks_View *sv = data;
@@ -143,6 +156,11 @@ _del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED,
143 ecore_event_handler_del(sv->sink_removed); 156 ecore_event_handler_del(sv->sink_removed);
144 sv->sink_removed = NULL; 157 sv->sink_removed = NULL;
145 } 158 }
159 if (sv->disconnected)
160 {
161 ecore_event_handler_del(sv->disconnected);
162 sv->disconnected = NULL;
163 }
146} 164}
147 165
148static char * 166static char *
@@ -289,6 +307,8 @@ sinks_view_add(Evas_Object *parent)
289 sv->genlist = elm_genlist_add(layout); 307 sv->genlist = elm_genlist_add(layout);
290 EINA_SAFETY_ON_NULL_GOTO(sv->genlist, err_genlist); 308 EINA_SAFETY_ON_NULL_GOTO(sv->genlist, err_genlist);
291 309
310 sv->disconnected = ecore_event_handler_add(DISCONNECTED,
311 _disconnected_cb, sv);
292 sv->sink_added = ecore_event_handler_add(SINK_ADDED, _sink_add_cb, sv); 312 sv->sink_added = ecore_event_handler_add(SINK_ADDED, _sink_add_cb, sv);
293 sv->sink_added = ecore_event_handler_add(SINK_CHANGED, _sink_changed_cb, sv); 313 sv->sink_added = ecore_event_handler_add(SINK_CHANGED, _sink_changed_cb, sv);
294 sv->sink_removed = ecore_event_handler_add(SINK_REMOVED, 314 sv->sink_removed = ecore_event_handler_add(SINK_REMOVED,