frameworkd-glib-dbus: don't call deprecated g_type_init for glib-2.35* and newer
[libframeworkd-glib.git] / src / opimd / frameworkd-glib-opimd-types.c
blobce1fb8525c6a2549713afe630c4cc3afa509fb1f
1 /*
2 * Copyright (C) 2009
3 * Authors (alphabetical) :
4 * mrmoku (Klaus Kurzmann, mok@fluxnetz.de)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Public License as published by
8 * the Free Software Foundation; version 2 of the license.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser Public License for more details.
16 #include <dbus/dbus-glib.h>
17 #include <dbus/dbus-glib-bindings.h>
18 #include "frameworkd-glib-opimd-types.h"
19 #include "frameworkd-glib-opimd-dbus.h"
20 #include "dbus/types.h"
22 DBusGProxy *opimdTypesBus = NULL;
25 typedef struct {
26 void (*callback)(GError *, char **, gpointer);
27 gpointer userdata;
28 } opimd_types_list_data_t;
30 static void
31 opimd_types_list_callback(DBusGProxy *proxy, char **types,
32 GError *dbus_error, gpointer user_data)
34 (void)proxy;
35 opimd_types_list_data_t *data = user_data;
36 GError *error = NULL;
38 if (data->callback != NULL) {
39 if (dbus_error != NULL)
40 error = dbus_handle_errors(dbus_error);
41 data->callback(error, types, data->userdata);
42 if (error != NULL)
43 g_error_free(error);
45 if (dbus_error != NULL)
46 g_error_free(dbus_error);
48 g_free(data);
51 void
52 opimd_types_list(void (*callback)(GError *, char **, gpointer),
53 gpointer user_data)
55 dbus_connect_to_opimd_types();
57 opimd_types_list_data_t *data =
58 g_malloc(sizeof(opimd_types_list_data_t));
59 data->callback = callback;
60 data->userdata = user_data;
62 org_freesmartphone_PIM_Types_list_async(opimdTypesBus,
63 opimd_types_list_callback, data);