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

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