[gtk+] Start recursively moving autocleanups macros to their headers



commit 93369788c907b9c61204ff377854729cd404e25f
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Nov 10 13:59:36 2015 +0000

    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.

 gtk/gtk-autocleanups.h |    7 -------
 gtk/gtkaccelgroup.h    |    4 ++++
 gtk/gtkapplication.h   |    4 ++++
 gtk/gtkbin.h           |    5 ++++-
 gtk/gtkborder.h        |    3 +++
 gtk/gtkcontainer.h     |    5 ++++-
 gtk/gtkwidget.h        |    5 +++++
 7 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtk-autocleanups.h b/gtk/gtk-autocleanups.h
index 60cccdd..089dd0a 100644
--- a/gtk/gtk-autocleanups.h
+++ b/gtk/gtk-autocleanups.h
@@ -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)
diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h
index 7e5eaf1..ce117f1 100644
--- a/gtk/gtkaccelgroup.h
+++ b/gtk/gtkaccelgroup.h
@@ -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__ */
diff --git a/gtk/gtkapplication.h b/gtk/gtkapplication.h
index b55d4a7..3cf905b 100644
--- a/gtk/gtkapplication.h
+++ b/gtk/gtkapplication.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__ */
diff --git a/gtk/gtkbin.h b/gtk/gtkbin.h
index bca7885..6322140 100644
--- a/gtk/gtkbin.h
+++ b/gtk/gtkbin.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__ */
diff --git a/gtk/gtkborder.h b/gtk/gtkborder.h
index b22ded7..362a7d0 100644
--- a/gtk/gtkborder.h
+++ b/gtk/gtkborder.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
 
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index d6cc8ed..da75f34 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -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__ */
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index d428917..208a9d1 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.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__ */


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