gnome-packagekit r231 - in trunk: . src



Author: rhughes
Date: Wed Jun 25 09:53:49 2008
New Revision: 231
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=231&view=rev

Log:
from git

Modified:
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/gpk-application.c
   trunk/src/gpk-client-depends.c
   trunk/src/gpk-client-depends.h
   trunk/src/gpk-client-requires.c
   trunk/src/gpk-client-resolve.c
   trunk/src/gpk-client.c
   trunk/src/gpk-common.c
   trunk/src/gpk-common.h
   trunk/src/gpk-interface.h
   trunk/src/gpk-update-viewer.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Wed Jun 25 09:53:49 2008
@@ -1,6 +1,6 @@
 AC_PREREQ(2.52)
 
-AC_INIT(gnome-packagekit, 0.2.3)
+AC_INIT(gnome-packagekit, 0.3.0)
 AC_CONFIG_SRCDIR(src)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Wed Jun 25 09:53:49 2008
@@ -58,6 +58,7 @@
 	gpk-consolekit.h				\
 	gpk-client.c					\
 	gpk-client.h					\
+	gpk-client-private.h				\
 	gpk-client-eula.c				\
 	gpk-client-eula.h				\
 	gpk-client-resolve.c				\

Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c	(original)
+++ trunk/src/gpk-application.c	Wed Jun 25 09:53:49 2008
@@ -40,8 +40,10 @@
 #include <pk-common.h>
 #include <pk-connection.h>
 #include <pk-package-id.h>
+#include <pk-package-ids.h>
 #include <pk-package-list.h>
 #include <pk-extra.h>
+#include <pk-details.h>
 
 #include <gpk-client.h>
 #include <gpk-common.h>
@@ -659,6 +661,7 @@
 	gboolean ret;
 	PkPackageList *list;
 	GtkWidget *widget;
+	gchar **package_ids;
 
 	/* cancel any previous request */
 	ret = pk_client_reset (application->priv->client_files, &error);
@@ -670,8 +673,10 @@
 
 	/* get the requires */
 	pk_client_set_synchronous (application->priv->client_files, TRUE, NULL);
