[glom/glom-1-14] SpinButtons: Don't have 0 to 0 ranges with only 0 increments possible.



commit 39fc4d794c0ae342954d7b70d5581443b19994e6
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Aug 10 16:34:44 2010 +0200

    SpinButtons: Don't have 0 to 0 ranges with only 0 increments possible.
    
    * glom/import_csv/dialog_import_csv.cc: (Import dialog)
    * glom/mode_design/layout/layout_item_dialogs/box_formatting.cc:
      (Multiline text field height)
    * glom/utility_widgets/dialog_flowtable.cc: (number of columns in a group):
      Constructors: Set the range and increment manually, because Glade defaults
      to useless 0 values for these.
      This problem was introduced when we remove the extra adjustment objects
      from the .glade files, so we could simplify our use of Glade.
      It is a side-effect of GtkBuilder bug
      http://bugzilla.gnome.org/show_bug.cgi?id=575714
      This partially fixes bug #625693 (.cvs file import not working).

 ChangeLog                                          |   16 +++++++++++++++
 glom/import_csv/dialog_import_csv.cc               |   21 ++++++++++++-------
 .../layout/layout_item_dialogs/box_formatting.cc   |    8 +++++++
 glom/utility_widgets/dialog_flowtable.cc           |    8 +++++++
 4 files changed, 45 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ac22f4f..f8aa1d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-10  Murray Cumming  <murrayc murrayc com>
+
+	SpinButtons: Don't have 0 to 0 ranges with only 0 increments possible.
+
+	* glom/import_csv/dialog_import_csv.cc: (Import dialog)
+	* glom/mode_design/layout/layout_item_dialogs/box_formatting.cc:
+  (Multiline text field height)
+	* glom/utility_widgets/dialog_flowtable.cc: (number of columns in a group):
+  Constructors: Set the range and increment manually, because Glade defaults
+  to useless 0 values for these.
+  This problem was introduced when we remove the extra adjustment objects
+  from the .glade files, so we could simplify our use of Glade.
+  It is a side-effect of GtkBuilder bug
+  http://bugzilla.gnome.org/show_bug.cgi?id=575714
+  This partially fixes bug #625693 (.cvs file import not working).
+
 2010-08-06  Murray Cumming  <murrayc murrayc com>
 
 	Document loading: Show an error dialog even for unexpected errors.
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index 6339784..4b45afe 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -76,11 +76,19 @@ Dialog_Import_CSV::Dialog_Import_CSV(BaseObjectType* cobject, const Glib::RefPtr
   builder->get_widget("import_csv_sample_rows", m_sample_rows);
   builder->get_widget("import_csv_advice_label", m_advice_label);
   builder->get_widget("import_csv_error_label", m_error_label);
-#ifdef GLIBMM_EXCEPTIONS_ENABLED  
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   if(!m_sample_view || !m_encoding_combo || !m_target_table || !m_encoding_info || !m_first_line_as_title || !m_sample_rows || !m_error_label)
     throw std::runtime_error("Missing widgets from glade file for Dialog_Import_CSV");
 #endif
 
+  //Set the adjustment details, to avoid a useless 0-to-0 range and a 0 incremenet.
+  //We don't do this the Glade file because GtkBuilder wouldn't find the
+  //associated adjustment object unless we specified it explictly:
+  //See http://bugzilla.gnome.org/show_bug.cgi?id=575714
+  m_sample_rows->set_range(0, 100);
+  m_sample_rows->set_increments(1, 10);
+  m_sample_rows->set_value(2); //A sensible default.
+
   //Fill the list of encodings:
   m_encoding_model = Gtk::ListStore::create(m_encoding_columns);
 
@@ -103,8 +111,6 @@ Dialog_Import_CSV::Dialog_Import_CSV(BaseObjectType* cobject, const Glib::RefPtr
     row[m_encoding_columns.m_col_charset] = encoding.get_charset();
   }
 
-  m_sample_rows->set_value(2); //A sensible default.
-
   Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
   m_encoding_combo->set_model(m_encoding_model);
   m_encoding_combo->pack_start(*renderer);
@@ -207,7 +213,7 @@ void Dialog_Import_CSV::import(const Glib::ustring& uri, const Glib::ustring& in
       }
     }
 
