[gnome-control-center] keyboard: Add link to the Region panel



commit 0f4b481c912add0429808b7c68688aa2b120d4e6
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Aug 26 18:29:24 2011 +0100

    keyboard: Add link to the Region panel
    
    So that the layouts are easier to find.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643101

 panels/keyboard/gnome-keyboard-panel.ui |   44 +++++++++++++++++++++++++++++++
 panels/keyboard/keyboard-general.c      |   21 ++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)
---
diff --git a/panels/keyboard/gnome-keyboard-panel.ui b/panels/keyboard/gnome-keyboard-panel.ui
index f68e444..8929452 100644
--- a/panels/keyboard/gnome-keyboard-panel.ui
+++ b/panels/keyboard/gnome-keyboard-panel.ui
@@ -54,6 +54,12 @@
               </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="vbox4">
@@ -203,6 +209,12 @@
               </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="GtkNotebook" id="keyboard_notebook">
@@ -614,6 +626,38 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkBox" id="box1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkLinkButton" id="linkbutton">
+                        <property name="label" translatable="yes">Layout 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>
+                        <property name="use_action_appearance">False</property>
+                        <property name="relief">none</property>
+                        <property name="uri">region panel</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
               </object>
             </child>
             <child type="tab">
diff --git a/panels/keyboard/keyboard-general.c b/panels/keyboard/keyboard-general.c
index b1d45d1..d8a9415 100644
--- a/panels/keyboard/keyboard-general.c
+++ b/panels/keyboard/keyboard-general.c
@@ -21,6 +21,8 @@
 
 #include "keyboard-general.h"
 
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (builder, s))
+
 static GSettings *keyboard_settings = NULL;
 static GSettings *interface_settings = NULL;
 
@@ -53,6 +55,22 @@ set_rate (const GValue       *value,
   return g_variant_new_uint32 (msecs);
 }
 
+static gboolean
+layout_link_clicked (GtkLinkButton *button,
+                     CcPanel       *panel)
+{
+  CcShell *shell;
+  GError *error = NULL;
+
+  shell = cc_panel_get_shell (panel);
+  if (cc_shell_set_active_panel_from_id (shell, "region", &error) == FALSE)
+    {
+      g_warning ("Failed to activate Region panel: %s", error->message);
+      g_error_free (error);
+    }
+  return TRUE;
+}
+
 void
 keyboard_general_init (CcPanel *panel, GtkBuilder *builder)
 {
@@ -87,6 +105,9 @@ keyboard_general_init (CcPanel *panel, GtkBuilder *builder)
   g_settings_bind (interface_settings, "cursor-blink-time",
                    gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (builder, "cursor_blink_time_scale"))), "value",
                    G_SETTINGS_BIND_DEFAULT);
+
+  g_signal_connect (WID ("linkbutton"), "activate-link",
+                    G_CALLBACK (layout_link_clicked), panel);
 }
 
 void



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