gnome-packagekit r85 - trunk/src



Author: rhughes
Date: Thu Jan 24 19:49:25 2008
New Revision: 85
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=85&view=rev

Log:
from git

Modified:
   trunk/src/Makefile.am
   trunk/src/pk-application-main.c
   trunk/src/pk-backend-status.c
   trunk/src/pk-common-gui.c
   trunk/src/pk-install-file.c
   trunk/src/pk-install-package.c
   trunk/src/pk-notify.c
   trunk/src/pk-prefs.c
   trunk/src/pk-repo.c
   trunk/src/pk-transaction-viewer.c
   trunk/src/pk-update-icon.c
   trunk/src/pk-update-viewer.c
   trunk/src/pk-watch.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Thu Jan 24 19:49:25 2008
@@ -16,6 +16,7 @@
 	-DPREFIX=\""$(prefix)"\" 			\
 	-DSYSCONFDIR=\""$(sysconfdir)"\" 		\
 	-DLIBDIR=\""$(libdir)"\" 			\
+	-DLOCALEDIR=\""$(localedir)"\"			\
 	-DVERSION="\"$(VERSION)\"" 			\
 	-DPK_DATA=\"$(pkgdatadir)\"			\
 	-I$(top_srcdir)/libgbus				\

Modified: trunk/src/pk-application-main.c
==============================================================================
--- trunk/src/pk-application-main.c	(original)
+++ trunk/src/pk-application-main.c	Thu Jan 24 19:49:25 2008
@@ -72,12 +72,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}

Modified: trunk/src/pk-backend-status.c
==============================================================================
--- trunk/src/pk-backend-status.c	(original)
+++ trunk/src/pk-backend-status.c	Thu Jan 24 19:49:25 2008
@@ -72,12 +72,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}

Modified: trunk/src/pk-common-gui.c
==============================================================================
--- trunk/src/pk-common-gui.c	(original)
+++ trunk/src/pk-common-gui.c	Thu Jan 24 19:49:25 2008
@@ -38,12 +38,12 @@
 	{PK_INFO_ENUM_UNKNOWN,			"help-browser"},	/* fall though value */
 	{PK_INFO_ENUM_INSTALLED,		"pk-package-installed"},
 	{PK_INFO_ENUM_AVAILABLE,		"pk-package-available"},
-	{PK_INFO_ENUM_LOW,			"software-update-available"},
-	{PK_INFO_ENUM_NORMAL,			"software-update-available"},
-	{PK_INFO_ENUM_IMPORTANT,		"software-update-urgent"},
-	{PK_INFO_ENUM_SECURITY,			"software-update-urgent"},
-	{PK_INFO_ENUM_BUGFIX,			"software-update-urgent"},
-	{PK_INFO_ENUM_ENHANCEMENT,		"software-update-urgent"},
+	{PK_INFO_ENUM_LOW,			"pk-update-low"},
+	{PK_INFO_ENUM_NORMAL,			"pk-update-normal"},
+	{PK_INFO_ENUM_IMPORTANT,		"pk-update-high"},
+	{PK_INFO_ENUM_SECURITY,			"pk-update-security"},
+	{PK_INFO_ENUM_BUGFIX,			"pk-update-bugfix"},
+	{PK_INFO_ENUM_ENHANCEMENT,		"pk-update-enhancement"},
 	{PK_INFO_ENUM_BLOCKED,			"help-browser"}, /* TODO: need better icon */
 	{PK_INFO_ENUM_DOWNLOADING,		"pk-package-download"},
 	{PK_INFO_ENUM_UPDATING,			"pk-package-update"},
@@ -779,6 +779,8 @@
 
 /**
  * pk_role_enum_to_localised_past:
+ *
+ * These are past tense versions of the action
  **/
 const gchar *
 pk_role_enum_to_localised_past (PkRoleEnum role)

Modified: trunk/src/pk-install-file.c
==============================================================================
--- trunk/src/pk-install-file.c	(original)
+++ trunk/src/pk-install-file.c	Thu Jan 24 19:49:25 2008
@@ -65,12 +65,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}
@@ -93,7 +99,7 @@
 	gtk_init (&argc, &argv);
 
 	if (argc < 2) {
-		g_print ("You need to specify a file to install\n");
+		g_print (_("You need to specify a file to install\n"));
 		return 1;
 	}
 

Modified: trunk/src/pk-install-package.c
==============================================================================
--- trunk/src/pk-install-package.c	(original)
+++ trunk/src/pk-install-package.c	Thu Jan 24 19:49:25 2008
@@ -132,12 +132,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}
@@ -145,7 +151,7 @@
 	g_type_init ();
 
 	g_set_application_name (_("PackageKit Package Installer"));
