]> git.tdb.fi Git - ext/subsurface.git/blob - linux.c
Might as well free current_file
[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 #define DIVELIST_DEFAULT_FONT "Sans 8"
6
7 GConfClient *gconf;
8
9 static char *gconf_name(char *name)
10 {
11         static char buf[255] = "/apps/subsurface/";
12
13         snprintf(buf, 255, "/apps/subsurface/%s", name);
14
15         return buf;
16 }
17
18 void subsurface_open_conf(void)
19 {
20         gconf = gconf_client_get_default();
21 }
22
23 void subsurface_set_conf(char *name, pref_type_t type, const void *value)
24 {
25         switch (type) {
26         case PREF_BOOL:
27                 gconf_client_set_bool(gconf, gconf_name(name), value != NULL, NULL);
28                 break;
29         case PREF_STRING:
30                 gconf_client_set_string(gconf, gconf_name(name), value, NULL);
31         }
32 }
33
34 const void *subsurface_get_conf(char *name, pref_type_t type)
35 {
36         switch (type) {
37         case PREF_BOOL:
38                 return gconf_client_get_bool(gconf, gconf_name(name), NULL) ? (void *) 1 : NULL;
39         case PREF_STRING:
40                 return gconf_client_get_string(gconf, gconf_name(name), NULL);
41         }
42         /* we shouldn't get here */
43         return NULL;
44 }
45
46 void subsurface_flush_conf(void)
47 {
48         /* this is a no-op */
49 }
50
51 void subsurface_close_conf(void)
52 {
53         /* this is a no-op */
54 }
55
56 const char *subsurface_USB_name()
57 {
58         return "/dev/ttyUSB0";
59 }
60
61 const char *subsurface_icon_name()
62 {
63         return "subsurface.svg";
64 }
65
66 void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
67                 GtkWidget *vbox, GtkUIManager *ui_manager)
68 {
69         if (!divelist_font)
70                 divelist_font = DIVELIST_DEFAULT_FONT;
71         gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
72 }