summaryrefslogtreecommitdiffstats
path: root/msg_sender/handler.c
blob: 6c15c8e524238a3dca64368e99cd62931b1257b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "Ecore.h"
#include "/usr/local/include/Evas.h"
#include "/usr/local/include/Ecore.h"
#include "/usr/local/include/Ecore_Evas.h"
#include "/usr/local/include/Elementary.h"
#include "msg_sender.h"

int is_init = 0;
double interval = 0.1;
double current_time, last_call;

void pause_msg_sender()
{	
	stop_irc();
}

void continue_msg_sender()
{
	run_irc();
}

void exit_all()
{
	elm_exit();
	ecore_shutdown();
	elm_shutdown();	
}

void continue_gui(void *data)
{
	elm_run();
}

void init_ecore_handler(char *from, char *to)
{
	ecore_init();
	
	if (is_init == 0)
	{
		is_init = 1;
		msg_main_loop(from, to);
	}

	ecore_idle_exiter_add(continue_msg_sender, NULL);

	ecore_idle_exiter_add(pause_msg_sender, NULL);	

	ecore_idle_exiter_add(continue_gui, NULL);

	ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_all, NULL);

	ecore_main_loop_begin();
}

void shutdown_ecore_handler()
{
	ecore_shutdown();
}