-	context = g_option_context_new (_("PACKAGE_ID"));
+	context = g_option_context_new ("pk-install-package");
 	g_option_context_set_summary (context, _("PackageKit Package Installer"));
 	g_option_context_add_main_entries (context, options, NULL);
 	g_option_context_parse (context, &argc, &argv, NULL);
@@ -160,7 +166,7 @@
 	gtk_init (&argc, &argv);
 
 	if (argc < 2) {
-		g_print ("You need to specify a package to install\n");
+		g_print (_("You need to specify a package to install\n"));
 		return 1;
 	}
 	loop = g_main_loop_new (NULL, FALSE);

Modified: trunk/src/pk-notify.c
==============================================================================
--- trunk/src/pk-notify.c	(original)
+++ trunk/src/pk-notify.c	Thu Jan 24 19:49:25 2008
@@ -288,6 +288,7 @@
 
 static gboolean pk_notify_check_for_updates_cb (PkNotify *notify);
 static void pk_notify_refresh_cache_finished_cb (PkClient *client, PkExitEnum exit_code, guint runtime, PkNotify *notify);
+static gboolean pk_notify_query_updates (PkNotify *notify);
 
 /**
  * pk_notify_update_system_finished_cb:
@@ -303,6 +304,8 @@
 	/* we failed, show the icon */
 	if (exit_code != PK_EXIT_ENUM_SUCCESS) {
 		pk_smart_icon_set_icon_name (notify->priv->sicon, FALSE);
+		/* we failed, so re-get the update list */
+		pk_notify_query_updates (notify);
 	}
 
 	/* close the libnotify bubble if it exists */
@@ -428,7 +431,7 @@
  * pk_notify_critical_updates_warning:
  **/
 static void
-pk_notify_critical_updates_warning (PkNotify *notify, const gchar *details, gboolean plural)
+pk_notify_critical_updates_warning (PkNotify *notify, const gchar *details, guint number)
 {
 	const gchar *title;
 	gchar *message;
@@ -436,13 +439,9 @@
 	g_return_if_fail (notify != NULL);
 	g_return_if_fail (PK_IS_NOTIFY (notify));
 
-	if (plural == TRUE) {
-		title = _("Security updates available");
-		message = g_strdup_printf (_("The following important updates are available for your computer:\n\n%s"), details);
-	} else {
-		title = _("Security update available");
-		message = g_strdup_printf (_("The following important update is available for your computer:\n\n%s"), details);
-	}
+	title = ngettext ("Security update available", "Security updates available", number);
+	message = g_strdup_printf (ngettext ("The following important update is available for your computer:\n\n%s",
+					     "The following important updates are available for your computer:\n\n%s", number), details);
 
 	pk_debug ("Doing requires-restart notification");
 	pk_smart_icon_notify_new (notify->priv->sicon, title, message, "software-update-urgent",
@@ -473,6 +472,78 @@
 }
 
 /**
+ * pk_notify_client_packages_to_enum_list:
+ **/
+static PkEnumList *
+pk_notify_client_packages_to_enum_list (PkNotify *notify, PkClient *client)
+{
+	guint i;
+	guint length;
+	PkEnumList *elist;
+	PkPackageItem *item;
+
+	g_return_val_if_fail (notify != NULL, NULL);
+	g_return_val_if_fail (PK_IS_NOTIFY (notify), NULL);
+
+	/* shortcut */
+	length = pk_client_package_buffer_get_size (client);
+	if (length == 0) {
+		return NULL;
+	}
+
+	/* we can use an enumerated list */
+	elist = pk_enum_list_new ();
+
+	/* add each status to a list */
+	for (i=0; i<length; i++) {
+		item = pk_client_package_buffer_get_item (client, i);
+		if (item == NULL) {
+			pk_warning ("not found item %i", i);
+			break;
+		}
+		pk_debug ("%s %s", item->package_id, pk_info_enum_to_text (item->info));
+		pk_enum_list_append (elist, item->info);
+	}
+	return elist;
+}
+
+/**
+ * pk_notify_get_best_update_icon:
+ **/
+static const gchar *
+pk_notify_get_best_update_icon (PkNotify *notify, PkClient *client)
+{
+	gint value;
+	PkEnumList *elist;
+	const gchar *icon;
+
+	g_return_val_if_fail (notify != NULL, NULL);
+	g_return_val_if_fail (PK_IS_NOTIFY (notify), NULL);
+
+	/* get an enumerated list with all the update types */
+	elist = pk_notify_client_packages_to_enum_list (notify, client);
+
+	/* get the most important icon */
+	value = pk_enum_list_contains_priority (elist,
+						PK_INFO_ENUM_SECURITY,
+						PK_INFO_ENUM_IMPORTANT,
+						PK_INFO_ENUM_BUGFIX,
+						PK_INFO_ENUM_NORMAL,
+						PK_INFO_ENUM_ENHANCEMENT,
+						PK_INFO_ENUM_LOW, -1);
+	if (value == -1) {
+		pk_warning ("should not be possible!");
+		value = PK_INFO_ENUM_LOW;
+	}
+
+	/* get the icon */
+	icon = pk_info_enum_to_icon_name (value);
+
+	g_object_unref (elist);
+	return icon;
+}
+
+/**
  * pk_notify_query_updates_finished_cb:
  **/
 static void
@@ -556,29 +627,23 @@
 	}
 
 	/* work out icon */
