[gstreamermm] Fixed build with disabled exceptions and disabled properties (bgo#582439)



commit 85f1a94efced063bd1c55c306f0284096a99ca2d
Author: Johannes Schmid <jhs gnome org>
Date:   Fri May 22 18:31:55 2009 +0200

    Fixed build with disabled exceptions and disabled properties (bgo#582439)
---
 ChangeLog                                          |   24 +++++++++++++
 examples/element_link/element_link.cc              |   12 +++++-
 examples/media_player_gtkmm/main.cc                |    4 ++
 examples/media_player_gtkmm/player_window.cc       |    4 ++
 examples/optiongroup/main.cc                       |   11 +++++-
 gstreamer/src/bin.ccg                              |   37 +++++++++++++-------
 gstreamer/src/bin.hg                               |    4 ++
 gstreamer/src/element.ccg                          |   27 ++++++++++++--
 gstreamer/src/element.hg                           |    4 ++
 gstreamer/src/ghostpad.ccg                         |   27 +++++++++++----
 gstreamer/src/ghostpad.hg                          |    3 ++
 tests/test-caps.cc                                 |   13 +++++++
 tests/test-init-check-noargs.cc                    |   12 ++++++-
 tests/test-init-check.cc                           |   12 ++++++-
 tests/test-iterator.cc                             |   16 +++++++--
 tests/test-plugin-signals.cc                       |   13 +++++++
 .../extra_defs_gen/generate_plugin_gmmproc_file.cc |   10 +++++
 17 files changed, 201 insertions(+), 32 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ca907b6..3fc4220 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2009-05-20  Johannes Schmid  <jschmid openismus com>
+
+  * examples/element_link/element_link.cc:
+  * examples/media_player_gtkmm/main.cc:
+  * examples/media_player_gtkmm/player_window.cc:
+  * examples/optiongroup/main.cc
+  Fixed examples to build with disabled exceptions and disabled properties
+  
+  * gstreamer/src/bin.ccg:
+  * gstreamer/src/bin.hg:
+  * gstreamer/src/element.ccg:
+  * gstreamer/src/element.hg:
+  * gstreamer/src/ghostpad.ccg:
+  * gstreamer/src/ghostpad.hg:
+  Report runtime exceptions to stderr if exceptions are disabled
+  
+  * tests/test-caps.cc:
+  * tests/test-init-check-noargs.cc
+  * tests/test-plugin-signals.cc
+  Fixed test-cases to build with disabled exceptions and properties
+  
+  * tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
+  Fixed build with disabled exceptions
+
 2009-05-20  José Alburquerque  <jaalburqu svn gnome org>
 
 	* gstreamer/src/taglist.ccg:
diff --git a/examples/element_link/element_link.cc b/examples/element_link/element_link.cc
index 619e7fb..87c952b 100644
--- a/examples/element_link/element_link.cc
+++ b/examples/element_link/element_link.cc
@@ -36,7 +36,15 @@ int main(int argc, char** argv)
   element_sink = Gst::ElementFactory::create_element("fakesink");
 
   // We must add the elements to the pipeline before linking them:
-  pipeline->add(element_source)->add(element_filter)->add(element_sink);
+  try
+  {
+    pipeline->add(element_source)->add(element_filter)->add(element_sink);
+  }
+  catch (std::runtime_error& ex)
+  {
+    std::cerr << "Exception while adding: " << ex.what() << std::endl;
+    return 1;
+  }
 
   // Link the elements together:
   try
@@ -45,7 +53,7 @@ int main(int argc, char** argv)
   }
   catch(const std::runtime_error& error)
   {
-    std::cout << "Exception while linking: " << error.what() << std::endl;
+    std::cerr << "Exception while linking: " << error.what() << std::endl;
   }
 
   return 0;
diff --git a/examples/media_player_gtkmm/main.cc b/examples/media_player_gtkmm/main.cc
index 0ad6da6..42cffaa 100644
--- a/examples/media_player_gtkmm/main.cc
+++ b/examples/media_player_gtkmm/main.cc
@@ -58,7 +58,11 @@ main (int argc, char *argv[])
 
   // Set the playbin's video-sink property so that our video sink is used
   // for video display:
+#ifdef GLIBMM_PROPERTIES_ENABLED
   playbin->property_video_sink() = video_sink;
+#else
+  playbin->set_property("video_sink", video_sink);
+#endif
 
   //Create our player window and give it the pipeline and video sink:
   PlayerWindow mainWindow(playbin, video_sink);
diff --git a/examples/media_player_gtkmm/player_window.cc b/examples/media_player_gtkmm/player_window.cc
index 293acae..75bf420 100644
--- a/examples/media_player_gtkmm/player_window.cc
+++ b/examples/media_player_gtkmm/player_window.cc
@@ -359,7 +359,11 @@ void PlayerWindow::on_button_open()
     working_dir = chooser.get_current_folder();
 
     // Set uri property on the playbin.
+#ifdef GLIBMM_PROPERTIES_ENABLED
     m_play_bin->property_uri() = chooser.get_uri();
+#else
+    m_play_bin->set_property("property_uri", chooser.get_uri());
+#endif
 
     // Resize m_video_area and window to minimum when opening a file
     m_video_area.set_size_request(0, 0);
diff --git a/examples/optiongroup/main.cc b/examples/optiongroup/main.cc
index f6cd306..ac74ca7 100644
--- a/examples/optiongroup/main.cc
+++ b/examples/optiongroup/main.cc
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
 
   Glib::OptionGroup m_GstOptiongroup = Gst::get_option_group();
   m_OptionContext.add_group(m_GstOptiongroup);
-
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     m_OptionContext.parse(argc, argv);
@@ -63,6 +63,15 @@ int main(int argc, char** argv)
     std::cout << "Failed to initialize: " << error.what() << std::endl;
     return 1;
   }
