gtkmm r1121 - in branches/gtkmm-2-12: . demos/gtk-demo examples/book/builder/basic examples/book/builder/derived examples/book/custom/custom_widget examples/book/printing/advanced examples/book/printing/simple examples/book/tooltips examples/book/treeview/popup examples/gdk gtk/src



Author: daniel
Date: Mon Mar 23 15:49:09 2009
New Revision: 1121
URL: http://svn.gnome.org/viewvc/gtkmm?rev=1121&view=rev

Log:
Fix --disable-api-exceptions build

* gtk/src/builder.{ccg,hg}: Conditionalize all exception handling
code in order to fix the build with --disable-api-exceptions.
* gtk/src/printjob.hg: ditto,
* demos/gtk-demo/example_images.cc: ditto,
* demos/gtk-demo/example_treeview_treestore.cc: ditto,
* examples/book/builder/basic/main.cc: ditto,
* examples/book/builder/derived/main.cc: ditto,
* examples/book/custom/custom_widget/mywidget.{cc,h}: ditto,
* examples/book/printing/advanced/examplewindow.cc: ditto,
* examples/book/printing/advanced/previewdialog.cc: ditto,
* examples/book/printing/simple/examplewindow.cc: ditto,
* examples/book/tooltips/examplewindow.cc: ditto,
* examples/book/treeview/popup/treeview_withpopup.cc: ditto,
* examples/gdk/radar.cc: ditto.

Modified:
   branches/gtkmm-2-12/ChangeLog
   branches/gtkmm-2-12/demos/gtk-demo/example_images.cc
   branches/gtkmm-2-12/demos/gtk-demo/example_treeview_treestore.cc
   branches/gtkmm-2-12/examples/book/builder/basic/main.cc
   branches/gtkmm-2-12/examples/book/builder/derived/main.cc
   branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.cc
   branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.h
   branches/gtkmm-2-12/examples/book/printing/advanced/examplewindow.cc
   branches/gtkmm-2-12/examples/book/printing/advanced/previewdialog.cc
   branches/gtkmm-2-12/examples/book/printing/simple/examplewindow.cc
   branches/gtkmm-2-12/examples/book/tooltips/examplewindow.cc
   branches/gtkmm-2-12/examples/book/treeview/popup/treeview_withpopup.cc
   branches/gtkmm-2-12/examples/gdk/radar.cc
   branches/gtkmm-2-12/gtk/src/builder.ccg
   branches/gtkmm-2-12/gtk/src/builder.hg
   branches/gtkmm-2-12/gtk/src/printjob.hg

Modified: branches/gtkmm-2-12/demos/gtk-demo/example_images.cc
==============================================================================
--- branches/gtkmm-2-12/demos/gtk-demo/example_images.cc	(original)
+++ branches/gtkmm-2-12/demos/gtk-demo/example_images.cc	Mon Mar 23 15:49:09 2009
@@ -261,7 +261,7 @@
     {
     #else
     std::auto_ptr<Glib::Error> error;
-    m_image_stream = Glib::IOChannel::create_from_file(demo_find_file("alphatest.png)", "r", error);
+    m_image_stream = Glib::IOChannel::create_from_file(demo_find_file("alphatest.png"), "r", error);
     if(error.get())
     {
     #endif //GLIBMM_EXCEPTIONS_ENABLED

Modified: branches/gtkmm-2-12/demos/gtk-demo/example_treeview_treestore.cc
==============================================================================
--- branches/gtkmm-2-12/demos/gtk-demo/example_treeview_treestore.cc	(original)
+++ branches/gtkmm-2-12/demos/gtk-demo/example_treeview_treestore.cc	Mon Mar 23 15:49:09 2009
@@ -173,6 +173,9 @@
   add_columns();
   m_ScrolledWindow.add(m_TreeView);
 
+#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+  signal_realize().connect(sigc::mem_fun(*this, &Example_TreeView_TreeStore::on_realize), false);
+#endif
   show_all();
 }
 
@@ -475,8 +478,9 @@
 void Example_TreeView_TreeStore::on_realize()
 {
   m_TreeView.expand_all();
-
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
   //call base class:
   Window::on_realize();
+#endif
 }
 

Modified: branches/gtkmm-2-12/examples/book/builder/basic/main.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/builder/basic/main.cc	(original)
+++ branches/gtkmm-2-12/examples/book/builder/basic/main.cc	Mon Mar 23 15:49:09 2009
@@ -3,6 +3,7 @@
 
 Gtk::Dialog* pDialog = 0;
 
+static
 void on_button_clicked()
 {
   if(pDialog)
@@ -15,6 +16,7 @@
 
   //Load the GtkBuilder file and instantiate its widgets:
   Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     refBuilder->add_from_file("basic.ui");
@@ -24,6 +26,15 @@
     std::cerr << ex.what() << std::endl;
     return 1;
   }
+#else
+  std::auto_ptr<Glib::Error> error;
+
+  if (!refBuilder->add_from_file("basic.ui", error))
+  {
+    std::cerr << error->what() << std::endl;
+    return 1;
+  }
+#endif /* !GLIBMM_EXCEPTIONS_ENABLED */
 
   //Get the GtkBuilder-instantiated Dialog:
   
@@ -43,4 +54,3 @@
 
   return 0;
 }
-

Modified: branches/gtkmm-2-12/examples/book/builder/derived/main.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/builder/derived/main.cc	(original)
+++ branches/gtkmm-2-12/examples/book/builder/derived/main.cc	Mon Mar 23 15:49:09 2009
@@ -25,6 +25,7 @@
 
   //Load the Glade file and instiate its widgets:
   Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     refBuilder->add_from_file("basic.ui");
@@ -34,6 +35,15 @@
     std::cerr << ex.what() << std::endl;
     return 1;
   }
