1 diff -urN gnome-packagekit-3.6.0/configure.ac gnome-packagekit-3.6.0.new/configure.ac
2 --- gnome-packagekit-3.6.0/configure.ac 2012-09-25 16:19:50.000000000 +0200
3 +++ gnome-packagekit-3.6.0.new/configure.ac 2012-10-09 13:56:53.458180536 +0200
7 PKG_CHECK_MODULES(SYSTEMD,
8 - [libsystemd-login polkit-gobject-1],
9 + [libsystemd-daemon libsystemd-login polkit-gobject-1],
10 [have_systemd=yes], [have_systemd=no])
12 AC_MSG_CHECKING([whether to use systemd])
13 diff -urN gnome-packagekit-3.6.0/src/gpk-distro-upgrade.c gnome-packagekit-3.6.0.new/src/gpk-distro-upgrade.c
14 --- gnome-packagekit-3.6.0/src/gpk-distro-upgrade.c 2012-06-26 12:18:11.000000000 +0200
15 +++ gnome-packagekit-3.6.0.new/src/gpk-distro-upgrade.c 2012-10-09 14:08:20.213457912 +0200
17 #include <packagekit-glib2/packagekit.h>
20 +#include <systemd/sd-daemon.h>
21 #include "systemd-proxy.h"
23 -#include "egg-console-kit.h"
25 +#include "egg-console-kit.h"
27 #include "gpk-animated-icon.h"
28 #include "gpk-common.h"
32 SystemdProxy *systemd_proxy;
34 - EggConsoleKit *console_kit;
36 + EggConsoleKit *console_kit;
37 GCancellable *cancellable;
38 GtkListStore *distro_upgrade_store;
42 if (response_id == GTK_RESPONSE_OK) {
44 - ret = systemd_proxy_restart (priv->systemd_proxy, &error);
46 - ret = egg_console_kit_restart (priv->console_kit, &error);
47 + if (priv->systemd_proxy != NULL)
48 + ret = systemd_proxy_restart (priv->systemd_proxy, &error);
51 + ret = egg_console_kit_restart (priv->console_kit, &error);
54 g_warning ("Cannot restart: %s", error->message);
57 _("Make sure you have saved any unsaved work before restarting."));
60 - ret = systemd_proxy_can_restart (priv->systemd_proxy, &can_restart, &error);
62 - /* check with ConsoleKit we can restart */
63 - ret = egg_console_kit_can_restart (priv->console_kit, &can_restart, &error);
64 + if (priv->systemd_proxy != NULL)
65 + ret = systemd_proxy_can_restart (priv->systemd_proxy, &can_restart, &error);
68 + /* check with ConsoleKit we can restart */
69 + ret = egg_console_kit_can_restart (priv->console_kit, &can_restart, &error);
72 g_warning ("cannot get consolekit CanRestart data: %s", error->message);
75 gtk_init (&argc, &argv);
76 priv = g_new0 (GpkDistroUpgradePrivate, 1);
78 - priv->systemd_proxy = systemd_proxy_new ();
80 - priv->console_kit = egg_console_kit_new ();
81 + if (sd_booted () > 0)
82 + priv->systemd_proxy = systemd_proxy_new ();
85 + priv->console_kit = egg_console_kit_new ();
87 priv->cancellable = g_cancellable_new ();
88 priv->client = pk_client_new ();
89 g_object_set (priv->client,
91 g_object_unref (priv->cancellable);
92 g_object_unref (priv->client);
94 - systemd_proxy_free (priv->systemd_proxy);
96 - g_object_unref (priv->console_kit);
97 + if (priv->systemd_proxy != NULL)
98 + systemd_proxy_free (priv->systemd_proxy);
101 + g_object_unref (priv->console_kit);
105 g_object_unref (application);
106 diff -urN gnome-packagekit-3.6.0/src/gpk-update-viewer.c gnome-packagekit-3.6.0.new/src/gpk-update-viewer.c
107 --- gnome-packagekit-3.6.0/src/gpk-update-viewer.c 2012-07-12 10:01:38.000000000 +0200
108 +++ gnome-packagekit-3.6.0.new/src/gpk-update-viewer.c 2012-10-09 14:03:49.276526624 +0200
110 #include "egg-string.h"
111 #include "egg-markdown.h"
113 +#include <systemd/sd-daemon.h>
114 #include "systemd-proxy.h"
116 -#include "egg-console-kit.h"
118 +#include "egg-console-kit.h"
120 #include "gpk-cell-renderer-info.h"
121 #include "gpk-cell-renderer-restart.h"
123 static PkRestartEnum restart_worst = 0;
125 static SystemdProxy *proxy = NULL;
127 -static EggConsoleKit *console = NULL;
129 +static EggConsoleKit *console = NULL;
130 static EggMarkdown *markdown = NULL;
131 static GCancellable *cancellable = NULL;
132 static GSettings *settings = NULL;
133 @@ -249,10 +248,11 @@
134 if (restart_update == PK_RESTART_ENUM_SYSTEM ||
135 restart_update == PK_RESTART_ENUM_SECURITY_SYSTEM) {
137 - systemd_proxy_can_restart (proxy, &show_button, NULL);
139 - egg_console_kit_can_restart (console, &show_button, NULL);
141 + systemd_proxy_can_restart (proxy, &show_button, NULL);
144 + egg_console_kit_can_restart (console, &show_button, NULL);
147 /* only show the button if we can do the action */
148 @@ -273,11 +273,13 @@
150 if (restart_update == PK_RESTART_ENUM_SYSTEM)
152 - ret = systemd_proxy_restart (proxy, &error);
154 - /* use consolekit to restart */
155 - ret = egg_console_kit_restart (console, &error);
157 + ret = systemd_proxy_restart (proxy, &error);
160 + /* use consolekit to restart */
161 + ret = egg_console_kit_restart (console, &error);
164 /* TRANSLATORS: the PackageKit request did not complete, and it did not send an error */
165 gpk_update_viewer_error_dialog (_("Could not restart"), NULL, error->message);
166 @@ -3238,10 +3240,12 @@
168 settings = g_settings_new (GPK_SETTINGS_SCHEMA);
170 - proxy = systemd_proxy_new ();
172 - console = egg_console_kit_new ();
173 + if (sd_booted () > 0)
174 + proxy = systemd_proxy_new ();
177 + console = egg_console_kit_new ();
179 cancellable = g_cancellable_new ();
180 markdown = egg_markdown_new ();
181 egg_markdown_set_output (markdown, EGG_MARKDOWN_OUTPUT_PANGO);
182 @@ -3484,10 +3488,9 @@
185 systemd_proxy_free (proxy);
189 g_object_unref (console);
192 g_object_unref (control);
193 if (settings != NULL)
194 diff -urN gnome-packagekit-3.6.0/src/Makefile.am gnome-packagekit-3.6.0.new/src/Makefile.am
195 --- gnome-packagekit-3.6.0/src/Makefile.am 2012-05-15 14:44:47.000000000 +0200
196 +++ gnome-packagekit-3.6.0.new/src/Makefile.am 2012-10-09 13:59:32.313986610 +0200
201 + egg-console-kit.c \
202 + egg-console-kit.h \
206 libgpkshared_a_SOURCES += \
210 -libgpkshared_a_SOURCES += \
211 - egg-console-kit.c \