[gtkmm] Update for the latest gtk+4 (remove Gtk::RecentChooser)



commit 1d09952f0d564502c068a00af2f0718ee6562ec6
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed Feb 7 09:40:57 2018 +0100

    Update for the latest gtk+4 (remove Gtk::RecentChooser)
    
    GdkContentFormatsBuilder is now a boxed refcounted class. Make
    Gdk::ContentFormatsBuilder a _CLASS_OPAQUE_REFCOUNTED class.
    
    Remove Gtk::RecentChooser, RecentChooserDialog, RecentChooserMenu,
    RecentChooserWidget, RecentFilter, ToolItemGroup, ToolPalette.
    The underlying C classes have been removed.
    
    Remove Gtk::Widget::show_now(). gtk_widget_show_now() has been removed.

 .gitignore                        |   14 ---
 gdk/src/contentformatsbuilder.ccg |   48 -----------
 gdk/src/contentformatsbuilder.hg  |   62 ++++----------
 gtk/gtkmm.h                       |    6 --
 gtk/src/filelist.am               |    7 --
 gtk/src/recentchooser.ccg         |   70 ---------------
 gtk/src/recentchooser.hg          |  168 -------------------------------------
 gtk/src/recentchooserdialog.ccg   |   51 -----------
 gtk/src/recentchooserdialog.hg    |   62 --------------
 gtk/src/recentchoosermenu.ccg     |   23 -----
 gtk/src/recentchoosermenu.hg      |   57 -------------
 gtk/src/recentchooserwidget.ccg   |   23 -----
 gtk/src/recentchooserwidget.hg    |   51 -----------
 gtk/src/recentfilter.ccg          |   87 -------------------
 gtk/src/recentfilter.hg           |  110 ------------------------
 gtk/src/toolitemgroup.ccg         |   30 -------
 gtk/src/toolitemgroup.hg          |   92 --------------------
 gtk/src/toolpalette.ccg           |   27 ------
 gtk/src/toolpalette.hg            |   98 ---------------------
 gtk/src/widget.hg                 |    1 -
 tools/m4/convert_gdk.m4           |    3 +-
 21 files changed, 21 insertions(+), 1069 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index c7a2fc6..bb9adf1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -373,16 +373,6 @@ gtk/gtkmm/radiotoolbutton.cc
 gtk/gtkmm/radiotoolbutton.h
 gtk/gtkmm/range.cc
 gtk/gtkmm/range.h
-gtk/gtkmm/recentchooser.cc
-gtk/gtkmm/recentchooser.h
-gtk/gtkmm/recentchooserdialog.cc
-gtk/gtkmm/recentchooserdialog.h
-gtk/gtkmm/recentchoosermenu.cc
-gtk/gtkmm/recentchoosermenu.h
-gtk/gtkmm/recentchooserwidget.cc
-gtk/gtkmm/recentchooserwidget.h
-gtk/gtkmm/recentfilter.cc
-gtk/gtkmm/recentfilter.h
 gtk/gtkmm/recentinfo.cc
 gtk/gtkmm/recentinfo.h
 gtk/gtkmm/recentmanager.cc
@@ -471,10 +461,6 @@ gtk/gtkmm/toolbutton.cc
 gtk/gtkmm/toolbutton.h
 gtk/gtkmm/toolitem.cc
 gtk/gtkmm/toolitem.h
-gtk/gtkmm/toolitemgroup.cc
-gtk/gtkmm/toolitemgroup.h
-gtk/gtkmm/toolpalette.cc
-gtk/gtkmm/toolpalette.h
 gtk/gtkmm/toolshell.cc
 gtk/gtkmm/toolshell.h
 gtk/gtkmm/tooltip.cc
