glom r1996 - in trunk: . glom glom/libglom/data_structure glom/libglom/document glom/mode_design glom/mode_design/fields glom/mode_design/script_library glom/mode_design/users glom/utility_widgets



Author: murrayc
Date: Tue Mar 17 10:14:33 2009
New Revision: 1996
URL: http://svn.gnome.org/viewvc/glom?rev=1996&view=rev

Log:
2009-03-17  Murray Cumming  <murrayc murrayc com>

* glom/utility_widgets/combo_textglade.[h|cc]: Remove the reimplementation 
of Gtk::ComboBoxText now that we can use gtkmm 2.14.
* glom/frame_glom.cc:
* glom/libglom/data_structure/glomconversions.cc:
* glom/mode_design/dialog_add_related_table.cc:
* glom/mode_design/fields/dialog_fielddefinition.cc:
* glom/mode_design/script_library/dialog_script_library.cc:
* glom/mode_design/users/dialog_users_list.cc: Adapted.
* glom/libglom/document/document_glom.cc: save_before: Remove another 
gtkmm 2.10 workaround.

Modified:
   trunk/ChangeLog
   trunk/glom/frame_glom.cc
   trunk/glom/libglom/data_structure/glomconversions.cc
   trunk/glom/libglom/document/document_glom.cc
   trunk/glom/mode_design/dialog_add_related_table.cc
   trunk/glom/mode_design/fields/dialog_fielddefinition.cc
   trunk/glom/mode_design/script_library/dialog_script_library.cc
   trunk/glom/mode_design/users/dialog_users_list.cc
   trunk/glom/utility_widgets/combo_textglade.cc
   trunk/glom/utility_widgets/combo_textglade.h

