[clutter-gtkmm] Updated several utility functions to add the GError arguments.



commit 9bb6551048145809e0758901ee75b02c02958e6e
Author: Siavash Safi <siavash siavashs org>
Date:   Wed Jul 29 00:50:13 2009 +0430

    Updated several utility functions to add the GError arguments.
    Fixed the events example to build against the latest cluttermm trunk.

 ChangeLog                            |    7 ++++
 clutter-gtk/clutter-gtkmm/utility.cc |   51 ++++++++++++++++++++++++++++++----
 examples/events/event.cc             |    8 ++--
 3 files changed, 56 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0b063f0..877a32b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-29  Siavash Safi  <siavashs siavashs org>
+
+	* clutter-gtk/clutter-gtkmm/utility.cc: Updated several functions to add
+	the GError argument
+	* examples/events/event.cc: Updated to build against the new cluttermm
+	trunk(patch by Milosz Derezynski)
+
 0.9.3:
 
 2009-05-15  Murray Cumming  <murrayc murrayc com>
diff --git a/clutter-gtk/clutter-gtkmm/utility.cc b/clutter-gtk/clutter-gtkmm/utility.cc
index a448e3e..0c4b62e 100644
--- a/clutter-gtk/clutter-gtkmm/utility.cc
+++ b/clutter-gtk/clutter-gtkmm/utility.cc
@@ -80,19 +80,58 @@ Glib::RefPtr<Texture> create_texture_from_icon_name(::Gtk::Widget& widget, const
   return Glib::wrap(CLUTTER_TEXTURE(gtk_clutter_texture_new_from_icon_name(widget.gobj(), icon_name.c_str(), GtkIconSize(int(size)))));
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
 void set_texture_from_pixbuf(const Glib::RefPtr<Texture>& texture, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
-{
-  gtk_clutter_texture_set_from_pixbuf(texture->gobj(), pixbuf->gobj());
+#else
+void set_texture_from_pixbuf(const Glib::RefPtr<Texture>& texture, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, std::auto_ptr<Glib::Error>& error)
+#endif
+{
+  GError* gerror = 0;
+  gtk_clutter_texture_set_from_pixbuf(texture->gobj(), pixbuf->gobj(), &gerror);
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif // GLIBMM_EXCEPTIONS_ENABLED
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
 void set_texture_from_stock(const Glib::RefPtr<Texture>& texture, ::Gtk::Widget& widget, const Glib::ustring& stock_id, ::Gtk::IconSize size)
-{
-  gtk_clutter_texture_set_from_stock(texture->gobj(), widget.gobj(), stock_id.c_str(), GtkIconSize(int(size)));
+#else
+void set_texture_from_stock(const Glib::RefPtr<Texture>& texture, ::Gtk::Widget& widget, const Glib::ustring& stock_id, ::Gtk::IconSize size, std::auto_ptr<Glib::Error>& error)
+#endif
+{
+  GError* gerror = 0;
+  gtk_clutter_texture_set_from_stock(texture->gobj(), widget.gobj(), stock_id.c_str(), GtkIconSize(int(size)), &gerror);
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif // GLIBMM_EXCEPTIONS_ENABLED
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
 void set_texture_from_icon_name(const Glib::RefPtr<Texture>& texture, ::Gtk::Widget& widget, const Glib::ustring& icon_name, ::Gtk::IconSize size)
-{
-  gtk_clutter_texture_set_from_icon_name(texture->gobj(), widget.gobj(), icon_name.c_str(), GtkIconSize(int(size)));
+#else
+void set_texture_from_icon_name(const Glib::RefPtr<Texture>& texture, ::Gtk::Widget& widget, const Glib::ustring& icon_name, ::Gtk::IconSize size, std::auto_ptr<Glib::Error>& error)
+#endif
+{
+  GError* gerror = 0;
+  gtk_clutter_texture_set_from_icon_name(texture->gobj(), widget.gobj(), icon_name.c_str(), GtkIconSize(int(size)), &gerror);
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif // GLIBMM_EXCEPTIONS_ENABLED
 }
 
 } //namespace Gtk
diff --git a/examples/events/event.cc b/examples/events/event.cc
index 84b5a21..914b98f 100644
--- a/examples/events/event.cc
+++ b/examples/events/event.cc
@@ -44,8 +44,8 @@ Event::Event()
     g_error("Unable to load pixbuf\n");
 
   m_stage->add_actor(m_hand);
-  guint width = 0;
-  guint height = 0;
+  gfloat width = 0;
+  gfloat height = 0;
   m_hand->get_size(width, height);
   m_hand->set_position((CLUTTER_STAGE_WIDTH()/2) - (width/2), (CLUTTER_STAGE_HEIGHT()/2) - (height/2));
   m_hand->set_reactive();
@@ -105,8 +105,8 @@ bool Event::on_stage_capture(Clutter::Event* event)
 {
   if(event->type == CLUTTER_BUTTON_RELEASE)
   {
-    int x = 0;
-    int y = 0;
+    gfloat x = 0;
+    gfloat y = 0;
     clutter_event_get_coords(event, &x, &y);
 
     std::cout << "Event captured at (" << x << ", " << y << ")" << std::endl;



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