gnome-packagekit r316 - trunk/src



Author: rhughes
Date: Tue Sep 30 13:30:09 2008
New Revision: 316
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=316&view=rev

Log:
from git

Modified:
   trunk/src/Makefile.am
   trunk/src/gpk-application.c
   trunk/src/gpk-client.c
   trunk/src/gpk-common.c
   trunk/src/gpk-common.h
   trunk/src/gpk-dbus.c
   trunk/src/gpk-firmware.c
   trunk/src/gpk-hardware.c
   trunk/src/gpk-install-catalog.c
   trunk/src/gpk-install-local-file.c
   trunk/src/gpk-install-mime-type.c
   trunk/src/gpk-install-package-name.c
   trunk/src/gpk-install-provide-file.c
   trunk/src/gpk-update-viewer.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Sep 30 13:30:09 2008
@@ -254,6 +254,8 @@
 		--output=gpk-interface.h		\
 		$(srcdir)/gpk-interface.xml
 
+if EGG_BUILD_TESTS
+
 check_PROGRAMS =					\
 	gpk-self-test
 
@@ -277,6 +279,7 @@
 gpk_self_test_CFLAGS = -DEGG_TEST $(AM_CFLAGS)
 
 TESTS = gpk-self-test
+endif
 
 EXTRA_DIST =						\
 	gpk-marshal.list				\

Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c	(original)
+++ trunk/src/gpk-application.c	Tue Sep 30 13:30:09 2008
@@ -986,7 +986,7 @@
 	/* if non-zero, set the size */
 	if (details->size > 0) {
 		/* set the size */
-		value = gpk_size_to_si_size_text (details->size);
+		value = g_format_size_for_display (details->size);
 		if (egg_strequal (details->id->data, "meta"))
 			gpk_application_add_detail_item (application, _("Size"), value, NULL);
 		else if (installed)

Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c	(original)
+++ trunk/src/gpk-client.c	Tue Sep 30 13:30:09 2008
@@ -1752,7 +1752,7 @@
 		return NULL;
 
 	codec_name_formatted = g_strdup_printf ("<i>%s</i>", codec_name);
-	title = g_strdup_printf (_("Searching for codec: %s"), codec_name_formatted);
+	title = g_strdup_printf (_("Searching for plugin: %s"), codec_name_formatted);
 	gpk_client_dialog_set_message (gclient->priv->dialog, title);
 	g_free (title);
 	g_free (codec_name_formatted);
@@ -1771,7 +1771,7 @@
 		goto out;
 	}
 
-	/* gstreamer-ffmpeg and gstreamer-plugins-ugly both provice mp3 playback, choose one */
+	/* gstreamer-ffmpeg and gstreamer-plugins-ugly both provide mp3 playback, choose one */
 	if (len > 1)
 		egg_warning ("choosing one of the provides as more than one match");
 
@@ -1800,10 +1800,15 @@
 	gchar **parts;
 	gboolean ret;
 	GString *string;
+	const gchar *title;
+	const gchar *message;
 
-	string = g_string_new ("");
-	g_string_append_printf (string, "%s\n%s\n\n", _("Additional plugins are required to play this content."), _("The following codecs are required:"));
 	len = g_strv_length (codec_name_strings);
+	title = ngettext ("An additional plugin is required to play this content", "Additional plugins are required to play this content", len);
+	message = ngettext ("The following plugin is required:", "The following plugins are required:", len);
+
+	string = g_string_new ("");
+	g_string_append_printf (string, "%s\n%s\n\n", title, message);
 	for (i=0; i<len; i++) {
 		parts = g_strsplit (codec_name_strings[i], "|", 2);
 		g_string_append_printf (string, "â <i>%s</i>\n", parts[0]);
@@ -1811,7 +1816,8 @@
 	}
 
 	/* trailer */
-	g_string_append_printf (string, "\n%s\n", _("Do you want to search for these now?"));
+	message = ngettext ("Do you want to search for this now?", "Do you want to search for these now?", len);
+	g_string_append_printf (string, "\n%s\n", message);
 
 	/* remove last \n */
 	g_string_set_size (string, string->len - 1);
@@ -1819,7 +1825,7 @@
 	/* display messagebox  */
 	text = g_string_free (string, FALSE);
 
