aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/efl/interfaces/efl_vpath_file.c
blob: 37613fca11a672d97a7e49a3208ebb24dbb4474f (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
55
56
57
58
59
60
61
#include "config.h"
#include "Efl.h"

#define MY_CLASS EFL_VPATH_FILE_CLASS

typedef struct _Efl_Vpath_File_Data Efl_Vpath_File_Data;

struct _Efl_Vpath_File_Data
{
   const char *path;
   const char *result;
   Eina_Bool called : 1;
};

EOLIAN static void
_efl_vpath_file_path_set(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd, const char *path)
{
   eina_stringshare_replace(&(pd->path), path);
}

EOLIAN static const char *
_efl_vpath_file_path_get(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd)
{
   return pd->path;
}

EOLIAN static void
_efl_vpath_file_result_set(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd, const char *path)
{
   eina_stringshare_replace(&(pd->result), path);
}

EOLIAN static const char *
_efl_vpath_file_result_get(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd)
{
   return pd->result;
}

EOLIAN static Eina_Bool
_efl_vpath_file_do(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd)
{
   if (pd->called) return EINA_FALSE;
   pd->called = EINA_TRUE;
   efl_event_callback_call(obj, EFL_VPATH_FILE_EVENT_FETCHED, NULL);
   return EINA_TRUE;
}

EOLIAN static void
_efl_vpath_file_wait(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd EINA_UNUSED)
{
   if (!pd->called)
     {
        pd->called = EINA_TRUE;
        if (pd->result)
          efl_event_callback_call(obj, EFL_VPATH_FILE_EVENT_FETCHED, NULL);
        else
          efl_event_callback_call(obj, EFL_VPATH_FILE_EVENT_FAILED, NULL);
     }
}

#include "interfaces/efl_vpath_file.eo.c"