]> git.tdb.fi Git - ext/subsurface.git/blob - linux.c
Add reasonable default device names for divecomputer import
[ext/subsurface.git] / linux.c
1 /* linux.c */
2 /* implements Linux specific functions */
3 #include "display-gtk.h"
4 #include <gconf/gconf-client.h>
5
6 GConfClient *gconf;
7
8 static char *gconf_name(char *name)
9 {
10         static char buf[255] = "/apps/subsurface/";
11
12         snprintf(buf, 255, "/apps/subsurface/%s", name);
13
14         return buf;
15 }
16
17 void subsurface_open_conf(void)
18 {
19         gconf = gconf_client_get_default();
20 }
21
22 void subsurface_set_conf(char *name, pref_type_t type, const void *value)
23 {
24         switch (type) {
25         case PREF_BOOL:
26                 gconf_client_set_bool(gconf, gconf_name(name), value != NULL, NULL);
27                 break;
28         case PREF_STRING:
29                 gconf_client_set_string(gconf, gconf_name(name), value, NULL);
30         }
31 }
32
33 const void *subsurface_get_conf(char *name, pref_type_t type)
34 {
35         switch (type) {
36         case PREF_BOOL:
37                 return gconf_client_get_bool(gconf, gconf_name(name), NULL) ? (void *) 1 : NULL;
38         case PREF_STRING:
39                 return gconf_client_get_string(gconf, gconf_name(name), NULL);
40         }
41         /* we shouldn't get here */
42         return NULL;
43 }
44
45 void subsurface_close_conf(void)
46 {
47         /* this is a no-op */
48 }
49
50 const char *subsurface_USB_name()
51 {
52         return("/dev/ttyUSB0");
53 }