wacom: Add description subtitles to styli

This commit is contained in:
Carlos Garnacho 2022-01-31 17:07:19 +01:00 committed by Georges Basile Stavracas Neto
parent 9bd0b94527
commit 04bb70a5b3
3 changed files with 25 additions and 0 deletions

View file

@ -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));

View file

@ -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;
}

View file

@ -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);