Commit 0fa45e38 authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Cosimo Cecchi

Use G_DEFINE_TYPE_* instead of hand-written nautilus_foo_get_type()

2009-02-02  Cosimo Cecchi  <cosimoc@pluto>

	* libnautilus-extension/nautilus-column.c:
	(nautilus_column_finalize), (nautilus_column_init),
	(nautilus_column_class_init):
	* libnautilus-extension/nautilus-menu.c: (nautilus_menu_finalize):
	* libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.c:
	(nautilus_cell_renderer_pixbuf_emblem_class_init),
	(nautilus_cell_renderer_pixbuf_emblem_finalize):
	* libnautilus-private/nautilus-cell-renderer-text-ellipsized.c:
	(nautilus_cell_renderer_text_ellipsized_init),
	(nautilus_cell_renderer_text_ellipsized_class_init),
	(nautilus_cell_renderer_text_ellipsized_get_size):
	* libnautilus-private/nautilus-entry.c: (nautilus_entry_finalize),
	(nautilus_entry_key_press), (nautilus_entry_motion_notify),
	(nautilus_entry_button_press), (nautilus_entry_button_release),
	(nautilus_entry_selection_clear), (nautilus_entry_class_init):
	* libnautilus-private/nautilus-file.c: (nautilus_file_init),
	(nautilus_file_constructor), (finalize),
	(nautilus_file_class_init):
	* libnautilus-private/nautilus-icon-canvas-item.c:
	(nautilus_icon_canvas_item_finalize),
	(nautilus_icon_canvas_item_update),
	(nautilus_icon_canvas_item_class_init):
	* libnautilus-private/nautilus-icon-container.c:
	(nautilus_icon_container_new):
	* libnautilus-private/nautilus-icon-container.h:
	* libnautilus-private/nautilus-mime-application-chooser.c:
	(nautilus_mime_application_chooser_finalize),
	(nautilus_mime_application_chooser_destroy),
	(nautilus_mime_application_chooser_class_init),
	(nautilus_mime_application_chooser_init):
	* libnautilus-private/nautilus-open-with-dialog.c:
	(nautilus_open_with_dialog_finalize),
	(nautilus_open_with_dialog_destroy),
	(nautilus_open_with_dialog_class_init),
	(nautilus_open_with_dialog_init):
	* src/file-manager/fm-icon-container.c:
	* src/file-manager/fm-list-model.c: (fm_list_model_dispose),
	(fm_list_model_finalize), (fm_list_model_class_init):
	* src/file-manager/fm-tree-model.c: (fm_tree_model_finalize),
	(fm_tree_model_class_init):
	Use G_DEFINE_TYPE_* instead of hand-written nautilus_foo_get_type()
	functions where possible.

