discomfitor pushed a commit to branch master.

http://git.enlightenment.org/apps/empc.git/commit/?id=7c15296068b749fdb3edf679a039c1db04da4c3a

commit 7c15296068b749fdb3edf679a039c1db04da4c3a
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Dec 26 18:34:29 2014 -0500

    add notifications for apm updates
---
 src/modules/auto_playlist_manager.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/modules/auto_playlist_manager.c 
b/src/modules/auto_playlist_manager.c
index 4870ad8..141ae7c 100644
--- a/src/modules/auto_playlist_manager.c
+++ b/src/modules/auto_playlist_manager.c
@@ -94,6 +94,17 @@ is_same_path(const char *a, const char *ae, const char *b, 
const char *be)
 }
 
 static void
+post_add(Eina_Bool insert, const char *filename)
+{
+   char summary[1024], body[PATH_MAX + 128];
+
+   snprintf(summary, sizeof(summary), "EMPC: Auto Playlist Manager");
+   snprintf(body, sizeof(body), "%s '%s'", insert ? "Insert:" : "Append:", 
filename);
+   elm_sys_notify_send(0, "empc", summary, body, 
ELM_SYS_NOTIFY_URGENCY_NORMAL, 5000, NULL, NULL);
+   wait_count++;
+}
+
+static void
 info_cb(Eldbus_Proxy *proxy EINA_UNUSED, void *data, Eldbus_Pending *pending 
EINA_UNUSED, Eldbus_Error_Info *error EINA_UNUSED, Eina_Value *args)
 {
    Eina_Value array;
@@ -128,13 +139,14 @@ info_cb(Eldbus_Proxy *proxy EINA_UNUSED, void *data, 
Eldbus_Pending *pending EIN
                     {
                        /* no match: append */
                        empd_empdd_add_list_call(empd_proxy, data);
-                       wait_count++;
+                       post_add(0, data);
                        break;
                     }
                   if (!file->track)
                     {
                        so = eina_list_last_data_get(l);
                        empd_empdd_add_id_list_call(empd_proxy, data, 
so->song_pos + 1);
+                       post_add(1, data);
                        break;
                     }
                   /* matches: insert at end point first to avoid breaking song 
positions */
@@ -145,7 +157,7 @@ info_cb(Eldbus_Proxy *proxy EINA_UNUSED, void *data, 
Eldbus_Pending *pending EIN
 
                        sl = elm_genlist_item_subitems_get(it);
                        if (eina_list_count(sl) < 2) continue; //ignore single 
songs
-                       wait_count++;
+                       post_add(1, data);
                        EINA_LIST_FOREACH(sl, sll, sit)
                          {
                             so = elm_object_item_data_get(sit);
@@ -229,7 +241,7 @@ run_adds(void)
                        ret = strcmp(ss->uri, file);
                        if (!ret) break; //already exists here...what the 
actual fuck
                        if (ret > 0) continue;
-                       wait_count++;
+                       post_add(1, file);
                        empd_empdd_add_id_list_call(empd_proxy, file, 
ss->song_pos + 1);
                        done = EINA_TRUE;
                        break;
@@ -240,7 +252,7 @@ run_adds(void)
         if (!done)
           {
              empd_empdd_add_list_call(empd_proxy, file);
-             wait_count++;
+             post_add(0, file);
           }
         adds = eina_list_remove_list(adds, l);
         free(file);
@@ -467,6 +479,7 @@ auto_playlist_manager_init(void)
 
    f = eina_file_open("/etc/mpd.conf", 0);
    if (!f) return EINA_FALSE;
+   elm_need_sys_notify();
    ecore_thread_feedback_run((Ecore_Thread_Cb)init_thread, 
(Ecore_Thread_Notify_Cb)init_notify, (Ecore_Thread_Cb)init_end, 
(Ecore_Thread_Cb)init_end, f, 0);
    eio_init();
    E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_FILE_MODIFIED, log_modified, 
NULL);

-- 


Reply via email to