[glom/glom-1-10] Revert "Increase version commit with unwanted extra changes."



commit 303b9bf4a53b83f42bfc45cb9ecb433384584c3e
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jun 1 13:04:54 2009 +0200

    Revert "Increase version commit with unwanted extra changes."
    
    This reverts commit 543b22ea18d566089ad9849a47f38268431b4291.
---
 ChangeLog                             |    2 -
 NEWS                                  |   12 ----
 configure.ac                          |    2 +-
 glom/base_db.cc                       |    3 +-
 glom/libglom/sharedptr.h              |    7 ---
 glom/mode_data/box_data_details.cc    |    4 +-
 glom/mode_data/flowtablewithfields.cc |   85 ++++++++++--------------------
 glom/mode_data/flowtablewithfields.h  |    8 +--
 glom/utility_widgets/imageglom.cc     |   92 +++++++++++++++------------------
 glom/utility_widgets/imageglom.h      |    1 -
 glom/xsl_utils.cc                     |    1 -
 11 files changed, 76 insertions(+), 141 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b192166..7fd1c4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,3 @@
-1.10.1:
-
 2009-05-25  Armin Burgmeier  <armin openismus com>
 
 	* glom/dialog_existing_or_new.cc (constructor): Create the top level
diff --git a/NEWS b/NEWS
index 53b8fa2..f8754d3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,15 +1,3 @@
-1.10.1 (stable):
-
-* Fix crash in initial dialog, experienced on some systems. 
-  (Armin Burgmeir) Bug #584022 (Keir Lawson)
-* Self-Hosting: Allow multiple glom instances to self-host on the same PC, 
-  by correcting the discovery of available network ports.
-  (Armin Burgmeir)
-* Allow Glom to use existing database tables again (though there is still no 
-  UI for this).
-* Restore the check for the necessary libgda provider plugin.
-  (Murray Cumming)
-
 1.10.0 (stable):
 
 What's new in Glom 1.10:
diff --git a/configure.ac b/configure.ac
index 50e8680..d194fac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ AC_CONFIG_SRCDIR([glom/main.cc])
 AC_CONFIG_HEADERS([config.h glom/libglom/libglom_config.h])
 
 # Package name and version number:
