[gnome-control-center] wacom: Add stub button mapping dialogue



commit 16b872c8dd5812eb11c5f15ac7d1bbf2713bd334
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 14 15:51:54 2012 +0000

    wacom: Add stub button mapping dialogue

 panels/wacom/Makefile.am               |    2 +-
 panels/wacom/button-mapping.ui         |  148 ++++++++++++++++++++++++++++++++
 panels/wacom/cc-wacom-page.c           |   31 +++++++
 panels/wacom/gnome-wacom-properties.ui |    4 +-
 po/POTFILES.in                         |    1 +
 5 files changed, 183 insertions(+), 3 deletions(-)
---
diff --git a/panels/wacom/Makefile.am b/panels/wacom/Makefile.am
index 59ff617..b31a775 100644
--- a/panels/wacom/Makefile.am
+++ b/panels/wacom/Makefile.am
@@ -68,7 +68,7 @@ pixmap_DATA =				\
 	wacom-tablet-pc.svg
 
 uidir   = $(pkgdatadir)/ui
-ui_DATA = gnome-wacom-properties.ui wacom-stylus-page.ui
+ui_DATA = gnome-wacom-properties.ui wacom-stylus-page.ui button-mapping.ui
 
 desktopdir = $(datadir)/applications
 desktop_in_files = gnome-wacom-panel.desktop.in
diff --git a/panels/wacom/button-mapping.ui b/panels/wacom/button-mapping.ui
new file mode 100644
index 0000000..e0ca94f
--- /dev/null
+++ b/panels/wacom/button-mapping.ui
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="button-mapping-dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Keyboard</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="top_vbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkButton" id="close_button">
+                <property name="label">gtk-close</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="shortcuts_vbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="ypad">12</property>
+                <property name="label" translatable="yes">Map buttons to functions</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkTable" id="table11">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="column_spacing">5</property>
+                <child>
+                  <object class="GtkScrolledWindow" id="actions_swindow">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">never</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkTreeView" id="shortcut_treeview">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="headers_visible">False</property>
+                        <property name="rules_hint">True</property>
+                        <child internal-child="selection">
+                          <object class="GtkTreeSelection" id="treeview-selection"/>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">5</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="label12">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">To edit a shortcut, click the row and hold down the new keys or press Backspace to clear.</property>
+                    <property name="justify">fill</property>
+                    <property name="wrap">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">close_button</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 093db88..570bd5a 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -32,6 +32,7 @@
 
 #define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x)
 #define CWID(x) (GtkContainer *) gtk_builder_get_object (priv->builder, x)
+#define MWID(x) (GtkWidget *) gtk_builder_get_object (builder, x);
 
 G_DEFINE_TYPE (CcWacomPage, cc_wacom_page, GTK_TYPE_BOX)
 
@@ -198,6 +199,34 @@ calibrate_button_clicked_cb (GtkButton   *button,
 }
 
 static void
+map_buttons_button_clicked_cb (GtkButton   *button,
+			       CcWacomPage *page)
+{
+	GtkBuilder *builder;
+	GError *error = NULL;
+	GtkWidget *dialog;
+
+	builder = gtk_builder_new ();
+	gtk_builder_add_from_file (builder,
+				   GNOMECC_UI_DIR "/button-mapping.ui",
+				   &error);
+
+	if (error != NULL) {
+		g_warning ("Error loading UI file: %s", error->message);
+		g_object_unref (builder);
+		g_error_free (error);
+		return;
+	}
+
+	dialog = MWID ("button-mapping-dialog");
+	gtk_window_set_transient_for (GTK_WINDOW (dialog),
+				      GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (page))));
+	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+	gtk_widget_show (dialog);
+}
+
+static void
 tabletmode_changed_cb (GtkComboBox *combo, gpointer user_data)
 {
 	CcWacomPagePrivate	*priv	= CC_WACOM_PAGE(user_data)->priv;
@@ -370,6 +399,8 @@ cc_wacom_page_init (CcWacomPage *self)
 
 	g_signal_connect (WID ("button-calibrate"), "clicked",
 			  G_CALLBACK (calibrate_button_clicked_cb), self);
+	g_signal_connect (WID ("map-buttons-button"), "clicked",
+			  G_CALLBACK (map_buttons_button_clicked_cb), self);
 
 	combo = GTK_COMBO_BOX (WID ("combo-tabletmode"));
 	combobox_text_cellrenderer (combo, MODELABEL_COLUMN);
diff --git a/panels/wacom/gnome-wacom-properties.ui b/panels/wacom/gnome-wacom-properties.ui
index 4c229b6..6e5ea5a 100644
--- a/panels/wacom/gnome-wacom-properties.ui
+++ b/panels/wacom/gnome-wacom-properties.ui
@@ -326,10 +326,10 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="button1">
+                      <object class="GtkButton" id="map-buttons-button">
                         <property name="label" translatable="yes">Map Buttons...</property>
                         <property name="use_action_appearance">False</property>
-                        <property name="sensitive">False</property>
+                        <property name="sensitive">True</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d3faa66..05b1eb2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -102,6 +102,7 @@ panels/user-accounts/um-utils.c
 panels/wacom/gnome-wacom-panel.desktop.in.in
 [type: gettext/glade]panels/wacom/gnome-wacom-properties.ui
 [type: gettext/glade]panels/wacom/wacom-stylus-page.ui
+[type: gettext/glade]panels/wacom/button-mapping.ui
 panels/wacom/gsd-wacom-device.c
 panels/wacom/calibrator/gui_gtk.c
 panels/wacom/cc-wacom-nav-button.c



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