+#else
+  std::auto_ptr<Glib::Error> ex;
+  m_OptionContext.parse(argc, argv, ex);
+  if (ex.get())
+  {
+    std::cout << "Failed to initialize" << ex->what() << std::endl;
+    return 1;
+  }
+#endif
 
   std::cout << "Run me with --help to see the Application options appended.\n";
   return 0;
diff --git a/gstreamer/src/bin.ccg b/gstreamer/src/bin.ccg
index 8c44247..70d9206 100644
--- a/gstreamer/src/bin.ccg
+++ b/gstreamer/src/bin.ccg
@@ -23,6 +23,10 @@
 #include <gstreamermm/pad.h>
 #include <gstreamermm/iterator.h>
 
+#ifndef GLIBMM_EXCEPTIONS_ENABLED
+#include <iostream>
+#endif
+
 _PINCLUDE(glibmm/private/object_p.h)
 _PINCLUDE(gstreamermm/private/element_p.h)
 
@@ -33,11 +37,10 @@ Bin::Bin()
 : _CONSTRUCT("name", 0)
 {}
 
-
 Glib::RefPtr<Gst::Bin> Bin::add(const Glib::RefPtr<Gst::Element>& element)
 {
   if(!element)
-    throw std::runtime_error("Failed to add null element.");
+    handle_error("Failed to add null element.");
 
   GstElement* celement = Glib::unwrap(element);
 
@@ -55,27 +58,35 @@ Glib::RefPtr<Gst::Bin> Bin::add(const Glib::RefPtr<Gst::Element>& element)
 
   // If addition successful, return RefPtr<..> to this bin, otherwise throw an
   // exception
-  if(result)
-    return Glib::wrap(gobj(), true);
-  else
-    throw std::runtime_error("Failed to add " + element->get_name() +
-      " element.");
+  if(!result)
+    handle_error("Failed to add " + element->get_name() + " element.");
+
+  return Glib::wrap(gobj(), true);
 }
 
 Glib::RefPtr<Gst::Bin> Bin::remove(const Glib::RefPtr<Gst::Element>& element)
 {
   if(!element)
-    throw std::runtime_error("Failed to remove null element.");
+    handle_error("Failed to remove null element.");
+
 
   const bool result = gst_bin_remove(gobj(), Glib::unwrap(element));
 
   // If removal successful, return RefPtr<..> to this bin, otherwise throw an
   // exception
-  if(result)
-    return Glib::wrap(gobj(), true);
-  else
-    throw std::runtime_error("Failed to remove " + element->get_name() +
-      " element.");
+  if(!result)
+    handle_error("Failed to remove " + element->get_name() + " element.");
+
+  return Glib::wrap(gobj(), true);
+}
+
+void Bin::handle_error(const Glib::ustring& message)
+{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+    throw std::runtime_error(message);
+#else
+      std::cerr << "GStreamermm: " << message << std::endl;
+#endif
 }
 
 } //namespace Gst