diff --git a/gdk/src/contentformatsbuilder.ccg b/gdk/src/contentformatsbuilder.ccg
index 97c16f5..1ce152f 100644
--- a/gdk/src/contentformatsbuilder.ccg
+++ b/gdk/src/contentformatsbuilder.ccg
@@ -13,51 +13,3 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
-
-namespace Gdk
-{
-ContentFormatsBuilder::ContentFormatsBuilder()
-: gobject_(gdk_content_formats_builder_new())
-{
-}
-
-ContentFormatsBuilder::ContentFormatsBuilder(GdkContentFormatsBuilder* castitem)
-: gobject_(castitem)
-{
-  // Always takes ownership - never takes copy.
-}
-
-ContentFormatsBuilder::ContentFormatsBuilder(ContentFormatsBuilder&& other) noexcept
-: gobject_(std::move(other.gobject_))
-{
-  other.gobject_ = nullptr;
-}
-
-ContentFormatsBuilder& ContentFormatsBuilder::operator=(ContentFormatsBuilder&& other) noexcept
-{
-  ContentFormatsBuilder temp(std::move(other));
-  std::swap(gobject_, temp.gobject_);
-  return *this;
-}
-
-ContentFormatsBuilder::~ContentFormatsBuilder()
-{
-  // The only way to destroy a GdkContentFormatsBuilder instance is to
-  // make a GdkContentFormats instance, and unref it.
-  if (gobj())
-    gdk_content_formats_unref(gdk_content_formats_builder_free(gobj()));
-}
-
-ContentFormatsBuilder::operator bool() const noexcept
-{
-  return gobj() != nullptr;
-}
-
-Glib::RefPtr<ContentFormats> ContentFormatsBuilder::make_content_formats()
-{
-  GdkContentFormats* formats = gdk_content_formats_builder_free(gobj());
-  gobject_ = nullptr;
-  return Glib::wrap(formats);
-}
-
-} // namespace Gdk
diff --git a/gdk/src/contentformatsbuilder.hg b/gdk/src/contentformatsbuilder.hg
index 918d52c..8d7ef0f 100644
--- a/gdk/src/contentformatsbuilder.hg
+++ b/gdk/src/contentformatsbuilder.hg
@@ -25,65 +25,41 @@ namespace Gdk
  *
  * @newin{3,94}
  */
-class ContentFormatsBuilder
+class ContentFormatsBuilder final
 {
-  _CLASS_GENERIC(ContentFormatsBuilder, GdkContentFormatsBuilder)
+  // ContentFormatsBuilder is registered as a boxed type, but it has custom
+  // reference-counting instead of copy/free functions, so we use it via RefPtr.
+  _CLASS_OPAQUE_REFCOUNTED(ContentFormatsBuilder, GdkContentFormatsBuilder, NONE, 
gdk_content_formats_builder_ref, gdk_content_formats_builder_unref)
+  _IGNORE(gdk_content_formats_builder_ref, gdk_content_formats_builder_unref)
+
 public:
+  // It's possible to specify gdk_content_formats_builder_new in the _CLASS_OPAQUE_REFCOUNTED()
+  // macro, and have the create() method generated from there, but then it would not
+  // be possible to add documentation to create().
   /** Creates a new %ContentFormatsBuilder object.
    *
    * The resulting builder would create an empty ContentFormats.
    * Use addition functions to add types to it.
+   *
+   * @return A new %ContentFormatsBuilder.
    */
-  ContentFormatsBuilder();
-  _IGNORE(gdk_content_formats_builder_new)
-
-  /** This always takes ownership of the underlying GdkContentFormatsBuilder,
-   * so it is only useful with C functions that return a newly-allocated GdkContentFormatsBuilder.
-   */
-  explicit ContentFormatsBuilder(GdkContentFormatsBuilder* castitem);
-
-  // noncopyable
-  ContentFormatsBuilder(const ContentFormatsBuilder& other) = delete;
-  ContentFormatsBuilder& operator=(const ContentFormatsBuilder& other) = delete;
-
-  // movable
-  ContentFormatsBuilder(ContentFormatsBuilder&& other) noexcept;
-  ContentFormatsBuilder& operator=(ContentFormatsBuilder&& other) noexcept;
-
-  ~ContentFormatsBuilder();
-
-  /** Checks whether the content formats builder is valid.
-   * For instance,
-   * @code
-   * if (builder)
-   *   do_something();
-   * @endcode
-   */
-  explicit operator bool() const noexcept;
+   _WRAP_METHOD(static Glib::RefPtr<ContentFormatsBuilder> create(), gdk_content_formats_builder_new)
 
   _WRAP_METHOD(void add_formats(const Glib::RefPtr<const ContentFormats>& formats),
     gdk_content_formats_builder_add_formats)
-  _WRAP_METHOD(void add_gtype(GType gtype), gdk_content_formats_builder_add_gtype)
   _WRAP_METHOD(void add_mime_type(const Glib::ustring& mime_type),
     gdk_content_formats_builder_add_mime_type)
+  _WRAP_METHOD(void add_gtype(GType gtype), gdk_content_formats_builder_add_gtype)
 
-  /** Makes a new Gdk::ContentFormats from the builder.
+  /** Creates a new Gdk::ContentFormats.
    *
-   * The builder becomes invalid. The only safe operations after a call
-   * to %make_content_formats() are operator bool() and the destructor.
+   * The %ContentFormatsBuilder is reset once this function returns;
+   * you cannot call this function multiple times on the same builder instance.
    *
-   * @return A new Gdk::ContentFormats with all the formats added to the builder.
+   * @return A newly created Gdk::ContentFormats with all the formats added to the builder.
    */
-  Glib::RefPtr<ContentFormats> make_content_formats();
-  _IGNORE(gdk_content_formats_builder_free)
-
-  /// Provides access to the underlying C object.
-  GdkContentFormatsBuilder* gobj() noexcept { return gobject_; }
-  /// Provides access to the underlying C object.
-  const GdkContentFormatsBuilder* gobj() const noexcept { return gobject_; }
-
-protected:
-  GdkContentFormatsBuilder* gobject_;
+  _WRAP_METHOD(Glib::RefPtr<ContentFormats> to_formats(), gdk_content_formats_builder_to_formats)
+  _IGNORE(gdk_content_formats_builder_free_to_formats)dnl// for C programmers
 };
 
 } // namespace Gdk
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 6fbd783..b192715 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -219,11 +219,6 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/radiomenuitem.h>
 #include <gtkmm/radiotoolbutton.h>
 #include <gtkmm/range.h>
