summaryrefslogtreecommitdiff
path: root/src/bin/main.c
blob: 0ab0f53a439230f790c83620f15a901a704682ae (plain)
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
/* 
 * Copyright 2018-2019. Alastair Poole <netstar@gmail.com>
 *
 * http://haxlab.org.
 *
 * See LICENSE file for details.
 */

#include "config.h"
#include "ui.h"

static void
_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   exit(0);
}

static Eina_Bool
_win_add(void)
{
   Ui *ui;
   Evas_Object *win, *icon;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("evisum", "evisum");
   icon = elm_icon_add(win);
   elm_icon_standard_set(icon, "evisum");
   elm_win_icon_object_set(win, icon);
   evas_object_resize(win, EVISUM_SIZE_WIDTH * elm_config_scale_get(), EVISUM_SIZE_HEIGHT * elm_config_scale_get());
   elm_win_title_set(win, "System Activity");
   elm_win_center(win, EINA_TRUE, EINA_TRUE);

   ui = ui_add(win);
   if (!ui)
     return EINA_FALSE;

   evas_object_smart_callback_add(win, "delete,request", _win_del_cb, ui);
   evas_object_show(win);

   return EINA_TRUE;
}

int
main(int argc, char **argv)
{
   eina_init();
   ecore_init();
   elm_init(argc, argv);

   if (_win_add())
     ecore_main_loop_begin();

   elm_shutdown();
   ecore_shutdown();
   eina_shutdown();

   return 0;
}