]> git.pld-linux.org Git - packages/gnome-packagekit.git/blob - systemd-fallback.patch
d579eafe7be581008dabe9344004cd535c072780
[packages/gnome-packagekit.git] / systemd-fallback.patch
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
4 @@ -146,7 +146,7 @@
5                [with_systemd=auto])
6  
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])
11  
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
16 @@ -27,10 +27,10 @@
17  #include <packagekit-glib2/packagekit.h>
18  
19  #ifdef HAVE_SYSTEMD
20 +#include <systemd/sd-daemon.h>
21  #include "systemd-proxy.h"
22 -#else
23 -#include "egg-console-kit.h"
24  #endif
25 +#include "egg-console-kit.h"
26  
27  #include "gpk-animated-icon.h"
28  #include "gpk-common.h"
29 @@ -47,9 +47,8 @@
30  typedef struct {
31  #ifdef HAVE_SYSTEMD
32          SystemdProxy    *systemd_proxy;
33 -#else
34 -       EggConsoleKit   *console_kit;
35  #endif
36 +       EggConsoleKit   *console_kit;
37         GCancellable    *cancellable;
38         GtkListStore    *distro_upgrade_store;
39         GtkWidget       *assistant;
40 @@ -118,10 +117,12 @@
41         /* restart */
42         if (response_id == GTK_RESPONSE_OK) {
43  #ifdef HAVE_SYSTEMD
44 -                ret = systemd_proxy_restart (priv->systemd_proxy, &error);
45 -#else
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);
49 +               else
50  #endif
51 +                       ret = egg_console_kit_restart (priv->console_kit, &error);
52 +
53                 if (!ret) {
54                         g_warning ("Cannot restart: %s", error->message);
55                         g_error_free (error);
56 @@ -178,11 +179,13 @@
57                                                   _("Make sure you have saved any unsaved work before restarting."));
58  
59  #ifdef HAVE_SYSTEMD
60 -        ret = systemd_proxy_can_restart (priv->systemd_proxy, &can_restart, &error);
61 -#else
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);
66 +       else
67  #endif
68 +               /* check with ConsoleKit we can restart */
69 +               ret = egg_console_kit_can_restart (priv->console_kit, &can_restart, &error);
70 +
71         if (!ret) {
72                 g_warning ("cannot get consolekit CanRestart data: %s", error->message);
73                 g_error_free (error);
74 @@ -768,10 +771,12 @@
75         gtk_init (&argc, &argv);
76         priv = g_new0 (GpkDistroUpgradePrivate, 1);
77  #ifdef HAVE_SYSTEMD
78 -        priv->systemd_proxy = systemd_proxy_new ();
79 -#else
80 -       priv->console_kit = egg_console_kit_new ();
81 +       if (sd_booted () > 0)
82 +               priv->systemd_proxy = systemd_proxy_new ();
83 +       else
84  #endif
85 +               priv->console_kit = egg_console_kit_new ();
86 +
87         priv->cancellable = g_cancellable_new ();
88         priv->client = pk_client_new ();
89         g_object_set (priv->client,
90 @@ -807,10 +812,12 @@
91         g_object_unref (priv->cancellable);
92         g_object_unref (priv->client);
93  #ifdef HAVE_SYSTEMD
94 -        systemd_proxy_free (priv->systemd_proxy);
95 -#else
96 -       g_object_unref (priv->console_kit);
97 +       if (priv->systemd_proxy != NULL)
98 +               systemd_proxy_free (priv->systemd_proxy);
99 +       else
100  #endif
101 +               g_object_unref (priv->console_kit);
102 +
103         g_free (priv);
104          if (application)
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
109 @@ -33,10 +33,10 @@
110  #include "egg-string.h"
111  #include "egg-markdown.h"
112  #ifdef HAVE_SYSTEMD
113 +#include <systemd/sd-daemon.h>
114  #include "systemd-proxy.h"
115 -#else
116 -#include "egg-console-kit.h"
117  #endif
118 +#include "egg-console-kit.h"
119  
120  #include "gpk-cell-renderer-info.h"
121  #include "gpk-cell-renderer-restart.h"
122 @@ -63,9 +63,8 @@
123  static PkRestartEnum            restart_worst = 0;
124  #ifdef HAVE_SYSTEMD
125  static  SystemdProxy            *proxy = NULL;
126 -#else
127 -static EggConsoleKit           *console = NULL;
128  #endif
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) {
136  #ifdef HAVE_SYSTEMD
137 -                systemd_proxy_can_restart (proxy, &show_button, NULL);
138 -#else
139 -               egg_console_kit_can_restart (console, &show_button, NULL);
140 +               if (proxy != NULL)
141 +                       systemd_proxy_can_restart (proxy, &show_button, NULL);
142 +               else
143  #endif
144 +                       egg_console_kit_can_restart (console, &show_button, NULL);
145         }
146  
147         /* only show the button if we can do the action */
148 @@ -273,11 +273,13 @@
149         /* do the action */
150         if (restart_update == PK_RESTART_ENUM_SYSTEM)
151  #ifdef HAVE_SYSTEMD
152 -                ret = systemd_proxy_restart (proxy, &error);
153 -#else
154 -               /* use consolekit to restart */
155 -               ret = egg_console_kit_restart (console, &error);
156 +               if (proxy != NULL)
157 +                       ret = systemd_proxy_restart (proxy, &error);
158 +               else
159  #endif
160 +                       /* use consolekit to restart */
161 +                       ret = egg_console_kit_restart (console, &error);
162 +
163                 if (!ret) {
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 @@
167  
168         settings = g_settings_new (GPK_SETTINGS_SCHEMA);
169  #ifdef HAVE_SYSTEMD
170 -        proxy = systemd_proxy_new ();
171 -#else
172 -       console = egg_console_kit_new ();
173 +       if (sd_booted () > 0)
174 +               proxy = systemd_proxy_new ();
175 +       else
176  #endif
177 +               console = egg_console_kit_new ();
178 +
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 @@
183  #ifdef HAVE_SYSTEMD
184          if (proxy != NULL)
185                  systemd_proxy_free (proxy);
186 -#else
187 +#endif
188         if (console != NULL)
189                 g_object_unref (console);
190 -#endif
191         if (control != NULL)
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
197 @@ -87,16 +87,14 @@
198         gpk-task.h                                      \
199         gpk-error.c                                     \
200         gpk-error.h                                     \
201 +       egg-console-kit.c                               \
202 +       egg-console-kit.h                               \
203         $(NULL)
204  
205  if WITH_SYSTEMD
206  libgpkshared_a_SOURCES +=                              \
207         systemd-proxy.c                                 \
208         systemd-proxy.h
209 -else
210 -libgpkshared_a_SOURCES +=                              \
211 -       egg-console-kit.c                               \
212 -       egg-console-kit.h
213  endif
214  
215  shared_LIBS =                                          \
This page took 0.133132 seconds and 2 git commands to generate.