[gnome-control-center/wip/carlosg/wacom-facelift: 6/6] wacom: Add description subtitles to tablet devices
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/carlosg/wacom-facelift: 6/6] wacom: Add description subtitles to tablet devices
- Date: Mon, 31 Jan 2022 16:30:07 +0000 (UTC)
commit 687741f5d9f41a5767b4732aa91f363b49e9a006
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jan 31 17:14:57 2022 +0100
wacom: Add description subtitles to tablet devices
panels/wacom/cc-wacom-device.c | 20 ++++++++++++++++++++
panels/wacom/cc-wacom-device.h | 3 +++
panels/wacom/cc-wacom-page.c | 2 ++
3 files changed, 25 insertions(+)
---
diff --git a/panels/wacom/cc-wacom-device.c b/panels/wacom/cc-wacom-device.c
index 28ee54f3e..695b85b0d 100644
--- a/panels/wacom/cc-wacom-device.c
+++ b/panels/wacom/cc-wacom-device.c
@@ -23,6 +23,8 @@
#include <string.h>
#include "cc-wacom-device.h"
+#include <glib/gi18n.h>
+
enum {
PROP_0,
PROP_DEVICE,
@@ -415,3 +417,21 @@ cc_wacom_device_get_button_settings (CcWacomDevice *device,
return settings;
}
+
+const gchar *
+cc_wacom_device_get_description (CcWacomDevice *device)
+{
+ WacomIntegrationFlags integration_flags;
+
+ g_return_val_if_fail (CC_IS_WACOM_DEVICE (device), NULL);
+
+ integration_flags = libwacom_get_integration_flags (device->wdevice);
+
+ if (integration_flags & WACOM_DEVICE_INTEGRATED_SYSTEM) {
+ return _("Tablet mounted on laptop panel");
+ } else if (integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY) {
+ return _("Tablet mounted on external display");
+ } else {
+ return _("External tablet device");
+ }
+}
diff --git a/panels/wacom/cc-wacom-device.h b/panels/wacom/cc-wacom-device.h
index 3e2c2ee61..63d38fb73 100644
--- a/panels/wacom/cc-wacom-device.h
+++ b/panels/wacom/cc-wacom-device.h
@@ -61,3 +61,6 @@ guint cc_wacom_device_get_num_buttons (CcWacomDevice *wacom_device);
GSettings * cc_wacom_device_get_button_settings (CcWacomDevice *device,
guint button);
+
+const gchar * cc_wacom_device_get_description (CcWacomDevice *device);
+
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 1c4676137..ee293c5c9 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -791,6 +791,8 @@ cc_wacom_page_new (CcWacomPanel *panel,
/* Tablet name */
gtk_label_set_text (GTK_LABEL (page->tablet_name), cc_wacom_device_get_name (stylus));
+ gtk_label_set_text (GTK_LABEL (page->tablet_subtitle),
+ cc_wacom_device_get_description (stylus));
g_settings_bind_with_mapping (page->wacom_settings, "mapping",
page->tablet_mode_switch, "active",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]