-	if (is_security == TRUE) {
-		icon = "software-update-urgent";
-	} else {
-		icon = "software-update-available";
-	}
+	icon = pk_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 */
-	if (length == 1) {
-		g_string_append_printf (status_tooltip, _("There is an update available"));
-	} else {
-		g_string_append_printf (status_tooltip, _("There are %d updates available"), length);
-	}
+	g_string_append_printf (status_tooltip, ngettext ("There is %d update pending",
+							  "There are %d updates pending", length), length);
 
 	pk_smart_icon_set_icon_name (notify->priv->sicon, icon);
 	pk_smart_icon_set_tooltip (notify->priv->sicon, status_tooltip->str);
 
 	/* do we warn the user? */
 	if (is_security == TRUE) {
-		pk_notify_critical_updates_warning (notify, status_security->str, (length > 1));
+		pk_notify_critical_updates_warning (notify, status_security->str, length);
 	}
 
 	g_string_free (status_security, TRUE);

Modified: trunk/src/pk-prefs.c
==============================================================================
--- trunk/src/pk-prefs.c	(original)
+++ trunk/src/pk-prefs.c	Thu Jan 24 19:49:25 2008
@@ -36,14 +36,14 @@
 #include <pk-enum-list.h>
 #include "pk-common-gui.h"
 
-#define PK_FREQ_HOURLY_TEXT		_("Hourly")
-#define PK_FREQ_DAILY_TEXT		_("Daily")
-#define PK_FREQ_WEEKLY_TEXT		_("Weekly")
-#define PK_FREQ_NEVER_TEXT		_("Never")
-
-#define PK_UPDATE_ALL_TEXT		_("All updates")
-#define PK_UPDATE_SECURITY_TEXT		_("Only security updates")
-#define PK_UPDATE_NONE_TEXT		_("Nothing")
+#define PK_FREQ_HOURLY_TEXT		N_("Hourly")
+#define PK_FREQ_DAILY_TEXT		N_("Daily")
+#define PK_FREQ_WEEKLY_TEXT		N_("Weekly")
+#define PK_FREQ_NEVER_TEXT		N_("Never")
+
+#define PK_UPDATE_ALL_TEXT		N_("All updates")
+#define PK_UPDATE_SECURITY_TEXT		N_("Only security updates")
+#define PK_UPDATE_NONE_TEXT		N_("Nothing")
 
 static GladeXML *glade_xml = NULL;
 
@@ -293,12 +293,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}

Modified: trunk/src/pk-repo.c
==============================================================================
--- trunk/src/pk-repo.c	(original)
+++ trunk/src/pk-repo.c	Thu Jan 24 19:49:25 2008
@@ -216,12 +216,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}
@@ -294,7 +300,7 @@
 		/* get the update list */
 		pk_client_get_repo_list (client);
 	} else {
-		pk_repo_detail_cb (client, "default", "Getting repository list not supported by backend", FALSE, NULL);
+		pk_repo_detail_cb (client, "default", _("Getting repository list not supported by backend"), FALSE, NULL);
 		widget = glade_xml_get_widget (glade_xml, "treeview_repo");
 		gtk_widget_set_sensitive (widget, FALSE);
 	}

Modified: trunk/src/pk-transaction-viewer.c
==============================================================================
--- trunk/src/pk-transaction-viewer.c	(original)
+++ trunk/src/pk-transaction-viewer.c	Thu Jan 24 19:49:25 2008
@@ -110,7 +110,7 @@
 	date = g_date_new ();
 	g_date_set_time_val (date, &timeval);
 
-	g_date_strftime (buffer, 100, "%A, %d %B %Y", date);
+	g_date_strftime (buffer, 100, _("%A, %d %B %Y"), date);
 	g_date_free (date);
 	return g_strdup (buffer);
 }
@@ -344,12 +344,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}

Modified: trunk/src/pk-update-icon.c
==============================================================================
--- trunk/src/pk-update-icon.c	(original)
+++ trunk/src/pk-update-icon.c	Thu Jan 24 19:49:25 2008
@@ -50,12 +50,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}

