mirror of
https://github.com/void-linux/void-packages.git
synced 2025-07-31 09:52:57 +02:00
xfce4-power-manager: update to 1.6.0
This commit is contained in:
parent
3d96e7ee9c
commit
41762a42ac
4 changed files with 358 additions and 6 deletions
20
srcpkgs/xfce4-power-manager/patches/0001-No-MATE.patch
Normal file
20
srcpkgs/xfce4-power-manager/patches/0001-No-MATE.patch
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
--- settings/xfce4-power-manager-settings.desktop.in.orig 2015-03-22 05:57:12.000000000 -0600
|
||||||
|
+++ settings/xfce4-power-manager-settings.desktop.in 2016-05-26 16:59:29.924613636 -0600
|
||||||
|
@@ -8,7 +8,7 @@
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-HardwareSettings;
|
||||||
|
-NotShowIn=GNOME;KDE;Unity;
|
||||||
|
+NotShowIn=GNOME;KDE;Unity;MATE;
|
||||||
|
StartupNotify=true
|
||||||
|
X-XfcePluggable=true
|
||||||
|
X-XfceHelpComponent=xfce4-power-manager
|
||||||
|
--- src/xfce4-power-manager.desktop.in.orig 2015-03-22 05:57:13.000000000 -0600
|
||||||
|
+++ src/xfce4-power-manager.desktop.in 2016-05-26 16:59:36.621643406 -0600
|
||||||
|
@@ -5,5 +5,5 @@
|
||||||
|
Exec=xfce4-power-manager
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
-NotShowIn=GNOME;KDE;Unity;
|
||||||
|
+NotShowIn=GNOME;KDE;Unity;MATE;
|
||||||
|
StartupNotify=false
|
|
@ -0,0 +1,73 @@
|
||||||
|
From 92189ef3ac1ff909591a4662d520f28f672793a0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric Koegel <eric.koegel@gmail.com>
|
||||||
|
Date: Tue, 24 May 2016 15:31:56 +0300
|
||||||
|
Subject: [PATCH] Load the inhibit proxy interface in an async callback
|
||||||
|
|
||||||
|
Otherwise we may end up waiting for another part of xfpm that
|
||||||
|
hasn't loaded yet.
|
||||||
|
---
|
||||||
|
.../power-manager-plugin/power-manager-button.c | 41 +++++++++++++---------
|
||||||
|
1 file changed, 25 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git panel-plugins/power-manager-plugin/power-manager-button.c panel-plugins/power-manager-plugin/power-manager-button.c
|
||||||
|
index 9f0fa6d..780b713 100644
|
||||||
|
--- panel-plugins/power-manager-plugin/power-manager-button.c
|
||||||
|
+++ panel-plugins/power-manager-plugin/power-manager-button.c
|
||||||
|
@@ -910,6 +910,22 @@ power_manager_button_class_init (PowerManagerButtonClass *klass)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
+inhibit_proxy_ready_cb (GObject *source_object,
|
||||||
|
+ GAsyncResult *res,
|
||||||
|
+ gpointer user_data)
|
||||||
|
+{
|
||||||
|
+ GError *error = NULL;
|
||||||
|
+ PowerManagerButton *button = POWER_MANAGER_BUTTON (user_data);
|
||||||
|
+
|
||||||
|
+ button->priv->inhibit_proxy = g_dbus_proxy_new_finish (res, &error);
|
||||||
|
+ if (error != NULL)
|
||||||
|
+ {
|
||||||
|
+ g_warning ("error getting inhibit proxy: %s", error->message);
|
||||||
|
+ g_clear_error (&error);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
power_manager_button_init (PowerManagerButton *button)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
@@ -938,22 +954,15 @@ power_manager_button_init (PowerManagerButton *button)
|
||||||
|
button->priv->channel = xfconf_channel_get ("xfce4-power-manager");
|
||||||
|
}
|
||||||
|
|
||||||
|
- button->priv->inhibit_proxy = g_dbus_proxy_new_sync (g_bus_get_sync (G_BUS_TYPE_SESSION,
|
||||||
|
- NULL,
|
||||||
|
- NULL),
|
||||||
|
- G_DBUS_PROXY_FLAGS_NONE,
|
||||||
|
- NULL,
|
||||||
|
- "org.freedesktop.PowerManagement",
|
||||||
|
- "/org/freedesktop/PowerManagement/Inhibit",
|
||||||
|
- "org.freedesktop.PowerManagement.Inhibit",
|
||||||
|
- NULL,
|
||||||
|
- &error);
|
||||||
|
-
|
||||||
|
- if (error != NULL)
|
||||||
|
- {
|
||||||
|
- g_warning ("error getting inhibit proxy: %s", error->message);
|
||||||
|
- g_clear_error (&error);
|
||||||
|
- }
|
||||||
|
+ g_dbus_proxy_new (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
|
||||||
|
+ G_DBUS_PROXY_FLAGS_NONE,
|
||||||
|
+ NULL,
|
||||||
|
+ "org.freedesktop.PowerManagement",
|
||||||
|
+ "/org/freedesktop/PowerManagement/Inhibit",
|
||||||
|
+ "org.freedesktop.PowerManagement.Inhibit",
|
||||||
|
+ NULL,
|
||||||
|
+ inhibit_proxy_ready_cb,
|
||||||
|
+ button);
|
||||||
|
|
||||||
|
/* Sane defaults for the systray and panel icon */
|
||||||
|
#ifdef XFCE_PLUGIN
|
||||||
|
--
|
||||||
|
2.4.11
|
||||||
|
|
|
@ -0,0 +1,260 @@
|
||||||
|
From 77fa8e5f7d6c90a7b96b466b654da5aff456816e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric Koegel <eric.koegel@gmail.com>
|
||||||
|
Date: Tue, 31 May 2016 10:21:10 +0300
|
||||||
|
Subject: [PATCH] Fix showing inhibits in the systray (Bug #12605)
|
||||||
|
|
||||||
|
The systray apparently can't use the dbus inhibt interface at all,
|
||||||
|
so use a direct call to get the list of inhibitors to display in
|
||||||
|
the menu.
|
||||||
|
---
|
||||||
|
.../power-manager-plugin/power-manager-button.c | 93 ++++++++++++++++------
|
||||||
|
src/xfpm-inhibit.c | 42 +++++++---
|
||||||
|
src/xfpm-inhibit.h | 2 +
|
||||||
|
3 files changed, 103 insertions(+), 34 deletions(-)
|
||||||
|
|
||||||
|
diff --git panel-plugins/power-manager-plugin/power-manager-button.c panel-plugins/power-manager-plugin/power-manager-button.c
|
||||||
|
index b1f8e1a..0069f3b 100644
|
||||||
|
--- panel-plugins/power-manager-plugin/power-manager-button.c
|
||||||
|
+++ panel-plugins/power-manager-plugin/power-manager-button.c
|
||||||
|
@@ -38,6 +38,9 @@
|
||||||
|
#include "common/xfpm-power-common.h"
|
||||||
|
#include "common/xfpm-brightness.h"
|
||||||
|
#include "common/xfpm-debug.h"
|
||||||
|
+#ifdef XFPM_SYSTRAY
|
||||||
|
+#include "src/xfpm-inhibit.h"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "power-manager-button.h"
|
||||||
|
#include "scalemenuitem.h"
|
||||||
|
@@ -55,14 +58,15 @@ struct PowerManagerButtonPrivate
|
||||||
|
{
|
||||||
|
#ifdef XFCE_PLUGIN
|
||||||
|
XfcePanelPlugin *plugin;
|
||||||
|
+ GDBusProxy *inhibit_proxy;
|
||||||
|
+#else
|
||||||
|
+ XfpmInhibit *inhibit;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
XfconfChannel *channel;
|
||||||
|
|
||||||
|
UpClient *upower;
|
||||||
|
|
||||||
|
- GDBusProxy *inhibit_proxy;
|
||||||
|
-
|
||||||
|
/* A list of BatteryDevices */
|
||||||
|
GList *devices;
|
||||||
|
|
||||||
|
@@ -909,6 +913,7 @@ power_manager_button_class_init (PowerManagerButtonClass *klass)
|
||||||
|
#undef XFPM_PARAM_FLAGS
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef XFCE_PLUGIN
|
||||||
|
static void
|
||||||
|
inhibit_proxy_ready_cb (GObject *source_object,
|
||||||
|
GAsyncResult *res,
|
||||||
|
@@ -924,6 +929,7 @@ inhibit_proxy_ready_cb (GObject *source_object,
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
power_manager_button_init (PowerManagerButton *button)
|
||||||
|
@@ -958,6 +964,7 @@ power_manager_button_init (PowerManagerButton *button)
|
||||||
|
button->priv->channel = xfconf_channel_get ("xfce4-power-manager");
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef XFCE_PLUGIN
|
||||||
|
g_dbus_proxy_new (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
|
||||||
|
G_DBUS_PROXY_FLAGS_NONE,
|
||||||
|
NULL,
|
||||||
|
@@ -967,6 +974,9 @@ power_manager_button_init (PowerManagerButton *button)
|
||||||
|
NULL,
|
||||||
|
inhibit_proxy_ready_cb,
|
||||||
|
button);
|
||||||
|
+#else
|
||||||
|
+ button->priv->inhibit = xfpm_inhibit_new ();
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* Sane defaults for the systray and panel icon */
|
||||||
|
#ifdef XFCE_PLUGIN
|
||||||
|
@@ -1335,6 +1345,33 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
+add_inhibitor_to_menu (PowerManagerButton *button, const gchar *text)
|
||||||
|
+{
|
||||||
|
+ GtkWidget *mi, *img;
|
||||||
|
+
|
||||||
|
+ /* Translators this is to display which app is inhibiting
|
||||||
|
+ * power in the plugin menu. Example:
|
||||||
|
+ * VLC is currently inhibiting power management
|
||||||
|
+ */
|
||||||
|
+ gchar *label = g_strdup_printf (_("%s is currently inhibiting power management"), text);
|
||||||
|
+
|
||||||
|
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
+ mi = gtk_image_menu_item_new_with_label(label);
|
||||||
|
+G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
+ /* add the image */
|
||||||
|
+ img = gtk_image_new_from_icon_name ("gtk-info", GTK_ICON_SIZE_MENU);
|
||||||
|
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
|
||||||
|
+G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
+
|
||||||
|
+ gtk_widget_set_can_focus (mi, FALSE);
|
||||||
|
+ gtk_widget_show (mi);
|
||||||
|
+ gtk_menu_shell_append (GTK_MENU_SHELL(button->priv->menu), mi);
|
||||||
|
+ g_free (label);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#ifdef XFCE_PLUGIN
|
||||||
|
+static void
|
||||||
|
display_inhibitors (PowerManagerButton *button, GtkWidget *menu)
|
||||||
|
{
|
||||||
|
gboolean needs_seperator = FALSE;
|
||||||
|
@@ -1370,27 +1407,7 @@ display_inhibitors (PowerManagerButton *button, GtkWidget *menu)
|
||||||
|
/* Add the list of programs to the menu */
|
||||||
|
while (g_variant_iter_next (iter, "s", &value))
|
||||||
|
{
|
||||||
|
- GtkWidget *mi, *img;
|
||||||
|
-
|
||||||
|
- /* Translators this is to display which app is inhibiting
|
||||||
|
- * power in the plugin menu. Example:
|
||||||
|
- * VLC is currently inhibiting power management
|
||||||
|
- */
|
||||||
|
- gchar *label = g_strdup_printf (_("%s is currently inhibiting power management"), value);
|
||||||
|
-
|
||||||
|
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
- mi = gtk_image_menu_item_new_with_label(label);
|
||||||
|
-G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
- /* add the image */
|
||||||
|
- img = gtk_image_new_from_icon_name ("gtk-info", GTK_ICON_SIZE_MENU);
|
||||||
|
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
|
||||||
|
-G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
-
|
||||||
|
- gtk_widget_set_can_focus (mi, FALSE);
|
||||||
|
- gtk_widget_show (mi);
|
||||||
|
- gtk_menu_shell_append (GTK_MENU_SHELL(button->priv->menu), mi);
|
||||||
|
- g_free (label);
|
||||||
|
+ add_inhibitor_to_menu (button, value);
|
||||||
|
}
|
||||||
|
g_variant_iter_free (iter);
|
||||||
|
g_variant_unref (reply);
|
||||||
|
@@ -1410,6 +1427,36 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+#else
|
||||||
|
+static void
|
||||||
|
+display_inhibitors (PowerManagerButton *button, GtkWidget *menu)
|
||||||
|
+{
|
||||||
|
+ gboolean needs_seperator = FALSE;
|
||||||
|
+ const gchar **inhibitors;
|
||||||
|
+
|
||||||
|
+ g_return_if_fail (POWER_MANAGER_IS_BUTTON (button));
|
||||||
|
+ g_return_if_fail (GTK_IS_MENU (menu));
|
||||||
|
+
|
||||||
|
+ inhibitors = xfpm_inhibit_get_inhibit_list (button->priv->inhibit);
|
||||||
|
+ if (inhibitors != NULL && inhibitors[0] != NULL)
|
||||||
|
+ {
|
||||||
|
+ guint i;
|
||||||
|
+
|
||||||
|
+ for (i=0; inhibitors[i] != NULL; i++)
|
||||||
|
+ {
|
||||||
|
+ add_inhibitor_to_menu (button, inhibitors[i]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* add a separator */
|
||||||
|
+ GtkWidget * separator_mi = gtk_separator_menu_item_new ();
|
||||||
|
+ gtk_widget_show (separator_mi);
|
||||||
|
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator_mi);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ g_free (inhibitors);
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
decrease_brightness (PowerManagerButton *button)
|
||||||
|
{
|
||||||
|
diff --git src/xfpm-inhibit.c src/xfpm-inhibit.c
|
||||||
|
index a4ef386..fba4a6e 100644
|
||||||
|
--- src/xfpm-inhibit.c
|
||||||
|
+++ src/xfpm-inhibit.c
|
||||||
|
@@ -292,6 +292,35 @@ xfpm_inhibit_new(void)
|
||||||
|
return XFPM_INHIBIT (xfpm_inhibit_object);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/***
|
||||||
|
+ * xfpm_inhibit_get_inhibit_list
|
||||||
|
+ * @inhibit: the XfpmInhibit object.
|
||||||
|
+ *
|
||||||
|
+ * Returns: An array of applications that are currently inhibiting xfpm.
|
||||||
|
+ * Call g_free on the returned array when done using it.
|
||||||
|
+ */
|
||||||
|
+const gchar **
|
||||||
|
+xfpm_inhibit_get_inhibit_list (XfpmInhibit *inhibit)
|
||||||
|
+{
|
||||||
|
+ guint i;
|
||||||
|
+ Inhibitor *inhibitor;
|
||||||
|
+ const gchar **OUT_inhibitors;
|
||||||
|
+
|
||||||
|
+ XFPM_DEBUG ("entering xfpm_inhibit_get_inhibit_list");
|
||||||
|
+
|
||||||
|
+ OUT_inhibitors = g_new (const gchar *, inhibit->priv->array->len + 1);
|
||||||
|
+
|
||||||
|
+ for ( i = 0; i<inhibit->priv->array->len; i++)
|
||||||
|
+ {
|
||||||
|
+ inhibitor = g_ptr_array_index (inhibit->priv->array, i);
|
||||||
|
+ OUT_inhibitors[i] = inhibitor->app_name;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ OUT_inhibitors[inhibit->priv->array->len] = NULL;
|
||||||
|
+
|
||||||
|
+ return OUT_inhibitors;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* DBus server implementation for org.freedesktop.PowerManagement.Inhibit
|
||||||
|
@@ -426,21 +455,12 @@ static gboolean xfpm_inhibit_get_inhibitors (XfpmInhibit *inhibit,
|
||||||
|
GDBusMethodInvocation *invocation,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
- guint i;
|
||||||
|
- Inhibitor *inhibitor;
|
||||||
|
const gchar **OUT_inhibitors;
|
||||||
|
|
||||||
|
XFPM_DEBUG ("Get Inhibitors message received");
|
||||||
|
|
||||||
|
- OUT_inhibitors = g_new (const gchar *, inhibit->priv->array->len + 1);
|
||||||
|
-
|
||||||
|
- for ( i = 0; i<inhibit->priv->array->len; i++)
|
||||||
|
- {
|
||||||
|
- inhibitor = g_ptr_array_index (inhibit->priv->array, i);
|
||||||
|
- OUT_inhibitors[i] = inhibitor->app_name;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- OUT_inhibitors[inhibit->priv->array->len] = NULL;
|
||||||
|
+ OUT_inhibitors = xfpm_inhibit_get_inhibit_list (inhibit);
|
||||||
|
+
|
||||||
|
xfpm_power_management_inhibit_complete_get_inhibitors (user_data,
|
||||||
|
invocation,
|
||||||
|
OUT_inhibitors);
|
||||||
|
diff --git src/xfpm-inhibit.h src/xfpm-inhibit.h
|
||||||
|
index 7ad5f9e..9f22dce 100644
|
||||||
|
--- src/xfpm-inhibit.h
|
||||||
|
+++ src/xfpm-inhibit.h
|
||||||
|
@@ -56,6 +56,8 @@ GQuark xfpm_inhibit_get_error_quark ();
|
||||||
|
|
||||||
|
XfpmInhibit *xfpm_inhibit_new (void);
|
||||||
|
|
||||||
|
+const gchar **xfpm_inhibit_get_inhibit_list (XfpmInhibit *inhibit);
|
||||||
|
+
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __XFPM_INHIBIT_H */
|
||||||
|
--
|
||||||
|
2.4.11
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
# Template file for 'xfce4-power-manager'
|
# Template file for 'xfce4-power-manager'
|
||||||
pkgname=xfce4-power-manager
|
pkgname=xfce4-power-manager
|
||||||
version=1.4.4
|
version=1.6.0
|
||||||
revision=3
|
revision=1
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
configure_args="--disable-systemd --enable-polkit --enable-network-manager --disable-static"
|
configure_args="--disable-static"
|
||||||
hostmakedepends="pkg-config intltool"
|
hostmakedepends="pkg-config intltool"
|
||||||
makedepends="libxfce4ui-devel libnotify-devel upower0-devel
|
makedepends="libxfce4ui-devel libnotify-devel upower-devel xfce4-panel-devel"
|
||||||
libXrandr-devel dbus-glib-devel xfce4-panel-devel NetworkManager-devel"
|
|
||||||
depends="hicolor-icon-theme desktop-file-utils"
|
depends="hicolor-icon-theme desktop-file-utils"
|
||||||
short_desc="Xfce power manager"
|
short_desc="Xfce power manager"
|
||||||
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
||||||
license="GPL-2"
|
license="GPL-2"
|
||||||
homepage="http://xfce.org"
|
homepage="http://xfce.org"
|
||||||
distfiles="http://archive.xfce.org/src/xfce/$pkgname/${version%.*}/$pkgname-$version.tar.bz2"
|
distfiles="http://archive.xfce.org/src/xfce/$pkgname/${version%.*}/$pkgname-$version.tar.bz2"
|
||||||
checksum=c50ec8aa7e7848c57c0f856dceb8132eb5f37585f0ac1627459ab8c882c73b07
|
checksum=bde3157e06ab31ff23648d163d53ee5095f7819544a9f48d3a96d57829857f2b
|
||||||
|
|
Loading…
Add table
Reference in a new issue