gnome-packagekit r162 - in trunk: . data help libpackagekit-gnome po src



Author: rhughes
Date: Sat Apr 12 18:53:51 2008
New Revision: 162
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=162&view=rev

Log:
from git

Added:
   trunk/libpackagekit-gnome/gpk-gnome.c
   trunk/libpackagekit-gnome/gpk-gnome.h
   trunk/packagekit-gnome.pc.in
   trunk/src/gpk-consolekit.c
   trunk/src/gpk-consolekit.h
   trunk/src/gpk-install-local-file.c
   trunk/src/gpk-install-package-name.c
   trunk/src/gpk-install-provide-file.c
Removed:
   trunk/src/gpk-install-file.c
   trunk/src/gpk-install-package.c
Modified:
   trunk/.gitignore
   trunk/Makefile.am
   trunk/autogen.sh
   trunk/configure.ac
   trunk/data/gpk-update-viewer.glade
   trunk/help/ChangeLog
   trunk/libpackagekit-gnome/Makefile.am
   trunk/libpackagekit-gnome/gpk-client.c
   trunk/libpackagekit-gnome/gpk-client.h
   trunk/libpackagekit-gnome/gpk-common.c
   trunk/libpackagekit-gnome/gpk-common.h
   trunk/po/POTFILES.in
   trunk/src/Makefile.am
   trunk/src/gpk-application.c
   trunk/src/gpk-auto-refresh.c
   trunk/src/gpk-inhibit.c
   trunk/src/gpk-log.c
   trunk/src/gpk-notify.c
   trunk/src/gpk-prefs.c
   trunk/src/gpk-progress.c
   trunk/src/gpk-repo.c
   trunk/src/gpk-statusbar.c
   trunk/src/gpk-update-viewer.c
   trunk/src/gpk-watch.c

Modified: trunk/.gitignore
==============================================================================
--- trunk/.gitignore	(original)
+++ trunk/.gitignore	Sat Apr 12 18:53:51 2008
@@ -31,4 +31,5 @@
 .svn
 NEWS.new
 packagekit-gnome.pc
+gtk-doc.make
 

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Sat Apr 12 18:53:51 2008
@@ -2,6 +2,7 @@
 	libselftest					\
 	libgbus						\
 	libpackagekit-gnome				\
+	docs						\
 	src						\
 	po						\
 	data						\
@@ -29,5 +30,5 @@
 	intltool-update					\
 	gnome-packagekit-*.tar.gz
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-schemas-install --disable-scrollkeeper
+DISTCHECK_CONFIGURE_FLAGS = --disable-schemas-install --disable-scrollkeeper --enable-gtk-doc
 

Modified: trunk/autogen.sh
==============================================================================
--- trunk/autogen.sh	(original)
+++ trunk/autogen.sh	Sat Apr 12 18:53:51 2008
@@ -19,4 +19,6 @@
     exit 1
 }
 
+(cd $srcdir && gtkdocize) || exit 1
+
 REQUIRED_AUTOMAKE_VERSION=1.7 GNOME_DATADIR="$gnome_datadir" USE_GNOME2_MACROS=1 USE_COMMON_DOC_BUILD=yes . gnome-autogen.sh

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sat Apr 12 18:53:51 2008
@@ -54,6 +54,9 @@
 
 AM_GLIB_GNU_GETTEXT
 
+# set up gtk-doc
+GTK_DOC_CHECK(1.9)
+
 dnl ---------------------------------------------------------------------------
 dnl - Library dependencies
 dnl ---------------------------------------------------------------------------
@@ -201,6 +204,9 @@
 help/Makefile
 po/Makefile.in
 data/Makefile
+docs/Makefile
+docs/api/version.xml
+docs/api/Makefile
 data/icons/Makefile
 data/icons/16x16/Makefile
 data/icons/22x22/Makefile

Modified: trunk/data/gpk-update-viewer.glade
==============================================================================
--- trunk/data/gpk-update-viewer.glade	(original)
+++ trunk/data/gpk-update-viewer.glade	Sat Apr 12 18:53:51 2008
@@ -69,40 +69,50 @@
                     <property name="column_spacing">6</property>
                     <property name="row_spacing">6</property>
                     <child>
-                      <widget class="GtkLabel" id="label_last_update">
+                      <widget class="GtkAlignment" id="alignment1">
                         <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Unknown....</property>
+                        <property name="xalign">1</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">0</property>
+                        <child>
+                          <widget class="GtkButton" id="button_history">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="label" translatable="yes">View History</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                        </child>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label_last_refresh">
+                      <widget class="GtkAlignment" id="alignment_refresh">
                         <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Unknown....</property>
+                        <property name="xalign">1</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">0</property>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
                       </packing>
                     </child>
                     <child>
                       <widget class="GtkLabel" id="label5">
                         <property name="visible">True</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Last update:</property>
+                        <property name="label" translatable="yes">Last refresh:</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
                         <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
@@ -110,48 +120,38 @@
                       <widget class="GtkLabel" id="label5">
                         <property name="visible">True</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Last refresh:</property>
+                        <property name="label" translatable="yes">Last update:</property>
                       </widget>
                       <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
                         <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkAlignment" id="alignment_refresh">
+                      <widget class="GtkLabel" id="label_last_refresh">
                         <property name="visible">True</property>
-                        <property name="xalign">1</property>
-                        <property name="xscale">0</property>
-                        <property name="yscale">0</property>
-                        <child>
-                          <placeholder/>
-                        </child>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Unknown....</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">2</property>
-                        <property name="right_attach">3</property>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkAlignment" id="alignment1">
+                      <widget class="GtkLabel" id="label_last_update">
                         <property name="visible">True</property>
-                        <property name="xalign">1</property>
-                        <property name="xscale">0</property>
-                        <property name="yscale">0</property>
-                        <child>
-                          <widget class="GtkButton" id="button_history">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="label" translatable="yes">View History</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                        </child>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Unknown....</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">2</property>
-                        <property name="right_attach">3</property>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
                   </widget>
@@ -180,6 +180,9 @@
                       </packing>
                     </child>
                     <child>
+                      <placeholder/>
+                    </child>
+                    <child>
                       <widget class="GtkButton" id="button_review">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -222,13 +225,10 @@
                         </child>
                       </widget>
                       <packing>
-                        <property name="position">1</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                     <child>
-                      <placeholder/>
-                    </child>
-                    <child>
                       <widget class="GtkButton" id="button_close3">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>

Modified: trunk/libpackagekit-gnome/Makefile.am
==============================================================================
--- trunk/libpackagekit-gnome/Makefile.am	(original)
+++ trunk/libpackagekit-gnome/Makefile.am	Sat Apr 12 18:53:51 2008
@@ -35,6 +35,8 @@
 	gpk-common.h						\
 	gpk-client.c						\
 	gpk-client.h						\
+	gpk-gnome.c						\
+	gpk-gnome.h						\
 	$(NULL)
 
 libpackagekit_gnome_la_LIBADD =					\

Modified: trunk/libpackagekit-gnome/gpk-client.c
==============================================================================
--- trunk/libpackagekit-gnome/gpk-client.c	(original)
+++ trunk/libpackagekit-gnome/gpk-client.c	Sat Apr 12 18:53:51 2008
@@ -19,9 +19,17 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION:gpk-client
+ * @short_description: GObject class for libpackagekit-gnome client access
+ *
+ * A nice GObject to use for installing software in GNOME applications
+ */
+
 #include "config.h"
 
 #include <glib/gi18n.h>
+#include <glib/gprintf.h>
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 #include <pk-debug.h>
@@ -31,6 +39,7 @@
 
 #include "gpk-client.h"
 #include "gpk-common.h"
+#include "gpk-gnome.h"
 
 static void     gpk_client_class_init	(GpkClientClass *klass);
 static void     gpk_client_init		(GpkClient      *gclient);
@@ -38,7 +47,12 @@
 
 #define GPK_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_CLIENT, GpkClientPrivate))
 
