summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/linux/up-backend.c17
-rw-r--r--src/up-backend.h6
-rw-r--r--src/up-daemon.c92
3 files changed, 104 insertions, 11 deletions
diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c
index 3656b69..e77dd1b 100644
--- a/src/linux/up-backend.c
+++ b/src/linux/up-backend.c
@@ -49,6 +49,7 @@
49#include <dbus/dbus-glib.h> 49#include <dbus/dbus-glib.h>
50#include <dbus/dbus-glib-lowlevel.h> 50#include <dbus/dbus-glib-lowlevel.h>
51 51
52#ifdef ENABLE_DEPRECATED
52#ifdef HAVE_SYSTEMD 53#ifdef HAVE_SYSTEMD
53#include <systemd/sd-daemon.h> 54#include <systemd/sd-daemon.h>
54 55
@@ -56,6 +57,7 @@
56#define SD_SUSPEND_COMMAND "gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.Suspend 'true'" 57#define SD_SUSPEND_COMMAND "gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.Suspend 'true'"
57 58
58#endif 59#endif
60#endif
59 61
60static void up_backend_class_init (UpBackendClass *klass); 62static void up_backend_class_init (UpBackendClass *klass);
61static void up_backend_init (UpBackend *backend); 63static void up_backend_init (UpBackend *backend);
@@ -77,7 +79,9 @@ struct UpBackendPrivate
77enum { 79enum {
78 SIGNAL_DEVICE_ADDED, 80 SIGNAL_DEVICE_ADDED,
79 SIGNAL_DEVICE_REMOVED, 81 SIGNAL_DEVICE_REMOVED,
82#ifdef ENABLE_DEPRECATED
80 SIGNAL_RESUMING, 83 SIGNAL_RESUMING,
84#endif
81 SIGNAL_LAST 85 SIGNAL_LAST
82}; 86};
83 87
@@ -88,8 +92,10 @@ G_DEFINE_TYPE (UpBackend, up_backend, G_TYPE_OBJECT)
88static gboolean up_backend_device_add (UpBackend *backend, GUdevDevice *native); 92static gboolean up_backend_device_add (UpBackend *backend, GUdevDevice *native);
89static void up_backend_device_remove (UpBackend *backend, GUdevDevice *native); 93static void up_backend_device_remove (UpBackend *backend, GUdevDevice *native);
90 94
95#ifdef ENABLE_DEPRECATED
91#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend" 96#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend"
92#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate" 97#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate"
98#endif
93#define UP_BACKEND_POWERSAVE_TRUE_COMMAND "/usr/sbin/pm-powersave true" 99#define UP_BACKEND_POWERSAVE_TRUE_COMMAND "/usr/sbin/pm-powersave true"
94#define UP_BACKEND_POWERSAVE_FALSE_COMMAND "/usr/sbin/pm-powersave false" 100#define UP_BACKEND_POWERSAVE_FALSE_COMMAND "/usr/sbin/pm-powersave false"
95 101
@@ -362,6 +368,7 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
362 return TRUE; 368 return TRUE;
363} 369}
364 370
371#ifdef ENABLE_DEPRECATED
365/** 372/**
366 * up_backend_supports_sleep_state: 373 * up_backend_supports_sleep_state:
367 * 374 *
@@ -619,6 +626,7 @@ up_backend_emits_resuming (UpBackend *backend)
619#endif 626#endif
620 return FALSE; 627 return FALSE;
621} 628}
629#endif
622 630
623/** 631/**
624 * up_backend_get_powersave_command: 632 * up_backend_get_powersave_command:
@@ -653,16 +661,19 @@ up_backend_class_init (UpBackendClass *klass)
653 G_STRUCT_OFFSET (UpBackendClass, device_removed), 661 G_STRUCT_OFFSET (UpBackendClass, device_removed),
654 NULL, NULL, up_marshal_VOID__POINTER_POINTER, 662 NULL, NULL, up_marshal_VOID__POINTER_POINTER,
655 G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); 663 G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
664#ifdef ENABLE_DEPRECATED
656 signals [SIGNAL_RESUMING] = 665 signals [SIGNAL_RESUMING] =
657 g_signal_new ("resuming", 666 g_signal_new ("resuming",
658 G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, 667 G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
659 G_STRUCT_OFFSET (UpBackendClass, resuming), 668 G_STRUCT_OFFSET (UpBackendClass, resuming),
660 NULL, NULL, g_cclosure_marshal_VOID__VOID, 669 NULL, NULL, g_cclosure_marshal_VOID__VOID,
661 G_TYPE_NONE, 0); 670 G_TYPE_NONE, 0);
671#endif
662 672
663 g_type_class_add_private (klass, sizeof (UpBackendPrivate)); 673 g_type_class_add_private (klass, sizeof (UpBackendPrivate));
664} 674}
665 675
676#ifdef ENABLE_DEPRECATED
666static DBusHandlerResult 677static DBusHandlerResult
667message_filter (DBusConnection *connection, 678message_filter (DBusConnection *connection,
668 DBusMessage *message, 679 DBusMessage *message,
@@ -675,9 +686,9 @@ message_filter (DBusConnection *connection,
675 g_signal_emit (backend, signals[SIGNAL_RESUMING], 0); 686 g_signal_emit (backend, signals[SIGNAL_RESUMING], 0);
676 return DBUS_HANDLER_RESULT_HANDLED; 687 return DBUS_HANDLER_RESULT_HANDLED;
677 } 688 }
678
679 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 689 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
680} 690}
691#endif
681 692
682/** 693/**
683 * up_backend_init: 694 * up_backend_init:
@@ -691,6 +702,7 @@ up_backend_init (UpBackend *backend)
691 backend->priv->device_list = NULL; 702 backend->priv->device_list = NULL;
692 backend->priv->managed_devices = up_device_list_new (); 703 backend->priv->managed_devices = up_device_list_new ();
693 704
705#ifdef ENABLE_DEPRECATED
694#ifdef HAVE_SYSTEMD 706#ifdef HAVE_SYSTEMD
695 if (sd_booted ()) { 707 if (sd_booted ()) {
696 DBusGConnection *bus; 708 DBusGConnection *bus;
@@ -699,6 +711,7 @@ up_backend_init (UpBackend *backend)
699 dbus_connection_add_filter (backend->priv->connection, message_filter, backend, NULL); 711 dbus_connection_add_filter (backend->priv->connection, message_filter, backend, NULL);
700 } 712 }
701#endif 713#endif
714#endif
702} 715}
703 716
704/** 717/**
@@ -723,8 +736,10 @@ up_backend_finalize (GObject *object)
723 736
724 g_object_unref (backend->priv->managed_devices); 737 g_object_unref (backend->priv->managed_devices);
725 738
739#ifdef ENABLE_DEPRECATED
726 if (backend->priv->connection) 740 if (backend->priv->connection)
727 dbus_connection_remove_filter (backend->priv->connection, message_filter, backend); 741 dbus_connection_remove_filter (backend->priv->connection, message_filter, backend);
742#endif
728 743
729 G_OBJECT_CLASS (up_backend_parent_class)->finalize (object); 744 G_OBJECT_CLASS (up_backend_parent_class)->finalize (object);
730} 745}
diff --git a/src/up-backend.h b/src/up-backend.h
index 08dac8b..2554453 100644
--- a/src/up-backend.h
+++ b/src/up-backend.h
@@ -59,7 +59,9 @@ typedef struct
59 void (* device_removed) (UpBackend *backend, 59 void (* device_removed) (UpBackend *backend,
60 GObject *native, 60 GObject *native,
61 UpDevice *device); 61 UpDevice *device);
62#ifdef ENABLE_DEPRECATED
62 void (* resuming) (UpBackend *backend); 63 void (* resuming) (UpBackend *backend);
64#endif
63} UpBackendClass; 65} UpBackendClass;
64 66
65GType up_backend_get_type (void); 67GType up_backend_get_type (void);
@@ -68,15 +70,19 @@ void up_backend_test (gpointer user_data);
68 70
69gboolean up_backend_coldplug (UpBackend *backend, 71gboolean up_backend_coldplug (UpBackend *backend,
70 UpDaemon *daemon); 72 UpDaemon *daemon);
73#ifdef ENABLE_DEPRECATED
71gboolean up_backend_kernel_can_suspend (UpBackend *backend); 74gboolean up_backend_kernel_can_suspend (UpBackend *backend);
72gboolean up_backend_kernel_can_hibernate (UpBackend *backend); 75gboolean up_backend_kernel_can_hibernate (UpBackend *backend);
73gboolean up_backend_has_encrypted_swap (UpBackend *backend); 76gboolean up_backend_has_encrypted_swap (UpBackend *backend);
74gfloat up_backend_get_used_swap (UpBackend *backend); 77gfloat up_backend_get_used_swap (UpBackend *backend);
75const gchar *up_backend_get_suspend_command (UpBackend *backend); 78const gchar *up_backend_get_suspend_command (UpBackend *backend);
76const gchar *up_backend_get_hibernate_command (UpBackend *backend); 79const gchar *up_backend_get_hibernate_command (UpBackend *backend);
80#endif
77const gchar *up_backend_get_powersave_command (UpBackend *backend, 81const gchar *up_backend_get_powersave_command (UpBackend *backend,
78 gboolean powersave); 82 gboolean powersave);
83#ifdef ENABLE_DEPRECATED
79gboolean up_backend_emits_resuming (UpBackend *backend); 84gboolean up_backend_emits_resuming (UpBackend *backend);
85#endif
80 86
81G_END_DECLS 87G_END_DECLS
82 88
diff --git a/src/up-daemon.c b/src/up-daemon.c
index be416ab..a5ab658 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -86,17 +86,23 @@ struct UpDaemonPrivate
86 gboolean lid_is_present; 86 gboolean lid_is_present;
87 gboolean lid_force_sleep; 87 gboolean lid_force_sleep;
88 gboolean is_docked; 88 gboolean is_docked;
89#ifdef ENABLE_DEPRECATED
89 gboolean kernel_can_suspend; 90 gboolean kernel_can_suspend;
90 gboolean kernel_can_hibernate; 91 gboolean kernel_can_hibernate;
91 gboolean hibernate_has_encrypted_swap; 92 gboolean hibernate_has_encrypted_swap;
93#endif
92 gboolean during_coldplug; 94 gboolean during_coldplug;
95#ifdef ENABLE_DEPRECATED
93 gboolean sent_sleeping_signal; 96 gboolean sent_sleeping_signal;
97#endif
94 guint battery_poll_id; 98 guint battery_poll_id;
95 guint battery_poll_count; 99 guint battery_poll_count;
100#ifdef ENABLE_DEPRECATED
96 GTimer *about_to_sleep_timer; 101 GTimer *about_to_sleep_timer;
97 guint about_to_sleep_id; 102 guint about_to_sleep_id;
98 guint conf_sleep_timeout; 103 guint conf_sleep_timeout;
99 gboolean conf_allow_hibernate_encrypted_swap; 104 gboolean conf_allow_hibernate_encrypted_swap;
105#endif
100 gboolean conf_run_powersave_command; 106 gboolean conf_run_powersave_command;
101 const gchar *sleep_kind; 107 const gchar *sleep_kind;
102}; 108};
@@ -338,8 +344,9 @@ up_daemon_about_to_sleep (UpDaemon *daemon,
338 const gchar *sleep_kind, 344 const gchar *sleep_kind,
339 DBusGMethodInvocation *context) 345 DBusGMethodInvocation *context)
340{ 346{
341 PolkitSubject *subject = NULL;
342 GError *error; 347 GError *error;
348#ifdef ENABLE_DEPRECATED
349 PolkitSubject *subject = NULL;
343 UpDaemonPrivate *priv = daemon->priv; 350 UpDaemonPrivate *priv = daemon->priv;
344 351
345 /* already requested */ 352 /* already requested */
@@ -373,6 +380,15 @@ out:
373 if (subject != NULL) 380 if (subject != NULL)
374 g_object_unref (subject); 381 g_object_unref (subject);
375 return TRUE; 382 return TRUE;
383#else
384 /* just return an error */
385 error = g_error_new_literal (UP_DAEMON_ERROR,
386 UP_DAEMON_ERROR_GENERAL,
387 "Method is deprecated, please port to org.freedesktop.login1.Manager.Inhibit");
388 dbus_g_method_return_error (context, error);
389 g_error_free (error);
390 return FALSE;
391#endif
376} 392}
377 393
378/* temp object for deferred callback */ 394/* temp object for deferred callback */
@@ -383,6 +399,7 @@ typedef struct {
383 gulong handler; 399 gulong handler;
384} UpDaemonDeferredSleep; 400} UpDaemonDeferredSleep;
385 401
402#ifdef ENABLE_DEPRECATED
386static void 403static void
387emit_resuming (UpDaemonDeferredSleep *sleep) 404emit_resuming (UpDaemonDeferredSleep *sleep)
388{ 405{
@@ -504,6 +521,7 @@ up_daemon_deferred_sleep (UpDaemon *daemon, const gchar *command, DBusGMethodInv
504#endif 521#endif
505 } 522 }
506} 523}
524#endif
507 525
508/** 526/**
509 * up_daemon_suspend: 527 * up_daemon_suspend:
@@ -512,6 +530,7 @@ gboolean
512up_daemon_suspend (UpDaemon *daemon, DBusGMethodInvocation *context) 530up_daemon_suspend (UpDaemon *daemon, DBusGMethodInvocation *context)
513{ 531{
514 GError *error; 532 GError *error;
533#ifdef ENABLE_DEPRECATED
515 PolkitSubject *subject = NULL; 534 PolkitSubject *subject = NULL;
516 const gchar *command; 535 const gchar *command;
517 UpDaemonPrivate *priv = daemon->priv; 536 UpDaemonPrivate *priv = daemon->priv;
@@ -551,6 +570,15 @@ out:
551 if (subject != NULL) 570 if (subject != NULL)
552 g_object_unref (subject); 571 g_object_unref (subject);
553 return TRUE; 572 return TRUE;
573#else
574 /* just return an error */
575 error = g_error_new_literal (UP_DAEMON_ERROR,
576 UP_DAEMON_ERROR_GENERAL,
577 "Method is deprecated, please port to org.freedesktop.login1.Manager.Suspend");
578 dbus_g_method_return_error (context, error);
579 g_error_free (error);
580 return FALSE;
581#endif
554} 582}
555 583
556/** 584/**
@@ -559,10 +587,11 @@ out:
559gboolean 587gboolean
560up_daemon_suspend_allowed (UpDaemon *daemon, DBusGMethodInvocation *context) 588up_daemon_suspend_allowed (UpDaemon *daemon, DBusGMethodInvocation *context)
561{ 589{
590 GError *error;
591#ifdef ENABLE_DEPRECATED
562 gboolean ret; 592 gboolean ret;
563 PolkitSubject *subject = NULL; 593 PolkitSubject *subject = NULL;
564 UpDaemonPrivate *priv = daemon->priv; 594 UpDaemonPrivate *priv = daemon->priv;
565 GError *error;
566 595
567 subject = up_polkit_get_subject (priv->polkit, context); 596 subject = up_polkit_get_subject (priv->polkit, context);
568 if (subject == NULL) 597 if (subject == NULL)
@@ -582,9 +611,19 @@ out:
582 if (subject != NULL) 611 if (subject != NULL)
583 g_object_unref (subject); 612 g_object_unref (subject);
584 return TRUE; 613 return TRUE;
614#else
615 /* just return an error */
616 error = g_error_new_literal (UP_DAEMON_ERROR,
617 UP_DAEMON_ERROR_GENERAL,
618 "Method is deprecated, please port to org.freedesktop.login1.Manager.CanSuspend");
619 dbus_g_method_return_error (context, error);
620 g_error_free (error);
621 return FALSE;
622#endif
585} 623}
586 624
587/** 625#ifdef ENABLE_DEPRECATED
626/**
588 * up_daemon_check_hibernate_swap: 627 * up_daemon_check_hibernate_swap:
589 * 628 *
590 * Check current memory usage whether we have enough swap space for 629 * Check current memory usage whether we have enough swap space for
@@ -608,6 +647,7 @@ up_daemon_check_hibernate_swap (UpDaemon *daemon)
608 647
609 return FALSE; 648 return FALSE;
610} 649}
650#endif
611 651
612/** 652/**
613 * up_daemon_hibernate: 653 * up_daemon_hibernate:
@@ -616,6 +656,7 @@ gboolean
616up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context) 656up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context)
617{ 657{
618 GError *error; 658 GError *error;
659#ifdef ENABLE_DEPRECATED
619 PolkitSubject *subject = NULL; 660 PolkitSubject *subject = NULL;
620 const gchar *command; 661 const gchar *command;
621 UpDaemonPrivate *priv = daemon->priv; 662 UpDaemonPrivate *priv = daemon->priv;
@@ -676,6 +717,15 @@ out:
676 if (subject != NULL) 717 if (subject != NULL)
677 g_object_unref (subject); 718 g_object_unref (subject);
678 return TRUE; 719 return TRUE;
720#else
721 /* just return an error */
722 error = g_error_new_literal (UP_DAEMON_ERROR,
723 UP_DAEMON_ERROR_GENERAL,
724 "Method is deprecated, please port to org.freedesktop.login1.Manager.Hibernate");
725 dbus_g_method_return_error (context, error);
726 g_error_free (error);
727 return FALSE;
728#endif
679} 729}
680 730
681/** 731/**
@@ -684,10 +734,11 @@ out:
684gboolean 734gboolean
685up_daemon_hibernate_allowed (UpDaemon *daemon, DBusGMethodInvocation *context) 735up_daemon_hibernate_allowed (UpDaemon *daemon, DBusGMethodInvocation *context)
686{ 736{
737 GError *error;
738#ifdef ENABLE_DEPRECATED
687 gboolean ret; 739 gboolean ret;
688 PolkitSubject *subject = NULL; 740 PolkitSubject *subject = NULL;
689 UpDaemonPrivate *priv = daemon->priv; 741 UpDaemonPrivate *priv = daemon->priv;
690 GError *error;
691 742
692 subject = up_polkit_get_subject (priv->polkit, context); 743 subject = up_polkit_get_subject (priv->polkit, context);
693 if (subject == NULL) 744 if (subject == NULL)
@@ -707,6 +758,15 @@ out:
707 if (subject != NULL) 758 if (subject != NULL)
708 g_object_unref (subject); 759 g_object_unref (subject);
709 return TRUE; 760 return TRUE;
761#else
762 /* just return an error */
763 error = g_error_new_literal (UP_DAEMON_ERROR,
764 UP_DAEMON_ERROR_GENERAL,
765 "Method is deprecated, please port to org.freedesktop.login1.Manager.CanHibernate");
766 dbus_g_method_return_error (context, error);
767 g_error_free (error);
768 return FALSE;
769#endif
710} 770}
711 771
712/** 772/**
@@ -1098,19 +1158,15 @@ up_daemon_init (UpDaemon *daemon)
1098 daemon->priv->lid_is_present = FALSE; 1158 daemon->priv->lid_is_present = FALSE;
1099 daemon->priv->is_docked = FALSE; 1159 daemon->priv->is_docked = FALSE;
1100 daemon->priv->lid_is_closed = FALSE; 1160 daemon->priv->lid_is_closed = FALSE;
1101 daemon->priv->kernel_can_suspend = FALSE;
1102 daemon->priv->kernel_can_hibernate = FALSE;
1103 daemon->priv->hibernate_has_encrypted_swap = FALSE;
1104 daemon->priv->power_devices = up_device_list_new (); 1161 daemon->priv->power_devices = up_device_list_new ();
1105 daemon->priv->on_battery = FALSE; 1162 daemon->priv->on_battery = FALSE;
1106 daemon->priv->on_low_battery = FALSE; 1163 daemon->priv->on_low_battery = FALSE;
1107 daemon->priv->during_coldplug = FALSE; 1164 daemon->priv->during_coldplug = FALSE;
1108 daemon->priv->sent_sleeping_signal = FALSE;
1109 daemon->priv->battery_poll_id = 0; 1165 daemon->priv->battery_poll_id = 0;
1110 daemon->priv->battery_poll_count = 0; 1166 daemon->priv->battery_poll_count = 0;
1111 daemon->priv->about_to_sleep_id = 0; 1167#ifdef ENABLE_DEPRECATED
1112 daemon->priv->conf_sleep_timeout = 1000; 1168 daemon->priv->conf_sleep_timeout = 1000;
1113 daemon->priv->conf_allow_hibernate_encrypted_swap = FALSE; 1169#endif
1114 daemon->priv->conf_run_powersave_command = TRUE; 1170 daemon->priv->conf_run_powersave_command = TRUE;
1115 1171
1116 /* load some values from the config file */ 1172 /* load some values from the config file */
@@ -1124,10 +1180,12 @@ up_daemon_init (UpDaemon *daemon)
1124 } 1180 }
1125 ret = g_key_file_load_from_file (file, filename, G_KEY_FILE_NONE, &error); 1181 ret = g_key_file_load_from_file (file, filename, G_KEY_FILE_NONE, &error);
1126 if (ret) { 1182 if (ret) {
1183#ifdef ENABLE_DEPRECATED
1127 daemon->priv->conf_sleep_timeout = 1184 daemon->priv->conf_sleep_timeout =
1128 g_key_file_get_integer (file, "UPower", "SleepTimeout", NULL); 1185 g_key_file_get_integer (file, "UPower", "SleepTimeout", NULL);
1129 daemon->priv->conf_allow_hibernate_encrypted_swap = 1186 daemon->priv->conf_allow_hibernate_encrypted_swap =
1130 g_key_file_get_boolean (file, "UPower", "AllowHibernateEncryptedSwap", NULL); 1187 g_key_file_get_boolean (file, "UPower", "AllowHibernateEncryptedSwap", NULL);
1188#endif
1131 daemon->priv->conf_run_powersave_command = 1189 daemon->priv->conf_run_powersave_command =
1132 g_key_file_get_boolean (file, "UPower", "RunPowersaveCommand", NULL); 1190 g_key_file_get_boolean (file, "UPower", "RunPowersaveCommand", NULL);
1133 } else { 1191 } else {
@@ -1144,8 +1202,10 @@ up_daemon_init (UpDaemon *daemon)
1144 G_CALLBACK (up_daemon_device_removed_cb), daemon); 1202 G_CALLBACK (up_daemon_device_removed_cb), daemon);
1145 1203
1146 /* use a timer for the about-to-sleep logic */ 1204 /* use a timer for the about-to-sleep logic */
1205#ifdef ENABLE_DEPRECATED
1147 daemon->priv->about_to_sleep_timer = g_timer_new (); 1206 daemon->priv->about_to_sleep_timer = g_timer_new ();
1148 g_timer_stop (daemon->priv->about_to_sleep_timer); 1207 g_timer_stop (daemon->priv->about_to_sleep_timer);
1208#endif
1149 1209
1150 /* watch when these properties change */ 1210 /* watch when these properties change */
1151 g_signal_connect (daemon, "notify::lid-is-present", 1211 g_signal_connect (daemon, "notify::lid-is-present",
@@ -1158,12 +1218,14 @@ up_daemon_init (UpDaemon *daemon)
1158 G_CALLBACK (up_daemon_properties_changed_cb), daemon); 1218 G_CALLBACK (up_daemon_properties_changed_cb), daemon);
1159 1219
1160 /* check if we have support */ 1220 /* check if we have support */
1221#ifdef ENABLE_DEPRECATED
1161 daemon->priv->kernel_can_suspend = up_backend_kernel_can_suspend (daemon->priv->backend); 1222 daemon->priv->kernel_can_suspend = up_backend_kernel_can_suspend (daemon->priv->backend);
1162 daemon->priv->kernel_can_hibernate = up_backend_kernel_can_hibernate (daemon->priv->backend); 1223 daemon->priv->kernel_can_hibernate = up_backend_kernel_can_hibernate (daemon->priv->backend);
1163 1224
1164 /* is the swap usable? */ 1225 /* is the swap usable? */
1165 if (daemon->priv->kernel_can_hibernate) 1226 if (daemon->priv->kernel_can_hibernate)
1166 daemon->priv->hibernate_has_encrypted_swap = up_backend_has_encrypted_swap (daemon->priv->backend); 1227 daemon->priv->hibernate_has_encrypted_swap = up_backend_has_encrypted_swap (daemon->priv->backend);
1228#endif
1167} 1229}
1168 1230
1169/** 1231/**
@@ -1214,13 +1276,21 @@ up_daemon_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
1214 g_value_set_string (value, PACKAGE_VERSION); 1276 g_value_set_string (value, PACKAGE_VERSION);
1215 break; 1277 break;
1216 case PROP_CAN_SUSPEND: 1278 case PROP_CAN_SUSPEND:
1279#ifdef ENABLE_DEPRECATED
1217 g_value_set_boolean (value, priv->kernel_can_suspend); 1280 g_value_set_boolean (value, priv->kernel_can_suspend);
1281#else
1282 g_value_set_boolean (value, FALSE);
1283#endif
1218 break; 1284 break;
1219 case PROP_CAN_HIBERNATE: 1285 case PROP_CAN_HIBERNATE:
1286#ifdef ENABLE_DEPRECATED
1220 g_value_set_boolean (value, (priv->kernel_can_hibernate && 1287 g_value_set_boolean (value, (priv->kernel_can_hibernate &&
1221 up_daemon_check_hibernate_swap (daemon) && 1288 up_daemon_check_hibernate_swap (daemon) &&
1222 (!priv->hibernate_has_encrypted_swap || 1289 (!priv->hibernate_has_encrypted_swap ||
1223 priv->conf_allow_hibernate_encrypted_swap))); 1290 priv->conf_allow_hibernate_encrypted_swap)));
1291#else
1292 g_value_set_boolean (value, FALSE);
1293#endif
1224 break; 1294 break;
1225 case PROP_ON_BATTERY: 1295 case PROP_ON_BATTERY:
1226 g_value_set_boolean (value, priv->on_battery); 1296 g_value_set_boolean (value, priv->on_battery);
@@ -1433,7 +1503,9 @@ up_daemon_finalize (GObject *object)
1433 g_object_unref (priv->polkit); 1503 g_object_unref (priv->polkit);
1434 g_object_unref (priv->config); 1504 g_object_unref (priv->config);
1435 g_object_unref (priv->backend); 1505 g_object_unref (priv->backend);
1506#ifdef ENABLE_DEPRECATED
1436 g_timer_destroy (priv->about_to_sleep_timer); 1507 g_timer_destroy (priv->about_to_sleep_timer);
1508#endif
1437 1509
1438 G_OBJECT_CLASS (up_daemon_parent_class)->finalize (object); 1510 G_OBJECT_CLASS (up_daemon_parent_class)->finalize (object);
1439} 1511}