[gtkmm] ApplicationWindow: Define it as a _CLASS_GTKOBJECT
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] ApplicationWindow: Define it as a _CLASS_GTKOBJECT
- Date: Wed, 29 Jun 2016 16:18:50 +0000 (UTC)
commit b337eae49ed4f4cf49e83f88ef5fa925518a1943
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Wed Jun 29 18:12:40 2016 +0200
ApplicationWindow: Define it as a _CLASS_GTKOBJECT
By mistake, ApplicationWindow has been defined as a _CLASS_GOBJECT.
Define it as a _CLASS_GTKOBJECT, and add some temporary (until ABI-break)
fixes in order not to break ABI. Bug #767951
gtk/src/applicationwindow.ccg | 22 ++++++++++++++++++++++
gtk/src/applicationwindow.hg | 41 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 61 insertions(+), 2 deletions(-)
---
diff --git a/gtk/src/applicationwindow.ccg b/gtk/src/applicationwindow.ccg
index 1c26d23..f48337f 100644
--- a/gtk/src/applicationwindow.ccg
+++ b/gtk/src/applicationwindow.ccg
@@ -51,4 +51,26 @@ void ApplicationWindow::unset_help_overlay()
gtk_application_window_set_help_overlay(gobj(), nullptr);
}
+_DEPRECATE_IFDEF_START
+GtkApplicationWindow* ApplicationWindow::gobj_copy()
+{
+ reference();
+ return gobj();
+}
+_DEPRECATE_IFDEF_END
+
} // namespace Gtk
+
+_DEPRECATE_IFDEF_START
+namespace Glib
+{
+//TODO: This wrap() function is broken. Remove it at the next ABI-break.
+Glib::RefPtr<Gtk::ApplicationWindow> wrap(GtkApplicationWindow* object, bool take_copy)
+{
+ g_warning("Glib::wrap(GtkApplicationWindow*, bool) is broken. See the reference documentation.\n");
+ return
Glib::RefPtr<Gtk::ApplicationWindow>(dynamic_cast<Gtk::ApplicationWindow*>(Glib::wrap_auto((GObject*)(object),
take_copy)));
+ //We use dynamic_cast<> in case of multiple inheritance.
+}
+
+} /* namespace Glib */
+_DEPRECATE_IFDEF_END
diff --git a/gtk/src/applicationwindow.hg b/gtk/src/applicationwindow.hg
index 50d2f38..affa3d0 100644
--- a/gtk/src/applicationwindow.hg
+++ b/gtk/src/applicationwindow.hg
@@ -73,10 +73,13 @@ class ApplicationWindow
public Gio::ActionGroup,
public Gio::ActionMap
{
- _CLASS_GOBJECT(ApplicationWindow, GtkApplicationWindow, GTK_APPLICATION_WINDOW, Gtk::Window, GtkWindow)
+ //TODO: At the next ABI-break, remove _NO_WRAP_FUNCTION, and the hand-coded gobj_copy() and wrap().
+ // https://bugzilla.gnome.org/show_bug.cgi?id=767951
+ _CLASS_GTKOBJECT(ApplicationWindow, GtkApplicationWindow, GTK_APPLICATION_WINDOW, Gtk::Window, GtkWindow)
_IMPLEMENTS_INTERFACE(Gio::ActionGroup)
_IMPLEMENTS_INTERFACE(Gio::ActionMap)
-
+ _UNMANAGEABLE
+ _NO_WRAP_FUNCTION
public:
_CTOR_DEFAULT
explicit ApplicationWindow(const Glib::RefPtr<Application>& application);
@@ -84,6 +87,14 @@ dnl // Don't ignore gtk_application_window_new(). h2def.py erroneously classifie
dnl // it as a GtkApplication method, because its first parameter is a GtkApplication*.
dnl //_IGNORE(gtk_application_window_new)
+_DEPRECATE_IFDEF_START
+ /** Provides access to the underlying C instance.
+ * The caller is responsible for unrefing it. Use when directly setting fields in structs.
+ * @deprecated This method should never have been created.
+ */
+ GtkApplicationWindow* gobj_copy();
+_DEPRECATE_IFDEF_END
+
_WRAP_METHOD(void set_show_menubar(bool show_menubar = true), gtk_application_window_set_show_menubar)
_WRAP_METHOD(bool get_show_menubar() const, gtk_application_window_get_show_menubar)
@@ -101,3 +112,29 @@ dnl //_IGNORE(gtk_application_window_new)
};
} // namespace Gtk
+
+_DEPRECATE_IFDEF_START
+namespace Glib
+{
+ /** A Glib::wrap() method for this object.
+ *
+ * @note
+ * This wrap() function is broken. It will be fixed at the next ABI-break.
+ * It should return a Gtk::ApplicationWindow*. A workaround:
+ * @code
+ * GtkApplicationWindow* gtkappwin = some_func();
+ * Gtk::ApplicationWindow* appwinmm =
+ * dynamic_cast<Gtk::ApplicationWindow*>(Glib::wrap((GtkWindow*)gtkappwin, take_copy));
+ * @endcode
+ *
+ * @deprecated Use the workaround instead.
+ *
+ * @param object The C instance.
+ * @param take_copy False if the result should take ownership of the C instance. True if it should take a
new copy or ref.
+ * @result A C++ instance that wraps this C instance.
+ *
+ * @relates Gtk::ApplicationWindow
+ */
+ Glib::RefPtr<Gtk::ApplicationWindow> wrap(GtkApplicationWindow* object, bool take_copy = false);
+}
+_DEPRECATE_IFDEF_END
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]