Modified: trunk/glom/frame_glom.cc
==============================================================================
--- trunk/glom/frame_glom.cc	(original)
+++ trunk/glom/frame_glom.cc	Tue Mar 17 10:14:33 2009
@@ -2067,9 +2067,6 @@
   }
   catch(const Glib::Exception& ex) // libgda does not set error domain
   {
-    //I think a failure here might be caused by installing unstable libgda, which seems to affect stable libgda-1.2.
-    //Doing a "make install" in libgda-1.2 seems to fix this:
-    //TODO: Is this still relevant in libgda-3.0?
     std::cerr << "Frame_Glom::create_database():  Gnome::Gda::Connection::create_database(" << database_name << ") failed: " << ex.what() << std::endl;
 
     //Tell the user:

Modified: trunk/glom/libglom/data_structure/glomconversions.cc
==============================================================================
--- trunk/glom/libglom/data_structure/glomconversions.cc	(original)
+++ trunk/glom/libglom/data_structure/glomconversions.cc	Tue Mar 17 10:14:33 2009
@@ -1018,20 +1018,6 @@
       //}
 
       Glib::RefPtr<Gdk::PixbufLoader> refPixbufLoader;
-
-      // PixbufLoader::create() is broken in gtkmm before 2.6.something,
-      // so let's do this in C so it works with all 2.6 versions:
-      GError* error = 0;
-      GdkPixbufLoader* loader = gdk_pixbuf_loader_new_with_type(GLOM_IMAGE_FORMAT, &error);
-      if(!error)
-        refPixbufLoader = Glib::wrap(loader);
-      else
-      {
-        std::cerr << "ImageGlom::set_value(): Error while calling gdk_pixbuf_loader_new_with_type(): " << error->message << std::endl;
-        g_error_free(error);
-      }
-
-      /*
       try
       {
         refPixbufLoader = Gdk::PixbufLoader::create(GLOM_IMAGE_FORMAT);
@@ -1040,9 +1026,8 @@
       catch(const Gdk::PixbufError& ex)
       {
         refPixbufLoader.clear();
-        g_warning("PixbufLoader::create failed: %s",ex.what().c_str());
+        std::cerr << "PixbufLoader::create failed: " << ex.what() << std::endl;
       }
-      */
 
       if(refPixbufLoader)
       {

Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc	(original)
+++ trunk/glom/libglom/document/document_glom.cc	Tue Mar 17 10:14:33 2009
@@ -3431,8 +3431,7 @@
           if(page_setup)
           {
             Glib::KeyFile key_file;
-            Glib::RefPtr<Gtk::PageSetup> unconst = Glib::RefPtr<Gtk::PageSetup>::cast_const(page_setup); //TODO: Remove this when using gtkmm 2.13/14.
-            unconst->save_to_key_file(key_file);
+            page_setup->save_to_key_file(key_file);
             
             xmlpp::Element* child = nodePrintLayout->add_child(GLOM_NODE_PAGE_SETUP);
             child->add_child_text(key_file.to_data());

Modified: trunk/glom/mode_design/dialog_add_related_table.cc
==============================================================================
--- trunk/glom/mode_design/dialog_add_related_table.cc	(original)
+++ trunk/glom/mode_design/dialog_add_related_table.cc	Tue Mar 17 10:14:33 2009
@@ -68,7 +68,7 @@
   type_vecFields fields = get_fields_for_table_from_database(table_name);
 
   //Show the fields:
-  m_combo_from_field->clear_text();
+  m_combo_from_field->clear_items();
   for(type_vecFields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
   {
      sharedptr<Field> item = *iter;

Modified: trunk/glom/mode_design/fields/dialog_fielddefinition.cc
==============================================================================
--- trunk/glom/mode_design/fields/dialog_fielddefinition.cc	(original)
+++ trunk/glom/mode_design/fields/dialog_fielddefinition.cc	Tue Mar 17 10:14:33 2009
@@ -344,7 +344,7 @@
 {
   //Get the fields that are avaiable from the new relationship:
 
-  m_pCombo_LookupField->clear_text();
+  m_pCombo_LookupField->clear_items();
 
   //Get the relationship name:
   sharedptr<const Relationship> relationship = m_pCombo_LookupRelationship->get_selected_relationship();

Modified: trunk/glom/mode_design/script_library/dialog_script_library.cc
==============================================================================
--- trunk/glom/mode_design/script_library/dialog_script_library.cc	(original)
+++ trunk/glom/mode_design/script_library/dialog_script_library.cc	Tue Mar 17 10:14:33 2009
@@ -205,7 +205,7 @@
     return;
 
   const std::vector<Glib::ustring> module_names = document->get_library_module_names();
-  m_combobox_name->clear_text();
+  m_combobox_name->clear_items();
  
   for(std::vector<Glib::ustring>::const_iterator iter = module_names.begin(); iter != module_names.end(); ++iter)
   {

Modified: trunk/glom/mode_design/users/dialog_users_list.cc
==============================================================================
--- trunk/glom/mode_design/users/dialog_users_list.cc	(original)
+++ trunk/glom/mode_design/users/dialog_users_list.cc	Tue Mar 17 10:14:33 2009
@@ -325,7 +325,7 @@
       dialog->m_entry_user->set_sensitive(false); //They can edit the password, but not the name. TODO: Allow editing of name?
 
       //Fill groups:
-      dialog->m_combo_group->clear_text();
+      dialog->m_combo_group->clear_items();
 
       type_vecStrings group_list = Privs::get_database_groups();
       for(type_vecStrings::const_iterator iter = group_list.begin(); iter != group_list.end(); ++iter)
@@ -418,7 +418,7 @@
 void Dialog_UsersList::set_group(const Glib::ustring& group_name)
 {
   //Fill the list of groups:
-  m_combo_group->clear_text();
+  m_combo_group->clear_items();
 
   type_vecStrings group_list = Privs::get_database_groups();
   for(type_vecStrings::const_iterator iter = group_list.begin(); iter != group_list.end(); ++iter)

Modified: trunk/glom/utility_widgets/combo_textglade.cc
==============================================================================
--- trunk/glom/utility_widgets/combo_textglade.cc	(original)
+++ trunk/glom/utility_widgets/combo_textglade.cc	Tue Mar 17 10:14:33 2009
@@ -25,105 +25,18 @@
 {
 
 Combo_TextGlade::Combo_TextGlade(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& /* refGlade */)
-: Gtk::ComboBox(cobject)
+: Gtk::ComboBoxText(cobject)
 {
-  m_model = Gtk::ListStore::create(m_text_columns);
-  set_model(m_model);
-  pack_start(m_text_columns.m_column);
-
-  set_row_separator_func( sigc::mem_fun(*this, &Combo_TextGlade::on_row_separator) );
-}
-
-
-Combo_TextGlade::~Combo_TextGlade()
-{
-
-}
-
-void Combo_TextGlade::append_separator()
-{
-  if(m_model)
-  {
-    Gtk::TreeModel::iterator iter = m_model->append();
-    Gtk::TreeModel::Row row = *iter;
-    row[m_text_columns.m_separator] = true;
-  }
-}
-
-void Combo_TextGlade::append_text(const Glib::ustring& text)
-{
-  if(m_model)
-  {
-    Gtk::TreeModel::iterator iter = m_model->append();
-    Gtk::TreeModel::Row row = *iter;
-    row[m_text_columns.m_column] = text;
-    row[m_text_columns.m_separator] = false;
-  }
-}
-
-void Combo_TextGlade::prepend_text(const Glib::ustring& text)
-{
-  if(m_model)
-  {
-    Gtk::TreeModel::iterator iter = m_model->prepend();
-    Gtk::TreeModel::Row row = *iter;
-    row[m_text_columns.m_column] = text;
-    row[m_text_columns.m_separator] = false;
-  }
-}
-
-Glib::ustring Combo_TextGlade::get_active_text() const
-{
-  //We cannot use gtk_combobox_get_active_text() here, because that can only be used if gtk_combo_box_new_text() has been used.
-
-  Glib::ustring result;
-
-  //Get the active row:
-  Gtk::TreeModel::iterator active_row = get_active();
-  if(active_row)
-  {
-    Gtk::TreeModel::Row row = *active_row;
-    result = row[m_text_columns.m_column];
-  }
-
-  return result;
-}
-
-void Combo_TextGlade::clear_text()
-{
-  m_model->clear();
 }
 
-void Combo_TextGlade::set_active_text(const Glib::ustring& text)
-{
-  for(Gtk::TreeModel::iterator iter = m_model->children().begin(); iter != m_model->children().end(); ++iter)
-  {
-    Glib::ustring this_text = (*iter)[m_text_columns.m_column];
-
-    if(this_text == text)
-    {
-      set_active(iter);
-      return; //success
-    }
-  }
-
-  //Not found, so mark it as blank:
-  unset_active();
-}
-
-bool Combo_TextGlade::on_row_separator(const Glib::RefPtr<Gtk::TreeModel>& /* model */, const Gtk::TreeModel::iterator& iter)
-{
-  Gtk::TreeModel::Row row = *iter;
-  return row[m_text_columns.m_separator];
-}
-
-///This ensures that something is selected:
 void Combo_TextGlade::set_first_active()
 {
-  Gtk::TreeModel::iterator iter = m_model->children().begin();
+  Glib::RefPtr<Gtk::TreeModel> model = get_model();
+  Gtk::TreeModel::iterator iter = model->children().begin();
   set_active(iter);
 }
 
+
 } //namespace Glom
 
 

Modified: trunk/glom/utility_widgets/combo_textglade.h
==============================================================================
--- trunk/glom/utility_widgets/combo_textglade.h	(original)
+++ trunk/glom/utility_widgets/combo_textglade.h	Tue Mar 17 10:14:33 2009
@@ -21,8 +21,7 @@
 #ifndef GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH
 #define GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH
 
-//#include <gtkmm/comboboxtext.h>
-#include <gtkmm/combobox.h>
+#include <gtkmm/comboboxtext.h>
 #include <libglademm.h>
 
 #include <gtkmm/liststore.h>
@@ -30,46 +29,15 @@
 namespace Glom
 {
 
-/** This class should just derive from Gtk::ComboBoxText and provide a constuctor suitable for libglade's get_widget_derived() template.
- * However, I have reimplemented Gtk::ComboBoxText here temporarily, until the fixes in gtkmm 2.4.3 are widely available.
+/** This class just derives from Gtk::ComboBoxText and provides a constuctor suitable for libglade's get_widget_derived() template.
  */
-class Combo_TextGlade : public Gtk::ComboBox
+class Combo_TextGlade : public Gtk::ComboBoxText
 {
 public:
   Combo_TextGlade(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
-  virtual ~Combo_TextGlade();
-
-  void append_text(const Glib::ustring& text);
-  void append_separator();
-  void prepend_text(const Glib::ustring& text);
-  Glib::ustring get_active_text() const;
-
-  //This is not part of ComboBoxText:
-  void clear_text();
-  void set_active_text(const Glib::ustring& text);
-
-  ///This ensures that something is selected:
+  
+  ///This ensures that something is selected,
   void set_first_active();
-
-private:
-
-  //This determines whether each row should be shown as a separator.
-  bool on_row_separator(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::iterator& iter);
-
-  //Tree model columns:
-  //These columns are used by the model that is created by the default constructor
-  class TextModelColumns : public Gtk::TreeModel::ColumnRecord
-  {
-  public:
-    TextModelColumns()
-    { add(m_column); add(m_separator); }
-
-    Gtk::TreeModelColumn<Glib::ustring> m_column;
-    Gtk::TreeModelColumn<bool> m_separator;
-  };
-
-  TextModelColumns m_text_columns;
-  Glib::RefPtr<Gtk::ListStore> m_model;
 };
 
 } //namespace Glom



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