File gnome-packagekit-bnc479107-optional.patch of Package gnome-packagekit

Index: gnome-packagekit-0.3.11/src/gpk-check-update.c
===================================================================
--- gnome-packagekit-0.3.11.orig/src/gpk-check-update.c
+++ gnome-packagekit-0.3.11/src/gpk-check-update.c
@@ -74,6 +74,7 @@ struct GpkCheckUpdatePrivate
 	gboolean		 cache_okay;
 	gboolean		 cache_update_in_progress;
 	gboolean		 get_updates_in_progress;
+	gboolean		 only_optional_updates_available;
 	guint			 number_updates_critical_last_shown;
 	NotifyNotification	*notification_updates_available;
 	GPtrArray		*important_updates_array;
@@ -364,6 +365,8 @@ gpk_check_update_activate_update_cb (Gtk
 
 	/* TRANSLATORS: context menu to update any pending updates */
 	item = gtk_image_menu_item_new_with_mnemonic (_("_Update System Now"));
+	if (icon->priv->only_optional_updates_available)
+		gtk_widget_set_sensitive (item, FALSE);
 	image = gtk_image_new_from_icon_name (GPK_ICON_SOFTWARE_UPDATE_AVAILABLE, GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
 	g_signal_connect (G_OBJECT (item), "activate",
@@ -704,6 +707,7 @@ gpk_check_update_query_updates (GpkCheck
 	}
 
 	/* sort by name */
+	cupdate->priv->only_optional_updates_available = FALSE;
 	pk_package_list_sort (list);
 
 	/* filter out the same package with multiple architectures */
@@ -727,8 +731,11 @@ gpk_check_update_query_updates (GpkCheck
 	}
 
 	/* find the security updates */
+ 	cupdate->priv->only_optional_updates_available = TRUE;
 	for (i=0; i<length; i++) {
 		obj = pk_package_list_get_obj (list, i);
+		if (obj->info != PK_INFO_ENUM_LOW)
+			cupdate->priv->only_optional_updates_available = FALSE;
 		if (obj->info == PK_INFO_ENUM_SECURITY) {
 			/* add to array */
 			package_id = pk_package_id_to_string (obj->id);
@@ -1081,6 +1088,7 @@ gpk_check_update_init (GpkCheckUpdate *c
 	cupdate->priv->cache_okay = FALSE;
 	cupdate->priv->cache_update_in_progress = FALSE;
 	cupdate->priv->get_updates_in_progress = FALSE;
+	cupdate->priv->only_optional_updates_available = FALSE;
 }
 
 /**
Index: gnome-packagekit-0.3.11/src/gpk-update-viewer.c
===================================================================
--- gnome-packagekit-0.3.11.orig/src/gpk-update-viewer.c
+++ gnome-packagekit-0.3.11/src/gpk-update-viewer.c
@@ -562,6 +562,11 @@ gpk_update_viewer_populate_preview (PkPa
 		/* set visible and sensitive */
 		widget = glade_xml_get_widget (glade_xml, "button_review");
 		gtk_widget_set_sensitive (widget, TRUE);
+		/*if there are only optional updates dont allow blind system update - bnc#479107 */
+		if (length == num_low) {
+			widget = glade_xml_get_widget (glade_xml, "button_update_system");
+			gtk_widget_set_sensitive (widget, FALSE);
+		}
 		polkit_gnome_action_set_sensitive (update_system_action, TRUE);
 		polkit_gnome_action_set_sensitive (update_packages_action, TRUE);
 	}
@@ -624,7 +629,7 @@ gpk_update_viewer_get_new_update_list (v
 	gchar *package_id;
 	const gchar *icon_name;
 	GtkTreeIter iter;
-	gboolean selected;
+	gboolean selected, selectable;
 
 	/* spin */
 	gpk_update_viewer_description_animation_start ();
@@ -658,15 +663,16 @@ gpk_update_viewer_get_new_update_list (v
 		icon_name = gpk_info_enum_to_icon_name (obj->info);
 		gtk_list_store_append (list_store_details, &iter);
 		package_id = pk_package_id_to_string (obj->id);
-		selected = (obj->info != PK_INFO_ENUM_BLOCKED);
+		selectable = (obj->info != PK_INFO_ENUM_BLOCKED);
+		selected = (selectable && (obj->info != PK_INFO_ENUM_LOW));
 		gtk_list_store_set (list_store_details, &iter,
 				    PACKAGES_COLUMN_TEXT, text,
 				    PACKAGES_COLUMN_ID, package_id,
 				    PACKAGES_COLUMN_ICON, icon_name,
 				    PACKAGES_COLUMN_INFO, obj->info,
 				    PACKAGES_COLUMN_SELECT, selected,
-				    PACKAGES_COLUMN_SENSITIVE, selected,
-				    PACKAGES_COLUMN_CLICKABLE, selected,
+				    PACKAGES_COLUMN_SENSITIVE, selectable,
+				    PACKAGES_COLUMN_CLICKABLE, selectable,
 				    -1);
 		g_free (package_id);
 		g_free (text);
openSUSE Build Service is sponsored by