-    // Create the sorted version of this model, 
+    // Create the sorted version of this model,
     // so the user sees the fields in alphabetical order:
     m_field_model_sorted = Gtk::TreeModelSort::create(m_field_model);
     m_field_model_sorted->set_sort_column(m_field_columns.m_col_field_name, Gtk::SORT_ASCENDING);
@@ -633,13 +639,13 @@ void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::
       }
     }
   }
-  
+
   renderer_combo->set_property("text", text);
   renderer_combo->set_property("editable", editable);
 }
 
 
-/**  Parse a row from a .cvs file. Note that this "line" might have newline 
+/**  Parse a row from a .cvs file. Note that this "line" might have newline
   *  characters inside one field value, inside quotes.
   **/
 void Dialog_Import_CSV::on_field_edited(const Glib::ustring& path, const Glib::ustring& new_text, guint column_number)
@@ -746,7 +752,7 @@ void Dialog_Import_CSV::on_parser_file_read_error(const Glib::ustring& error_mes
   std::auto_ptr<Glib::Error> error;
   filename = Glib::filename_from_uri(m_file_uri, error);
 #endif
-  
+
   show_error_dialog(_("Could Not Open file"),
     Glib::ustring::compose(_("The file at \"%1\" could not be opened: %2"), filename, error_message) );
 }
@@ -768,4 +774,3 @@ Dialog_Import_CSV::type_signal_state_changed Dialog_Import_CSV::signal_state_cha
 }
 
 } //namespace Glom
-
diff --git a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
index 9bb0651..6790e4b 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
@@ -85,6 +85,14 @@ Box_Formatting::Box_Formatting(BaseObjectType* cobject, const Glib::RefPtr<Gtk::
   builder->get_widget("colorbutton_background", m_colorbutton_background);
   builder->get_widget("checkbutton_color_background", m_checkbox_format_text_color_background);
 
+  //Set the adjustment details, to avoid a useless 0-to-0 range and a 0 incremenet.
+  //We don't do this the Glade file because GtkBuilder wouldn't find the
+  //associated adjustment object unless we specified it explictly:
+  //See http://bugzilla.gnome.org/show_bug.cgi?id=575714
+  m_spinbutton_format_text_multiline_height->set_range(0, 100);
+  m_spinbutton_format_text_multiline_height->set_increments(1, 10);
+  m_spinbutton_format_text_multiline_height->set_value(3); //A sensible default.
+
   //Fill the alignment combo:
   m_model_alignment = Gtk::ListStore::create(m_columns_alignment);
 
diff --git a/glom/utility_widgets/dialog_flowtable.cc b/glom/utility_widgets/dialog_flowtable.cc
index f7bfbd5..3351749 100644
--- a/glom/utility_widgets/dialog_flowtable.cc
+++ b/glom/utility_widgets/dialog_flowtable.cc
@@ -37,6 +37,14 @@ Dialog_FlowTable::Dialog_FlowTable(BaseObjectType* cobject, const Glib::RefPtr<G
   builder->get_widget("entry_title",  m_entry_title);
   builder->get_widget("spin_columns",  m_spin_columns);
   
+  //Set the adjustment details, to avoid a useless 0-to-0 range and a 0 incremenet.
+  //We don't do this the Glade file because GtkBuilder wouldn't find the
+  //associated adjustment object unless we specified it explictly:
+  //See http://bugzilla.gnome.org/show_bug.cgi?id=575714
+  m_spin_columns->set_range(0, 10);
+  m_spin_columns->set_increments(1, 2);
+  m_spin_columns->set_value(3); //A sensible default.
+
   show_all_children();
 }
 



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