Mercurial > pidgin
comparison libgaim/gaim-client.c @ 20389:e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
to branch 'im.pidgin.rlaager.merging.soc-msnp13-to-svn18164' (head 5b5cde92182d2a922a8e7e6c2308342a5490a8c9)
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 15 Apr 2007 02:10:37 +0000 |
parents | 60b1bc8dbf37 |
children |
comparison
equal
deleted
inserted
replaced
19842:21cb7a79ac7f | 20389:e354528c4163 |
---|---|
1 #define DBUS_API_SUBJECT_TO_CHANGE | |
2 | |
3 #include <dbus/dbus-glib.h> | |
4 #include <stdio.h> | |
5 #include <stdlib.h> | |
6 | |
7 #include "dbus-gaim.h" | |
8 #include "gaim-client-bindings.h" | |
9 | |
10 static DBusGConnection *bus; | |
11 static DBusGProxy *gaim_proxy; | |
12 | |
13 static GList *garray_int_to_glist(GArray *array) | |
14 { | |
15 GList *list = NULL; | |
16 int i; | |
17 | |
18 for (i = 0; i < array->len; i++) | |
19 list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); | |
20 | |
21 g_array_free(array, TRUE); | |
22 return list; | |
23 } | |
24 | |
25 static GSList *garray_int_to_gslist(GArray *array) | |
26 { | |
27 GSList *list = NULL; | |
28 int i; | |
29 | |
30 for (i = 0; i < array->len; i++) | |
31 list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); | |
32 | |
33 g_array_free(array, TRUE); | |
34 return list; | |
35 } | |
36 | |
37 #include "gaim-client-bindings.c" | |
38 | |
39 static void lose(const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); | |
40 static void lose_gerror(const char *prefix, GError *error) G_GNUC_NORETURN; | |
41 | |
42 static void | |
43 lose(const char *str, ...) | |
44 { | |
45 va_list args; | |
46 | |
47 va_start(args, str); | |
48 | |
49 vfprintf(stderr, str, args); | |
50 fputc('\n', stderr); | |
51 | |
52 va_end(args); | |
53 | |
54 exit(1); | |
55 } | |
56 | |
57 static void | |
58 lose_gerror(const char *prefix, GError *error) | |
59 { | |
60 lose("%s: %s", prefix, error->message); | |
61 } | |
62 | |
63 void gaim_init(void) | |
64 { | |
65 GError *error = NULL; | |
66 | |
67 g_type_init (); | |
68 | |
69 bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); | |
70 if (!bus) | |
71 lose_gerror ("Couldn't connect to session bus", error); | |
72 | |
73 gaim_proxy = dbus_g_proxy_new_for_name (bus, | |
74 DBUS_SERVICE_GAIM, | |
75 DBUS_PATH_GAIM, | |
76 DBUS_INTERFACE_GAIM); | |
77 | |
78 if (!gaim_proxy) | |
79 lose_gerror ("Couldn't connect to the Gaim Service", error); | |
80 } | |
81 |