Merge lp:~ken-vandine/indicator-me/libgwibber-port into lp:indicator-me
- libgwibber-port
- Merge into trunk
Proposed by
Ken VanDine
Status: | Merged |
---|---|
Approved by: | David Barth |
Approved revision: | 105 |
Merge reported by: | David Barth |
Merged at revision: | not available |
Proposed branch: | lp:~ken-vandine/indicator-me/libgwibber-port |
Merge into: | lp:indicator-me |
Diff against target: |
768 lines (+240/-352) 5 files modified
configure.ac (+2/-0) src/entry-menu-item.c (+2/-2) src/me-service-gwibber.c (+199/-302) src/me-service-gwibber.h (+31/-32) src/me-service.c (+6/-16) |
To merge this branch: | bzr merge lp:~ken-vandine/indicator-me/libgwibber-port |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
David Barth | Approve | ||
Ken VanDine | Needs Resubmitting | ||
Review via email: mp+32775@code.launchpad.net |
Commit message
Description of the change
Port to libgwibber
To post a comment you must log in.
- 102. By Ken VanDine
-
remove a noop
- 103. By Ken VanDine
-
Don't set status to NOT_RUNNING if we get a response from gwibber
- 104. By Ken VanDine
-
Don't set status based on configured accounts
Revision history for this message
Ken VanDine (ken-vandine) wrote : | # |
OK, I think I addressed all of those. It will no longer hide the entry if the service shuts down, but it does hide if you disable all the accounts.
review:
Needs Resubmitting
- 105. By Ken VanDine
-
check for send_enabled even if configured_accounts was TRUE before
Revision history for this message
David Barth (dbarth) wrote : | # |
Thanks for the branch, I appreciate your help
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2010-03-24 09:42:26 +0000 | |||
3 | +++ configure.ac 2010-08-17 14:44:43 +0000 | |||
4 | @@ -28,6 +28,7 @@ | |||
5 | 28 | 28 | ||
6 | 29 | GTK_REQUIRED_VERSION=2.12 | 29 | GTK_REQUIRED_VERSION=2.12 |
7 | 30 | INDICATOR_REQUIRED_VERSION=0.3.0 | 30 | INDICATOR_REQUIRED_VERSION=0.3.0 |
8 | 31 | GWIBBER_REQUIRED_VERSION=0.0.4 | ||
9 | 31 | DBUSMENUGTK_REQUIRED_VERSION=0.2.2 | 32 | DBUSMENUGTK_REQUIRED_VERSION=0.2.2 |
10 | 32 | DBUSMENUGLIB_REQUIRED_VERSION=0.2.2 | 33 | DBUSMENUGLIB_REQUIRED_VERSION=0.2.2 |
11 | 33 | TELEPATHYGLIB_REQUIRED_VERSION=0.9.0 | 34 | TELEPATHYGLIB_REQUIRED_VERSION=0.9.0 |
12 | @@ -41,6 +42,7 @@ | |||
13 | 41 | PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION | 42 | PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION |
14 | 42 | gconf-2.0 >= $GCONF_REQUIRED_VERSION | 43 | gconf-2.0 >= $GCONF_REQUIRED_VERSION |
15 | 43 | indicator >= $INDICATOR_REQUIRED_VERSION | 44 | indicator >= $INDICATOR_REQUIRED_VERSION |
16 | 45 | gwibber >= $GWIBBER_REQUIRED_VERSION | ||
17 | 44 | telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION) | 46 | telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION) |
18 | 45 | 47 | ||
19 | 46 | ########################### | 48 | ########################### |
20 | 47 | 49 | ||
21 | === modified file 'src/entry-menu-item.c' | |||
22 | --- src/entry-menu-item.c 2010-03-17 16:19:44 +0000 | |||
23 | +++ src/entry-menu-item.c 2010-08-17 14:44:43 +0000 | |||
24 | @@ -128,8 +128,8 @@ | |||
25 | 128 | 128 | ||
26 | 129 | g_debug ("handle_event"); | 129 | g_debug ("handle_event"); |
27 | 130 | if (g_strcmp0 (name, "send") == 0) { | 130 | if (g_strcmp0 (name, "send") == 0) { |
30 | 131 | GwibberService *gwibber = gwibber_service_get (); | 131 | MeGwibberService *me_gwibber_service = me_gwibber_service_get (); |
31 | 132 | gwibber_service_send (gwibber, g_value_get_string (value)); | 132 | me_gwibber_service_send (me_gwibber_service, g_value_get_string (value)); |
32 | 133 | dbusmenu_menuitem_property_set (mi, ENTRY_MENUITEM_PROP_TEXT, ""); | 133 | dbusmenu_menuitem_property_set (mi, ENTRY_MENUITEM_PROP_TEXT, ""); |
33 | 134 | } | 134 | } |
34 | 135 | 135 | ||
35 | 136 | 136 | ||
36 | === modified file 'src/me-service-gwibber.c' | |||
37 | --- src/me-service-gwibber.c 2010-03-24 09:38:22 +0000 | |||
38 | +++ src/me-service-gwibber.c 2010-08-17 14:44:43 +0000 | |||
39 | @@ -24,23 +24,14 @@ | |||
40 | 24 | 24 | ||
41 | 25 | #include <glib.h> | 25 | #include <glib.h> |
42 | 26 | 26 | ||
52 | 27 | #include <dbus/dbus-glib.h> | 27 | #include <gwibber.h> |
44 | 28 | #include <dbus/dbus-glib-bindings.h> | ||
45 | 29 | |||
46 | 30 | #define DBUS_SERVICE_ADDRESS "com.Gwibber.Service" | ||
47 | 31 | #define DBUS_SERVICE_SERVICE_OBJECT "/com/gwibber/Service" | ||
48 | 32 | #define DBUS_SERVICE_SERVICE_INTERFACE "com.Gwibber.Service" | ||
49 | 33 | |||
50 | 34 | #define DBUS_SERVICE_ACCOUNTS_OBJECT "/com/gwibber/Accounts" | ||
51 | 35 | #define DBUS_SERVICE_ACCOUNTS_INTERFACE "com.Gwibber.Accounts" | ||
53 | 36 | 28 | ||
54 | 37 | /* gobject infrastructure */ | 29 | /* gobject infrastructure */ |
55 | 38 | 30 | ||
61 | 39 | typedef struct _GwibberServicePrivate GwibberServicePrivate; | 31 | typedef struct _MeGwibberServicePrivate MeGwibberServicePrivate; |
62 | 40 | struct _GwibberServicePrivate { | 32 | struct _MeGwibberServicePrivate { |
63 | 41 | DBusGProxy * dbus_proxy; | 33 | GwibberService * me_gwibber_service; |
64 | 42 | DBusGProxy * service_proxy; | 34 | GwibberAccounts * me_gwibber_accounts; |
60 | 43 | DBusGProxy * accounts_proxy; | ||
65 | 44 | int status; | 35 | int status; |
66 | 45 | gboolean has_configured_accounts; | 36 | gboolean has_configured_accounts; |
67 | 46 | }; | 37 | }; |
68 | @@ -54,35 +45,35 @@ | |||
69 | 54 | static guint signals[LAST_SIGNAL] = { 0 }; | 45 | static guint signals[LAST_SIGNAL] = { 0 }; |
70 | 55 | 46 | ||
71 | 56 | /* Prototypes */ | 47 | /* Prototypes */ |
86 | 57 | static void gwibber_service_class_init (GwibberServiceClass *klass); | 48 | static void me_gwibber_service_class_init (MeGwibberServiceClass *klass); |
87 | 58 | static void gwibber_service_init (GwibberService *self); | 49 | static void me_gwibber_service_init (MeGwibberService *self); |
88 | 59 | static void gwibber_service_dispose (GObject *object); | 50 | static void me_gwibber_service_dispose (GObject *object); |
89 | 60 | static void gwibber_service_finalize (GObject *object); | 51 | static void me_gwibber_service_finalize (GObject *object); |
90 | 61 | 52 | ||
91 | 62 | static void dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, GwibberService * self); | 53 | static void me_gwibber_service_exists_cb (GwibberService * me_gwibber_service, gboolean exists, gpointer userdata); |
92 | 63 | static void gwibber_exists_cb (DBusGProxy * proxy, gboolean exists, GError * error, gpointer userdata); | 54 | static void me_gwibber_accounts_exists_cb (GwibberAccounts * me_gwibber_accounts, gboolean exists, gpointer userdata); |
93 | 64 | static void setup_service_proxies (GwibberService *self); | 55 | static void setup_service_proxies (MeGwibberService *self); |
94 | 65 | static void query_account_manager (GwibberService *self); | 56 | static void query_account_manager (MeGwibberService *self); |
95 | 66 | 57 | ||
96 | 67 | G_DEFINE_TYPE (GwibberService, gwibber_service, G_TYPE_OBJECT); | 58 | G_DEFINE_TYPE (MeGwibberService, me_gwibber_service, G_TYPE_OBJECT); |
97 | 68 | 59 | ||
98 | 69 | #define GWIBBER_SERVICE_GET_PRIVATE(o) \ | 60 | #define ME_GWIBBER_SERVICE_GET_PRIVATE(o) \ |
99 | 70 | (G_TYPE_INSTANCE_GET_PRIVATE ((o), GWIBBER_SERVICE_TYPE, GwibberServicePrivate)) | 61 | (G_TYPE_INSTANCE_GET_PRIVATE ((o), ME_GWIBBER_SERVICE_TYPE, MeGwibberServicePrivate)) |
100 | 71 | 62 | ||
101 | 72 | static void | 63 | static void |
103 | 73 | gwibber_service_class_init (GwibberServiceClass *klass) | 64 | me_gwibber_service_class_init (MeGwibberServiceClass *klass) |
104 | 74 | { | 65 | { |
105 | 75 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | 66 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
106 | 76 | 67 | ||
113 | 77 | g_type_class_add_private (klass, sizeof (GwibberServicePrivate)); | 68 | g_type_class_add_private (klass, sizeof (MeGwibberServicePrivate)); |
114 | 78 | 69 | ||
115 | 79 | object_class->dispose = gwibber_service_dispose; | 70 | object_class->dispose = me_gwibber_service_dispose; |
116 | 80 | object_class->finalize = gwibber_service_finalize; | 71 | object_class->finalize = me_gwibber_service_finalize; |
117 | 81 | 72 | ||
118 | 82 | signals[STATUS_CHANGED] = g_signal_new(GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED, | 73 | signals[STATUS_CHANGED] = g_signal_new(ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED, |
119 | 83 | G_TYPE_FROM_CLASS(klass), | 74 | G_TYPE_FROM_CLASS(klass), |
120 | 84 | G_SIGNAL_RUN_LAST, | 75 | G_SIGNAL_RUN_LAST, |
122 | 85 | G_STRUCT_OFFSET(GwibberServiceClass, status_changed), | 76 | G_STRUCT_OFFSET(MeGwibberServiceClass, status_changed), |
123 | 86 | NULL, NULL, | 77 | NULL, NULL, |
124 | 87 | g_cclosure_marshal_VOID__UINT, | 78 | g_cclosure_marshal_VOID__UINT, |
125 | 88 | G_TYPE_NONE, 1, G_TYPE_UINT); | 79 | G_TYPE_NONE, 1, G_TYPE_UINT); |
126 | @@ -90,316 +81,222 @@ | |||
127 | 90 | } | 81 | } |
128 | 91 | 82 | ||
129 | 92 | static void | 83 | static void |
269 | 93 | gwibber_service_init (GwibberService *self) | 84 | me_gwibber_service_init (MeGwibberService *self) |
270 | 94 | { | 85 | { |
271 | 95 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(self); | 86 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(self); |
272 | 96 | 87 | ||
273 | 97 | priv->dbus_proxy = NULL; | 88 | priv->me_gwibber_service = NULL; |
274 | 98 | priv->service_proxy = NULL; | 89 | priv->me_gwibber_accounts = NULL; |
275 | 99 | priv->accounts_proxy = NULL; | 90 | priv->status = ME_GWIBBER_SERVICE_STATUS_NOT_RUNNING; |
276 | 100 | priv->status = GWIBBER_SERVICE_STATUS_NOT_RUNNING; | 91 | priv->has_configured_accounts = FALSE; |
277 | 101 | priv->has_configured_accounts = FALSE; | 92 | |
278 | 102 | 93 | setup_service_proxies(self); | |
279 | 103 | DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); | 94 | return; |
280 | 104 | g_return_if_fail(bus != NULL); /* Can't do anymore DBus stuff without this, | 95 | } |
281 | 105 | all non-DBus stuff should be done */ | 96 | |
282 | 106 | 97 | static void | |
283 | 107 | GError * error = NULL; | 98 | me_gwibber_service_dispose (GObject *object) |
284 | 108 | 99 | { | |
285 | 109 | /* Set up the dbus Proxy */ | 100 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(object); |
286 | 110 | priv->dbus_proxy = dbus_g_proxy_new_for_name_owner (bus, | 101 | |
287 | 111 | DBUS_SERVICE_DBUS, | 102 | if (priv->me_gwibber_service != NULL) { |
288 | 112 | DBUS_PATH_DBUS, | 103 | g_object_unref(priv->me_gwibber_service); |
289 | 113 | DBUS_INTERFACE_DBUS, | 104 | priv->me_gwibber_service = NULL; |
290 | 114 | &error); | 105 | } |
291 | 115 | if (error != NULL) { | 106 | |
292 | 116 | g_warning("Unable to connect to DBus events: %s", error->message); | 107 | if (priv->me_gwibber_accounts != NULL) { |
293 | 117 | g_error_free(error); | 108 | g_object_unref(priv->me_gwibber_accounts); |
294 | 118 | return; | 109 | priv->me_gwibber_accounts = NULL; |
295 | 119 | } | 110 | } |
296 | 120 | 111 | ||
297 | 121 | /* Configure the name owner changing */ | 112 | G_OBJECT_CLASS (me_gwibber_service_parent_class)->dispose (object); |
298 | 122 | dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged", | 113 | return; |
299 | 123 | G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, | 114 | } |
300 | 124 | G_TYPE_INVALID); | 115 | |
301 | 125 | dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", | 116 | static void |
302 | 126 | G_CALLBACK(dbus_namechange), | 117 | me_gwibber_service_finalize (GObject *object) |
303 | 127 | self, NULL); | 118 | { |
304 | 128 | 119 | G_OBJECT_CLASS (me_gwibber_service_parent_class)->finalize (object); | |
305 | 129 | org_freedesktop_DBus_name_has_owner_async(priv->dbus_proxy, DBUS_SERVICE_ADDRESS, gwibber_exists_cb, self); | 120 | return; |
306 | 130 | 121 | } | |
307 | 131 | return; | 122 | |
308 | 132 | } | 123 | static gboolean |
309 | 133 | 124 | check_account_send_enabled (GHashTable * account_table) { | |
310 | 134 | static void | 125 | return g_value_get_boolean(g_hash_table_lookup(account_table, "send_enabled")); |
311 | 135 | gwibber_service_dispose (GObject *object) | 126 | } |
312 | 136 | { | 127 | |
313 | 137 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(object); | 128 | static void |
314 | 138 | 129 | query_account_manager (MeGwibberService *self) | |
315 | 139 | if (priv->dbus_proxy != NULL) { | 130 | { |
316 | 140 | g_object_unref(priv->dbus_proxy); | 131 | g_return_if_fail (IS_ME_GWIBBER_SERVICE (self)); |
317 | 141 | priv->dbus_proxy = NULL; | 132 | |
318 | 142 | } | 133 | gpointer accounts_table; |
319 | 143 | 134 | gpointer account_table; | |
320 | 144 | if (priv->service_proxy != NULL) { | 135 | GHashTableIter accounts_iter; |
321 | 145 | g_object_unref(priv->service_proxy); | 136 | gpointer account; |
322 | 146 | priv->service_proxy = NULL; | 137 | gboolean send_enabled; |
323 | 147 | } | 138 | |
324 | 148 | 139 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(self); | |
325 | 149 | if (priv->accounts_proxy != NULL) { | 140 | |
326 | 150 | g_object_unref(priv->accounts_proxy); | 141 | if (priv->me_gwibber_accounts == NULL) { |
327 | 151 | priv->accounts_proxy = NULL; | 142 | g_warning ("no accounts, can't query for accounts"); |
328 | 152 | } | 143 | return; |
329 | 153 | 144 | } | |
330 | 154 | G_OBJECT_CLASS (gwibber_service_parent_class)->dispose (object); | 145 | |
331 | 155 | return; | 146 | accounts_table = gwibber_accounts_list (priv->me_gwibber_accounts); |
332 | 156 | } | 147 | if (accounts_table == NULL) { |
333 | 157 | 148 | g_warning ("failed to get accounts list"); | |
334 | 158 | static void | 149 | return; |
335 | 159 | gwibber_service_finalize (GObject *object) | 150 | } |
336 | 160 | { | 151 | |
337 | 161 | G_OBJECT_CLASS (gwibber_service_parent_class)->finalize (object); | 152 | g_hash_table_iter_init (&accounts_iter, accounts_table); |
338 | 162 | return; | 153 | |
339 | 163 | } | 154 | priv->has_configured_accounts = FALSE; |
340 | 164 | 155 | ||
341 | 165 | 156 | while (g_hash_table_iter_next (&accounts_iter, &account, &account_table)) { | |
342 | 166 | /* Watch for Gwibber coming on and off the bus. */ | 157 | send_enabled = check_account_send_enabled (account_table); |
343 | 167 | static void | 158 | if (send_enabled) { |
344 | 168 | dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, GwibberService * self) | 159 | priv->has_configured_accounts = TRUE; |
345 | 169 | { | 160 | } |
346 | 170 | g_return_if_fail (IS_GWIBBER_SERVICE (self)); | 161 | } |
347 | 171 | 162 | ||
348 | 172 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(self); | 163 | g_signal_emit (G_OBJECT (self), |
349 | 173 | 164 | ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID, | |
211 | 174 | if (prev[0] == '\0' && g_strcmp0(name, DBUS_SERVICE_ADDRESS) == 0) { | ||
212 | 175 | g_debug("Gwibber Service coming online"); | ||
213 | 176 | priv->status = GWIBBER_SERVICE_STATUS_RUNNING; | ||
214 | 177 | if (priv->service_proxy == NULL || | ||
215 | 178 | priv->accounts_proxy == NULL) | ||
216 | 179 | setup_service_proxies (self); | ||
217 | 180 | query_account_manager (self); | ||
218 | 181 | } | ||
219 | 182 | |||
220 | 183 | if (new[0] == '\0' && g_strcmp0(name, DBUS_SERVICE_ADDRESS) == 0) { | ||
221 | 184 | g_debug("Gwibber Service going offline"); | ||
222 | 185 | priv->status = GWIBBER_SERVICE_STATUS_NOT_RUNNING; | ||
223 | 186 | g_signal_emit (G_OBJECT (self), GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID, 0, priv->status, TRUE); | ||
224 | 187 | if (priv->service_proxy != NULL) { | ||
225 | 188 | g_object_unref(priv->service_proxy); | ||
226 | 189 | priv->service_proxy = NULL; | ||
227 | 190 | } | ||
228 | 191 | if (priv->accounts_proxy != NULL) { | ||
229 | 192 | g_object_unref(priv->accounts_proxy); | ||
230 | 193 | priv->accounts_proxy = NULL; | ||
231 | 194 | } | ||
232 | 195 | } | ||
233 | 196 | |||
234 | 197 | return; | ||
235 | 198 | } | ||
236 | 199 | |||
237 | 200 | static void | ||
238 | 201 | get_accounts_response (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) | ||
239 | 202 | { | ||
240 | 203 | GError *error = NULL; | ||
241 | 204 | gchar *accounts_string = NULL; | ||
242 | 205 | |||
243 | 206 | dbus_g_proxy_end_call (proxy, call, &error, | ||
244 | 207 | G_TYPE_STRING, &accounts_string, | ||
245 | 208 | G_TYPE_INVALID); | ||
246 | 209 | |||
247 | 210 | if (error != NULL) { | ||
248 | 211 | g_warning ("GetAccounts: %s", error->message); | ||
249 | 212 | g_error_free (error); | ||
250 | 213 | g_free (accounts_string); | ||
251 | 214 | return; | ||
252 | 215 | } | ||
253 | 216 | |||
254 | 217 | /* don't print the accounts string, it contains passwords */ | ||
255 | 218 | /* g_debug ("GetAccounts: %s", accounts_string); */ | ||
256 | 219 | |||
257 | 220 | g_return_if_fail (IS_GWIBBER_SERVICE (data)); | ||
258 | 221 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(data); | ||
259 | 222 | g_return_if_fail (priv != NULL); | ||
260 | 223 | /* Note: not free'ing accounts_string here, but g_return_if_fail are | ||
261 | 224 | meant to catch design errors, not runtime ones */ | ||
262 | 225 | |||
263 | 226 | priv->status = GWIBBER_SERVICE_STATUS_RUNNING; | ||
264 | 227 | priv->has_configured_accounts = g_strrstr (accounts_string, " \"send_enabled\": true,") ? TRUE : FALSE; | ||
265 | 228 | |||
266 | 229 | /* trigger a status update */ | ||
267 | 230 | g_signal_emit (G_OBJECT (data), | ||
268 | 231 | GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID, | ||
350 | 232 | 0, priv->status, TRUE); | 165 | 0, priv->status, TRUE); |
351 | 233 | 166 | ||
354 | 234 | g_free (accounts_string); | 167 | g_hash_table_destroy(accounts_table); |
353 | 235 | |||
355 | 236 | return; | 168 | return; |
356 | 237 | } | 169 | } |
357 | 238 | 170 | ||
358 | 239 | static void | 171 | static void |
384 | 240 | query_account_manager (GwibberService *self) | 172 | accounts_changed (GwibberAccounts *me_gwibber_accounts, GHashTable *account_table, MeGwibberService *self) |
385 | 241 | { | 173 | { |
386 | 242 | g_return_if_fail (IS_GWIBBER_SERVICE (self)); | 174 | g_return_if_fail (IS_ME_GWIBBER_SERVICE (self)); |
362 | 243 | |||
363 | 244 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(self); | ||
364 | 245 | |||
365 | 246 | if (priv->service_proxy == NULL) { | ||
366 | 247 | g_warning ("no service_proxy, can't query for accounts"); | ||
367 | 248 | return; | ||
368 | 249 | } | ||
369 | 250 | |||
370 | 251 | dbus_g_proxy_begin_call(priv->service_proxy, | ||
371 | 252 | "GetAccounts", | ||
372 | 253 | get_accounts_response, | ||
373 | 254 | self, | ||
374 | 255 | NULL, | ||
375 | 256 | G_TYPE_INVALID); | ||
376 | 257 | } | ||
377 | 258 | |||
378 | 259 | static void | ||
379 | 260 | accounts_changed (DBusGProxy *proxy, const gchar *id, GwibberService *self) | ||
380 | 261 | { | ||
381 | 262 | g_return_if_fail (IS_GWIBBER_SERVICE (self)); | ||
382 | 263 | |||
383 | 264 | g_debug ("accounts_changed"); | ||
387 | 265 | 175 | ||
388 | 266 | query_account_manager (self); | 176 | query_account_manager (self); |
389 | 267 | 177 | ||
390 | 268 | return; | 178 | return; |
391 | 269 | } | 179 | } |
392 | 270 | 180 | ||
470 | 271 | static void | 181 | |
471 | 272 | setup_service_proxies (GwibberService *self) | 182 | static void |
472 | 273 | { | 183 | setup_service_proxies (MeGwibberService *self) |
473 | 274 | g_return_if_fail (IS_GWIBBER_SERVICE (self)); | 184 | { |
474 | 275 | 185 | g_return_if_fail (IS_ME_GWIBBER_SERVICE (self)); | |
475 | 276 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(self); | 186 | |
476 | 277 | 187 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(self); | |
477 | 278 | DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); | 188 | |
478 | 279 | g_return_if_fail(bus != NULL); /* Can't do anymore DBus stuff without this, | 189 | if (priv->me_gwibber_service == NULL) { |
479 | 280 | all non-DBus stuff should be done */ | 190 | priv->me_gwibber_service = gwibber_service_new (); |
480 | 281 | 191 | if (priv->me_gwibber_service == NULL) { | |
481 | 282 | if (priv->service_proxy == NULL) { | 192 | g_warning ("can't setup me_gwibber_service"); |
482 | 283 | priv->service_proxy = dbus_g_proxy_new_for_name( | 193 | return; |
483 | 284 | bus, | 194 | } |
484 | 285 | DBUS_SERVICE_ADDRESS, | 195 | } |
485 | 286 | DBUS_SERVICE_SERVICE_OBJECT, | 196 | |
486 | 287 | DBUS_SERVICE_SERVICE_INTERFACE); | 197 | g_signal_connect (priv->me_gwibber_service, "is-available", |
487 | 288 | if (priv->service_proxy == NULL) { | 198 | G_CALLBACK(me_gwibber_service_exists_cb), ME_GWIBBER_SERVICE (self)); |
488 | 289 | g_warning ("can't setup service_proxy"); | 199 | |
489 | 290 | return; | 200 | if (priv->me_gwibber_accounts == NULL) { |
490 | 291 | } | 201 | priv->me_gwibber_accounts = gwibber_accounts_new ();; |
491 | 292 | } | 202 | if (priv->me_gwibber_accounts == NULL) { |
492 | 293 | 203 | g_warning ("can't setup me_gwibber_accounts"); | |
493 | 294 | if (priv->accounts_proxy == NULL) { | 204 | return; |
494 | 295 | priv->accounts_proxy = | 205 | } |
495 | 296 | dbus_g_proxy_new_for_name(bus, | 206 | } |
496 | 297 | DBUS_SERVICE_ADDRESS, | 207 | |
497 | 298 | DBUS_SERVICE_ACCOUNTS_OBJECT, | 208 | g_signal_connect (priv->me_gwibber_accounts, "is-available", |
498 | 299 | DBUS_SERVICE_ACCOUNTS_INTERFACE); | 209 | G_CALLBACK(me_gwibber_accounts_exists_cb), ME_GWIBBER_SERVICE (self)); |
499 | 300 | if (priv->accounts_proxy == NULL) { | 210 | } |
500 | 301 | g_warning ("can't setup accounts_proxy"); | 211 | |
501 | 302 | return; | 212 | static void |
502 | 303 | } | 213 | me_gwibber_service_exists_cb (GwibberService * me_gwibber_service, gboolean exists, gpointer userdata) |
503 | 304 | } | 214 | { |
504 | 305 | 215 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(ME_GWIBBER_SERVICE (userdata)); | |
505 | 306 | /* Monitor signals about account changes */ | 216 | |
506 | 307 | dbus_g_proxy_add_signal(priv->accounts_proxy, "AccountChanged", | 217 | if (exists) { |
507 | 308 | G_TYPE_STRING, | 218 | priv->status = ME_GWIBBER_SERVICE_STATUS_RUNNING; |
508 | 309 | G_TYPE_INVALID); | 219 | } |
509 | 310 | dbus_g_proxy_connect_signal(priv->accounts_proxy, "AccountChanged", | 220 | |
510 | 311 | G_CALLBACK(accounts_changed), | 221 | |
511 | 312 | self, NULL); | 222 | if (!exists) { |
512 | 313 | dbus_g_proxy_add_signal(priv->accounts_proxy, "AccountDeleted", | 223 | priv->status = ME_GWIBBER_SERVICE_STATUS_NOT_RUNNING; |
513 | 314 | G_TYPE_STRING, | 224 | g_signal_emit (G_OBJECT (ME_GWIBBER_SERVICE (userdata)), ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID, 0, priv->status, TRUE); |
514 | 315 | G_TYPE_INVALID); | 225 | } |
515 | 316 | dbus_g_proxy_connect_signal(priv->accounts_proxy, "AccountDeleted", | 226 | return; |
516 | 317 | G_CALLBACK(accounts_changed), | 227 | } |
517 | 318 | self, NULL); | 228 | |
518 | 319 | 229 | static void | |
519 | 320 | } | 230 | me_gwibber_accounts_exists_cb (GwibberAccounts * me_gwibber_accounts, gboolean exists, gpointer userdata) |
520 | 321 | 231 | { | |
521 | 322 | static void | 232 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(ME_GWIBBER_SERVICE (userdata)); |
522 | 323 | gwibber_exists_cb (DBusGProxy * proxy, gboolean exists, GError * error, gpointer userdata) | 233 | |
523 | 324 | { | 234 | if (exists) { |
524 | 325 | if (error) { | 235 | if (priv->me_gwibber_accounts == NULL) { |
525 | 326 | g_warning ("Unable to check if Gwibber is running: %s", error->message); | 236 | priv->me_gwibber_accounts = gwibber_accounts_new ();; |
526 | 327 | return; | 237 | if (priv->me_gwibber_accounts == NULL) { |
527 | 328 | } | 238 | g_warning ("can't setup me_gwibber_accounts"); |
528 | 329 | 239 | return; | |
529 | 330 | if (exists) { | 240 | } |
530 | 331 | setup_service_proxies (GWIBBER_SERVICE (userdata)); | 241 | } |
531 | 332 | query_account_manager (GWIBBER_SERVICE (userdata)); | 242 | |
532 | 333 | } | 243 | query_account_manager (ME_GWIBBER_SERVICE (userdata)); |
533 | 334 | 244 | g_signal_emit (G_OBJECT (ME_GWIBBER_SERVICE (userdata)), ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID, 0, priv->status, TRUE); | |
534 | 335 | return; | 245 | g_signal_connect (priv->me_gwibber_accounts, "account-updated", |
535 | 336 | } | 246 | G_CALLBACK(accounts_changed), ME_GWIBBER_SERVICE (userdata)); |
536 | 337 | 247 | } | |
537 | 338 | GwibberService * gwibber_service_new (void){ | 248 | return; |
538 | 339 | return GWIBBER_SERVICE (g_object_new (GWIBBER_SERVICE_TYPE, NULL)); | 249 | } |
539 | 340 | } | 250 | |
540 | 341 | 251 | ||
541 | 342 | static void | 252 | MeGwibberService * me_gwibber_service_new (void){ |
542 | 343 | send_message_response (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) | 253 | return ME_GWIBBER_SERVICE (g_object_new (ME_GWIBBER_SERVICE_TYPE, NULL)); |
466 | 344 | { | ||
467 | 345 | g_debug ("send_message_response"); | ||
468 | 346 | |||
469 | 347 | return; | ||
543 | 348 | } | 254 | } |
544 | 349 | 255 | ||
545 | 350 | void | 256 | void |
547 | 351 | gwibber_service_send (GwibberService *self, const gchar *msg) | 257 | me_gwibber_service_send (MeGwibberService *self, const gchar *msg) |
548 | 352 | { | 258 | { |
550 | 353 | g_return_if_fail (IS_GWIBBER_SERVICE (self)); | 259 | g_return_if_fail (IS_ME_GWIBBER_SERVICE (self)); |
551 | 354 | 260 | ||
553 | 355 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(self); | 261 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(self); |
554 | 356 | 262 | ||
555 | 357 | GValue value = {0}; | 263 | GValue value = {0}; |
556 | 358 | g_value_init(&value, G_TYPE_STRING); | 264 | g_value_init(&value, G_TYPE_STRING); |
557 | 359 | g_value_set_string(&value, msg); | 265 | g_value_set_string(&value, msg); |
558 | 360 | 266 | ||
562 | 361 | g_debug ("gwibber_send: %s\n", msg); | 267 | if (priv->me_gwibber_service == NULL) { |
560 | 362 | |||
561 | 363 | if (priv->service_proxy == NULL) { | ||
563 | 364 | setup_service_proxies (self); | 268 | setup_service_proxies (self); |
566 | 365 | if (priv->service_proxy == NULL) { | 269 | if (priv->me_gwibber_service == NULL) { |
567 | 366 | g_warning ("can't setup service_proxy"); | 270 | g_warning ("can't setup me_gwibber_service"); |
568 | 367 | return; | 271 | return; |
569 | 368 | } | 272 | } |
570 | 369 | } | 273 | } |
571 | 370 | 274 | ||
580 | 371 | dbus_g_proxy_begin_call(priv->service_proxy, | 275 | gwibber_service_send_message (priv->me_gwibber_service, g_value_get_string (&value)); |
573 | 372 | "SendMessage", | ||
574 | 373 | send_message_response, | ||
575 | 374 | NULL, | ||
576 | 375 | NULL, | ||
577 | 376 | G_TYPE_VALUE, | ||
578 | 377 | &value, | ||
579 | 378 | G_TYPE_INVALID); | ||
581 | 379 | 276 | ||
582 | 380 | g_value_unset(&value); | 277 | g_value_unset(&value); |
583 | 381 | 278 | ||
584 | 382 | return; | 279 | return; |
585 | 383 | } | 280 | } |
586 | 384 | 281 | ||
589 | 385 | GwibberService * | 282 | MeGwibberService * |
590 | 386 | gwibber_service_get (void) | 283 | me_gwibber_service_get (void) |
591 | 387 | { | 284 | { |
593 | 388 | static GwibberService *singleton = NULL; | 285 | static MeGwibberService *singleton = NULL; |
594 | 389 | 286 | ||
595 | 390 | if (! singleton) { | 287 | if (! singleton) { |
597 | 391 | singleton = gwibber_service_new (); | 288 | singleton = me_gwibber_service_new (); |
598 | 392 | } | 289 | } |
599 | 393 | 290 | ||
600 | 394 | return singleton; | 291 | return singleton; |
601 | 395 | } | 292 | } |
602 | 396 | 293 | ||
603 | 397 | gboolean | 294 | gboolean |
605 | 398 | gwibber_service_has_configured_accounts (GwibberService *self) | 295 | me_gwibber_service_has_configured_accounts (MeGwibberService *self) |
606 | 399 | { | 296 | { |
608 | 400 | g_return_val_if_fail (IS_GWIBBER_SERVICE (self), FALSE); | 297 | g_return_val_if_fail (IS_ME_GWIBBER_SERVICE (self), FALSE); |
609 | 401 | 298 | ||
611 | 402 | GwibberServicePrivate * priv = GWIBBER_SERVICE_GET_PRIVATE(self); | 299 | MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(self); |
612 | 403 | 300 | ||
613 | 404 | return priv->has_configured_accounts; | 301 | return priv->has_configured_accounts; |
614 | 405 | } | 302 | } |
615 | 406 | 303 | ||
616 | === modified file 'src/me-service-gwibber.h' | |||
617 | --- src/me-service-gwibber.h 2010-03-17 16:19:44 +0000 | |||
618 | +++ src/me-service-gwibber.h 2010-08-17 14:44:43 +0000 | |||
619 | @@ -20,57 +20,56 @@ | |||
620 | 20 | with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | with this program. If not, see <http://www.gnu.org/licenses/>. |
621 | 21 | */ | 21 | */ |
622 | 22 | 22 | ||
625 | 23 | #ifndef __GWIBBER_SERVICE_H__ | 23 | #ifndef __ME_GWIBBER_SERVICE_H__ |
626 | 24 | #define __GWIBBER_SERVICE_H__ | 24 | #define __ME_GWIBBER_SERVICE_H__ |
627 | 25 | 25 | ||
628 | 26 | #include <glib.h> | 26 | #include <glib.h> |
629 | 27 | #include <glib-object.h> | 27 | #include <glib-object.h> |
630 | 28 | 28 | ||
631 | 29 | #include <gwibber.h> | ||
632 | 30 | |||
633 | 29 | G_BEGIN_DECLS | 31 | G_BEGIN_DECLS |
634 | 30 | 32 | ||
641 | 31 | #define GWIBBER_SERVICE_TYPE (gwibber_service_get_type ()) | 33 | #define ME_GWIBBER_SERVICE_TYPE (me_gwibber_service_get_type ()) |
642 | 32 | #define GWIBBER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GWIBBER_SERVICE_TYPE, GwibberService)) | 34 | #define ME_GWIBBER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ME_GWIBBER_SERVICE_TYPE, MeGwibberService)) |
643 | 33 | #define GWIBBER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GWIBBER_SERVICE_TYPE, GwibberServiceClass)) | 35 | #define ME_GWIBBER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ME_GWIBBER_SERVICE_TYPE, MeGwibberServiceClass)) |
644 | 34 | #define IS_GWIBBER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GWIBBER_SERVICE_TYPE)) | 36 | #define IS_ME_GWIBBER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ME_GWIBBER_SERVICE_TYPE)) |
645 | 35 | #define IS_GWIBBER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GWIBBER_SERVICE_TYPE)) | 37 | #define IS_ME_GWIBBER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ME_GWIBBER_SERVICE_TYPE)) |
646 | 36 | #define GWIBBER_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GWIBBER_SERVICE_TYPE, GwibberServiceClass)) | 38 | #define ME_GWIBBER_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ME_GWIBBER_SERVICE_TYPE, MeGwibberServiceClass)) |
647 | 37 | 39 | ||
648 | 38 | typedef enum | 40 | typedef enum |
649 | 39 | { | 41 | { |
655 | 40 | GWIBBER_SERVICE_STATUS_NOT_RUNNING, | 42 | ME_GWIBBER_SERVICE_STATUS_NOT_RUNNING, |
656 | 41 | /* GWIBBER_SERVICE_STATUS_LOADING_STARTED, | 43 | /* ME_GWIBBER_SERVICE_STATUS_LOADING_STARTED, |
657 | 42 | GWIBBER_SERVICE_STATUS_LOADING_COMPLETE, */ | 44 | ME_GWIBBER_SERVICE_STATUS_LOADING_COMPLETE, */ |
658 | 43 | GWIBBER_SERVICE_STATUS_RUNNING, | 45 | ME_GWIBBER_SERVICE_STATUS_RUNNING, |
659 | 44 | GWIBBER_SERVICE_STATUS_LAST | 46 | ME_GWIBBER_SERVICE_STATUS_LAST |
660 | 45 | } | 47 | } |
668 | 46 | GwibberServiceStatus; | 48 | MeGwibberServiceStatus; |
669 | 47 | 49 | ||
670 | 48 | #define GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED "status-changed" | 50 | #define ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED "status-changed" |
671 | 49 | #define GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID (g_signal_lookup(GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED, GWIBBER_SERVICE_TYPE)) | 51 | #define ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID (g_signal_lookup(ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED, ME_GWIBBER_SERVICE_TYPE)) |
672 | 50 | 52 | ||
673 | 51 | typedef struct _GwibberServiceClass GwibberServiceClass; | 53 | typedef struct _MeGwibberServiceClass MeGwibberServiceClass; |
674 | 52 | struct _GwibberServiceClass { | 54 | struct _MeGwibberServiceClass { |
675 | 53 | GObjectClass parent_class; | 55 | GObjectClass parent_class; |
676 | 54 | 56 | ||
677 | 55 | /* Signals */ | 57 | /* Signals */ |
679 | 56 | void (*status_changed) (GwibberServiceStatus newstatus); | 58 | void (*status_changed) (MeGwibberServiceStatus newstatus); |
680 | 57 | }; | 59 | }; |
681 | 58 | 60 | ||
684 | 59 | typedef struct _GwibberService GwibberService; | 61 | typedef struct _MeGwibberService MeGwibberService; |
685 | 60 | struct _GwibberService { | 62 | struct _MeGwibberService { |
686 | 61 | GObject parent; | 63 | GObject parent; |
687 | 62 | }; | 64 | }; |
688 | 63 | 65 | ||
697 | 64 | GType gwibber_service_get_type (void) G_GNUC_CONST; | 66 | GType me_gwibber_service_get_type (void) G_GNUC_CONST; |
698 | 65 | GwibberService * gwibber_service_new (void); | 67 | MeGwibberService * me_gwibber_service_new (void); |
699 | 66 | GwibberService * gwibber_service_get (void); | 68 | MeGwibberService * me_gwibber_service_get (void); |
700 | 67 | void gwibber_service_send (GwibberService *self, const gchar *msg); | 69 | void me_gwibber_service_send (MeGwibberService *self, const gchar *msg); |
701 | 68 | gboolean gwibber_service_has_configured_accounts (GwibberService *self); | 70 | gboolean me_gwibber_service_has_configured_accounts (MeGwibberService *self); |
694 | 69 | |||
695 | 70 | /* old API */ | ||
696 | 71 | void gwibber_send (const gchar *msg); | ||
702 | 72 | 71 | ||
703 | 73 | G_END_DECLS | 72 | G_END_DECLS |
704 | 74 | 73 | ||
706 | 75 | #endif /* __GWIBBER_SERVICE_H__ */ | 74 | #endif /* __ME_GWIBBER_SERVICE_H__ */ |
707 | 76 | 75 | ||
708 | 77 | 76 | ||
709 | === modified file 'src/me-service.c' | |||
710 | --- src/me-service.c 2010-03-25 20:25:31 +0000 | |||
711 | +++ src/me-service.c 2010-08-17 14:44:43 +0000 | |||
712 | @@ -81,7 +81,7 @@ | |||
713 | 81 | /* STATUS_PROVIDER_STATUS_DISCONNECTED */"user-offline" | 81 | /* STATUS_PROVIDER_STATUS_DISCONNECTED */"user-offline" |
714 | 82 | }; | 82 | }; |
715 | 83 | 83 | ||
717 | 84 | static GwibberService * gwibber = NULL; | 84 | static MeGwibberService * me_gwibber_service = NULL; |
718 | 85 | 85 | ||
719 | 86 | static DbusmenuMenuitem * root_menuitem = NULL; | 86 | static DbusmenuMenuitem * root_menuitem = NULL; |
720 | 87 | static DbusmenuMenuitem * status_menuitems[STATUS_PROVIDER_STATUS_LAST] = {0}; | 87 | static DbusmenuMenuitem * status_menuitems[STATUS_PROVIDER_STATUS_LAST] = {0}; |
721 | @@ -170,7 +170,7 @@ | |||
722 | 170 | } | 170 | } |
723 | 171 | 171 | ||
724 | 172 | static void | 172 | static void |
726 | 173 | gwibber_status_update (GwibberService *instance, GwibberServiceStatus status, gpointer data) { | 173 | me_gwibber_status_update (MeGwibberService *instance, MeGwibberServiceStatus status, gpointer data) { |
727 | 174 | g_return_if_fail (instance != NULL); | 174 | g_return_if_fail (instance != NULL); |
728 | 175 | 175 | ||
729 | 176 | g_debug ("gwibber service status changed to: %d", status); | 176 | g_debug ("gwibber service status changed to: %d", status); |
730 | @@ -180,7 +180,7 @@ | |||
731 | 180 | return; | 180 | return; |
732 | 181 | } | 181 | } |
733 | 182 | 182 | ||
735 | 183 | if (! gwibber_service_has_configured_accounts (instance)) { | 183 | if (! me_gwibber_service_has_configured_accounts (instance)) { |
736 | 184 | g_debug ("no configured accounts detected, so hiding the broadcast field"); | 184 | g_debug ("no configured accounts detected, so hiding the broadcast field"); |
737 | 185 | dbusmenu_menuitem_property_set_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); | 185 | dbusmenu_menuitem_property_set_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); |
738 | 186 | return; | 186 | return; |
739 | @@ -189,16 +189,6 @@ | |||
740 | 189 | if (! dbusmenu_menuitem_property_get_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_VISIBLE)) | 189 | if (! dbusmenu_menuitem_property_get_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_VISIBLE)) |
741 | 190 | dbusmenu_menuitem_property_set_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); | 190 | dbusmenu_menuitem_property_set_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); |
742 | 191 | 191 | ||
743 | 192 | #if 0 | ||
744 | 193 | if (status == GWIBBER_SERVICE_STATUS_RUNNING) { | ||
745 | 194 | g_debug ("enabling the broadcast field"); | ||
746 | 195 | dbusmenu_menuitem_property_set_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); | ||
747 | 196 | } else { | ||
748 | 197 | g_debug ("disabling the broadcast field"); | ||
749 | 198 | dbusmenu_menuitem_property_set_bool (broadcast_field, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); | ||
750 | 199 | } | ||
751 | 200 | #endif | ||
752 | 201 | |||
753 | 202 | return; | 192 | return; |
754 | 203 | } | 193 | } |
755 | 204 | 194 | ||
756 | @@ -287,9 +277,9 @@ | |||
757 | 287 | 277 | ||
758 | 288 | status_update(); | 278 | status_update(); |
759 | 289 | 279 | ||
763 | 290 | gwibber = gwibber_service_new (); | 280 | me_gwibber_service = me_gwibber_service_get (); |
764 | 291 | if (gwibber != NULL) { | 281 | if (me_gwibber_service != NULL) { |
765 | 292 | g_signal_connect (G_OBJECT (gwibber), GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED, G_CALLBACK (gwibber_status_update), NULL); | 282 | g_signal_connect (G_OBJECT (me_gwibber_service), ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED, G_CALLBACK (me_gwibber_status_update), NULL); |
766 | 293 | } | 283 | } |
767 | 294 | 284 | ||
768 | 295 | return FALSE; | 285 | return FALSE; |
Sounds good to me and works well on my test build. There are a few changes required though:
Line 343: the test for priv->send_enabled should probably be removed, ie toggling the boolean to true on each loop iteration; what matters is the end result
Line 350: the STATUS_RUNNING flag should be set in all cases, as a reply from gwibber implies that it is available for sending messages; the state name is a bit misleading though, it should be more about gwibber being "available" as a gateway service, but I chose running to make the distinction with the "availability" status of other online/chat services
Line 545: not sure about the void if (!exists), i don't think there is anything particular to do in this case either
Line 625: has_configured_ accounts should return a positive value even if the service is temporarily down, ie a send would restart it anyway; i found it difficult to understand as a user that the entry is "sometimes" not there, for no apparent reason; it's better to have it always there, whatever the state of the service; the visibility criteria is only that gwibber is "configured".