[gnome-packagekit] Don't unconditionally force on NEWEST filtering in the update viewer



commit 9c97e452a9f69121e0dc14d0c924c727684f77f2
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jul 10 15:40:24 2009 +0100

    Don't unconditionally force on NEWEST filtering in the update viewer

 data/gnome-packagekit.schemas.in |   12 ++++++++++++
 src/gpk-common.h                 |    1 +
 src/gpk-update-viewer.c          |   10 +++++++++-
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/data/gnome-packagekit.schemas.in b/data/gnome-packagekit.schemas.in
index 60f9bce..76c0c66 100644
--- a/data/gnome-packagekit.schemas.in
+++ b/data/gnome-packagekit.schemas.in
@@ -428,6 +428,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-packagekit/update-viewer/only_newest</key>
+      <applyto>/apps/gnome-packagekit/update-viewer/only_newest</applyto>
+      <owner>gnome-packagekit</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Only show the newest updates in the list</short>
+        <long>Only show the newest packages in the update list, and filter out older updates that are still available.</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-packagekit/enable_font_helper</key>
       <applyto>/apps/gnome-packagekit/enable_font_helper</applyto>
       <owner>gnome-packagekit</owner>
diff --git a/src/gpk-common.h b/src/gpk-common.h
index 37b636e..107e1a0 100644
--- a/src/gpk-common.h
+++ b/src/gpk-common.h
@@ -71,6 +71,7 @@ G_BEGIN_DECLS
 #define GPK_CONF_APPLICATION_CATEGORY_GROUPS	"/apps/gnome-packagekit/application/category_groups"
 #define GPK_CONF_APPLICATION_SEARCH_MODE	"/apps/gnome-packagekit/application/search_mode"
 #define GPK_CONF_UPDATE_VIEWER_MOBILE_BBAND	"/apps/gnome-packagekit/update-viewer/notify_mobile_connection"
+#define GPK_CONF_UPDATE_VIEWER_ONLY_NEWEST	"/apps/gnome-packagekit/update-viewer/only_newest"
 
 #define GPK_BUGZILLA_URL			"https://bugs.freedesktop.org/";
 
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index a1f8117..27d61de 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -2333,6 +2333,7 @@ gpk_update_viewer_get_new_update_list (void)
 	GError *error = NULL;
 	GtkWidget *widget;
 	gchar *text = NULL;
+	PkBitfield filter = PK_FILTER_ENUM_NONE;
 
 	/* clear all widgets */
 	gtk_list_store_clear (list_store_updates);
@@ -2351,8 +2352,15 @@ gpk_update_viewer_get_new_update_list (void)
 		goto out;
 	}
 
+	/* only show newest updates? */
+	ret = gconf_client_get_bool (gconf_client, GPK_CONF_UPDATE_VIEWER_ONLY_NEWEST, NULL);
+	if (ret) {
+		egg_warning ("only showing newest updates");
+		filter = pk_bitfield_from_enums (PK_FILTER_ENUM_NEWEST, -1);
+	}
+
 	/* get new list */
-	ret = pk_client_get_updates (client_primary, pk_bitfield_from_enums (PK_FILTER_ENUM_NEWEST, -1), &error);
+	ret = pk_client_get_updates (client_primary, filter, &error);
 	if (!ret) {
 		egg_warning ("Failed to get updates: %s", error->message);
 		g_error_free (error);



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