+#else
+  std::auto_ptr<Glib::Error> error;
+
+  if (!refBuilder->add_from_file("basic.ui", error))
+  {
+    std::cerr << error->what() << std::endl;
+    return 1;
+  }
+#endif /* !GLIBMM_EXCEPTIONS_ENABLED */
 
   //Get the GtkBuilder-instantiated dialog::
   DerivedDialog* pDialog = 0;
@@ -49,4 +59,3 @@
 
   return 0;
 }
-

Modified: branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.cc	(original)
+++ branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.cc	Mon Mar 23 15:49:09 2009
@@ -57,6 +57,7 @@
 {
 }
 
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 void MyWidget::on_size_request(Gtk::Requisition* requisition)
 {
   //Initialize the output parameter:
@@ -196,3 +197,4 @@
   }
   return true;
 }
+#endif /* GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED */

Modified: branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.h
==============================================================================
--- branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.h	(original)
+++ branches/gtkmm-2-12/examples/book/custom/custom_widget/mywidget.h	Mon Mar 23 15:49:09 2009
@@ -29,6 +29,7 @@
 
 protected:
 
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
   //Overrides:
   virtual void on_size_request(Gtk::Requisition* requisition);
   virtual void on_size_allocate(Gtk::Allocation& allocation);
@@ -37,6 +38,7 @@
   virtual void on_realize();
   virtual void on_unrealize();
   virtual bool on_expose_event(GdkEventExpose* event);
+#endif /* GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED */
 
   Glib::RefPtr<Gdk::Window> m_refGdkWindow;
 

Modified: branches/gtkmm-2-12/examples/book/printing/advanced/examplewindow.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/printing/advanced/examplewindow.cc	(original)
+++ branches/gtkmm-2-12/examples/book/printing/advanced/examplewindow.cc	Mon Mar 23 15:49:09 2009
@@ -222,7 +222,7 @@
   //after it has been completed.
   print->signal_done().connect(sigc::bind(sigc::mem_fun(*this,
                   &ExampleWindow::on_printoperation_done), &print));
-
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     print->run(print_action /* print or preview */, *this);
@@ -233,6 +233,16 @@
     std::cerr << "An error occurred while trying to run a print operation:"
         << ex.what() << std::endl;
   }
+#else
+  std::auto_ptr<Glib::Error> error;
+  print->run(print_action /* print or preview */, *this, error);
+
+  if (error.get())
+  {
+    std::cerr << "An error occurred while trying to run a print operation:"
+              << error->what() << std::endl;
+  }
+#endif /* !GLIBMM_EXCEPTIONS_ENABLED */
 
   g_debug("print status: %s", print->get_status_string().c_str());
 }

