|
|
02512f |
From 7a4532ff72a74ce74dee4b96b993ecd11f557acc Mon Sep 17 00:00:00 2001
|
|
|
02512f |
From: Carlos Garnacho <carlosg@gnome.org>
|
|
|
02512f |
Date: Mon, 11 Feb 2019 20:48:23 +0100
|
|
|
02512f |
Subject: [PATCH] wacom: Update "Test your settings" button sensitivity on
|
|
|
02512f |
device availability
|
|
|
02512f |
|
|
|
02512f |
The button/popover are meaningless if there's no device to test with. Set
|
|
|
02512f |
it inactive (so the popover hides if visible) and set insensitive if no
|
|
|
02512f |
devices are found.
|
|
|
02512f |
|
|
|
02512f |
https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/390
|
|
|
02512f |
---
|
|
|
02512f |
panels/wacom/cc-wacom-panel.c | 22 ++++++++++++++++++++++
|
|
|
02512f |
1 file changed, 22 insertions(+)
|
|
|
02512f |
|
|
|
02512f |
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
|
|
|
02512f |
index 77a1e261f..e4f3ca7fc 100644
|
|
|
02512f |
--- a/panels/wacom/cc-wacom-panel.c
|
|
|
02512f |
+++ b/panels/wacom/cc-wacom-panel.c
|
|
|
02512f |
@@ -53,6 +53,7 @@ struct _CcWacomPanelPrivate
|
|
|
02512f |
GtkWidget *stylus_notebook;
|
|
|
02512f |
GtkWidget *test_popover;
|
|
|
02512f |
GtkWidget *test_draw_area;
|
|
|
02512f |
+ GtkWidget *test_button;
|
|
|
02512f |
GHashTable *devices; /* key=GsdDevice, value=CcWacomDevice */
|
|
|
02512f |
GHashTable *pages; /* key=device name, value=GtkWidget */
|
|
|
02512f |
GHashTable *stylus_pages; /* key=CcWacomTool, value=GtkWidget */
|
|
|
02512f |
@@ -309,6 +310,22 @@ add_stylus (CcWacomPanel *self,
|
|
|
02512f |
return TRUE;
|
|
|
02512f |
}
|
|
|
02512f |
|
|
|
02512f |
+static void
|
|
|
02512f |
+update_test_button (CcWacomPanel *self)
|
|
|
02512f |
+{
|
|
|
02512f |
+ CcWacomPanelPrivate *priv = self->priv;;
|
|
|
02512f |
+
|
|
|
02512f |
+ if (!priv->test_button)
|
|
|
02512f |
+ return;
|
|
|
02512f |
+
|
|
|
02512f |
+ if (g_hash_table_size (priv->devices) == 0) {
|
|
|
02512f |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->test_button), FALSE);
|
|
|
02512f |
+ gtk_widget_set_sensitive (priv->test_button, FALSE);
|
|
|
02512f |
+ } else {
|
|
|
02512f |
+ gtk_widget_set_sensitive (priv->test_button, TRUE);
|
|
|
02512f |
+ }
|
|
|
02512f |
+}
|
|
|
02512f |
+
|
|
|
02512f |
static void
|
|
|
02512f |
update_current_tool (CcWacomPanel *panel,
|
|
|
02512f |
GdkDevice *device,
|
|
|
02512f |
@@ -422,6 +439,9 @@ cc_wacom_panel_constructed (GObject *object)
|
|
|
02512f |
|
|
|
02512f |
g_signal_connect_object (shell, "event",
|
|
|
02512f |
G_CALLBACK (on_shell_event_cb), self, 0);
|
|
|
02512f |
+
|
|
|
02512f |
+ priv->test_button = button;
|
|
|
02512f |
+ update_test_button (self);
|
|
|
02512f |
}
|
|
|
02512f |
|
|
|
02512f |
static const char *
|
|
|
02512f |
@@ -561,6 +581,8 @@ update_current_page (CcWacomPanel *self,
|
|
|
02512f |
if (num_pages > 1)
|
|
|
02512f |
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->tablet_notebook), 1);
|
|
|
02512f |
}
|
|
|
02512f |
+
|
|
|
02512f |
+ update_test_button (self);
|
|
|
02512f |
}
|
|
|
02512f |
|
|
|
02512f |
static void
|
|
|
02512f |
--
|
|
|
02512f |
2.20.1
|
|
|
02512f |
|