[gnome-software/gnome-3-10] Clear the offline update once the updates have been shown



commit bb60ee04ea11a2d65ff81587f56074541cc74f3d
Author: Richard Hughes <richard hughsie com>
Date:   Mon Nov 25 15:20:20 2013 +0000

    Clear the offline update once the updates have been shown

 src/Makefile.am        |    1 +
 src/gs-shell-updates.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index c15890e..f3daec2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,7 @@ AM_CPPFLAGS =                                           \
        $(NOTIFY_CFLAGS)                                \
        -DG_LOG_DOMAIN=\"Gs\"                           \
        -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE  \
+       -DLIBEXECDIR=\"$(libexecdir)\"                  \
        -DLIBDIR=\"$(libdir)\"                          \
        -DBINDIR=\"$(bindir)\"                          \
        -DDATADIR=\"$(datadir)\"                        \
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 64c48d2..868ad15 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -63,6 +63,40 @@ gs_shell_updates_invalidate (GsShellUpdates *shell_updates)
        shell_updates->priv->cache_valid = FALSE;
 }
 
+static void
+child_exit_cb (GPid pid, gint status, gpointer user_data)
+{
+       g_spawn_close_pid (pid);
+}
+
+static void
+clear_offline_updates_message (void)
+{
+       gboolean ret;
+       GError *error = NULL;
+       const gchar *argv[3];
+       GPid pid;
+
+       argv[0] = "pkexec";
+       argv[1] = LIBEXECDIR "/pk-clear-offline-update";
+       argv[2] = NULL;
+       ret = g_spawn_async (NULL,
+                            (gchar **) argv,
+                            NULL,
+                            G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
+                            NULL,
+                            NULL,
+                            &pid,
+                            &error);
+       if (!ret) {
+               g_warning ("Failure clearing offline update message: %s",
+                          error->message);
+               g_error_free (error);
+               return;
+       }
+       g_child_watch_add (pid, child_exit_cb, NULL);
+}
+
 /**
  * gs_shell_updates_get_updates_cb:
  **/
@@ -137,6 +171,8 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
                gtk_widget_show (widget);
        }
 
+       /* clear the offline update success file */
+       clear_offline_updates_message ();
 out:
        if (list != NULL)
                gs_plugin_list_free (list);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]