[gnome-packagekit/glib2-merge-candidate] trivial: ignore updates-changed if the update-system method is still running



commit b935b5c47b228de26aa783e3320cbd39c585f490
Author: Richard Hughes <richard hughsie com>
Date:   Wed Oct 7 13:34:34 2009 +0100

    trivial: ignore updates-changed if the update-system method is still running

 src/gpk-update-viewer.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index b3803e6..034a4c5 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -74,6 +74,7 @@ static GConfClient *gconf_client = NULL;
 static gchar **install_package_ids = NULL;
 static EggConsoleKit *console = NULL;
 static GCancellable *cancellable = NULL;
+static gboolean ignore_updates_changed = FALSE;
 
 enum {
 	GPK_UPDATES_COLUMN_TEXT,
@@ -474,6 +475,9 @@ gpk_update_viewer_update_packages_cb (PkTask *_task, GAsyncResult *res, GMainLoo
 	/* quit after we successfully updated */
 	g_main_loop_quit (loop);
 out:
+	/* no longer updating */
+	ignore_updates_changed = FALSE;
+
 	if (error_item != NULL)
 		pk_item_error_code_unref (error_item);
 	if (array != NULL)
@@ -945,6 +949,9 @@ gpk_update_viewer_button_install_cb (GtkWidget *widget, gpointer data)
 				       (GAsyncReadyCallback) gpk_update_viewer_update_packages_cb, loop);
 	g_strfreev (package_ids);
 
+	/* from now on ignore updates-changed signals */
+	ignore_updates_changed = TRUE;
+
 	/* get rid of the array, and free the contents */
 	if (array != NULL)
 		g_ptr_array_unref (array);
@@ -2318,6 +2325,10 @@ gpk_update_viewer_updates_changed_cb (PkControl *_control, gpointer data)
 {
 	/* now try to get newest update array */
 	egg_debug ("updates changed");
+	if (ignore_updates_changed) {
+		egg_debug ("ignoring");
+		return;
+	}
 	gpk_update_viewer_get_new_update_array ();
 }
 



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