summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/sources_view.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/bin/sources_view.c b/src/bin/sources_view.c
index aa6dafb..e089412 100644
--- a/src/bin/sources_view.c
+++ b/src/bin/sources_view.c
@@ -21,12 +21,25 @@ struct Sources_View
21 Elm_Genlist_Item_Class *itc; 21 Elm_Genlist_Item_Class *itc;
22 22
23 Eina_List *sources; 23 Eina_List *sources;
24 Ecore_Event_Handler *disconnected;
24 Ecore_Event_Handler *source_added; 25 Ecore_Event_Handler *source_added;
25 Ecore_Event_Handler *source_changed; 26 Ecore_Event_Handler *source_changed;
26 Ecore_Event_Handler *source_removed; 27 Ecore_Event_Handler *source_removed;
27}; 28};
28 29
29static Eina_Bool 30static Eina_Bool
31_disconnected_cb(void *data, int type EINA_UNUSED, void *info EINA_UNUSED)
32{
33 struct Sources_View *sv = data;
34 struct Source *source;
35
36 EINA_LIST_FREE(sv->sources, source)
37 elm_object_item_del(source->item);
38
39 return ECORE_CALLBACK_PASS_ON;
40}
41
42static Eina_Bool
30_source_add_cb(void *data, int type EINA_UNUSED, void *info) 43_source_add_cb(void *data, int type EINA_UNUSED, void *info)
31{ 44{
32 struct Sources_View *sv = data; 45 struct Sources_View *sv = data;
@@ -107,6 +120,11 @@ _del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED,
107 struct Sources_View *sv = data; 120 struct Sources_View *sv = data;
108 121
109 eina_list_free(sv->sources); 122 eina_list_free(sv->sources);
123 if (sv->disconnected)
124 {
125 ecore_event_handler_del(sv->disconnected);
126 sv->disconnected = NULL;
127 }
110 if (sv->source_added) 128 if (sv->source_added)
111 { 129 {
112 ecore_event_handler_del(sv->source_added); 130 ecore_event_handler_del(sv->source_added);
@@ -228,6 +246,8 @@ sources_view_add(Evas_Object *parent)
228 sv->genlist = elm_genlist_add(layout); 246 sv->genlist = elm_genlist_add(layout);
229 EINA_SAFETY_ON_NULL_GOTO(sv->genlist, err_genlist); 247 EINA_SAFETY_ON_NULL_GOTO(sv->genlist, err_genlist);
230 248
249 sv->disconnected = ecore_event_handler_add(DISCONNECTED,
250 _disconnected_cb, sv);
231 sv->source_added = ecore_event_handler_add(SOURCE_ADDED, _source_add_cb, sv); 251 sv->source_added = ecore_event_handler_add(SOURCE_ADDED, _source_add_cb, sv);
232 sv->source_added = ecore_event_handler_add(SOURCE_CHANGED, 252 sv->source_added = ecore_event_handler_add(SOURCE_CHANGED,
233 _source_changed_cb, sv); 253 _source_changed_cb, sv);
@@ -252,6 +272,7 @@ sources_view_add(Evas_Object *parent)
252 return layout; 272 return layout;
253 273
254 err_genlist: 274 err_genlist:
275 ecore_event_handler_del(sv->disconnected);
255 ecore_event_handler_del(sv->source_added); 276 ecore_event_handler_del(sv->source_added);
256 ecore_event_handler_del(sv->source_changed); 277 ecore_event_handler_del(sv->source_changed);
257 ecore_event_handler_del(sv->source_removed); 278 ecore_event_handler_del(sv->source_removed);