[packagekit] packagekit: Branch 'master'
Richard Hughes
hughsient at kemper.freedesktop.org
Sun Oct 28 12:30:32 PDT 2007
client/pk-console.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
New commits:
commit af574f3a622953add01b08598e3a9347e4db2bda
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Oct 28 16:38:32 2007 +0000
end the mainloop if the daemon crashes
diff --git a/client/pk-console.c b/client/pk-console.c
index b9a9e51..b1efe31 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -34,6 +34,7 @@
#include <pk-client.h>
#include <pk-package-id.h>
#include <pk-enum-list.h>
+#include <pk-connection.h>
#define PROGRESS_BAR_PADDING 22
#define MINIMUM_COLUMNS (PROGRESS_BAR_PADDING + 5)
@@ -827,6 +828,19 @@ pk_console_repo_signature_required_cb (PkClient *client, const gchar *repository
}
/**
+ * pk_connection_changed_cb:
+ **/
+static void
+pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, gpointer data)
+{
+ /* if the daemon crashed, don't hang around */
+ if (connected == FALSE && loop != NULL) {
+ pk_warning ("The daemon went away...");
+ g_main_loop_quit (loop);
+ }
+}
+
+/**
* main:
**/
int
@@ -835,6 +849,7 @@ main (int argc, char *argv[])
DBusGConnection *system_connection;
GError *error = NULL;
PkClient *client;
+ PkConnection *pconnection;
gboolean verbose = FALSE;
gboolean program_version = FALSE;
gboolean nowait = FALSE;
@@ -891,6 +906,10 @@ main (int argc, char *argv[])
pk_debug_init (verbose);
loop = g_main_loop_new (NULL, FALSE);
+ pconnection = pk_connection_new ();
+ g_signal_connect (pconnection, "connection-changed",
+ G_CALLBACK (pk_connection_changed_cb), loop);
+
client = pk_client_new ();
g_signal_connect (client, "package",
G_CALLBACK (pk_console_package_cb), NULL);
More information about the PackageKit
mailing list