[gnome-packagekit] Nuke gpk_restart_system(), and use the EggConsoleKit stuff instead to reduce code duplication



commit 733222eb62dbc96ae9b7666ec108914ed77176da
Author: Richard Hughes <richard hughsie com>
Date:   Mon Aug 10 14:55:33 2009 +0100

    Nuke gpk_restart_system(), and use the EggConsoleKit stuff instead to reduce code duplication

 src/Makefile.am         |    2 -
 src/gpk-check-update.c  |    1 -
 src/gpk-consolekit.c    |   78 -----------------------------------------------
 src/gpk-consolekit.h    |   33 --------------------
 src/gpk-update-viewer.c |    1 -
 src/gpk-watch.c         |   15 ++++++++-
 6 files changed, 13 insertions(+), 117 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index ed90394..84043e7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -70,8 +70,6 @@ libgpkshared_a_SOURCES =				\
 	gpk-desktop.h					\
 	gpk-animated-icon.c				\
 	gpk-animated-icon.h				\
-	gpk-consolekit.c				\
-	gpk-consolekit.h				\
 	gpk-dialog.c					\
 	gpk-dialog.h					\
 	gpk-vendor.c					\
diff --git a/src/gpk-check-update.c b/src/gpk-check-update.c
index bd3f3c2..d1ce609 100644
--- a/src/gpk-check-update.c
+++ b/src/gpk-check-update.c
@@ -44,7 +44,6 @@
 #include "egg-string.h"
 #include "egg-dbus-monitor.h"
 
-#include "gpk-consolekit.h"
 #include "gpk-common.h"
 #include "gpk-gnome.h"
 #include "gpk-auto-refresh.h"
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 55fe175..e29bc99 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -44,7 +44,6 @@
 #include "gpk-gnome.h"
 #include "gpk-dialog.h"
 #include "gpk-error.h"
-#include "gpk-consolekit.h"
 #include "gpk-cell-renderer-size.h"
 #include "gpk-cell-renderer-info.h"
 #include "gpk-cell-renderer-restart.h"
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index ba0cdfc..ea2ba29 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -41,6 +41,7 @@
 
 #include "egg-debug.h"
 #include "egg-string.h"
+#include "egg-console-kit.h"
 
 #include "gpk-common.h"
 #include "gpk-session.h"
@@ -48,7 +49,6 @@
 #include "gpk-watch.h"
 #include "gpk-modal-dialog.h"
 #include "gpk-inhibit.h"
-#include "gpk-consolekit.h"
 #include "gpk-enum.h"
 
 static void     gpk_watch_finalize	(GObject       *object);
@@ -1275,7 +1275,18 @@ gpk_watch_menu_log_out_cb (GtkMenuItem *item, gpointer data)
 static void
 gpk_watch_menu_restart_cb (GtkMenuItem *item, gpointer data)
 {
-	gpk_restart_system ();
+	gboolean ret;
+	GError *error = NULL;
+	EggConsoleKit *console;
+
+	/* restart using ConsoleKit */
+	console = egg_console_kit_new ();
+	ret = egg_console_kit_restart (console, &error);
+	if (!ret) {
+		egg_warning ("restarting failed: %s", error->message);
+		g_error_free (error);
+	}
+	g_object_unref (console);
 }
 
 /**



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