[gnome-control-center] wacom: Add cc_wacom_device_get_button_settings()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] wacom: Add cc_wacom_device_get_button_settings()
- Date: Fri, 4 Nov 2016 22:41:26 +0000 (UTC)
commit 5fdf5ad8ec122764431b36793ed71925baf8a22e
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jun 23 16:50:58 2016 +0200
wacom: Add cc_wacom_device_get_button_settings()
This function retrieves the GSettings pointing to the configuration
of the given button, or NULL if not found.
panels/wacom/cc-wacom-device.c | 25 +++++++++++++++++++++++++
panels/wacom/cc-wacom-device.h | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-device.c b/panels/wacom/cc-wacom-device.c
index e66eefd..934d6a9 100644
--- a/panels/wacom/cc-wacom-device.c
+++ b/panels/wacom/cc-wacom-device.c
@@ -374,3 +374,28 @@ cc_wacom_device_get_num_buttons (CcWacomDevice *device)
return libwacom_get_num_buttons (device->wdevice);
}
+
+GSettings *
+cc_wacom_device_get_button_settings (CcWacomDevice *device,
+ guint button)
+{
+ GSettings *tablet_settings, *settings;
+ gchar *path, *button_path;
+
+ g_return_val_if_fail (CC_IS_WACOM_DEVICE (device), NULL);
+
+ if (button > cc_wacom_device_get_num_buttons (device))
+ return NULL;
+
+ tablet_settings = cc_wacom_device_get_settings (device);
+ g_object_get (tablet_settings, "path", &path, NULL);
+
+ button_path = g_strdup_printf ("%sbutton%c/", path, 'A' + button);
+ settings = g_settings_new_with_path ("org.gnome.desktop.peripherals.tablet.pad-button",
+ button_path);
+ g_free (path);
+ g_free (button_path);
+ g_object_unref (tablet_settings);
+
+ return settings;
+}
diff --git a/panels/wacom/cc-wacom-device.h b/panels/wacom/cc-wacom-device.h
index 62bf656..756f746 100644
--- a/panels/wacom/cc-wacom-device.h
+++ b/panels/wacom/cc-wacom-device.h
@@ -59,5 +59,7 @@ void cc_wacom_device_set_output (CcWacomDevice *wacom_device,
guint cc_wacom_device_get_num_buttons (CcWacomDevice *wacom_device);
+GSettings * cc_wacom_device_get_button_settings (CcWacomDevice *device,
+ guint button);
#endif /* __CC_WACOM_DEVICE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]