[gnome-control-center/wip/carlosg/wacom-test-button-sensitivity] wacom: Update "Test your settings" button sensitivity on device availability
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/carlosg/wacom-test-button-sensitivity] wacom: Update "Test your settings" button sensitivity on device availability
- Date: Mon, 11 Feb 2019 18:54:59 +0000 (UTC)
commit 903cc8b114f627c5df003ca1ae60bbb7538f9283
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Feb 11 19:16:45 2019 +0100
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.
panels/wacom/cc-wacom-panel.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
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 */
@@ -336,6 +337,20 @@ add_stylus (CcWacomPanel *self,
return TRUE;
}
+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,
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]