Accepting request 211794 from openSUSE:Factory:Staging:upower

- Add gnome-control-center-upower-DeviceChanged-signal.patch,
  gnome-control-center-upower-display.patch,
  gnome-control-center-upower-fix-build.patch,
  gnome-control-center-upower-icons.patch,
  gnome-control-center-upower-changed-signal.patch -- update for libupower-glib
  API changes, from 3.11.
- Up libupower-glib dependency

OBS-URL: https://build.opensuse.org/request/show/211794
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-control-center?expand=0&rev=230
This commit is contained in:
Dominique Leuenberger 2013-12-23 17:57:12 +00:00 committed by Git OBS Bridge
parent 1dc84e775f
commit 7e6e98030b
7 changed files with 485 additions and 1 deletions

View File

@ -0,0 +1,186 @@
From 6f78b2ab0f05cdf9d88ffb30abebc5d69cf121cf Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 17 Oct 2013 17:16:35 +0200
Subject: [PATCH] power: Fix run-time for DeviceChanged signal removal
The DeviceChanged signal was removed, instead, each interesting
device should be monitored individually. This means we need to keep
our own device list locally.
https://bugzilla.gnome.org/show_bug.cgi?id=710393
---
panels/power/cc-power-panel.c | 75 +++++++++++++++++++++++++++++++++++--------
1 file changed, 61 insertions(+), 14 deletions(-)
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index fccc994..75e8ce2 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -70,6 +70,7 @@ struct _CcPowerPanelPrivate
GtkBuilder *builder;
GtkWidget *automatic_suspend_dialog;
UpClient *up_client;
+ GPtrArray *devices;
GDBusProxy *screen_proxy;
GDBusProxy *kbd_proxy;
gboolean has_batteries;
@@ -142,6 +143,11 @@ cc_power_panel_dispose (GObject *object)
g_clear_object (&priv->builder);
g_clear_object (&priv->screen_proxy);
g_clear_object (&priv->kbd_proxy);
+ if (priv->devices)
+ {
+ g_ptr_array_foreach (priv->devices, (GFunc) g_object_unref, NULL);
+ g_clear_pointer (&priv->devices, g_ptr_array_unref);
+ }
g_clear_object (&priv->up_client);
#ifdef HAVE_BLUETOOTH
g_clear_object (&priv->bt_client);
@@ -624,7 +630,6 @@ up_client_changed (UpClient *client,
CcPowerPanel *self)
{
CcPowerPanelPrivate *priv = self->priv;
- GPtrArray *devices;
GList *children, *l;
gint i;
UpDeviceKind kind;
@@ -658,8 +663,6 @@ up_client_changed (UpClient *client,
g_list_free (children);
gtk_widget_hide (priv->device_section);
- devices = up_client_get_devices (client);
-
#ifdef TEST_FAKE_DEVICES
{
static gboolean fake_devices_added = FALSE;
@@ -675,7 +678,7 @@ up_client_changed (UpClient *client,
"state", UP_DEVICE_STATE_DISCHARGING,
"time-to-empty", 287,
NULL);
- g_ptr_array_add (devices, device);
+ g_ptr_array_add (priv->devices, device);
device = up_device_new ();
g_object_set (device,
"kind", UP_DEVICE_KIND_KEYBOARD,
@@ -683,7 +686,7 @@ up_client_changed (UpClient *client,
"state", UP_DEVICE_STATE_DISCHARGING,
"time-to-empty", 250,
NULL);
- g_ptr_array_add (devices, device);
+ g_ptr_array_add (priv->devices, device);
device = up_device_new ();
g_object_set (device,
"kind", UP_DEVICE_KIND_BATTERY,
@@ -694,7 +697,7 @@ up_client_changed (UpClient *client,
"energy-rate", 15.0,
"time-to-empty", 400,
NULL);
- g_ptr_array_add (devices, device);
+ g_ptr_array_add (priv->devices, device);
}
}
#endif
@@ -709,9 +712,9 @@ up_client_changed (UpClient *client,
"power-supply", TRUE,
"is-present", TRUE,
NULL);
- for (i = 0; devices != NULL && i < devices->len; i++)
+ for (i = 0; priv->devices != NULL && i < priv->devices->len; i++)
{
- UpDevice *device = (UpDevice*) g_ptr_array_index (devices, i);
+ UpDevice *device = (UpDevice*) g_ptr_array_index (priv->devices, i);
g_object_get (device,
"kind", &kind,
"state", &state,
@@ -776,9 +779,9 @@ up_client_changed (UpClient *client,
if (!on_ups && n_batteries > 1)
set_primary (self, composite);
- for (i = 0; devices != NULL && i < devices->len; i++)
+ for (i = 0; priv->devices != NULL && i < priv->devices->len; i++)
{
- UpDevice *device = (UpDevice*) g_ptr_array_index (devices, i);
+ UpDevice *device = (UpDevice*) g_ptr_array_index (priv->devices, i);
g_object_get (device, "kind", &kind, NULL);
if (kind == UP_DEVICE_KIND_LINE_POWER)
{
@@ -802,11 +805,48 @@ up_client_changed (UpClient *client,
}
}
- g_clear_pointer (&devices, g_ptr_array_unref);
g_object_unref (composite);
}
static void
+up_client_device_removed (UpClient *client,
+ const char *object_path,
+ CcPowerPanel *self)
+{
+ CcPowerPanelPrivate *priv = self->priv;
+ guint i;
+
+ if (priv->devices == NULL)
+ return;
+
+ for (i = 0; i < priv->devices->len; i++)
+ {
+ UpDevice *device = g_ptr_array_index (priv->devices, i);
+
+ if (g_strcmp0 (object_path, up_device_get_object_path (device)) == 0)
+ {
+ g_ptr_array_remove_index (priv->devices, i);
+ break;
+ }
+ }
+
+ up_client_changed (self->priv->up_client, NULL, self);
+}
+
+static void
+up_client_device_added (UpClient *client,
+ UpDevice *device,
+ CcPowerPanel *self)
+{
+ CcPowerPanelPrivate *priv = self->priv;
+
+ g_ptr_array_add (priv->devices, g_object_ref (device));
+ g_signal_connect (G_OBJECT (device), "notify",
+ G_CALLBACK (up_client_changed), self);
+ up_client_changed (priv->up_client, NULL, self);
+}
+
+static void
set_brightness_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
GError *error = NULL;
@@ -2163,6 +2203,7 @@ cc_power_panel_init (CcPowerPanel *self)
GError *error;
GtkWidget *widget;
GtkWidget *box;
+ guint i;
priv = self->priv = POWER_PANEL_PRIVATE (self);
g_resources_register (cc_power_get_resource ());
@@ -2226,9 +2267,15 @@ cc_power_panel_init (CcPowerPanel *self)
update_automatic_suspend_label (self);
/* populate batteries */
- g_signal_connect (priv->up_client, "device-added", G_CALLBACK (up_client_changed), self);
- g_signal_connect (priv->up_client, "device-changed", G_CALLBACK (up_client_changed), self);
- g_signal_connect (priv->up_client, "device-removed", G_CALLBACK (up_client_changed), self);
+ g_signal_connect (priv->up_client, "device-added", G_CALLBACK (up_client_device_added), self);
+ g_signal_connect (priv->up_client, "device-removed", G_CALLBACK (up_client_device_removed), self);
+
+ priv->devices = up_client_get_devices (priv->up_client);
+ for (i = 0; priv->devices != NULL && i < priv->devices->len; i++) {
+ UpDevice *device = g_ptr_array_index (priv->devices, i);
+ g_signal_connect (G_OBJECT (device), "notify",
+ G_CALLBACK (up_client_changed), self);
+ }
up_client_changed (priv->up_client, NULL, self);
widget = WID (priv->builder, "vbox_power");
--
1.8.4

View File

@ -0,0 +1,37 @@
From 8ba50267bed318cae35a40cd20f3067856e7c93b Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 30 Oct 2013 12:03:33 +0100
Subject: [PATCH] display: Update for libupower-glib API changes
There's no "changed" signal anymore.
---
panels/display/cc-display-panel.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index f170d51..775b48d 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -2261,6 +2261,7 @@ mapped_cb (CcDisplayPanel *panel)
static void
cc_display_panel_up_client_changed (UpClient *client,
+ GParamSpec *pspec,
CcDisplayPanel *self)
{
CcDisplayPanelPrivate *priv = self->priv;
@@ -2352,9 +2353,9 @@ cc_display_panel_init (CcDisplayPanel *self)
* https://bugs.freedesktop.org/show_bug.cgi?id=43001
*/
- g_signal_connect (self->priv->up_client, "changed",
+ g_signal_connect (self->priv->up_client, "notify::lid-is-closed",
G_CALLBACK (cc_display_panel_up_client_changed), self);
- cc_display_panel_up_client_changed (self->priv->up_client, self);
+ cc_display_panel_up_client_changed (self->priv->up_client, NULL, self);
}
else
g_clear_object (&self->priv->up_client);
--
1.8.4

View File

@ -0,0 +1,131 @@
From 93997f5ee82107e710d1d22b55d6d1137ab97127 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 21 Oct 2013 22:53:43 +0200
Subject: [PATCH] power: Use the new display device
From UPower 0.99. Removes all the code creating the composite device.
https://bugzilla.gnome.org/show_bug.cgi?id=710393
---
panels/power/cc-power-panel.c | 86 +++++++------------------------------------
1 file changed, 13 insertions(+), 73 deletions(-)
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 223fd86..8083888 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -633,22 +633,9 @@ up_client_changed (UpClient *client,
GList *children, *l;
gint i;
UpDeviceKind kind;
- UpDeviceState state;
guint n_batteries;
gboolean on_ups;
UpDevice *composite;
- gdouble percentage = 0.0;
- gdouble energy = 0.0;
- gdouble energy_full = 0.0;
- gdouble energy_rate = 0.0;
- gdouble energy_total = 0.0;
- gdouble energy_full_total = 0.0;
- gdouble energy_rate_total = 0.0;
- gint64 time_to_empty = 0;
- gint64 time_to_full = 0;
- gboolean is_charging = FALSE;
- gboolean is_discharging = FALSE;
- gboolean is_fully_charged = TRUE;
gchar *s;
children = gtk_container_get_children (GTK_CONTAINER (priv->battery_list));
@@ -713,38 +700,21 @@ up_client_changed (UpClient *client,
on_ups = FALSE;
n_batteries = 0;
- composite = up_device_new ();
- g_object_set (composite,
- "kind", UP_DEVICE_KIND_BATTERY,
- "is-rechargeable", TRUE,
- "native-path", "dummy:composite_battery",
- "power-supply", TRUE,
- "is-present", TRUE,
- NULL);
- for (i = 0; priv->devices != NULL && i < priv->devices->len; i++)
+ composite = up_client_get_display_device (priv->up_client);
+ g_object_get (composite, "kind", &kind, NULL);
+ if (kind == UP_DEVICE_KIND_UPS)
{
- UpDevice *device = (UpDevice*) g_ptr_array_index (priv->devices, i);
- g_object_get (device,
- "kind", &kind,
- "state", &state,
- "energy", &energy,
- "energy-full", &energy_full,
- "energy-rate", &energy_rate,
- NULL);
- if (kind == UP_DEVICE_KIND_UPS && state == UP_DEVICE_STATE_DISCHARGING)
- on_ups = TRUE;
- if (kind == UP_DEVICE_KIND_BATTERY)
+ on_ups = TRUE;
+ }
+ else
+ {
+ /* Count the batteries */
+ for (i = 0; priv->devices != NULL && i < priv->devices->len; i++)
{
- if (state == UP_DEVICE_STATE_CHARGING)
- is_charging = TRUE;
- if (state == UP_DEVICE_STATE_DISCHARGING)
- is_discharging = TRUE;
- if (state != UP_DEVICE_STATE_FULLY_CHARGED)
- is_fully_charged = FALSE;
- energy_total += energy;
- energy_full_total += energy_full;
- energy_rate_total += energy_rate;
- n_batteries++;
+ UpDevice *device = (UpDevice*) g_ptr_array_index (priv->devices, i);
+ g_object_get (device, "kind", &kind, NULL);
+ if (kind == UP_DEVICE_KIND_BATTERY)
+ n_batteries++;
}
}
@@ -755,36 +725,6 @@ up_client_changed (UpClient *client,
gtk_label_set_label (GTK_LABEL (priv->battery_heading), s);
g_free (s);
- if (energy_full_total > 0.0)
- percentage = 100.0 * energy_total / energy_full_total;
-
- if (is_charging)
- state = UP_DEVICE_STATE_CHARGING;
- else if (is_discharging)
- state = UP_DEVICE_STATE_DISCHARGING;
- else if (is_fully_charged)
- state = UP_DEVICE_STATE_FULLY_CHARGED;
- else
- state = UP_DEVICE_STATE_UNKNOWN;
-
- if (energy_rate_total > 0)
- {
- if (state == UP_DEVICE_STATE_DISCHARGING)
- time_to_empty = 3600 * (energy_total / energy_rate_total);
- else if (state == UP_DEVICE_STATE_CHARGING)
- time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total);
- }
-
- g_object_set (composite,
- "energy", energy_total,
- "energy-full", energy_full_total,
- "energy-rate", energy_rate_total,
- "time-to-empty", time_to_empty,
- "time-to-full", time_to_full,
- "percentage", percentage,
- "state", state,
- NULL);
-
if (!on_ups && n_batteries > 1)
set_primary (self, composite);
--
1.8.4

View File

@ -0,0 +1,50 @@
From ceafe6f4c51452b731c165808eebc8334bf58df9 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 17 Oct 2013 16:52:36 +0200
Subject: [PATCH] power: Fix build
up_client_enumerate_devices_sync() was removed.
https://bugzilla.gnome.org/show_bug.cgi?id=710393
---
panels/power/cc-power-panel.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index cab6b4a..fccc994 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1095,22 +1095,11 @@ static void
set_ac_battery_ui_mode (CcPowerPanel *self)
{
gboolean has_batteries = FALSE;
- gboolean ret;
- GError *error = NULL;
GPtrArray *devices;
guint i;
UpDevice *device;
UpDeviceKind kind;
- /* this is sync, but it's cached in the daemon and so quick */
- ret = up_client_enumerate_devices_sync (self->priv->up_client, NULL, &error);
- if (!ret)
- {
- g_warning ("failed to get device list: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
devices = up_client_get_devices (self->priv->up_client);
g_debug ("got %d devices from upower\n", devices->len);
@@ -1131,7 +1120,6 @@ set_ac_battery_ui_mode (CcPowerPanel *self)
has_batteries = FALSE;
#endif
-out:
self->priv->has_batteries = has_batteries;
gtk_widget_set_visible (self->priv->critical_battery_row, has_batteries);
--
1.8.4

View File

@ -0,0 +1,54 @@
From 63bf77196ec880ba7d013d8e5329656adc0b1c3e Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 17 Oct 2013 16:51:31 +0200
Subject: [PATCH] power: Use icons from UPower
https://bugzilla.gnome.org/show_bug.cgi?id=710393
---
panels/power/cc-power-panel.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index d9d09b3..cab6b4a 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -382,6 +382,7 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
GtkWidget *widget;
gchar *s;
gchar *native_path;
+ gchar *icon_name;
const gchar *name;
g_object_get (device,
@@ -389,6 +390,7 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
"state", &state,
"percentage", &percentage,
"native-path", &native_path,
+ "icon-name", &icon_name,
NULL);
if (native_path && strstr (native_path, "BAT0"))
@@ -412,10 +414,9 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
gtk_box_pack_start (GTK_BOX (box), box2, FALSE, TRUE, 0);
#if 1
- if (state == UP_DEVICE_STATE_DISCHARGING ||
- state == UP_DEVICE_STATE_CHARGING)
+ if (icon_name != NULL && *icon_name != '\0')
{
- widget = gtk_image_new_from_icon_name ("battery-good-charging-symbolic", GTK_ICON_SIZE_BUTTON);
+ widget = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
gtk_style_context_add_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_DIM_LABEL);
gtk_widget_set_halign (widget, GTK_ALIGN_END);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@@ -455,6 +456,7 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
gtk_widget_show_all (row);
g_free (native_path);
+ g_free (icon_name);
gtk_widget_set_visible (priv->battery_section, TRUE);
}
--
1.8.4

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Dec 17 12:07:47 UTC 2013 - mgorse@suse.com
- Add gnome-control-center-upower-DeviceChanged-signal.patch,
gnome-control-center-upower-display.patch,
gnome-control-center-upower-fix-build.patch,
gnome-control-center-upower-icons.patch,
gnome-control-center-upower-changed-signal.patch -- update for libupower-glib
API changes, from 3.11.
- Up libupower-glib dependency
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Nov 12 19:52:46 UTC 2013 - dimstar@opensuse.org Tue Nov 12 19:52:46 UTC 2013 - dimstar@opensuse.org

View File

@ -45,6 +45,16 @@ Patch15: gcc-private-connection.patch
Patch16: gnome-control-center-probe-radius-server-cert.patch Patch16: gnome-control-center-probe-radius-server-cert.patch
# PATCH-FIX-UPSTREAM gnome-control-center-BT-sharing.patch bgo#712252 dimstar@opensuse.org -- Fix Bluetooth label always being off # PATCH-FIX-UPSTREAM gnome-control-center-BT-sharing.patch bgo#712252 dimstar@opensuse.org -- Fix Bluetooth label always being off
Patch17: gnome-control-center-BT-sharing.patch Patch17: gnome-control-center-BT-sharing.patch
# PATCH-FEATURE-UPSTREAM gnome-control-center-upower-fix-build.patch mgorse@suse.com -- Build fix for UPower 0.99
Patch18: gnome-control-center-upower-fix-build.patch
# PATCH-FEATURE-UPSTREAM gnome-control-center-upower-DeviceChanged-signal.patch mgorse@suse.com -- DeviceChanged signal no longer exists in upower-glib 0.99
Patch19: gnome-control-center-upower-DeviceChanged-signal.patch
# PATCH-FEATURE-UPSTREAM gnome-control-center-upower-icons.patch mgorse@suse.com -- Use UPower icons
Patch20: gnome-control-center-upower-icons.patch
# PATCH-FEATURE-UPSTREAM gnome-control-center-upower-display.patch mgorse@suse.com -- Use new display device
Patch21: gnome-control-center-upower-display.patch
# PATCH-FEATURE-UPSTREAM gnome-control-center-upower-changed-signal.patch mgorse@suse.com -- Update for libupower-glib API changes
Patch22: gnome-control-center-upower-changed-signal.patch
BuildRequires: cups-devel BuildRequires: cups-devel
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
BuildRequires: fdupes BuildRequires: fdupes
@ -96,7 +106,7 @@ BuildRequires: pkgconfig(mm-glib) >= 0.7
BuildRequires: pkgconfig(polkit-gobject-1) >= 0.103 BuildRequires: pkgconfig(polkit-gobject-1) >= 0.103
BuildRequires: pkgconfig(pwquality) >= 1.2.2 BuildRequires: pkgconfig(pwquality) >= 1.2.2
BuildRequires: pkgconfig(smbclient) BuildRequires: pkgconfig(smbclient)
BuildRequires: pkgconfig(upower-glib) BuildRequires: pkgconfig(upower-glib) >= 0.99.0
BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xcursor) BuildRequires: pkgconfig(xcursor)
BuildRequires: pkgconfig(xft) BuildRequires: pkgconfig(xft)
@ -165,6 +175,11 @@ translation-update-upstream
%patch15 -p1 %patch15 -p1
%patch16 -p1 %patch16 -p1
%patch17 -p1 %patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
#NEEDS-REBASE #NEEDS-REBASE
#patch14 -p1 #patch14 -p1