+	package_ids = pk_package_ids_from_id (application->priv->package);
 	ret = pk_client_get_requires (application->priv->client_files, PK_FILTER_ENUM_NONE,
-				      application->priv->package, TRUE, &error);
+				      package_ids, TRUE, &error);
+	g_strfreev (package_ids);
 	pk_client_set_synchronous (application->priv->client_files, FALSE, NULL);
 
 	if (!ret) {
@@ -702,6 +707,7 @@
 	gboolean ret;
 	PkPackageList *list;
 	GtkWidget *widget;
+	gchar **package_ids;
 
 	/* cancel any previous request */
 	ret = pk_client_reset (application->priv->client_files, &error);
@@ -713,8 +719,10 @@
 
 	/* get the depends */
 	pk_client_set_synchronous (application->priv->client_files, TRUE, NULL);
+	package_ids = pk_package_ids_from_id (application->priv->package);
 	ret = pk_client_get_depends (application->priv->client_files, PK_FILTER_ENUM_NONE,
-				     application->priv->package, TRUE, &error);
+				     package_ids, TRUE, &error);
+	g_strfreev (package_ids);
 	pk_client_set_synchronous (application->priv->client_files, FALSE, NULL);
 
 	if (!ret) {
@@ -829,10 +837,7 @@
  * gpk_application_details_cb:
  **/
 static void
-gpk_application_details_cb (PkClient *client, const gchar *package_id,
-			    const gchar *license, PkGroupEnum group_enum,
-			    const gchar *detail, const gchar *url,
-			    guint64 size, GpkApplication *application)
+gpk_application_details_cb (PkClient *client, PkDetails *details, GpkApplication *application)
 {
 	GtkWidget *widget;
 	gchar *text;
@@ -847,9 +852,9 @@
 
 	g_return_if_fail (PK_IS_APPLICATION (application));
 
-	ident = pk_package_id_new_from_string (package_id);
+	ident = pk_package_id_new_from_string (details->package_id);
 	if (ident == NULL) {
-		pk_warning ("failed to get PkPackageId for %s", package_id);
+		pk_warning ("failed to get PkPackageId for %s", details->package_id);
 		return;
 	}
 	installed = pk_strequal (ident->data, "installed");
@@ -877,47 +882,47 @@
 
 	/* homepage */
 	widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_homepage");
-	if (pk_strzero (url) == FALSE) {
+	if (pk_strzero (details->url) == FALSE) {
 		gtk_widget_set_sensitive (widget, TRUE);
 
 		/* set the tooltip to where we are going */
-		text = g_strdup_printf (_("Visit %s"), url);
+		text = g_strdup_printf (_("Visit %s"), details->url);
 		gtk_widget_set_tooltip_text (widget, text);
 		g_free (text);
 
-		gpk_application_add_detail_item (application, _("Project"), _("Hompage"), url);
+		gpk_application_add_detail_item (application, _("Project"), _("Homepage"), details->url);
 
 		/* save the url for the button */
 		g_free (application->priv->url);
-		application->priv->url = g_strdup (url);
+		application->priv->url = g_strdup (details->url);
 
 	} else {
 		gtk_widget_set_sensitive (widget, FALSE);
 	}
 
 	/* group */
-	if (TRUE || group_enum != PK_GROUP_ENUM_UNKNOWN) {
-		group = gpk_group_enum_to_localised_text (group_enum);
+	if (details->group != PK_GROUP_ENUM_UNKNOWN) {
+		group = gpk_group_enum_to_localised_text (details->group);
 		gpk_application_add_detail_item (application, _("Group"), group, NULL);
 	}
 
 	/* group */
-	if (!pk_strzero (license)) {
+	if (!pk_strzero (details->license)) {
 		/* This should be a licence enum value - bad API, bad.
 		 * license = pk_license_enum_to_text (license_enum); */
-		gpk_application_add_detail_item (application, _("License"), license, NULL);
+		gpk_application_add_detail_item (application, _("License"), details->license, NULL);
 	}
 
 	/* set the description */
-	text = g_markup_escape_text (detail, -1);
+	text = g_markup_escape_text (details->description, -1);
 	widget = glade_xml_get_widget (application->priv->glade_xml, "textview_description");
 	gpk_application_set_text_buffer (widget, text);
 	g_free (text);
 
 	/* if non-zero, set the size */
-	if (size > 0) {
+	if (details->size > 0) {
 		/* set the size */
-		value = gpk_size_to_si_size_text (size);
+		value = gpk_size_to_si_size_text (details->size);
 		if (installed) {
 			gpk_application_add_detail_item (application, _("Installed size"), value, NULL);
 		} else {
@@ -1664,6 +1669,7 @@
 	gboolean show_install = TRUE;
 	gboolean show_remove = TRUE;
 	GpkPackageState state;
+	gchar **package_ids;
 
 	g_return_if_fail (PK_IS_APPLICATION (application));
 
@@ -1726,8 +1732,9 @@
 	}
 
 	/* get the details */
-	ret = pk_client_get_details (application->priv->client_details,
-				     application->priv->package, &error);
+	package_ids = pk_package_ids_from_id (application->priv->package);
+	ret = pk_client_get_details (application->priv->client_details, package_ids, &error);
+	g_strfreev (package_ids);
 	if (!ret) {
 		pk_warning ("failed to get details: %s", error->message);
 		g_error_free (error);

Modified: trunk/src/gpk-client-depends.c
==============================================================================
--- trunk/src/gpk-client-depends.c	(original)
+++ trunk/src/gpk-client-depends.c	Wed Jun 25 09:53:49 2008
@@ -35,6 +35,7 @@
 #include "gpk-gnome.h"
 #include "gpk-error.h"
 #include "gpk-common.h"
+#include "gpk-client-private.h"
 
 static PkClient *client = NULL;
 static GConfClient *gconf_client = NULL;
@@ -52,36 +53,13 @@
 	gconf_client_set_bool (gconf_client, GPK_CONF_SHOW_DEPENDS, checked, NULL);
 }
 
-static gboolean
-gpk_client_depends_indervidual (GtkWindow *window, PkPackageList *list_ret, const gchar *package_id)
+/**
+ * gpk_client_status_changed_cb:
+ **/
+static void
+gpk_client_status_changed_cb (PkClient *client, PkStatusEnum status, GpkClient *gclient)
 {
-	GError *error = NULL;
-	PkPackageList *list;
-	gboolean ret;
-
-	/* reset */
-	ret = pk_client_reset (client, &error);
-	if (!ret) {
-		gpk_error_dialog_modal (window, _("Failed to reset client"), NULL, error->message);
-		g_error_free (error);
-		return FALSE;
-	}
-
-	/* find out if this would drag in other packages */
-	ret = pk_client_get_depends (client, PK_FILTER_ENUM_NOT_INSTALLED, package_id, TRUE, &error);
-	if (!ret) {
-		gpk_error_dialog_modal (window, _("Failed to get depends"),
-					_("Could not work out what packages would be also installed"),
-					error->message);
-		g_error_free (error);
-		return FALSE;
-	}
-
-	/* add additional packages */
-	list = pk_client_get_package_list (client);
-	pk_package_list_add_list (list_ret, list);
-	g_object_unref (list);
-	return TRUE;
+	gpk_client_set_status (gclient, status);
 }
 
 /**
@@ -90,10 +68,11 @@
  * Return value: if we agreed to remove the deps
  **/
 gboolean
-gpk_client_depends_show (GtkWindow *window, gchar **package_ids)
+gpk_client_depends_show (GpkClient *gclient, gchar **package_ids)
 {
 	GtkWidget *widget;
 	GtkWidget *dialog;
+	GtkWindow *window;
 	GtkResponseType button;
 	PkPackageList *list;
 	gboolean ret;
@@ -102,6 +81,7 @@
 	GString *string;
 	PkPackageItem *item;
 	gchar *text;
+	GError *error = NULL;
 
 	list = pk_package_list_new ();
 	gconf_client = gconf_client_get_default ();
@@ -109,6 +89,8 @@
 	client = pk_client_new ();
 	pk_client_set_use_buffer (client, TRUE, NULL);
 	pk_client_set_synchronous (client, TRUE, NULL);
+	g_signal_connect (client, "status-changed",
+			  G_CALLBACK (gpk_client_status_changed_cb), gclient);
 
 	/* have we previously said we don't want to be shown the confirmation */
 	ret = gconf_client_get_bool (gconf_client, GPK_CONF_SHOW_DEPENDS, NULL);
@@ -119,20 +101,33 @@
 	}
 
 	/* get the packages we depend on */
-	length = g_strv_length (package_ids);
-	for (i=0; i<length; i++) {
-		ret = gpk_client_depends_indervidual (window, list, package_ids[i]);
-		if (!ret) {
-			ret = FALSE;
-			goto out;
-		}
+	gpk_client_set_title (gclient, _("Finding packages we depend on"));
+
+	/* reset */
+	ret = pk_client_reset (client, &error);
+	if (!ret) {
+		window = gpk_client_get_window (gclient);
+		gpk_error_dialog_modal (window, _("Failed to reset client"), NULL, error->message);
+		g_error_free (error);
+		ret = FALSE;
+		goto out;
 	}
 
-	/* sometimes a package may pull in a depend we have already selected; we remove those */
-	for (i=0; i<length; i++) {
-		pk_package_list_remove (list, package_ids[i]);
+	/* find out if this would drag in other packages */
+	ret = pk_client_get_depends (client, PK_FILTER_ENUM_NOT_INSTALLED, package_ids, TRUE, &error);
+	if (!ret) {
+		window = gpk_client_get_window (gclient);
+		gpk_error_dialog_modal (window, _("Failed to get depends"),
+					_("Could not work out what packages would be also installed"),
+					error->message);
+		g_error_free (error);
+		ret = FALSE;
+		goto out;
 	}
 
+	/* these are the new packages */
+	list = pk_client_get_package_list (client);
+
 	/* process package list */
 	string = g_string_new (_("The following packages also have to be downloaded:"));
 	g_string_append (string, "\n\n");
@@ -154,6 +149,7 @@
 	text = g_string_free (string, FALSE);
 
 	/* show UI */
+	window = gpk_client_get_window (gclient);
 	dialog = gtk_message_dialog_new (window, GTK_DIALOG_DESTROY_WITH_PARENT,
 					 GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,
 					 "%s", _("Install additional packages?"));

Modified: trunk/src/gpk-client-depends.h
==============================================================================
--- trunk/src/gpk-client-depends.h	(original)
+++ trunk/src/gpk-client-depends.h	Wed Jun 25 09:53:49 2008
@@ -27,7 +27,7 @@
 G_BEGIN_DECLS
 
 void		 gpk_client_depends_self_test		(gpointer	 data);
-gboolean	 gpk_client_depends_show		(GtkWindow	*window,
+gboolean	 gpk_client_depends_show		(GpkClient	*gclient,
 							 gchar		**package_ids);
 
 G_END_DECLS

Modified: trunk/src/gpk-client-requires.c
==============================================================================
--- trunk/src/gpk-client-requires.c	(original)
+++ trunk/src/gpk-client-requires.c	Wed Jun 25 09:53:49 2008
@@ -37,36 +37,35 @@
 
 static PkClient *client = NULL;
 
-static gboolean
-gpk_client_requires_indervidual (GtkWindow *window, PkPackageList *list_ret, const gchar *package_id)
+/**
+ * gpk_client_requires_get_package_ids_name:
+ **/
+gchar *
+gpk_client_requires_get_package_ids_name (gchar **package_ids)
 {
-	GError *error = NULL;
-	PkPackageList *list;
-	gboolean ret;
+	guint i;
+	guint length;
+	gchar *text;
+	GString *string;
+	PkPackageId *ident;
 
-	/* reset */
-	ret = pk_client_reset (client, &error);
-	if (!ret) {
-		gpk_error_dialog_modal (window, _("Failed to reset client"), NULL, error->message);
-		g_error_free (error);
-		return FALSE;
-	}
+	string = g_string_new ("");
+	length = g_strv_length (package_ids);
 
-	/* find out if this would force removal of other packages */
-	ret = pk_client_get_requires (client, PK_FILTER_ENUM_INSTALLED, package_id, TRUE, &error);
-	if (!ret) {
-		gpk_error_dialog_modal (window, _("Failed to get requires"),
-					_("Could not work out what packages would also be removed"),
-					error->message);
-		g_error_free (error);
-		return FALSE;
+	/* for each name */
+	for (i=0; i<length; i++) {
+		ident = pk_package_id_new_from_string (package_ids[i]);
+		g_string_append_printf (string, "%s, ", ident->name);
+		pk_package_id_free (ident);
 	}
 
-	list = pk_client_get_package_list (client);
-	pk_package_list_add_list (list_ret, list);
-	g_object_unref (list);
+	/* remove last ', ' */
+	if (string->len > 2) {
+		g_string_set_size (string, string->len - 2);
+	}
 
-	return TRUE;
+	text = g_string_free (string, FALSE);
+	return text;
 }
 
 /**
@@ -87,6 +86,7 @@
 	PkPackageItem *item;
 	gchar *text;
 	gchar *name;
+	GError *error = NULL;
 
 	list = pk_package_list_new ();
 
@@ -94,15 +94,29 @@
 	pk_client_set_use_buffer (client, TRUE, NULL);
 	pk_client_set_synchronous (client, TRUE, NULL);
 
-	length = g_strv_length (package_ids);
-	for (i=0; i<length; i++) {
-		ret = gpk_client_requires_indervidual (window, list, package_ids[i]);
-		if (!ret) {
-			ret = FALSE;
-			goto out;
-		}
+	/* reset */
+	ret = pk_client_reset (client, &error);
+	if (!ret) {
+		gpk_error_dialog_modal (window, _("Failed to reset client"), NULL, error->message);
+		g_error_free (error);
+		ret = FALSE;
+		goto out;
 	}
 
+	/* find out if this would force removal of other packages */
+	ret = pk_client_get_requires (client, PK_FILTER_ENUM_INSTALLED, package_ids, TRUE, &error);
+	if (!ret) {
+		gpk_error_dialog_modal (window, _("Failed to get requires"),
+					_("Could not work out what packages would also be removed"),
+					error->message);
+		g_error_free (error);
+		ret = FALSE;
+		goto out;
+	}
+
+	/* these are the new packages */
+	list = pk_client_get_package_list (client);
+
 	/* sort by package_id */
 	pk_package_list_sort (list);
 
@@ -123,14 +137,11 @@
 	/* remove last \n */
 	g_string_set_size (string, string->len - 1);
 
+	name = gpk_client_requires_get_package_ids_name (package_ids);
+	text = g_strdup_printf (ngettext ("%i other package depends on %s", "%i other packages depend on %s", length), length, name);
+	g_free (name);
+
 	/* show UI */
-	if (g_strv_length (package_ids) == 1) {
-		name = gpk_package_id_name_version (package_ids[0]);
-		text = g_strdup_printf (_("%i other packages depends on %s"), length, name);
-		g_free (name);
-	} else {
-		text = g_strdup_printf (_("%i other packages depends on these packages"), length);
-	}
 	dialog = gtk_message_dialog_new (window, GTK_DIALOG_DESTROY_WITH_PARENT,
 					 GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, "%s", text);
 	g_free (text);

Modified: trunk/src/gpk-client-resolve.c
==============================================================================
--- trunk/src/gpk-client-resolve.c	(original)
+++ trunk/src/gpk-client-resolve.c	Wed Jun 25 09:53:49 2008
@@ -31,25 +31,37 @@
 #include <pk-client.h>
 #include <pk-common.h>
 #include <pk-package-id.h>
+#include <pk-package-ids.h>
 #include "gpk-gnome.h"
 #include "gpk-error.h"
 #include "gpk-common.h"
 
 static PkClient *client = NULL;
 
-static gchar *
-gpk_client_resolve_indervidual (GtkWindow *window, const gchar *package)
+/**
+ * gpk_client_resolve_show:
+ *
+ * Return value: if we agreed to remove the deps
+ **/
+gchar **
+gpk_client_resolve_show (GtkWindow *window, gchar **packages)
 {
 	GError *error = NULL;
 	PkPackageItem *item;
 	PkPackageList *list;
 	gchar *package_id = NULL;
+	gchar **package_ids = NULL;
+	gchar *text;
 	gboolean already_installed = FALSE;
 	gboolean ret;
 	gchar *title;
 	guint len;
 	guint i;
 
+	client = pk_client_new ();
+	pk_client_set_use_buffer (client, TRUE, NULL);
+	pk_client_set_synchronous (client, TRUE, NULL);
+
 	/* reset */
 	ret = pk_client_reset (client, &error);
 	if (!ret) {
@@ -59,11 +71,10 @@
 	}
 
 	/* find out if we can find a package */
-	ret = pk_client_resolve (client, PK_FILTER_ENUM_NONE, package, &error);
+	ret = pk_client_resolve (client, PK_FILTER_ENUM_NONE, packages, &error);
 	if (!ret) {
 		gpk_error_dialog_modal (window, _("Failed to resolve package"),
-				  _("Incorrect response from search"),
-				  error->message);
+					_("Incorrect response from search"), error->message);
 		g_error_free (error);
 		goto out;
 	}
@@ -72,8 +83,10 @@
 	list = pk_client_get_package_list (client);
 	len = pk_package_list_get_size (list);
 	if (len == 0) {
-		title = g_strdup_printf (_("Could not find %s"), package);
-		gpk_error_dialog_modal (window, title, _("The package could not be found in any software sources"), NULL);
+		text = pk_package_ids_to_text (packages, ",");
+		title = g_strdup_printf (_("Could not find %s"), text);
+		g_free (text);
+		gpk_error_dialog_modal (window, title, _("The packages could not be found in any software source"), NULL);
 		g_free (title);
 		goto out;
 	}
@@ -93,11 +106,12 @@
 			package_id = g_strdup (item->package_id);
 		}
 	}
-	g_object_unref (list);
 
 	/* already installed? */
 	if (already_installed) {
-		title = g_strdup_printf (_("Failed to install %s"), package);
+		text = pk_package_ids_to_text (packages, ",");
+		title = g_strdup_printf (_("Failed to install %s"), text);
+		g_free (text);
 		gpk_error_dialog_modal (window, title, _("The package is already installed"), NULL);
 		g_free (title);
 		goto out;
@@ -108,41 +122,12 @@
 		gpk_error_dialog_modal (window, _("Failed to find package"), _("Incorrect response from search"), NULL);
 		goto out;
 	}
-out:
-	return package_id;
-}
 
-/**
- * gpk_client_resolve_show:
- *
- * Return value: if we agreed to remove the deps
- **/
-gchar **
-gpk_client_resolve_show (GtkWindow *window, gchar **packages)
-{
-	guint i;
-	guint length;
-	gchar *package_id;
-	gchar **package_ids = NULL;
-	GPtrArray *array;
-
-	array = g_ptr_array_new ();
-	client = pk_client_new ();
-	pk_client_set_use_buffer (client, TRUE, NULL);
-	pk_client_set_synchronous (client, TRUE, NULL);
-
-	length = g_strv_length (packages);
-	for (i=0; i<length; i++) {
-		package_id = gpk_client_resolve_indervidual (window, packages[i]);
-		if (package_id == NULL) {
-			goto out;
-		}
-		g_ptr_array_add (array, package_id);
-	}
-	package_ids = pk_ptr_array_to_argv (array);
+	/* convert to data */
+	package_ids = pk_package_list_to_argv (list);
+	g_object_unref (list);
 
 out:
-	g_ptr_array_free (array, TRUE);
 	g_object_unref (client);
 	return package_ids;
 }

Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c	(original)
+++ trunk/src/gpk-client.c	Wed Jun 25 09:53:49 2008
@@ -40,6 +40,7 @@
 #include <pk-debug.h>
 #include <pk-client.h>
 #include <pk-package-id.h>
+#include <pk-package-ids.h>
 #include <pk-common.h>
 #include <pk-control.h>
 #include <pk-catalog.h>
@@ -516,15 +517,14 @@
 }
 
 /**
- * gpk_client_progress_changed_cb:
+ * gpk_client_set_percentage:
  **/
-static void
-gpk_client_progress_changed_cb (PkClient *client, guint percentage, guint subpercentage,
-				guint elapsed, guint remaining, GpkClient *gclient)
+gboolean
+gpk_client_set_percentage (GpkClient *gclient, guint percentage)
 {
 	GtkWidget *widget;
 
-	g_return_if_fail (GPK_IS_CLIENT (gclient));
+	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 
 	widget = glade_xml_get_widget (gclient->priv->glade_xml, "progressbar_percent");
 	if (gclient->priv->pulse_timer_id != 0) {
@@ -538,18 +538,19 @@
 	} else {
 		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget), (gfloat) percentage / 100.0);
 	}
+	return TRUE;
 }
 
 /**
- * gpk_client_status_changed_cb:
+ * gpk_client_set_status:
  **/
-static void
-gpk_client_status_changed_cb (PkClient *client, PkStatusEnum status, GpkClient *gclient)
+gboolean
+gpk_client_set_status (GpkClient *gclient, PkStatusEnum status)
 {
 	GtkWidget *widget;
 	gchar *text;
 
-	g_return_if_fail (GPK_IS_CLIENT (gclient));
+	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 
 	/* do we force progress? */
 	if (gclient->priv->interact == GPK_CLIENT_INTERACT_SOMETIMES) {
@@ -597,6 +598,51 @@
 		widget = glade_xml_get_widget (gclient->priv->glade_xml, "progressbar_percent");
 		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget), 1.0f);
 	}
+	return TRUE;
+}
+
+/**
+ * gpk_client_set_package_label:
+ **/
+gboolean
+gpk_client_set_package_label (GpkClient *gclient, const gchar *text)
+{
+	GtkWidget *widget;
+	widget = glade_xml_get_widget (gclient->priv->glade_xml, "label_package");
+	gtk_widget_show (widget);
+	gtk_label_set_markup (GTK_LABEL (widget), text);
+	return TRUE;
+}
+
+/**
+ * gpk_client_set_title:
+ **/
+gboolean
+gpk_client_set_title (GpkClient *gclient, const gchar *title)
+{
+	GtkWidget *widget;
+	widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+	gtk_window_set_title (GTK_WINDOW (widget), title);
+	return TRUE;
+}
+
+/**
+ * gpk_client_progress_changed_cb:
+ **/
+static void
+gpk_client_progress_changed_cb (PkClient *client, guint percentage, guint subpercentage,
+				guint elapsed, guint remaining, GpkClient *gclient)
+{
+	gpk_client_set_percentage (gclient, percentage);
+}
+
+/**
+ * gpk_client_status_changed_cb:
+ **/
+static void
+gpk_client_status_changed_cb (PkClient *client, PkStatusEnum status, GpkClient *gclient)
+{
+	gpk_client_set_status (gclient, status);
 }
 
 /**
@@ -662,19 +708,6 @@
 }
 
 /**
- * gpk_client_set_package_label:
- **/
-static gboolean
-gpk_client_set_package_label (GpkClient *gclient, const gchar *text)
-{
-	GtkWidget *widget;
-	widget = glade_xml_get_widget (gclient->priv->glade_xml, "label_package");
-	gtk_widget_show (widget);
-	gtk_label_set_markup (GTK_LABEL (widget), text);
-	return TRUE;
-}
-
-/**
  * gpk_client_package_cb:
  **/
 static void
@@ -885,8 +918,7 @@
 	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 
 	/* set title */
-	widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
-	gtk_window_set_title (GTK_WINDOW (widget), title);
+	gpk_client_set_title (gclient, title);
 
 	/* clear status and progress text */
 	widget = glade_xml_get_widget (gclient->priv->glade_xml, "progress_part_label");
@@ -1138,6 +1170,17 @@
 }
 
 /**
+ * gpk_client_get_window:
+ **/
+GtkWindow *
+gpk_client_get_window (GpkClient *gclient)
+{
+	GtkWidget *widget;
+	widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+	return GTK_WINDOW (widget);
+}
+
+/**
  * gpk_client_install_package_ids:
  * @gclient: a valid #GpkClient instance
  * @package_id: a package_id such as <literal>hal-info;0.20;i386;fedora</literal>
@@ -1151,7 +1194,6 @@
 	gboolean ret;
 	GError *error_local = NULL;
 	gchar *text;
-	GtkWidget *widget;
 
 	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 	g_return_val_if_fail (package_ids != NULL, FALSE);
@@ -1175,8 +1217,7 @@
 		goto skip_checks;
 	}
 
-	widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
-	ret = gpk_client_depends_show (GTK_WINDOW (widget), package_ids);
+	ret = gpk_client_depends_show (gclient, package_ids);
 	/* did we click no or exit the window? */
 	if (!ret) {
 		gpk_client_error_msg (gclient, _("Failed to install package"), _("Additional packages were not downloaded"), NULL);
@@ -1196,6 +1237,7 @@
 	}
 
 	/* try to install the package_id */
+	gpk_client_set_title (gclient, _("Installing packages"));
 	ret = pk_client_install_packages (gclient->priv->client_action, package_ids, &error_local);
 	if (!ret) {
 		/* check if we got a permission denied */
@@ -1415,7 +1457,7 @@
 
 	/* selected nothing */
 	if (package_id == NULL) {
-		gpk_client_error_msg (gclient, _("Failed to install software"), _("No spplications were chosen to be installed"), NULL);
+		gpk_client_error_msg (gclient, _("Failed to install software"), _("No applications were chosen to be installed"), NULL);
 		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "user chose nothing");
 		ret = FALSE;
 		goto out;
@@ -1519,7 +1561,7 @@
 		message = g_strdup_printf (_("Finding a package to provide: %s"), text);
 	}
 
-	gpk_client_status_changed_cb (NULL, PK_STATUS_ENUM_QUERY, gclient);
+	gpk_client_set_status (gclient, PK_STATUS_ENUM_QUERY);
 	gpk_client_set_package_label (gclient, message);
 	g_free (message);
 }
@@ -1580,7 +1622,7 @@
 
 	/* set title */
 	gpk_client_setup_window (gclient, _("Install catalogs"));
-	gpk_client_status_changed_cb (NULL, PK_STATUS_ENUM_WAIT, gclient);
+	gpk_client_set_status (gclient, PK_STATUS_ENUM_WAIT);
 
 	/* setup the UI */
 	gpk_client_set_progress_files (gclient, TRUE);
@@ -1705,7 +1747,7 @@
 	if (!ret) {
 		/* print a proper error if we have it */
 		if (error_local->code == PK_CLIENT_ERROR_FAILED_AUTH) {
-			message = g_strdup (_("Authorisation could not be obtained"));
+			message = g_strdup (_("Authorization could not be obtained"));
 		} else {
 			message = g_strdup_printf (_("The error was: %s"), error_local->message);
 		}
@@ -1878,6 +1920,7 @@
 {
 	gboolean ret;
 	GError *error_local = NULL;
+	gchar **package_ids;
 
 	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 
@@ -1900,7 +1943,9 @@
 	gpk_client_setup_window (gclient, _("Getting file lists"));
 
 	/* wrap get files */
-	ret = pk_client_get_files (gclient->priv->client_action, package_id, &error_local);
+	package_ids = pk_package_ids_from_id (package_id);
+	ret = pk_client_get_files (gclient->priv->client_action, package_ids, &error_local);
+	g_strfreev (package_ids);
 	if (!ret) {
 		gpk_client_error_msg (gclient, _("Getting file list failed"), _("Failed to get file list"), error_local->message);
 		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
@@ -2192,14 +2237,13 @@
 		pk_warning ("could not get status");
 		return FALSE;
 	}
+	gpk_client_set_status (gclient, status);
 
 	/* are we cancellable? */
 	pk_client_get_allow_cancel (gclient->priv->client_action, &allow_cancel, NULL);
 	widget = glade_xml_get_widget (gclient->priv->glade_xml, "button_cancel");
 	gtk_widget_set_sensitive (widget, allow_cancel);
 
-	gpk_client_status_changed_cb (gclient->priv->client_action, status, gclient);
-
 	/* coldplug */
 	ret = pk_client_get_progress (gclient->priv->client_action,
 				      &percentage, &subpercentage, &elapsed, &remaining, NULL);

Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c	(original)
+++ trunk/src/gpk-common.c	Wed Jun 25 09:53:49 2008
@@ -405,7 +405,7 @@
 		text = _("Reading the config file failed");
 		break;
 	case PK_ERROR_ENUM_CANNOT_CANCEL:
-		text = _("The task cannot be cancelled");
+		text = _("The task cannot be canceled");
 		break;
 	case PK_ERROR_ENUM_CANNOT_INSTALL_SOURCE_PACKAGE:
 		text = _("Source packages cannot be installed");
@@ -486,11 +486,11 @@
 		break;
 	case PK_ERROR_ENUM_NOT_SUPPORTED:
 		text = _("The action is not supported by this backend.\n"
-			 "Please report a bug as this shouldn't have happened.");
+			 "Please report a bug at " GPK_BUGZILLA_URL " as this should not have happened.");
 		break;
 	case PK_ERROR_ENUM_INTERNAL_ERROR:
 		text = _("A problem that we were not expecting has occurred.\n"
-			 "Please report this bug with the error description.");
+			 "Please report this bug at " GPK_BUGZILLA_URL " with the error description.");
 		break;
 	case PK_ERROR_ENUM_GPG_FAILURE:
 		text = _("A security trust relationship could not be made with software source.\n"
@@ -538,7 +538,7 @@
 			 "You may need to enable an item in Software Sources");
 		break;
 	case PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE:
-		text = _("Removing a protected system package is not alloed.");
+		text = _("Removing a protected system package is not allowed.");
 		break;
 	case PK_ERROR_ENUM_TRANSACTION_CANCELLED:
 		text = _("The task was canceled successfully and no packages were changed.");
@@ -552,7 +552,7 @@
 			 "Please make sure configuration is valid.");
 		break;
 	case PK_ERROR_ENUM_CANNOT_CANCEL:
