media: turn off media on video playblack del.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 23 Aug 2012 02:15:44 +0000 (02:15 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 23 Aug 2012 02:15:44 +0000 (02:15 +0000)
if the object is deleted by media_stop(), then we must listen to it
and emit "media,off". We should also clean up the config->background
if it's temporary, so it's not restarted on the next
main_media_update() (changing config options).

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/terminology@75582 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/main.c

index fbf28c0..6aef497 100644 (file)
@@ -256,6 +256,15 @@ main_trans_update(const Config *config)
      }
 }
 
+static void
+_cb_media_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Config *config = data;
+   media = NULL;
+   edje_object_signal_emit(bg, "media,off", "terminology");
+   if (config->temporary) eina_stringshare_replace(&(config->background), NULL);
+}
+
 void
 main_media_update(const Config *config)
 {
@@ -264,8 +273,15 @@ main_media_update(const Config *config)
 
    if ((config->background) && (config->background[0]))
      {
-        if (media) evas_object_del(media);
+        if (media)
+          {
+             evas_object_event_callback_del(media, EVAS_CALLBACK_DEL,
+                                            _cb_media_del);
+             evas_object_del(media);
+          }
         o = media = media_add(win, config->background, config, MEDIA_BG, &type);
+        evas_object_event_callback_add(media, EVAS_CALLBACK_DEL,
+                                       _cb_media_del, config);
         edje_object_part_swallow(bg, "terminology.background", o);
         evas_object_show(o);
         if (type == TYPE_IMG)