-struct GpkClientPrivate
+/**
+ * GpkClientPrivate:
+ *
+ * Private #GpkClient data
+ **/
+struct _GpkClientPrivate
 {
 	PkClient		*client_action;
 	PkClient		*client_resolve;
@@ -58,6 +72,41 @@
 G_DEFINE_TYPE (GpkClient, gpk_client, G_TYPE_OBJECT)
 
 /**
+ * gpk_client_error_quark:
+ *
+ * Return value: Our personal error quark.
+ **/
+GQuark
+gpk_client_error_quark (void)
+{
+	static GQuark quark = 0;
+	if (!quark) {
+		quark = g_quark_from_static_string ("gpk_client_error");
+	}
+	return quark;
+}
+
+/**
+ * gpk_client_error_get_type:
+ **/
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+GType
+gpk_client_error_get_type (void)
+{
+	static GType etype = 0;
+
+	if (etype == 0) {
+		static const GEnumValue values[] =
+		{
+			ENUM_ENTRY (GPK_CLIENT_ERROR_FAILED, "Failed"),
+			{ 0, NULL, NULL }
+		};
+		etype = g_enum_register_static ("PkClientError", values);
+	}
+	return etype;
+}
+
+/**
  * gpk_client_set_page:
  **/
 static void
@@ -267,7 +316,7 @@
 gpk_client_button_help_cb (GtkWidget *widget, GpkClient *gclient)
 {
 	g_return_if_fail (GPK_IS_CLIENT (gclient));
-	gpk_show_help (NULL);
+	gpk_gnome_help (NULL);
 }
 
 /**
@@ -308,37 +357,78 @@
 }
 
 /**
+ * gpk_client_error_set:
+ *
+ * Sets the correct error code (if allowed) and print to the screen
+ * as a warning.
+ **/
+static gboolean
+gpk_client_error_set (GError **error, gint code, const gchar *format, ...)
+{
+	va_list args;
+	gchar *buffer = NULL;
+	gboolean ret = TRUE;
+
+	va_start (args, format);
+	g_vasprintf (&buffer, format, args);
+	va_end (args);
+
+	/* dumb */
+	if (error == NULL) {
+		pk_warning ("No error set, so can't set: %s", buffer);
+		ret = FALSE;
+		goto out;
+	}
+
+	/* already set */
+	if (*error != NULL) {
+		pk_warning ("not NULL error!");
+		g_clear_error (error);
+	}
+
+	/* propogate */
+	g_set_error (error, GPK_CLIENT_ERROR, code, "%s", buffer);
+
+out:
+	g_free(buffer);
+	return ret;
+}
+
+/**
  * gpk_client_install_local_file:
  * @gclient: a valid #GpkClient instance
- * @file: a file such as "./hal-devel-0.10.0.rpm"
+ * @file_rel: a file such as <literal>./hal-devel-0.10.0.rpm</literal>
+ * @error: a %GError to put the error code and message in, or %NULL
  *
  * Install a file locally, and get the deps from the repositories.
  * This is useful for double clicking on a .rpm or .deb file.
  *
- * Return value: %TRUE if the method is running
+ * Return value: %TRUE if the method succeeded
  **/
 gboolean
-gpk_client_install_local_file (GpkClient *gclient, const gchar *file_rel)
+gpk_client_install_local_file (GpkClient *gclient, const gchar *file_rel, GError **error)
 {
 	gboolean ret;
-	GError *error = NULL;
+	GError *error_local = NULL;
 	gchar *text;
 
 	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 	g_return_val_if_fail (file_rel != NULL, FALSE);
 
-	ret = pk_client_install_file (gclient->priv->client_action, file_rel, &error);
+	ret = pk_client_install_file (gclient->priv->client_action, file_rel, &error_local);
 	if (!ret) {
 		/* check if we got a permission denied */
-		if (g_str_has_prefix (error->message, "org.freedesktop.packagekit.")) {
+		if (g_str_has_prefix (error_local->message, "org.freedesktop.packagekit.")) {
 			gpk_client_error_msg (gclient, _("Failed to install file"),
 					      _("You don't have the necessary privileges to install local files"));
+			gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		} else {
-			text = g_markup_escape_text (error->message, -1);
+			text = g_markup_escape_text (error_local->message, -1);
 			gpk_client_error_msg (gclient, _("Failed to install file"), text);
 			g_free (text);
+			gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		}
-		g_error_free (error);
+		g_error_free (error_local);
 		goto out;
 	}
 
@@ -357,18 +447,19 @@
 /**
  * gpk_client_install_package_id:
  * @gclient: a valid #GpkClient instance
- * @package_id: a package_id such as hal-info;0.20;i386;fedora
+ * @package_id: a package_id such as <literal>hal-info;0.20;i386;fedora</literal>
+ * @error: a %GError to put the error code and message in, or %NULL
  *
- * Return value: %TRUE if the method is running
+ * Return value: %TRUE if the method succeeded
  **/
 gboolean
-gpk_client_install_package_id (GpkClient *gclient, const gchar *package_id)
+gpk_client_install_package_id (GpkClient *gclient, const gchar *package_id, GError **error)
 {
 	GtkWidget *widget;
 	GtkWidget *dialog;
 	GtkResponseType button;
 	gboolean ret;
-	GError *error = NULL;
+	GError *error_local = NULL;
 	gchar *text;
 	guint len;
 	guint i;
@@ -385,25 +476,33 @@
 	}
 
 	/* reset */
-	ret = pk_client_reset (gclient->priv->client_resolve, &error);
+	ret = pk_client_reset (gclient->priv->client_resolve, &error_local);
 	if (!ret) {
 		gpk_client_error_msg (gclient, _("Failed to reset client"), _("Failed to reset resolve"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
 
 	/* find out if this would drag in other packages */
-	ret = pk_client_get_depends (gclient->priv->client_resolve, PK_FILTER_ENUM_NOT_INSTALLED, package_id, TRUE, &error);
+	ret = pk_client_get_depends (gclient->priv->client_resolve, PK_FILTER_ENUM_NOT_INSTALLED, package_id, TRUE, &error_local);
 	if (!ret) {
-		text = g_strdup_printf ("%s: %s", _("Could not work out what packages would be also installed"), error->message);
+		text = g_strdup_printf ("%s: %s", _("Could not work out what packages would be also installed"), error_local->message);
 		gpk_client_error_msg (gclient, _("Failed to get depends"), text);
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		g_free (text);
 		ret = FALSE;
 		goto out;
 	}
 
-	/* process package list */
+	/* any additional packages? */
 	len = pk_client_package_buffer_get_size	(gclient->priv->client_resolve);
+	if (len == 0) {
+		pk_debug ("no additional deps");
+		goto skip_checks;
+	}
+
+	/* process package list */
 	string = g_string_new (_("The following packages also have to be downloaded:"));
 	g_string_append (string, "\n\n");
 	for (i=0; i<len; i++) {
@@ -432,24 +531,27 @@
 	/* did we click no or exit the window? */
 	if (button != GTK_RESPONSE_OK) {
 		gpk_client_error_msg (gclient, _("Failed to install package"), _("Additional packages were not downloaded"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
 
 skip_checks:
 	/* try to install the package_id */
-	ret = pk_client_install_package (gclient->priv->client_action, package_id, &error);
+	ret = pk_client_install_package (gclient->priv->client_action, package_id, &error_local);
 	if (!ret) {
 		/* check if we got a permission denied */
-		if (g_str_has_prefix (error->message, "org.freedesktop.packagekit.")) {
+		if (g_str_has_prefix (error_local->message, "org.freedesktop.packagekit.")) {
 			gpk_client_error_msg (gclient, _("Failed to install package"),
 					        _("You don't have the necessary privileges to install packages"));
+			gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		} else {
-			text = g_markup_escape_text (error->message, -1);
+			text = g_markup_escape_text (error_local->message, -1);
 			gpk_client_error_msg (gclient, _("Failed to install package"), text);
+			gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 			g_free (text);
 		}
-		g_error_free (error);
+		g_error_free (error_local);
 		goto out;
 	}
 
@@ -468,17 +570,18 @@
 /**
  * gpk_client_install_package_name:
  * @gclient: a valid #GpkClient instance
- * @package: a pakage name such as hal-info
+ * @package: a pakage name such as <literal>hal-info</literal>
+ * @error: a %GError to put the error code and message in, or %NULL
  *
  * Install a package of the newest and most correct version.
  *
- * Return value: %TRUE if the method is running
+ * Return value: %TRUE if the method succeeded
  **/
 gboolean
-gpk_client_install_package_name (GpkClient *gclient, const gchar *package)
+gpk_client_install_package_name (GpkClient *gclient, const gchar *package, GError **error)
 {
 	gboolean ret;
-	GError *error = NULL;
+	GError *error_local = NULL;
 	guint len;
 	guint i;
 	gboolean already_installed = FALSE;
@@ -488,9 +591,10 @@
 	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 	g_return_val_if_fail (package != NULL, FALSE);
 
-	ret = pk_client_resolve (gclient->priv->client_resolve, PK_FILTER_ENUM_NONE, package, &error);
+	ret = pk_client_resolve (gclient->priv->client_resolve, PK_FILTER_ENUM_NONE, package, &error_local);
 	if (!ret) {
 		gpk_client_error_msg (gclient, _("Failed to resolve package"), _("Incorrect response from search"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
@@ -499,6 +603,7 @@
 	len = pk_client_package_buffer_get_size	(gclient->priv->client_resolve);
 	if (len == 0) {
 		gpk_client_error_msg (gclient, _("Failed to find package"), _("The package could not be found online"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
@@ -519,6 +624,7 @@
 	/* already installed? */
 	if (already_installed) {
 		gpk_client_error_msg (gclient, _("Failed to install package"), _("The package is already installed"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
@@ -526,12 +632,13 @@
 	/* got junk? */
 	if (package_id == NULL) {
 		gpk_client_error_msg (gclient, _("Failed to find package"), _("Incorrect response from search"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
 
 	/* install this specific package */
-	ret = gpk_client_install_package_id (gclient, package_id);
+	ret = gpk_client_install_package_id (gclient, package_id, error);
 out:
 	g_free (package_id);
 	return ret;
@@ -540,17 +647,18 @@
 /**
  * gpk_client_install_provide_file:
  * @gclient: a valid #GpkClient instance
- * @full_path: a file path name such as /usr/sbin/packagekitd
+ * @full_path: a file path name such as <literal>/usr/sbin/packagekitd</literal>
+ * @error: a %GError to put the error code and message in, or %NULL
  *
  * Install a package which provides a file on the system.
  *
- * Return value: %TRUE if the method is running
+ * Return value: %TRUE if the method succeeded
  **/
 gboolean
-gpk_client_install_provide_file (GpkClient *gclient, const gchar *full_path)
+gpk_client_install_provide_file (GpkClient *gclient, const gchar *full_path, GError **error)
 {
 	gboolean ret;
-	GError *error = NULL;
+	GError *error_local = NULL;
 	guint len;
 	guint i;
 	gboolean already_installed = FALSE;
@@ -562,11 +670,11 @@
 	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
 	g_return_val_if_fail (full_path != NULL, FALSE);
 
-
-	ret = pk_client_search_file (gclient->priv->client_resolve, PK_FILTER_ENUM_NONE, full_path, &error);
+	ret = pk_client_search_file (gclient->priv->client_resolve, PK_FILTER_ENUM_NONE, full_path, &error_local);
 	if (!ret) {
-		text = g_strdup_printf ("%s: %s", _("Incorrect response from search"), error->message);
+		text = g_strdup_printf ("%s: %s", _("Incorrect response from search"), error_local->message);
 		gpk_client_error_msg (gclient, _("Failed to search for file"), text);
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		g_free (text);
 		ret = FALSE;
 		goto out;
@@ -576,6 +684,7 @@
 	len = pk_client_package_buffer_get_size	(gclient->priv->client_resolve);
 	if (len == 0) {
 		gpk_client_error_msg (gclient, _("Failed to find package"), _("The file could not be found in any packages"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
@@ -599,6 +708,7 @@
 		ident = pk_package_id_new_from_string (package_id);
 		text = g_strdup_printf (_("The %s package already provides the file %s"), ident->name, full_path);
 		gpk_client_error_msg (gclient, _("Failed to install file"), text);
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		g_free (text);
 		pk_package_id_free (ident);
 		ret = FALSE;
@@ -608,12 +718,13 @@
 	/* got junk? */
 	if (package_id == NULL) {
 		gpk_client_error_msg (gclient, _("Failed to install file"), _("Incorrect response from file search"));
+		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
 		ret = FALSE;
 		goto out;
 	}
 
 	/* install this specific package */
-	ret = gpk_client_install_package_id (gclient, package_id);
+	ret = gpk_client_install_package_id (gclient, package_id, error);
 out:
 	g_free (package_id);
 	return ret;
@@ -621,7 +732,7 @@
 
 /**
  * gpk_client_class_init:
- * @klass: The GpkClientClass
+ * @klass: The #GpkClientClass
  **/
 static void
 gpk_client_class_init (GpkClientClass *klass)
@@ -633,7 +744,7 @@
 
 /**
  * gpk_client_init:
- * @client: This class instance
+ * @gclient: a valid #GpkClient instance
  **/
 static void
 gpk_client_init (GpkClient *gclient)
@@ -735,7 +846,9 @@
 /**
  * gpk_client_new:
  *
- * Return value: a new GpkClient object.
+ * PkClient is a nice GObject wrapper for gnome-packagekit and makes installing software easy
+ *
+ * Return value: A new %GpkClient instance
  **/
 GpkClient *
 gpk_client_new (void)

Modified: trunk/libpackagekit-gnome/gpk-client.h
==============================================================================
--- trunk/libpackagekit-gnome/gpk-client.h	(original)
+++ trunk/libpackagekit-gnome/gpk-client.h	Sat Apr 12 18:53:51 2008
@@ -36,33 +36,51 @@
 #define GPK_CLIENT_ERROR	(gpk_client_error_quark ())
 #define GPK_CLIENT_TYPE_ERROR	(gpk_client_error_get_type ())
 
-typedef struct GpkClientPrivate GpkClientPrivate;
+/**
+ * GpkClientError:
+ * @GPK_CLIENT_ERROR_FAILED: the transaction failed for an unknown reason
+ *
+ * Errors that can be thrown
+ */
+typedef enum
+{
+	GPK_CLIENT_ERROR_FAILED
+} GpkClientError;
+
+typedef struct _GpkClientPrivate	 GpkClientPrivate;
+typedef struct _GpkClient		 GpkClient;
+typedef struct _GpkClientClass		 GpkClientClass;
 
-typedef struct
+struct _GpkClient
 {
-	 GObject		 parent;
-	 GpkClientPrivate	*priv;
-} GpkClient;
+	GObject				 parent;
+	GpkClientPrivate		*priv;
+};
 
-typedef struct
+struct _GpkClientClass
 {
 	GObjectClass	parent_class;
-} GpkClientClass;
+};
 
+GQuark		 gpk_client_error_quark			(void);
 GType		 gpk_client_get_type			(void) G_GNUC_CONST;
 GpkClient	*gpk_client_new				(void);
 
 gboolean	 gpk_client_install_local_file		(GpkClient	*gclient,
-							 const gchar	*file_rel)
+							 const gchar	*file_rel,
+							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 gpk_client_install_provide_file	(GpkClient	*gclient,
-							 const gchar	*full_path)
+							 const gchar	*full_path,
+							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 gpk_client_install_package_name	(GpkClient	*gclient,
-							 const gchar	*package)
+							 const gchar	*package,
+							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 gpk_client_install_package_id		(GpkClient	*gclient,
-							 const gchar	*package_id)
+							 const gchar	*package_id,
+							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 
 G_END_DECLS

Modified: trunk/libpackagekit-gnome/gpk-common.c
==============================================================================
--- trunk/libpackagekit-gnome/gpk-common.c	(original)
+++ trunk/libpackagekit-gnome/gpk-common.c	Sat Apr 12 18:53:51 2008
@@ -160,231 +160,6 @@
 	{0, NULL}
 };
 
-static gboolean
-try_system_restart (DBusGProxy *proxy, GError **error)
-{
-	return dbus_g_proxy_call_with_timeout (proxy, "Restart", INT_MAX,
-					       error, G_TYPE_INVALID, G_TYPE_INVALID);
-}
-
-static PolKitAction *
-get_action_from_error (GError *error)
-{
-	PolKitAction *action;
-	gchar *paction, *p;
-
-	action = polkit_action_new ();
-
-	paction = NULL;
-	if (g_str_has_prefix (error->message, "Not privileged for action: ")) {
-		paction = g_strdup (error->message + strlen ("Not privileged for action: "));
-		p = strchr (paction, ' ');
-		if (p)
-			*p = '\0';
-	}
-	polkit_action_set_action_id (action, paction);
-
-	g_free (paction);
-
-	return action;
-}
-
-static PolKitResult
-get_result_from_error (GError *error)
-{
-	PolKitResult result = POLKIT_RESULT_UNKNOWN;
-	const char *p;
-
-	p = strrchr (error->message, ' ');
-	if (p) {
-		p++;
-		polkit_result_from_string_representation (p, &result);
-	}
-
-	return result;
-}
-
-static void
-system_restart_auth_cb (PolKitAction *action, gboolean gained_privilege,
-			GError *error, DBusGProxy *proxy)
-{
-	GError *local_error;
-	gboolean res;
-
-	if (!gained_privilege) {
-		if (error != NULL) {
-			pk_warning ("Not privileged to restart system: %s", error->message);
-		}
-		return;
-	}
-
-        local_error = NULL;
-        res = try_system_restart (proxy, &local_error);
-        if (!res) {
-                pk_warning ("Unable to restart system: %s", local_error->message);
-                g_error_free (local_error);
-        }
-}
-
-static gboolean
-request_restart_priv (DBusGProxy *proxy, PolKitAction *action, GError **error)
-{
-        guint xid;
-        pid_t pid;
-
-        xid = 0;
-        pid = getpid ();
-
-	return polkit_gnome_auth_obtain (action, xid, pid,
-					 (PolKitGnomeAuthCB) system_restart_auth_cb,
-					 proxy, error);
-}
-
-/**
- * gpk_restart_system:
- **/
-gboolean
-gpk_restart_system (void)
-{
-	DBusGProxy *proxy;
-	DBusGConnection *connection;
-	GError *error = NULL;
-	gboolean ret;
-	PolKitAction *action;
-	PolKitAction *action2;
-	PolKitResult result;
-
-	/* check dbus connections, exit if not valid */
-	connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
-	if (error != NULL) {
-		pk_warning ("cannot acccess the system bus: %s", error->message);
-		g_error_free (error);
-		return FALSE;
-	}
-
-	/* get a connection */
-	proxy = dbus_g_proxy_new_for_name (connection,
-					   "org.freedesktop.ConsoleKit",
-					   "/org/freedesktop/ConsoleKit/Manager",
-					   "org.freedesktop.ConsoleKit.Manager");
-	if (proxy == NULL) {
-		pk_warning ("Cannot connect to ConsoleKit");
-		return FALSE;
-	}
-
-	/* do the method */
-	ret = try_system_restart (proxy, &error);
-	if (!ret) {
-		if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
-			action = get_action_from_error (error);
-			result = get_result_from_error (error);
-
-			if (result == POLKIT_RESULT_NO) {
-				action2 = polkit_action_new ();
-				polkit_action_set_action_id (action2,
-							     "org.freedesktop.consolekit.system.restart-multiple-users");
-				if (polkit_action_equal (action, action2)) {
-					gpk_error_modal_dialog (_("Failed to restart"),
-								_("You are not allowed to restart the computer "
-								  "because multiple users are logged in"));
-				}
-
-				g_error_free (error);
-
-				polkit_action_unref (action);
-				polkit_action_unref (action2);
-
-				return FALSE;
-			}
-			g_clear_error (&error);
-			ret = request_restart_priv (proxy, action, &error);
-			polkit_action_unref (action);
-		}
-		if (!ret) {
-			pk_warning ("Unable to restart system: %s", error->message);
-			g_error_free (error);
-		}
-	}
-
-	g_object_unref (G_OBJECT (proxy));
-
-	return ret;
-}
-
-/**
- * gpk_execute_url:
- **/
-gboolean
-gpk_execute_url (const gchar *url)
-{
-	gchar *data;
-	gboolean ret;
-
-	g_return_val_if_fail (url != NULL, FALSE);
-
-	data = g_strconcat ("gnome-open ", url, NULL);
-	ret = g_spawn_command_line_async (data, NULL);
-	if (ret == FALSE) {
-		pk_warning ("spawn of '%s' failed", data);
-	}
-	g_free (data);
-	return ret;
-}
-
-/**
- * gpk_show_help:
- * @link_id: Subsection of gnome-packagekit help file, or NULL.
- **/
-gboolean
-gpk_show_help (const gchar *link_id)
-{
-	GError *error = NULL;
-	gchar *command;
-	const gchar *lang;
-	gchar *uri = NULL;
-	GdkScreen *gscreen;
-	gint i;
-	gboolean ret = TRUE;
-	const gchar *const *langs = g_get_language_names ();
-
-	for (i = 0; langs[i]; i++) {
-		lang = langs[i];
-		if (strchr (lang, '.')) {
-			continue;
-		}
-		uri = g_build_filename(DATADIR,
-				       "/gnome/help/gnome-packagekit/",
-					lang,
-				       "/gnome-packagekit.xml",
-					NULL);
-		if (g_file_test (uri, G_FILE_TEST_EXISTS)) {
-                    break;
-		}
-	}
-	if (link_id) {
-		command = g_strconcat ("gnome-open ghelp://", uri, "?", link_id, NULL);
-	} else {
-		command = g_strconcat ("gnome-open ghelp://", uri,  NULL);
-	}
-	pk_debug ("using command %s", command);
-
-	gscreen = gdk_screen_get_default();
-	gdk_spawn_command_line_on_screen (gscreen, command, &error);
-	if (error != NULL) {
-		GtkWidget *d;
-		d = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-					    GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", error->message);
-		gtk_dialog_run (GTK_DIALOG(d));
-		gtk_widget_destroy (d);
-		g_error_free (error);
-		ret = FALSE;
-	}
-
-	g_free (command);
-	g_free (uri);
-	return ret;
-}
-
 /**
  * gpk_size_to_si_size_text:
  **/
@@ -535,40 +310,6 @@
 }
 
 /**
- * gpk_icon_valid:
- *
- * Check icon actually exists and is valid in this theme
- **/
-gboolean
-gpk_icon_valid (const gchar *icon)
-{
-	GtkIconInfo *icon_info;
-	static GtkIconTheme *icon_theme = NULL;
-	gboolean ret = TRUE;
-
-	/* trivial case */
-	if (pk_strzero (icon)) {
-		return FALSE;
-	}
-
-	/* no unref required */
-	if (icon_theme == NULL) {
-		icon_theme = gtk_icon_theme_get_default ();
-	}
-
-	/* default to 32x32 */
-	icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon, 32, GTK_ICON_LOOKUP_USE_BUILTIN);
-	if (icon_info == NULL) {
-		pk_debug ("ignoring broken icon %s", icon);
-		ret = FALSE;
-	} else {
-		/* we only used this to see if it was valid */
-		gtk_icon_info_free (icon_info);
-	}
-	return ret;
-}
-
-/**
  * gpk_error_modal_dialog:
  *
  * Shows a modal error, and blocks until the user clicks close
@@ -1360,7 +1101,6 @@
 /**
  * gpk_time_to_localised_string:
  * @time_secs: The time value to convert in seconds
- * @cookie: The cookie we are looking for
  *
  * Returns a localised timestring
  *

Modified: trunk/libpackagekit-gnome/gpk-common.h
==============================================================================
--- trunk/libpackagekit-gnome/gpk-common.h	(original)
+++ trunk/libpackagekit-gnome/gpk-common.h	Sat Apr 12 18:53:51 2008
@@ -19,17 +19,14 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef __PK_COMMON_GUI_H
-#define __PK_COMMON_GUI_H
+#ifndef __GPK_COMMON_H
+#define __GPK_COMMON_H
 
 #include <glib-object.h>
 #include <pk-enum.h>
 
 G_BEGIN_DECLS
 
-#define GPK_PROGRESS_BAR_PULSE_DELAY		50
-#define GPK_PROGRESS_BAR_PULSE_STEP		0.05
-
 #define GPK_CONF_NOTIFY_COMPLETED		"/apps/gnome-packagekit/notify_complete"
 #define GPK_CONF_NOTIFY_AVAILABLE		"/apps/gnome-packagekit/notify_available"
 #define GPK_CONF_NOTIFY_CRITICAL		"/apps/gnome-packagekit/notify_critical"
@@ -49,28 +46,15 @@
 #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 GS_DBUS_SERVICE				"org.gnome.ScreenSaver"
-#define GS_DBUS_PATH				"/org/gnome/ScreenSaver"
-#define GS_DBUS_INTERFACE			"org.gnome.ScreenSaver"
-
-#define GPM_DBUS_SERVICE			"org.freedesktop.PowerManagement"
-#define GPM_DBUS_PATH				"/org/freedesktop/PowerManagement"
-#define GPM_DBUS_PATH_INHIBIT			"/org/freedesktop/PowerManagement/Inhibit"
-#define GPM_DBUS_INTERFACE			"org.freedesktop.PowerManagement"
-#define GPM_DBUS_INTERFACE_INHIBIT		"org.freedesktop.PowerManagement.Inhibit"
-
 gchar		*gpk_package_get_name			(const gchar	*package_id);
 gchar		*gpk_package_id_pretty			(const gchar	*package_id,
 							 const gchar	*summary);
 gchar		*gpk_package_id_pretty_oneline		(const gchar	*package_id,
 							 const gchar	*summary);
 gchar		*gpk_package_id_name_version		(const gchar	*package_id);
-gboolean	 gpk_icon_valid				(const gchar	*icon);
 gboolean	 gpk_error_modal_dialog			(const gchar	*title,
 							 const gchar	*message);
-gboolean	 gpk_execute_url			(const gchar	*url);
-gboolean	 gpk_show_help				(const gchar	*link_id);
-gboolean	 gpk_restart_system			(void);
+
 const gchar	*gpk_role_enum_to_localised_past	(PkRoleEnum	 role)
 							 G_GNUC_CONST;
 const gchar	*gpk_role_enum_to_localised_present	(PkRoleEnum	 role)
@@ -104,4 +88,4 @@
 
 G_END_DECLS
 
-#endif	/* __PK_COMMON_GUI_H */
+#endif	/* __GPK_COMMON_H */

Added: trunk/libpackagekit-gnome/gpk-gnome.c
==============================================================================
--- (empty file)
+++ trunk/libpackagekit-gnome/gpk-gnome.c	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,104 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <string.h>
+
+#include <pk-debug.h>
+
+/**
+ * gpk_gnome_open:
+ * @url: a url such as <literal>http://www.hughsie.com</literal>
+ **/
+gboolean
+gpk_gnome_open (const gchar *url)
+{
+	gchar *data;
+	gboolean ret;
+
+	g_return_val_if_fail (url != NULL, FALSE);
+
+	data = g_strconcat ("gnome-open ", url, NULL);
+	ret = g_spawn_command_line_async (data, NULL);
+	if (ret == FALSE) {
+		pk_warning ("spawn of '%s' failed", data);
+	}
+	g_free (data);
+	return ret;
+}
+
+/**
+ * gpk_gnome_help:
+ * @link_id: Subsection of gnome-packagekit help file, or %NULL.
+ **/
+gboolean
+gpk_gnome_help (const gchar *link_id)
+{
+	GError *error = NULL;
+	gchar *command;
+	const gchar *lang;
+	gchar *uri = NULL;
+	GdkScreen *gscreen;
+	gint i;
+	gboolean ret = TRUE;
+	const gchar *const *langs = g_get_language_names ();
+
+	for (i = 0; langs[i]; i++) {
+		lang = langs[i];
+		if (strchr (lang, '.')) {
+			continue;
+		}
+		uri = g_build_filename(DATADIR,
+				       "/gnome/help/gnome-packagekit/",
+					lang,
+				       "/gnome-packagekit.xml",
+					NULL);
+		if (g_file_test (uri, G_FILE_TEST_EXISTS)) {
+                    break;
+		}
+	}
+	if (link_id) {
+		command = g_strconcat ("gnome-open ghelp://", uri, "?", link_id, NULL);
+	} else {
+		command = g_strconcat ("gnome-open ghelp://", uri,  NULL);
+	}
+	pk_debug ("using command %s", command);
+
+	gscreen = gdk_screen_get_default();
+	gdk_spawn_command_line_on_screen (gscreen, command, &error);
+	if (error != NULL) {
+		GtkWidget *d;
+		d = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+					    GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", error->message);
+		gtk_dialog_run (GTK_DIALOG(d));
+		gtk_widget_destroy (d);
+		g_error_free (error);
+		ret = FALSE;
+	}
+
+	g_free (command);
+	g_free (uri);
+	return ret;
+}
+

Added: trunk/libpackagekit-gnome/gpk-gnome.h
==============================================================================
--- (empty file)
+++ trunk/libpackagekit-gnome/gpk-gnome.h	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GPK_GNOME_H
+#define __GPK_GNOME_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean	 gpk_gnome_open				(const gchar	*url);
+gboolean	 gpk_gnome_help				(const gchar	*link_id);
+
+G_END_DECLS
+
+#endif	/* __GPK_GNOME_H */

Added: trunk/packagekit-gnome.pc.in
==============================================================================
--- (empty file)
+++ trunk/packagekit-gnome.pc.in	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,13 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: packagekit
+Description: packagekit-gnome is a library that lets you install things in GNOME.
+Version: @VERSION@
+Requires.private: dbus-1, gthread-2.0
+Requires: glib-2.0, gobject-2.0
+Libs: -L${libdir} -lpackagekit-gnome
+Cflags: -I${includedir}/packagekit-gnome
+

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Sat Apr 12 18:53:51 2008
@@ -37,4 +37,5 @@
 src/gpk-update-icon.c
 src/gpk-update-viewer.c
 src/gpk-watch.c
+src/gpk-consolekit.c
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sat Apr 12 18:53:51 2008
@@ -105,6 +105,8 @@
 	gpk-smart-icon.h				\
 	gpk-marshal.c					\
 	gpk-marshal.h					\
+	gpk-consolekit.c				\
+	gpk-consolekit.h				\
 	gpk-progress.c					\
 	gpk-progress.h					\
 	$(NULL)
@@ -160,6 +162,8 @@
 	gpk-update-viewer.c				\
 	gpk-statusbar.c					\
 	gpk-statusbar.h					\
+	gpk-consolekit.c				\
+	gpk-consolekit.h				\
 	gpk-cell-renderer-uri.c				\
 	gpk-cell-renderer-uri.h				\
 	$(NULL)

Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c	(original)
+++ trunk/src/gpk-application.c	Sat Apr 12 18:53:51 2008
@@ -30,7 +30,7 @@
 #include <libsexy/sexy-icon-entry.h>
 #include <math.h>
 #include <string.h>
-
+#include <locale.h>
 #include <polkit-gnome/polkit-gnome.h>
 
 #include <pk-debug.h>
@@ -42,11 +42,12 @@
 #include <pk-package-id.h>
 #include <pk-extra.h>
 #include <pk-extra-obj.h>
-#include <locale.h>
+
+#include <gpk-client.h>
+#include <gpk-common.h>
+#include <gpk-gnome.h>
 
 #include "gpk-statusbar.h"
-#include "gpk-client.h"
-#include "gpk-common.h"
 #include "gpk-application.h"
 
 static void     gpk_application_class_init (GpkApplicationClass *klass);
@@ -66,6 +67,7 @@
 typedef enum {
 	PK_MODE_NAME_DETAILS_FILE,
 	PK_MODE_GROUP,
+	PK_MODE_ALL_PACKAGES,
 	PK_MODE_UNKNOWN
 } PkSearchMode;
 
@@ -191,7 +193,7 @@
 
 	/* xxx TODO: this is hacky code for testing only */
 	gclient = gpk_client_new ();
-	ret = gpk_client_install_package_id (gclient, package_id);
+	ret = gpk_client_install_package_id (gclient, package_id, NULL);
 	g_object_unref (gclient);
 
 	return ret;
@@ -241,7 +243,7 @@
 		            GpkApplication  *application)
 {
 	g_return_if_fail (PK_IS_APPLICATION (application));
-	gpk_execute_url (application->priv->url);
+	gpk_gnome_open (application->priv->url);
 }
 
 /**
@@ -499,6 +501,40 @@
 }
 
 /**
+ * gpk_icon_valid:
+ *
+ * Check icon actually exists and is valid in this theme
+ **/
+gboolean
+gpk_icon_valid (const gchar *icon)
+{
+	GtkIconInfo *icon_info;
+	static GtkIconTheme *icon_theme = NULL;
+	gboolean ret = TRUE;
+
+	/* trivial case */
+	if (pk_strzero (icon)) {
+		return FALSE;
+	}
+
+	/* no unref required */
+	if (icon_theme == NULL) {
+		icon_theme = gtk_icon_theme_get_default ();
+	}
+
+	/* default to 32x32 */
+	icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon, 32, GTK_ICON_LOOKUP_USE_BUILTIN);
+	if (icon_info == NULL) {
+		pk_debug ("ignoring broken icon %s", icon);
+		ret = FALSE;
+	} else {
+		/* we only used this to see if it was valid */
+		gtk_icon_info_free (icon_info);
+	}
+	return ret;
+}
+
+/**
  * gpk_application_package_cb:
  **/
 static void
@@ -803,10 +839,10 @@
 }
 
 /**
- * gpk_application_perform_search_group:
+ * gpk_application_perform_search_others:
  **/
 static gboolean
-gpk_application_perform_search_group (GpkApplication *application)
+gpk_application_perform_search_others (GpkApplication *application)
 {
 	GtkWidget *widget;
 	gboolean ret;
@@ -826,7 +862,14 @@
 	/* refresh the search as the items may have changed */
 	gtk_list_store_clear (application->priv->packages_store);
 
-	ret = pk_client_search_group (application->priv->client_search, application->priv->filters_current, application->priv->group, &error);
+	if (application->priv->search_mode == PK_MODE_GROUP) {
+		ret = pk_client_search_group (application->priv->client_search,
+					      application->priv->filters_current,
+					      application->priv->group, &error);
+	} else {
+		ret = pk_client_get_packages (application->priv->client_search,
+					      application->priv->filters_current, &error);
+	}
 	/* ick, we failed so pretend we didn't do the action */
 	if (ret) {
 		/* switch around buttons */
@@ -853,8 +896,9 @@
 	gboolean ret = FALSE;
 	if (application->priv->search_mode == PK_MODE_NAME_DETAILS_FILE) {
 		ret = gpk_application_perform_search_name_details_file (application);
-	} else if (application->priv->search_mode == PK_MODE_GROUP) {
-		ret = gpk_application_perform_search_group (application);
+	} else if (application->priv->search_mode == PK_MODE_GROUP ||
+		   application->priv->search_mode == PK_MODE_ALL_PACKAGES) {
+		ret = gpk_application_perform_search_others (application);
 	} else {
 		pk_debug ("doing nothing");
 	}
@@ -1027,8 +1071,14 @@
 		gtk_tree_model_get (model, &iter, GROUPS_COLUMN_ID, &application->priv->group, -1);
 		pk_debug ("selected row is: %s", application->priv->group);
 
+		/* GetPackages? */
+		if (pk_strequal (application->priv->group, "all-packages")) {
+			application->priv->search_mode = PK_MODE_ALL_PACKAGES;
+		} else {
+			application->priv->search_mode = PK_MODE_GROUP;
+		}
+
 		/* actually do the search */
-		application->priv->search_mode = PK_MODE_GROUP;
 		gpk_application_perform_search (application);
 	}
 }
@@ -1516,7 +1566,7 @@
 static void
 gpk_application_menu_help_cb (GtkAction *action, GpkApplication *application)
 {
-	gpk_show_help ("add-remove");
+	gpk_gnome_help ("add-remove");
 }
 
 /**
@@ -2356,6 +2406,18 @@
 	/* add columns to the tree view */
 	gpk_application_packages_add_columns (GTK_TREE_VIEW (widget));
 
+	/* add an "all" entry if we can GetPackages */
+	if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_GET_PACKAGES)) {
+		GtkTreeIter iter;
+		const gchar *icon_name;
+		gtk_list_store_append (application->priv->groups_store, &iter);
+		icon_name = gpk_role_enum_to_icon_name (PK_ROLE_ENUM_GET_PACKAGES);
+		gtk_list_store_set (application->priv->groups_store, &iter,
+				    GROUPS_COLUMN_NAME, _("All packages"),
+				    GROUPS_COLUMN_ID, "all-packages",
+				    GROUPS_COLUMN_ICON, icon_name, -1);
+	}
+
 	/* create group tree view if we can search by group */
 	if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_SEARCH_GROUP)) {
 		widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");

Modified: trunk/src/gpk-auto-refresh.c
==============================================================================
--- trunk/src/gpk-auto-refresh.c	(original)
+++ trunk/src/gpk-auto-refresh.c	Sat Apr 12 18:53:51 2008
@@ -50,6 +50,16 @@
 #define GPK_AUTO_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_AUTO_REFRESH, GpkAutoRefreshPrivate))
 #define GPK_AUTO_REFRESH_PERIODIC_CHECK		60*60	/* force check for updates every this much time */
 
+#define GS_DBUS_SERVICE				"org.gnome.ScreenSaver"
+#define GS_DBUS_PATH				"/org/gnome/ScreenSaver"
+#define GS_DBUS_INTERFACE			"org.gnome.ScreenSaver"
+
+#define GPM_DBUS_SERVICE			"org.freedesktop.PowerManagement"
+#define GPM_DBUS_PATH				"/org/freedesktop/PowerManagement"
+#define GPM_DBUS_PATH_INHIBIT			"/org/freedesktop/PowerManagement/Inhibit"
+#define GPM_DBUS_INTERFACE			"org.freedesktop.PowerManagement"
+#define GPM_DBUS_INTERFACE_INHIBIT		"org.freedesktop.PowerManagement.Inhibit"
+
 /*
  * at startup, after a small delay, force a GetUpdates call
  * every hour (or any event) check:

Added: trunk/src/gpk-consolekit.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-consolekit.c	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,201 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <string.h>
+#include <unistd.h>
+#include <dbus/dbus-glib.h>
+#include <polkit-gnome/polkit-gnome.h>
+
+#include <pk-debug.h>
+#include <gpk-common.h>
+
+/**
+ * gpk_consolekit_try_system_restart:
+ **/
+static gboolean
+gpk_consolekit_try_system_restart (DBusGProxy *proxy, GError **error)
+{
+	return dbus_g_proxy_call_with_timeout (proxy, "Restart", INT_MAX,
+					       error, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+/**
+ * gpk_consolekit_get_action_from_error:
+ **/
+static PolKitAction *
+gpk_consolekit_get_action_from_error (GError *error)
+{
+	PolKitAction *action;
+	gchar *paction, *p;
+
+	action = polkit_action_new ();
+
+	paction = NULL;
+	if (g_str_has_prefix (error->message, "Not privileged for action: ")) {
+		paction = g_strdup (error->message + strlen ("Not privileged for action: "));
+		p = strchr (paction, ' ');
+		if (p)
+			*p = '\0';
+	}
+	polkit_action_set_action_id (action, paction);
+
+	g_free (paction);
+
+	return action;
+}
+
+/**
+ * gpk_consolekit_get_result_from_error:
+ **/
+static PolKitResult
+gpk_consolekit_get_result_from_error (GError *error)
+{
+	PolKitResult result = POLKIT_RESULT_UNKNOWN;
+	const char *p;
+
+	p = strrchr (error->message, ' ');
+	if (p) {
+		p++;
+		polkit_result_from_string_representation (p, &result);
+	}
+
+	return result;
+}
+
+/**
+ * gpk_consolekit_system_restart_auth_cb:
+ **/
+static void
+gpk_consolekit_system_restart_auth_cb (PolKitAction *action, gboolean gained_privilege,
+				       GError *error, DBusGProxy *proxy)
+{
+	GError *local_error;
+	gboolean res;
+
+	if (!gained_privilege) {
+		if (error != NULL) {
+			pk_warning ("Not privileged to restart system: %s", error->message);
+		}
+		return;
+	}
+
+        local_error = NULL;
+        res = gpk_consolekit_try_system_restart (proxy, &local_error);
+        if (!res) {
+                pk_warning ("Unable to restart system: %s", local_error->message);
+                g_error_free (local_error);
+        }
+}
+
+/**
+ * gpk_consolekit_request_restart_priv:
+ **/
+static gboolean
+gpk_consolekit_request_restart_priv (DBusGProxy *proxy, PolKitAction *action, GError **error)
+{
+        guint xid;
+        pid_t pid;
+
+        xid = 0;
+        pid = getpid ();
+
+	return polkit_gnome_auth_obtain (action, xid, pid,
+					 (PolKitGnomeAuthCB) gpk_consolekit_system_restart_auth_cb,
+					 proxy, error);
+}
+
+/**
+ * gpk_restart_system:
+ *
+ * Return value: if we succeeded
+ **/
+gboolean
+gpk_restart_system (void)
+{
+	DBusGProxy *proxy;
+	DBusGConnection *connection;
+	GError *error = NULL;
+	gboolean ret;
+	PolKitAction *action;
+	PolKitAction *action2;
+	PolKitResult result;
+
+	/* check dbus connections, exit if not valid */
+	connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+	if (error != NULL) {
+		pk_warning ("cannot acccess the system bus: %s", error->message);
+		g_error_free (error);
+		return FALSE;
+	}
+
+	/* get a connection */
+	proxy = dbus_g_proxy_new_for_name (connection,
+					   "org.freedesktop.ConsoleKit",
+					   "/org/freedesktop/ConsoleKit/Manager",
+					   "org.freedesktop.ConsoleKit.Manager");
+	if (proxy == NULL) {
+		pk_warning ("Cannot connect to ConsoleKit");
+		return FALSE;
+	}
+
+	/* do the method */
+	ret = gpk_consolekit_try_system_restart (proxy, &error);
+	if (!ret) {
+		if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
+			action = gpk_consolekit_get_action_from_error (error);
+			result = gpk_consolekit_get_result_from_error (error);
+
+			if (result == POLKIT_RESULT_NO) {
+				action2 = polkit_action_new ();
+				polkit_action_set_action_id (action2,
+							     "org.freedesktop.consolekit.system.restart-multiple-users");
+				if (polkit_action_equal (action, action2)) {
+					gpk_error_modal_dialog (_("Failed to restart"),
+								_("You are not allowed to restart the computer "
+								  "because multiple users are logged in"));
+				}
+
+				g_error_free (error);
+
+				polkit_action_unref (action);
+				polkit_action_unref (action2);
+
+				return FALSE;
+			}
+			g_clear_error (&error);
+			ret = gpk_consolekit_request_restart_priv (proxy, action, &error);
+			polkit_action_unref (action);
+		}
+		if (!ret) {
+			pk_warning ("Unable to restart system: %s", error->message);
+			g_error_free (error);
+		}
+	}
+
+	g_object_unref (G_OBJECT (proxy));
+
+	return ret;
+}
+

Added: trunk/src/gpk-consolekit.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-consolekit.h	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GPK_CONSOLEKIT_H
+#define __GPK_CONSOLEKIT_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean	 gpk_restart_system			(void);
+
+G_END_DECLS
+
+#endif	/* __GPK_CONSOLEKIT_H */

Modified: trunk/src/gpk-inhibit.c
==============================================================================
--- trunk/src/gpk-inhibit.c	(original)
+++ trunk/src/gpk-inhibit.c	Sat Apr 12 18:53:51 2008
@@ -47,6 +47,10 @@
 
 #define GPK_INHIBIT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_INHIBIT, GpkInhibitPrivate))
 
+#define GPM_DBUS_SERVICE			"org.freedesktop.PowerManagement"
+#define GPM_DBUS_PATH_INHIBIT			"/org/freedesktop/PowerManagement/Inhibit"
+#define GPM_DBUS_INTERFACE_INHIBIT		"org.freedesktop.PowerManagement.Inhibit"
+
 struct GpkInhibitPrivate
 {
 	DBusGProxy		*proxy_gpm;

Added: trunk/src/gpk-install-local-file.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-install-local-file.c	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,88 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007-2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <locale.h>
+
+#include <pk-debug.h>
+
+#include "gpk-common.h"
+#include "gpk-client.h"
+
+/**
+ * main:
+ **/
+int
+main (int argc, char *argv[])
+{
+	GOptionContext *context;
+	gboolean ret;
+	gboolean verbose = FALSE;
+	GError *error;
+	GpkClient *gclient;
+
+	const GOptionEntry options[] = {
+		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
+		  N_("Show extra debugging information"), 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);
+	}
+	g_type_init ();
+
+	g_set_application_name (_("PackageKit File Installer"));
+	context = g_option_context_new ("gpk-install-file");
+	g_option_context_set_summary (context, _("PackageKit File Installer"));
+	g_option_context_add_main_entries (context, options, NULL);
+	g_option_context_parse (context, &argc, &argv, NULL);
+	g_option_context_free (context);
+
+	pk_debug_init (verbose);
+	gtk_init (&argc, &argv);
+
+	if (argc < 2) {
+		gpk_error_modal_dialog (_("Failed to install"), _("You need to specify a file to install"));
+		return 1;
+	}
+	if (argc > 2) {
+		gpk_error_modal_dialog (_("Failed to install files"), _("You can only specify one file to install"));
+		return 1;
+	}
+
+	error = NULL;
+	gclient = gpk_client_new ();
+	ret = gpk_client_install_local_file (gclient, argv[1], NULL);
+	g_object_unref (gclient);
+
+	return !ret;
+}

Added: trunk/src/gpk-install-package-name.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-install-package-name.c	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,88 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007-2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <locale.h>
+
+#include <pk-debug.h>
+
+#include "gpk-common.h"
+#include "gpk-client.h"
+
+/**
+ * main:
+ **/
+int
+main (int argc, char *argv[])
+{
+	GOptionContext *context;
+	gboolean ret;
+	gboolean verbose = FALSE;
+	GError *error;
+	GpkClient *gclient;
+
+	const GOptionEntry options[] = {
+		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
+		  N_("Show extra debugging information"), 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);
+	}
+	g_type_init ();
+
+	g_set_application_name (_("PackageKit Package Installer"));
+	context = g_option_context_new ("gpk-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);
+	g_option_context_free (context);
+
+	pk_debug_init (verbose);
+	gtk_init (&argc, &argv);
+
+	if (argc < 2) {
+		gpk_error_modal_dialog (_("Failed to install"), _("You need to specify a package to install"));
+		return 1;
+	}
+	if (argc > 2) {
+		gpk_error_modal_dialog (_("Failed to install packages"), _("You can only specify one package name to install"));
+		return 1;
+	}
+
+	error = NULL;
+	gclient = gpk_client_new ();
+	ret = gpk_client_install_package_name (gclient, argv[1], NULL);
+	g_object_unref (gclient);
+
+	return !ret;
+}

Added: trunk/src/gpk-install-provide-file.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-install-provide-file.c	Sat Apr 12 18:53:51 2008
@@ -0,0 +1,88 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <locale.h>
+
+#include <pk-debug.h>
+
+#include "gpk-common.h"
+#include "gpk-client.h"
+
+/**
+ * main:
+ **/
+int
+main (int argc, char *argv[])
+{
+	GOptionContext *context;
+	gboolean ret;
+	gboolean verbose = FALSE;
+	GError *error;
+	GpkClient *gclient;
+
+	const GOptionEntry options[] = {
+		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
+		  N_("Show extra debugging information"), 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);
+	}
+	g_type_init ();
+
+	g_set_application_name (_("PackageKit Filename Installer"));
+	context = g_option_context_new ("gpk-install-filename");
+	g_option_context_set_summary (context, _("PackageKit Filename Installer"));
+	g_option_context_add_main_entries (context, options, NULL);
+	g_option_context_parse (context, &argc, &argv, NULL);
+	g_option_context_free (context);
+
+	pk_debug_init (verbose);
+	gtk_init (&argc, &argv);
+
+	if (argc < 2) {
+		gpk_error_modal_dialog (_("Failed to filename"), _("You need to specify a filename to install"));
+		return 1;
+	}
+	if (argc > 2) {
+		gpk_error_modal_dialog (_("Failed to install filename"), _("You can only specify one filename to install"));
+		return 1;
+	}
+
+	error = NULL;
+	gclient = gpk_client_new ();
+	ret = gpk_client_install_provide_file (gclient, argv[1], NULL);
+	g_object_unref (gclient);
+
+	return !ret;
+}

Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c	(original)
+++ trunk/src/gpk-log.c	Sat Apr 12 18:53:51 2008
@@ -40,7 +40,8 @@
 #include <pk-package-id.h>
 #include <pk-common.h>
 
-#include "gpk-common.h"
+#include <gpk-common.h>
+#include <gpk-gnome.h>
 
 static GladeXML *glade_xml = NULL;
 static GtkListStore *list_store_general = NULL;
@@ -73,7 +74,7 @@
 pk_button_help_cb (GtkWidget *widget,
 		   gboolean  data)
 {
-	gpk_show_help ("software-sources");
+	gpk_gnome_help ("software-sources");
 }
 
 /**

Modified: trunk/src/gpk-notify.c
==============================================================================
--- trunk/src/gpk-notify.c	(original)
+++ trunk/src/gpk-notify.c	Sat Apr 12 18:53:51 2008
@@ -47,9 +47,12 @@
 #include <pk-package-ids.h>
 #include <pk-package-list.h>
 
+#include <gpk-common.h>
+#include <gpk-gnome.h>
+
 #include "gpk-smart-icon.h"
 #include "gpk-auto-refresh.h"
-#include "gpk-common.h"
+#include "gpk-consolekit.h"
 #include "gpk-notify.h"
 
 static void     gpk_notify_class_init	(GpkNotifyClass *klass);
@@ -94,7 +97,7 @@
 gpk_notify_show_help_cb (GtkMenuItem *item, GpkNotify *notify)
 {
 	g_return_if_fail (GPK_IS_NOTIFY (notify));
-	gpk_show_help ("update-icon");
+	gpk_gnome_help ("update-icon");
 }
 
 /**
@@ -1118,7 +1121,7 @@
 
 	/* we need the task list so we can hide the update icon when we are doing the update */
 	notify->priv->tlist = pk_task_list_new ();
-	g_signal_connect (notify->priv->tlist, "task-list-changed",
+	g_signal_connect (notify->priv->tlist, "changed",
 			  G_CALLBACK (gpk_notify_task_list_changed_cb), notify);
 
 	/* refresh the cache, and poll until we get a good refresh */

Modified: trunk/src/gpk-prefs.c
==============================================================================
--- trunk/src/gpk-prefs.c	(original)
+++ trunk/src/gpk-prefs.c	Sat Apr 12 18:53:51 2008
@@ -35,7 +35,9 @@
 #include <pk-debug.h>
 #include <pk-control.h>
 #include <pk-client.h>
-#include "gpk-common.h"
+
+#include <gpk-common.h>
+#include <gpk-gnome.h>
 
 #define PK_FREQ_HOURLY_TEXT		N_("Hourly")
 #define PK_FREQ_DAILY_TEXT		N_("Daily")
@@ -54,7 +56,7 @@
 static void
 pk_button_help_cb (GtkWidget *widget, gboolean  data)
 {
-	gpk_show_help ("prefs");
+	gpk_gnome_help ("prefs");
 }
 
 /**

Modified: trunk/src/gpk-progress.c
==============================================================================
--- trunk/src/gpk-progress.c	(original)
+++ trunk/src/gpk-progress.c	Sat Apr 12 18:53:51 2008
@@ -44,6 +44,8 @@
 static void     gpk_progress_finalize   (GObject	    *object);
 
 #define GPK_PROGRESS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_PROGRESS, GpkProgressPrivate))
+#define GPK_PROGRESS_BAR_PULSE_DELAY		50
+#define GPK_PROGRESS_BAR_PULSE_STEP		0.05
 
 struct GpkProgressPrivate
 {

Modified: trunk/src/gpk-repo.c
==============================================================================
--- trunk/src/gpk-repo.c	(original)
+++ trunk/src/gpk-repo.c	Sat Apr 12 18:53:51 2008
@@ -36,7 +36,10 @@
 #include <pk-client.h>
 #include <pk-control.h>
 #include <pk-connection.h>
-#include "gpk-common.h"
+
+#include <gpk-gnome.h>
+#include <gpk-common.h>
+
 #include "gpk-statusbar.h"
 
 static GladeXML *glade_xml = NULL;
@@ -61,7 +64,7 @@
 static void
 pk_button_help_cb (GtkWidget *widget, gboolean  data)
 {
-	gpk_show_help ("software-sources");
+	gpk_gnome_help ("software-sources");
 }
 
 /**

Modified: trunk/src/gpk-statusbar.c
==============================================================================
--- trunk/src/gpk-statusbar.c	(original)
+++ trunk/src/gpk-statusbar.c	Sat Apr 12 18:53:51 2008
@@ -45,6 +45,8 @@
 static void     gpk_statusbar_finalize	(GObject          *object);
 
 #define GPK_STATUSBAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_STATUSBAR, GpkStatusbarPrivate))
+#define GPK_STATUSBAR_BAR_PULSE_DELAY		50
+#define GPK_STATUSBAR_BAR_PULSE_STEP		0.05
 
 struct GpkStatusbarPrivate
 {
@@ -136,7 +138,7 @@
 		if (sbar->priv->timer_id != 0) {
 			return TRUE;
 		}
-		sbar->priv->timer_id = g_timeout_add (GPK_PROGRESS_BAR_PULSE_DELAY,
+		sbar->priv->timer_id = g_timeout_add (GPK_STATUSBAR_BAR_PULSE_DELAY,
 						      gpk_statusbar_pulse_timeout, sbar);
 		sbar->priv->last_percentage = percentage;
 		return TRUE;
@@ -246,7 +248,7 @@
 
 	sbar->priv->progressbar = GTK_PROGRESS_BAR (gtk_progress_bar_new ());
 	gtk_progress_bar_set_fraction (sbar->priv->progressbar, 0.0);
-	gtk_progress_bar_set_pulse_step (sbar->priv->progressbar, GPK_PROGRESS_BAR_PULSE_STEP);
+	gtk_progress_bar_set_pulse_step (sbar->priv->progressbar, GPK_STATUSBAR_BAR_PULSE_STEP);
 }
 
 /**

Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c	(original)
+++ trunk/src/gpk-update-viewer.c	Sat Apr 12 18:53:51 2008
@@ -42,8 +42,12 @@
 #include <pk-connection.h>
 #include <pk-package-id.h>
 #include <pk-package-ids.h>
-#include "gpk-common.h"
+
+#include <gpk-common.h>
+#include <gpk-gnome.h>
+
 #include "gpk-statusbar.h"
+#include "gpk-consolekit.h"
 #include "gpk-cell-renderer-uri.h"
 
 static GladeXML *glade_xml = NULL;
@@ -116,7 +120,7 @@
 {
 	const char *id = data;
 
-	gpk_show_help (id);
+	gpk_gnome_help (id);
 }
 
 /**
@@ -280,7 +284,7 @@
 /**
  * pk_updates_animation_load_frames:
  **/
-static void
+static gboolean
 pk_updates_animation_load_frames (void)
 {
 	GtkWidget *widget;
@@ -299,7 +303,10 @@
 		pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
 						   "process-working",
 						   w, 0, NULL);
-
+		/* can't load from gnome-icon-theme */
+		if (pixbuf == NULL) {
+			return FALSE;
+		}
 		cols = gdk_pixbuf_get_width (pixbuf) / w;
 		rows = gdk_pixbuf_get_height (pixbuf) / h;
 
@@ -313,6 +320,7 @@
 
 		g_object_unref (pixbuf);
 	}
+	return TRUE;
 }
 
 /**
@@ -327,6 +335,12 @@
 
 	column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (model), "progress-column"));
 
+	/* have we loaded a file */
+	if (frames == NULL) {
+		pk_warning ("no frames to process");
+		return FALSE;
+	}
+
 	gtk_tree_model_get_iter_first (model, &iter);
 	gtk_list_store_set (GTK_LIST_STORE (model), &iter,
 			    column, frames[frame_counter],
@@ -959,7 +973,7 @@
 pk_treeview_renderer_clicked (GtkCellRendererToggle *cell, gchar *uri, gpointer data)
 {
 	pk_debug ("clicked %s", uri);
-	gpk_execute_url (uri);
+	gpk_gnome_open (uri);
 }
 
 /**
@@ -1469,17 +1483,28 @@
 static void
 pk_updates_task_list_changed_cb (PkTaskList *tlist, gpointer data)
 {
+	GtkWidget *widget;
+
 	/* hide buttons 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)) {
 		/* clear existing list */
 		gtk_list_store_clear (list_store_preview);
 
 		/* put a message in the listbox */
 		pk_updates_add_preview_item ("dialog-information", _("There is an update already in progress!"), TRUE);
 
-		/* if doing it then hide apply and refresh */
-		polkit_gnome_action_set_visible (update_system_action, FALSE);
-		polkit_gnome_action_set_visible (refresh_action, FALSE);
+		/* hide apply, review and refresh */
+		polkit_gnome_action_set_sensitive (update_system_action, FALSE);
+		polkit_gnome_action_set_sensitive (refresh_action, FALSE);
+		widget = glade_xml_get_widget (glade_xml, "button_review");
+		gtk_widget_set_sensitive (widget, FALSE);
+	} else {
+		/* show apply, review and refresh */
+		polkit_gnome_action_set_sensitive (update_system_action, TRUE);
+		polkit_gnome_action_set_sensitive (refresh_action, TRUE);
+		widget = glade_xml_get_widget (glade_xml, "button_review");
+		gtk_widget_set_sensitive (widget, TRUE);
 	}
 }
 
@@ -2022,7 +2047,7 @@
 	gtk_label_set_label (GTK_LABEL (widget), "");
 
 	/* we need to grey out all the buttons if we are in progress */
-	g_signal_connect (tlist, "task-list-changed",
+	g_signal_connect (tlist, "changed",
 			  G_CALLBACK (pk_updates_task_list_changed_cb), NULL);
 	pk_updates_task_list_changed_cb (tlist, NULL);
 

Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c	(original)
+++ trunk/src/gpk-watch.c	Sat Apr 12 18:53:51 2008
@@ -53,6 +53,7 @@
 #include "gpk-progress.h"
 #include "gpk-inhibit.h"
 #include "gpk-smart-icon.h"
+#include "gpk-consolekit.h"
 
 static void     gpk_watch_class_init	(GpkWatchClass *klass);
 static void     gpk_watch_init		(GpkWatch      *watch);
@@ -883,7 +884,9 @@
 				 "activate", G_CALLBACK (gpk_watch_activate_status_restart_cb), watch, 0);
 
 	watch->priv->tlist = pk_task_list_new ();
-	g_signal_connect (watch->priv->tlist, "task-list-changed",
+	g_signal_connect (watch->priv->tlist, "changed",
+			  G_CALLBACK (gpk_watch_task_list_changed_cb), watch);
+	g_signal_connect (watch->priv->tlist, "status-changed",
 			  G_CALLBACK (gpk_watch_task_list_changed_cb), watch);
 	g_signal_connect (watch->priv->tlist, "finished",
 			  G_CALLBACK (gpk_watch_finished_cb), watch);



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