From 624b6e5dd7bd32fc3f57b8c423c52f0d6738d0a7 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Tue, 18 Sep 2012 16:10:15 +0200 Subject: libmessaging-menu: don't call SetStatus(OFFLINE) for all apps Only notify the service about status if the application has actually called messaging_menu_app_set_status. This saves a d-bus call per non-chat application and - more importantly - doesn't make the messaging menu go into "unknown status" mode when one application is reporting 'online' status. --- libmessaging-menu/messaging-menu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libmessaging-menu') diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index 8066b35..fe2583b 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -102,6 +102,7 @@ struct _MessagingMenuApp GDesktopAppInfo *appinfo; int registered; /* -1 for unknown */ MessagingMenuStatus status; + gboolean status_set; GSimpleActionGroup *source_actions; GMenu *menu; @@ -370,7 +371,8 @@ created_messages_service (GObject *source_object, messaging_menu_app_register (app); else if (app->registered == FALSE) messaging_menu_app_unregister (app); - messaging_menu_app_set_status (app, app->status); + if (app->status_set) + messaging_menu_app_set_status (app, app->status); } static void @@ -410,7 +412,7 @@ static void messaging_menu_app_init (MessagingMenuApp *app) { app->registered = -1; - app->status = MESSAGING_MENU_STATUS_OFFLINE; + app->status_set = FALSE; app->cancellable = g_cancellable_new (); @@ -538,6 +540,7 @@ messaging_menu_app_set_status (MessagingMenuApp *app, status <= MESSAGING_MENU_STATUS_OFFLINE); app->status = status; + app->status_set = TRUE; /* state will be synced right after connecting to the service */ if (!app->messages_service) -- cgit v1.2.3