[glom/maemo5] Maemo: Fix my previous commit.



commit 227431120141183ebd86077b430c636c1458dffc
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Oct 16 15:46:00 2009 +0200

    Maemo: Fix my previous commit.
    
    * glom/utility_widgets/datawidget.cc: set_child_size_by_field(): Move the
    ifdefs around so normal fields get sensible sizes again on Maemo.

 ChangeLog                                          |    7 +++++++
 .../test_sqlite_music/glom_musiccollection21.db    |  Bin 15360 -> 15360 bytes
 glom/utility_widgets/datawidget.cc                 |   13 ++++++++++---
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3c1a0cc..47515d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-10-16  Murray Cumming  <murrayc murrayc com>
 
+  Maemo: Fix my previous commit.
+  
+	* glom/utility_widgets/datawidget.cc: set_child_size_by_field(): Move the 
+	ifdefs around so normal fields get sensible sizes again on Maemo.
+
+2009-10-16  Murray Cumming  <murrayc murrayc com>
+
 	Maemo: Make TextViews small to begin with.
 	
 	* glom/utility_widgets/datawidget.cc: set_child_size_by_field(): On Maemo, 
diff --git a/examples/sqlite/test_sqlite_music/glom_musiccollection21.db b/examples/sqlite/test_sqlite_music/glom_musiccollection21.db
index fadc279..f161c4c 100644
Binary files a/examples/sqlite/test_sqlite_music/glom_musiccollection21.db and b/examples/sqlite/test_sqlite_music/glom_musiccollection21.db differ
diff --git a/glom/utility_widgets/datawidget.cc b/glom/utility_widgets/datawidget.cc
index a8f026a..f7706d9 100644
--- a/glom/utility_widgets/datawidget.cc
+++ b/glom/utility_widgets/datawidget.cc
@@ -376,26 +376,33 @@ const Gtk::Label* DataWidget::get_label() const
 void DataWidget::set_child_size_by_field(const sharedptr<const LayoutItem_Field>& field)
 {
   const Field::glom_field_type glom_type = field->get_glom_type();
-  const int width = get_suitable_width(field);
+  int width = get_suitable_width(field);
 
   if(glom_type == Field::TYPE_IMAGE) //GtkImage widgets default to no size (invisible) if they are empty.
     m_child->set_size_request(width, width);
   else
   {
-    #ifndef GLOM_ENABLE_MAEMO //On Maemo, TextView widgets expand automatically.
     int height = -1; //auto.
     if((glom_type == Field::TYPE_TEXT) && (field->get_formatting_used().get_text_format_multiline()))
     {
+      #ifndef GLOM_ENABLE_MAEMO 
       int example_width = 0;
       int example_height = 0;
       Glib::RefPtr<Pango::Layout> refLayout = create_pango_layout("example"); //TODO: Use different text, according to the current locale, or allow the user to choose an example?
       refLayout->get_pixel_size(example_width, example_height);
+      
       if(example_height > 0)
         height = example_height * field->get_formatting_used().get_text_format_multiline_height_lines();
+      #else
+      //On Maemo, TextView widgets expand automatically.
+      //TODO: Expansion only happens if both are -1, and vertical expansion never happens.
+      //See bug https://bugs.maemo.org/show_bug.cgi?id=5515
+      width = -1;
+      height = -1; 
+      #endif //GLOM_ENABLE_MAEMO
     }
 
     m_child->set_size_request(width, height);
-    #endif //GLOM_ENABLE_MAEMO
   }
 }
 



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