diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index 7e9e3f6..63ead1e 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -701,26 +701,31 @@ _edi_launcher_run(Edi_Project_Config_Launch *launch) } static void -_edi_build_display_status_cb(int status) +_edi_build_display_status_cb(int status, void *data) { - Eina_Strbuf *message; + Eina_Strbuf *title, *message; + const char *name = data; + title = eina_strbuf_new(); message = eina_strbuf_new(); if (status != 0) - eina_strbuf_append_printf(message, "Build of project %s in %s failed with status code %d.", edi_project_name_get(), edi_project_get(), status); + eina_strbuf_append_printf(message, "%s of project %s in %s failed with status code %d.\n", name, edi_project_name_get(), edi_project_get(), status); else - eina_strbuf_append_printf(message, "Build of project %s in %s was successful.", edi_project_name_get(), edi_project_get()); + eina_strbuf_append_printf(message, "%s of project %s in %s was successful.\n", name, edi_project_name_get(), edi_project_get()); - edi_screens_desktop_notify("EDI :: Build Status", eina_strbuf_string_get(message)); + eina_strbuf_append_printf(title, "EDI :: %s Status", name); + edi_screens_desktop_notify(eina_strbuf_string_get(title), eina_strbuf_string_get(message)); + + eina_strbuf_free(title); eina_strbuf_free(message); } static void _edi_build_project(void) { - if (edi_exe_notify_handle("edi_build", _edi_build_display_status_cb)) + if (edi_exe_notify_handle("edi_build", _edi_build_display_status_cb, "Build")) { edi_consolepanel_show(); edi_builder_build(); @@ -730,7 +735,7 @@ _edi_build_project(void) static void _edi_build_clean_project(void) { - if (edi_exe_notify_handle("edi_build", _edi_build_display_status_cb)) + if (edi_exe_notify_handle("edi_build", _edi_build_display_status_cb, "Clean")) { edi_consolepanel_show(); edi_builder_clean(); @@ -740,7 +745,7 @@ _edi_build_clean_project(void) static void _edi_build_test_project(void) { - if (edi_exe_notify_handle("edi_build", _edi_build_display_status_cb)) + if (edi_exe_notify_handle("edi_build", _edi_build_display_status_cb, "Test")) { edi_consolepanel_show(); edi_builder_test(); diff --git a/src/bin/screens/edi_screens.c b/src/bin/screens/edi_screens.c index b86ebfa..7e625f4 100644 --- a/src/bin/screens/edi_screens.c +++ b/src/bin/screens/edi_screens.c @@ -129,7 +129,7 @@ void edi_screens_desktop_notify(const char *title, const char *message) command = eina_strbuf_new(); - eina_strbuf_append_printf(command, "notify-send -t 7000 -i edi '%s' '%s'", title, message); + eina_strbuf_append_printf(command, "notify-send -t 10000 -i edi '%s' '%s'", title, message); ecore_exe_run(eina_strbuf_string_get(command), NULL); diff --git a/src/lib/edi_exe.c b/src/lib/edi_exe.c index c16cedb..0fa16eb 100644 --- a/src/lib/edi_exe.c +++ b/src/lib/edi_exe.c @@ -13,33 +13,47 @@ static Ecore_Event_Handler *_edi_exe_handler = NULL; static Ecore_Event_Handler *_edi_exe_notify_handler = NULL; +typedef struct _Edi_Exe_Args { + void ((*func)(int, void *)); + void *data; +} Edi_Exe_Args; + static Eina_Bool _edi_exe_notify_data_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) { int *status; - void *(*func)(int value); + Edi_Exe_Args *args; Ecore_Con_Event_Client_Data *ev = event; status = ev->data; - func = data; - func(*status); + args = data; + + args->func(*status, args->data); ecore_event_handler_del(_edi_exe_notify_handler); _edi_exe_notify_handler = NULL; + free(args); + return EINA_FALSE; } EAPI Eina_Bool -edi_exe_notify_handle(const char *name, void ((*func)(int))) +edi_exe_notify_handle(const char *name, void ((*func)(int, void *)), void *data) { + Edi_Exe_Args *args; + if (_edi_exe_notify_handler) return EINA_FALSE; /* These are UNIX domain sockets, no need to clean up */ ecore_con_server_add(ECORE_CON_LOCAL_USER, name, 0, NULL); - _edi_exe_notify_handler = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _edi_exe_notify_data_cb, func); + args = malloc(sizeof(Edi_Exe_Args)); + args->func = func; + args->data = data; + + _edi_exe_notify_handler = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _edi_exe_notify_data_cb, args); return EINA_TRUE; } diff --git a/src/lib/edi_exe.h b/src/lib/edi_exe.h index 1165c8e..2dec603 100644 --- a/src/lib/edi_exe.h +++ b/src/lib/edi_exe.h @@ -56,10 +56,11 @@ EAPI void edi_exe_notify(const char *name, const char *command); * * @param name The name of the resource used to identify the notification. * @param func Function that will execute upon receiving exit code of exe. + * @param data Additional data to pass to the callback. * * @ingroup Exe */ -EAPI Eina_Bool edi_exe_notify_handle(const char *name, void ((*func)(int))); +EAPI Eina_Bool edi_exe_notify_handle(const char *name, void ((*func)(int, void *)), void *data); /** * @}