Update to 24f58c58bb8d22c0e8e6c5ce43c536c47b719bc6
[gnt.git] / gntstyle.h
blob7116922db3f299c16c862e97e7ed57697afe0196
1 /**
2 * @file gntstyle.h Style API
3 * @ingroup gnt
4 */
5 /*
6 * GNT - The GLib Ncurses Toolkit
8 * GNT is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #include "gnt.h"
28 #include "gntwm.h"
30 typedef enum
32 GNT_STYLE_SHADOW = 0,
33 GNT_STYLE_COLOR = 1,
34 GNT_STYLE_MOUSE = 2,
35 GNT_STYLE_WM = 3,
36 GNT_STYLE_REMPOS = 4,
37 GNT_STYLES
38 } GntStyle;
40 /**
41 * Read configuration from a file.
43 * @param filename The filename to read configuration from.
45 void gnt_style_read_configure_file(const char *filename);
47 /**
48 * Get the user-setting for a style.
49 * @param style The style.
50 * @return The user-setting, or @c NULL.
52 const char *gnt_style_get(GntStyle style);
54 /**
55 * Get the value of a preference in ~/.gntrc.
57 * @param group The name of the group in the keyfile. If @c NULL, the prgname
58 * will be used first, if available. Otherwise, "general" will be used.
59 * @param key The key
61 * @return The value of the setting as a string, or @c NULL
63 * @since 2.0.0 (gnt), 2.1.0 (pidgin)
65 char *gnt_style_get_from_name(const char *group, const char *key);
67 /**
68 * Get the value of a preference in ~/.gntrc.
70 * @param group The name of the group in the keyfile. If @c NULL, the prgname
71 * will be used first, if available. Otherwise, "general" will be used.
72 * @param key The key
73 * @param length Return location for the number of strings returned, or NULL
75 * @return NULL terminated string array. The array should be freed with g_strfreev().
77 * @since 2.4.0
79 char **gnt_style_get_string_list(const char *group, const char *key, gsize *length);
81 /**
82 * Get the value of a color pair in ~/.gntrc.
84 * @param group The name of the group in the keyfile. If @c NULL, the prgname
85 * will be used first, if available. Otherwise, "general" will be used.
86 * @param key The key
88 * @return The value of the color as an int, or 0 on error.
90 * @since 2.4.0
92 int gnt_style_get_color(char *group, char *key);
94 /**
95 * Parse a boolean preference. For example, if 'value' is "false" (ignoring case)
96 * or "0", the return value will be @c FALSE, otherwise @c TRUE.
98 * @param value The value of the boolean setting as a string
99 * @return The boolean value
101 * @since 2.0.0 (gnt), 2.1.0 (pidgin)
103 gboolean gnt_style_parse_bool(const char *value);
106 * Get the boolean value for a user-setting.
108 * @param style The style.
109 * @param def The default value (i.e, the value if the user didn't define
110 * any value)
112 * @return The value of the setting.
114 gboolean gnt_style_get_bool(GntStyle style, gboolean def);
117 * @internal
119 void gnt_styles_get_keyremaps(GType type, GHashTable *hash);
122 * @internal
124 void gnt_style_read_actions(GType type, GntBindableClass *klass);
127 * Read menu-accels from ~/.gntrc
129 * @param name The name of the window.
130 * @param table The hastable to store the accel information.
132 * @return @c TRUE if some accels were read, @c FALSE otherwise.
134 gboolean gnt_style_read_menu_accels(const char *name, GHashTable *table);
137 * @internal
138 * Read workspace information.
140 void gnt_style_read_workspaces(GntWM *wm);
143 * Initialize style settings.
145 void gnt_init_styles(void);
148 * Uninitialize style settings.
150 void gnt_uninit_styles(void);