[gnome-settings-daemon] power: simplify brightness changed signal generation
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: simplify brightness changed signal generation
- Date: Mon, 5 May 2014 14:32:11 +0000 (UTC)
commit 1a763e619b10d4e89c12498933cd26fe53e34a52
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sat May 3 19:22:01 2014 +0200
power: simplify brightness changed signal generation
We can use g_variant_new_parsed() for building the inner variant
and for passing the interface string too (and we save one malloc)
https://bugzilla.gnome.org/show_bug.cgi?id=729500
plugins/power/gsd-power-manager.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index ce34599..54e3782 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1261,17 +1261,13 @@ backlight_iface_emit_changed (GsdPowerManager *manager,
gint32 value)
{
GVariant *params;
- gchar *string;
/* not yet connected to the bus */
if (manager->priv->connection == NULL)
return;
- string = g_strdup_printf ("('%s', [{'Brightness', %%v}], @as [])", interface_name);
- params = g_variant_new_parsed (string,
- g_variant_new_int32 (value));
- g_free (string);
-
+ params = g_variant_new_parsed ("(%s, [{'Brightness', <%i>}], @as [])", interface_name,
+ value);
g_dbus_connection_emit_signal (manager->priv->connection,
NULL,
GSD_POWER_DBUS_PATH,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]