service: add new 'string set' utility pseudoclass
[dconf.git] / tests / dconf-mock-dbus.c
blob1ae7ba0dfe524cbb4a5532b75a6828b9b4498cc1
1 /*
2 * Copyright © 2012 Canonical 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 #include "../engine/dconf-engine.h"
23 #include "dconf-mock.h"
25 GQueue dconf_mock_dbus_outstanding_call_handles;
27 gboolean
28 dconf_engine_dbus_call_async_func (GBusType bus_type,
29 const gchar *bus_name,
30 const gchar *object_path,
31 const gchar *interface_name,
32 const gchar *method_name,
33 GVariant *parameters,
34 DConfEngineCallHandle *handle,
35 GError **error)
37 g_variant_ref_sink (parameters);
38 g_variant_unref (parameters);
40 g_queue_push_tail (&dconf_mock_dbus_outstanding_call_handles, handle);
42 return TRUE;
45 DConfMockDBusSyncCallHandler dconf_mock_dbus_sync_call_handler;
47 GVariant *
48 dconf_engine_dbus_call_sync_func (GBusType bus_type,
49 const gchar *bus_name,
50 const gchar *object_path,
51 const gchar *interface_name,
52 const gchar *method_name,
53 GVariant *parameters,
54 const GVariantType *reply_type,
55 GError **error)
57 GVariant *reply;
59 g_assert (dconf_mock_dbus_sync_call_handler != NULL);
61 g_variant_ref_sink (parameters);
63 reply = (* dconf_mock_dbus_sync_call_handler) (bus_type, bus_name, object_path, interface_name,
64 method_name, parameters, reply_type, error);
66 g_variant_unref (parameters);
68 return g_variant_take_ref (reply);