[gnome-mines] Added animations enable/disable checkbox.



commit ad2422880257fd03f8e4e3ab802cd0c1f243efe9
Author: Robert Roth <robert roth off gmail com>
Date:   Sat Jun 20 04:28:27 2015 +0300

    Added animations enable/disable checkbox.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750415

 data/org.gnome.mines.gschema.xml |    5 +++++
 src/gnome-mines.vala             |    4 ++++
 src/theme-selector-dialog.vala   |   14 ++++++++++++--
 3 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.mines.gschema.xml b/data/org.gnome.mines.gschema.xml
index e57ae12..9c9c999 100644
--- a/data/org.gnome.mines.gschema.xml
+++ b/data/org.gnome.mines.gschema.xml
@@ -20,6 +20,11 @@
       <summary>Enable automatic placing of flags</summary>
       <description>Set to true to automatically flag squares as mined when enough squares are 
revealed</description>
     </key>
+    <key name="use-animations" type="b">
+      <default>true</default>
+      <summary>Enable animations</summary>
+      <description>Set to false to disable theme-defined transition animations</description>
+    </key>
     <key name="xsize" type="i">
       <default>16</default>
       <range min="4" max="100" />
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index d07aa2a..c6d5c35 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -29,6 +29,7 @@ public class Mines : Gtk.Application
     public static const string KEY_USE_OVERMINE_WARNING = "use-overmine-warning";
     public static const string KEY_USE_AUTOFLAG = "use-autoflag";
     public static const string KEY_THEME = "theme";
+    public static const string KEY_USE_ANIMATIONS = "use-animations";
 
     private Gtk.Widget main_screen;
     private Gtk.Button play_pause_button;
@@ -208,6 +209,8 @@ public class Mines : Gtk.Application
         window.focus_out_event.connect (window_focus_out_event_cb);
         window.focus_in_event.connect (window_focus_in_event_cb);
         window.set_default_size (settings.get_int ("window-width"), settings.get_int ("window-height"));
+        Gtk.Settings.get_default ().gtk_enable_animations = settings.get_boolean ("use-animations");
+
         if (settings.get_boolean ("window-is-maximized"))
             window.maximize ();
         add_window (window);
@@ -443,6 +446,7 @@ public class Mines : Gtk.Application
         /* Save window state */
         settings.set_int ("window-width", window_width);
         settings.set_int ("window-height", window_height);
+        settings.set_boolean (KEY_USE_ANIMATIONS, Gtk.Settings.get_default ().gtk_enable_animations);
         settings.set_boolean ("window-is-maximized", is_maximized);
         settings.apply ();
     }
diff --git a/src/theme-selector-dialog.vala b/src/theme-selector-dialog.vala
index 9db5156..31f710a 100644
--- a/src/theme-selector-dialog.vala
+++ b/src/theme-selector-dialog.vala
@@ -67,11 +67,21 @@ public class ThemeSelectorDialog : Gtk.Dialog
         view = new MinefieldView (settings);
         view.minefield = new PreviewField ();
 
+        var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
         var frame = new Gtk.AspectFrame (null, 0.5f, 0.5f, 1.0f, false);
         frame.border_width = 6;
         frame.add (view);
         reveal_nonmines (view);
-        return frame;
+        box.pack_start (frame, true, true, 0);
+
+        var animations_check = new Gtk.CheckButton.with_mnemonic (_("Use _animations"));
+        animations_check.set_property("halign", Gtk.Align.CENTER);
+        box.pack_start (animations_check, false, false, 0);
+
+        Gtk.Settings.get_default().bind_property ("gtk-enable-animations",
+          animations_check, "active",BindingFlags.BIDIRECTIONAL|BindingFlags.SYNC_CREATE);
+
+        return box;
     }
 
     public ThemeSelectorDialog (Gtk.Window parent)
@@ -81,7 +91,7 @@ public class ThemeSelectorDialog : Gtk.Dialog
         MinefieldView minefield;
 
         Object (use_header_bar: use_headerbar ? 1 : 0, title:  _("Select Theme"),
-                modal: true, transient_for: parent, resizable: false);
+                modal: true, transient_for: parent, resizable: false, border_width: 12);
 
         previous = new Gtk.Button.from_icon_name ("go-previous-symbolic", Gtk.IconSize.BUTTON);
         previous.valign = Gtk.Align.CENTER;


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