glom r2035 - in trunk: . glom glom/bakery glom/libglom glom/libglom/data_structure glom/libglom/data_structure/layout glom/libglom/document glom/mode_design/print_layouts glom/utility_widgets glom/utility_widgets/db_adddel
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r2035 - in trunk: . glom glom/bakery glom/libglom glom/libglom/data_structure glom/libglom/data_structure/layout glom/libglom/document glom/mode_design/print_layouts glom/utility_widgets glom/utility_widgets/db_adddel
- Date: Mon, 30 Mar 2009 12:50:43 +0000 (UTC)
Author: murrayc
Date: Mon Mar 30 12:50:43 2009
New Revision: 2035
URL: http://svn.gnome.org/viewvc/glom?rev=2035&view=rev
Log:
2009-03-30 Murray Cumming <murrayc murrayc com>
* configure.ac: Remove the gtkmm dependency from libglom.
* glom/libglom/Makefile.am:
* glom/bakery/Makefile.am:
* glom/libglom/busy_cursor.[h|cc]: Moved this to glom/bakery/.
* glom/libglom/data_structure/glomconversions.[h|cc]:
Moved get_pixbuf_for_gda_value() to glom/utils_ui.[h|cc].
* glom/libglom/*.[h|cc]: Adapted, and removed any gtkmm or gdkmm headers.
Added:
trunk/glom/bakery/busy_cursor.cc (contents, props changed)
- copied, changed from r2033, /trunk/glom/libglom/busy_cursor.cc
trunk/glom/bakery/busy_cursor.h (props changed)
- copied unchanged from r2033, /trunk/glom/libglom/busy_cursor.h
Removed:
trunk/glom/libglom/busy_cursor.cc
trunk/glom/libglom/busy_cursor.h
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/glom/application.cc
trunk/glom/bakery/Makefile.am
trunk/glom/base_db.h
trunk/glom/box_withbuttons.h
trunk/glom/dialog_database_preferences.cc
trunk/glom/libglom/Makefile.am
trunk/glom/libglom/data_structure/glomconversions.cc
trunk/glom/libglom/data_structure/glomconversions.h
trunk/glom/libglom/data_structure/layout/layoutitem_image.h
trunk/glom/libglom/document/document_glom.cc
trunk/glom/libglom/document/document_glom.h
trunk/glom/mode_design/print_layouts/canvas_layout_item.cc
trunk/glom/mode_design/print_layouts/canvas_print_layout.cc
trunk/glom/utility_widgets/db_adddel/db_adddel.cc
trunk/glom/utility_widgets/imageglom.cc
trunk/glom/utils_ui.cc
trunk/glom/utils_ui.h
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Mar 30 12:50:43 2009
@@ -105,7 +105,7 @@
fi
# Libraries used by libglom:
-REQUIRED_LIBGLOM_LIBS="gtkmm-2.4 >= 2.14 gthread-2.0 libxml++-2.6 pygda-4.0 >= 2.25.3 pygtk-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.14 libgda-4.0 >= 4.0.0 libgda-postgres-4.0"
+REQUIRED_LIBGLOM_LIBS="giomm-2.4 gthread-2.0 libxml++-2.6 pygda-4.0 >= 2.25.3 pygtk-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.14 libgda-4.0 >= 4.0.0 libgda-postgres-4.0"
if test "$enable_maemo" = "yes"; then
REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS ibepc-1.0 >= 0.3.1 avahi-ui";
Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc (original)
+++ trunk/glom/application.cc Mon Mar 30 12:50:43 2009
@@ -889,7 +889,7 @@
{
Document_Glom* document_glom = new Document_Glom();
m_pDocument = document_glom;
- document_glom->set_parent_window(this); //So that it can show a BusyCursor when loading and saving.
+ //document_glom->set_parent_window(this); //So that it can show a BusyCursor when loading and saving.
//Tell document about view:
m_pDocument->set_view(m_pFrame);
Modified: trunk/glom/bakery/Makefile.am
==============================================================================
--- trunk/glom/bakery/Makefile.am (original)
+++ trunk/glom/bakery/Makefile.am Mon Mar 30 12:50:43 2009
@@ -1,7 +1,7 @@
AM_CPPFLAGS = -I top_srcdir@/ -I top_srcdir@/glom $(GLOM_CFLAGS) $(GLOM_WARNING_FLAGS)
-h_sources = app_withdoc.h app.h app_withdoc_gtk.h dialog_offersave.h
-cc_sources = app_withdoc.cc app.cc app_withdoc_gtk.cc dialog_offersave.cc
+h_sources = app_withdoc.h app.h app_withdoc_gtk.h dialog_offersave.h busy_cursor.h
+cc_sources = app_withdoc.cc app.cc app_withdoc_gtk.cc dialog_offersave.cc busy_cursor.cc
noinst_LIBRARIES = libbakery_app.a
libbakery_app_a_SOURCES = $(h_sources) $(cc_sources)
Copied: trunk/glom/bakery/busy_cursor.cc (from r2033, /trunk/glom/libglom/busy_cursor.cc)
==============================================================================
--- /trunk/glom/libglom/busy_cursor.cc (original)
+++ trunk/glom/bakery/busy_cursor.cc Mon Mar 30 12:50:43 2009
@@ -1,4 +1,4 @@
-#include <libglom/busy_cursor.h>
+#include <glom/bakery/busy_cursor.h>
#include <gtkmm/main.h>
#include <gtk/gtk.h>
Modified: trunk/glom/base_db.h
==============================================================================
--- trunk/glom/base_db.h (original)
+++ trunk/glom/base_db.h Mon Mar 30 12:50:43 2009
@@ -34,7 +34,7 @@
#include <libglom/utils.h>
#include <libglom/calcinprogress.h>
#include <libglom/document/bakery/view/view.h>
-#include <libglom/busy_cursor.h>
+#include <glom/bakery/busy_cursor.h>
namespace Glom
{
Modified: trunk/glom/box_withbuttons.h
==============================================================================
--- trunk/glom/box_withbuttons.h (original)
+++ trunk/glom/box_withbuttons.h Mon Mar 30 12:50:43 2009
@@ -27,8 +27,7 @@
#include <libglom/document/document_glom.h>
#include <libglom/connectionpool.h>
#include <libglom/appstate.h>
-#include "base_db.h"
-#include <libglom/busy_cursor.h>
+#include <glom/base_db.h>
#include <gtkmm/builder.h>
namespace Glom
Modified: trunk/glom/dialog_database_preferences.cc
==============================================================================
--- trunk/glom/dialog_database_preferences.cc (original)
+++ trunk/glom/dialog_database_preferences.cc Mon Mar 30 12:50:43 2009
@@ -22,7 +22,7 @@
#include "box_withbuttons.h" //For Box_WithButtons::connect_to_server().
#include <libglom/standard_table_prefs_fields.h>
#include <libglom/data_structure/glomconversions.h>
-#include <libglom/busy_cursor.h>
+#include <glom/bakery/busy_cursor.h>
#include <glibmm/i18n.h>
namespace Glom
Modified: trunk/glom/libglom/Makefile.am
==============================================================================
--- trunk/glom/libglom/Makefile.am (original)
+++ trunk/glom/libglom/Makefile.am Mon Mar 30 12:50:43 2009
@@ -26,7 +26,6 @@
appstate.h
h_sources = $(h_sources_public) \
- busy_cursor.h \
calcinprogress.h \
connectionpool.h \
spawn_with_feedback.h \
@@ -34,7 +33,6 @@
gst-package.h
cc_sources = appstate.cc \
- busy_cursor.cc \
calcinprogress.cc \
connectionpool.cc \
spawn_with_feedback.cc \
Modified: trunk/glom/libglom/data_structure/glomconversions.cc
==============================================================================
--- trunk/glom/libglom/data_structure/glomconversions.cc (original)
+++ trunk/glom/libglom/data_structure/glomconversions.cc Mon Mar 30 12:50:43 2009
@@ -21,13 +21,10 @@
#include <libglom/libglom_config.h> // For HAVE_STRPTIME
-#include <libgda/gda-blob-op.h> // For gda_blob_op_read_all()
-
#include "glomconversions.h"
#include <libglom/connectionpool.h>
#include <libglom/utils.h>
-#include <gdkmm/pixbufloader.h>
-#include <libglom/data_structure/layout/layoutitem_image.h> // For GLOM_IMAGE_FORMAT
+
#include <glibmm/i18n.h>
#include <sstream> //For stringstream
@@ -978,102 +975,5 @@
return value;
}
-Glib::RefPtr<Gdk::Pixbuf> Conversions::get_pixbuf_for_gda_value(const Gnome::Gda::Value& value)
-{
- Glib::RefPtr<Gdk::Pixbuf> result;
-
- if(value.get_value_type() == GDA_TYPE_BINARY || value.get_value_type() == GDA_TYPE_BLOB)
- {
- glong buffer_binary_length;
- gconstpointer buffer_binary;
- if(value.get_value_type() == GDA_TYPE_BLOB)
- {
- const GdaBlob* blob = value.get_blob();
- if(gda_blob_op_read_all(blob->op, const_cast<GdaBlob*>(blob)))
- {
- buffer_binary_length = blob->data.binary_length;
- buffer_binary = blob->data.data;
- }
- else
- {
- buffer_binary_length = 0;
- buffer_binary = NULL;
- g_warning("Conversions::get_pixbuf_for_gda_value(): Failed to read BLOB data");
- }
- }
- else
- {
- buffer_binary = value.get_binary(buffer_binary_length);
- }
-
- /* Note that this is regular binary data, not escaped text representing the binary data: */
- if(buffer_binary && buffer_binary_length)
- {
- //typedef std::list<Gdk::PixbufFormat> type_list_formats;
- //const type_list_formats formats = Gdk::Pixbuf::get_formats();
- //std::cout << "Debug: Supported pixbuf formats:" << std::endl;
- //for(type_list_formats::const_iterator iter = formats.begin(); iter != formats.end(); ++iter)
- //{
- // std::cout << " name=" << iter->get_name() << ", writable=" << iter->is_writable() << std::endl;
- //}
-
- Glib::RefPtr<Gdk::PixbufLoader> refPixbufLoader;
- try
- {
- refPixbufLoader = Gdk::PixbufLoader::create(GLOM_IMAGE_FORMAT);
- }
- catch(const Gdk::PixbufError& ex)
- {
- refPixbufLoader.reset();
- std::cerr << "PixbufLoader::create failed: " << ex.what() << std::endl;
- }
-
- if(refPixbufLoader)
- {
- guint8* puiData = (guint8*)buffer_binary;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
- try
- {
-
- //g_warning("ImageGlom::set_value(): debug: from db: ");
- //for(int i = 0; i < 10; ++i)
- // g_warning("%02X (%c), ", (guint8)puiData[i], (char)puiData[i]);
-
- refPixbufLoader->write(puiData, (glong)buffer_binary_length);
- result = refPixbufLoader->get_pixbuf();
-
- refPixbufLoader->close(); //This throws if write() threw, so it must be inside the try block.
- }
-#else
- std::auto_ptr<Glib::Error> error;
- refPixbufLoader->write(puiData, (glong)buffer_binary_length, error);
- if(error.get() == NULL)
- {
- result = refPixbufLoader->get_pixbuf();
- refPixbufLoader->close(error);
- }
-#endif
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
- catch(const Glib::Exception& ex)
- {
-#else
- if(error.get() != NULL)
- {
- const Glib::Exception& ex = *error.get();
-#endif
- g_warning("Conversions::get_pixbuf_for_gda_value(): PixbufLoader::write() failed: %s", ex.what().c_str());
- }
- }
-
- //TODO: load the image, using the mime type stored elsewhere.
- //pixbuf = Gdk::Pixbuf::create_from_data(
- }
-
- }
-
- return result;
-}
-
} //namespace Glom
Modified: trunk/glom/libglom/data_structure/glomconversions.h
==============================================================================
--- trunk/glom/libglom/data_structure/glomconversions.h (original)
+++ trunk/glom/libglom/data_structure/glomconversions.h Mon Mar 30 12:50:43 2009
@@ -26,7 +26,6 @@
#include <libglom/data_structure/layout/layoutitem_field.h>
#include <libxml++/libxml++.h>
-#include <gdkmm/pixbuf.h>
namespace Glom
{
@@ -81,10 +80,8 @@
Gnome::Gda::Value get_example_value(Field::glom_field_type field_type);
Gnome::Gda::Value convert_value(const Gnome::Gda::Value& value, Field::glom_field_type target_glom_type);
-
-
- Glib::RefPtr<Gdk::Pixbuf> get_pixbuf_for_gda_value(const Gnome::Gda::Value& value);
-}
+
+} //namespace Conversions
} //namespace Glom
Modified: trunk/glom/libglom/data_structure/layout/layoutitem_image.h
==============================================================================
--- trunk/glom/libglom/data_structure/layout/layoutitem_image.h (original)
+++ trunk/glom/libglom/data_structure/layout/layoutitem_image.h Mon Mar 30 12:50:43 2009
@@ -23,7 +23,6 @@
#include "layoutitem.h"
#include <libgdamm/value.h>
-#include <gdkmm/pixbuf.h>
namespace Glom
{
Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc (original)
+++ trunk/glom/libglom/document/document_glom.cc Mon Mar 30 12:50:43 2009
@@ -33,8 +33,7 @@
#include <libglom/data_structure/layout/layoutitem_line.h>
#include <libglom/standard_table_prefs_fields.h>
#include <giomm.h>
-#include <libglom/busy_cursor.h>
-#include <gtkmm/pagesetup.h>
+//#include <libglom/busy_cursor.h>
#include <libglom/connectionpool.h>
@@ -243,8 +242,7 @@
m_allow_auto_save(true), //Save all changes immediately, by default.
#endif // !GLOM_ENABLE_CLIENT_ONLY
m_is_example(false),
- m_opened_from_browse(false),
- m_parent_window(0)
+ m_opened_from_browse(false)
{
m_document_format_version = get_latest_known_document_format_version(); //Default to this for new documents.
@@ -2296,12 +2294,15 @@
bool Document_Glom::load_after()
{
+ //TODO: Use some callback UI to show a busy cursor?
+ /*
//Use a std::auto_ptr<> to avoid even unncessarily instantiating a BusyCursor,
//which would require GTK+ to be initialized:
std::auto_ptr<BusyCursor> auto_cursor;
if(m_parent_window)
auto_cursor = std::auto_ptr<BusyCursor>( new BusyCursor(m_parent_window) );
-
+ */
+
m_block_modified_set = true; //Prevent the set_ functions from trigerring a save.
bool result = GlomBakery::Document_XML::load_after();
@@ -3181,12 +3182,15 @@
bool Document_Glom::save_before()
{
+ //TODO: Use some callback UI to show a busy cursor?
+ /*
//Use a std::auto_ptr<> to avoid even unncessarily instantiating a BusyCursor,
//which would require GTK+ to be initialized:
std::auto_ptr<BusyCursor> auto_cursor;
if(m_parent_window)
auto_cursor = std::auto_ptr<BusyCursor>( new BusyCursor(m_parent_window) );
-
+ */
+
xmlpp::Element* nodeRoot = get_node_document();
if(nodeRoot)
@@ -3945,11 +3949,6 @@
}
}
-void Document_Glom::set_parent_window(Gtk::Window* window)
-{
- m_parent_window = window;
-}
-
void Document_Glom::set_file_uri(const Glib::ustring& file_uri, bool bEnforceFileExtension /* = false */)
{
//We override this because set_modified() triggers a save (to the old filename) in this derived class.
Modified: trunk/glom/libglom/document/document_glom.h
==============================================================================
--- trunk/glom/libglom/document/document_glom.h (original)
+++ trunk/glom/libglom/document/document_glom.h Mon Mar 30 12:50:43 2009
@@ -417,8 +417,6 @@
#ifndef SWIG //Hide this API from swig.
- void set_parent_window(Gtk::Window* window);
-
Glib::ustring build_and_get_contents() const;
protected:
@@ -613,8 +611,6 @@
bool m_opened_from_browse;
Glib::ustring m_active_layout_platform; //empty (means normal), or "maemo".
-
- Gtk::Window* m_parent_window; //Needed by BusyCursor.
};
} //namespace Glom
Modified: trunk/glom/mode_design/print_layouts/canvas_layout_item.cc
==============================================================================
--- trunk/glom/mode_design/print_layouts/canvas_layout_item.cc (original)
+++ trunk/glom/mode_design/print_layouts/canvas_layout_item.cc Mon Mar 30 12:50:43 2009
@@ -33,6 +33,7 @@
#include <libglom/data_structure/layout/layoutitem_portal.h>
#include <libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h>
#include <libglom/data_structure/glomconversions.h>
+#include <glom/utils_ui.h>
#include <glibmm/i18n.h>
#include <math.h>
#include <algorithm> //For std::max().
@@ -193,7 +194,7 @@
if(image)
{
Glib::RefPtr<CanvasImageMovable> canvas_item = CanvasImageMovable::create();
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Conversions::get_pixbuf_for_gda_value(image->m_image);
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Utils::get_pixbuf_for_gda_value(image->m_image);
if(pixbuf)
canvas_item->set_image(pixbuf);
else
@@ -403,7 +404,7 @@
double height = 0;
canvas_item->get_width_height(width, height);
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Conversions::get_pixbuf_for_gda_value(value);
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Utils::get_pixbuf_for_gda_value(value);
if(pixbuf) //TODO: Remove this if() check when goocanvas has my patch to avoid crashes when this is NULL.
canvas_item->set_image(pixbuf);
Modified: trunk/glom/mode_design/print_layouts/canvas_print_layout.cc
==============================================================================
--- trunk/glom/mode_design/print_layouts/canvas_print_layout.cc (original)
+++ trunk/glom/mode_design/print_layouts/canvas_print_layout.cc Mon Mar 30 12:50:43 2009
@@ -756,7 +756,7 @@
if(!canvas_image)
return;
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Conversions::get_pixbuf_for_gda_value(value);
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Utils::get_pixbuf_for_gda_value(value);
canvas_image->property_pixbuf() = pixbuf;
}
else //text, numbers, date, time, boolean:
Modified: trunk/glom/utility_widgets/db_adddel/db_adddel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/db_adddel.cc (original)
+++ trunk/glom/utility_widgets/db_adddel/db_adddel.cc Mon Mar 30 12:50:43 2009
@@ -648,7 +648,7 @@
{
Gtk::CellRendererPixbuf* pixbuf_renderer = Gtk::manage( new Gtk::CellRendererPixbuf() );
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Conversions::get_pixbuf_for_gda_value(item_image->m_image);
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Utils::get_pixbuf_for_gda_value(item_image->m_image);
if(pixbuf)
pixbuf_renderer->set_property("pixbuf", pixbuf);
else
@@ -2002,7 +2002,7 @@
Gtk::CellRendererPixbuf* pDerived = dynamic_cast<Gtk::CellRendererPixbuf*>(renderer);
if(pDerived)
{
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Conversions::get_pixbuf_for_gda_value(value);
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Utils::get_pixbuf_for_gda_value(value);
//Scale it down to a sensible size.
if(pixbuf)
Modified: trunk/glom/utility_widgets/imageglom.cc
==============================================================================
--- trunk/glom/utility_widgets/imageglom.cc (original)
+++ trunk/glom/utility_widgets/imageglom.cc Mon Mar 30 12:50:43 2009
@@ -21,6 +21,7 @@
#include "imageglom.h"
#include <glibmm/i18n.h>
#include <glom/application.h>
+#include <glom/utils_ui.h>
#include <libglom/data_structure/glomconversions.h>
//#include <sstream> //For stringstream
@@ -156,7 +157,7 @@
void ImageGlom::set_value(const Gnome::Gda::Value& value)
{
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Conversions::get_pixbuf_for_gda_value(value);
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Utils::get_pixbuf_for_gda_value(value);
if(pixbuf)
{
set_pixbuf(pixbuf);
Modified: trunk/glom/utils_ui.cc
==============================================================================
--- trunk/glom/utils_ui.cc (original)
+++ trunk/glom/utils_ui.cc Mon Mar 30 12:50:43 2009
@@ -25,7 +25,10 @@
#include <libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h>
#include <libglom/data_structure/glomconversions.h>
-#include <glibmm/i18n.h>
+#include <libglom/data_structure/layout/layoutitem_image.h> // For GLOM_IMAGE_FORMAT
+#include <gdkmm/pixbufloader.h>
+#include <libgda/gda-blob-op.h> // For gda_blob_op_read_all()
+
#include <gtkmm/messagedialog.h>
#include <giomm.h>
@@ -34,6 +37,8 @@
#include <hildonmm/note.h>
#endif
+#include <glibmm/i18n.h>
+
#include <string.h> // for strchr
#include <sstream> //For stringstream
@@ -212,4 +217,101 @@
}
+Glib::RefPtr<Gdk::Pixbuf> Utils::get_pixbuf_for_gda_value(const Gnome::Gda::Value& value)
+{
+ Glib::RefPtr<Gdk::Pixbuf> result;
+
+ if(value.get_value_type() == GDA_TYPE_BINARY || value.get_value_type() == GDA_TYPE_BLOB)
+ {
+ glong buffer_binary_length;
+ gconstpointer buffer_binary;
+ if(value.get_value_type() == GDA_TYPE_BLOB)
+ {
+ const GdaBlob* blob = value.get_blob();
+ if(gda_blob_op_read_all(blob->op, const_cast<GdaBlob*>(blob)))
+ {
+ buffer_binary_length = blob->data.binary_length;
+ buffer_binary = blob->data.data;
+ }
+ else
+ {
+ buffer_binary_length = 0;
+ buffer_binary = NULL;
+ g_warning("Conversions::get_pixbuf_for_gda_value(): Failed to read BLOB data");
+ }
+ }
+ else
+ {
+ buffer_binary = value.get_binary(buffer_binary_length);
+ }
+
+ /* Note that this is regular binary data, not escaped text representing the binary data: */
+ if(buffer_binary && buffer_binary_length)
+ {
+ //typedef std::list<Gdk::PixbufFormat> type_list_formats;
+ //const type_list_formats formats = Gdk::Pixbuf::get_formats();
+ //std::cout << "Debug: Supported pixbuf formats:" << std::endl;
+ //for(type_list_formats::const_iterator iter = formats.begin(); iter != formats.end(); ++iter)
+ //{
+ // std::cout << " name=" << iter->get_name() << ", writable=" << iter->is_writable() << std::endl;
+ //}
+
+ Glib::RefPtr<Gdk::PixbufLoader> refPixbufLoader;
+ try
+ {
+ refPixbufLoader = Gdk::PixbufLoader::create(GLOM_IMAGE_FORMAT);
+ }
+ catch(const Gdk::PixbufError& ex)
+ {
+ refPixbufLoader.reset();
+ std::cerr << "PixbufLoader::create failed: " << ex.what() << std::endl;
+ }
+
+ if(refPixbufLoader)
+ {
+ guint8* puiData = (guint8*)buffer_binary;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+
+ //g_warning("ImageGlom::set_value(): debug: from db: ");
+ //for(int i = 0; i < 10; ++i)
+ // g_warning("%02X (%c), ", (guint8)puiData[i], (char)puiData[i]);
+
+ refPixbufLoader->write(puiData, (glong)buffer_binary_length);
+ result = refPixbufLoader->get_pixbuf();
+
+ refPixbufLoader->close(); //This throws if write() threw, so it must be inside the try block.
+ }
+#else
+ std::auto_ptr<Glib::Error> error;
+ refPixbufLoader->write(puiData, (glong)buffer_binary_length, error);
+ if(error.get() == NULL)
+ {
+ result = refPixbufLoader->get_pixbuf();
+ refPixbufLoader->close(error);
+ }
+#endif
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ catch(const Glib::Exception& ex)
+ {
+#else
+ if(error.get() != NULL)
+ {
+ const Glib::Exception& ex = *error.get();
+#endif
+ g_warning("Conversions::get_pixbuf_for_gda_value(): PixbufLoader::write() failed: %s", ex.what().c_str());
+ }
+ }
+
+ //TODO: load the image, using the mime type stored elsewhere.
+ //pixbuf = Gdk::Pixbuf::create_from_data(
+ }
+
+ }
+
+ return result;
+}
+
} //namespace Glom
Modified: trunk/glom/utils_ui.h
==============================================================================
--- trunk/glom/utils_ui.h (original)
+++ trunk/glom/utils_ui.h Mon Mar 30 12:50:43 2009
@@ -63,6 +63,8 @@
/// For instance, to create bold primary text for a dialog box, without marking the markup for translation.
Glib::ustring bold_message(const Glib::ustring& message);
+Glib::RefPtr<Gdk::Pixbuf> get_pixbuf_for_gda_value(const Gnome::Gda::Value& value);
+
} //namespace Utils
} //namespace Glom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]