-	gpk_client_dialog_set_title (gclient->priv->dialog, _("Codec installer"));
+	gpk_client_dialog_set_title (gclient->priv->dialog, _("Plugin installer"));
 	gpk_client_dialog_set_action (gclient->priv->dialog, _("Search"));
 	ret = gpk_client_confirm_action (gclient, _("requires additional plugins"), text);
 	g_free (text);
@@ -1849,6 +1855,8 @@
 	GtkResponseType button;
 	PkPackageList *list = NULL;
 	gchar **package_ids = NULL;
+	const gchar *title;
+	const gchar *message;
 
 	/* check it's not session wide banned in gconf */
 	ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_ENABLE_CODEC_HELPER, NULL);
@@ -1874,7 +1882,7 @@
 
 skip_checks:
 	/* set title */
-	gpk_client_dialog_set_title (gclient->priv->dialog, _("Searching for codecs"));
+	gpk_client_dialog_set_title (gclient->priv->dialog, _("Searching for plugins"));
 	gpk_client_dialog_set_image_status (gclient->priv->dialog, PK_STATUS_ENUM_WAIT);
 	gpk_client_dialog_set_message (gclient->priv->dialog, "");
 
@@ -1892,13 +1900,11 @@
 			egg_warning ("invalid line '%s', expecting a | delimiter", codec_name_strings[i]);
 			continue;
 		}
-		egg_debug ("codec name=%s", parts[0]);
-		egg_debug ("codec description=%s", parts[1]);
 		obj_new = gpk_client_install_gstreamer_codec_part (gclient, parts[0], parts[1], &error_local);
 		if (obj_new == NULL) {
 			if (gclient->priv->show_warning) {
-				gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to search for codec"));
-				gpk_client_dialog_set_message (gclient->priv->dialog, _("Could not find codec in any configured software source"));
+				gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to search for plugin"));
+				gpk_client_dialog_set_message (gclient->priv->dialog, _("Could not find plugin in any configured software source"));
 				gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
 				gpk_client_dialog_run (gclient->priv->dialog);
 			}
@@ -1926,9 +1932,12 @@
 		goto skip_checks2;
 	}
 
+	title = ngettext ("Install the following plugin", "Install the following plugins", len);
+	message = ngettext ("Do you want to install this package now?", "Do you want to install these packages now?", len);
+
 	gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
