Blame SOURCES/0001-wacom-Update-Test-your-settings-button-sensitivity-o.patch

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