-#include <gtkmm/recentchooser.h>
-#include <gtkmm/recentchooserdialog.h>
-#include <gtkmm/recentchoosermenu.h>
-#include <gtkmm/recentchooserwidget.h>
-#include <gtkmm/recentfilter.h>
 #include <gtkmm/recentinfo.h>
 #include <gtkmm/recentmanager.h>
 #include <gtkmm/revealer.h>
@@ -262,7 +257,6 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/toolbar.h>
 #include <gtkmm/toolitem.h>
 #include <gtkmm/toolbutton.h>
-#include <gtkmm/toolpalette.h>
 #include <gtkmm/toggletoolbutton.h>
 #include <gtkmm/menutoolbutton.h>
 #include <gtkmm/tooltip.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 9aa13fa..3682a86 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -135,11 +135,6 @@ gtkmm_files_any_hg =               \
        radiomenuitem.hg        \
        radiotoolbutton.hg      \
        range.hg                \
-       recentchooser.hg        \
-       recentchooserdialog.hg  \
-       recentchoosermenu.hg    \
-       recentchooserwidget.hg  \
-       recentfilter.hg         \
        recentinfo.hg           \
        recentmanager.hg        \
        requisition.hg          \
@@ -184,8 +179,6 @@ gtkmm_files_any_hg =                \
        toolbar.hg              \
        toolbutton.hg           \
        toolitem.hg             \
-       toolitemgroup.hg        \
-       toolpalette.hg          \
        toolshell.hg            \
        tooltip.hg              \
        treedragdest.hg         \
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 3a7c117..dd35c40 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -107,7 +107,6 @@ public:
   _DOCUMENT_DTOR(Destroys the widget. The widget will be automatically removed from the parent container.)
 
   _WRAP_METHOD(void show(), gtk_widget_show)
-  _WRAP_METHOD(void show_now(), gtk_widget_show_now)
   _WRAP_METHOD(void hide(), gtk_widget_hide)
 
 /* QUEUE DRAWS */
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index b307e87..9fb7f64 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -231,7 +231,7 @@ _CONVERSION(`GdkClipboard*',`Glib::RefPtr<const Clipboard>',`Glib::wrap($3)')
 _CONVERSION(`GdkClipboard*',`Glib::RefPtr<Gdk::Clipboard>',`Glib::wrap($3)')
 _CONVERSION(`GdkClipboard*',`Glib::RefPtr<const Gdk::Clipboard>',`Glib::wrap($3)')
 
-# ContentFormats
+# ContentFormats, ContentFormatsBuilder
 _CONVERSION(`const Glib::RefPtr<ContentFormats>&',`GdkContentFormats*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const ContentFormats>&',`GdkContentFormats*',__CONVERT_CONST_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const ContentFormats>&',`const GdkContentFormats*',__CONVERT_REFPTR_TO_P)
@@ -241,6 +241,7 @@ _CONVERSION(`GdkContentFormats*',`Glib::RefPtr<ContentFormats>',`Glib::wrap($3)'
 _CONVERSION(`GdkContentFormats*',`Glib::RefPtr<const ContentFormats>',`Glib::wrap($3)')
 _CONVERSION(`GdkContentFormats*',`Glib::RefPtr<Gdk::ContentFormats>',`Glib::wrap($3)')
 _CONVERSION(`GdkContentFormats*',`Glib::RefPtr<const Gdk::ContentFormats>',`Glib::wrap($3)')
+_CONVERSION(`GdkContentFormatsBuilder*',`Glib::RefPtr<ContentFormatsBuilder>',`Glib::wrap($3)')
 
 # ContentProvider
 _CONVERSION(`const Glib::RefPtr<ContentProvider>&',`GdkContentProvider*',__CONVERT_REFPTR_TO_P)


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