-	gpk_client_dialog_set_title (gclient->priv->dialog, _("Install the following codecs"));
-	gpk_client_dialog_set_message (gclient->priv->dialog, _("Do you want to install these packages now?"));
+	gpk_client_dialog_set_title (gclient->priv->dialog, title);
+	gpk_client_dialog_set_message (gclient->priv->dialog, message);
 	gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-information");
 	gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
 	gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST, gclient->priv->timestamp);

Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c	(original)
+++ trunk/src/gpk-common.c	Tue Sep 30 13:30:09 2008
@@ -44,37 +44,6 @@
 #include "gpk-error.h"
 
 /**
- * gpk_size_to_si_size_text:
- **/
-gchar *
-gpk_size_to_si_size_text (guint64 size)
-{
-	gdouble frac;
-
-	/* double cast, not sure why, but it works */
-	frac = (gdouble) (long int) size;
-
-	/* first chunk */
-	if (frac < 1024)
-		return g_strdup_printf ("%li bytes", (long int) size);
-	/* next chunk */
-	frac /= 1024.0;
-	if (frac < 1024)
-		return g_strdup_printf ("%.1lf kB", frac);
-	/* next chunk */
-	frac /= 1024.0;
-	if (frac < 1024)
-		return g_strdup_printf ("%.1lf MB", frac);
-	/* next chunk */
-	frac /= 1024.0;
-	if (frac < 1024)
-		return g_strdup_printf ("%.1lf GB", frac);
-	/* no way.... */
-	egg_warning ("cannot have a file this large!");
-	return NULL;
-}
-
-/**
  * gpk_package_id_format_twoline:
  *
  * Return value: "<b>GTK Toolkit</b>\ngtk2-2.12.2 (i386)"
@@ -334,27 +303,6 @@
 }
 
 /**
- * gpk_convert_argv_to_strv:
- **/
-gchar **
-gpk_convert_argv_to_strv (gchar *argv[])
-{
-	gchar **array;
-	guint length;
-	guint i;
-
-	length = g_strv_length (argv) - 1;
-	array = g_new0 (gchar *, length+1);
-	for (i=0; i<length; i++) {
-		/* we miss out argv[0] as it's the program name */
-		array[i] = g_strdup (argv[i+1]);
-		egg_debug ("array[%i]=%s", i, array[i]);
-	}
-	array[i] = NULL;
-	return array;
-}
-
-/**
  * gpk_strv_join_locale:
  *
  * Return value: "dave" or "dave and john" or "dave, john and alice",
@@ -488,38 +436,6 @@
 	g_free (text);
 
 	/************************************************************
-	 ****************        size text             **************
-	 ************************************************************/
-	egg_test_title (test, "size zero");
-	text = gpk_size_to_si_size_text (0);
-	if (text != NULL && strcmp (text, _("0 bytes")) == 0) {
-		egg_test_success (test, NULL);
-	} else {
-		egg_test_failed (test, "failed, got %s", text);
-	}
-	g_free (text);
-
-	/************************************************************/
-	egg_test_title (test, "size 512 bytes");
-	text = gpk_size_to_si_size_text (512);
-	if (text != NULL && strcmp (text, _("512 bytes")) == 0) {
-		egg_test_success (test, NULL);
-	} else {
-		egg_test_failed (test, "failed, got %s", text);
-	}
-	g_free (text);
-
-	/************************************************************/
-	egg_test_title (test, "size 256.2 MB");
-	text = gpk_size_to_si_size_text (256*1025*1024);
-	if (text != NULL && strcmp (text, _("256.2 MB")) == 0) {
-		egg_test_success (test, NULL);
-	} else {
-		egg_test_failed (test, "failed, got %s", text);
-	}
-	g_free (text);
-
-	/************************************************************
 	 ****************     package name text        **************
 	 ************************************************************/
 	egg_test_title (test, "get name null");

Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h	(original)
+++ trunk/src/gpk-common.h	Tue Sep 30 13:30:09 2008
@@ -48,8 +48,6 @@
 #define GPK_CONF_AUTO_UPDATE			"/apps/gnome-packagekit/auto_update"
 #define GPK_CONF_UPDATE_BATTERY			"/apps/gnome-packagekit/update_battery"
 #define GPK_CONF_SHOW_DEPENDS			"/apps/gnome-packagekit/show_depends"
-#define GPK_CONF_PROMPT_FIRMWARE		"/apps/gnome-packagekit/prompt_firmware"
-#define GPK_CONF_PROMPT_HARDWARE		"/apps/gnome-packagekit/prompt_hardware"
 #define GPK_CONF_BANNED_FIRMWARE		"/apps/gnome-packagekit/banned_firmware"
 
 #define GPK_CONF_REPO_SHOW_DETAILS		"/apps/gnome-packagekit/repo/show_details"
@@ -57,9 +55,11 @@
 #define GPK_CONF_APPLICATION_FILTER_NEWEST	"/apps/gnome-packagekit/application/filter_newest"
 #define GPK_CONF_UPDATE_VIEWER_PRECACHE_DETAILS	"/apps/gnome-packagekit/update_viewer/precache_details"
 
-#define GPK_CONF_ENABLE_FONT_HELPER		"/apps/gnome-packagekit/interface/enable_font_helper"
-#define GPK_CONF_ENABLE_CODEC_HELPER		"/apps/gnome-packagekit/interface/enable_codec_helper"
-#define GPK_CONF_ENABLE_MIME_TYPE_HELPER	"/apps/gnome-packagekit/interface/enable_mime_type_helper"
+#define GPK_CONF_ENABLE_FONT_HELPER		"/apps/gnome-packagekit/enable_font_helper"
+#define GPK_CONF_ENABLE_CODEC_HELPER		"/apps/gnome-packagekit/enable_codec_helper"
+#define GPK_CONF_ENABLE_MIME_TYPE_HELPER	"/apps/gnome-packagekit/enable_mime_type_helper"
+#define GPK_CONF_ENABLE_CHECK_FIRMWARE		"/apps/gnome-packagekit/enable_check_firmware"
+#define GPK_CONF_ENABLE_CHECK_HARDWARE		"/apps/gnome-packagekit/enable_check_hardware"
 
 #define GPK_BUGZILLA_URL			"https://bugs.freedesktop.org/";
 
@@ -71,7 +71,6 @@
 #define GPK_ICON_SOFTWARE_UPDATE_AVAILABLE	"software-update-available"
 
 void		 gpk_common_test			(gpointer	 data);
