[Xfce4-commits] <ristretto:master> Set the default accels from settings object

Stephan Arts noreply at xfce.org
Mon Apr 16 18:54:04 CEST 2012


Updating branch refs/heads/master
         to 4da8de9f32f26222e395702cc697cc094523810c (commit)
       from c3705395b8484552f2e39fd721836f5052862862 (commit)

commit 4da8de9f32f26222e395702cc697cc094523810c
Author: Stephan Arts <stephan at xfce.org>
Date:   Mon Apr 16 18:00:53 2012 +0200

    Set the default accels from settings object
    
     - Set the default accelerators from the Settings object if
       the accels file is not yet created.
     - Allow the 'Play' accelerator to be cleared when editable
       accelerators are enabled.

 src/main_window.c |   11 -----------
 src/settings.c    |   16 ++++++++++++++++
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/main_window.c b/src/main_window.c
index fe90cff..8d221f4 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -576,17 +576,6 @@ rstto_main_window_init (RsttoMainWindow *window)
     gtk_accel_group_connect_by_path (accel_group, "<Window>/delete", delete_closure);
 
     /* Set default accelerators */
-    gtk_accel_map_change_entry ("<Window>/fullscreen", GDK_F, 0, FALSE);
-    gtk_accel_map_change_entry ("<Window>/unfullscreen", GDK_Escape, 0, FALSE);
-    gtk_accel_map_change_entry ("<Window>/next-image", GDK_Page_Down, 0, FALSE);
-    gtk_accel_map_change_entry ("<Window>/previous-image", GDK_Page_Up, 0, FALSE);
-    gtk_accel_map_change_entry ("<Window>/quit", GDK_q, 0, FALSE);
-
-    gtk_accel_map_change_entry ("<Window>/delete", GDK_Delete, GDK_SHIFT_MASK, FALSE);
-    if (gtk_accel_map_lookup_entry ("<Actions>/RsttoWindow/play", NULL) == FALSE)
-    {
-        gtk_accel_map_change_entry ("<Actions>/RsttoWindow/play", GDK_F5, 0, FALSE);
-    }
 
     /* Create mergeid's for adding ui-components */
     window->priv->recent_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
diff --git a/src/settings.c b/src/settings.c
index 4b3fcae..9beea1f 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -20,6 +20,7 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 #include <xfconf/xfconf.h>
 #include <libxfce4util/libxfce4util.h>
 
@@ -152,6 +153,21 @@ rstto_settings_init (GObject *object)
         g_free (accelmap_path);
         accelmap_path = NULL;
     }
+    else
+    {
+        /* If the accels.scm file is missing, we are probably
+         * dealing with a first-boot. Add default accelerators.
+         */
+        gtk_accel_map_change_entry ("<Window>/fullscreen", GDK_F, 0, FALSE);
+        gtk_accel_map_change_entry ("<Window>/unfullscreen", GDK_Escape, 0, FALSE);
+        gtk_accel_map_change_entry ("<Window>/next-image", GDK_Page_Down, 0, FALSE);
+        gtk_accel_map_change_entry ("<Window>/previous-image", GDK_Page_Up, 0, FALSE);
+        gtk_accel_map_change_entry ("<Window>/quit", GDK_q, 0, FALSE);
+
+        gtk_accel_map_change_entry ("<Window>/delete", GDK_Delete, GDK_SHIFT_MASK, FALSE);
+
+        gtk_accel_map_change_entry ("<Actions>/RsttoWindow/play", GDK_F5, 0, FALSE);
+    }
     
     settings->priv->slideshow_timeout = 5;
     settings->priv->bgcolor = g_new0 (GdkColor, 1);


More information about the Xfce4-commits mailing list