summaryrefslogtreecommitdiff
path: root/src/bin/e_desklock.h
blob: 55257aa332f62616c2f042ff2f2d636b662428cf (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
#ifdef E_TYPEDEFS

typedef struct _E_Event_Desklock E_Event_Desklock;
typedef Eina_Bool (*E_Desklock_Show_Cb)(void);
typedef void (*E_Desklock_Hide_Cb)(void);

typedef enum _E_Desklock_Background_Method {
    E_DESKLOCK_BACKGROUND_METHOD_THEME_DESKLOCK = 0,
    E_DESKLOCK_BACKGROUND_METHOD_THEME,
    E_DESKLOCK_BACKGROUND_METHOD_WALLPAPER,
    E_DESKLOCK_BACKGROUND_METHOD_CUSTOM,
} E_Desklock_Background_Method;

typedef enum
{
   E_DESKLOCK_AUTH_METHOD_SYSTEM = 0,
   E_DESKLOCK_AUTH_METHOD_PERSONAL = 1,
   E_DESKLOCK_AUTH_METHOD_EXTERNAL = 2,
   E_DESKLOCK_AUTH_METHOD_PIN = 3,
} E_Desklock_Auth_Method;

typedef struct E_Desklock_Interface E_Desklock_Interface;

#else
#ifndef E_DESKLOCK_H
#define E_DESKLOCK_H

struct E_Desklock_Interface
{
   const char *name;
   E_Desklock_Show_Cb show;
   E_Desklock_Hide_Cb hide;
   Eina_Bool active : 1; //interface is currently being used for locking
};

struct _E_Event_Desklock
{
   int on;
   int suspend;
};

EINTERN int e_desklock_init(void);
EINTERN int e_desklock_shutdown(void);

EAPI int e_desklock_show(Eina_Bool suspend);
EAPI int e_desklock_show_autolocked(void);
EAPI void e_desklock_hide(void);
EAPI Eina_Bool e_desklock_state_get(void);

EAPI void e_desklock_interface_append(E_Desklock_Interface *iface);
EAPI void e_desklock_interface_remove(E_Desklock_Interface *iface);
EAPI Eina_Stringshare *e_desklock_user_wallpaper_get(E_Zone *zone);
EAPI void e_desklock_show_hook_add(E_Desklock_Show_Cb cb);
EAPI void e_desklock_show_hook_del(E_Desklock_Show_Cb cb);
EAPI void e_desklock_hide_hook_add(E_Desklock_Hide_Cb cb);
EAPI void e_desklock_hide_hook_del(E_Desklock_Hide_Cb cb);

extern EAPI int E_EVENT_DESKLOCK;

static inline Eina_Bool
e_desklock_is_external(void)
{
   return e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_EXTERNAL;
}

static inline Eina_Bool
e_desklock_is_personal(void)
{
   return e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_PERSONAL;
}

static inline Eina_Bool
e_desklock_is_system(void)
{
   return e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_SYSTEM;
}

#endif
#endif