[banshee] Save and load the Gtk.AccelMap (BGO #579013)



commit 74cb923e45ffcc8a2ad0a6d8a44d4837ffe09914
Author: Olivier Dufour <olivier duff gmail com>
Date:   Wed Aug 12 15:43:38 2009 -0700

    Save and load the Gtk.AccelMap (BGO #579013)
    
    Signed-off-by: Gabriel Burt <gabriel burt gmail com>

 .../Banshee.Gui/BaseClientWindow.cs                |   22 +++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
index eb50427..2fb0e26 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
@@ -41,6 +41,7 @@ namespace Banshee.Gui
     public abstract class BaseClientWindow : Window
     {
         private PersistentWindowController window_controller;
+        private string accel_map_file = Paths.Combine (Paths.ApplicationData, "gtk_accel_map");
 
         private GtkElementsService elements_service;
         protected GtkElementsService ElementsService {
@@ -51,7 +52,7 @@ namespace Banshee.Gui
         protected InterfaceActionService ActionService {
             get { return action_service; }
         }
-        
+
         public event EventHandler TitleChanged;
 
         protected BaseClientWindow (IntPtr ptr) : base (ptr)
@@ -73,6 +74,25 @@ namespace Banshee.Gui
             AddAccelGroup (action_service.UIManager.AccelGroup);
             
             InitializeWindow ();
+
+            try {
+                if (System.IO.File.Exists (accel_map_file)) {
+                    Gtk.AccelMap.Load (accel_map_file);
+                }
+            } catch (Exception e) {
+                Hyena.Log.Exception ("Failed to load custom AccelMap", e);
+            }
+        }
+
+        public override void Dispose ()
+        {
+            base.Dispose ();
+
+            try {
+                Gtk.AccelMap.Save (accel_map_file);
+            } catch (Exception e) {
+                Hyena.Log.Exception ("Failed to save custom AccelMap", e);
+            }
         }
 
 		protected void InitialShowPresent ()



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