[Pkg-xfce-devel] Bug#755234: fix for xfce4-power-manager 1.2.0-5, a problem with refreshing of battery status

Rafal fatwildcat at gmail.com
Sat Jul 26 19:18:47 UTC 2014


It looks the problem is caused really by transition to upower-1.0. Below 
is a patch which fixes the problem for 1.2.0-5. It causes that power 
manager connects to another signal, which is not dropped from upower API.

Rafal


--- xfce4-power-manager-1.2.0.orig/src/xfpm-battery.c    2014-07-26 
18:45:42.000000000 +0000
+++ xfce4-power-manager-1.2.0/src/xfpm-battery.c    2014-07-26 
18:52:36.764187964 +0000
@@ -773,7 +773,7 @@
      if (battery->priv->notify_idle != 0)
          g_source_remove (battery->priv->notify_idle);

-    dbus_g_proxy_disconnect_signal (battery->priv->proxy, "Changed",
+    dbus_g_proxy_disconnect_signal (battery->priv->proxy_prop, 
"PropertiesChanged",
                      G_CALLBACK (xfpm_battery_changed_cb), battery);

      if ( g_signal_handler_is_connected (battery->priv->conf, 
battery->priv->sig ) )
@@ -866,6 +866,17 @@
      return GTK_STATUS_ICON (battery);
  }

+static void battPropertiesChangedMarshal(GClosure *closure,
+        GValue *return_value, guint n_param_values,
+        const GValue *param_values, gpointer invocation_hint,
+        gpointer marshal_data)
+{
+    GCClosure *cclosure = (GCClosure*)closure;
+
+    /* XXX: I hope only the xfpm_battery_changed_cb is invoked... */
+    ((void(*)())cclosure->callback)(NULL, closure->data);
+}
+
  void xfpm_battery_monitor_device (XfpmBattery *battery,
                    DBusGProxy *proxy,
                    DBusGProxy *proxy_prop,
@@ -878,8 +889,15 @@
      battery->priv->battery_name = xfpm_battery_get_name (device_type);


-    dbus_g_proxy_add_signal (proxy, "Changed", G_TYPE_INVALID);
-    dbus_g_proxy_connect_signal (proxy, "Changed",
+    dbus_g_object_register_marshaller(battPropertiesChangedMarshal,
+            G_TYPE_NONE, G_TYPE_STRING,
+            dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+            G_TYPE_STRV, G_TYPE_INVALID);
+    dbus_g_proxy_add_signal (proxy_prop, "PropertiesChanged",
+            G_TYPE_STRING,
+            dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+            G_TYPE_STRV, G_TYPE_INVALID);
+    dbus_g_proxy_connect_signal (proxy_prop, "PropertiesChanged",
                   G_CALLBACK (xfpm_battery_changed_cb), battery, NULL);

      g_object_set (G_OBJECT (battery),



More information about the Pkg-xfce-devel mailing list