[packagekit] packagekit: Branch 'master'

Richard Hughes hughsient at kemper.freedesktop.org
Mon Sep 10 15:03:14 PDT 2007


 client/pk-console.c             |   22 +++++++++++++++++++++-
 libpackagekit/pk-task-client.c  |   31 +++++++++++++++++++++++++++++++
 libpackagekit/pk-task-monitor.c |   40 ++++++++++++++++++++++++++++++++++++++++
 src/pk-backend.c                |   12 ++++++++++++
 src/pk-backend.h                |    3 +--
 src/pk-engine.c                 |   30 +++++++++++++++++++++++++++++-
 src/pk-marshal.list             |    1 +
 7 files changed, 135 insertions(+), 4 deletions(-)

New commits:
diff-tree 6a1e775714ac7cf306fba465f7bd78d0402a5249 (from 63363a3fff231c37ed20823ff81cbc21581592b8)
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Sep 10 23:02:26 2007 +0100

    connect up the client bits for get_update_detail

diff --git a/client/pk-console.c b/client/pk-console.c
index 1f68931..9ca725e 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -34,7 +34,7 @@
 #include <pk-enum-list.h>
 
 /**
- * pk_console_package_cb:
+ * pk_console_make_space:
  **/
 static gchar *
 pk_console_make_space (const gchar *data, guint length, guint *extra)
@@ -96,6 +96,24 @@ pk_console_package_cb (PkTaskClient *tcl
 }
 
 /**
+ * pk_console_update_detail_cb:
+ **/
+static void
+pk_console_update_detail_cb (PkTaskClient *tclient, const gchar *package_id,
+			     const gchar *updates, const gchar *obsoletes,
+			     const gchar *url, const gchar *restart,
+			     const gchar *update_text, gpointer data)
+{
+	g_print ("update-detail\n");
+	g_print ("  package:    '%s'\n", package_id);
+	g_print ("  updates:    '%s'\n", updates);
+	g_print ("  obsoletes:  '%s'\n", obsoletes);
+	g_print ("  url:        '%s'\n", url);
+	g_print ("  restart:    '%s'\n", restart);
+	g_print ("  update_text:'%s'\n", update_text);
+}
+
+/**
  * pk_console_percentage_changed_cb:
  **/
 static void
@@ -395,6 +413,8 @@ main (int argc, char *argv[])
 	tclient = pk_task_client_new ();
 	g_signal_connect (tclient, "package",
 			  G_CALLBACK (pk_console_package_cb), NULL);
