wacom: Split off notebook switching for detected stylus
This will reduce code duplication for mocking styli.
This commit is contained in:
parent
d47b9be08a
commit
a93a023229
1 changed files with 22 additions and 16 deletions
|
@ -330,6 +330,26 @@ update_test_button (CcWacomPanel *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_stylus_notebook (CcWacomPanel *panel,
|
||||||
|
CcWacomTool *stylus)
|
||||||
|
{
|
||||||
|
if (panel->stylus_notebook ==
|
||||||
|
gtk_stack_get_visible_child (GTK_STACK (panel->stack))) {
|
||||||
|
GtkWidget *widget;
|
||||||
|
gint page;
|
||||||
|
|
||||||
|
widget = g_hash_table_lookup (panel->stylus_pages, stylus);
|
||||||
|
page = gtk_notebook_page_num (GTK_NOTEBOOK (panel->stylus_notebook), widget);
|
||||||
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->stylus_notebook), page);
|
||||||
|
} else {
|
||||||
|
gtk_container_child_set (GTK_CONTAINER (panel->stack),
|
||||||
|
panel->stylus_notebook,
|
||||||
|
"needs-attention", TRUE,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_current_tool (CcWacomPanel *panel,
|
update_current_tool (CcWacomPanel *panel,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
@ -392,22 +412,8 @@ update_current_tool (CcWacomPanel *panel,
|
||||||
|
|
||||||
added = add_stylus (panel, stylus);
|
added = add_stylus (panel, stylus);
|
||||||
|
|
||||||
if (added) {
|
if (added)
|
||||||
if (panel->stylus_notebook ==
|
update_stylus_notebook (panel, stylus);
|
||||||
gtk_stack_get_visible_child (GTK_STACK (panel->stack))) {
|
|
||||||
GtkWidget *widget;
|
|
||||||
gint page;
|
|
||||||
|
|
||||||
widget = g_hash_table_lookup (panel->stylus_pages, stylus);
|
|
||||||
page = gtk_notebook_page_num (GTK_NOTEBOOK (panel->stylus_notebook), widget);
|
|
||||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->stylus_notebook), page);
|
|
||||||
} else {
|
|
||||||
gtk_container_child_set (GTK_CONTAINER (panel->stack),
|
|
||||||
panel->stylus_notebook,
|
|
||||||
"needs-attention", TRUE,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_tablet_tool_map_add_relation (panel->tablet_tool_map,
|
cc_tablet_tool_map_add_relation (panel->tablet_tool_map,
|
||||||
wacom_device, stylus);
|
wacom_device, stylus);
|
||||||
|
|
Loading…
Add table
Reference in a new issue