[gnome-control-center] wacom: add a link to the mouse settings panel



commit 9031c41784bcad8084c45fc20ecf8a7ca41c12d5
Author: Joaquim Rocha <me joaquimrocha com>
Date:   Thu Apr 4 14:01:08 2013 +0200

    wacom: add a link to the mouse settings panel
    
    Based on previous work by Olivier Fourdan.

 panels/wacom/cc-wacom-page.c           | 26 +++++++++++++++++++++++++-
 panels/wacom/gnome-wacom-properties.ui | 25 ++++++++++++++++++++++---
 panels/wacom/test-wacom.c              |  2 +-
 3 files changed, 48 insertions(+), 5 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 2d85175..6214bdd 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -1033,6 +1033,14 @@ display_clicked_cb (GtkButton   *button,
        return TRUE;
 }
 
+static gboolean
+mouse_clicked_cb (GtkButton   *button,
+                 CcWacomPage *page)
+{
+       cc_wacom_panel_switch_to_panel (page->priv->panel, "mouse");
+       return TRUE;
+}
+
 /* Boilerplate code goes below */
 
 static void
@@ -1158,6 +1166,9 @@ cc_wacom_page_init (CcWacomPage *self)
        g_signal_connect (G_OBJECT (WID ("display-link")), "activate-link",
                          G_CALLBACK (display_clicked_cb), self);
 
+       g_signal_connect (G_OBJECT (WID ("mouse-link")), "activate-link",
+                         G_CALLBACK (mouse_clicked_cb), self);
+
        g_signal_connect (G_OBJECT (WID ("display-mapping-button")), "clicked",
                          G_CALLBACK (display_mapping_button_clicked_cb), self);
 
@@ -1272,13 +1283,27 @@ remove_display_link (CcWacomPagePrivate *priv)
 }
 
 static void
+remove_mouse_link (CcWacomPagePrivate *priv)
+{
+        gtk_widget_destroy (WID ("mouse-link"));
+
+        gtk_container_child_set (CWID ("main-grid"),
+                                 WID ("tablet-buttons-box"),
+                                 "top_attach", 2, NULL);
+}
+
+static void
 update_tablet_ui (CcWacomPage *page,
                  int          layout)
 {
        CcWacomPagePrivate *priv;
        gboolean has_monitor = FALSE;
+       GsdWacomStylus *puck;
 
        priv = page->priv;
+       puck = gsd_wacom_device_get_stylus_for_type (priv->stylus, WACOM_STYLUS_TYPE_PUCK);
+       if (puck == NULL)
+               remove_mouse_link (priv);
 
        /* Hide the pad buttons if no pad is present */
        gtk_widget_set_visible (WID ("map-buttons-button"), priv->pad != NULL);
@@ -1302,7 +1327,6 @@ update_tablet_ui (CcWacomPage *page,
                if (gsd_wacom_device_get_display_monitor (priv->stylus) >= 0)
                        has_monitor = TRUE;
                gtk_widget_set_sensitive (WID ("button-calibrate"), has_monitor);
-               gtk_widget_show (WID ("display-link"));
 
                gtk_container_child_set (CWID ("main-grid"),
                                         WID ("tablet-buttons-box"),
diff --git a/panels/wacom/gnome-wacom-properties.ui b/panels/wacom/gnome-wacom-properties.ui
index 55363d9..126f0bd 100644
--- a/panels/wacom/gnome-wacom-properties.ui
+++ b/panels/wacom/gnome-wacom-properties.ui
@@ -196,7 +196,7 @@
                     <property name="left_attach">0</property>
                     <property name="top_attach">1</property>
                     <property name="width">1</property>
-                    <property name="height">3</property>
+                    <property name="height">4</property>
                   </packing>
                 </child>
                 <child>
@@ -263,7 +263,26 @@
                 <child>
                  <object class="GtkLinkButton" id="display-link">
                    <property name="label" translatable="yes">Adjust display resolution</property>
-                   <property name="visible">False</property>
+                   <property name="visible">True</property>
+                   <property name="can_focus">True</property>
+                   <property name="receives_default">True</property>
+                   <property name="has_tooltip">False</property>
+                   <property name="use_action_appearance">False</property>
+                   <property name="relief">none</property>
+                   <property name="halign">end</property>
+                   <property name="valign">center</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                 <object class="GtkLinkButton" id="mouse-link">
+                   <property name="label" translatable="yes">Adjust mouse settings</property>
+                   <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="receives_default">True</property>
                    <property name="has_tooltip">False</property>
@@ -369,7 +388,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">1</property>
                   </packing>
diff --git a/panels/wacom/test-wacom.c b/panels/wacom/test-wacom.c
index c3012cc..f286071 100644
--- a/panels/wacom/test-wacom.c
+++ b/panels/wacom/test-wacom.c
@@ -11,7 +11,7 @@
 void
 cc_wacom_panel_switch_to_panel (CcWacomPanel *self, const char *panel)
 {
-       g_message ("Should launch display preferences here");
+       g_message ("Should launch %s preferences here", panel);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]