+	g_signal_connect (tclient, "update-detail",
+			  G_CALLBACK (pk_console_update_detail_cb), NULL);
 	g_signal_connect (tclient, "percentage-changed",
 			  G_CALLBACK (pk_console_percentage_changed_cb), NULL);
 	g_signal_connect (tclient, "finished",
diff --git a/libpackagekit/pk-task-client.c b/libpackagekit/pk-task-client.c
index 9e2c2a6..2bcb9cc 100644
--- a/libpackagekit/pk-task-client.c
+++ b/libpackagekit/pk-task-client.c
@@ -71,6 +71,7 @@ typedef enum {
 	PK_TASK_CLIENT_SUB_PERCENTAGE_CHANGED,
 	PK_TASK_CLIENT_NO_PERCENTAGE_UPDATES,
 	PK_TASK_CLIENT_PACKAGE,
+	PK_TASK_CLIENT_UPDATE_DETAIL,
 	PK_TASK_CLIENT_DESCRIPTION,
 	PK_TASK_CLIENT_ERROR_CODE,
 	PK_TASK_CLIENT_FINISHED,
@@ -1124,6 +1125,28 @@ pk_task_client_package_cb (PkTaskMonitor
 }
 
 /**
+ * pk_task_client_update_detail_cb:
+ */
+static void
+pk_task_client_update_detail_cb (PkTaskMonitor *tmonitor,
+			         const gchar *package_id,
+			         const gchar *updates,
+			         const gchar *obsoletes,
+			         const gchar *url,
+			         const gchar *restart,
+			         const gchar *update_text,
+			         PkTaskClient  *tclient)
+{
+	g_return_if_fail (tclient != NULL);
+	g_return_if_fail (PK_IS_TASK_CLIENT (tclient));
+
+	pk_debug ("update-detail package='%s', updates='%s', obsoletes='%s', url='%s', restart='%s', update='%s'",
+		  package_id, updates, obsoletes, url, restart, update_text);
+	g_signal_emit (tclient , signals [PK_TASK_CLIENT_UPDATE_DETAIL], 0,
+		       package_id, updates, obsoletes, url, restart, update_text);
+}
+
+/**
  * pk_task_client_description_cb:
  */
 static void
@@ -1211,6 +1234,12 @@ pk_task_client_class_init (PkTaskClientC
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
 			      0, NULL, NULL, pk_marshal_VOID__UINT_STRING_STRING,
 			      G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
+	signals [PK_TASK_CLIENT_UPDATE_DETAIL] =
+		g_signal_new ("update-detail",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING,
+			      G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING,
+			      G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
 	signals [PK_TASK_CLIENT_DESCRIPTION] =
 		g_signal_new ("description",
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -1305,6 +1334,8 @@ pk_task_client_init (PkTaskClient *tclie
 			  G_CALLBACK (pk_task_client_job_status_changed_cb), tclient);
 	g_signal_connect (tclient->priv->tmonitor, "package",
 			  G_CALLBACK (pk_task_client_package_cb), tclient);
+	g_signal_connect (tclient->priv->tmonitor, "update-detail",
+			  G_CALLBACK (pk_task_client_update_detail_cb), tclient);
 	g_signal_connect (tclient->priv->tmonitor, "description",
 			  G_CALLBACK (pk_task_client_description_cb), tclient);
 	g_signal_connect (tclient->priv->tmonitor, "error-code",
diff --git a/libpackagekit/pk-task-monitor.c b/libpackagekit/pk-task-monitor.c
index bdf99a0..ef92f71 100644
--- a/libpackagekit/pk-task-monitor.c
+++ b/libpackagekit/pk-task-monitor.c
@@ -59,6 +59,7 @@ typedef enum {
 	PK_TASK_MONITOR_SUB_PERCENTAGE_CHANGED,
 	PK_TASK_MONITOR_NO_PERCENTAGE_UPDATES,
 	PK_TASK_MONITOR_PACKAGE,
+	PK_TASK_MONITOR_UPDATE_DETAIL,
 	PK_TASK_MONITOR_DESCRIPTION,
 	PK_TASK_MONITOR_ERROR_CODE,
 	PK_TASK_MONITOR_REQUIRE_RESTART,
@@ -373,6 +374,31 @@ pk_task_monitor_package_cb (DBusGProxy  
 }
 
 /**
+ * pk_task_monitor_update_detail_cb:
+ */
+static void
+pk_task_monitor_update_detail_cb (DBusGProxy  *proxy,
+			          guint	       job,
+			          const gchar *package_id,
+			          const gchar *updates,
+			          const gchar *obsoletes,
+			          const gchar *url,
+			          const gchar *restart,
+			          const gchar *update_text,
+			          PkTaskMonitor *tmonitor)
+{
+	g_return_if_fail (tmonitor != NULL);
+	g_return_if_fail (PK_IS_TASK_MONITOR (tmonitor));
+
+	if (job == tmonitor->priv->job) {
+		pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s",
+			  package_id, updates, obsoletes, url, restart, update_text);
+		g_signal_emit (tmonitor , signals [PK_TASK_MONITOR_UPDATE_DETAIL], 0,
+			       package_id, updates, obsoletes, url, restart, update_text);
+	}
+}
+
+/**
  * pk_task_monitor_description_cb:
  */
 static void
@@ -472,6 +498,12 @@ pk_task_monitor_class_init (PkTaskMonito
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
 			      0, NULL, NULL, pk_marshal_VOID__UINT_STRING_STRING,
 			      G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
+	signals [PK_TASK_MONITOR_UPDATE_DETAIL] =
+		g_signal_new ("update-detail",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING,
+			      G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING,
+			      G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
 	signals [PK_TASK_MONITOR_DESCRIPTION] =
 		g_signal_new ("description",
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -564,6 +596,9 @@ pk_task_monitor_init (PkTaskMonitor *tmo
 					   G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
 	dbus_g_object_register_marshaller (pk_marshal_VOID__UINT_UINT_STRING_STRING,
 					   G_TYPE_NONE, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+	dbus_g_object_register_marshaller (pk_marshal_VOID__UINT_STRING_STRING_STRING_STRING_STRING_STRING,
+					   G_TYPE_NONE, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING,
+					   G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
 
 	dbus_g_proxy_add_signal (proxy, "Finished",
 				 G_TYPE_UINT, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
@@ -594,6 +629,11 @@ pk_task_monitor_init (PkTaskMonitor *tmo
 				 G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
 	dbus_g_proxy_connect_signal (proxy, "Package",
 				     G_CALLBACK (pk_task_monitor_package_cb), tmonitor, NULL);
+	dbus_g_proxy_add_signal (proxy, "UpdateDetail",
+				 G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+				 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+	dbus_g_proxy_connect_signal (proxy, "UpdateDetail",
+				     G_CALLBACK (pk_task_monitor_update_detail_cb), tmonitor, NULL);
 	dbus_g_proxy_add_signal (proxy, "Description",
 				 G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
 	dbus_g_proxy_connect_signal (proxy, "Description",
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 10e709f..3b419f8 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -75,6 +75,7 @@ enum {
 	PK_TASK_NO_PERCENTAGE_UPDATES,
 	PK_TASK_DESCRIPTION,
 	PK_TASK_PACKAGE,
+	PK_TASK_UPDATE_DETAIL,
 	PK_TASK_ERROR_CODE,
 	PK_TASK_REQUIRE_RESTART,
 	PK_TASK_FINISHED,
@@ -540,6 +541,11 @@ pk_backend_update_detail (PkBackend *bac
 {
 	g_return_val_if_fail (backend != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+
+	pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s",
+		  package_id, updates, obsoletes, url, restart, update_text);
+	g_signal_emit (backend, signals [PK_TASK_UPDATE_DETAIL], 0,
+		       package_id, updates, obsoletes, url, restart, update_text);
 	return TRUE;
 }
 
@@ -1162,6 +1168,12 @@ pk_backend_class_init (PkBackendClass *k
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
 			      0, NULL, NULL, pk_marshal_VOID__UINT_STRING_STRING,
 			      G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
+	signals [PK_TASK_UPDATE_DETAIL] =
+		g_signal_new ("update-detail",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING,
+			      G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING,
+			      G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
 	signals [PK_TASK_REQUIRE_RESTART] =
 		g_signal_new ("require-restart",
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 1e81689..ce78af5 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -103,8 +103,7 @@ struct _PkBackendDesc {
 #define PK_BACKEND_OPTIONS(description, version, author, initialize, destroy, \
 			   get_groups, get_filters, \
 			   cancel_job_try, get_depends, get_description, \
-			   get_update_detail, \
-			   get_requires, get_updates, install_package, \
+			   get_requires, get_update_detail, get_updates, install_package, \
 			   refresh_cache, remove_package, search_details, \
 			   search_file, search_group, search_name, \
 			   update_package, update_system) \
diff --git a/src/pk-engine.c b/src/pk-engine.c
index cf1dced..9850254 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -274,6 +274,32 @@ pk_engine_package_cb (PkTask *task, guin
 }
 
 /**
+ * pk_engine_update_detail_cb:
+ **/
+static void
+pk_engine_update_detail_cb (PkTask *task, const gchar *package_id,
+			    const gchar *updates, const gchar *obsoletes,
+			    const gchar *url, const gchar *restart,
+			    const gchar *update_text, PkEngine *engine)
+{
+	PkJobListItem *item;
+
+	g_return_if_fail (engine != NULL);
+	g_return_if_fail (PK_IS_ENGINE (engine));
+
+	item = pk_job_list_get_item_from_task (engine->priv->job_list, task);
+	if (item == NULL) {
+		pk_warning ("could not find task");
+		return;
+	}
+	pk_debug ("emitting package job:%i value=%s, %s, %s, %s, %s, %s", item->job,
+		  package_id, updates, obsoletes, url, restart, update_text);
+	g_signal_emit (engine, signals [PK_ENGINE_UPDATE_DETAIL], 0, item->job,
+		       package_id, updates, obsoletes, url, restart, update_text);
+	pk_engine_reset_timer (engine);
+}
+
+/**
  * pk_engine_error_code_cb:
  **/
 static void
@@ -429,6 +455,8 @@ pk_engine_new_task (PkEngine *engine)
 			  G_CALLBACK (pk_engine_no_percentage_updates_cb), engine);
 	g_signal_connect (task, "package",
 			  G_CALLBACK (pk_engine_package_cb), engine);
+	g_signal_connect (task, "update-detail",
+			  G_CALLBACK (pk_engine_update_detail_cb), engine);
 	g_signal_connect (task, "error-code",
 			  G_CALLBACK (pk_engine_error_code_cb), engine);
 	g_signal_connect (task, "require-restart",
@@ -914,7 +942,7 @@ pk_engine_get_requires (PkEngine *engine
  **/
 gboolean
 pk_engine_get_update_detail (PkEngine *engine, const gchar *package_id,
-		       guint *job, GError **error)
+		             guint *job, GError **error)
 {
 	gboolean ret;
 	PkTask *task;
diff --git a/src/pk-marshal.list b/src/pk-marshal.list
index 7bfad4d..78ea747 100644
--- a/src/pk-marshal.list
+++ b/src/pk-marshal.list
@@ -11,4 +11,5 @@ VOID:UINT,STRING,UINT
 VOID:UINT,STRING,STRING
 VOID:UINT,BOOL
 VOID:UINT,STRING,STRING,STRING,STRING,STRING,STRING
+VOID:STRING,STRING,STRING,STRING,STRING,STRING
 



More information about the PackageKit mailing list