[TSAM-12282] Checking for focus before playing on shuffle 18/125718/1
authorRahul Dadhich <r.dadhich@samsung.com>
Fri, 30 Dec 2016 04:30:33 +0000 (10:00 +0530)
committerbhutani.92 <bhutani.92@samsung.com>
Tue, 18 Apr 2017 12:15:35 +0000 (17:45 +0530)
Change-Id: Ic631864ffb95816af817b8b6083221a0665292a8
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
src/widget/mp-track-list.c

index d2591f5..e7d45d5 100644 (file)
@@ -737,12 +737,34 @@ _mp_track_list_shuffle_cb(void *data, Evas_Object * obj, void *event_info)
        MpList_t *list = data;
        MP_CHECK(list);
 
+       struct appdata *ad = mp_util_get_appdata();
+       MP_CHECK(ad);
+
+       if (_mp_is_current_focus_available(ad) != 0) {
+               ERROR_TRACE
+               ("Some other application has the focus currently... Returning...");
+               char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL;
+               if (message) {
+                       int ret =
+                                       notification_status_message_post(dgettext
+                                                       ("music-player",
+                                                                       message));
+                       if (ret != 0) {
+                               ERROR_TRACE("notification_status_message_post()... [0x%x]",
+                                               ret);
+                       } else {
+                               DEBUG_TRACE("message: [%s]", message);
+                       }
+               }
+               return;
+       }
+
        mp_list_item_data_t *item =
-               (mp_list_item_data_t *) elm_object_item_data_get(gli);
+                       (mp_list_item_data_t *) elm_object_item_data_get(gli);
        MP_CHECK(item);
        mp_play_control_shuffle_set(NULL, true);
        mp_common_play_track_list_with_playlist_id(item, obj,
-                                                                                          list->playlist_id);
+                       list->playlist_id);
 
        return;
 }