[gnome-control-center] display: Hide unsupported sizes



commit 1b97a789e877a971f236c190ee9212d7b3e91557
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 1 02:28:52 2011 +0000

    display: Hide unsupported sizes
    
    Sizes smaller than 675x530 aren't supported in the design, so
    avoid them, unless they're bigger than the current output size
    (so you could go up from them).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=626822

 panels/display/xrandr-capplet.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/panels/display/xrandr-capplet.c b/panels/display/xrandr-capplet.c
index 0e7d680..7cac497 100644
--- a/panels/display/xrandr-capplet.c
+++ b/panels/display/xrandr-capplet.c
@@ -44,6 +44,11 @@
 #define CLOCK_SCHEMA "org.gnome.desktop.interface"
 #define CLOCK_FORMAT_KEY "clock-format"
 
+/* The minimum supported size for the panel, see:
+ * http://live.gnome.org/Design/SystemSettings */
+#define MINIMUM_WIDTH 675
+#define MINIMUM_HEIGHT 530
+
 typedef struct App App;
 typedef struct GrabInfo GrabInfo;
 
@@ -136,6 +141,20 @@ idle_free (gchar *s)
   return s;
 }
 
+static gboolean
+should_show_resolution (gint output_width,
+                        gint output_height,
+                        gint width,
+                        gint height)
+{
+  if (width >= MIN (output_width, MINIMUM_WIDTH) &&
+      height >= MIN (output_height, MINIMUM_HEIGHT))
+    {
+      return TRUE;
+    }
+  return FALSE;
+}
+
 static void
 on_screen_changed (GnomeRRScreen *scr,
                    gpointer data)
@@ -650,9 +669,12 @@ rebuild_resolution_combo (App *app)
       width = gnome_rr_mode_get_width (modes[i]);
       height = gnome_rr_mode_get_height (modes[i]);
 
-      add_key (app->resolution_combo,
-               idle_free (make_resolution_string (width, height)),
-               width, height, 0, -1);
+      if (should_show_resolution (output_width, output_height, width, height))
+        {
+          add_key (app->resolution_combo,
+                   idle_free (make_resolution_string (width, height)),
+                   width, height, 0, -1);
+        }
     }
 
   current = idle_free (make_resolution_string (output_width, output_height));



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