[gnome-packagekit] Reduce in weight X-GNOME-Autostart-Phase desktop files



commit 27786f5639d721d955e70f6b47ee57df55a7d759
Author: Richard Hughes <richard hughsie com>
Date:   Tue Aug 18 12:11:11 2009 +0100

    Reduce in weight X-GNOME-Autostart-Phase desktop files

 src/gpk-desktop.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/gpk-desktop.c b/src/gpk-desktop.c
index 81ee46c..4762fc2 100644
--- a/src/gpk-desktop.c
+++ b/src/gpk-desktop.c
@@ -218,6 +218,11 @@ gpk_desktop_get_file_weight (const gchar *filename)
 		weight += 30;
 	g_free (value);
 
+	/* has autostart phase */
+	value = g_key_file_get_string (file, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Autostart-Phase", NULL);
+	if (value != NULL)
+		weight -= 30;
+	g_free (value);
 out:
 	g_key_file_free (file);
 	return weight;
@@ -233,9 +238,9 @@ gpk_desktop_guess_best_file (PkDesktop *desktop, const gchar *package)
 	const gchar *filename;
 	gchar *best_file = NULL;
 	guint i;
-	guint max = G_MININT;
-	guint max_index = 0;
+	gint max = G_MININT;
 	gint weight;
+	guint max_index = 0;
 
 	array = pk_desktop_get_files_for_package (desktop, package, NULL);
 	if (array == NULL)
@@ -254,6 +259,10 @@ gpk_desktop_guess_best_file (PkDesktop *desktop, const gchar *package)
 		}
 	}
 
+	/* nothing was processed */
+	if (max == G_MININT)
+		goto out;
+
 	/* we've got a best */
 	best_file = g_strdup (g_ptr_array_index (array, max_index));
 	egg_debug ("using %s", best_file);



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