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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Ecore_Getopt.h>
#include <Edje.h>
#include <stdlib.h>
#include <string.h>
#include "gettext.h"
#define COPYRIGHT "Copyright © 2015 Olliver Schinagl <oliver@schinagl.nl> and various contributors (see AUTHORS)."
#define EULOGIUM_THEME "eulogium.edj"
#define WIDTH 128
#define HEIGHT 64
int main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
Eina_Bool quit_option = EINA_FALSE;
static const Ecore_Getopt optdesc = {
"eulogium",
"%prog [options]",
PACKAGE_VERSION,
COPYRIGHT,
"Affero GPLv3",
"eulogium program",
0,
{
ECORE_GETOPT_LICENSE('L', "license"),
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
ECORE_GETOPT_VERSION('V', "version"),
ECORE_GETOPT_HELP('h', "help"),
ECORE_GETOPT_SENTINEL
}
};
Ecore_Getopt_Value values[] = {
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_NONE
};
int args;
Eina_Prefix *prefix;
Ecore_Evas *window;
Evas *canvas;
Eina_List *engines, *l;
Evas_Object *edje;
const char *eulogium_edj = EULOGIUM_THEME;
const int eulogium_edj_size = sizeof(EULOGIUM_THEME);
int prefix_size;
char *theme_file;
int theme_file_size;
#if ENABLE_NLS
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALE_DIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
#endif
if (!eina_init())
return EXIT_FAILURE;
if (!ecore_evas_init())
return EXIT_FAILURE;
if (!edje_init())
return EXIT_FAILURE;
prefix = eina_prefix_new(argv[0], NULL,
"EULOGIUM",
"eulogium",
eulogium_edj,
PACKAGE_BIN_DIR,
PACKAGE_LIB_DIR,
PACKAGE_DATA_DIR,
LOCALE_DIR);
args = ecore_getopt_parse(&optdesc, values, argc, argv);
if (args < 0) {
EINA_LOG_CRIT("Could not parse arguments.");
return EXIT_FAILURE;
}
window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
canvas = ecore_evas_get(window);
edje = edje_object_add(canvas);
if (!edje) {
EINA_LOG_CRIT("Could not create edje object!");
return EXIT_FAILURE;
}
prefix_size = strlen(eina_prefix_data_get(prefix));
theme_file_size = prefix_size + eulogium_edj_size + 1;
theme_file = malloc(sizeof(char) * theme_file_size);
eina_str_join_len(theme_file, theme_file_size, '/',
eina_prefix_data_get(prefix), prefix_size, eulogium_edj, eulogium_edj_size);
if (!edje_object_file_set(edje, theme_file, "mainscreen")) {
int err = edje_object_load_error_get(edje);
const char *errmsg = edje_load_error_str(err);
EINA_LOG_ERR("Could not load 'mainscreen' from %s: %s (%d)", theme_file, errmsg, err);
evas_object_del(edje);
return EXIT_FAILURE;
}
free(theme_file);
evas_object_show(edje);
ecore_evas_title_set(window, PACKAGE_NAME);
ecore_evas_show(window);
ecore_main_loop_begin();
evas_object_del(edje);
ecore_evas_free(window);
eina_prefix_free(prefix);
eina_shutdown();
ecore_evas_shutdown();
edje_shutdown();
return EXIT_SUCCESS;
}
|