[gnome-settings-daemon] updates: if the user opens the update viewer then hide the 'You have updates' notification
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] updates: if the user opens the update viewer then hide the 'You have updates' notification
- Date: Thu, 17 Feb 2011 10:12:42 +0000 (UTC)
commit d0b2f9d7dce1d64f6a240303c4c1c2a3327b25f9
Author: Richard Hughes <richard hughsie com>
Date: Thu Feb 17 10:12:09 2011 +0000
updates: if the user opens the update viewer then hide the 'You have updates' notification
plugins/updates/gsd-updates-manager.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c
index 3fff598..0d1905a 100644
--- a/plugins/updates/gsd-updates-manager.c
+++ b/plugins/updates/gsd-updates-manager.c
@@ -52,6 +52,7 @@ struct GsdUpdatesManagerPrivate
PkTask *task;
guint inhibit_cookie;
GDBusProxy *proxy_session;
+ guint update_viewer_watcher_id;
};
static void gsd_updates_manager_class_init (GsdUpdatesManagerClass *klass);
@@ -992,6 +993,22 @@ notify_locked_cb (PkControl *control,
}
}
+static void
+update_viewer_appeared_cb (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
+{
+ GsdUpdatesManager *manager = GSD_UPDATES_MANAGER (user_data);
+
+ /* close any existing notification */
+ if (manager->priv->notification_updates_available != NULL) {
+ g_debug ("update viewer on the bus, clearing bubble");
+ notify_notification_close (manager->priv->notification_updates_available, NULL);
+ manager->priv->notification_updates_available = NULL;
+ }
+}
+
gboolean
gsd_updates_manager_start (GsdUpdatesManager *manager,
GError **error)
@@ -1052,6 +1069,16 @@ gsd_updates_manager_start (GsdUpdatesManager *manager,
if (manager->priv->proxy_session == NULL)
goto out;
+ /* if the update viewer is started, then hide the notification */
+ manager->priv->update_viewer_watcher_id =
+ g_bus_watch_name (G_BUS_TYPE_SESSION,
+ "org.freedesktop.PackageKit.UpdateViewer",
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ update_viewer_appeared_cb,
+ NULL,
+ manager,
+ NULL);
+
/* coldplug */
reload_proxy_settings (manager);
set_install_root (manager);
@@ -1104,6 +1131,10 @@ gsd_updates_manager_stop (GsdUpdatesManager *manager)
g_object_unref (manager->priv->cancellable);
manager->priv->cancellable = NULL;
}
+ if (manager->priv->update_viewer_watcher_id != 0) {
+ g_bus_unwatch_name (manager->priv->update_viewer_watcher_id);
+ manager->priv->update_viewer_watcher_id = 0;
+ }
if (manager->priv->timeout) {
g_source_remove (manager->priv->timeout);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]