aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/e_module.h
blob: 182e57d3fbc6f066c1714e0f08cfa0d2f0b7e3ca (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
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#ifdef E_TYPEDEFS

#define E_MODULE_API_VERSION 2

typedef struct _E_Module     E_Module;
typedef struct _E_Module_Api E_Module_Api;

#else
#ifndef E_MODULE_H
#define E_MODULE_H

#define E_MODULE_TYPE 0xE0b0100b

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);
      int    (*info)        (E_Module *m);
      int    (*about)       (E_Module *m);
      int    (*config)      (E_Module *m);
   } func;
   
   unsigned char        enabled : 1;
   unsigned char        error : 1;
   
   /* the module is allowed to modify these */
   void                *data;
   E_Menu              *config_menu;

   /* modify these but only set them up when the info func is called */
   /* e_module will free them when the module is freed. */
   /* note you will need to malloc (strdup) these fields due to the free */
   char                *icon_file;
   char                *edje_icon_file;
   char                *edje_icon_key;
};

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

EAPI int          e_module_init(void);
EAPI int          e_module_shutdown(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 Evas_List   *e_module_list(void);
EAPI E_Menu      *e_module_menu_new(void);
EAPI void         e_module_dialog_show(const char *title, const char *body);

#endif
#endif