Use G_DEFINE_BOXED_TYPE

Bug #627214.
This commit is contained in:
Christian Persch 2010-04-27 13:31:23 +02:00
parent f730af8360
commit ffa07ee21e
16 changed files with 59 additions and 224 deletions

View File

@ -31,7 +31,7 @@ m4_define([gtk_api_version], [3.0])
m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.25.11])
m4_define([glib_required_version], [2.25.15])
m4_define([pango_required_version], [1.20])
m4_define([atk_required_version], [1.29.2])
m4_define([cairo_required_version], [1.9.10])

View File

@ -58,18 +58,10 @@ stock_item_info_copy (StockItemInfo *src)
return info;
}
static GType
stock_item_info_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static ("StockItemInfo",
(GBoxedCopyFunc) stock_item_info_copy,
(GBoxedFreeFunc) stock_item_info_free);
return our_type;
}
static
G_DEFINE_BOXED_TYPE (StockItemInfo, stock_item_info,
stock_item_info_copy,
stock_item_info_free)
typedef struct _StockItemDisplay StockItemDisplay;
struct _StockItemDisplay

View File

@ -156,17 +156,9 @@ gdk_color_equal (const GdkColor *colora,
(colora->blue == colorb->blue));
}
GType
gdk_color_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (g_intern_static_string ("GdkColor"),
(GBoxedCopyFunc)gdk_color_copy,
(GBoxedFreeFunc)gdk_color_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GdkColor, gdk_color,
gdk_color_copy,
gdk_color_free)
/**
* gdk_color_parse:

View File

@ -30,17 +30,9 @@
#include "gdkinternals.h"
GType
gdk_cursor_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (g_intern_static_string ("GdkCursor"),
(GBoxedCopyFunc)gdk_cursor_ref,
(GBoxedFreeFunc)gdk_cursor_unref);
return our_type;
}
G_DEFINE_BOXED_TYPE (GdkCursor, gdk_cursor,
gdk_cursor_ref,
gdk_cursor_unref)
/**
* gdk_cursor_ref:

View File

@ -1512,17 +1512,9 @@ gdk_display_set_double_click_distance (GdkDisplay *display,
display->double_click_distance = distance;
}
GType
gdk_event_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (g_intern_static_string ("GdkEvent"),
(GBoxedCopyFunc)gdk_event_copy,
(GBoxedFreeFunc)gdk_event_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GdkEvent, gdk_event,
gdk_event_copy,
gdk_event_free)
/**
* gdk_setting_get:

View File

@ -122,14 +122,6 @@ gdk_rectangle_copy (const GdkRectangle *rectangle)
return result;
}
GType
gdk_rectangle_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (g_intern_static_string ("GdkRectangle"),
(GBoxedCopyFunc)gdk_rectangle_copy,
(GBoxedFreeFunc)g_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GdkRectangle, gdk_rectangle,
gdk_rectangle_copy,
g_free)

View File

@ -1290,18 +1290,9 @@ gtk_icon_set_unref (GtkIconSet *icon_set)
}
}
GType
gtk_icon_set_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkIconSet"),
(GBoxedCopyFunc) gtk_icon_set_ref,
(GBoxedFreeFunc) gtk_icon_set_unref);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkIconSet, gtk_icon_set,
gtk_icon_set_ref,
gtk_icon_set_unref)
/**
* gtk_icon_set_copy:
@ -1972,18 +1963,9 @@ gtk_icon_source_free (GtkIconSource *source)
g_free (source);
}
GType
gtk_icon_source_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkIconSource"),
(GBoxedCopyFunc) gtk_icon_source_copy,
(GBoxedFreeFunc) gtk_icon_source_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkIconSource, gtk_icon_source,
gtk_icon_source_copy,
gtk_icon_source_free)
static void
icon_source_clear (GtkIconSource *source)

View File

@ -2598,19 +2598,10 @@ icon_data_free (GtkIconData *icon_data)
/*
* GtkIconInfo
*/
GType
gtk_icon_info_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkIconInfo"),
(GBoxedCopyFunc) gtk_icon_info_copy,
(GBoxedFreeFunc) gtk_icon_info_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkIconInfo, gtk_icon_info,
gtk_icon_info_copy,
gtk_icon_info_free)
static GtkIconInfo *
icon_info_new (void)

View File

@ -47,17 +47,9 @@ struct _GtkPaperSize
gboolean is_custom;
};
GType
gtk_paper_size_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkPaperSize"),
(GBoxedCopyFunc)gtk_paper_size_copy,
(GBoxedFreeFunc)gtk_paper_size_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkPaperSize, gtk_paper_size,
gtk_paper_size_copy,
gtk_paper_size_free)
static const PaperInfo *
lookup_paper_info (const gchar *name)

View File