diff --git a/gstreamer/src/bin.hg b/gstreamer/src/bin.hg
index aba29b9..6d5da33 100644
--- a/gstreamer/src/bin.hg
+++ b/gstreamer/src/bin.hg
@@ -162,6 +162,7 @@ public:
    * @throws std::runtime_error if the Bin does not want to accept the Element.
    */
   Glib::RefPtr<Gst::Bin> add(const Glib::RefPtr<Gst::Element>& element);
+
   _IGNORE(gst_bin_add, gst_bin_add_many)
 
   /** Removes the element from the bin, unparenting it as well. Unparenting the
@@ -249,6 +250,9 @@ public:
   /** Method to handle a message from the children.
    */
   _WRAP_VFUNC(void handle_message(const Glib::RefPtr<Gst::Message>& message), "handle_message")
+
+private:
+  void handle_error(const Glib::ustring& message);
 };
 
 } //namespace Gst
diff --git a/gstreamer/src/element.ccg b/gstreamer/src/element.ccg
index 40b7b79..cdf0be1 100644
--- a/gstreamer/src/element.ccg
+++ b/gstreamer/src/element.ccg
@@ -32,6 +32,10 @@
 #include <gstreamermm/taglist.h>
 #include <gstreamermm/iterator.h>
 
+#ifndef GLIBMM_EXCEPTIONS_ENABLED
+#include <iostream>
+#endif
+
 _PINCLUDE(gstreamermm/private/object_p.h)
 
 namespace Gst
@@ -60,27 +64,33 @@ Glib::ustring get_name(StateChangeReturn s)
 Glib::RefPtr<Gst::Element> Element::link(const Glib::RefPtr<Gst::Element>& dest)
 {
   if(!dest)
-    throw std::runtime_error("Failed to link null element.");
+    handle_error("Failed to link null element.");
     
   const bool result = gst_element_link(gobj(), dest->gobj());
 
   if(result)
     return dest;
   else
-    throw std::runtime_error("failed to link: " + get_name() + "->" + dest->get_name());
+  {
+    handle_error("failed to link: " + get_name() + "->" + dest->get_name());
+    return Glib::RefPtr<Gst::Element>();
+  }
 }
 
 Glib::RefPtr<Gst::Element> Element::link(const Glib::RefPtr<Gst::Element>& dest, const Glib::RefPtr<Gst::Caps>& filter)
 {
   if(!dest)
-    throw std::runtime_error("Failed to link null element.");
+    handle_error("Failed to link null element.");
     
   const bool result = gst_element_link_filtered(gobj(), dest->gobj(), filter->gobj());
 
   if(result)
     return dest;
   else
-    throw std::runtime_error("failed to link: " + get_name() + "->" + dest->get_name());
+  {
+    handle_error("failed to link: " + get_name() + "->" + dest->get_name());
+    return Glib::RefPtr<Gst::Element>();
+  }
 }
 
 void Element::post_message(int code, int line, MessageType type,
@@ -228,4 +238,13 @@ Glib::ArrayHandle<QueryType> Gst::Element::get_query_types_vfunc() const
 }
 #endif //GLIBMM_VFUNCS_ENABLED
 
+void Element::handle_error(const Glib::ustring& message)
+{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+    throw std::runtime_error(message);
+#else
+    std::cerr << "GStreamermm: " << message << std::endl;
+#endif
+}
+
 } //namespace Gst
