[gnome-control-center/wip/carlosg/wacom-facelift: 5/7] wacom: Add description subtitles to styli




commit 8606b8825417eeaebb5b0f7f4e78865581d467f3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jan 31 17:07:19 2022 +0100

    wacom: Add description subtitles to styli

 panels/wacom/cc-wacom-stylus-page.c |  2 ++
 panels/wacom/cc-wacom-tool.c        | 21 +++++++++++++++++++++
 panels/wacom/cc-wacom-tool.h        |  2 ++
 3 files changed, 25 insertions(+)
---
diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c
index 95ad42027..33656198a 100644
--- a/panels/wacom/cc-wacom-stylus-page.c
+++ b/panels/wacom/cc-wacom-stylus-page.c
@@ -234,6 +234,8 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
        /* Stylus name */
        gtk_label_set_text (GTK_LABEL (page->stylus_name),
                            cc_wacom_tool_get_name (stylus));
+       gtk_label_set_text (GTK_LABEL (page->stylus_subtitle),
+                           cc_wacom_tool_get_description (stylus));
 
        /* Icon */
        set_icon_name (page, cc_wacom_tool_get_icon_name (stylus));
diff --git a/panels/wacom/cc-wacom-tool.c b/panels/wacom/cc-wacom-tool.c
index aa741e8c3..5633f5bde 100644
--- a/panels/wacom/cc-wacom-tool.c
+++ b/panels/wacom/cc-wacom-tool.c
@@ -22,6 +22,8 @@
 
 #include "cc-wacom-tool.h"
 
+#include <glib/gi18n.h>
+
 enum {
        PROP_0,
        PROP_SERIAL,
@@ -307,3 +309,22 @@ cc_wacom_tool_get_has_eraser (CcWacomTool *tool)
 
        return libwacom_stylus_is_eraser (tool->wstylus);
 }
+
+const gchar *
+cc_wacom_tool_get_description (CcWacomTool *tool)
+{
+       WacomAxisTypeFlags axes;
+
+       axes = libwacom_stylus_get_axes (tool->wstylus);
+
+       if ((~axes & (WACOM_AXIS_TYPE_TILT | WACOM_AXIS_TYPE_PRESSURE | WACOM_AXIS_TYPE_SLIDER)) == 0)
+               return _("Airbrush stylus with pressure, tilt, and integrated slider");
+       else if ((~axes & (WACOM_AXIS_TYPE_TILT | WACOM_AXIS_TYPE_PRESSURE | WACOM_AXIS_TYPE_ROTATION_Z)) == 
0)
+               return _("Airbrush stylus with pressure, tilt, and rotation");
+       else if ((~axes & (WACOM_AXIS_TYPE_TILT | WACOM_AXIS_TYPE_PRESSURE)) == 0)
+               return _("Standard stylus with pressure and tilt");
+       else if ((~axes & WACOM_AXIS_TYPE_PRESSURE) == 0)
+               return _("Standard stylus with pressure");
+
+       return NULL;
+}
diff --git a/panels/wacom/cc-wacom-tool.h b/panels/wacom/cc-wacom-tool.h
index f988e1ff6..a07659f7e 100644
--- a/panels/wacom/cc-wacom-tool.h
+++ b/panels/wacom/cc-wacom-tool.h
@@ -42,3 +42,5 @@ GSettings     * cc_wacom_tool_get_settings    (CcWacomTool   *tool);
 
 guint           cc_wacom_tool_get_num_buttons (CcWacomTool   *tool);
 gboolean        cc_wacom_tool_get_has_eraser  (CcWacomTool   *tool);
+
+const gchar   * cc_wacom_tool_get_description (CcWacomTool   *tool);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]