-gchar		*gpk_size_to_si_size_text		(guint64	 size);
 gchar		*gpk_package_get_name			(const gchar	*package_id);
 gchar		*gpk_package_id_format_twoline		(const PkPackageId *id,
 							 const gchar	*summary);
@@ -80,7 +79,6 @@
 gchar		*gpk_package_id_name_version		(const PkPackageId *id);
 
 gchar		*gpk_time_to_localised_string		(guint		 time_secs);
-gchar		**gpk_convert_argv_to_strv		(gchar		*argv[]);
 gboolean	 gpk_check_privileged_user		(const gchar	*application_name);
 gboolean	 gpk_check_icon_valid			(const gchar	*icon);
 gboolean	 gpk_set_animated_icon_from_status	(GpkAnimatedIcon *icon,

Modified: trunk/src/gpk-dbus.c
==============================================================================
--- trunk/src/gpk-dbus.c	(original)
+++ trunk/src/gpk-dbus.c	Tue Sep 30 13:30:09 2008
@@ -239,7 +239,7 @@
 
 	/* check we have a foreign window */
 	if (xid == 0) {
-		g_message ("no XID, so cannot work with focus stealing prevention");
+		egg_debug ("no XID, so cannot work with focus stealing prevention");
 		goto out;
 	}
 

Modified: trunk/src/gpk-firmware.c
==============================================================================
--- trunk/src/gpk-firmware.c	(original)
+++ trunk/src/gpk-firmware.c	Tue Sep 30 13:30:09 2008
@@ -108,8 +108,8 @@
 	if (egg_strequal (action, "install-firmware")) {
 		gpk_firmware_install_file (firmware);
 	} else if (egg_strequal (action, "do-not-show-prompt-firmware")) {
-		egg_debug ("set %s to FALSE", GPK_CONF_PROMPT_FIRMWARE);
-		gconf_client_set_bool (firmware->priv->gconf_client, GPK_CONF_PROMPT_FIRMWARE, FALSE, NULL);
+		egg_debug ("set %s to FALSE", GPK_CONF_ENABLE_CHECK_FIRMWARE);
+		gconf_client_set_bool (firmware->priv->gconf_client, GPK_CONF_ENABLE_CHECK_FIRMWARE, FALSE, NULL);
 	} else {
 		egg_warning ("unknown action id: %s", action);
 	}
@@ -124,7 +124,7 @@
 gpk_firmware_check_available (GpkFirmware *firmware, const gchar *filename)
 {
 	gboolean ret;
-	guint length;
+	guint length = 0;
 	PkClient *client = NULL;
 	PkPackageList *list = NULL;
 	GError *error = NULL;
@@ -293,7 +293,7 @@
 	firmware->priv->gconf_client = gconf_client_get_default ();
 
 	/* should we check and show the user */
-	ret = gconf_client_get_bool (firmware->priv->gconf_client, GPK_CONF_PROMPT_FIRMWARE, NULL);
+	ret = gconf_client_get_bool (firmware->priv->gconf_client, GPK_CONF_ENABLE_CHECK_FIRMWARE, NULL);
 	if (!ret) {
 		egg_debug ("not showing thanks to GConf");
 		return;

Modified: trunk/src/gpk-hardware.c
==============================================================================
--- trunk/src/gpk-hardware.c	(original)
+++ trunk/src/gpk-hardware.c	Tue Sep 30 13:30:09 2008
@@ -107,8 +107,8 @@
 	if (egg_strequal (action, GPK_HARDWARE_INSTALL_ACTION)) {
 		gpk_hardware_install_package (hardware);
 	} else if (egg_strequal (action, GPK_HARDWARE_DONT_PROMPT_ACTION)) {
-		egg_debug ("set %s to FALSE", GPK_CONF_PROMPT_HARDWARE);
-		gconf_client_set_bool (hardware->priv->gconf_client, GPK_CONF_PROMPT_HARDWARE, FALSE, NULL);
+		egg_debug ("set %s to FALSE", GPK_CONF_ENABLE_CHECK_HARDWARE);
+		gconf_client_set_bool (hardware->priv->gconf_client, GPK_CONF_ENABLE_CHECK_HARDWARE, FALSE, NULL);
 	} else {
 		egg_warning ("unknown action id: %s", action);
 	}
@@ -244,7 +244,7 @@
 	hardware->priv->udi = NULL;
 
 	/* should we check and show the user */
-	ret = gconf_client_get_bool (hardware->priv->gconf_client, GPK_CONF_PROMPT_HARDWARE, NULL);
+	ret = gconf_client_get_bool (hardware->priv->gconf_client, GPK_CONF_ENABLE_CHECK_HARDWARE, NULL);
 	if (!ret) {
 		egg_debug ("hardware driver checking disabled in GConf");
 		return;

Modified: trunk/src/gpk-install-catalog.c
==============================================================================
--- trunk/src/gpk-install-catalog.c	(original)
+++ trunk/src/gpk-install-catalog.c	Tue Sep 30 13:30:09 2008
@@ -42,11 +42,13 @@
 	GpkClient *gclient;
 	gboolean ret;
 	gboolean verbose = FALSE;
-	gchar **files;
+	gchar **files = NULL;
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
 		  _("Show extra debugging information"), NULL },
+		{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &files,
+		  "catalogs to install", NULL },
 		{ NULL}
 	};
 
@@ -56,9 +58,8 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	if (! g_thread_supported ()) {
+	if (! g_thread_supported ())
 		g_thread_init (NULL);
-	}
 	g_type_init ();
 
 	g_set_application_name (_("Catalog Installer"));
@@ -73,18 +74,16 @@
 
 	/* are we running privileged */
 	ret = gpk_check_privileged_user (_("Catalog installer"));
-	if (!ret) {
+	if (!ret)
 		return 1;
-	}
 
-	if (argc < 2) {
+	if (files == NULL) {
 		gpk_error_dialog (_("Failed to install catalog"),
 				  _("You need to specify a file to install"), NULL);
 		return 1;
 	}
 
 	/* find the file list */
-	files = gpk_convert_argv_to_strv (argv);
 	gclient = gpk_client_new ();
 	gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_ALWAYS);
 	/* install all the catalogs */

Modified: trunk/src/gpk-install-local-file.c
==============================================================================
--- trunk/src/gpk-install-local-file.c	(original)
+++ trunk/src/gpk-install-local-file.c	Tue Sep 30 13:30:09 2008
@@ -42,11 +42,13 @@
 	gboolean verbose = FALSE;
 	GError *error;
 	GpkClient *gclient;
-	gchar **files;
+	gchar **files = NULL;
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
 		  _("Show extra debugging information"), NULL },
+		{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &files,
+		  "files to install", NULL },
 		{ NULL}
 	};
 
