wacom: Switch to using a dialog for stylus button assignments

This moves the wacom stylus button assignments from a dropdown to an
external dialog, in preparation for adding keyboard shortcuts to this
list.
This commit is contained in:
Peter Hutterer 2024-01-18 16:15:17 +10:00 committed by Carlos Garnacho
parent 605914911a
commit ad63caf442
12 changed files with 526 additions and 63 deletions

View file

@ -349,7 +349,7 @@ add_stylus (CcWacomPanel *self,
if (g_hash_table_lookup (self->stylus_pages, tool))
return FALSE;
page = cc_wacom_stylus_page_new (tool);
page = cc_wacom_stylus_page_new (self, tool);
gtk_box_append (GTK_BOX (self->styli), page);
g_hash_table_insert (self->stylus_pages, tool, page);

View file

@ -20,6 +20,8 @@
#pragma once
#include <gdesktop-enums.h>
#include <shell/cc-panel.h>
G_BEGIN_DECLS
@ -39,4 +41,6 @@ GDBusProxy * cc_wacom_panel_get_gsd_wacom_bus_proxy (CcWacomPanel *self);
GDBusProxy * cc_wacom_panel_get_input_mapping_bus_proxy (CcWacomPanel *self);
const char * cc_wacom_panel_get_stylus_button_action_label (GDesktopStylusButtonAction action);
G_END_DECLS

View file

@ -0,0 +1,181 @@
/* cc-wacom-stylus-action-dialog.c
*
* Copyright © 2024 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config.h>
#include <glib/gi18n.h>
#include <adwaita.h>
#include <gdesktop-enums.h>
#include "cc-wacom-stylus-action-dialog.h"
#include "cc-wacom-panel.h"
struct _CcWacomStylusActionDialog
{
AdwWindow parent_instance;
GtkLabel *description_label;
AdwActionRow *left_button_row;
AdwActionRow *right_button_row;
AdwActionRow *middle_button_row;
AdwActionRow *back_row;
AdwActionRow *forward_row;
GSettings *settings;
char *key;
};
G_DEFINE_TYPE (CcWacomStylusActionDialog, cc_wacom_stylus_action_dialog, ADW_TYPE_WINDOW)
static void
cc_wacom_stylus_action_dialog_finalize (GObject *object)
{
CcWacomStylusActionDialog *self = CC_WACOM_STYLUS_ACTION_DIALOG (object);
g_clear_pointer (&self->key, free);
G_OBJECT_CLASS (cc_wacom_stylus_action_dialog_parent_class)->finalize (object);
}
static void
left_button_activated (CcWacomStylusActionDialog *self)
{
g_settings_set_enum (self->settings, self->key, G_DESKTOP_STYLUS_BUTTON_ACTION_DEFAULT);
}
static void
right_button_activated (CcWacomStylusActionDialog *self)
{
g_settings_set_enum (self->settings, self->key, G_DESKTOP_STYLUS_BUTTON_ACTION_RIGHT);
}
static void
middle_button_activated (CcWacomStylusActionDialog *self)
{
g_settings_set_enum (self->settings, self->key, G_DESKTOP_STYLUS_BUTTON_ACTION_MIDDLE);
}
static void
back_activated (CcWacomStylusActionDialog *self)
{
g_settings_set_enum (self->settings, self->key, G_DESKTOP_STYLUS_BUTTON_ACTION_BACK);
}
static void
forward_activated (CcWacomStylusActionDialog *self)
{
g_settings_set_enum (self->settings, self->key, G_DESKTOP_STYLUS_BUTTON_ACTION_FORWARD);
}
static void
cc_wacom_stylus_action_dialog_class_init (CcWacomStylusActionDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = cc_wacom_stylus_action_dialog_finalize;
gtk_widget_class_add_binding_action (widget_class, GDK_KEY_Escape, 0, "window.close", NULL);
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/"
"wacom/cc-wacom-stylus-action-dialog.ui");
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusActionDialog, description_label);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusActionDialog, left_button_row);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusActionDialog, right_button_row);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusActionDialog, middle_button_row);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusActionDialog, back_row);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusActionDialog, forward_row);
gtk_widget_class_bind_template_callback (widget_class, left_button_activated);
gtk_widget_class_bind_template_callback (widget_class, middle_button_activated);
gtk_widget_class_bind_template_callback (widget_class, right_button_activated);
gtk_widget_class_bind_template_callback (widget_class, forward_activated);
gtk_widget_class_bind_template_callback (widget_class, back_activated);
}
static void
cc_wacom_stylus_action_dialog_init (CcWacomStylusActionDialog *self)
{
const char *text;
gtk_widget_init_template (GTK_WIDGET (self));
text = cc_wacom_panel_get_stylus_button_action_label (G_DESKTOP_STYLUS_BUTTON_ACTION_DEFAULT);
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->left_button_row), text);
text = cc_wacom_panel_get_stylus_button_action_label (G_DESKTOP_STYLUS_BUTTON_ACTION_MIDDLE);
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->middle_button_row), text);
text = cc_wacom_panel_get_stylus_button_action_label (G_DESKTOP_STYLUS_BUTTON_ACTION_RIGHT);
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->right_button_row), text);
text = cc_wacom_panel_get_stylus_button_action_label (G_DESKTOP_STYLUS_BUTTON_ACTION_BACK);
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->back_row), text);
text = cc_wacom_panel_get_stylus_button_action_label (G_DESKTOP_STYLUS_BUTTON_ACTION_FORWARD);
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->forward_row), text);
}
GtkWidget*
cc_wacom_stylus_action_dialog_new (GSettings *settings,
guint button,
const char *key)
{
CcWacomStylusActionDialog *dialog = g_object_new (CC_TYPE_WACOM_STYLUS_ACTION_DIALOG, NULL);
GDesktopStylusButtonAction action;
AdwActionRow *row = NULL;
g_autofree char *text = NULL;
g_autofree char *title = NULL;
g_return_val_if_fail(button > 0 && button <= 3, NULL);
dialog->settings = settings;
dialog->key = g_strdup (key);
text = g_strdup_printf (_("Choose an action when button %d on the stylus is pressed"), button);
gtk_label_set_text (dialog->description_label, text);
title = g_strdup_printf (_("Button %d Mapping"), button);
gtk_window_set_title (GTK_WINDOW (dialog), title);
action = g_settings_get_enum (settings, key);
switch (action) {
case G_DESKTOP_STYLUS_BUTTON_ACTION_DEFAULT:
row = dialog->left_button_row;
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_MIDDLE:
row = dialog->middle_button_row;
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_RIGHT:
row = dialog->right_button_row;
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_BACK:
row = dialog->back_row;
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_FORWARD:
row = dialog->forward_row;
break;
}
if (row)
adw_action_row_activate (row);
return GTK_WIDGET (dialog);
}

View file

@ -0,0 +1,35 @@
/* cc-wacom-stylus-action-dialog.h
*
* Copyright © 2024 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <adwaita.h>
G_BEGIN_DECLS
#define CC_TYPE_WACOM_STYLUS_ACTION_DIALOG (cc_wacom_stylus_action_dialog_get_type ())
G_DECLARE_FINAL_TYPE (CcWacomStylusActionDialog, cc_wacom_stylus_action_dialog, CC, WACOM_STYLUS_ACTION_DIALOG, AdwWindow)
GtkWidget* cc_wacom_stylus_action_dialog_new (GSettings *settings,
guint button,
const char *key);
G_END_DECLS

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="CcWacomStylusActionDialog" parent="AdwWindow">
<property name="modal">True</property>
<property name="resizable">False</property>
<property name="title" translatable="no">Button %d Mapping</property>
<child>
<object class="AdwNavigationView" id="navigation_view">
<child>
<object class="AdwNavigationPage" id="main_page">
<property name="title" bind-source="CcWacomStylusActionDialog" bind-flags="sync-create" bind-property="title"/>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<object class="GtkBox">
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="spacing">12</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="description_label">
<property name="label" translatable="no">Choose an action when Button %d on the stylus is pressed</property>
<property name="margin_top">6</property>
<property name="margin_top">6</property>
<property name="wrap">True</property>
<property name="width_chars">40</property>
<property name="max_width_chars">40</property>
<property name="xalign">0</property>
</object>
</child>
<child>
<object class="GtkListBox" id="switch_listbox">
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="AdwActionRow" id="left_button_row">
<property name="use-underline">True</property>
<property name="activatable-widget">left_button</property>
<signal name="activated" handler="left_button_activated" swapped="yes"/>
<child type="prefix">
<object class="GtkCheckButton" id="left_button">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="middle_button_row">
<property name="use-underline">True</property>
<property name="activatable-widget">middle_button</property>
<signal name="activated" handler="middle_button_activated" swapped="yes"/>
<child type="prefix">
<object class="GtkCheckButton" id="middle_button">
<property name="valign">center</property>
<property name="group">left_button</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="right_button_row">
<property name="use-underline">True</property>
<property name="activatable-widget">right_button</property>
<signal name="activated" handler="right_button_activated" swapped="yes"/>
<child type="prefix">
<object class="GtkCheckButton" id="right_button">
<property name="valign">center</property>
<property name="group">left_button</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="back_row">
<property name="use-underline">True</property>
<property name="activatable-widget">back</property>
<signal name="activated" handler="back_activated" swapped="yes"/>
<child type="prefix">
<object class="GtkCheckButton" id="back">
<property name="valign">center</property>
<property name="group">left_button</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="forward_row">
<property name="use-underline">True</property>
<property name="activatable-widget">forward</property>
<signal name="activated" handler="forward_activated" swapped="yes"/>
<child type="prefix">
<object class="GtkCheckButton" id="forward">
<property name="valign">center</property>
<property name="group">left_button</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</child>
</object> <!-- ./AdwNavigationView navigation_view-->
</child>
</template>
<object class="GtkSizeGroup" id="accelerator_size_group"/>
</interface>

View file

@ -23,9 +23,12 @@
#include <adwaita.h>
#include <glib/gi18n.h>
#include <shell/cc-panel.h>
#include "cc-wacom-panel.h"
#include "cc-wacom-stylus-page.h"
#include "cc-wacom-stylus-action-dialog.h"
#include "panels/common/cc-list-row.h"
#include <gtk/gtk.h>
#include <gdesktop-enums.h>
#include <string.h>
@ -33,11 +36,15 @@ struct _CcWacomStylusPage
{
GtkBox parent_instance;
CcWacomPanel *panel;
GtkWidget *stylus_section;
GtkWidget *stylus_icon;
GtkWidget *stylus_button1_action;
GtkWidget *stylus_button2_action;
GtkWidget *stylus_button3_action;
GtkWidget *stylus_button1_action_row;
GtkWidget *stylus_button2_action_row;
GtkWidget *stylus_button3_action_row;
GtkLabel *stylus_button1_action_label;
GtkLabel *stylus_button2_action_label;
GtkLabel *stylus_button3_action_label;
GtkWidget *stylus_eraser_pressure;
GtkWidget *stylus_tip_pressure_scale;
GtkWidget *stylus_eraser_pressure_scale;
@ -188,30 +195,36 @@ cc_wacom_stylus_page_set_property (GObject *object,
}
static void
on_stylus_button1_action_selected (CcWacomStylusPage *page)
present_action_dialog (CcWacomStylusPage *page,
guint button,
const char *key)
{
gint idx;
GtkWindow *window;
GtkWidget *action_dialog;
idx = adw_combo_row_get_selected (ADW_COMBO_ROW (page->stylus_button1_action));
g_settings_set_enum (page->stylus_settings, "button-action", idx);
window = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (page->panel))));
action_dialog = cc_wacom_stylus_action_dialog_new (page->stylus_settings, button, key);
gtk_window_set_transient_for (GTK_WINDOW (action_dialog), window);
gtk_window_present (GTK_WINDOW (action_dialog));
}
static void
on_stylus_button2_action_selected (CcWacomStylusPage *page)
on_stylus_button1_action_activated (CcWacomStylusPage *page)
{
gint idx;
idx = adw_combo_row_get_selected (ADW_COMBO_ROW (page->stylus_button2_action));
g_settings_set_enum (page->stylus_settings, "secondary-button-action", idx);
present_action_dialog (page, 1, "button-action");
}
static void
on_stylus_button3_action_selected (CcWacomStylusPage *page)
on_stylus_button2_action_activated (CcWacomStylusPage *page)
{
gint idx;
present_action_dialog (page, 2, "secondary-button-action");
}
idx = adw_combo_row_get_selected (ADW_COMBO_ROW (page->stylus_button3_action));
g_settings_set_enum (page->stylus_settings, "tertiary-button-action", idx);
static void
on_stylus_button3_action_activated (CcWacomStylusPage *page)
{
present_action_dialog (page, 3, "tertiary-button-action");
}
static void
@ -223,22 +236,27 @@ cc_wacom_stylus_page_class_init (CcWacomStylusPageClass *klass)
object_class->get_property = cc_wacom_stylus_page_get_property;
object_class->set_property = cc_wacom_stylus_page_set_property;
g_type_ensure (CC_TYPE_LIST_ROW);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/wacom/cc-wacom-stylus-page.ui");
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_section);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_icon);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button1_action);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button2_action);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button3_action);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button1_action_row);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button2_action_row);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button3_action_row);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button1_action_label);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button2_action_label);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_button3_action_label);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_eraser_pressure);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_tip_pressure_scale);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_eraser_pressure_scale);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_tip_pressure_adjustment);
gtk_widget_class_bind_template_child (widget_class, CcWacomStylusPage, stylus_eraser_pressure_adjustment);
gtk_widget_class_bind_template_callback (widget_class, on_stylus_button1_action_selected);
gtk_widget_class_bind_template_callback (widget_class, on_stylus_button2_action_selected);
gtk_widget_class_bind_template_callback (widget_class, on_stylus_button3_action_selected);
gtk_widget_class_bind_template_callback (widget_class, on_stylus_button1_action_activated);
gtk_widget_class_bind_template_callback (widget_class, on_stylus_button2_action_activated);
gtk_widget_class_bind_template_callback (widget_class, on_stylus_button3_action_activated);
gtk_widget_class_bind_template_callback (widget_class, on_tip_pressure_value_changed);
gtk_widget_class_bind_template_callback (widget_class, on_eraser_pressure_value_changed);
}
@ -270,8 +288,22 @@ set_icon_name (CcWacomStylusPage *page,
gtk_picture_set_resource (GTK_PICTURE (page->stylus_icon), resource);
}
static void
on_button_action_changed (GSettings *settings,
gchar *key,
gpointer user_data)
{
GDesktopStylusButtonAction action = g_settings_get_enum (settings, key);
GtkLabel *label = GTK_LABEL (user_data);
const char *text = cc_wacom_panel_get_stylus_button_action_label (action);
if (text)
gtk_label_set_label (label, text);
}
GtkWidget *
cc_wacom_stylus_page_new (CcWacomTool *stylus)
cc_wacom_stylus_page_new (CcWacomPanel *panel,
CcWacomTool *stylus)
{
CcWacomStylusPage *page;
guint num_buttons;
@ -281,6 +313,7 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
page = g_object_new (CC_TYPE_WACOM_STYLUS_PAGE, NULL);
page->panel = panel;
page->stylus = stylus;
/* Stylus name */
@ -297,27 +330,43 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
has_paired_eraser = cc_wacom_tool_get_has_paired_eraser (stylus);
num_buttons = cc_wacom_tool_get_num_buttons (stylus);
gtk_widget_set_visible (page->stylus_button3_action,
gtk_widget_set_visible (page->stylus_button3_action_row,
num_buttons >= 3);
gtk_widget_set_visible (page->stylus_button2_action,
gtk_widget_set_visible (page->stylus_button2_action_row,
num_buttons >= 2);
gtk_widget_set_visible (page->stylus_button1_action,
gtk_widget_set_visible (page->stylus_button1_action_row,
num_buttons >= 1);
gtk_widget_set_visible (page->stylus_eraser_pressure,
has_paired_eraser);
adw_combo_row_set_selected (ADW_COMBO_ROW (page->stylus_button1_action),
g_settings_get_enum (page->stylus_settings, "button-action"));
adw_combo_row_set_selected (ADW_COMBO_ROW (page->stylus_button2_action),
g_settings_get_enum (page->stylus_settings, "secondary-button-action"));
adw_combo_row_set_selected (ADW_COMBO_ROW (page->stylus_button3_action),
g_settings_get_enum (page->stylus_settings, "tertiary-button-action"));
set_feel_from_gsettings (page->stylus_tip_pressure_adjustment,
page->stylus_settings, "pressure-curve");
set_feel_from_gsettings (page->stylus_eraser_pressure_adjustment,
page->stylus_settings, "eraser-pressure-curve");
g_signal_connect (G_OBJECT (page->stylus_settings),
"changed::button-action",
G_CALLBACK (on_button_action_changed),
page->stylus_button1_action_label);
g_signal_connect (G_OBJECT (page->stylus_settings),
"changed::secondary-button-action",
G_CALLBACK (on_button_action_changed),
page->stylus_button2_action_label);
g_signal_connect (G_OBJECT (page->stylus_settings),
"changed::tertiary-button-action",
G_CALLBACK (on_button_action_changed),
page->stylus_button3_action_label);
on_button_action_changed (page->stylus_settings,
"button-action",
page->stylus_button1_action_label);
on_button_action_changed (page->stylus_settings,
"secondary-button-action",
page->stylus_button2_action_label);
on_button_action_changed (page->stylus_settings,
"tertiary-button-action",
page->stylus_button3_action_label);
return GTK_WIDGET (page);
}
@ -336,3 +385,31 @@ cc_wacom_stylus_page_set_highlight (CcWacomStylusPage *page,
page->highlighted = highlight;
}
}
const char *
cc_wacom_panel_get_stylus_button_action_label (GDesktopStylusButtonAction action)
{
const char *text = NULL;
switch (action) {
case G_DESKTOP_STYLUS_BUTTON_ACTION_DEFAULT:
text = _("Left Mousebutton Click");
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_MIDDLE:
text = _("Middle Mousebutton Click");
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_RIGHT:
text = _("Right Mousebutton Click");
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_BACK:
/* Translators: this is the "go back" action of a button */
text = _("Back");
break;
case G_DESKTOP_STYLUS_BUTTON_ACTION_FORWARD:
/* Translators: this is the "go forward" action of a button */
text = _("Forward");
break;
}
return text;
}

View file

@ -21,6 +21,7 @@
#pragma once
#include <gtk/gtk.h>
#include "cc-wacom-panel.h"
#include "cc-wacom-tool.h"
G_BEGIN_DECLS
@ -28,7 +29,8 @@ G_BEGIN_DECLS
#define CC_TYPE_WACOM_STYLUS_PAGE (cc_wacom_stylus_page_get_type ())
G_DECLARE_FINAL_TYPE (CcWacomStylusPage, cc_wacom_stylus_page, CC, WACOM_STYLUS_PAGE, GtkBox)
GtkWidget * cc_wacom_stylus_page_new (CcWacomTool *stylus);
GtkWidget * cc_wacom_stylus_page_new (CcWacomPanel *panel,
CcWacomTool *stylus);
CcWacomTool * cc_wacom_stylus_page_get_tool (CcWacomStylusPage *page);

View file

@ -50,30 +50,60 @@
</object>
</child>
<child>
<object class="AdwComboRow" id="stylus_button1_action">
<property name="width_request">100</property>
<property name="title" translatable="yes" context="display setting">Button _1</property>
<property name="model">button_model</property>
<property name="use-underline">true</property>
<signal name="notify::selected-item" handler="on_stylus_button1_action_selected" swapped="yes"/>
<object class="CcListRow" id="stylus_button1_action_row">
<property name="title" translatable="yes">Button _1</property>
<property name="activatable">True</property>
<signal name="activated" handler="on_stylus_button1_action_activated" object="CcWacomStylusPage" swapped="yes" />
<child>
<object class="GtkLabel" id="stylus_button1_action_label">
<property name="use-underline">True</property>
<property name="halign">end</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="valign">center</property>
<property name="icon-name">go-next-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="stylus_button2_action">
<property name="width_request">100</property>
<property name="title" translatable="yes" context="display setting">Button _2</property>
<property name="model">button_model</property>
<property name="use-underline">true</property>
<signal name="notify::selected-item" handler="on_stylus_button2_action_selected" swapped="yes"/>
<object class="CcListRow" id="stylus_button2_action_row">
<property name="title" translatable="yes">Button _2</property>
<property name="activatable">True</property>
<signal name="activated" handler="on_stylus_button2_action_activated" object="CcWacomStylusPage" swapped="yes" />
<child>
<object class="GtkLabel" id="stylus_button2_action_label">
<property name="use-underline">True</property>
<property name="halign">end</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="valign">center</property>
<property name="icon-name">go-next-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="stylus_button3_action">
<property name="width_request">100</property>
<property name="title" translatable="yes" context="display setting">Button _3</property>
<property name="model">button_model</property>
<property name="use-underline">true</property>
<signal name="notify::selected-item" handler="on_stylus_button3_action_selected" swapped="yes"/>
<object class="CcListRow" id="stylus_button3_action_row">
<property name="title" translatable="yes">Button _3</property>
<property name="activatable">True</property>
<signal name="activated" handler="on_stylus_button3_action_activated" object="CcWacomStylusPage" swapped="yes" />
<child>
<object class="GtkLabel" id="stylus_button3_action_label">
<property name="use-underline">True</property>
<property name="halign">end</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="valign">center</property>
<property name="icon-name">go-next-symbolic</property>
</object>
</child>
</object>
</child>
<child>
@ -133,13 +163,4 @@
<widget name="stylus_eraser_pressure_box" />
</widgets>
</object>
<object class="GtkStringList" id="button_model">
<items>
<item translatable="yes">Default</item>
<item translatable="yes">Middle Mouse Button Click</item>
<item translatable="yes">Right Mouse Button Click</item>
<item translatable="yes">Back</item>
<item translatable="yes">Forward</item>
</items>
</object>
</interface>

View file

@ -37,6 +37,7 @@ common_sources = files(
'cc-wacom-button-row.c',
'cc-wacom-device.c',
'cc-wacom-page.c',
'cc-wacom-stylus-action-dialog.c',
'cc-wacom-stylus-page.c',
'cc-wacom-tool.c',
'gsd-wacom-key-shortcut-button.c'

View file

@ -2,11 +2,31 @@
#include "config.h"
#include <glib/gi18n.h>
#include <shell/cc-panel.h>
#include "cc-wacom-panel.h"
#include "cc-wacom-page.h"
#define FIXED_WIDTH 675
CcShell *
cc_panel_get_shell (CcPanel *self)
{
return NULL;
}
GtkWidget *
cc_shell_get_toplevel (CcShell *shell)
{
return NULL;
}
GType
cc_panel_get_type ()
{
return 1234;
}
void
cc_wacom_panel_switch_to_panel (CcWacomPanel *self, const char *panel)
{

View file

@ -4,6 +4,7 @@
<file preprocess="xml-stripblanks">cc-wacom-panel.ui</file>
<file preprocess="xml-stripblanks">cc-wacom-page.ui</file>
<file preprocess="xml-stripblanks">cc-wacom-ekr-page.ui</file>
<file preprocess="xml-stripblanks">cc-wacom-stylus-action-dialog.ui</file>
<file preprocess="xml-stripblanks">cc-wacom-stylus-page.ui</file>
<file preprocess="xml-stripblanks">button-mapping.ui</file>
<file preprocess="xml-stripblanks">calibrator/calibrator.ui</file>

View file

@ -262,6 +262,8 @@ panels/wacom/cc-wacom-page.c
panels/wacom/cc-wacom-page.ui
panels/wacom/cc-wacom-panel.c
panels/wacom/cc-wacom-panel.ui
panels/wacom/cc-wacom-stylus-action-dialog.c
panels/wacom/cc-wacom-stylus-action-dialog.ui
panels/wacom/cc-wacom-stylus-page.c
panels/wacom/cc-wacom-stylus-page.ui
panels/wacom/cc-wacom-tool.c