-		text = _("The task is not safe to be cancelled at this time.");
+		text = _("The task is not safe to be canceled at this time.");
 		break;
 	case PK_ERROR_ENUM_CANNOT_INSTALL_SOURCE_PACKAGE:
 		text = _("Source packages are not normally installed this way.\n"
@@ -613,7 +613,7 @@
 		text = _("The package that was downloaded is corrupt and needs to be downloaded again.");
 		break;
 	default:
-		g_warning ("Unknown error, please report a bug.\n"
+		g_warning ("Unknown error, please report a bug at " GPK_BUGZILLA_URL ".\n"
 			   "More information is available in the detailed report.");
 	}
 	return text;

Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h	(original)
+++ trunk/src/gpk-common.h	Wed Jun 25 09:53:49 2008
@@ -51,6 +51,8 @@
 #define GPK_CONF_APPLICATION_FILTER_BASENAME	"/apps/gnome-packagekit/application/filter_basename"
 #define GPK_CONF_APPLICATION_FILTER_NEWEST	"/apps/gnome-packagekit/application/filter_newest"
 
+#define GPK_BUGZILLA_URL			"https://bugs.freedesktop.org/";
+
 void		 gpk_common_self_test			(gpointer	 data);
 gchar		*gpk_package_get_name			(const gchar	*package_id);
 gchar		*gpk_package_id_format_twoline		(const gchar	*package_id,

Modified: trunk/src/gpk-interface.h
==============================================================================
--- trunk/src/gpk-interface.h	(original)
+++ trunk/src/gpk-interface.h	Wed Jun 25 09:53:49 2008
@@ -53,7 +53,7 @@
 #endif /* !G_ENABLE_DEBUG */
 
 
-/* NONE:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.QE1YCU:1) */
+/* NONE:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.VI70CU:1) */
 extern void dbus_glib_marshal_gpk_dbus_VOID__STRING_POINTER (GClosure     *closure,
                                                              GValue       *return_value,
                                                              guint         n_param_values,

Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c	(original)
+++ trunk/src/gpk-update-viewer.c	Wed Jun 25 09:53:49 2008
@@ -44,6 +44,7 @@
 #include <pk-task-list.h>
 #include <pk-package-id.h>
 #include <pk-package-ids.h>
+#include <pk-update-detail.h>
 
 #include <gpk-common.h>
 #include <gpk-gnome.h>
@@ -561,7 +562,9 @@
 	guint i;
 	gchar *text;
 	const gchar *icon_name;
+	gchar **package_ids;
 	GtkTreeIter iter;
+	gboolean ret;
 
 	/* clear existing list */
 	gtk_list_store_clear (list_store_details);
@@ -609,6 +612,25 @@
 	gtk_widget_set_sensitive (widget, are_updates_available);
 
 	gpk_update_viewer_populate_preview (list);
+
+	/* reset */
+	ret = pk_client_reset (client_query, &error);
+	if (!ret) {
+		pk_warning ("failed to reset: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+
+	/* pre-cache the update detail if we can */
+	package_ids = pk_package_list_to_argv (list);
+	ret = pk_client_get_update_detail (client_query, package_ids, &error);
+	g_strfreev (package_ids);
+	if (!ret) {
+		pk_warning ("failed to cache update detail: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+
 out:
 	g_object_unref (list);
 }
@@ -752,11 +774,7 @@
  * gpk_update_viewer_update_detail_cb:
  **/
 static void
-gpk_update_viewer_update_detail_cb (PkClient *client, const gchar *package_id,
-				    const gchar *updates, const gchar *obsoletes,
-				    const gchar *vendor_url, const gchar *bugzilla_url,
-				    const gchar *cve_url, PkRestartEnum restart,
-				    const gchar *update_text, gpointer data)
+gpk_update_viewer_update_detail_cb (PkClient *client, const PkUpdateDetail *detail, gpointer data)
 {
 	GtkWidget *widget;
 	PkPackageId *ident;
@@ -789,13 +807,13 @@
 	/* translators: this is the update type, e.g. security */
 	gpk_update_viewer_add_description_item (_("Type"), info_text, NULL);
 
-	package_pretty = gpk_package_id_name_version (package_id);
+	package_pretty = gpk_package_id_name_version (detail->package_id);
 	/* translators: this is the package version */
 	gpk_update_viewer_add_description_item (_("New version"), package_pretty, NULL);
 	g_free (package_pretty);
 
 	/* split and add */
-	package_pretty = gpk_update_viewer_get_pretty_from_composite (updates);
+	package_pretty = gpk_update_viewer_get_pretty_from_composite (detail->updates);
 	if (package_pretty != NULL) {
 		/* translators: this is a list of packages that are updated */
 		gpk_update_viewer_add_description_item (_("Updates"), package_pretty, NULL);
@@ -803,22 +821,22 @@
 	g_free (package_pretty);
 
 	/* split and add */
-	package_pretty = gpk_update_viewer_get_pretty_from_composite (obsoletes);
+	package_pretty = gpk_update_viewer_get_pretty_from_composite (detail->obsoletes);
 	if (package_pretty != NULL) {
 		/* translators: this is a list of packages that are obsoleted */
 		gpk_update_viewer_add_description_item (_("Obsoletes"), package_pretty, NULL);
 	}
 	g_free (package_pretty);
 
-	ident = pk_package_id_new_from_string (package_id);
+	ident = pk_package_id_new_from_string (detail->package_id);
 	/* translators: this is the repository the package has come from */
 	gpk_update_viewer_add_description_item (_("Repository"), ident->data, NULL);
 	pk_package_id_free (ident);
 
-	if (!pk_strzero (update_text)) {
+	if (!pk_strzero (detail->update_text)) {
 		gchar *first;
 		gchar *second;
-		first = pk_strreplace (update_text, "\n- ", "\nâ ");
+		first = pk_strreplace (detail->update_text, "\n- ", "\nâ ");
 		second = pk_strreplace (first, "\n* ", "\nâ ");
 		/* translators: this is the package description */
 		gpk_update_viewer_add_description_item (_("Description"), second, NULL);
@@ -827,23 +845,23 @@
 	}
 
 	/* add all the links */
-	if (!pk_strzero (vendor_url)) {
+	if (!pk_strzero (detail->vendor_url)) {
 		/* translators: this is a list of vendor URLs */
-		gpk_update_viewer_add_description_link_item (_("Vendor"), vendor_url);
+		gpk_update_viewer_add_description_link_item (_("Vendor"), detail->vendor_url);
 	}
-	if (!pk_strzero (bugzilla_url)) {
+	if (!pk_strzero (detail->bugzilla_url)) {
 		/* translators: this is a list of bugzilla URLs */
-		gpk_update_viewer_add_description_link_item (_("Bugzilla"), bugzilla_url);
+		gpk_update_viewer_add_description_link_item (_("Bugzilla"), detail->bugzilla_url);
 	}
-	if (!pk_strzero (cve_url)) {
+	if (!pk_strzero (detail->cve_url)) {
 		/* translators: this is a list of CVE (security) URLs */
-		gpk_update_viewer_add_description_link_item (_("CVE"), cve_url);
+		gpk_update_viewer_add_description_link_item (_("CVE"), detail->cve_url);
 	}
 
 	/* reboot */
-	if (restart == PK_RESTART_ENUM_SESSION ||
-	    restart == PK_RESTART_ENUM_SYSTEM) {
-		info_text = gpk_restart_enum_to_localised_text (restart);
+	if (detail->restart == PK_RESTART_ENUM_SESSION ||
+	    detail->restart == PK_RESTART_ENUM_SYSTEM) {
+		info_text = gpk_restart_enum_to_localised_text (detail->restart);
 		/* translators: this is a notice a restart might be required */
 		gpk_update_viewer_add_description_item (_("Notice"), info_text, NULL);
 	}
@@ -991,6 +1009,7 @@
 	GtkWidget *widget;
 	GError *error = NULL;
 	gboolean ret;
+	gchar **package_ids;
 
 	widget = glade_xml_get_widget (glade_xml, "scrolledwindow_description");
 
@@ -1023,7 +1042,9 @@
 
 		/* get the description */
 		error = NULL;
-		ret = pk_client_get_update_detail (client_query, cached_package_id, &error);
+		package_ids = pk_package_ids_from_id (cached_package_id);
+		ret = pk_client_get_update_detail (client_query, package_ids, &error);
+		g_strfreev (package_ids);
 		if (!ret) {
 			pk_warning ("failed to get update detail: %s", error->message);
 			g_error_free (error);



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