[gtkmm] PrintOperation: const and refcount fixes.



commit f862de4debcb32b86001a20e11e6595c860b12ba
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jun 28 08:54:54 2010 +0200

    PrintOperation: const and refcount fixes.
    
    * gtk/src/printoperation.hg: get_default_page_setup(),
        get_print_settings(): Use refreturn, fixing bug #622957 (Kjell Ahlstedt)
        and also make sure there are const and non-const methods.

 ChangeLog                 |    8 ++++++++
 gtk/src/printoperation.hg |   44 ++++++++++++++++++++++++--------------------
 2 files changed, 32 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6abdafc..98c4493 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-28  Murray Cumming  <murrayc murrayc com>
+
+	PrintOperation: const and refcount fixes.
+
+	* gtk/src/printoperation.hg: get_default_page_setup(),
+    get_print_settings(): Use refreturn, fixing bug #622957 (Kjell Ahlstedt)
+    and also make sure there are const and non-const methods.
+
 2010-06-24  Murray Cumming  <murrayc murrayc com>
 
 	Added some StatusBar and TextView methods.
diff --git a/gtk/src/printoperation.hg b/gtk/src/printoperation.hg
index 931e6ae..a28e517 100644
--- a/gtk/src/printoperation.hg
+++ b/gtk/src/printoperation.hg
@@ -38,18 +38,18 @@ _WRAP_GERROR(PrintError, GtkPrintError, GTK_PRINT_ERROR)
 /** @defgroup Printing Printing
  */
 
-/** PrintOperation is the high-level, portable printing API. It looks a bit different than other 
- * GTK+ dialogs such as the FileChooser, since some platforms don't expose enough infrastructure 
- * to implement a good print dialog. On such platforms, PrintOperation uses the native print 
+/** PrintOperation is the high-level, portable printing API. It looks a bit different than other
+ * GTK+ dialogs such as the FileChooser, since some platforms don't expose enough infrastructure
+ * to implement a good print dialog. On such platforms, PrintOperation uses the native print
  * dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see PrintUnixDialog.
  *
- * The typical way to use the high-level printing API is to create a PrintOperation object 
- * when the user chooses to print. Then you set some properties on it,such as the page size, any PrintSettings 
+ * The typical way to use the high-level printing API is to create a PrintOperation object
+ * when the user chooses to print. Then you set some properties on it,such as the page size, any PrintSettings
  * from previous print operations, the number of  pages, the current page, etc.
  *
- * Then you start the print operation by calling run(). It will then show a dialog to 
- * let the user select a printer and options. When the user finishes the dialog various signals will be 
- * emitted by the PrintOperation for you to handle, the main one being draw_page. You should then 
+ * Then you start the print operation by calling run(). It will then show a dialog to
+ * let the user select a printer and options. When the user finishes the dialog various signals will be
+ * emitted by the PrintOperation for you to handle, the main one being draw_page. You should then
  * render the page on the provided PrintContext using Cairo.
  *
  * @newin{2,10}
@@ -71,11 +71,15 @@ public:
 
   _WRAP_METHOD(void set_default_page_setup(const Glib::RefPtr<PageSetup>& default_page_setup),
                gtk_print_operation_set_default_page_setup)
-  _WRAP_METHOD(Glib::RefPtr<PageSetup> get_default_page_setup() const, gtk_print_operation_get_default_page_setup)
+
+  _WRAP_METHOD(Glib::RefPtr<PageSetup> get_default_page_setup(), gtk_print_operation_get_default_page_setup, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const PageSetup> get_default_page_setup() const, gtk_print_operation_get_default_page_setup, refreturn, constversion)
 
   _WRAP_METHOD(void set_print_settings(const Glib::RefPtr<PrintSettings>& print_settings),
                gtk_print_operation_set_print_settings)
-  _WRAP_METHOD(Glib::RefPtr<PrintSettings> get_print_settings() const, gtk_print_operation_get_print_settings, refreturn)
+
+  _WRAP_METHOD(Glib::RefPtr<PrintSettings> get_print_settings(), gtk_print_operation_get_print_settings, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const PrintSettings> get_print_settings() const, gtk_print_operation_get_print_settings, refreturn, constversion)
 
   _WRAP_METHOD(void set_job_name(const Glib::ustring& job_name), gtk_print_operation_set_job_name)
   _WRAP_METHOD(void set_n_pages(int n_pages), gtk_print_operation_set_n_pages)
@@ -100,8 +104,8 @@ public:
 
   _WRAP_METHOD(void draw_page_finish(), gtk_print_operation_draw_page_finish)
   _WRAP_METHOD(void set_defer_drawing(), gtk_print_operation_set_defer_drawing)
-  
-  
+
+
   _WRAP_METHOD(void set_support_selection(bool support_selection = true), gtk_print_operation_set_support_selection)
   _WRAP_METHOD(bool get_support_selection() const, gtk_print_operation_get_support_selection)
   _WRAP_METHOD(void set_has_selection(bool has_selection = true), gtk_print_operation_set_has_selection)
@@ -168,15 +172,15 @@ public:
 
   //TODO: Make these static members of a class instead of non-class functions?
 
-  //Note: gtk_run_page_setup_dialog() can take a null page_setup object, but the application should always 
+  //Note: gtk_run_page_setup_dialog() can take a null page_setup object, but the application should always
   //store and reuse a page_setup object, so I see no need to provide an overload for that. murrayc.
   //TODO: The parent parameter may also be null, so maybe we should add an overload for that.
 
-  /** Runs a page setup dialog, letting the user modify the values from page_setup. 
-   * If the user cancels the dialog, the returned PageSetup is identical to that passed in @a page_setup, 
+  /** Runs a page setup dialog, letting the user modify the values from page_setup.
+   * If the user cancels the dialog, the returned PageSetup is identical to that passed in @a page_setup,
    * otherwise it contains the modifications done in the dialog.
-   * 
-   * Note that this function may use a recursive mainloop to show the page setup dialog. 
+   *
+   * Note that this function may use a recursive mainloop to show the page setup dialog.
    * See run_page_setup_dialog_async() if this is a problem.
    *
    * @param parent Transient parent.
@@ -191,15 +195,15 @@ public:
                                                 const Glib::RefPtr<const PrintSettings>& print_settings);
   //TODO: Add overloads that don't take page_setup.
 
-  /** For example, 
+  /** For example,
    * void on_setup_done(const Glib::RefPtr<PageSetup>& page_setup);
    */
   typedef sigc::slot< void, const Glib::RefPtr<PageSetup>& > SlotPrintSetupDone;
 
   /** Runs a page setup dialog, letting the user modify the values from page_setup.
    *
-   * In contrast to run_page_setup_dialog(), this function returns after showing the 
-   * page setup dialog on platforms that support this, and calls the @a slot from a 
+   * In contrast to run_page_setup_dialog(), this function returns after showing the
+   * page setup dialog on platforms that support this, and calls the @a slot from a
    * signal handler for the ::response signal of the dialog.
    *
    * @param parent Transient parent.



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