ekg2  GIT master
vars.h
Idź do dokumentacji tego pliku.
1 /* $Id$ */
2 
3 /*
4  * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License Version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __EKG_VARS_H
21 #define __EKG_VARS_H
22 
23 #include <glib.h>
24 
25 #include "dynstuff.h"
26 #include "plugins.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef enum {
33  VAR_STR, /* ciąg znaków */
34  VAR_INT, /* liczba całkowita */
35  VAR_BOOL, /* 0/1, tak/nie, yes/no, on/off */
36  VAR_MAP, /* bitmapa */
37  VAR_FILE, /* plik */
38  VAR_DIR, /* katalog */
39  VAR_THEME /* theme */
41 
42 typedef struct variable_map_t {
43  char *label; /* nazwa wartości */
44  int value; /* wartość */
45  int conflicts; /* wartości, z którymi koliduje */
47 
48 typedef void (variable_notify_func_t)(const char *);
49 typedef void (variable_check_func_t)(const char *, const char *);
50 typedef int (variable_display_func_t)(const char *);
51 
52 typedef struct variable {
53  char *name; /* nazwa zmiennej */
54  plugin_t *plugin; /* wstyczka obsługująca zmienną */
55  int name_hash; /* hash nazwy zmiennej */
56  int type; /* rodzaj */
57  int display; /* 0 bez wartości, 1 pokazuje, 2 w ogóle */
58  void *ptr; /* wskaźnik do zmiennej */
60  /* funkcja sprawdzająca czy wartość jest
61  * prawidłowa */
63  /* funkcja wywoływana po zmianie wartości */
64  variable_map_t *map; /* mapa wartości i etykiet */
66  /* funkcja sprawdzająca, czy zmienną można
67  * wyświetlić na liście zmiennych */
68 } variable_t;
69 
70 #ifndef EKG2_WIN32_NOFUNCTION
71 
72 extern GSList *variables;
73 
74 void variable_init();
76 variable_t *variable_find(const char *name);
77 variable_map_t *variable_map(int count, ...);
78 #define variable_hash ekg_hash
79 
82  const char *name,
83  int type,
84  int display,
85  void *ptr,
86  variable_notify_func_t *notify,
87  variable_map_t *map,
88  variable_display_func_t *dyndisplay);
89 
90 int variable_set(const char *name, const char *value);
91 void variable_help(const char *name);
92 int variable_remove(plugin_t *plugin, const char *name);
93 
95 void variables_destroy();
96 
97 #endif
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* __EKG_VARS_H */
104 
105 /*
106  * Local Variables:
107  * mode: c
108  * c-file-style: "k&r"
109  * c-basic-offset: 8
110  * indent-tabs-mode: t
111  * End:
112  */
void variable_help(const char *name)
Definition: vars.c:520
Definition: vars.h:38
variable_notify_func_t * notify
Definition: vars.h:62
variable_class_t
Definition: vars.h:32
void variable_init()
Definition: vars.c:65
int value
Definition: vars.h:44
struct variable_map_t variable_map_t
int variable_set(const char *name, const char *value)
Definition: vars.c:319
Definition: vars.h:39
void() variable_notify_func_t(const char *)
Definition: vars.h:48
Definition: vars.h:35
char * label
Definition: vars.h:43
int conflicts
Definition: vars.h:45
int() variable_display_func_t(const char *)
Definition: vars.h:50
int display
Definition: vars.h:57
variable_display_func_t * dyndisplay
Definition: vars.h:65
void() variable_check_func_t(const char *, const char *)
Definition: vars.h:49
void variable_set_default()
Definition: vars.c:137
Definition: vars.h:33
Definition: plugins.h:76
Definition: vars.h:37
char * name
Definition: vars.h:53
Definition: vars.h:42
void variables_destroy()
Definition: vars.c:508
Definition: vars.h:36
int variable_remove(plugin_t *plugin, const char *name)
Definition: vars.c:264
void variables_remove(variable_t *v)
Definition: vars.c:503
const char * name
Definition: remote.c:88
GSList * variables
Definition: vars.c:35
variable_check_func_t * check
Definition: vars.h:59
plugin_t * plugin
Definition: vars.h:54
void * ptr
Definition: vars.h:58
struct variable variable_t
variable_map_t * map
Definition: vars.h:64
variable_map_t * variable_map(int count,...)
Definition: vars.c:196
variable_t * variable_find(const char *name)
Definition: vars.c:166
variable_t * variable_add(plugin_t *plugin, const char *name, int type, int display, void *ptr, variable_notify_func_t *notify, variable_map_t *map, variable_display_func_t *dyndisplay)
Definition: vars.c:232
Definition: vars.h:52
Definition: vars.h:34
int name_hash
Definition: vars.h:55
int type
Definition: vars.h:56