-AM_INIT_AUTOMAKE(glom, 1.10.1)
+AM_INIT_AUTOMAKE(glom, 1.10.0)
 
 AM_MAINTAINER_MODE
 
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 1f10f8c..5c46ca1 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -2490,8 +2490,7 @@ bool Base_DB::set_field_value_in_database(const LayoutFieldInRecord& layoutfield
   { 
     Glib::RefPtr<Gnome::Gda::Set> params = Gnome::Gda::Set::create();
     params->add_holder(field_in_record.m_field->get_holder(field_value));
-    params->add_holder(field_in_record.m_key->get_holder(field_in_record.m_key_value));
-
+    params->add_holder(field_in_record.m_key->get_holder(field_in_record.m_key_value));  
     Glib::ustring strQuery = "UPDATE \"" + field_in_record.m_table_name + "\"";
     strQuery += " SET \"" + field_in_record.m_field->get_name() + "\" = " + field_in_record.m_field->get_gda_holder_string();
     strQuery += " WHERE \"" + field_in_record.m_key->get_name() + "\" = " + field_in_record.m_key->get_gda_holder_string();
diff --git a/glom/libglom/sharedptr.h b/glom/libglom/sharedptr.h
index f3082f9..eb6f1a8 100644
--- a/glom/libglom/sharedptr.h
+++ b/glom/libglom/sharedptr.h
@@ -79,7 +79,6 @@ public:
   virtual ~sharedptr();
 
   inline bool operator==(const sharedptr<T_obj>& src) const;
-  inline bool operator!=(const sharedptr<T_obj>& src) const;
 
   ///Forget the instance.
   virtual void clear();
@@ -269,12 +268,6 @@ inline bool sharedptr<T_obj>::operator==(const sharedptr<T_obj>& src) const
   return m_pobj == src.m_pobj;
 }
 
-template <class T_obj>
-inline bool sharedptr<T_obj>::operator!=(const sharedptr<T_obj>& src) const
-{
-  return m_pobj != src.m_pobj;
-}
-
 
 template< typename T_obj>
 void sharedptr<T_obj>::clear()
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 915e4cc..3ace737 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -761,8 +761,8 @@ void Box_Data_Details::on_flowtable_field_edited(const sharedptr<const LayoutIte
     }
 
     //Set the value in all instances of this field in the layout (The field might be on the layout more than once):
-    //We don't need to set the value in the layout_field itself, as this is where the value comes from.
-    m_FlowTable.set_other_field_value(layout_field, field_value);
+    //if(layout_field->get_glom_type() != Field::TYPE_IMAGE) //TODO For now, don't do this for images, because the ImageGlom widget expects a broken GdaValue, because gda_value_get_binary() needs to be fixed.
+    m_FlowTable.set_field_value(layout_field, field_value);
 
     //Update the field in the record (the record with this primary key):
 
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 783a91e..9cbf18a 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -742,36 +742,8 @@ void FlowTableWithFields::remove_field(const Glib::ustring& id)
 
 void FlowTableWithFields::set_field_value(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value)
 {
-  // TODO: Avoid duplication. Maybe we can call set_other_field_value plus
-  // set the value for field's widget directly.
   //Set widgets which should show the value of this field:
-  type_list_widgets list_widgets = get_field(field, true);
-  for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
-  {
-    DataWidget* datawidget = dynamic_cast<DataWidget*>(*iter);
-    if(datawidget)
-    {
-      datawidget->set_value(value);
-    }
-  }
-
-  //Refresh widgets which should show the related records for relationships that use this field:
-  type_portals list_portals = get_portals(field /* from_key field name */);
-  for(type_portals::iterator iter = list_portals.begin(); iter != list_portals.end(); ++iter)
-  {
-    Box_Data_Portal* portal = *iter;
-    if(portal)
-    {
-      //g_warning("FlowTableWithFields::set_field_value: foreign_key_value=%s", value.to_string().c_str());
-      portal->refresh_data_from_database_with_foreign_key(value /* foreign key value */);
-    }
-  }
-}
-
-void FlowTableWithFields::set_other_field_value(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value)
-{
-  //Set widgets which should show the value of this field:
-  type_list_widgets list_widgets = get_field(field, false);
+  type_list_widgets list_widgets = get_field(field);
   for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
   {
     DataWidget* datawidget = dynamic_cast<DataWidget*>(*iter);
@@ -796,7 +768,7 @@ void FlowTableWithFields::set_other_field_value(const sharedptr<const LayoutItem
 
 Gnome::Gda::Value FlowTableWithFields::get_field_value(const sharedptr<const LayoutItem_Field>& field) const
 {
-  type_list_const_widgets list_widgets = get_field(field, true);
+  type_list_const_widgets list_widgets = get_field(field);
   if(!list_widgets.empty())
   {
     const DataWidget* datawidget = dynamic_cast<const DataWidget*>(*(list_widgets.begin()));
@@ -811,7 +783,7 @@ Gnome::Gda::Value FlowTableWithFields::get_field_value(const sharedptr<const Lay
 
 void FlowTableWithFields::set_field_editable(const sharedptr<const LayoutItem_Field>& field, bool editable)
 {
-  type_list_widgets list_widgets = get_field(field, true);
+  type_list_widgets list_widgets = get_field(field);
   for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
   {
     DataWidget* datawidget = dynamic_cast<DataWidget*>(*iter);
@@ -868,31 +840,21 @@ FlowTableWithFields::type_portals FlowTableWithFields::get_portals(const sharedp
   return result;
 }
 
-namespace
+FlowTableWithFields::type_list_const_widgets FlowTableWithFields::get_field(const sharedptr<const LayoutItem_Field>& layout_item) const
 {
-  // Get the direct widgets represesenting a given layout item
-  // from a flowtable, without considering subflowtables:
-  template<typename InputIterator, typename OutputIterator>
-  void get_direct_fields(InputIterator begin, InputIterator end, OutputIterator out, const sharedptr<const LayoutItem_Field>& layout_item, bool include_item)
+  type_list_const_widgets result;
+
+  for(type_listFields::const_iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
   {
-    for(InputIterator iter = begin; iter != end; ++iter)
+    if( (iter->m_field->is_same_field(layout_item)) )
     {
-      if(iter->m_field->is_same_field(layout_item) && (include_item || iter->m_field != layout_item))
-      {
-        if(iter->m_checkbutton)
-          *out++ = iter->m_checkbutton;
-        else
-          *out++ = iter->m_second;
-      }
+      const Info& info = *iter;
+      if(info.m_checkbutton)
+        result.push_back(info.m_checkbutton);
+      else
+        result.push_back(info.m_second);
     }
   }
-}
-
-FlowTableWithFields::type_list_const_widgets FlowTableWithFields::get_field(const sharedptr<const LayoutItem_Field>& layout_item, bool include_item) const
-{
-  type_list_const_widgets result;
-
-  get_direct_fields(m_listFields.begin(), m_listFields.end(), std::back_inserter(result), layout_item, include_item);
 
   //Check the sub-flowtables:
   for(type_sub_flow_tables::const_iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end(); ++iter)
@@ -900,7 +862,7 @@ FlowTableWithFields::type_list_const_widgets FlowTableWithFields::get_field(cons
     const FlowTableWithFields* subtable = *iter;
     if(subtable)
     {
-      type_list_const_widgets sub_list = subtable->get_field(layout_item, include_item);
+      type_list_const_widgets sub_list = subtable->get_field(layout_item);
       if(!sub_list.empty())
       {
         //Add to the main result:
@@ -912,13 +874,22 @@ FlowTableWithFields::type_list_const_widgets FlowTableWithFields::get_field(cons
   return result;
 }
 
-FlowTableWithFields::type_list_widgets FlowTableWithFields::get_field(const sharedptr<const LayoutItem_Field>& layout_item, bool include_item)
+FlowTableWithFields::type_list_widgets FlowTableWithFields::get_field(const sharedptr<const LayoutItem_Field>& layout_item)
 {
+  //TODO: Avoid duplication
   type_list_widgets result;
 
-  get_direct_fields(m_listFields.begin(), m_listFields.end(), std::back_inserter(result), layout_item, include_item);
-
-  //TODO: Avoid duplication
+  for(type_listFields::const_iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
+  {
+    if( (iter->m_field->is_same_field(layout_item)) )
+    {
+      const Info& info = *iter;
+      if(info.m_checkbutton)
+        result.push_back(info.m_checkbutton);
+      else
+        result.push_back(info.m_second);
+    }
+  }
 
   //Check the sub-flowtables:
   for(type_sub_flow_tables::const_iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end(); ++iter)
@@ -926,7 +897,7 @@ FlowTableWithFields::type_list_widgets FlowTableWithFields::get_field(const shar
     FlowTableWithFields* subtable = *iter;
     if(subtable)
     {
-      type_list_widgets sub_list = subtable->get_field(layout_item, include_item);
+      type_list_widgets sub_list = subtable->get_field(layout_item);
       if(!sub_list.empty())
       {
         //Add to the main result:
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index d93cdd2..fe82708 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -87,7 +87,7 @@ public:
   //virtual Gnome::Gda::Value get_field_value(const Glib::ustring& id) const;
   virtual void set_field_value(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
   //virtual void set_field_value(const Glib::ustring& id, const Gnome::Gda::Value& value);
-  virtual void set_other_field_value(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+
 
   typedef std::list<Gtk::Widget*> type_list_widgets;
   typedef std::list<const Gtk::Widget*> type_list_const_widgets;
@@ -138,10 +138,8 @@ public:
   
 private:
 
-  // If include_item is set, then the output list will contain field's widget,
-  // otherwise not.
-  type_list_widgets get_field(const sharedptr<const LayoutItem_Field>& field, bool include_item);
-  type_list_const_widgets get_field(const sharedptr<const LayoutItem_Field>& field, bool include_item) const;
+  type_list_widgets get_field(const sharedptr<const LayoutItem_Field>& field);
+  type_list_const_widgets get_field(const sharedptr<const LayoutItem_Field>& field) const;
 
   typedef std::list< Box_Data_Portal* > type_portals;
     
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index c648a04..525efa6 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -156,11 +156,7 @@ void ImageGlom::set_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
 
 void ImageGlom::set_value(const Gnome::Gda::Value& value)
 {
-  // Remember original data 
-  m_original_data = Gnome::Gda::Value();
-  m_original_data = value;
-  Glib::RefPtr<Gdk::Pixbuf> pixbuf = Utils::get_pixbuf_for_gda_value(value);
-
+  Glib::RefPtr<Gdk::Pixbuf> pixbuf = Conversions::get_pixbuf_for_gda_value(value);
   if(pixbuf)
   {
     set_pixbuf(pixbuf);
@@ -222,8 +218,7 @@ Gnome::Gda::Value ImageGlom::get_value() const
 {
   //TODO: Return the data from the file that was just chosen.
   //Don't store the original here any longer than necessary,
-  if(m_original_data.get_value_type() != G_TYPE_NONE)
-    return m_original_data;
+  Gnome::Gda::Value result;
   
   if(m_pixbuf_original)
   {
@@ -249,16 +244,11 @@ Gnome::Gda::Value ImageGlom::get_value() const
       //for(int i = 0; i < 10; ++i)
       //  g_warning("%02X (%c), ", (guint8)buffer[i], buffer[i]);
 
-      GdaBinary* bin = g_new(GdaBinary, 1);
-      bin->data = reinterpret_cast<guchar*>(buffer);
-      bin->binary_length = buffer_size;
-
-      m_original_data = Gnome::Gda::Value();
-      m_original_data.Glib::ValueBase::init(GDA_TYPE_BINARY);
-      gda_value_take_binary(m_original_data.gobj(), bin);
+      result.Glib::ValueBase::init(GDA_TYPE_BINARY);
+      result.set(reinterpret_cast<const guchar*>(buffer), buffer_size);
 
+      g_free(buffer);
       buffer = 0;
-      return m_original_data;
     }
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     catch(const Glib::Exception& ex)
@@ -268,7 +258,7 @@ Gnome::Gda::Value ImageGlom::get_value() const
 #endif // GLIBMM_EXCEPTIONS_ENABLED
   }
 
-  return Gnome::Gda::Value();
+  return result;
 }
 
 bool ImageGlom::on_expose_event(GdkEventExpose* event)
@@ -407,41 +397,44 @@ void ImageGlom::on_menupopup_activate_select_file()
     const std::string filepath = dialog.get_filename();
     if(!filepath.empty())
     {
-      // TODO: We might want to show a progress dialog here, and read
-      // the data asynchronously
-      // We use the C API here to avoid unnecessary copying
-      gchar* data;
-      gsize length;
-      GError* error = NULL;
-      if(!g_file_get_contents(filepath.c_str(), &data, &length, &error))
-      {
-        App_Glom* pApp = get_application();
-        if(pApp)
-          Frame_Glom::show_ok_dialog(_("Image loading failed"), _("The image file could not be opened:\n") + Glib::ustring(error->message), *pApp, Gtk::MESSAGE_ERROR);
-        g_error_free(error);
-      }
-      else
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try
+#else
+      std::auto_ptr<Glib::Error> error;
+#endif // GLIBMM_EXCEPTIONS_ENABLED
       {
-        GdaBinary* bin = g_new(GdaBinary, 1);
-        bin->data = reinterpret_cast<guchar*>(data);
-        bin->binary_length = length;
-
-        m_original_data = Gnome::Gda::Value();
-        m_original_data.Glib::ValueBase::init(GDA_TYPE_BINARY);
-        gda_value_take_binary(m_original_data.gobj(), bin);
-
-        m_pixbuf_original = Utils::get_pixbuf_for_gda_value(m_original_data);
-        if(m_pixbuf_original)
-        {
-          m_image.set(m_pixbuf_original); //Load the image.
-          scale();
-          signal_edited().emit();
-        }
-        else
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+        m_pixbuf_original = Gdk::Pixbuf::create_from_file(filepath);
+#else
+        m_pixbuf_original = Gdk::Pixbuf::create_from_file(filepath, error);
+        if(error.get() != NULL)
         {
-	  m_original_data = Gnome::Gda::Value();
-          g_warning("ImageGlom::on_menupopup_activate_select_file(): file load failed.");
+#endif // GLIBMM_EXCEPTIONS_ENABLED
+          if(m_pixbuf_original)
+          {
+            m_image.set(m_pixbuf_original); //Load the image.
+            scale();
+            signal_edited().emit();
+          }
+          else
+          {
+            g_warning("ImageGlom::on_menupopup_activate_select_file(): file load failed.");
+          }
+#ifndef GLIBMM_EXCEPTIONS_ENABLED
         }
+#endif // !GLIBMM_EXCEPTIONS_ENABLED
+      }
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+      catch(const Glib::Exception& ex)
+      {
+#else
+      if(error.get() != NULL)
+      {
+        const Glib::Exception& ex = *error.get();
+#endif
+        App_Glom* pApp = get_application();
+        if(pApp)
+          Frame_Glom::show_ok_dialog(_("Image loading failed"), _("The image file could not be opened:\n") + ex.what(), *pApp, Gtk::MESSAGE_ERROR);
       }
     }
   }
@@ -500,9 +493,6 @@ void ImageGlom::on_clipboard_received_image(const Glib::RefPtr<Gdk::Pixbuf>& pix
 
   if(pixbuf)
   {
-    // Clear original data of previous image
-    m_original_data = Gnome::Gda::Value();
-
     m_pixbuf_original = pixbuf;
 
     m_image.set(m_pixbuf_original); //Load the image.
diff --git a/glom/utility_widgets/imageglom.h b/glom/utility_widgets/imageglom.h
index f3cbd40..86ff1b0 100644
--- a/glom/utility_widgets/imageglom.h
+++ b/glom/utility_widgets/imageglom.h
@@ -81,7 +81,6 @@ private:
  
   Gtk::Image m_image;
   Gtk::Frame m_frame;
-  mutable Gnome::Gda::Value m_original_data; // Original file data (mutable so that we can create it in get_value() if it does not exist yet)
   Glib::RefPtr<Gdk::Pixbuf> m_pixbuf_original; //Only stored temporarily, because it could be big.
   Glib::RefPtr<Gdk::Pixbuf> m_pixbuf_clipboard; //When copy is used, store it here until it is pasted.
 
diff --git a/glom/xsl_utils.cc b/glom/xsl_utils.cc
index 74493e5..64396d0 100644
--- a/glom/xsl_utils.cc
+++ b/glom/xsl_utils.cc
@@ -30,7 +30,6 @@
 //#include <libexslt/exslt.h> //For exsltRegisterAll().
 #include <giomm.h>
 #include <glibmm/i18n.h>
-#include <gtk/gtk.h>
 
 #include <sstream> //For stringstream
 



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