@ -1367,17 +1367,9 @@ gtk_recent_manager_clamp_to_age (GtkRecentManager *manager,
* GtkRecentInfo *
*****************/
GType
gtk_recent_info_get_type (void)
{
static GType info_type = 0;
if (!info_type)
info_type = g_boxed_type_register_static (I_("GtkRecentInfo"),
(GBoxedCopyFunc) gtk_recent_info_ref,
(GBoxedFreeFunc) gtk_recent_info_unref);
return info_type;
}
G_DEFINE_BOXED_TYPE (GtkRecentInfo, gtk_recent_info,
gtk_recent_info_ref,
gtk_recent_info_unref)
static GtkRecentInfo *
gtk_recent_info_new (const gchar *uri)

View File

@ -3110,31 +3110,13 @@ gtk_selection_data_free (GtkSelectionData *data)
g_slice_free (GtkSelectionData, data);
}
GType
gtk_selection_data_get_type (void)
{
static GType our_type = 0;
G_DEFINE_BOXED_TYPE (GtkSelectionData, gtk_selection_data,
gtk_selection_data_copy,
gtk_selection_data_free)
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkSelectionData"),
(GBoxedCopyFunc) gtk_selection_data_copy,
(GBoxedFreeFunc) gtk_selection_data_free);
return our_type;
}
GType
gtk_target_list_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkTargetList"),
(GBoxedCopyFunc) gtk_target_list_ref,
(GBoxedFreeFunc) gtk_target_list_unref);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkTargetList, gtk_target_list,
gtk_target_list_ref,
gtk_target_list_unref)
static int
gtk_selection_bytes_per_item (gint format)

View File

@ -5667,18 +5667,9 @@ gtk_border_free (GtkBorder *border)
g_slice_free (GtkBorder, border);
}
GType
gtk_border_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkBorder"),
(GBoxedCopyFunc) gtk_border_copy,
(GBoxedFreeFunc) gtk_border_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkBorder, gtk_border,
gtk_border_copy,
gtk_border_free)
typedef struct _CursorInfo CursorInfo;

View File

@ -444,18 +444,9 @@ gtk_text_iter_free (GtkTextIter *iter)
g_slice_free (GtkTextIter, iter);
}
GType
gtk_text_iter_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkTextIter"),
(GBoxedCopyFunc) gtk_text_iter_copy,
(GBoxedFreeFunc) gtk_text_iter_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkTextIter, gtk_text_iter,
gtk_text_iter_copy,
gtk_text_iter_free)
GtkTextLineSegment*
_gtk_text_iter_get_indexable_segment (const GtkTextIter *iter)

View File

@ -1883,18 +1883,9 @@ gtk_text_attributes_copy (GtkTextAttributes *src)
return dest;
}
GType
gtk_text_attributes_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkTextAttributes"),
(GBoxedCopyFunc) gtk_text_attributes_ref,
(GBoxedFreeFunc) gtk_text_attributes_unref);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkTextAttributes, gtk_text_attributes,
gtk_text_attributes_ref,
gtk_text_attributes_unref)
/**
* gtk_text_attributes_copy_values:

View File

@ -684,18 +684,9 @@ gtk_tree_path_copy (const GtkTreePath *path)
return retval;
}
GType
gtk_tree_path_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkTreePath"),
(GBoxedCopyFunc) gtk_tree_path_copy,
(GBoxedFreeFunc) gtk_tree_path_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkTreePath, gtk_tree_path,
gtk_tree_path_copy,
gtk_tree_path_free)
/**
* gtk_tree_path_compare:
@ -913,18 +904,9 @@ gtk_tree_iter_free (GtkTreeIter *iter)
g_slice_free (GtkTreeIter, iter);
}
GType
gtk_tree_iter_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkTreeIter"),
(GBoxedCopyFunc) gtk_tree_iter_copy,
(GBoxedFreeFunc) gtk_tree_iter_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkTreeIter, gtk_tree_iter,
gtk_tree_iter_copy,
gtk_tree_iter_free)
/**
* gtk_tree_model_get_flags:
@ -1666,19 +1648,9 @@ static void gtk_tree_row_reference_unref_path (GtkTreePath *path,
gint depth);
GType
gtk_tree_row_reference_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkTreeRowReference"),
(GBoxedCopyFunc) gtk_tree_row_reference_copy,
(GBoxedFreeFunc) gtk_tree_row_reference_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkTreeRowReference, gtk_tree_row_reference,
gtk_tree_row_reference_copy,
gtk_tree_row_reference_free)
struct _GtkTreeRowReference
{

View File

@ -10291,18 +10291,9 @@ gtk_requisition_free (GtkRequisition *requisition)
g_slice_free (GtkRequisition, requisition);
}
GType
gtk_requisition_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (I_("GtkRequisition"),
(GBoxedCopyFunc) gtk_requisition_copy,
(GBoxedFreeFunc) gtk_requisition_free);
return our_type;
}
G_DEFINE_BOXED_TYPE (GtkRequisition, gtk_requisition,
gtk_requisition_copy,
gtk_requisition_free)
/**
* gtk_widget_get_accessible: