gnome-packagekit r340 - in trunk: help/C src



Author: rhughes
Date: Sun Oct 12 21:27:01 2008
New Revision: 340
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=340&view=rev

Log:
from git

Modified:
   trunk/help/C/gnome-packagekit.xml
   trunk/src/gpk-service-pack.c

Modified: trunk/help/C/gnome-packagekit.xml
==============================================================================
--- trunk/help/C/gnome-packagekit.xml	(original)
+++ trunk/help/C/gnome-packagekit.xml	Sun Oct 12 21:27:01 2008
@@ -553,6 +553,10 @@
     A service pack is a tarball which contains a set of packages and their dependencies.
     To explain better what a service pack is, it is best to show a few use-cases.
   </para>
+  <note><para>
+    You can add multiple packages to a service pack by separating the package
+    names with a comma, for instance <literal>hal,gnome-power-manager</literal>.
+  </para></note>
   <orderedlist numeration="arabic">
     <listitem>
       <para>

Modified: trunk/src/gpk-service-pack.c
==============================================================================
--- trunk/src/gpk-service-pack.c	(original)
+++ trunk/src/gpk-service-pack.c	Sun Oct 12 21:27:01 2008
@@ -54,7 +54,7 @@
 } GpkActionEnum;
 
 static GladeXML *glade_xml = NULL;
-static GpkActionEnum action;
+static GpkActionEnum action = GPK_ACTION_ENUM_UPDATES;
 static guint pulse_id = 0;
 
 /**
@@ -210,10 +210,10 @@
 }
 
 /**
- * gpk_pack_resolve:
+ * gpk_pack_resolve_package_id:
  **/
 static gchar *
-gpk_pack_resolve (const gchar *package)
+gpk_pack_resolve_package_id (const gchar *package)
 {
 	GtkWidget *widget;
 	PkPackageList *list = NULL;
@@ -272,6 +272,38 @@
 }
 
 /**
+ * gpk_pack_resolve_package_ids:
+ **/
+static gchar **
+gpk_pack_resolve_package_ids (gchar **package)
+{
+	gchar **package_ids;
+	guint i, length;
+	gboolean ret = TRUE;
+
+	length = g_strv_length (package);
+	package_ids = g_strdupv (package);
+
+	/* for each package, resolve to a package_id */
+	for (i=0; i<length; i++) {
+		g_free (package_ids[i]);
+		package_ids[i] = gpk_pack_resolve_package_id (package[i]);
+		if (package_ids[i] == NULL) {
+			egg_warning ("failed to resolve %s", package[i]);
+			ret = FALSE;
+			break;
+		}
+	}
+
+	/* we failed at least one resolve */
+	if (!ret) {
+		g_strfreev (package_ids);
+		package_ids = NULL;
+	}
+	return package_ids;
+}
+
+/**
  * gpk_pack_copy_package_lists:
  **/
 static gboolean
@@ -337,7 +369,8 @@
 	gchar *directory;
 	gchar *filename;
 	gchar *exclude = NULL;
-	gchar *package_id = NULL;
+	gchar **packages = NULL;
+	gchar **package_ids = NULL;
 	PkServicePack *pack;
 	PkPackageList *list = NULL;
 	GError *error = NULL;
@@ -380,8 +413,9 @@
 			gpk_error_dialog_modal (GTK_WINDOW (widget), _("Create error"), _("No package name selected"), NULL);
 			goto out;
 		}
-		package_id = gpk_pack_resolve (package);
-		if (package_id == NULL)
+		packages = g_strsplit (package, ",", 0);
+		package_ids = gpk_pack_resolve_package_ids (packages);
+		if (package_ids == NULL)
 			goto out;
 	}
 
@@ -405,7 +439,7 @@
 	if (action == GPK_ACTION_ENUM_UPDATES)
 		ret = pk_service_pack_create_for_updates (pack, &error);
 	else if (action == GPK_ACTION_ENUM_PACKAGE)
-		ret = pk_service_pack_create_for_package_id (pack, directory, &error);
+		ret = pk_service_pack_create_for_package_ids (pack, package_ids, &error);
 	if (!ret) {
 		widget = glade_xml_get_widget (glade_xml, "window_pack");
 		gpk_error_dialog_modal (GTK_WINDOW (widget), _("Create error"), _("Cannot create service pack"), error->message);
@@ -420,9 +454,14 @@
 	gtk_widget_hide (widget);
 	gpk_pack_set_percentage (100);
 
+	/* blank */
+	widget = glade_xml_get_widget (glade_xml, "progressbar_percentage");
+	gtk_progress_bar_set_text (GTK_PROGRESS_BAR(widget), "");
+
 	if (list != NULL)
 		g_object_unref (list);
-	g_free (package_id);
+	g_strfreev (packages);
+	g_strfreev (package_ids);
 	g_free (directory);
 	g_free (exclude);
 }



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