@@ -56,9 +58,8 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	if (! g_thread_supported ()) {
+	if (! g_thread_supported ())
 		g_thread_init (NULL);
-	}
 	g_type_init ();
 
 	g_set_application_name (_("PackageKit File Installer"));
@@ -73,11 +74,10 @@
 
 	/* are we running privileged */
 	ret = gpk_check_privileged_user (_("Local file installer"));
-	if (!ret) {
+	if (!ret)
 		return 1;
-	}
 
-	if (argc < 2) {
+	if (files == NULL) {
 		gpk_error_dialog (_("Failed to install local file"),
 				  _("You need to specify a file to install"), NULL);
 		return 1;
@@ -86,7 +86,6 @@
 	error = NULL;
 	gclient = gpk_client_new ();
 	gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_ALWAYS);
-	files = gpk_convert_argv_to_strv (argv);
 	ret = gpk_client_install_local_files (gclient, files, NULL);
 	g_strfreev (files);
 	g_object_unref (gclient);

Modified: trunk/src/gpk-install-mime-type.c
==============================================================================
--- trunk/src/gpk-install-mime-type.c	(original)
+++ trunk/src/gpk-install-mime-type.c	Tue Sep 30 13:30:09 2008
@@ -55,9 +55,8 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	if (! g_thread_supported ()) {
+	if (! g_thread_supported ())
 		g_thread_init (NULL);
-	}
 	g_type_init ();
 
 	g_set_application_name (_("Mime Type Installer"));
@@ -72,9 +71,8 @@
 
 	/* are we running privileged */
 	ret = gpk_check_privileged_user (_("Mime type installer"));
-	if (!ret) {
+	if (!ret)
 		return 1;
-	}
 
 	if (argc < 2) {
 		gpk_error_dialog (_("Failed to install file handler"),

Modified: trunk/src/gpk-install-package-name.c
==============================================================================
--- trunk/src/gpk-install-package-name.c	(original)
+++ trunk/src/gpk-install-package-name.c	Tue Sep 30 13:30:09 2008
@@ -42,11 +42,13 @@
 	gboolean verbose = FALSE;
 	GError *error;
 	GpkClient *gclient;
-	gchar **packages;
+	gchar **packages = NULL;
 
 	const GOptionEntry options[] = {
 		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
 		  _("Show extra debugging information"), NULL },
+		{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &packages,
+		  "packages to install", NULL },
 		{ NULL}
 	};
 
@@ -56,9 +58,8 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	if (! g_thread_supported ()) {
+	if (! g_thread_supported ())
 		g_thread_init (NULL);
-	}
 	g_type_init ();
 
 	g_set_application_name (_("Package Installer"));
@@ -73,11 +74,10 @@
 
 	/* are we running privileged */
 	ret = gpk_check_privileged_user (_("Package name installer"));
-	if (!ret) {
+	if (!ret)
 		return 1;
-	}
 
-	if (argc < 2) {
+	if (packages == NULL) {
 		gpk_error_dialog (_("Failed to install package from name"),
 				  _("You need to specify a package to install"), NULL);
 		return 1;
@@ -86,7 +86,6 @@
 	error = NULL;
 	gclient = gpk_client_new ();
 	gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_ALWAYS);
-	packages = gpk_convert_argv_to_strv (argv);
 	ret = gpk_client_install_package_names (gclient, packages, NULL);
 	g_strfreev (packages);
 	g_object_unref (gclient);

Modified: trunk/src/gpk-install-provide-file.c
==============================================================================
--- trunk/src/gpk-install-provide-file.c	(original)
+++ trunk/src/gpk-install-provide-file.c	Tue Sep 30 13:30:09 2008
@@ -55,9 +55,8 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	if (! g_thread_supported ()) {
+	if (! g_thread_supported ())
 		g_thread_init (NULL);
-	}
 	g_type_init ();
 
 	g_set_application_name (_("Filename Installer"));
@@ -72,9 +71,8 @@
 
 	/* are we running privileged */
 	ret = gpk_check_privileged_user (_("Provide file installer"));
-	if (!ret) {
+	if (!ret)
 		return 1;
-	}
 
 	if (argc < 2) {
 		gpk_error_dialog (_("Failed to install a package to provide a file"),

Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c	(original)
+++ trunk/src/gpk-update-viewer.c	Tue Sep 30 13:30:09 2008
@@ -144,14 +144,12 @@
 	}
 
 	/* some pages are resizeable */
-	if (page == PAGE_DETAILS) {
+	if (page == PAGE_DETAILS)
 		gtk_window_set_resizable (GTK_WINDOW (widget), TRUE);
-	} else {
+	else
 		gtk_window_set_resizable (GTK_WINDOW (widget), FALSE);
-	}
-	if (page == PAGE_CONFIRM) {
+	if (page == PAGE_CONFIRM)
 		gtk_window_unmaximize (GTK_WINDOW (widget));
-	}
 	gtk_widget_show (widget);
 
 	/* clear */
@@ -163,11 +161,10 @@
 	widget = glade_xml_get_widget (glade_xml, "hbox_hidden");
 	list = gtk_container_get_children (GTK_CONTAINER (widget));
 	for (l=list, i=0; l; l=l->next, i++) {
-		if (i == page) {
+		if (i == page)
 			gtk_widget_show (l->data);
-		} else {
+		else
 			gtk_widget_hide (l->data);
-		}
 	}
 }
 
@@ -190,12 +187,10 @@
 	ret = gpk_client_update_system (gclient, NULL);
 
 	/* did we succeed updating the system */
-	if (!ret) {
-		/* show the preview page */
+	if (!ret)
 		gpk_update_viewer_set_page (PAGE_PREVIEW);
-	} else {
+	else
 		gpk_update_viewer_set_page (PAGE_CONFIRM);
-	}
 }
 
 /**
@@ -230,11 +225,10 @@
 		gtk_tree_model_get (model, &iter, PACKAGES_COLUMN_SELECT, &update,
 				    PACKAGES_COLUMN_ID, &package_id, -1);
 
-		if (!update) {
+		if (!update)
 			selected_all = FALSE;
-		} else {
+		else
 			selected_any = TRUE;
-		}
 
 		/* do something with the data */
 		if (update) {
@@ -256,11 +250,10 @@
 	}
 
 	widget = glade_xml_get_widget (glade_xml, "button_overview2");
-	if (selected_all) {
+	if (selected_all)
 		gtk_widget_hide (widget);
-	} else {
+	else
 		gtk_widget_show (widget);
-	}
 
 	/* set correct view */
 	gpk_update_viewer_set_page (PAGE_LAST);
@@ -270,12 +263,10 @@
 	g_strfreev (package_ids);
 
 	/* did we succeed updating the system */
-	if (!ret) {
-		/* show the preview page */
+	if (!ret)
 		gpk_update_viewer_set_page (PAGE_PREVIEW);
-	} else {
+	else
 		gpk_update_viewer_set_page (PAGE_CONFIRM);
-	}
 
 	/* get rid of the array, and free the contents */
 	g_ptr_array_foreach (array, (GFunc) g_free, NULL);
@@ -503,21 +494,20 @@
 
 		for (i=0;i<length;i++) {
 			obj = pk_package_list_get_obj (list, i);
-			if (obj->info == PK_INFO_ENUM_LOW) {
+			if (obj->info == PK_INFO_ENUM_LOW)
 				num_low++;
-			} else if (obj->info == PK_INFO_ENUM_IMPORTANT) {
+			else if (obj->info == PK_INFO_ENUM_IMPORTANT)
 				num_important++;
-			} else if (obj->info == PK_INFO_ENUM_SECURITY) {
+			else if (obj->info == PK_INFO_ENUM_SECURITY)
 				num_security++;
-			} else if (obj->info == PK_INFO_ENUM_BUGFIX) {
+			else if (obj->info == PK_INFO_ENUM_BUGFIX)
 				num_bugfix++;
-			} else if (obj->info == PK_INFO_ENUM_ENHANCEMENT) {
+			else if (obj->info == PK_INFO_ENUM_ENHANCEMENT)
 				num_enhancement++;
-			} else if (obj->info == PK_INFO_ENUM_BLOCKED) {
+			else if (obj->info == PK_INFO_ENUM_BLOCKED)
 				num_blocked++;
-			} else {
+			else
 				num_normal++;
-			}
 		}
 
 		/* clear existing list */
@@ -796,8 +786,6 @@
 
 /**
  * gpk_update_viewer_get_pretty_from_composite:
- *
- * NOTE: Split using ^, because \t was already taken.
  **/
 static gchar *
 gpk_update_viewer_get_pretty_from_composite (const gchar *package_ids_delimit)
@@ -810,9 +798,8 @@
 	PkPackageId *id;
 
 	/* do we have any data? */
-	if (egg_strzero (package_ids_delimit)) {
+	if (egg_strzero (package_ids_delimit))
 		goto out;
-	}
 
 	string = g_string_new ("");
 	package_ids = pk_package_ids_from_text (package_ids_delimit);
@@ -857,22 +844,19 @@
 
 		/* common prefixes */
 		if (g_str_has_prefix (line, "- ") ||
-		    g_str_has_prefix (line, "* ")) {
+		    g_str_has_prefix (line, "* "))
 			line2 = g_strdup_printf ("â %s", line+2);
-		} else {
+		else
 			line2 = g_strdup (line);
-		}
 
 		/* if not null then append back */
-		if (!egg_strzero (line2)) {
+		if (!egg_strzero (line2))
 			g_string_append_printf (string, "%s\n", line2);
-		}
 		g_free (line2);
 	}
 	/* remove trailing \n */