Modified: branches/gtkmm-2-12/examples/book/printing/advanced/previewdialog.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/printing/advanced/previewdialog.cc	(original)
+++ branches/gtkmm-2-12/examples/book/printing/advanced/previewdialog.cc	Mon Mar 23 15:49:09 2009
@@ -108,8 +108,13 @@
 
 void PreviewDialog::on_popreview_ready(const Glib::RefPtr<Gtk::PrintContext>&)
 {
+#ifdef GLIBMM_PROPERTIES_ENABLED
   m_PageSpin.set_range(1.0, m_pOperation->property_n_pages());
-
+#else
+  int n_pages = 0;
+  m_pOperation->get_property("n-pages", n_pages);
+  m_PageSpin.set_range(1.0, n_pages);
+#endif
   m_DrawingArea.queue_draw();
 }
 

Modified: branches/gtkmm-2-12/examples/book/printing/simple/examplewindow.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/printing/simple/examplewindow.cc	(original)
+++ branches/gtkmm-2-12/examples/book/printing/simple/examplewindow.cc	Mon Mar 23 15:49:09 2009
@@ -217,7 +217,7 @@
 
   print->signal_done().connect(sigc::bind(sigc::mem_fun(*this,
                   &ExampleWindow::on_printoperation_done), print));
-
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     print->run(print_action /* print or preview */, *this);
@@ -228,6 +228,16 @@
     std::cerr << "An error occurred while trying to run a print operation:"
         << ex.what() << std::endl;
   }
+#else
+  std::auto_ptr<Glib::Error> ex;
+  print->run(print_action /* print or preview */, *this, ex);
+
+  if (ex.get())
+  {
+    std::cerr << "An error occurred while trying to run a print operation:"
+              << ex->what() << std::endl;
+  }
+#endif /* !GLIBMM_EXCEPTIONS_ENABLED */
 }
 
 void ExampleWindow::on_menu_file_new()

Modified: branches/gtkmm-2-12/examples/book/tooltips/examplewindow.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/tooltips/examplewindow.cc	(original)
+++ branches/gtkmm-2-12/examples/book/tooltips/examplewindow.cc	Mon Mar 23 15:49:09 2009
@@ -142,7 +142,12 @@
 
   if (keyboard_tooltip)
   {
+#ifdef GLIBMM_PROPERTIES_ENABLED
     int offset = m_ref_text_buffer->property_cursor_position().get_value();
+#else
+    int offset = 0;
+    m_ref_text_buffer->get_property("cursor-position", offset);
+#endif
     iter = m_ref_text_buffer->get_iter_at_offset(offset);
   }
   else

Modified: branches/gtkmm-2-12/examples/book/treeview/popup/treeview_withpopup.cc
==============================================================================
--- branches/gtkmm-2-12/examples/book/treeview/popup/treeview_withpopup.cc	(original)
+++ branches/gtkmm-2-12/examples/book/treeview/popup/treeview_withpopup.cc	Mon Mar 23 15:49:09 2009
@@ -54,6 +54,11 @@
       sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) ) );
   }
   m_Menu_Popup.accelerate(*this);
+
+#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+  signal_button_press_event()
+    .connect(sigc::mem_fun(*this, &TreeView_WithPopup::on_button_press_event), false);
+#endif
 }
 
 TreeView_WithPopup::~TreeView_WithPopup()
@@ -62,9 +67,13 @@
 
 bool TreeView_WithPopup::on_button_press_event(GdkEventButton* event)
 {
+  bool return_value = false;
+
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
   //Call base class, to allow normal handling,
   //such as allowing the row to be selected by the right-click:
-  bool return_value = TreeView::on_button_press_event(event);
+  return_value = TreeView::on_button_press_event(event);
+#endif
 
   //Then do our custom stuff:
   if( (event->type == GDK_BUTTON_PRESS) && (event->button == 3) )

Modified: branches/gtkmm-2-12/examples/gdk/radar.cc
==============================================================================
--- branches/gtkmm-2-12/examples/gdk/radar.cc	(original)
+++ branches/gtkmm-2-12/examples/gdk/radar.cc	Mon Mar 23 15:49:09 2009
@@ -100,6 +100,11 @@
   alpha = 0.0;
 
   add_events(Gdk::EXPOSURE_MASK);
+
+#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+  signal_realize().connect(sigc::mem_fun(*this, &PPI::on_realize));
+  signal_expose_event().connect(sigc::mem_fun(*this, &PPI::on_expose_event));
+#endif
 }
 
 
