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
;
26 void (*callback
)(GError
*, char **, gpointer
);
28 } opimd_types_list_data_t
;
31 opimd_types_list_callback(DBusGProxy
*proxy
, char **types
,
32 GError
*dbus_error
, gpointer user_data
)
35 opimd_types_list_data_t
*data
= user_data
;
38 if (data
->callback
!= NULL
) {
39 if (dbus_error
!= NULL
)
40 error
= dbus_handle_errors(dbus_error
);
41 data
->callback(error
, types
, data
->userdata
);
45 if (dbus_error
!= NULL
)
46 g_error_free(dbus_error
);
52 opimd_types_list(void (*callback
)(GError
*, char **, gpointer
),
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
);