1 /** 2 * @file conf.h Liferea configuration (GSettings access) 3 * 4 * Copyright (C) 2011 Mikel Olasagasti Uranga <mikel@olasagasti.info> 5 * Copyright (C) 2003-2017 Lars Windolf <lars.windolf@gmx.de> 6 * Copyright (C) 2004,2005 Nathan J. Conrad <t98502@users.sourceforge.net> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 23 #ifndef _CONF_H 24 #define _CONF_H 25 26 #include <glib.h> 27 #include <gio/gio.h> 28 29 /* browsing settings */ 30 #define BROWSE_INSIDE_APPLICATION "browse-inside-application" 31 #define BROWSE_KEY_SETTING "browse-key-setting" 32 #define BROWSER_ID "browser-id" 33 #define BROWSER_COMMAND "browser" 34 35 #define DEFAULT_VIEW_MODE "default-view-mode" 36 37 #define DEFAULT_FONT "document-font-name" 38 #define USER_FONT "browser-font" 39 #define DISABLE_JAVASCRIPT "disable-javascript" 40 #define SOCIAL_BM_SITE "social-bm-site" 41 #define ENABLE_PLUGINS "enable-plugins" 42 43 /* enclosure handling */ 44 #define DOWNLOAD_CUSTOM_COMMAND "download-custom-command" 45 #define DOWNLOAD_TOOL "download-tool" 46 #define DOWNLOAD_USE_CUSTOM_COMMAND "download-use-custom-command" 47 48 /* feed handling settings */ 49 #define DEFAULT_MAX_ITEMS "maxitemcount" 50 #define DEFAULT_UPDATE_INTERVAL "default-update-interval" 51 #define STARTUP_FEED_ACTION "startup-feed-action" 52 53 /* folder handling settings */ 54 #define FOLDER_DISPLAY_MODE "folder-display-mode" 55 #define FOLDER_DISPLAY_HIDE_READ "folder-display-hide-read" 56 #define REDUCED_FEEDLIST "reduced-feedlist" 57 58 /* GUI settings and persistency values */ 59 #define CONFIRM_MARK_ALL_READ "confirm-mark-all-read" 60 #define DISABLE_TOOLBAR "disable-toolbar" 61 #define TOOLBAR_STYLE "toolbar-style" 62 #define LAST_WINDOW_STATE "last-window-state" 63 #define LAST_WINDOW_X "last-window-x" 64 #define LAST_WINDOW_Y "last-window-y" 65 #define LAST_WINDOW_WIDTH "last-window-width" 66 #define LAST_WINDOW_HEIGHT "last-window-height" 67 #define LAST_WINDOW_MAXIMIZED "last-window-maximized" 68 #define LAST_VPANE_POS "last-vpane-pos" 69 #define LAST_HPANE_POS "last-hpane-pos" 70 #define LAST_WPANE_POS "last-wpane-pos" 71 #define LAST_ZOOMLEVEL "last-zoomlevel" 72 #define LAST_NODE_SELECTED "last-node-selected" 73 #define LIST_VIEW_COLUMN_ORDER "list-view-column-order" 74 75 /* networking settings */ 76 #define PROXY_DETECT_MODE "proxy-detect-mode" 77 #define PROXY_HOST "proxy-host" 78 #define PROXY_PORT "proxy-port" 79 #define PROXY_USEAUTH "proxy-use-authentication" 80 #define PROXY_USER "proxy-authentication-user" 81 #define PROXY_PASSWD "proxy-authentication-password" 82 #define DO_NOT_TRACK "do-not-track" 83 84 /* initializing methods */ 85 void conf_init (void); 86 void conf_deinit (void); 87 88 /* preferences access methods */ 89 90 #define conf_get_bool_value(key, value) conf_get_bool_value_from_schema (NULL, key, value) 91 #define conf_get_str_value(key, value) conf_get_str_value_from_schema (NULL, key, value) 92 #define conf_get_strv_value(key, value) conf_get_strv_value_from_schema (NULL, key, value) 93 #define conf_get_int_value(key, value) conf_get_int_value_from_schema (NULL, key, value) 94 95 /** 96 * Retrieves the value of the given boolean configuration key. 97 * 98 * @param gsettings gsettings schema to use 99 * @param key the configuration key 100 * @param value the value, if the function returned FALSE it's always FALSE 101 * 102 * @returns TRUE if the configuration key was found 103 */ 104 gboolean conf_get_bool_value_from_schema (GSettings *gsettings, const gchar *key, gboolean *value); 105 106 /** 107 * Retrieves the value of the given string configuration key. 108 * The string has to be freed by the caller. 109 * 110 * @param gsettings gsettings schema to use 111 * @param key the configuration key 112 * @param value the value, if the function returned FALSE an empty string 113 * 114 * @returns TRUE if the configuration key was found 115 */ 116 gboolean conf_get_str_value_from_schema (GSettings *gsettings,const gchar *key, gchar **value); 117 118 /** 119 * Retrieves the value of the given string array configuration key. 120 * The string array has to be freed by the caller. 121 * 122 * @param gsettings gsettings schema to use 123 * @param key the configuration key 124 * @param value the value, if the function returned FALSE an empty string 125 * 126 * @returns TRUE if the configuration key was found 127 */ 128 gboolean conf_get_strv_value_from_schema (GSettings *gsettings,const gchar *key, gchar ***value); 129 130 /** 131 * Retrieves the value of the given integer configuration key. 132 * 133 * @param gsettings gsettings schema to use 134 * @param key the configuration key 135 * @param value the value, if the function returned FALSE it's always 0 136 * 137 * @returns TRUE if the configuration key was found 138 */ 139 gboolean conf_get_int_value_from_schema (GSettings *gsettings, const gchar *key, gint *value); 140 141 /** 142 * Sets the value of the given boolean configuration key. 143 * 144 * @param key the configuration key 145 * @param value the new boolean value 146 */ 147 void conf_set_bool_value (const gchar *key, gboolean value); 148 149 /** 150 * Sets the value of the given string configuration key. 151 * The given value will not be free'd after setting it! 152 * 153 * @param key the configuration key 154 * @param value the new string value 155 */ 156 void conf_set_str_value (const gchar *key, const gchar *value); 157 158 /** 159 * Sets the value of the given string configuration key. 160 * The given value will not be free'd after setting it! 161 * 162 * @param key the configuration key 163 * @param value the new string value 164 */ 165 void conf_set_strv_value (const gchar *key, const gchar **value); 166 167 /** 168 * Sets the value of the given integer configuration key 169 * 170 * @param key the configuration key 171 * @param value the new integer value 172 */ 173 void conf_set_int_value (const gchar *key, gint value); 174 175 /** 176 * Returns the current toolbar configuration. 177 * 178 * @returns a string (to be free'd using g_free) 179 */ 180 gchar * conf_get_toolbar_style (void); 181 182 /** 183 * Get the current system default font from desktop schema 184 * 185 * @param key the configuration key 186 * @param value the value, if the function returned FALSE it's always 0 187 * 188 * @returns TRUE if the configuration key was found 189 */ 190 gboolean conf_get_default_font_from_schema (const gchar *key, gchar **value); 191 192 /** 193 * Connect to a signal in the default GSettings object 194 * 195 * @param signal the signal to connect to 196 * @param cb callback to invoke when the signal is emitted 197 * @param data user data to pass to the callback 198 */ 199 void conf_signal_connect (const gchar *signal, GCallback cb, gpointer data); 200 201 /** 202 * conf_bind: 203 * @key: the configuration key 204 * @object: a GObject 205 * @property: the object's property to bind 206 * @flags: binding flags 207 * 208 * This is a convenience function that calls g_settings_bind with Liferea settings. 209 */ 210 void conf_bind (const gchar *key, gpointer object, const gchar *property, GSettingsBindFlags flags); 211 #endif 212