summaryrefslogtreecommitdiff
path: root/panels/wacom/cc-wacom-panel.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2019-02-11 19:16:45 +0100
committerRobert Ancell <robert.ancell@gmail.com>2019-02-12 00:40:14 +0000
commit4860f3637cc755719cc1dfd772fdf19adf44f474 (patch)
treeb14fd4e6dc021b11dfde725c70df4cc48eb68da1 /panels/wacom/cc-wacom-panel.c
parent35fbddc2fedc6a37d67a85fd8a70ee0c0fc1b804 (diff)
downloadgnome-control-center-4860f3637cc755719cc1dfd772fdf19adf44f474.tar.gz
wacom: Update "Test your settings" button sensitivity on device availability
The button/popover are meaningless if there's no device to test with. Set it inactive (so the popover hides if visible) and set insensitive if no devices are found.
Diffstat (limited to 'panels/wacom/cc-wacom-panel.c')
-rw-r--r--panels/wacom/cc-wacom-panel.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index 72c8c46a0..b1f7bad7a 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -52,6 +52,7 @@ struct _CcWacomPanel
GtkWidget *stylus_notebook;
GtkWidget *test_popover;
GtkWidget *test_draw_area;
+ GtkWidget *test_button;
GHashTable *devices; /* key=GsdDevice, value=CcWacomDevice */
GHashTable *pages; /* key=device name, value=GtkWidget */
GHashTable *stylus_pages; /* key=CcWacomTool, value=GtkWidget */
@@ -337,6 +338,20 @@ add_stylus (CcWacomPanel *self,
}
static void
+update_test_button (CcWacomPanel *self)
+{
+ if (!self->test_button)
+ return;
+
+ if (g_hash_table_size (self->devices) == 0) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->test_button), FALSE);
+ gtk_widget_set_sensitive (self->test_button, FALSE);
+ } else {
+ gtk_widget_set_sensitive (self->test_button, TRUE);
+ }
+}
+
+static void
update_current_tool (CcWacomPanel *panel,
GdkDevice *device,
GdkDeviceTool *tool)
@@ -468,6 +483,9 @@ cc_wacom_panel_constructed (GObject *object)
g_signal_connect_object (shell, "event",
G_CALLBACK (on_shell_event_cb), self, 0);
+
+ self->test_button = button;
+ update_test_button (self);
}
static const char *
@@ -603,6 +621,8 @@ update_current_page (CcWacomPanel *self,
if (num_pages > 1)
gtk_notebook_set_current_page (GTK_NOTEBOOK (self->tablet_notebook), 1);
}
+
+ update_test_button (self);
}
static void