summaryrefslogtreecommitdiff
path: root/src/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/view')
-rw-r--r--src/view/base.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/view/base.c b/src/view/base.c
index b44b498..abb826a 100644
--- a/src/view/base.c
+++ b/src/view/base.c
@@ -41,9 +41,6 @@
#define TEXT_USB_ADDED "USB Connected"
#define TEXT_USB_REMOVED "USB Disconnected"
-#define USB_ADDED 1
-#define USB_REMOVED 0
-
#define BOX_PADDING_SIZE 80
#define TIME_TOAST 5.0
@@ -832,10 +829,21 @@ static void _media_db_updated_cb(media_content_error_e error,
_hide_toast(priv);
}
+static void _show_base_view(void)
+{
+ struct view_update_data vdata;
+
+ vdata.status = E_PLAYER_STOP;
+ viewmgr_update_view(VIEW_MPLAYER, UPDATE_PLAYER, &vdata);
+
+ /* to show base view */
+ while (viewmgr_active_view_count() > 1)
+ viewmgr_pop_view();
+}
+
static void _usb_changed_cb(void *data, int state)
{
media_content_noti_h noti_h;
- struct view_update_data vdata;
struct _priv *priv;
int r;
@@ -851,16 +859,17 @@ static void _usb_changed_cb(void *data, int state)
priv->noti_h = noti_h;
- vdata.status = E_PLAYER_STOP;
- viewmgr_update_view(VIEW_MPLAYER, UPDATE_PLAYER, &vdata);
-
- /* to show base view */
- while (viewmgr_active_view_count() > 1)
- viewmgr_pop_view();
+ if (state == USB_ADDED)
+ _show_base_view();
_show_toast_usb(priv, state);
}
+static void _usb_blocked_cb(void *data, int state)
+{
+ _show_base_view();
+}
+
static Evas_Object *_create(Evas_Object *win, void *data)
{
struct usb *usb_h;
@@ -904,7 +913,8 @@ static Evas_Object *_create(Evas_Object *win, void *data)
return NULL;
}
- usb_set_callback(usb_h, _usb_changed_cb, priv);
+ usb_set_callback(usb_h, E_DEVICE_BLOCKED, _usb_blocked_cb, priv);
+ usb_set_callback(usb_h, E_DEVICE_CHANGED, _usb_changed_cb, priv);
priv->usb_h = usb_h;