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



commit a3914f73722b3e8330141bd329b4f292e19b28dc
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               |   28 +++++++++++++++-----
 .../layout/layout_item_dialogs/box_formatting.cc   |    8 +++++
 glom/utility_widgets/dialog_flowtable.cc           |    8 +++++
 4 files changed, 53 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7969ff8..cdb6a3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 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-10  Murray Cumming  <murrayc murrayc com>
+
 	Catch exceptions from std::locale::global().
 
 	* glom/main.cc: Put a try/catch around the call to std::locale::global(),
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index b7ab7d3..2ec84be 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -76,9 +76,18 @@ 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);
+
   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");
 
+  //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);
 
@@ -101,8 +110,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);
@@ -205,7 +212,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);
@@ -621,13 +628,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)
@@ -729,7 +736,15 @@ void Dialog_Import_CSV::on_parser_file_read_error(const Glib::ustring& error_mes
   {
     std::cerr << "Glib::filename_from_uri() failed: " << ex.what() << std::endl;
   }
-  
+<<<<<<< HEAD:glom/import_csv/dialog_import_csv.cc
+
+=======
+#else
+  std::auto_ptr<Glib::Error> error;
+  filename = Glib::filename_from_uri(m_file_uri, error);
+#endif
+
+>>>>>>> 39fc4d7... SpinButtons: Don't have 0 to 0 ranges with only 0 increments possible.:glom/import_csv/dialog_import_csv.cc
   show_error_dialog(_("Could Not Open file"),
     Glib::ustring::compose(_("The file at \"%1\" could not be opened: %2"), filename, error_message) );
 }
@@ -751,4 +766,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 4133781..94126ef 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
@@ -89,6 +89,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]