summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Friloux <kuri@efl.so>2014-01-01 22:09:46 +0100
committerGuillaume Friloux <kuri@efl.so>2014-01-01 22:09:46 +0100
commit10509bc7b3803b8a807306987d6e5cca82206397 (patch)
tree7f6b9ca083d6a9c7f0971b39f5bc9c27fcf333b4
Begin of work ... very slowly.
-rw-r--r--src/include/Vog.h11
-rw-r--r--src/lib/vog_game.c2
-rw-r--r--src/lib/vog_main.c90
-rw-r--r--src/lib/vog_private.h7
4 files changed, 110 insertions, 0 deletions
diff --git a/src/include/Vog.h b/src/include/Vog.h
new file mode 100644
index 0000000..c29b787
--- /dev/null
+++ b/src/include/Vog.h
@@ -0,0 +1,11 @@
1#ifndef VOG_H
2#define VOG_H
3#include <Eina.h>
4#include <Ecore.h>
5#include <Efreet.h>
6
7typedef struct _Vog Vog;
8
9int vog_init(void);
10int vog_shutdown(void);
11#endif
diff --git a/src/lib/vog_game.c b/src/lib/vog_game.c
new file mode 100644
index 0000000..fc01b46
--- /dev/null
+++ b/src/lib/vog_game.c
@@ -0,0 +1,2 @@
1#include "vog_private.h"
2
diff --git a/src/lib/vog_main.c b/src/lib/vog_main.c
new file mode 100644
index 0000000..9759927
--- /dev/null
+++ b/src/lib/vog_main.c
@@ -0,0 +1,90 @@
1#include "vog_private.h"
2
3static int _vog_init_count = 0;
4int _vog_log_dom_global = -1;
5
6int VOG_EVENT_GAME_ADD = 0,
7 VOG_EVENT_GAME_DEL = 0;
8
9Vog *
10vog_new(void)
11{
12 Vog *vog;
13
14 vog = calloc(1, sizeof(Vog));
15 if (!vog)
16 {
17 ERR("Failed to allocate Vog structure");
18 return NULL;
19 }
20
21 /* Put inotify code */
22
23 return vog;
24}
25
26int
27vog_init(void)
28{
29 if (++_vog_init_count != 1)
30 return _vog_init_count;
31
32 if (!eina_init())
33 {
34 fprintf(stderr, "Vog can not initialize Eina\n");
35 return --_vog_init_count;
36 }
37
38 _vog_log_dom_global = eina_log_domain_register("vog", EINA_COLOR_RED);
39 if (_vog_log_dom_global < 0)
40 {
41 EINA_LOG_ERR("Vog can not create a general log domain");
42 goto shutdown_eina;
43 }
44
45 if (!ecore_init())
46 {
47 ERR("Can not initialize Ecore");
48 goto unregister_log_domain;
49 }
50
51 if (!efreet_init())
52 {
53 ERR("Can not initialize Efreet");
54 goto shutdown_ecore
55 }
56
57 VOG_EVENT_GAME_ADD = ecore_event_type_new();
58 VOG_EVENT_GAME_DEL = ecore_event_type_new();
59
60 return _vog_init_count;
61
62shutdown_ecore:
63 ecore_shutdown();
64unregister_log_domain:
65 eina_log_domain_unregister(_vog_log_dom_global);
66 _vog_log_dom_global = -1;
67shutdown_eina:
68 eina_shutdown();
69 return --_vog_init_count;
70}
71
72int
73vog_shutdown(void)
74{
75 if (_vog_init_count <= 0)
76 {
77 fprintf(stderr, "Vog init count not greater than 0 in shutdown.");
78 return 0;
79 }
80
81 if (--_vog_init_count != 0)
82 return _vog_init_count;
83
84 efreet_shutdown();
85 ecore_shutdown();
86 eina_log_domain_unregister(_vog_log_dom_global);
87 _vog_log_dom_global = -1;
88 eina_shutdown();
89 return _vog_init_count;
90}
diff --git a/src/lib/vog_private.h b/src/lib/vog_private.h
new file mode 100644
index 0000000..4751c4e
--- /dev/null
+++ b/src/lib/vog_private.h
@@ -0,0 +1,7 @@
1#include <Vog.h>
2
3struct _Vog
4{
5
6
7} Vog;