diff options
Diffstat (limited to 'src/linux/up-backend.c')
-rw-r--r-- | src/linux/up-backend.c | 17 |
1 files changed, 16 insertions, 1 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 | ||
60 | static void up_backend_class_init (UpBackendClass *klass); | 62 | static void up_backend_class_init (UpBackendClass *klass); |
61 | static void up_backend_init (UpBackend *backend); | 63 | static void up_backend_init (UpBackend *backend); |
@@ -77,7 +79,9 @@ struct UpBackendPrivate | |||
77 | enum { | 79 | enum { |
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) | |||
88 | static gboolean up_backend_device_add (UpBackend *backend, GUdevDevice *native); | 92 | static gboolean up_backend_device_add (UpBackend *backend, GUdevDevice *native); |
89 | static void up_backend_device_remove (UpBackend *backend, GUdevDevice *native); | 93 | static 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 | ||
666 | static DBusHandlerResult | 677 | static DBusHandlerResult |
667 | message_filter (DBusConnection *connection, | 678 | message_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 | } |