diff --git a/gstreamer/src/element.hg b/gstreamer/src/element.hg
index a635143..873c017 100644
--- a/gstreamer/src/element.hg
+++ b/gstreamer/src/element.hg
@@ -413,6 +413,10 @@ protected:
   static const GstQueryType* get_query_types_vfunc_callback(GstElement* self);
   _POP()
 #m4end
+
+private:
+  void handle_error(const Glib::ustring& message);
+  
 };
 
 /** Templated class used for casting Gst::Element to interfaces that its
diff --git a/gstreamer/src/ghostpad.ccg b/gstreamer/src/ghostpad.ccg
index 372f8fe..5b78348 100644
--- a/gstreamer/src/ghostpad.ccg
+++ b/gstreamer/src/ghostpad.ccg
@@ -22,6 +22,10 @@
 #include <gst/gstghostpad.h>
 #include <gstreamermm/padtemplate.h>
 
+#ifndef GLIBMM_EXCEPTIONS_ENABLED
+#include <iostream>
+#endif
+
 _PINCLUDE(gstreamermm/private/pad_p.h)
 
 namespace Gst
@@ -34,14 +38,14 @@ GhostPad::GhostPad(const Glib::ustring& name,
     ((target) ? ((GstPadDirection) target->get_direction()) : GST_PAD_UNKNOWN))
 {
   if(!target)
-    throw std::runtime_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
+    handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Gst::Pad>&): "
       "Failed to construct ghost pad (name = " + name + ") from null target.");
 
   if(!gst_ghost_pad_construct(gobj()) ||
     !gst_ghost_pad_set_target(gobj(), target->gobj()))
   {
-    throw std::runtime_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
+    handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Gst::Pad>&): "
       "Unsuccessful construction of ghost pad (name = " + name +
       ", target = " + target->get_name() + ").");
@@ -56,7 +60,7 @@ GhostPad::GhostPad(const Glib::ustring& name, PadDirection direction)
     std::stringstream int_conv_stream;
     int_conv_stream << direction;
 
-    throw std::runtime_error("Gst::GhostPad::GhostPad(const Glib::ustring&, "
+    handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&, "
     "PadDirection): Unsuccessful construction of ghost pad (name = " +
     name + ", direction = " + int_conv_stream.str() + ").");
   }
@@ -70,7 +74,7 @@ GhostPad::GhostPad(const Glib::ustring& name,
   "template", ((templ) ? templ->gobj() : 0))
 {
   if(!target || !templ)
-    throw std::runtime_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
+    handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Gst::Pad>&, const Glib::RefPtr<Gst::PadTemplate>&):"
       " Failed to construct ghost pad (name = " + name + ") from null "
       "target or template.");
@@ -78,7 +82,7 @@ GhostPad::GhostPad(const Glib::ustring& name,
   if(!gst_ghost_pad_construct(gobj()) ||
     !gst_ghost_pad_set_target(gobj(), target->gobj()))
   {
-    throw std::runtime_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
+    handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Gst::Pad>&, const Glib::RefPtr<Gst::PadTemplate>&):"
       " Unsuccessful construction of ghost pad (name = " + name +
       ", target = " + target->get_name() + ", templ = " +
@@ -93,18 +97,27 @@ GhostPad::GhostPad(const Glib::ustring& name,
     "template", ((templ) ? templ->gobj() : 0))
 {
   if(!templ)
-    throw std::runtime_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
+    handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Gst::PadTemplate>&): "
       "Failed to construct ghost pad (name = " + name +
       ") from null template.");
 
   if(!gst_ghost_pad_construct(gobj()))
   {
-    throw std::runtime_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
+    handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Gst::PadTemplate>&): "
       "Unsuccessful construction of ghost pad (name = " + name +
       ", templ = " + templ->get_name_template() + ").");
   }
 }
 
+void GhostPad::handle_error(const Glib::ustring& message)
+{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+    throw std::runtime_error(message);
+#else
+      std::cerr << "GStreamermm: " << message << std::endl;
+#endif
+}
+
 } //namespace Gst
diff --git a/gstreamer/src/ghostpad.hg b/gstreamer/src/ghostpad.hg
index 0f5ec25..36d2f8d 100644
--- a/gstreamer/src/ghostpad.hg
+++ b/gstreamer/src/ghostpad.hg
@@ -128,6 +128,9 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<Gst::Pad> get_target(), gst_ghost_pad_get_target)
   _WRAP_METHOD(Glib::RefPtr<const Gst::Pad> get_target() const, gst_ghost_pad_get_target, constversion)
+
+private:
+  void handle_error(const Glib::ustring& message);
 };
 
 } // namespace Gst
diff --git a/tests/test-caps.cc b/tests/test-caps.cc
index 55a67d6..f85fa8e 100644
--- a/tests/test-caps.cc
+++ b/tests/test-caps.cc
@@ -91,7 +91,20 @@ int main (int argc, char* argv[])
   e1 = Gst::ElementFactory::create_element("fakesrc", "source");
   e2 = Gst::ElementFactory::create_element("fakesink", "sink");
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
+  {
+    pipeline->add(e1)->add(e2);
+  }
+  catch (std::runtime_error& ex)
+  {
+    std::cerr << "Exception while adding: " << ex.what() << std::endl;
+    return 1;
+  }
+#else
+  // Will report errors to stderr
   pipeline->add(e1)->add(e2);
+#endif
 
   if(!link_elements_with_filter(e1, e2))
     std::cerr << "Falied to link e1 and e2." << std::endl;
diff --git a/tests/test-init-check-noargs.cc b/tests/test-init-check-noargs.cc
index 9a1c084..cda5dd6 100644
--- a/tests/test-init-check-noargs.cc
+++ b/tests/test-init-check-noargs.cc
@@ -22,6 +22,7 @@
 
 int main (int argc, char* argv[])
 {
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     bool success = Gst::init_check();
@@ -38,7 +39,16 @@ int main (int argc, char* argv[])
     std::cout << "Error initializing gstreamermm." << std::endl;
     return -1;
   }
-
+#else
+  std::auto_ptr<Glib::Error> error;
+  bool success = Gst::init_check(error);
+  if(!success)
+  {
+    std::cout << "Error initializing gstreamermm." << std::endl;
+    if(error.get())
+      std::cout << "Error: " << error->what() << std::endl;
+  }
+#endif
   Glib::RefPtr<Gst::Element> element = Gst::ElementFactory::create_element("ximagesink", "videosink");
 
   if(element)
diff --git a/tests/test-init-check.cc b/tests/test-init-check.cc
index 6d473ec..f8edd52 100644
--- a/tests/test-init-check.cc
+++ b/tests/test-init-check.cc
@@ -23,6 +23,7 @@
 
 int main (int argc, char* argv[])
 {
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     bool success = Gst::init_check(argc, argv);
@@ -38,7 +39,16 @@ int main (int argc, char* argv[])
     std::cout << "Error initializing gstreamermm." << std::endl;
     return -1;
   }
-
+#else
+  std::auto_ptr<Glib::Error> error;
+  bool success = Gst::init_check(argc, argv, error);
+  if(!success)
+  {
+    std::cout << "Error initializing gstreamermm." << std::endl;
+    if(error.get())
+      std::cout << "Error: " << error->what() << std::endl;
+  }
+#endif
   Glib::RefPtr<Gst::Element> element = Gst::ElementFactory::create_element("ximagesink", "videosink");
 
   if(element)
diff --git a/tests/test-iterator.cc b/tests/test-iterator.cc
index 6b8066c..cd995ac 100644
--- a/tests/test-iterator.cc
+++ b/tests/test-iterator.cc
@@ -46,9 +46,10 @@ int main (int argc, char* argv[])
   int iterations = 0;
   Gst::Iterator<Gst::Element> elements = bin->iterate_elements();
   Gst::Iterator<Gst::Element> firstIter;
-
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
+#endif
     for(elements.begin(); !elements.is_end(); ++elements, ++iterations)
     {
       if(!firstIter)
@@ -64,12 +65,14 @@ int main (int argc, char* argv[])
     if(elements)
       std::cout << "elements.is_end() == true && (elements) is valid." <<
         std::endl;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
   catch(std::runtime_error& e)
   {
     std::cout << "Runtime error while iterating through \"" <<
       bin->get_name() << "'s\" elements:" << std::endl << e.what() << std::endl;
   }
+#endif
 
   std::cout << "The loop iterated " << iterations <<
     " time(s) to print bin '" << bin->get_name() << "' elements." << std::endl;
@@ -79,38 +82,45 @@ int main (int argc, char* argv[])
 
   Gst::IteratorBasic<const Gst::QueryTypeDefinition> queryTypes =
     Gst::Query::iterate_definitions();
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
+#endif
     for(++queryTypes; !queryTypes.is_end(); ++queryTypes)
     {
       std::cout << queryTypes->nick << " -- " << queryTypes->description <<
         "." << std::endl;
     }
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
   catch(std::runtime_error& e)
   {
     std::cout << "Runtime error while iterating through query types." <<
       std::endl << e.what() << std::endl;
   }
-
+#endif
   std::cout << std::endl <<
     "The following are standard GStreamer formats:" << std::endl;
 
   Gst::IteratorBasic<const Gst::FormatDefinition> formats =
     Gst::iterate_format_definitions();
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
+#endif
     for(++formats; !formats.is_end(); ++formats)
     {
       std::cout << formats->nick << " -- " << formats->description <<
         "." << std::endl;
     }
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
   catch(std::runtime_error& e)
   {
     std::cout << "Runtime error while iterating through formats." <<
       std::endl << e.what() << std::endl;
   }
-
+#endif
   return 0;
 }
diff --git a/tests/test-plugin-signals.cc b/tests/test-plugin-signals.cc
index b6f773c..78d3147 100644
--- a/tests/test-plugin-signals.cc
+++ b/tests/test-plugin-signals.cc
@@ -80,6 +80,7 @@ int main(int argc, char* argv[])
   }
 
   // Put all elements in a bin:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     pipeline->add(source)->add(sink);
@@ -91,6 +92,10 @@ int main(int argc, char* argv[])
 
     return -1;
   }
+#else
+  // Errors will go to stdout
+  pipeline->add(source)->add(sink);
+#endif
 
   // Link together:
   source->link(sink);
@@ -99,10 +104,18 @@ int main(int argc, char* argv[])
   pipeline->get_bus()->add_watch(sigc::ptr_fun(&on_bus_message));
 
   // Set number of buffers fakesink creates to low number:
+#ifdef GLIBMM_PROPERTIES_ENABLED
   source->property_num_buffers() = 5;
+#else
+  source->set_property("num_buffers", 5);
+#endif
 
   // Enable the fakesink handoff signal emition and connect slot:
+#ifdef GLIBMM_PROPERTIES_ENABLED
   sink->property_signal_handoffs() = true;
+#else
+  sink->set_property("signal_handoffs", true);
+#endif
   sink->signal_handoff().connect(sigc::ptr_fun(on_handoff));
 
   // Now set to playing and iterate:
diff --git a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
index 74419d0..5ffd767 100644
--- a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
+++ b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
@@ -659,17 +659,27 @@ int main(int argc, char* argv[])
 
   Glib::OptionContext optionContext(gContext, true);
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     if(!optionContext.parse(argc, argv))
+#else
+    std::auto_ptr<Glib::Error> error;
+    if (!optionContext.parse(argc, argv, error))
+#endif
     {
       std::cout << "Error parsing options and initializing.  Sorry." <<
         std::endl;
       return -1;
     }
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
   catch(Glib::OptionError& error)
   {
+#else 
+  if (error.get())
+  {
+#endif
       std::cout << "Error parsing options and initializing GStreamer." <<
         std::endl << "Run `" << argv[0] << " -?'  for a list of options." <<
         std::endl;



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