summaryrefslogtreecommitdiff
path: root/src/lib/vog_event.c
blob: 603556a406a82662118601c9b357f68839c91fd6 (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
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
#include "vog_private.h"
#include <string.h>

void
_vog_event_game_free(void *d1 EINA_UNUSED,
                     void *d2 EINA_UNUSED)
{}

Eina_Bool
vog_event_filter_cb(void *data EINA_UNUSED,
                    Eio_File *handler EINA_UNUSED,
                    const Eina_File_Direct_Info *info EINA_UNUSED)
{
   return EINA_TRUE;
}

void
vog_event_main_cb(void *data,
                  Eio_File *handler EINA_UNUSED,
                  const Eina_File_Direct_Info *info)
{
   Vog *vog;
   Vog_Game *vg;
   Efreet_Desktop *ed;

   vog = data;

   DBG("vog[%p] info[%p][%s]", vog, info, info->path);

   ed = efreet_desktop_get(info->path);
   if (!ed)
     {
        ERR("Failed to load desktop file %s", info->path);
        return;
     }

   vg = calloc(1, sizeof(Vog_Game));
   if (!vg)
     {
        ERR("Failed to allocate Vog_Game structure");
        goto ed_free;
     }

   vg->ed = ed;
   vg->name = strdup(ed->name);
   if (!vg->name)
     {
        ERR("Failed to allocate vg->name");
        goto vg_free;
     }

   ecore_event_add(VOG_EVENT_GAME_ADD, vg, _vog_event_game_free, NULL);

   return;

vg_free:
   free(vg);
ed_free:
   efreet_desktop_free(ed);
}

void
vog_event_done_cb(void *data,
                  Eio_File *handler EINA_UNUSED)
{
   Vog *vog;

   vog = data;

   DBG("vog[%p]", vog);
}

void
vog_event_error_cb(void *data,
                   Eio_File *handler EINA_UNUSED,
                   int error)
{
   Vog *vog;

   vog = data;
   ERR("vog[%p] : Failed to load desktop directory : %s", vog, strerror(error));
}

Eina_Bool
vog_event_action(void *data EINA_UNUSED,
                 int type EINA_UNUSED,
                 void *event EINA_UNUSED)
{
   return EINA_TRUE;
}