[gnome-control-center] wacom: add a left-handed switch
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] wacom: add a left-handed switch
- Date: Fri, 2 Sep 2011 15:47:14 +0000 (UTC)
commit a4c96614bf5d438cbadbe932086f4f94fe57afc1
Author: Peter Hutterer <peter hutterer who-t net>
Date: Thu Sep 1 12:00:17 2011 +1000
wacom: add a left-handed switch
Add a switch for left-handed orientation (read: no/180 degree
rotation). g-s-d and the driver allow for 4 orientations, so this only
activates the switch as "on" if the rotation is "half".
https://bugzilla.gnome.org/show_bug.cgi?id=657810
panels/wacom/cc-wacom-panel.c | 28 ++++++++++++++++++
panels/wacom/gnome-wacom-properties.ui | 50 +++++++++++++++++++++++++------
2 files changed, 68 insertions(+), 10 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index 76eec1c..edec43b 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -167,6 +167,28 @@ tabletmode_changed_cb (GtkComboBox *combo, gpointer user_data)
}
static void
+left_handed_toggled_cb (GtkSwitch *sw, GParamSpec *pspec, gpointer *user_data)
+{
+ CcWacomPanelPrivate *priv = CC_WACOM_PANEL(user_data)->priv;
+ const gchar* rotation;
+
+ rotation = gtk_switch_get_active (sw) ? "half" : "none";
+
+ g_settings_set_string (priv->wacom_settings, "rotation", rotation);
+}
+
+static void
+set_left_handed_from_gsettings (CcWacomPanel *panel)
+{
+ CcWacomPanelPrivate *priv = CC_WACOM_PANEL(panel)->priv;
+ const gchar* rotation;
+
+ rotation = g_settings_get_string (priv->wacom_settings, "rotation");
+ if (strcmp (rotation, "half") == 0)
+ gtk_switch_set_active (GTK_SWITCH (WID ("switch-left-handed")), TRUE);
+}
+
+static void
set_mode_from_gsettings (GtkComboBox *combo, CcWacomPanel *panel)
{
CcWacomPanelPrivate *priv = CC_WACOM_PANEL(panel)->priv;
@@ -382,6 +404,7 @@ cc_wacom_panel_init (CcWacomPanel *self)
GtkWidget *grid;
GError *error = NULL;
GtkComboBox *combo;
+ GtkSwitch *sw;
char *objects[] = {
"main-grid",
"liststore-tabletmode",
@@ -435,11 +458,16 @@ cc_wacom_panel_init (CcWacomPanel *self)
g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (tabletmode_changed_cb), self);
+ sw = GTK_SWITCH (WID ("switch-left-handed"));
+ g_signal_connect (G_OBJECT (sw), "notify::active",
+ G_CALLBACK (left_handed_toggled_cb), self);
+
set_button_mapping_from_gsettings (GTK_COMBO_BOX (WID ("combo-topbutton")), priv->stylus_settings, 3);
set_button_mapping_from_gsettings (GTK_COMBO_BOX (WID ("combo-bottombutton")), priv->stylus_settings, 2);
set_mode_from_gsettings (GTK_COMBO_BOX (WID ("combo-tabletmode")), self);
set_feel_from_gsettings (GTK_ADJUSTMENT (WID ("adjustment-tip-feel")), priv->stylus_settings);
set_feel_from_gsettings (GTK_ADJUSTMENT (WID ("adjustment-eraser-feel")), priv->eraser_settings);
+ set_left_handed_from_gsettings (self);
gtk_image_set_from_file (GTK_IMAGE (WID ("image-tablet")), PIXMAP_DIR "/wacom-tablet.svg");
gtk_image_set_from_file (GTK_IMAGE (WID ("image-stylus")), PIXMAP_DIR "/wacom-stylus.svg");
diff --git a/panels/wacom/gnome-wacom-properties.ui b/panels/wacom/gnome-wacom-properties.ui
index 631ac92..9247c36 100644
--- a/panels/wacom/gnome-wacom-properties.ui
+++ b/panels/wacom/gnome-wacom-properties.ui
@@ -164,7 +164,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="width">2</property>
<property name="height">4</property>
</packing>
@@ -222,6 +222,36 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="label-left-handed">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Left-Handed Orientation:</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch-left-handed">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -277,7 +307,7 @@
</object>
<packing>
<property name="left_attach">3</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -297,7 +327,7 @@
</object>
<packing>
<property name="left_attach">2</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -311,7 +341,7 @@
</object>
<packing>
<property name="left_attach">3</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -325,7 +355,7 @@
</object>
<packing>
<property name="left_attach">3</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">7</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -385,7 +415,7 @@
</object>
<packing>
<property name="left_attach">3</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -405,7 +435,7 @@
</object>
<packing>
<property name="left_attach">2</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">7</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -425,7 +455,7 @@
</object>
<packing>
<property name="left_attach">2</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -445,7 +475,7 @@
</object>
<packing>
<property name="left_attach">2</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -464,7 +494,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]