-	if (string->len > 0) {
+	if (string->len > 0)
 		g_string_set_size (string, string->len - 1);
-	}
 	line = g_string_free (string, FALSE);
 	g_strfreev (lines);
 
@@ -905,12 +889,11 @@
 	/* get info  */
 	widget = glade_xml_get_widget (glade_xml, "treeview_updates");
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
-	if (gtk_tree_selection_get_selected (selection, &model, &treeiter)) {
+	if (gtk_tree_selection_get_selected (selection, &model, &treeiter))
 		gtk_tree_model_get (model, &treeiter,
 				    PACKAGES_COLUMN_INFO, &info, -1);
-	} else {
+	else
 		info = PK_INFO_ENUM_NORMAL;
-	}
 
 	info_text = gpk_info_enum_to_localised_text (info);
 	/* translators: this is the update type, e.g. security */
@@ -1222,15 +1205,14 @@
 static const gchar *
 pk_update_get_approx_time (guint time)
 {
-	if (time < 60) {
+	if (time < 60)
 		return _("Less than a minute ago");
-	} else if (time < 60*60) {
+	else if (time < 60*60)
 		return _("Less than an hour ago");
-	} else if (time < 24*60*60) {
+	else if (time < 24*60*60)
 		return _("A few hours ago");
-	} else if (time < 7*24*60*60) {
+	else if (time < 7*24*60*60)
 		return _("A few days ago");
-	}
 	return _("Over a week ago");
 }
 
