wacom: Add cc_wacom_page_calibrate and cc_wacom_page_can_calibrate functions

https://bugzilla.gnome.org/show_bug.cgi?id=692816
This commit is contained in:
Joaquim Rocha 2013-06-03 19:21:35 +02:00
parent e45bafaacb
commit ed3c9badff
2 changed files with 41 additions and 7 deletions

View file

@ -253,15 +253,17 @@ run_calibration (CcWacomPage *page,
}
static void
calibrate_button_clicked_cb (GtkButton *button,
CcWacomPage *page)
calibrate (CcWacomPage *page)
{
CcWacomPagePrivate *priv;
int i, calibration[4];
GVariant *variant;
int *current;
gsize ncal;
gint monitor;
priv = page->priv;
monitor = gsd_wacom_device_get_display_monitor (page->priv->stylus);
if (monitor < 0) {
/* The display the tablet should be mapped to could not be located.
@ -314,7 +316,14 @@ calibrate_button_clicked_cb (GtkButton *button,
}
run_calibration (page, calibration, monitor);
gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
gtk_widget_set_sensitive (WID ("button-calibrate"), FALSE);
}
static void
calibrate_button_clicked_cb (GtkButton *button,
CcWacomPage *page)
{
calibrate (page);
}
/* This avoids us crashing when a newer version of
@ -1336,12 +1345,17 @@ remove_mouse_link (CcWacomPagePrivate *priv)
"top_attach", 2, NULL);
}
static gboolean
has_monitor (CcWacomPage *page)
{
return gsd_wacom_device_get_display_monitor (page->priv->stylus) >= 0;
}
static void
update_tablet_ui (CcWacomPage *page,
int layout)
{
CcWacomPagePrivate *priv;
gboolean has_monitor = FALSE;
GsdWacomStylus *puck;
priv = page->priv;
@ -1368,9 +1382,8 @@ update_tablet_ui (CcWacomPage *page,
gtk_widget_destroy (WID ("display-mapping-button"));
gtk_widget_show (WID ("button-calibrate"));
if (gsd_wacom_device_get_display_monitor (priv->stylus) >= 0)
has_monitor = TRUE;
gtk_widget_set_sensitive (WID ("button-calibrate"), has_monitor);
gtk_widget_set_sensitive (WID ("button-calibrate"),
has_monitor (priv));
gtk_container_child_set (CWID ("main-grid"),
WID ("tablet-buttons-box"),
@ -1477,3 +1490,20 @@ cc_wacom_page_set_navigation (CcWacomPage *page,
"ignore-first", ignore_first_page,
NULL);
}
void
cc_wacom_page_calibrate (CcWacomPage *page)
{
g_return_if_fail (CC_IS_WACOM_PAGE (page));
calibrate (page);
}
gboolean
cc_wacom_page_can_calibrate (CcWacomPage *page)
{
g_return_val_if_fail (CC_IS_WACOM_PAGE (page),
FALSE);
return has_monitor (page);
}

View file

@ -83,6 +83,10 @@ void cc_wacom_page_set_navigation (CcWacomPage *page,
GtkNotebook *notebook,
gboolean ignore_first_page);
void cc_wacom_page_calibrate (CcWacomPage *page);
gboolean cc_wacom_page_can_calibrate (CcWacomPage *page);
G_END_DECLS
#endif /* _CC_WACOM_PAGE_H */