2 * Copyright © 2010 Codethink Limited
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the licence, or (at your option) any later version.
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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * Author: Ryan Lortie <desrt@desrt.ca>
22 #ifndef __dconf_engine_h__
23 #define __dconf_engine_h__
25 #include "../common/dconf-changeset.h"
29 typedef struct _DConfEngine DConfEngine
;
31 typedef struct _DConfEngineCallHandle DConfEngineCallHandle
;
36 DCONF_ERROR_NOT_WRITABLE
39 #define DCONF_ERROR (g_quark_from_static_string ("dconf error quark"))
41 /* These functions need to be implemented by the client library */
43 void dconf_engine_dbus_init_for_testing (void);
45 /* Sends a D-Bus message.
47 * When the reply comes back, the client library should call
48 * dconf_engine_handle_dbus_reply with the given user_data.
50 * This is called with the engine lock held. Re-entering the engine
51 * from this function will cause a deadlock.
54 gboolean
dconf_engine_dbus_call_async_func (GBusType bus_type
,
55 const gchar
*bus_name
,
56 const gchar
*object_path
,
57 const gchar
*interface_name
,
58 const gchar
*method_name
,
60 DConfEngineCallHandle
*handle
,
63 /* Sends a D-Bus message, synchronously.
65 * The lock is never held when calling this function (for the sake of
66 * not blocking requests in other threads) but you should have no reason
67 * to re-enter, so don't.
70 GVariant
* dconf_engine_dbus_call_sync_func (GBusType bus_type
,
71 const gchar
*bus_name
,
72 const gchar
*object_path
,
73 const gchar
*interface_name
,
74 const gchar
*method_name
,
76 const GVariantType
*expected_type
,
79 /* Notifies that a change occured.
81 * The engine lock is never held when calling this function so it is
82 * safe to run user callbacks or emit signals from this function.
85 void dconf_engine_change_notify (DConfEngine
*engine
,
87 const gchar
* const *changes
,
92 /* These functions are implemented by the engine */
94 const GVariantType
* dconf_engine_call_handle_get_expected_type (DConfEngineCallHandle
*handle
);
96 void dconf_engine_call_handle_reply (DConfEngineCallHandle
*handle
,
101 void dconf_engine_handle_dbus_signal (GBusType bus_type
,
102 const gchar
*bus_name
,
103 const gchar
*object_path
,
104 const gchar
*signal_name
,
105 GVariant
*parameters
);
108 DConfEngine
* dconf_engine_new (gpointer user_data
,
109 GDestroyNotify free_func
);
112 void dconf_engine_unref (DConfEngine
*engine
);
114 /* Read API: always handled immediately */
116 guint64
dconf_engine_get_state (DConfEngine
*engine
);
119 gboolean
dconf_engine_is_writable (DConfEngine
*engine
,
123 GVariant
* dconf_engine_read (DConfEngine
*engine
,
124 GQueue
*read_through
,
128 gchar
** dconf_engine_list (DConfEngine
*engine
,
132 /* "Fast" API: all calls return immediately and look like they succeeded (from a local viewpoint) */
134 void dconf_engine_watch_fast (DConfEngine
*engine
,
138 void dconf_engine_unwatch_fast (DConfEngine
*engine
,
142 gboolean
dconf_engine_change_fast (DConfEngine
*engine
,
143 DConfChangeset
*changeset
,
147 /* Synchronous API: all calls block until completed */
149 void dconf_engine_watch_sync (DConfEngine
*engine
,
153 void dconf_engine_unwatch_sync (DConfEngine
*engine
,
157 gboolean
dconf_engine_change_sync (DConfEngine
*engine
,
158 DConfChangeset
*changeset
,
162 gboolean
dconf_engine_has_outstanding (DConfEngine
*engine
);
164 void dconf_engine_sync (DConfEngine
*engine
);
166 /* Asynchronous API: not implemented yet (and maybe never?) */
168 #endif /* __dconf_engine_h__ */