svn path=/trunk/; revision=14911
parent d24d8800
2009-02-02 Cosimo Cecchi <cosimoc@pluto>
* libnautilus-extension/nautilus-column.c:
(nautilus_column_finalize), (nautilus_column_init),
(nautilus_column_class_init):
* libnautilus-extension/nautilus-menu.c: (nautilus_menu_finalize):
* libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.c:
(nautilus_cell_renderer_pixbuf_emblem_class_init),
(nautilus_cell_renderer_pixbuf_emblem_finalize):
* libnautilus-private/nautilus-cell-renderer-text-ellipsized.c:
(nautilus_cell_renderer_text_ellipsized_init),
(nautilus_cell_renderer_text_ellipsized_class_init),
(nautilus_cell_renderer_text_ellipsized_get_size):
* libnautilus-private/nautilus-entry.c: (nautilus_entry_finalize),
(nautilus_entry_key_press), (nautilus_entry_motion_notify),
(nautilus_entry_button_press), (nautilus_entry_button_release),
(nautilus_entry_selection_clear), (nautilus_entry_class_init):
* libnautilus-private/nautilus-file.c: (nautilus_file_init),
(nautilus_file_constructor), (finalize),
(nautilus_file_class_init):
* libnautilus-private/nautilus-icon-canvas-item.c:
(nautilus_icon_canvas_item_finalize),
(nautilus_icon_canvas_item_update),
(nautilus_icon_canvas_item_class_init):
* libnautilus-private/nautilus-icon-container.c:
(nautilus_icon_container_new):
* libnautilus-private/nautilus-icon-container.h:
* libnautilus-private/nautilus-mime-application-chooser.c:
(nautilus_mime_application_chooser_finalize),
(nautilus_mime_application_chooser_destroy),
(nautilus_mime_application_chooser_class_init),
(nautilus_mime_application_chooser_init):
* libnautilus-private/nautilus-open-with-dialog.c:
(nautilus_open_with_dialog_finalize),
(nautilus_open_with_dialog_destroy),
(nautilus_open_with_dialog_class_init),
(nautilus_open_with_dialog_init):
* src/file-manager/fm-icon-container.c:
* src/file-manager/fm-list-model.c: (fm_list_model_dispose),
(fm_list_model_finalize), (fm_list_model_class_init):
* src/file-manager/fm-tree-model.c: (fm_tree_model_finalize),
(fm_tree_model_class_init):
Use G_DEFINE_TYPE_* instead of hand-written nautilus_foo_get_type()
functions where possible.
2009-02-02 Alexander Larsson <alexl@redhat.com>
* configure.in:
......
......@@ -45,7 +45,7 @@ struct _NautilusColumnDetails {
float xalign;
};
static GObjectClass *parent_class = NULL;
G_DEFINE_TYPE (NautilusColumn, nautilus_column, G_TYPE_OBJECT);
/**
* nautilus_column_new:
......@@ -170,11 +170,11 @@ nautilus_column_finalize (GObject *object)
g_free (column->details);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (nautilus_column_parent_class)->finalize (object);
}
static void
nautilus_column_instance_init (NautilusColumn *column)
nautilus_column_init (NautilusColumn *column)
{
column->details = g_new0 (NautilusColumnDetails, 1);
column->details->xalign = 0.0;
......@@ -183,8 +183,6 @@ nautilus_column_instance_init (NautilusColumn *column)
static void
nautilus_column_class_init (NautilusColumnClass *class)
{
parent_class = g_type_class_peek_parent (class);
G_OBJECT_CLASS (class)->finalize = nautilus_column_finalize;
G_OBJECT_CLASS (class)->get_property = nautilus_column_get_property;
G_OBJECT_CLASS (class)->set_property = nautilus_column_set_property;
......@@ -236,29 +234,3 @@ nautilus_column_class_init (NautilusColumnClass *class)
G_PARAM_READWRITE));
}
GType
nautilus_column_get_type (void)
{
static GType type = 0;
if (!type) {
const GTypeInfo info = {
sizeof (NautilusColumnClass),
NULL,
NULL,
(GClassInitFunc)nautilus_column_class_init,
NULL,
NULL,
sizeof (NautilusColumn),
0,
(GInstanceInitFunc)nautilus_column_instance_init
};
type = g_type_register_static
(G_TYPE_OBJECT,
"NautilusColumn",
&info, 0);
}
return type;
}
......@@ -28,6 +28,7 @@
#include <glib.h>
#define NAUTILUS_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NAUTILUS_TYPE_MENU, NautilusMenuPrivate))
G_DEFINE_TYPE (NautilusMenu, nautilus_menu, G_TYPE_OBJECT);
struct _NautilusMenuPrivate {
GList *item_list;
......@@ -70,13 +71,12 @@ static void
nautilus_menu_finalize (GObject *object)
{
NautilusMenu *this = NAUTILUS_MENU (object);
GObjectClass *parent_class = g_type_class_peek_parent (NAUTILUS_MENU_GET_CLASS (object));
if (this->private->item_list) {
g_list_free (this->private->item_list);
}
parent_class->finalize (object);
G_OBJECT_CLASS (nautilus_menu_parent_class)->finalize (object);
}
static void
......@@ -97,30 +97,6 @@ nautilus_menu_class_init (NautilusMenuClass *klass)
object_class->finalize = nautilus_menu_finalize;
}
GType
nautilus_menu_get_type (void)
{
static GType type = 0;
if(type == 0) {
const GTypeInfo info = {
sizeof (NautilusMenuClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) nautilus_menu_class_init,
(GClassFinalizeFunc) NULL,
NULL,
sizeof (NautilusMenu),
0,
(GInstanceInitFunc) nautilus_menu_init,
};
type = g_type_register_static (G_TYPE_OBJECT, "NautilusMenu", &info, 0);
}
return type;
}
/* public constructors */
NautilusMenu *
......
......@@ -67,8 +67,6 @@ enum {
PROP_PIXBUF_EMBLEM
};
static gpointer parent_class;
#define CELLINFO_KEY "nautilus-cell-renderer-pixbuf-emblem-info"
typedef struct _NautilusCellRendererPixbufEmblemInfo NautilusCellRendererPixbufEmblemInfo;
......@@ -79,32 +77,7 @@ struct _NautilusCellRendererPixbufEmblemInfo
gchar *stock_detail;
};
GType
nautilus_cell_renderer_pixbuf_emblem_get_type (void)
{
static GType cell_pixbuf_type = 0;
if (!cell_pixbuf_type) {
const GTypeInfo cell_pixbuf_info =
{
sizeof (NautilusCellRendererPixbufEmblemClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) nautilus_cell_renderer_pixbuf_emblem_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (NautilusCellRendererPixbufEmblem),
0, /* n_preallocs */
(GInstanceInitFunc) nautilus_cell_renderer_pixbuf_emblem_init,
};
cell_pixbuf_type = g_type_register_static (GTK_TYPE_CELL_RENDERER,
"NautilusCellRendererPixbufEmblem",
&cell_pixbuf_info, 0);
}
return cell_pixbuf_type;
}
G_DEFINE_TYPE (NautilusCellRendererPixbufEmblem, nautilus_cell_renderer_pixbuf_emblem, GTK_TYPE_CELL_RENDERER);
static void
nautilus_cell_renderer_pixbuf_emblem_init (NautilusCellRendererPixbufEmblem *cellpixbuf)
......@@ -122,8 +95,6 @@ nautilus_cell_renderer_pixbuf_emblem_class_init (NautilusCellRendererPixbufEmble
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = nautilus_cell_renderer_pixbuf_emblem_finalize;
object_class->get_property = nautilus_cell_renderer_pixbuf_emblem_get_property;
......@@ -215,7 +186,7 @@ nautilus_cell_renderer_pixbuf_emblem_finalize (GObject *object)
g_free (cellinfo);
g_object_set_data (object, CELLINFO_KEY, NULL);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
(* G_OBJECT_CLASS (nautilus_cell_renderer_pixbuf_emblem_parent_class)->finalize) (object);
}
static void
......
......@@ -28,8 +28,6 @@
#define ELLIPSIZE_PROP "ellipsize"
static void nautilus_cell_renderer_text_ellipsized_init (NautilusCellRendererTextEllipsizedClass *cell);
static void nautilus_cell_renderer_text_ellipsized_class_init (NautilusCellRendererTextEllipsizedClass *klass);
static void nautilus_cell_renderer_text_ellipsized_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *rectangle,
......@@ -38,38 +36,11 @@ static void nautilus_cell_renderer_text_ellipsized_get_size (GtkCellRenderer
gint *width,
gint *height);
static gpointer parent_class;
GType
nautilus_cell_renderer_text_ellipsized_get_type (void)
{
static GType type = 0;
if (!type) {
const GTypeInfo info =
{
sizeof (NautilusCellRendererTextEllipsizedClass),
NULL,
NULL,
(GClassInitFunc) nautilus_cell_renderer_text_ellipsized_class_init,
NULL,
NULL,
sizeof (NautilusCellRendererTextEllipsized),
0,
(GInstanceInitFunc) nautilus_cell_renderer_text_ellipsized_init
};
type = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT,
"NautilusCellRendererTextEllipsized",
&info, 0);
}
return type;
}
G_DEFINE_TYPE (NautilusCellRendererTextEllipsized, nautilus_cell_renderer_text_ellipsized,
GTK_TYPE_CELL_RENDERER_TEXT);
static void
nautilus_cell_renderer_text_ellipsized_init (NautilusCellRendererTextEllipsizedClass *cell)
nautilus_cell_renderer_text_ellipsized_init (NautilusCellRendererTextEllipsized *cell)
{
g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_END, NULL);
}
......@@ -79,8 +50,6 @@ nautilus_cell_renderer_text_ellipsized_class_init (NautilusCellRendererTextEllip
{
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
cell_class->get_size = nautilus_cell_renderer_text_ellipsized_get_size;
}
......@@ -101,9 +70,10 @@ nautilus_cell_renderer_text_ellipsized_get_size (GtkCellRenderer *cell,
{
g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_NONE, NULL);
(* GTK_CELL_RENDERER_CLASS (parent_class)->get_size) (cell, widget, cell_area,
x_offset, y_offset,
width, height);
(* GTK_CELL_RENDERER_CLASS (nautilus_cell_renderer_text_ellipsized_parent_class)->get_size)
(cell, widget, cell_area,
x_offset, y_offset,
width, height);
g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_END, NULL);
}
......
......@@ -50,10 +50,12 @@ enum {
};
static guint signals[LAST_SIGNAL];
static void nautilus_entry_init (NautilusEntry *entry);
static void nautilus_entry_class_init (NautilusEntryClass *class);
static void nautilus_entry_editable_init (GtkEditableClass *iface);
G_DEFINE_TYPE_WITH_CODE (NautilusEntry, nautilus_entry, GTK_TYPE_ENTRY,
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
nautilus_entry_editable_init));
static GObjectClass *parent_class = NULL;
static GtkEditableClass *parent_editable_interface = NULL;
static void
......@@ -99,7 +101,7 @@ nautilus_entry_finalize (GObject *object)
g_free (entry->details);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
G_OBJECT_CLASS (nautilus_entry_parent_class)->finalize (object);
}
static gboolean
......@@ -139,8 +141,7 @@ nautilus_entry_key_press (GtkWidget *widget, GdkEventKey *event)
old_has = gtk_editable_get_selection_bounds (editable, NULL, NULL);
result = EEL_CALL_PARENT_WITH_RETURN_VALUE
(GTK_WIDGET_CLASS, key_press_event, (widget, event));
result = GTK_WIDGET_CLASS (nautilus_entry_parent_class)->key_press_event (widget, event);
/* Pressing a key usually changes the selection if there is a selection.
* If there is not selection, we can save work by not emitting a signal.
......@@ -170,8 +171,7 @@ nautilus_entry_motion_notify (GtkWidget *widget, GdkEventMotion *event)
old_had = gtk_editable_get_selection_bounds (editable, &old_start, &old_end);
result = EEL_CALL_PARENT_WITH_RETURN_VALUE
(GTK_WIDGET_CLASS, motion_notify_event, (widget, event));
result = GTK_WIDGET_CLASS (nautilus_entry_parent_class)->motion_notify_event (widget, event);
/* Send a signal if dragging the mouse caused the selection to change. */
if (result) {
......@@ -279,8 +279,7 @@ nautilus_entry_button_press (GtkWidget *widget,
{
gboolean result;
result = EEL_CALL_PARENT_WITH_RETURN_VALUE
(GTK_WIDGET_CLASS, button_press_event, (widget, event));
result = GTK_WIDGET_CLASS (nautilus_entry_parent_class)->button_press_event (widget, event);
if (result) {
g_signal_emit (widget, signals[SELECTION_CHANGED], 0);
......@@ -295,8 +294,7 @@ nautilus_entry_button_release (GtkWidget *widget,
{
gboolean result;
result = EEL_CALL_PARENT_WITH_RETURN_VALUE
(GTK_WIDGET_CLASS, button_release_event, (widget, event));
result = GTK_WIDGET_CLASS (nautilus_entry_parent_class)->button_release_event (widget, event);
if (result) {
g_signal_emit (widget, signals[SELECTION_CHANGED], 0);
......@@ -358,8 +356,7 @@ nautilus_entry_selection_clear (GtkWidget *widget,
return FALSE;
}
return EEL_CALL_PARENT_WITH_RETURN_VALUE
(GTK_WIDGET_CLASS, selection_clear_event, (widget, event));
return GTK_WIDGET_CLASS (nautilus_entry_parent_class)->selection_clear_event (widget, event);
}
static void
......@@ -384,8 +381,6 @@ nautilus_entry_class_init (NautilusEntryClass *class)
GtkObjectClass *object_class;
GObjectClass *gobject_class;
parent_class = g_type_class_peek_parent (class);
widget_class = GTK_WIDGET_CLASS (class);
gobject_class = G_OBJECT_CLASS (class);
object_class = GTK_OBJECT_CLASS (class);
......@@ -429,36 +424,3 @@ nautilus_entry_set_special_tab_handling (NautilusEntry *entry,
}
GType
nautilus_entry_get_type (void)
{
static GType entry_type = 0;
if (entry_type == 0) {
const GInterfaceInfo editable_info =
{
(GInterfaceInitFunc) nautilus_entry_editable_init,
NULL,
NULL
};
const GTypeInfo object_info = {
sizeof (NautilusEntryClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) nautilus_entry_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (NautilusEntry),
0, /* n_preallocs */
(GInstanceInitFunc) nautilus_entry_init
};
entry_type = g_type_register_static (
GTK_TYPE_ENTRY, "NautilusEntry",
&object_info, 0);
g_type_add_interface_static (
entry_type, GTK_TYPE_EDITABLE, &editable_info);
}
return entry_type;
}
......@@ -114,8 +114,6 @@ static int date_format_pref;
static guint signals[LAST_SIGNAL];
static GObjectClass *parent_class = NULL;
static GHashTable *symbolic_links;
static GQuark attribute_name_q,
......@@ -145,9 +143,6 @@ static GQuark attribute_name_q,
attribute_volume_q,
attribute_free_space_q;
static void nautilus_file_instance_init (NautilusFile *file);
static void nautilus_file_class_init (NautilusFileClass *class);
static void nautilus_file_info_iface_init (NautilusFileInfoIface *iface);
static char * nautilus_file_get_owner_as_string (NautilusFile *file,
gboolean include_real_name);
......@@ -157,43 +152,12 @@ static gboolean update_info_and_name (NautilusFile
static const char * nautilus_file_peek_display_name (NautilusFile *file);
static const char * nautilus_file_peek_display_name_collation_key (NautilusFile *file);
GType
nautilus_file_get_type (void)
{
static GType type = 0;
if (!type) {
const GTypeInfo info = {
sizeof (NautilusFileClass),
NULL,
NULL,
(GClassInitFunc) nautilus_file_class_init,
NULL,
NULL,
sizeof (NautilusFile),
0,
(GInstanceInitFunc) nautilus_file_instance_init,
};
const GInterfaceInfo file_info_iface_info = {
(GInterfaceInitFunc) nautilus_file_info_iface_init,
NULL,
NULL
};
type = g_type_register_static (G_TYPE_OBJECT,
"NautilusFile",
&info, 0);
g_type_add_interface_static (type,
NAUTILUS_TYPE_FILE_INFO,
&file_info_iface_info);
}
return type;
}
G_DEFINE_TYPE_WITH_CODE (NautilusFile, nautilus_file, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_FILE_INFO,
nautilus_file_info_iface_init));
static void
nautilus_file_instance_init (NautilusFile *file)
nautilus_file_init (NautilusFile *file)
{
file->details = G_TYPE_INSTANCE_GET_PRIVATE ((file), NAUTILUS_TYPE_FILE, NautilusFileDetails);
......@@ -209,9 +173,9 @@ nautilus_file_constructor (GType type,
GObject *object;
NautilusFile *file;
object = (* G_OBJECT_CLASS (parent_class)->constructor) (type,
n_construct_properties,
construct_params);
object = (* G_OBJECT_CLASS (nautilus_file_parent_class)->constructor) (type,
n_construct_properties,
construct_params);
file = NAUTILUS_FILE (object);
......@@ -703,7 +667,7 @@ finalize (GObject *object)
g_hash_table_destroy (file->details->extension_attributes);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (nautilus_file_parent_class)->finalize (object);
}
NautilusFile *
......@@ -7165,8 +7129,6 @@ nautilus_file_class_init (NautilusFileClass *class)
{
GtkIconTheme *icon_theme;
parent_class = g_type_class_peek_parent (class);
attribute_name_q = g_quark_from_static_string ("name");
attribute_size_q = g_quark_from_static_string ("size");
attribute_type_q = g_quark_from_static_string ("type");
......
......@@ -198,9 +198,11 @@ typedef struct {
static int click_policy_auto_value;
/* GtkObject */
static void nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class);
static void nautilus_icon_canvas_item_init (NautilusIconCanvasItem *item);
static void nautilus_icon_canvas_item_text_interface_init (EelAccessibleTextIface *iface);
G_DEFINE_TYPE_WITH_CODE (NautilusIconCanvasItem, nautilus_icon_canvas_item, EEL_TYPE_CANVAS_ITEM,
G_IMPLEMENT_INTERFACE (EEL_TYPE_ACCESSIBLE_TEXT,
nautilus_icon_canvas_item_text_interface_init));
/* private */
static void draw_label_text (NautilusIconCanvasItem *item,
......@@ -245,7 +247,6 @@ static GdkPixbuf *nautilus_icon_canvas_lighten_pixbuf (GdkPixbuf* src, guint lig
static void nautilus_icon_canvas_item_ensure_bounds_up_to_date (NautilusIconCanvasItem *icon_item);
static NautilusIconCanvasItemClass *parent_class = NULL;
static gpointer accessible_parent_class = NULL;
static GQuark accessible_private_data_quark = 0;
......@@ -319,8 +320,8 @@ nautilus_icon_canvas_item_finalize (GObject *object)
}
g_free (details->embedded_text);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
G_OBJECT_CLASS (nautilus_icon_canvas_item_parent_class)->finalize (object);
}
/* Currently we require pixbufs in this format (for hit testing).
......@@ -890,8 +891,7 @@ nautilus_icon_canvas_item_update (EelCanvasItem *item,
eel_canvas_item_request_redraw (EEL_CANVAS_ITEM (item));
EEL_CALL_PARENT (EEL_CANVAS_ITEM_CLASS, update,
(item, i2w_dx, i2w_dy, flags));
EEL_CANVAS_ITEM_CLASS (nautilus_icon_canvas_item_parent_class)->update (item, i2w_dx, i2w_dy, flags);
}
/* Rendering */
......@@ -3564,8 +3564,6 @@ nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class)
GObjectClass *object_class;
EelCanvasItemClass *item_class;
parent_class = g_type_class_peek_parent (class);
object_class = G_OBJECT_CLASS (class);
item_class = EEL_CANVAS_ITEM_CLASS (class);
......@@ -3627,36 +3625,4 @@ nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class)
g_type_class_add_private (class, sizeof (NautilusIconCanvasItemDetails));
}
GType
nautilus_icon_canvas_item_get_type (void)
{
static GType type = 0;
if (!type) {
const GTypeInfo info = {
sizeof (NautilusIconCanvasItemClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) nautilus_icon_canvas_item_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (NautilusIconCanvasItem),
0, /* n_preallocs */
(GInstanceInitFunc) nautilus_icon_canvas_item_init,
};
const GInterfaceInfo eel_text_info = {
(GInterfaceInitFunc)
nautilus_icon_canvas_item_text_interface_init,
(GInterfaceFinalizeFunc) NULL,
NULL
};
type = g_type_register_static
(EEL_TYPE_CANVAS_ITEM, "NautilusIconCanvasItem", &info, 0);
g_type_add_interface_static
(type, EEL_TYPE_ACCESSIBLE_TEXT, &eel_text_info);
}
return type;
}
......@@ -6406,7 +6406,7 @@ item_event_callback (EelCanvasItem *item,
GtkWidget *
nautilus_icon_container_new (void)
{
return gtk_widget_new (nautilus_icon_container_get_type (), NULL);
return gtk_widget_new (NAUTILUS_TYPE_ICON_CONTAINER, NULL);
}
/* Clear all of the icons in the container. */
......
......@@ -29,6 +29,8 @@
#include <eel/eel-canvas.h>
#include <libnautilus-private/nautilus-icon-info.h>
#define NAUTILUS_TYPE_ICON_CONTAINER \
(nautilus_icon_container_get_type ())
#define NAUTILUS_ICON_CONTAINER(obj) \
GTK_CHECK_CAST (obj, nautilus_icon_container_get_type (), NautilusIconContainer)
#define NAUTILUS_ICON_CONTAINER_CLASS(k) \
......
......@@ -70,13 +70,13 @@ enum {
NUM_COLUMNS
};
G_DEFINE_TYPE (NautilusMimeApplicationChooser, nautilus_mime_application_chooser, GTK_TYPE_VBOX);
static void refresh_model (NautilusMimeApplicationChooser *chooser);
static void refresh_model_soon (NautilusMimeApplicationChooser *chooser);
static void mime_type_data_changed_cb (GObject *signaller,
gpointer user_data);
static gpointer parent_class;
static void
nautilus_mime_application_chooser_finalize (GObject *object)
{
......@@ -101,13 +101,13 @@ nautilus_mime_application_chooser_finalize (GObject *object)
g_free (chooser->details);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (nautilus_mime_application_chooser_parent_class)->finalize (object);
}
static void
nautilus_mime_application_chooser_destroy (GtkObject *object)
{
GTK_OBJECT_CLASS (parent_class)->destroy (object);
GTK_OBJECT_CLASS (nautilus_mime_application_chooser_parent_class)->destroy (object);
}
static void
......@@ -116,8 +116,6 @@ nautilus_mime_application_chooser_class_init (NautilusMimeApplicationChooserClas
GObjectClass *gobject_class;
GtkObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = nautilus_mime_application_chooser_finalize;
......@@ -363,7 +361,7 @@ mime_type_data_changed_cb (GObject *signaller,
}
static void
nautilus_mime_application_chooser_instance_init (NautilusMimeApplicationChooser *chooser)
nautilus_mime_application_chooser_init (NautilusMimeApplicationChooser *chooser)
{
GtkWidget *box;
GtkWidget *scrolled;
......@@ -711,28 +709,3 @@ nautilus_mime_application_chooser_new_for_multiple_files (GList *uris,
return chooser;
}
GType
nautilus_mime_application_chooser_get_type (void)
{
static GType type = 0;
if (!type) {
const GTypeInfo info = {
sizeof (NautilusMimeApplicationChooserClass),
NULL,
NULL,
(GClassInitFunc)nautilus_mime_application_chooser_class_init,
NULL,
NULL,
sizeof (NautilusMimeApplicationChooser),
0,
(GInstanceInitFunc)nautilus_mime_application_chooser_instance_init,
};
type = g_type_register_static (GTK_TYPE_VBOX,
"NautilusMimeApplicationChooser",
&info, 0);
}
return type;
}
......@@ -81,8 +81,8 @@ enum {
LAST_SIGNAL
};
static gpointer parent_class;
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (NautilusOpenWithDialog, nautilus_open_with_dialog, GTK_TYPE_DIALOG);
static void
nautilus_open_with_dialog_finalize (GObject *object)
......@@ -108,13 +108,13 @@ nautilus_open_with_dialog_finalize (GObject *object)
g_free (dialog->details);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (nautilus_open_with_dialog_parent_class)->finalize (object);
}
static void
nautilus_open_with_dialog_destroy (GtkObject *object)
{
GTK_OBJECT_CLASS (parent_class)->destroy (object);
GTK_OBJECT_CLASS (nautilus_open_with_dialog_parent_class)->destroy (object);
}
/* An application is valid if:
......@@ -341,8 +341,6 @@ nautilus_open_with_dialog_class_init (NautilusOpenWithDialogClass *class)
GObjectClass *gobject_class;
GtkObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = nautilus_open_with_dialog_finalize;
......@@ -745,7 +743,7 @@ expander_toggled (GtkWidget *expander, NautilusOpenWithDialog *dialog)
}