[yelp/new-aday-design] Added keybinding to show text cursor



commit 1927dbb6663fd43b03efd64171b41563cc361886
Author: Shaun McCance <shaunm gnome org>
Date:   Sun Feb 23 14:28:44 2014 -0500

    Added keybinding to show text cursor

 configure.ac           |    4 ++--
 src/yelp-application.c |   26 ++++++++++++++++++++------
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ac12a13..787f47b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,10 +27,10 @@ GLIB_GSETTINGS
 # Library dependecies
 PKG_CHECK_MODULES(YELP,
 [
-       gio-2.0 >= 2.32.0
+       gio-2.0 >= 2.38.0
        gio-unix-2.0
        gtk+-unix-print-3.0
-       gtk+-3.0 >= 3.8.0
+       gtk+-3.0 >= 3.11.8
        libxml-2.0 >= 2.6.5
        libxslt >= 1.1.4
        libexslt >= 0.8.1
diff --git a/src/yelp-application.c b/src/yelp-application.c
index c9d6667..38e4af7 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -116,6 +116,8 @@ struct _YelpApplicationPrivate {
 
     GtkActionGroup *action_group;
 
+    GPropertyAction  *show_cursor_action;
+
     GSettingsBackend *backend;
     GSettings *gsettings;
     GHashTable *docsettings;
@@ -142,6 +144,8 @@ yelp_application_init (YelpApplication *app)
                                                (GDestroyNotify) g_free,
                                                (GDestroyNotify) g_object_unref);
 
+    gtk_application_add_accelerator (GTK_APPLICATION (app), "F7", "app.yelp-application-show-cursor", NULL);
+
     gtk_application_add_accelerator (GTK_APPLICATION (app), "<Control>f", "win.yelp-window-find", NULL);
     gtk_application_add_accelerator (GTK_APPLICATION (app), "<Control>s", "win.yelp-window-search", NULL);
     gtk_application_add_accelerator (GTK_APPLICATION (app), "<Control>n", "win.yelp-window-new", NULL);
@@ -196,6 +200,11 @@ yelp_application_dispose (GObject *object)
         priv->action_group = NULL;
     }
 
+    if (priv->show_cursor_action) {
+        g_object_unref (priv->show_cursor_action);
+        priv->show_cursor_action = NULL;
+    }
+
     if (priv->gsettings) {
         g_object_unref (priv->gsettings);
         priv->gsettings = NULL;
@@ -262,8 +271,7 @@ yelp_application_startup (GApplication *application)
     g_set_application_name (N_("Help"));
 
     /* chain up */
-    G_APPLICATION_CLASS (yelp_application_parent_class)
-      ->startup (application);
+    G_APPLICATION_CLASS (yelp_application_parent_class)->startup (application);
 
     settings = yelp_settings_get_default ();
     if (editor_mode)
@@ -274,20 +282,26 @@ yelp_application_startup (GApplication *application)
                                                        NULL);
     /* Use a config file for per-document settings, because
        Ryan asked me to. */
-    keyfile = g_build_filename (g_get_user_config_dir (),
-                                "yelp", "yelp.cfg", NULL);
+    keyfile = g_build_filename (g_get_user_config_dir (), "yelp", "yelp.cfg", NULL);
     priv->backend = g_keyfile_settings_backend_new (keyfile, "/org/gnome/yelp/", "yelp");
     g_free (keyfile);
+
     /* But the main settings are in dconf */
     priv->gsettings = g_settings_new ("org.gnome.yelp");
 
     g_settings_bind (priv->gsettings, "show-cursor",
                      settings, "show-text-cursor",
                      G_SETTINGS_BIND_DEFAULT);
+    priv->show_cursor_action = g_property_action_new ("yelp-application-show-cursor",
+                                                      settings, "show-text-cursor");
+    g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (priv->show_cursor_action));
+
+
     g_settings_bind (priv->gsettings, "font-adjustment",
                      settings, "font-adjustment",
                      G_SETTINGS_BIND_DEFAULT);
 
+
     priv->action_group = gtk_action_group_new ("ApplicationActions");
     gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
     gtk_action_group_add_actions (priv->action_group,
@@ -296,11 +310,11 @@ yelp_application_startup (GApplication *application)
     action = (GtkAction *) gtk_toggle_action_new ("ShowTextCursor",
                                                   _("Show Text _Cursor"),
                                                   NULL, NULL);
-    gtk_action_group_add_action_with_accel (priv->action_group,
-                                            action, "F7");
     g_settings_bind (priv->gsettings, "show-cursor",
                      action, "active",
                      G_SETTINGS_BIND_DEFAULT);
+    gtk_action_group_add_action_with_accel (priv->action_group,
+                                            action, "F7");
     g_object_unref (action);
     application_set_font_sensitivity (app);
 }


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