gnome-packagekit r155 - trunk/src



Author: rhughes
Date: Wed Apr  9 22:27:57 2008
New Revision: 155
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=155&view=rev

Log:
from git

Modified:
   trunk/src/gpk-notify.c
   trunk/src/gpk-progress.c

Modified: trunk/src/gpk-notify.c
==============================================================================
--- trunk/src/gpk-notify.c	(original)
+++ trunk/src/gpk-notify.c	Wed Apr  9 22:27:57 2008
@@ -691,6 +691,7 @@
 	PkUpdateEnum update;
 	PkPackageId *ident;
 	GPtrArray *security_array;
+	const gchar *icon;
 
 	g_return_if_fail (GPK_IS_NOTIFY (notify));
 
@@ -734,26 +735,22 @@
 		goto out;
 	}
 
+	/* work out icon */
+	icon = gpk_notify_get_best_update_icon (notify, client);
+	gpk_smart_icon_set_icon_name (notify->priv->sicon, icon);
+
+	/* make tooltip */
+	if (status_security->len != 0) {
+		g_string_set_size (status_security, status_security->len-1);
+	}
+	g_string_append_printf (status_tooltip, ngettext ("There is %d update pending",
+							  "There are %d updates pending", length), length);
+	gpk_smart_icon_set_tooltip (notify->priv->sicon, status_tooltip->str);
+
 	/* is policy none? */
 	if (update == PK_UPDATE_ENUM_NONE) {
-		const gchar *icon;
 		pk_debug ("not updating as policy NONE");
 
-		/* work out icon */
-		icon = gpk_notify_get_best_update_icon (notify, client);
-
-		/* trim off extra newlines */
-		if (status_security->len != 0) {
-			g_string_set_size (status_security, status_security->len-1);
-		}
-
-		/* make tooltip */
-		g_string_append_printf (status_tooltip, ngettext ("There is %d update pending",
-								  "There are %d updates pending", length), length);
-
-		gpk_smart_icon_set_icon_name (notify->priv->sicon, icon);
-		gpk_smart_icon_set_tooltip (notify->priv->sicon, status_tooltip->str);
-
 		/* do we warn the user? */
 		if (security_array->len > 0) {
 			gpk_notify_critical_updates_warning (notify, status_security->str, length);
@@ -765,6 +762,10 @@
 	ret = gpk_notify_check_on_battery (notify);
 	if (!ret) {
 		pk_debug ("on battery so not doing update");
+		/* do we warn the user? */
+		if (security_array->len > 0) {
+			gpk_notify_critical_updates_warning (notify, status_security->str, length);
+		}
 		goto out;
 	}
 
@@ -993,7 +994,8 @@
 {
 	g_return_if_fail (GPK_IS_NOTIFY (notify));
 	/* hide icon if we are updating */
-	if (pk_task_list_contains_role (tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
+	if (pk_task_list_contains_role (tlist, PK_ROLE_ENUM_UPDATE_SYSTEM) ||
+	    pk_task_list_contains_role (tlist, PK_ROLE_ENUM_UPDATE_PACKAGES)) {
 		gpk_smart_icon_set_icon_name (notify->priv->sicon, NULL);
 	}
 }

Modified: trunk/src/gpk-progress.c
==============================================================================
--- trunk/src/gpk-progress.c	(original)
+++ trunk/src/gpk-progress.c	Wed Apr  9 22:27:57 2008
@@ -470,8 +470,8 @@
 	const gchar *role_text;
 	gchar *package_id;
 	gchar *text;
+	gchar *package;
 	PkRoleEnum role;
-	PkPackageId *ident;
 	GError *error = NULL;
 	gboolean ret;
 
@@ -486,16 +486,15 @@
 	/* backup */
 	role_text = gpk_role_enum_to_localised_present (role);
 
-	/* check to see if we have a package_id or just a search term */
-	if (pk_strzero (package_id)) {
-		text = g_strdup (role_text);
-	} else if (pk_package_id_check (package_id) == FALSE) {
-		text = g_strdup_printf ("%s: %s", role_text, package_id);
+	if (!pk_strzero (package_id) && role != PK_ROLE_ENUM_UPDATE_PACKAGES) {
+		package = gpk_package_get_name (package_id);
+		text = g_strdup_printf ("%s: %s", role_text, package);
+		g_free (package);
 	} else {
-		ident = pk_package_id_new_from_string (package_id);
-		text = g_strdup_printf ("%s: %s", role_text, ident->name);
-		pk_package_id_free (ident);
+		text = g_strdup_printf ("%s", role_text);
 	}
+	g_free (package_id);
+
 	return text;
 }
 



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