prepared code to add a way to change the notes directory
[ptask.git] / src / settings.c
1 /*
2  * Copyright (C) 2012-2013 jeanfi@gmail.com
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19
20 #include <settings.h>
21
22 const char *SETTINGS_KEY_WINDOW_WIDTH = "window-width";
23 const char *SETTINGS_KEY_WINDOW_HEIGHT = "window-height";
24 const char *SETTINGS_KEY_WINDOW_X = "window-x";
25 const char *SETTINGS_KEY_WINDOW_Y = "window-y";
26 const char *SETTINGS_KEY_SPLITER_VERTICAL_POS = "spliter-vertical-pos";
27 const char *SETTINGS_KEY_SPLITER_HORIZONTAL_POS = "spliter-horizontal-pos";
28 const char *SETTINGS_KEY_TASKS_SORT_COL = "tasks-sort-col";
29 const char *SETTINGS_KEY_TASKS_SORT_ORDER = "tasks-sort-order";
30
31 const char * const SETTINGS_VISIBLE_COL_KEYS[] = {
32         "tasktree-id-visible",
33         "tasktree-description-visible",
34         "tasktree-project-visible",
35         "tasktree-uuid-visible",
36         "tasktree-priority-visible",
37         "tasktree-urgency-visible",
38         "tasktree-creation-date-visible",
39         "tasktree-due-visible",
40         "tasktree-start-visible",
41 };
42
43 static GSettings *settings;
44
45 void settings_init()
46 {
47         settings = g_settings_new("ptask");
48 }
49
50 gint settings_get_int(const gchar *key)
51 {
52         return g_settings_get_int(settings, key);
53 }
54
55 void settings_set_int(const gchar *key, gint value)
56 {
57         g_settings_set_int(settings, key, value);
58 }
59
60 gboolean settings_get_boolean(const gchar *key)
61 {
62         return g_settings_get_boolean(settings, key);
63 }
64
65 void settings_set_boolean(const gchar *key, gboolean value)
66 {
67         g_settings_set_boolean(settings, key, value);
68 }