summaryrefslogtreecommitdiff
path: root/src/bin/main.c
blob: 2077176b941197f8d39ced262ed6fba9f765d464 (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
#include <emix.h>
#include "common.h"
#include "main_window.h"

#define DEFAULT_HEIGHT 600
#define DEFAULT_WIDTH 800

EAPI int
elm_main(int argc EINA_UNUSED, char *argv[]  EINA_UNUSED)
{
   Evas_Object *win;
   Eina_List *l;
   const char *backend_name;
   Eina_Bool backend_loaded = EINA_FALSE;

   EINA_SAFETY_ON_FALSE_RETURN_VAL(emixer_common_init("emixer"), EXIT_FAILURE);
   EINA_SAFETY_ON_FALSE_RETURN_VAL(emix_init() == EINA_TRUE, EXIT_FAILURE);

   if (emix_backend_set("PULSEAUDIO") == EINA_FALSE)
     {
        WRN("Could not load PULSEAUDIO, trying another one ...");
        EINA_LIST_FOREACH((Eina_List *)emix_backends_available(), l,
                          backend_name)
          {
             if (emix_backend_set(backend_name) == EINA_TRUE)
               {
                  DBG("Loaded backend: %s!", backend_name);
                  backend_loaded = EINA_TRUE;
                  break;
               }
          }
     }
   else
     backend_loaded = EINA_TRUE;

   if (!backend_loaded)
     goto end;

   win = main_window_add();
   evas_object_resize(win, DEFAULT_WIDTH, DEFAULT_HEIGHT);
   evas_object_show(win);
   elm_run();

end:
   emixer_common_shutdown();
   emix_shutdown();
   return 0;
}

/*
 * Create the default main() that will work with both quicklaunch or
 * regular applications.
 */
ELM_MAIN()