@@ -1279,9 +1261,8 @@
 	pk_control_get_time_since_action (control, PK_ROLE_ENUM_UPDATE_PACKAGES, &time_new, NULL);
 
 	/* always use the shortest time */
-	if (time_new < time) {
+	if (time_new < time)
 		time = time_new;
-	}
 	time_text = pk_update_get_approx_time (time);
 	widget = glade_xml_get_widget (glade_xml, "label_last_update");
 	gtk_label_set_label (GTK_LABEL (widget), time_text);
@@ -1326,9 +1307,8 @@
 	}
 
 	/* trim off extra newlines */
-	if (string->len != 0) {
+	if (string->len != 0)
 		g_string_set_size (string, string->len-1);
-	}
 
 	/* convert to a normal gchar */
 	text = g_string_free (string, FALSE);
@@ -1435,9 +1415,8 @@
 	GtkWidget *widget;
 	widget = glade_xml_get_widget (glade_xml, "progressbar_percent");
 
-	if (percentage != PK_CLIENT_PERCENTAGE_INVALID) {
+	if (percentage != PK_CLIENT_PERCENTAGE_INVALID)
 		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget), (gfloat) percentage / 100.0);
-	}
 }
 
 /**
@@ -1583,11 +1562,10 @@
 	*none_checked = TRUE;
 	while (valid) {
 		gtk_tree_model_get (model, &iter, PACKAGES_COLUMN_SELECT, &update, -1);
-		if (update) {
+		if (update)
 			*none_checked = FALSE;
-		} else {
+		else
 			*all_checked = FALSE;
-		}
 		valid = gtk_tree_model_iter_next (model, &iter);
 	}
 }
@@ -1722,24 +1700,18 @@
 				     gchar *string1, gchar *string2,
 				     gint int1, gint int2, gpointer user_data)
 {
-	if (egg_strequal (name, "button_refresh")) {
+	if (egg_strequal (name, "button_refresh"))
 		return polkit_gnome_action_create_button (refresh_action);
-	}
-	if (egg_strequal (name, "button_restart")) {
+	if (egg_strequal (name, "button_restart"))
 		return polkit_gnome_action_create_button (restart_action);
-	}
-	if (egg_strequal (name, "button_update_system")) {
+	if (egg_strequal (name, "button_update_system"))
 		return polkit_gnome_action_create_button (update_system_action);
-	}
-	if (egg_strequal (name, "button_update_packages")) {
+	if (egg_strequal (name, "button_update_packages"))
 		return polkit_gnome_action_create_button (update_packages_action);
-	}
-	if (egg_strequal (name, "image_animation_preview")) {
+	if (egg_strequal (name, "image_animation_preview"))
 		return gpk_animated_icon_new ();
-	}
-	if (egg_strequal (name, "image_animation_description")) {
+	if (egg_strequal (name, "image_animation_description"))
 		return gpk_animated_icon_new ();
-	}
 	egg_warning ("name unknown=%s", name);
 	return NULL;
 }
@@ -1849,9 +1821,8 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	if (! g_thread_supported ()) {
+	if (! g_thread_supported ())
 		g_thread_init (NULL);
-	}
 	dbus_g_thread_init ();
 	g_type_init ();
 
@@ -1876,9 +1847,9 @@
 	/* are we already activated? */
 	egg_unique = egg_unique_new ();
 	ret = egg_unique_assign (egg_unique, "org.freedesktop.PackageKit.UpdateViewer");
-	if (!ret) {
+	if (!ret)
 		goto unique_out;
-	}
+
 	g_signal_connect (egg_unique, "activated",
 			  G_CALLBACK (gpk_update_viewer_activated_cb), NULL);
 



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