Commit 93369788 authored by Emmanuele Bassi's avatar Emmanuele Bassi

Start recursively moving autocleanups macros to their headers

* Cover letter

Having a single header file for all autocleanups definitions was a
reasonable stop-gap measure, but now GTK+ is starting to use G_DECLARE_*
macros. This means that every class using a G_DECLARE_* macro will need
to include "gtk.h" to avoid compiler warnings, which is not acceptable.

By moving the G_DEFINE_AUTO* use to the header that defines the type we
allow using the G_DECLARE_* macros without sacrificing the ability to
include only the needed files when deriving from a class.

* Commit

This commit changes all includes relative to GtkWindow to define their
own autocleanup macros.
parent d5891707
......@@ -22,7 +22,6 @@
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAboutDialog, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelGroup, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelLabel, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelMap, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccessible, g_object_unref)
......@@ -33,11 +32,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooser, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserButton, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserDialog, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserWidget, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplicationWindow, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAspectFrame, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAssistant, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBin, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBox, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBuildable, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBuilder, g_object_unref)
......@@ -68,7 +65,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserDialog, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserWidget, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBox, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBoxText, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkContainer, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCssProvider, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDialog, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDrawingArea, g_object_unref)
......@@ -202,11 +198,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeView, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeViewColumn, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkViewport, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkVolumeButton, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBorder, gtk_border_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPaperSize, gtk_paper_size_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSelectionData, gtk_selection_data_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTargetList, gtk_target_list_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextAttributes, gtk_text_attributes_unref)
......
......@@ -242,6 +242,10 @@ struct _GtkAccelGroupEntry
GQuark accel_path_quark;
};
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelGroup, g_object_unref)
#endif
G_END_DECLS
#endif /* __GTK_ACCEL_GROUP_H__ */
......@@ -162,6 +162,10 @@ GDK_AVAILABLE_IN_3_14
GMenu * gtk_application_get_menu_by_id (GtkApplication *application,
const gchar *id);
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref)
#endif
G_END_DECLS
#endif /* __GTK_APPLICATION_H__ */
......@@ -32,7 +32,6 @@
#include <gtk/gtkcontainer.h>
G_BEGIN_DECLS
#define GTK_TYPE_BIN (gtk_bin_get_type ())
......@@ -82,6 +81,10 @@ GtkWidget *gtk_bin_get_child (GtkBin *bin);
void _gtk_bin_set_child (GtkBin *bin,
GtkWidget *widget);
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBin, g_object_unref)
#endif
G_END_DECLS
#endif /* __GTK_BIN_H__ */
......@@ -65,6 +65,9 @@ GtkBorder *gtk_border_copy (const GtkBorder *border_);
GDK_AVAILABLE_IN_ALL
void gtk_border_free (GtkBorder *border_);
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBorder, gtk_border_free)
#endif
G_END_DECLS
......
......@@ -32,7 +32,6 @@
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
......@@ -300,6 +299,10 @@ GDK_AVAILABLE_IN_ALL
GtkWidgetPath * gtk_container_get_path_for_child (GtkContainer *container,
GtkWidget *child);
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkContainer, g_object_unref)
#endif
G_END_DECLS
#endif /* __GTK_CONTAINER_H__ */
......@@ -1490,6 +1490,11 @@ void gtk_widget_set_font_map (GtkWidget *
GDK_AVAILABLE_IN_3_18
PangoFontMap * gtk_widget_get_font_map (GtkWidget *widget);
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
#endif
G_END_DECLS
#endif /* __GTK_WIDGET_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment