[gnome-control-center/wip/input-sources: 7/14] Region: Add a 'Shortcuts' link to the input sources tab



commit eaebd5e7d2d9cb57c83dd2a033de5301d92c2da0
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Nov 15 21:12:43 2011 -0500

    Region: Add a 'Shortcuts' link to the input sources tab
    
    Now we just need to make the shortcuts page actually provide
    previous/next input source shortcuts.

 panels/region/cc-region-panel.c          |    2 +-
 panels/region/gnome-region-panel-input.c |   24 +++++++++++++++++++++++-
 panels/region/gnome-region-panel-input.h |    4 +++-
 panels/region/gnome-region-panel.ui      |   27 +++++++++++++++++++++++++--
 4 files changed, 52 insertions(+), 5 deletions(-)
---
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index ee2577a..54e4b01 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -151,7 +151,7 @@ cc_region_panel_init (CcRegionPanel * self)
 
 	gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
 
-        setup_input_tabs (priv->builder);
+        setup_input_tabs (priv->builder, self);
 	setup_language (priv->builder);
 	setup_formats (priv->builder);
 	setup_system (priv->builder);
diff --git a/panels/region/gnome-region-panel-input.c b/panels/region/gnome-region-panel-input.c
index 1419fe2..25b5868 100644
--- a/panels/region/gnome-region-panel-input.c
+++ b/panels/region/gnome-region-panel-input.c
@@ -571,8 +571,27 @@ show_selected_layout (GtkButton *button, gpointer data)
 
 /* Main setup {{{1 */
 
+static gboolean
+go_to_shortcuts (GtkLinkButton *button,
+                 CcRegionPanel *panel)
+{
+  CcShell *shell;
+  const gchar *argv[] = { "shortcuts", NULL };
+  GError *error = NULL;
+
+  shell = cc_panel_get_shell (CC_PANEL (panel));
+  if (!cc_shell_set_active_panel_from_id (shell, "keyboard", argv, &error))
+    {
+      g_warning ("Failed to activate Keyboard panel: %s", error->message);
+      g_error_free (error);
+    }
+
+  return TRUE;
+}
+
 void
-setup_input_tabs (GtkBuilder *builder)
+setup_input_tabs (GtkBuilder    *builder,
+                  CcRegionPanel *panel)
 {
   GtkWidget *treeview;
   GtkTreeViewColumn *column;
@@ -632,6 +651,9 @@ setup_input_tabs (GtkBuilder *builder)
 
   g_free (previous);
   g_free (next);
+
+  g_signal_connect (WID("jump-to-shortcuts"), "activate-link",
+                    G_CALLBACK (go_to_shortcuts), panel);
 }
 
 /* Chooser dialog {{{1 */
diff --git a/panels/region/gnome-region-panel-input.h b/panels/region/gnome-region-panel-input.h
index a3aa05d..47a1f52 100644
--- a/panels/region/gnome-region-panel-input.h
+++ b/panels/region/gnome-region-panel-input.h
@@ -24,10 +24,12 @@
 
 #include <gtk/gtk.h>
 
+#include "cc-region-panel.h"
 
 G_BEGIN_DECLS
 
-void setup_input_tabs (GtkBuilder *builder);
+void setup_input_tabs (GtkBuilder    *builder,
+                       CcRegionPanel *self);
 
 G_END_DECLS
 
diff --git a/panels/region/gnome-region-panel.ui b/panels/region/gnome-region-panel.ui
index 3536a23..93fd0c7 100644
--- a/panels/region/gnome-region-panel.ui
+++ b/panels/region/gnome-region-panel.ui
@@ -169,6 +169,7 @@
                               <object class="GtkToolButton" id="language_add">
                                 <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
+                                <property name="label" translatable="yes">Add Language</property>
                                 <property name="can_focus">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="icon_name">list-add-symbolic</property>
@@ -181,6 +182,7 @@
                             <child>
                               <object class="GtkToolButton" id="language_remove">
                                 <property name="use_action_appearance">False</property>
+                                <property name="label" translatable="yes">Remove Language</property>
                                 <property name="visible">True</property>
                                 <property name="sensitive">False</property>
                                 <property name="can_focus">False</property>
@@ -320,6 +322,7 @@
                             <child>
                               <object class="GtkToolButton" id="region_add">
                                 <property name="use_action_appearance">False</property>
+                                <property name="label" translatable="yes">Add Region</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="use_underline">True</property>
@@ -334,6 +337,7 @@
                               <object class="GtkToolButton" id="region_remove">
                                 <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
+                                <property name="label" translatable="yes">Remove Region</property>
                                 <property name="sensitive">False</property>
                                 <property name="can_focus">False</property>
                                 <property name="use_underline">True</property>
@@ -700,6 +704,7 @@
                                 <child>
                                   <object class="GtkToolButton" id="input_source_add">
                                     <property name="use_action_appearance">False</property>
+                                    <property name="label" translatable="yes">Add Input Source</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="use_underline">True</property>
@@ -713,6 +718,7 @@
                                 <child>
                                   <object class="GtkToolButton" id="input_source_remove">
                                     <property name="use_action_appearance">False</property>
+                                    <property name="label" translatable="yes">Remove Input Source</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="use_underline">True</property>
@@ -726,6 +732,7 @@
                                 <child>
                                   <object class="GtkToolButton" id="input_source_move_up">
                                     <property name="use_action_appearance">False</property>
+                                    <property name="label" translatable="yes">Move Selected Input Source Up</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="use_underline">True</property>
@@ -739,6 +746,7 @@
                                 <child>
                                   <object class="GtkToolButton" id="input_source_move_down">
                                     <property name="use_action_appearance">False</property>
+                                    <property name="label" translatable="yes">Move Selected Input Source Down</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="use_underline">True</property>
@@ -752,6 +760,7 @@
                                 <child>
                                   <object class="GtkToolButton" id="input_source_show">
                                     <property name="use_action_appearance">False</property>
+                                    <property name="label" translatable="yes">Show Keyboard Layout</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="use_underline">True</property>
@@ -815,7 +824,7 @@
                                         <property name="halign">end</property>
                                         <property name="hexpand">True</property>
                                         <property name="label" translatable="yes">Ctrl+Alt+Space</property>
-                                        <property name="selectable">True</property>
+                                        <style><class name="dim-label"/></style>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
@@ -845,7 +854,7 @@
                                         <property name="halign">end</property>
                                         <property name="hexpand">True</property>
                                         <property name="label" translatable="yes">Ctrl+Alt+Shift+Space</property>
-                                        <property name="selectable">True</property>
+                                        <style><class name="dim-label"/></style>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
@@ -854,6 +863,20 @@
                                         <property name="height">1</property>
                                       </packing>
                                     </child>
+                                    <child>
+                                      <object class="GtkLinkButton" id="jump-to-shortcuts">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">Shortcut Settings</property>
+                                        <property name="halign">end</property>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="top_attach">2</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
+                                      </packing>
+                                    </child>
                                   </object>
                                 </child>
                               </object>



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