1 #ifndef DBUS_API_SUBJECT_TO_CHANGE
2 #define DBUS_API_SUBJECT_TO_CHANGE
5 #include <dbus/dbus-glib.h>
9 #include "dbus-purple.h"
10 #include "purple-client.h"
12 static DBusGConnection
*bus
;
13 static DBusGProxy
*purple_proxy
;
15 static GList
*garray_int_to_glist(GArray
*array
)
20 for (i
= 0; i
< array
->len
; i
++)
21 list
= g_list_append(list
, GINT_TO_POINTER(g_array_index(array
,gint
,i
)));
23 g_array_free(array
, TRUE
);
27 static GSList
*garray_int_to_gslist(GArray
*array
)
32 for (i
= 0; i
< array
->len
; i
++)
33 list
= g_slist_append(list
, GINT_TO_POINTER(g_array_index(array
,gint
,i
)));
35 g_array_free(array
, TRUE
);
39 #include "purple-client-bindings.c"
41 static void lose(const char *fmt
, ...) G_GNUC_NORETURN
G_GNUC_PRINTF (1, 2);
42 static void lose_gerror(const char *prefix
, GError
*error
) G_GNUC_NORETURN
;
45 lose(const char *str
, ...)
51 vfprintf(stderr
, str
, args
);
60 lose_gerror(const char *prefix
, GError
*error
)
62 lose("%s: %s", prefix
, error
->message
);
65 void purple_init(void)
69 #if !GLIB_CHECK_VERSION(2, 36, 0)
70 /* GLib type system is automaticaly initialized since 2.36. */
74 bus
= dbus_g_bus_get (DBUS_BUS_SESSION
, &error
);
76 lose_gerror ("Couldn't connect to session bus", error
);
78 purple_proxy
= dbus_g_proxy_new_for_name (bus
,
81 DBUS_INTERFACE_PURPLE
);
84 lose_gerror ("Couldn't connect to the Purple Service", error
);