Modified: trunk/src/pk-update-viewer.c
==============================================================================
--- trunk/src/pk-update-viewer.c	(original)
+++ trunk/src/pk-update-viewer.c	Thu Jan 24 19:49:25 2008
@@ -1010,12 +1010,18 @@
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
-		  "Show extra debugging information", NULL },
+		  N_("Show extra debugging information"), NULL },
 		{ "version", '\0', 0, G_OPTION_ARG_NONE, &program_version,
-		  "Show the program version and exit", NULL },
+		  N_("Show the program version and exit"), NULL },
 		{ NULL}
 	};
 
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	if (! g_thread_supported ()) {
 		g_thread_init (NULL);
 	}

Modified: trunk/src/pk-watch.c
==============================================================================
--- trunk/src/pk-watch.c	(original)
+++ trunk/src/pk-watch.c	Thu Jan 24 19:49:25 2008
@@ -176,9 +176,9 @@
 static gboolean
 pk_watch_refresh_icon (PkWatch *watch)
 {
-	PkStatusEnum state = PK_STATUS_ENUM_UNKNOWN;
 	const gchar *icon;
 	PkEnumList *elist;
+	gint value;
 
 	g_return_val_if_fail (watch != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_WATCH (watch), FALSE);
@@ -193,44 +193,28 @@
 		return TRUE;
 	}
 
-	/* in order of priority */
-	if (pk_enum_list_contains (elist, PK_STATUS_ENUM_REFRESH_CACHE) == TRUE) {
-		state = PK_STATUS_ENUM_REFRESH_CACHE;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_INSTALL) == TRUE) {
-		state = PK_STATUS_ENUM_INSTALL;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_REMOVE) == TRUE) {
-		state = PK_STATUS_ENUM_REMOVE;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_CLEANUP) == TRUE) {
-		state = PK_STATUS_ENUM_CLEANUP;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_OBSOLETE) == TRUE) {
-		state = PK_STATUS_ENUM_OBSOLETE;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_SETUP) == TRUE) {
-		state = PK_STATUS_ENUM_SETUP;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_UPDATE) == TRUE) {
-		state = PK_STATUS_ENUM_UPDATE;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_DOWNLOAD) == TRUE) {
-		state = PK_STATUS_ENUM_DOWNLOAD;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_QUERY) == TRUE) {
-		state = PK_STATUS_ENUM_QUERY;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_INFO) == TRUE) {
-		state = PK_STATUS_ENUM_INFO;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_WAIT) == TRUE) {
-		state = PK_STATUS_ENUM_WAIT;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_DEP_RESOLVE) == TRUE) {
-		state = PK_STATUS_ENUM_DEP_RESOLVE;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_ROLLBACK) == TRUE) {
-		state = PK_STATUS_ENUM_ROLLBACK;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_COMMIT) == TRUE) {
-		state = PK_STATUS_ENUM_COMMIT;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_REQUEST) == TRUE) {
-		state = PK_STATUS_ENUM_REQUEST;
-	} else if (pk_enum_list_contains (elist, PK_STATUS_ENUM_FINISHED) == TRUE) {
-		state = PK_STATUS_ENUM_FINISHED;
-	}
-
-	/* only set if in the list */
-	if (state != PK_STATUS_ENUM_UNKNOWN) {
-		icon = pk_status_enum_to_icon_name (state);
+	/* get the most important icon */
+	value = pk_enum_list_contains_priority (elist,
+						PK_STATUS_ENUM_REFRESH_CACHE,
+						PK_STATUS_ENUM_INSTALL,
+						PK_STATUS_ENUM_REMOVE,
+						PK_STATUS_ENUM_CLEANUP,
+						PK_STATUS_ENUM_OBSOLETE,
+						PK_STATUS_ENUM_SETUP,
+						PK_STATUS_ENUM_UPDATE,
+						PK_STATUS_ENUM_DOWNLOAD,
+						PK_STATUS_ENUM_QUERY,
+						PK_STATUS_ENUM_INFO,
+						PK_STATUS_ENUM_WAIT,
+						PK_STATUS_ENUM_DEP_RESOLVE,
+						PK_STATUS_ENUM_ROLLBACK,
+						PK_STATUS_ENUM_COMMIT,
+						PK_STATUS_ENUM_REQUEST,
+						PK_STATUS_ENUM_FINISHED, -1);
+
+	/* only set if in the list and not unknown */
+	if (value != PK_STATUS_ENUM_UNKNOWN && value != -1) {
+		icon = pk_status_enum_to_icon_name (value);
 		pk_smart_icon_set_icon_name (watch->priv->sicon, icon);
 	}
 



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