[gnome-mines] Only show scrollbars if required. https://bugzilla.gnome.org/show_bug.cgi?id=730031
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mines] Only show scrollbars if required. https://bugzilla.gnome.org/show_bug.cgi?id=730031
- Date: Tue, 13 May 2014 00:29:49 +0000 (UTC)
commit 95f24aa019aecbc39c65b264c75acd6c85f60fb0
Author: Robert Roth <robert roth off gmail com>
Date: Tue May 13 03:28:01 2014 +0300
Only show scrollbars if required.
https://bugzilla.gnome.org/show_bug.cgi?id=730031
Only show the scrollbars if the screen size is smaller than the size
required to display the full mine grid with the minimum minefield size.
src/gnome-mines.vala | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 60dfc9e..2eda53f 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -35,6 +35,7 @@ public class Mines : Gtk.Application
private Gtk.AspectFrame minefield_aspect;
private Gtk.Overlay minefield_overlay;
private Gtk.Box paused_box;
+ private Gtk.ScrolledWindow scrolled;
private Gtk.Label clock_label;
@@ -176,7 +177,7 @@ public class Mines : Gtk.Application
minefield_view = new MinefieldView (settings);
minefield_view.show ();
- var scrolled = new Gtk.ScrolledWindow (null, null);
+ scrolled = new Gtk.ScrolledWindow (null, null);
scrolled.show ();
scrolled.add (minefield_view);
@@ -497,9 +498,20 @@ public class Mines : Gtk.Application
minefield.paused_changed.connect (paused_changed_cb);
minefield.clock_started.connect (clock_started_cb);
- minefield_aspect.ratio = (float)x / y;
+ minefield_aspect.ratio = (float)x / y;
minefield_view.minefield = minefield;
-
+ int request_x = -1, request_y = -1;
+ if (window.get_allocated_width () - scrolled.get_allocated_width () + 30 * x < Gdk.Screen.width ())
{
+ request_x = 30 * x;
+ } else {
+ request_x = Gdk.Screen.width () - window.get_allocated_width () + scrolled.get_allocated_width
();
+ }
+ if (window.get_allocated_height () - scrolled.get_allocated_height () + 30 * y < Gdk.Screen.height
()) {
+ request_y = 30 * y;
+ } else {
+ request_y = Gdk.Screen.height () - window.get_allocated_height () +
scrolled.get_allocated_height ();
+ }
+ minefield_aspect.set_size_request (request_x, request_y);
update_flag_label ();
new_game_action.set_enabled (true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]