summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWilliam Brown <[email protected]>2013-06-27 10:17:08 +0930
committerWilliam Brown <[email protected]>2013-06-27 10:17:08 +0930
commit0d07b0bbc9a76b5401bee7f0c8132af8e8d558ff (patch)
tree730860e4f9b26d517a67ff31d2fe454f4886b1d4 /src
parent4d842135ce677957aee8bd5bb47f875b0ece570a (diff)
downloadmate-power-manager-0d07b0bbc9a76b5401bee7f0c8132af8e8d558ff.tar.bz2
mate-power-manager-0d07b0bbc9a76b5401bee7f0c8132af8e8d558ff.tar.xz
RHBZ #964678 : Patch that provides DBUS interface to control KbdBacklight.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am9
-rw-r--r--src/gpm-common.h1
-rw-r--r--src/gpm-kbd-backlight.c49
-rw-r--r--src/gpm-manager.c9
-rw-r--r--src/org.mate.PowerManager.KbdBacklight.xml15
5 files changed, 31 insertions, 52 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5fda8ee..e518903 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,7 @@ NULL =
EXTRA_DIST = \
org.mate.PowerManager.xml \
org.mate.PowerManager.Backlight.xml \
+ org.mate.PowerManager.KbdBacklight.xml \
gpm-marshal.list \
$(NULL)
@@ -271,6 +272,7 @@ endif
BUILT_SOURCES = \
org.mate.PowerManager.h \
org.mate.PowerManager.Backlight.h \
+ org.mate.PowerManager.KbdBacklight.h \
gpm-marshal.c \
gpm-marshal.h \
$(NULL)
@@ -296,6 +298,13 @@ org.mate.PowerManager.Backlight.h: org.mate.PowerManager.Backlight.xml
--output=org.mate.PowerManager.Backlight.h \
$(srcdir)/org.mate.PowerManager.Backlight.xml
+org.mate.PowerManager.KbdBacklight.h: org.mate.PowerManager.KbdBacklight.xml
+ libtool --mode=execute dbus-binding-tool \
+ --prefix=gpm_kbd_backlight \
+ --mode=glib-server \
+ --output=org.mate.PowerManager.KbdBacklight.h \
+ $(srcdir)/org.mate.PowerManager.KbdBacklight.xml
+
clean-local:
rm -f *~
rm -f gpm-marshal.c gpm-marshal.h
diff --git a/src/gpm-common.h b/src/gpm-common.h
index ca4762c..1c83268 100644
--- a/src/gpm-common.h
+++ b/src/gpm-common.h
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
#define GPM_DBUS_SERVICE "org.mate.PowerManager"
#define GPM_DBUS_INTERFACE "org.mate.PowerManager"
#define GPM_DBUS_INTERFACE_BACKLIGHT "org.mate.PowerManager.Backlight"
+#define GPM_DBUS_INTERFACE_KBD_BACKLIGHT "org.mate.PowerManager.KbdBacklight"
#define GPM_DBUS_PATH "/org/mate/PowerManager"
#define GPM_DBUS_PATH_BACKLIGHT "/org/mate/PowerManager/Backlight"
#define GPM_DBUS_PATH_KBD_BACKLIGHT "/org/mate/PowerManager/KbdBacklight"
diff --git a/src/gpm-kbd-backlight.c b/src/gpm-kbd-backlight.c
index 72c4f96..5bb8ae2 100644
--- a/src/gpm-kbd-backlight.c
+++ b/src/gpm-kbd-backlight.c
@@ -31,21 +31,6 @@
#include "gpm-kbd-backlight.h"
#include "gsd-media-keys-window.h"
-static const gchar *kbd_backlight_introspection = ""
-"<?xml version=\"1.0\" encoding=\"UTF-8\"?>""<node name=\"/\">"
- "<interface name=\"org.mate.PowerManager.Backlight\">"
- "<method name=\"GetBrightness\">"
- "<arg type=\"u\" name=\"percentage_brightness\" direction=\"out\"/>"
- "</method>"
- "<method name=\"SetBrightness\">"
- "<arg type=\"u\" name=\"percentage_brightness\" direction=\"in\"/>"
- "</method>"
- "<signal name=\"BrightnessChanged\">"
- "<arg type=\"u\" name=\"percentage_brightness\" direction=\"out\"/>"
- "</signal>"
- "</interface>"
-"</node>";
-
#define GPM_KBD_BACKLIGHT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_KBD_BACKLIGHT, GpmKbdBacklightPrivate))
struct GpmKbdBacklightPrivate
@@ -430,40 +415,6 @@ gpm_kbd_backlight_dbus_property_set (GDBusConnection *connection,
return FALSE;
}
-/**
- * gpm_kbd_backlight_register_dbus:
- * @backlight:
- * @connection:
- * @error:
- **/
-void
-gpm_kbd_backlight_register_dbus (GpmKbdBacklight *backlight,
- GDBusConnection *connection,
- GError **error)
-{
- GDBusNodeInfo *node_info;
- GDBusInterfaceInfo *interface_info;
- GDBusInterfaceVTable interface_vtable = {
- gpm_kbd_backlight_dbus_method_call,
- gpm_kbd_backlight_dbus_property_get,
- gpm_kbd_backlight_dbus_property_set
- };
-
- node_info = g_dbus_node_info_new_for_xml (kbd_backlight_introspection, NULL);
- interface_info = g_dbus_node_info_lookup_interface (node_info, GPM_DBUS_INTERFACE_BACKLIGHT);
-
- backlight->priv->bus_connection = g_object_ref (connection);
- backlight->priv->bus_object_id =
- g_dbus_connection_register_object (connection,
- GPM_DBUS_PATH_KBD_BACKLIGHT,
- interface_info,
- &interface_vtable,
- backlight,
- NULL,
- error);
- g_dbus_node_info_unref (node_info);
-}
-
static gboolean
gpm_kbd_backlight_evaluate_power_source_and_set (GpmKbdBacklight *backlight)
{
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 9b697b5..6f403a9 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -65,6 +65,7 @@
#include "gpm-disks.h"
#include "org.mate.PowerManager.Backlight.h"
+#include "org.mate.PowerManager.KbdBacklight.h"
static void gpm_manager_finalize (GObject *object);
@@ -1997,9 +1998,11 @@ gpm_manager_init (GpmManager *manager)
manager->priv->kbd_backlight = gpm_kbd_backlight_new ();
if (manager->priv->kbd_backlight != NULL) {
- gpm_kbd_backlight_register_dbus (manager->priv->kbd_backlight,
- g_connection,
- NULL);
+ dbus_g_object_type_install_info (GPM_TYPE_KBD_BACKLIGHT,
+ &dbus_glib_gpm_kbd_backlight_object_info);
+ dbus_g_connection_register_g_object (connection, GPM_DBUS_PATH_KBD_BACKLIGHT,
+ G_OBJECT (manager->priv->kbd_backlight));
+
}
manager->priv->idle = gpm_idle_new ();
diff --git a/src/org.mate.PowerManager.KbdBacklight.xml b/src/org.mate.PowerManager.KbdBacklight.xml
new file mode 100644
index 0000000..82b7cb2
--- /dev/null
+++ b/src/org.mate.PowerManager.KbdBacklight.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/">
+ <interface name="org.mate.PowerManager.KbdBacklight">
+ <method name="GetBrightness">
+ <arg type="u" name="percentage_brightness" direction="out"/>
+ </method>
+ <method name="SetBrightness">
+ <arg type="u" name="percentage_brightness" direction="in"/>
+ </method>
+ <signal name="BrightnessChanged">
+ <arg type="u" name="percentage_brightness" direction="out"/>
+ </signal>
+ </interface>
+</node>
+