gtkmm-documentation r85 - in trunk: . 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



Author: daniel
Date: Mon Mar 23 16:08:51 2009
New Revision: 85
URL: http://svn.gnome.org/viewvc/gtkmm-documentation?rev=85&view=rev

Log:
Fix --disable-api-exceptions build

* examples/book/builder/basic/main.cc: Conditionalize all exception
handling in order to fix the build with --disable-api-exceptions.
* 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,


Modified:
   trunk/ChangeLog
   trunk/examples/book/builder/basic/main.cc
   trunk/examples/book/builder/derived/main.cc
   trunk/examples/book/custom/custom_widget/mywidget.cc
   trunk/examples/book/custom/custom_widget/mywidget.h
   trunk/examples/book/printing/advanced/examplewindow.cc
   trunk/examples/book/printing/advanced/previewdialog.cc
   trunk/examples/book/printing/simple/examplewindow.cc
   trunk/examples/book/tooltips/examplewindow.cc
   trunk/examples/book/treeview/popup/treeview_withpopup.cc

Modified: trunk/examples/book/builder/basic/main.cc
==============================================================================
--- trunk/examples/book/builder/basic/main.cc	(original)
+++ trunk/examples/book/builder/basic/main.cc	Mon Mar 23 16:08:51 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");
@@ -29,6 +31,15 @@
     std::cerr << "BuilderError: " << 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:
   refBuilder->get_widget("DialogBasic", pDialog);
@@ -47,4 +58,3 @@
 
   return 0;
 }
-

Modified: trunk/examples/book/builder/derived/main.cc
==============================================================================
--- trunk/examples/book/builder/derived/main.cc	(original)
+++ trunk/examples/book/builder/derived/main.cc	Mon Mar 23 16:08:51 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");
@@ -39,6 +40,15 @@
     std::cerr << "BuilderError: " << 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;
@@ -54,4 +64,3 @@
 
   return 0;
 }
-

Modified: trunk/examples/book/custom/custom_widget/mywidget.cc
==============================================================================
--- trunk/examples/book/custom/custom_widget/mywidget.cc	(original)
+++ trunk/examples/book/custom/custom_widget/mywidget.cc	Mon Mar 23 16:08:51 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: trunk/examples/book/custom/custom_widget/mywidget.h
==============================================================================
--- trunk/examples/book/custom/custom_widget/mywidget.h	(original)
+++ trunk/examples/book/custom/custom_widget/mywidget.h	Mon Mar 23 16:08:51 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: trunk/examples/book/printing/advanced/examplewindow.cc
==============================================================================
--- trunk/examples/book/printing/advanced/examplewindow.cc	(original)
+++ trunk/examples/book/printing/advanced/examplewindow.cc	Mon Mar 23 16:08:51 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: trunk/examples/book/printing/advanced/previewdialog.cc
==============================================================================
--- trunk/examples/book/printing/advanced/previewdialog.cc	(original)
+++ trunk/examples/book/printing/advanced/previewdialog.cc	Mon Mar 23 16:08:51 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: trunk/examples/book/printing/simple/examplewindow.cc
==============================================================================
--- trunk/examples/book/printing/simple/examplewindow.cc	(original)
+++ trunk/examples/book/printing/simple/examplewindow.cc	Mon Mar 23 16:08:51 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: trunk/examples/book/tooltips/examplewindow.cc
==============================================================================
--- trunk/examples/book/tooltips/examplewindow.cc	(original)
+++ trunk/examples/book/tooltips/examplewindow.cc	Mon Mar 23 16:08:51 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: trunk/examples/book/treeview/popup/treeview_withpopup.cc
==============================================================================
--- trunk/examples/book/treeview/popup/treeview_withpopup.cc	(original)
+++ trunk/examples/book/treeview/popup/treeview_withpopup.cc	Mon Mar 23 16:08:51 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) )



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