@@ -110,9 +115,10 @@
 
 void PPI::on_realize()
 {
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
   // We need to call the base on_realize()
   Gtk::DrawingArea::on_realize();
-
+#endif
   // Now we can allocate any additional resources we need
   Glib::RefPtr<Gdk::Window> window = get_window();
 

Modified: branches/gtkmm-2-12/gtk/src/builder.ccg
==============================================================================
--- branches/gtkmm-2-12/gtk/src/builder.ccg	(original)
+++ branches/gtkmm-2-12/gtk/src/builder.ccg	Mon Mar 23 15:49:09 2009
@@ -46,7 +46,8 @@
 namespace Gtk
 {
 
-//static
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+// static
 Glib::RefPtr<Builder> Builder::create_from_file(const std::string& filename)
 {
   Glib::RefPtr<Builder> builder = Builder::create();
@@ -55,8 +56,20 @@
   else
     return Glib::RefPtr<Builder>();
 }
+#else
+Glib::RefPtr<Builder> Builder::create_from_file(const std::string& filename,
+                                                std::auto_ptr<Glib::Error>& error)
+{
+  Glib::RefPtr<Builder> builder = Builder::create();
+  if(builder->add_from_file(filename, error))
+    return builder;
+  else
+    return Glib::RefPtr<Builder>();
+}
+#endif /* !GLIBMM_EXCEPTIONS_ENABLED */
 
-//static
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+// static
 Glib::RefPtr<Builder> Builder::create_from_string(const Glib::ustring& buffer)
 {
   Glib::RefPtr<Builder> builder = Builder::create();
@@ -65,7 +78,17 @@
   else
     return Glib::RefPtr<Builder>();
 }
-
+#else
+Glib::RefPtr<Builder> Builder::create_from_string(const Glib::ustring& buffer,
+                                                  std::auto_ptr<Glib::Error>& error)
+{
+  Glib::RefPtr<Builder> builder = Builder::create();
+  if(builder->add_from_string(buffer, error))
+    return builder;
+  else
+    return Glib::RefPtr<Builder>();
+}
+#endif /* !GLIBMM_EXCEPTIONS_ENABLED */
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
 bool Builder::add_from_string(const Glib::ustring& buffer)

Modified: branches/gtkmm-2-12/gtk/src/builder.hg
==============================================================================
--- branches/gtkmm-2-12/gtk/src/builder.hg	(original)
+++ branches/gtkmm-2-12/gtk/src/builder.hg	Mon Mar 23 15:49:09 2009
@@ -60,8 +60,12 @@
    *
    * @newin2p12
    **/
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   static Glib::RefPtr<Builder> create_from_file(const std::string& filename);
-
+#else
+  static Glib::RefPtr<Builder> create_from_file(const std::string& filename,
+                                                std::auto_ptr<Glib::Error>& error);
+#endif
 
   /** Parses a string containing a GtkBuilder UI definition.
    *
@@ -71,8 +75,12 @@
    *
    * @newin2p12
    **/
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   static Glib::RefPtr<Builder> create_from_string(const Glib::ustring& buffer);
-
+#else
+  static Glib::RefPtr<Builder> create_from_string(const Glib::ustring& buffer,
+                                                  std::auto_ptr<Glib::Error>& error);
+#endif
   _WRAP_METHOD(bool add_from_file(const std::string& filename), gtk_builder_add_from_file, errthrow)
 
   /** Parses a string containing a GtkBuilder UI definition 

Modified: branches/gtkmm-2-12/gtk/src/printjob.hg
==============================================================================
--- branches/gtkmm-2-12/gtk/src/printjob.hg	(original)
+++ branches/gtkmm-2-12/gtk/src/printjob.hg	Mon Mar 23 15:49:09 2009
@@ -65,7 +65,7 @@
   #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<const Cairo::Surface>',`Cairo::RefPtr<Cairo::Surface>(new Cairo::Surface($3, false /* take reference */))')
 
   _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_surface(), gtk_print_job_get_surface, errthrow)
-  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_surface() const, gtk_print_job_get_surface, constversion, errthrow)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_surface() const, gtk_print_job_get_surface, errthrow)
 
   _WRAP_METHOD(void set_track_print_status(bool track_status = true), gtk_print_job_set_track_print_status)
   _WRAP_METHOD(bool get_track_print_status() const, gtk_print_job_get_track_print_status)



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