Code

60eb694b5018764a1bcd339e26b2962074a14fbc
[inkscape.git] / src / prefs-utils.h
1 /*
2  * Utility functions for reading and setting preferences
3  *
4  * Authors:
5  *   bulia byak <bulia@dr.com>
6  *
7  * Copyright (C) 2003 authors
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #ifndef SEEN_PREFS_UTILS_H
13 #define SEEN_PREFS_UTILS_H
15 #include <glib/gtypes.h>
16 #include <glib/gslist.h>
17 #include "preferences.h"
19 inline bool pref_path_exists(gchar const *path){
20     Inkscape::Preferences *ps = Inkscape::Preferences::get();
21     return ps->exists(path);
22 }
24 inline unsigned pref_path_number_of_children(gchar const *path){
25     Inkscape::Preferences *ps = Inkscape::Preferences::get();
26     return ps->childCount(path);
27 }
29 inline void
30 prefs_set_int_attribute(gchar const *path, gchar const *attr, long long int value)
31 {
32     Inkscape::Preferences *ps = Inkscape::Preferences::get();
33     ps->setInt(path, attr, value);
34 }
36 inline int
37 prefs_get_int_attribute(gchar const *path, gchar const *attr, long long int def)
38 {
39     Inkscape::Preferences *ps = Inkscape::Preferences::get();
40     return ps->getInt(path, attr, def);
41 }
43 inline int
44 prefs_get_int_attribute_limited(gchar const *path, gchar const *attr, long long int def, long long int min, long long int max)
45 {
46     Inkscape::Preferences *ps = Inkscape::Preferences::get();
47     return ps->getIntLimited(path, attr, def, min, max);
48 }
50 inline void
51 prefs_set_double_attribute(gchar const *path, gchar const *attr, double value)
52 {
53     Inkscape::Preferences *ps = Inkscape::Preferences::get();
54     ps->setDouble(path, attr, value);
55 }
57 inline double
58 prefs_get_double_attribute(gchar const *path, gchar const *attr, double def)
59 {
60     Inkscape::Preferences *ps = Inkscape::Preferences::get();
61     return ps->getDouble(path, attr, def);
62 }
64 inline double
65 prefs_get_double_attribute_limited(gchar const *path, gchar const *attr, double def, double min, double max)
66 {
67     Inkscape::Preferences *ps = Inkscape::Preferences::get();
68     return ps->getDoubleLimited(path, attr, def, min, max);
69 }
71 inline void
72 prefs_set_string_attribute(gchar const *path, gchar const *attr, gchar const *value)
73 {
74     Inkscape::Preferences *ps = Inkscape::Preferences::get();
75     ps->setString(path, attr, value);
76 }
78 /// @todo Reimplement using Gtk::RecentManager
79 void prefs_set_recent_file(const gchar * uri, const gchar * name);
80 const gchar ** prefs_get_recent_files(void);
82 #endif /* !SEEN_PREFS_UTILS_H */
84 /*
85   Local Variables:
86   mode:c++
87   c-file-style:"stroustrup"
88   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
89   indent-tabs-mode:nil
90   fill-column:99
91   End:
92 */
93 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :