[glade] Limit the size of the spin button in GladeEPropNumeric when the max value is over 16 digits. Otherwi



commit 13574908826fc511f08d032615a715338d83706e
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Fri Jan 18 19:40:07 2013 -0300

    Limit the size of the spin button in GladeEPropNumeric when the max value is over 16 digits.
    Otherwise a property with a max value of G_MAXDOUBLE gets a minimum size over 2800 pixels.

 gladeui/glade-editor-property.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 7c41907..642d39b 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -768,6 +768,10 @@ glade_eprop_numeric_create_input (GladeEditorProperty *eprop)
 			 G_IS_PARAM_SPEC_DOUBLE (pspec) ? 2 : 0);
   gtk_widget_show (eprop_numeric->spin);
 
+  /* Limit the size of the spin if max allowed value is too big */
+  if (gtk_adjustment_get_upper (adjustment) > 9999999999999999.0)
+    gtk_entry_set_width_chars (GTK_ENTRY (eprop_numeric->spin), 16);
+
   g_signal_connect (G_OBJECT (eprop_numeric->spin), "value_changed",
                     G_CALLBACK (glade_eprop_numeric_changed), eprop);
 



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