handlers: clean up
This commit is contained in:
parent
8b2490e4db
commit
35a359af97
|
@ -68,10 +68,10 @@ evisum_server_init(void *data)
|
|||
}
|
||||
|
||||
typedef struct _Evisum_Server_Client {
|
||||
Ecore_Con_Server *srv;
|
||||
Evisum_Action action;
|
||||
int pid;
|
||||
Eina_Bool success;
|
||||
Ecore_Con_Server *srv;
|
||||
Evisum_Action action;
|
||||
int pid;
|
||||
Eina_Bool success;
|
||||
} Evisum_Server_Client;
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -131,6 +131,7 @@ Eina_Bool
|
|||
evisum_server_client_add(Evisum_Action action, int pid)
|
||||
{
|
||||
Evisum_Server_Client *client;
|
||||
Ecore_Event_Handler *handler[4];
|
||||
Eina_Bool ok;
|
||||
|
||||
Ecore_Con_Server *srv = ecore_con_server_connect(ECORE_CON_LOCAL_USER, LISTEN_SOCKET_NAME, 0, NULL);
|
||||
|
@ -144,13 +145,22 @@ evisum_server_client_add(Evisum_Action action, int pid)
|
|||
client->pid = pid;
|
||||
client->srv = srv;
|
||||
|
||||
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _evisum_server_client_connect_cb, client);
|
||||
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _evisum_server_client_done_cb, client);
|
||||
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ERROR, _evisum_server_client_done_cb, client);
|
||||
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _evisum_server_client_data_cb, client);
|
||||
handler[0] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD,
|
||||
_evisum_server_client_connect_cb, client);
|
||||
handler[1] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL,
|
||||
_evisum_server_client_done_cb, client);
|
||||
handler[2] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ERROR,
|
||||
_evisum_server_client_done_cb, client);
|
||||
handler[3] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
|
||||
_evisum_server_client_data_cb, client);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
ecore_event_handler_del(handler[0]);
|
||||
ecore_event_handler_del(handler[1]);
|
||||
ecore_event_handler_del(handler[2]);
|
||||
ecore_event_handler_del(handler[3]);
|
||||
|
||||
ok = client->success;
|
||||
free(client);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ _shutdown_cb(void *data, int type, void *event EINA_UNUSED)
|
|||
static void
|
||||
_signals(Ui *ui)
|
||||
{
|
||||
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _shutdown_cb, ui);
|
||||
ui->handler_sig = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _shutdown_cb, ui);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -86,6 +86,7 @@ main(int argc, char **argv)
|
|||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
ecore_event_handler_del(ui->handler_sig);
|
||||
evisum_ui_shutdown(ui);
|
||||
evisum_server_shutdown();
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
typedef struct Ui
|
||||
{
|
||||
pid_t program_pid;
|
||||
pid_t program_pid;
|
||||
Ecore_Event_Handler *handler_sig;
|
||||
|
||||
struct
|
||||
{
|
||||
|
|
|
@ -341,14 +341,6 @@ _graph_guide(Evas_Object *parent, int r, int g, int b, int a)
|
|||
return btn;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_config_changed_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Ui_Data *pd = data;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -503,11 +495,6 @@ ui_win_memory_add(Ui *ui)
|
|||
else
|
||||
elm_win_center(win, 1, 1);
|
||||
|
||||
_elm_config_changed_cb(pd, 0, NULL);
|
||||
|
||||
ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED,
|
||||
_elm_config_changed_cb, pd);
|
||||
|
||||
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _win_resize_cb, pd);
|
||||
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _win_del_cb, pd);
|
||||
evas_object_show(win);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern Evisum_Config *_evisum_config;
|
||||
extern int EVISUM_EVENT_CONFIG_CHANGED;
|
||||
|
||||
Eina_Lock _lock;
|
||||
static Eina_Lock _lock;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue