1 /* GConf 2 * Copyright (C) 1999, 2000 Red Hat Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef GCONF_GCONF_CHANGESET_H 21 #define GCONF_GCONF_CHANGESET_H 22 23 #include "gconf/gconf.h" 24 25 G_BEGIN_DECLS 26 27 /* 28 * A GConfChangeSet is basically a hash from keys to "changes in value," 29 * where a change in a value is either a new value or "unset this value." 30 * 31 * You can use this to collect changes then "commit" them as a group to 32 * the GConf database. 33 */ 34 35 #define GCONF_TYPE_CHANGE_SET (gconf_change_set_get_type ()) 36 37 typedef struct _GConfChangeSet GConfChangeSet; 38 39 typedef void (* GConfChangeSetForeachFunc) (GConfChangeSet* cs, 40 const gchar* key, 41 GConfValue* value, 42 gpointer user_data); 43 44 gboolean gconf_engine_commit_change_set (GConfEngine* conf, 45 GConfChangeSet* cs, 46 /* remove all 47 successfully 48 committed changes 49 from the set */ 50 gboolean remove_committed, 51 GError** err); 52 53 /* Create a change set that would revert the given change set 54 for the given GConfEngine */ 55 GConfChangeSet* gconf_engine_reverse_change_set (GConfEngine* conf, 56 GConfChangeSet* cs, 57 GError** err); 58 59 /* Create a change set that would restore the current state of all the keys 60 in the NULL-terminated array "keys" */ 61 GConfChangeSet* gconf_engine_change_set_from_currentv (GConfEngine* conf, 62 const gchar** keys, 63 GError** err); 64 65 GConfChangeSet* gconf_engine_change_set_from_current (GConfEngine* conf, 66 GError** err, 67 const gchar* first_key, 68 ...) G_GNUC_NULL_TERMINATED; 69 70 71 GType gconf_change_set_get_type (void); 72 GConfChangeSet* gconf_change_set_new (void); 73 GConfChangeSet* gconf_change_set_ref (GConfChangeSet* cs); 74 75 void gconf_change_set_unref (GConfChangeSet* cs); 76 77 void gconf_change_set_clear (GConfChangeSet* cs); 78 79 guint gconf_change_set_size (GConfChangeSet* cs); 80 81 void gconf_change_set_remove (GConfChangeSet* cs, 82 const gchar* key); 83 84 void gconf_change_set_foreach (GConfChangeSet* cs, 85 GConfChangeSetForeachFunc func, 86 gpointer user_data); 87 88 /* Returns TRUE if the change set contains the given key; if the key 89 is in the set, either NULL (for unset) or a GConfValue is placed in 90 *value_retloc; the value is not a copy and should not be 91 freed. value_retloc can be NULL if you just want to check for a value, 92 and don't care what it is. */ 93 gboolean gconf_change_set_check_value (GConfChangeSet* cs, const gchar* key, 94 GConfValue** value_retloc); 95 96 void gconf_change_set_set (GConfChangeSet* cs, const gchar* key, 97 GConfValue* value); 98 99 void gconf_change_set_set_nocopy (GConfChangeSet* cs, const gchar* key, 100 GConfValue* value); 101 102 void gconf_change_set_unset (GConfChangeSet* cs, const gchar* key); 103 104 void gconf_change_set_set_float (GConfChangeSet* cs, const gchar* key, 105 gdouble val); 106 107 void gconf_change_set_set_int (GConfChangeSet* cs, const gchar* key, 108 gint val); 109 110 void gconf_change_set_set_string (GConfChangeSet* cs, const gchar* key, 111 const gchar* val); 112 113 void gconf_change_set_set_bool (GConfChangeSet* cs, const gchar* key, 114 gboolean val); 115 116 void gconf_change_set_set_schema (GConfChangeSet* cs, const gchar* key, 117 GConfSchema* val); 118 119 void gconf_change_set_set_list (GConfChangeSet* cs, const gchar* key, 120 GConfValueType list_type, 121 GSList* list); 122 123 void gconf_change_set_set_pair (GConfChangeSet* cs, const gchar* key, 124 GConfValueType car_type, GConfValueType cdr_type, 125 gconstpointer address_of_car, 126 gconstpointer address_of_cdr); 127 128 129 /* For use by language bindings only */ 130 void gconf_change_set_set_user_data (GConfChangeSet *cs, 131 gpointer data, 132 GDestroyNotify dnotify); 133 gpointer gconf_change_set_get_user_data (GConfChangeSet *cs); 134 135 136 137 G_END_DECLS 138 139 #endif 140 141 142 143