summaryrefslogtreecommitdiff
path: root/src/bin/e_module.h
blob: 6c5c88eee083a5671ffc52c037834f56d7305d0a (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
/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#ifdef E_TYPEDEFS

#define E_MODULE_API_VERSION 7

typedef struct _E_Module     E_Module;
typedef struct _E_Module_Api E_Module_Api;

typedef struct _E_Event_Module_Update E_Event_Module_Update;

#else
#ifndef E_MODULE_H
#define E_MODULE_H

#define E_MODULE_TYPE 0xE0b0100b

extern EAPI int E_EVENT_MODULE_UPDATE;

struct _E_Event_Module_Update
{
   char *name;
   unsigned char enabled : 1;
};

struct _E_Module
{
   E_Object             e_obj_inherit;

   E_Module_Api        *api;
   
   const char          *name;
   const char          *dir;
   void                *handle;
   
   struct {
      void * (*init)        (E_Module *m);
      int    (*shutdown)    (E_Module *m);
      int    (*save)        (E_Module *m);
   } func;
   
   unsigned char        enabled : 1;
   unsigned char        error : 1;
   
   /* the module is allowed to modify these */
   void                *data;
};

struct _E_Module_Api
{
   int         version;
   const char *name;
};

EAPI int          e_module_init(void);
EAPI int          e_module_shutdown(void);

EAPI void         e_module_all_load(void);
EAPI E_Module    *e_module_new(const char *name);
EAPI int          e_module_save(E_Module *m);
EAPI const char  *e_module_dir_get(E_Module *m);
EAPI int          e_module_enable(E_Module *m);
EAPI int          e_module_disable(E_Module *m);
EAPI int          e_module_enabled_get(E_Module *m);
EAPI int          e_module_save_all(void);
EAPI E_Module    *e_module_find(const char *name);
EAPI Eina_List   *e_module_list(void);
EAPI void         e_module_dialog_show(E_Module *m, const char *title, const char *body);
EAPI void         e_module_delayed_set(E_Module *m, int delayed);
EAPI void         e_module_priority_set(E_Module *m, int priority);
    
#endif
#endif