mirror of
https://github.com/dguglielmi/sunny-overlay.git
synced 2025-12-06 09:32:37 +01:00
205 lines
6.6 KiB
Diff
205 lines
6.6 KiB
Diff
--- cairo-dock-plugins-3.3.2/CMakeLists.txt.upower1 2014-06-16 14:01:49.819680691 +0900
|
|
+++ cairo-dock-plugins-3.3.2/CMakeLists.txt 2014-06-16 14:01:49.821680926 +0900
|
|
@@ -357,9 +357,10 @@
|
|
STRING (REGEX REPLACE "[0-9]*\\.([^ ]+)" "\\1" UPOWER_MINOR "${UPOWER_VERSION}") # 2.28.3 => 2.28
|
|
STRING (REGEX REPLACE "\\.[0-9]*" "" UPOWER_MINOR "${UPOWER_MINOR}") # 2.28 => 28
|
|
if (${UPOWER_MAJOR} GREATER 0 OR ${UPOWER_MINOR} GREATER 89)
|
|
- message (STATUS " Your version of UPower no longer supports logout features")
|
|
+ message (STATUS " Your version of UPower no longer supports suspend/hibernate features")
|
|
+ set (with_upower_support "yes (0.99+)")
|
|
else()
|
|
- set (UPOWER_SUPPORTS_LOGOUT 1)
|
|
+ set (UPOWER_SUPPORTS_SUSPEND_HIBERNATE 1)
|
|
endif()
|
|
else()
|
|
set (with_upower_support no)
|
|
--- cairo-dock-plugins-3.3.2/logout/src/CMakeLists.txt.upower1 2014-06-16 14:01:49.822681043 +0900
|
|
+++ cairo-dock-plugins-3.3.2/logout/src/CMakeLists.txt 2014-06-16 14:02:34.010855358 +0900
|
|
@@ -21,7 +21,7 @@
|
|
add_definitions (-DMY_APPLET_DOCK_VERSION="${dock_version}")
|
|
add_definitions (-DMY_APPLET_ICON_FILE="icon.svg")
|
|
|
|
-if (UPOWER_SUPPORTS_LOGOUT)
|
|
+if (UPOWER_SUPPORTS_SUSPEND_HIBERNATE)
|
|
add_definitions (-DCD_UPOWER_AVAILABLE="1")
|
|
|
|
include_directories (
|
|
--- cairo-dock-plugins-3.3.2/powermanager/src/CMakeLists.txt.upower1 2013-10-03 20:04:33.000000000 +0900
|
|
+++ cairo-dock-plugins-3.3.2/powermanager/src/CMakeLists.txt 2014-06-16 14:01:49.822681043 +0900
|
|
@@ -25,7 +25,10 @@
|
|
add_definitions (-DMY_APPLET_DOCK_VERSION="${dock_version}")
|
|
add_definitions (-DMY_APPLET_ICON_FILE="icon.png")
|
|
if (${UPOWER_FOUND})
|
|
- add_definitions (-DCD_UPOWER_AVAILABLE="1")
|
|
+ add_definitions (-DCD_UPOWER_AVAILABLE=1)
|
|
+ if (NOT UPOWER_SUPPORTS_SUSPEND_HIBERNATE)
|
|
+ add_definitions (-DCD_UPOWER_0_99=1)
|
|
+ endif()
|
|
endif()
|
|
|
|
include_directories (
|
|
--- cairo-dock-plugins-3.3.2/powermanager/src/powermanager-menu-functions.c.upower1 2013-10-03 20:04:33.000000000 +0900
|
|
+++ cairo-dock-plugins-3.3.2/powermanager/src/powermanager-menu-functions.c 2014-06-16 14:01:49.822681043 +0900
|
|
@@ -90,19 +90,5 @@
|
|
|
|
if (bAddSeparator)
|
|
CD_APPLET_ADD_SEPARATOR_IN_MENU (CD_APPLET_MY_MENU);
|
|
-
|
|
- // Power actions (Hibernate/Suspend)
|
|
- #ifdef CD_UPOWER_AVAILABLE // if Upower is available, we should be able to suspend; if not, then it's probably just a problem with consolekit, which should be fixed by the user; so show the items to give the user a hint about the problem.
|
|
- pMenuItem = CD_APPLET_ADD_IN_MENU (D_("Hibernate"), cd_power_hibernate, CD_APPLET_MY_MENU);
|
|
- if (! cd_power_can_hibernate ())
|
|
- gtk_widget_set_sensitive (pMenuItem, FALSE);
|
|
- pMenuItem = CD_APPLET_ADD_IN_MENU (D_("Suspend"), cd_power_suspend, CD_APPLET_MY_MENU);
|
|
- if (! cd_power_can_suspend ())
|
|
- gtk_widget_set_sensitive (pMenuItem, FALSE);
|
|
- #else
|
|
- if (cd_power_can_hibernate ())
|
|
- CD_APPLET_ADD_IN_MENU (D_("Hibernate"), cd_power_hibernate, CD_APPLET_MY_MENU);
|
|
- if (cd_power_can_suspend ())
|
|
- CD_APPLET_ADD_IN_MENU (D_("Suspend"), cd_power_suspend, CD_APPLET_MY_MENU);
|
|
- #endif
|
|
+
|
|
CD_APPLET_ON_BUILD_MENU_END
|
|
--- cairo-dock-plugins-3.3.2/powermanager/src/powermanager-struct.h.upower1 2013-10-03 20:04:33.000000000 +0900
|
|
+++ cairo-dock-plugins-3.3.2/powermanager/src/powermanager-struct.h 2014-06-16 14:01:49.823681160 +0900
|
|
@@ -22,10 +22,6 @@
|
|
|
|
#include <cairo-dock.h>
|
|
#ifdef CD_UPOWER_AVAILABLE
|
|
-/* to access suspend/resume functionality on Upower 0.9
|
|
- * even if we use first logind, we only use logind via DBus
|
|
- */
|
|
-#define UPOWER_ENABLE_DEPRECATED
|
|
#include <upower.h>
|
|
#endif
|
|
|
|
--- cairo-dock-plugins-3.3.2/powermanager/src/powermanager-upower.c.upower1 2013-10-03 20:04:33.000000000 +0900
|
|
+++ cairo-dock-plugins-3.3.2/powermanager/src/powermanager-upower.c 2014-06-16 14:01:49.823681160 +0900
|
|
@@ -48,7 +48,11 @@
|
|
UpClient *pUPowerClient = up_client_new ();
|
|
|
|
// get the list of devices.
|
|
- if (pUPowerClient == NULL || ! up_client_enumerate_devices_sync (pUPowerClient, NULL, NULL))
|
|
+ if (pUPowerClient == NULL
|
|
+ #ifndef CD_UPOWER_0_99 // no longer available with UPower 0.99+
|
|
+ || ! up_client_enumerate_devices_sync (pUPowerClient, NULL, NULL)
|
|
+ #endif
|
|
+ )
|
|
{
|
|
cd_warning ("couldn't get devices from UPower daemon");
|
|
if (pUPowerClient)
|
|
@@ -182,6 +186,7 @@
|
|
CD_APPLET_LEAVE ();
|
|
}
|
|
|
|
+#ifndef CD_UPOWER_0_99 // no longer used with UPower 0.99+
|
|
static void _on_device_changed (G_GNUC_UNUSED UpDevice *pDevice, G_GNUC_UNUSED gpointer data)
|
|
{
|
|
CD_APPLET_ENTER;
|
|
@@ -194,6 +199,7 @@
|
|
update_icon ();
|
|
CD_APPLET_LEAVE ();
|
|
}
|
|
+#endif
|
|
|
|
// Can be launched the first time (with the Task) or when a device is added/removed after.
|
|
static gboolean _cd_upower_update_state (CDSharedMemory *pSharedMemory)
|
|
@@ -248,6 +254,7 @@
|
|
g_free (cVendor);
|
|
g_free (cModel);
|
|
|
|
+ #ifndef CD_UPOWER_0_99 // no longer used with UPower 0.99+
|
|
if (myData.pTask != NULL // only the first time
|
|
|| myData.pBatteryDeviceList == NULL // or if it's a new device
|
|
|| g_list_find (myData.pBatteryDeviceList, pDevice) == NULL)
|
|
@@ -262,6 +269,7 @@
|
|
iSignalID = g_signal_connect (pDevice, "changed", G_CALLBACK (_on_device_changed), NULL);
|
|
myData.pSignalIDList = g_list_append (myData.pSignalIDList, GINT_TO_POINTER (iSignalID));
|
|
}
|
|
+ #endif
|
|
|
|
bFirst = FALSE;
|
|
}
|
|
@@ -364,38 +372,6 @@
|
|
}
|
|
}
|
|
|
|
-gboolean cd_power_hibernate (void)
|
|
-{
|
|
- if (myData.pUPowerClient != NULL)
|
|
- return up_client_hibernate_sync (myData.pUPowerClient, NULL, NULL);
|
|
- else
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-gboolean cd_power_suspend (void)
|
|
-{
|
|
- if (myData.pUPowerClient != NULL)
|
|
- return up_client_suspend_sync (myData.pUPowerClient, NULL, NULL);
|
|
- else
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-gboolean cd_power_can_hibernate (void)
|
|
-{
|
|
- if (myData.pUPowerClient != NULL)
|
|
- return up_client_get_can_hibernate (myData.pUPowerClient);
|
|
- else
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-gboolean cd_power_can_suspend (void)
|
|
-{
|
|
- if (myData.pUPowerClient != NULL)
|
|
- return up_client_get_can_suspend (myData.pUPowerClient);
|
|
- else
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
#else // code without libupower
|
|
|
|
void cd_powermanager_start (void)
|
|
@@ -408,24 +384,4 @@
|
|
|
|
}
|
|
|
|
-gboolean cd_power_hibernate (void)
|
|
-{
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-gboolean cd_power_suspend (void)
|
|
-{
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-gboolean cd_power_can_hibernate (void)
|
|
-{
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-gboolean cd_power_can_suspend (void)
|
|
-{
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
#endif
|
|
--- cairo-dock-plugins-3.3.2/powermanager/src/powermanager-upower.h.upower1 2013-10-03 20:04:33.000000000 +0900
|
|
+++ cairo-dock-plugins-3.3.2/powermanager/src/powermanager-upower.h 2014-06-16 14:01:49.823681160 +0900
|
|
@@ -27,14 +27,4 @@
|
|
|
|
void cd_upower_stop (void);
|
|
|
|
-
|
|
-gboolean cd_power_hibernate (void);
|
|
-
|
|
-gboolean cd_power_suspend (void);
|
|
-
|
|
-gboolean cd_power_can_hibernate (void);
|
|
-
|
|
-gboolean cd_power_can_suspend (void);
|
|
-
|
|
-
|
|
#endif
|