[gnome-packagekit] Don't spin in a loop in the updater when results come quicker than we expect



commit 0b0b8c64358ca88ac267552f6bf4d6fdc8995fb3
Author: Richard Hughes <richard hughsie com>
Date:   Thu Dec 15 15:50:45 2011 +0000

    Don't spin in a loop in the updater when results come quicker than we expect
    
    I think this is a side effect of switching to GDBus, although it's still a valid bug.

 src/gpk-update-viewer.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 0a234ba..b33ea54 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -746,14 +746,15 @@ gpk_update_view_get_info_headers (PkInfoEnum info)
 static void
 gpk_update_viewer_get_parent_for_info (PkInfoEnum info, GtkTreeIter *parent)
 {
-	GtkTreeView *treeview;
-	GtkTreeModel *model;
-	GtkTreeIter iter;
+	gboolean is_package;
+	gboolean ret = FALSE;
 	gboolean valid;
 	gchar *package_id_tmp;
-	gboolean ret = FALSE;
-	PkInfoEnum info_tmp;
 	gchar *title;
+	GtkTreeIter iter;
+	GtkTreeModel *model;
+	GtkTreeView *treeview;
+	PkInfoEnum info_tmp;
 
 	treeview = GTK_TREE_VIEW(gtk_builder_get_object (builder, "treeview_updates"));
 	model = gtk_tree_view_get_model (treeview);
@@ -777,14 +778,11 @@ gpk_update_viewer_get_parent_for_info (PkInfoEnum info, GtkTreeIter *parent)
 				    GPK_UPDATES_COLUMN_INFO, &info_tmp,
 				    GPK_UPDATES_COLUMN_ID, &package_id_tmp,
 				    -1);
-
-		if (package_id_tmp != NULL) {
-			g_free (package_id_tmp);
-			continue;
-		}
+		is_package = package_id_tmp != NULL;
+		g_free (package_id_tmp);
 
 		/* right section? */
-		if (info_tmp == info) {
+		if (!is_package && info_tmp == info) {
 			*parent = iter;
 			ret = TRUE;
 			break;



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