nautilus r14911 - in trunk: . libnautilus-extension libnautilus-private src/file-manager
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14911 - in trunk: . libnautilus-extension libnautilus-private src/file-manager
- Date: Mon, 2 Feb 2009 16:47:17 +0000 (UTC)
Author: cosimoc
Date: Mon Feb 2 16:47:17 2009
New Revision: 14911
URL: http://svn.gnome.org/viewvc/nautilus?rev=14911&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/libnautilus-extension/nautilus-column.c
trunk/libnautilus-extension/nautilus-menu.c
trunk/libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.c
trunk/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c
trunk/libnautilus-private/nautilus-entry.c
trunk/libnautilus-private/nautilus-file.c
trunk/libnautilus-private/nautilus-icon-canvas-item.c
trunk/libnautilus-private/nautilus-icon-container.c
trunk/libnautilus-private/nautilus-icon-container.h
trunk/libnautilus-private/nautilus-mime-application-chooser.c
trunk/libnautilus-private/nautilus-open-with-dialog.c
trunk/src/file-manager/fm-icon-container.c
trunk/src/file-manager/fm-list-model.c
trunk/src/file-manager/fm-tree-model.c
Modified: trunk/libnautilus-extension/nautilus-column.c
==============================================================================
--- trunk/libnautilus-extension/nautilus-column.c (original)
+++ trunk/libnautilus-extension/nautilus-column.c Mon Feb 2 16:47:17 2009
@@ -45,7 +45,7 @@
float xalign;
};
-static GObjectClass *parent_class = NULL;
+G_DEFINE_TYPE (NautilusColumn, nautilus_column, G_TYPE_OBJECT);
/**
* nautilus_column_new:
@@ -170,11 +170,11 @@
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 @@
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 @@
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;
-}
Modified: trunk/libnautilus-extension/nautilus-menu.c
==============================================================================
--- trunk/libnautilus-extension/nautilus-menu.c (original)
+++ trunk/libnautilus-extension/nautilus-menu.c Mon Feb 2 16:47:17 2009
@@ -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 @@
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 @@
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 *
Modified: trunk/libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.c
==============================================================================
--- trunk/libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.c (original)
+++ trunk/libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.c Mon Feb 2 16:47:17 2009
@@ -67,8 +67,6 @@
PROP_PIXBUF_EMBLEM
};
-static gpointer parent_class;
-
#define CELLINFO_KEY "nautilus-cell-renderer-pixbuf-emblem-info"
typedef struct _NautilusCellRendererPixbufEmblemInfo NautilusCellRendererPixbufEmblemInfo;
@@ -79,32 +77,7 @@
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 @@
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 @@
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
Modified: trunk/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c
==============================================================================
--- trunk/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c (original)
+++ trunk/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c Mon Feb 2 16:47:17 2009
@@ -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 @@
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 @@
{
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 @@
{
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);
}
Modified: trunk/libnautilus-private/nautilus-entry.c
==============================================================================
--- trunk/libnautilus-private/nautilus-entry.c (original)
+++ trunk/libnautilus-private/nautilus-entry.c Mon Feb 2 16:47:17 2009
@@ -50,10 +50,12 @@
};
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 @@
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 @@
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 @@
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 @@
{
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 @@
{
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 @@
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 @@
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 @@
}
-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;
-}
Modified: trunk/libnautilus-private/nautilus-file.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file.c (original)
+++ trunk/libnautilus-private/nautilus-file.c Mon Feb 2 16:47:17 2009
@@ -114,8 +114,6 @@
static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class = NULL;
-
static GHashTable *symbolic_links;
static GQuark attribute_name_q,
@@ -145,9 +143,6 @@
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 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 @@
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 @@
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 @@
{
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");
Modified: trunk/libnautilus-private/nautilus-icon-canvas-item.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-canvas-item.c (original)
+++ trunk/libnautilus-private/nautilus-icon-canvas-item.c Mon Feb 2 16:47:17 2009
@@ -198,9 +198,11 @@
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 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 @@
}
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 @@
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 @@
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 @@
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;
-}
Modified: trunk/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.c (original)
+++ trunk/libnautilus-private/nautilus-icon-container.c Mon Feb 2 16:47:17 2009
@@ -6406,7 +6406,7 @@
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. */
Modified: trunk/libnautilus-private/nautilus-icon-container.h
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.h (original)
+++ trunk/libnautilus-private/nautilus-icon-container.h Mon Feb 2 16:47:17 2009
@@ -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) \
Modified: trunk/libnautilus-private/nautilus-mime-application-chooser.c
==============================================================================
--- trunk/libnautilus-private/nautilus-mime-application-chooser.c (original)
+++ trunk/libnautilus-private/nautilus-mime-application-chooser.c Mon Feb 2 16:47:17 2009
@@ -70,13 +70,13 @@
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 @@
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 @@
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 @@
}
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 @@
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;
-}
Modified: trunk/libnautilus-private/nautilus-open-with-dialog.c
==============================================================================
--- trunk/libnautilus-private/nautilus-open-with-dialog.c (original)
+++ trunk/libnautilus-private/nautilus-open-with-dialog.c Mon Feb 2 16:47:17 2009
@@ -81,8 +81,8 @@
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 @@
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 @@
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 @@
}
static void
-nautilus_open_with_dialog_instance_init (NautilusOpenWithDialog *dialog)
+nautilus_open_with_dialog_init (NautilusOpenWithDialog *dialog)
{
GtkWidget *hbox;
GtkWidget *vbox;
@@ -1013,28 +1011,3 @@
return GTK_WIDGET (dialog);
}
-GType
-nautilus_open_with_dialog_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- const GTypeInfo info = {
- sizeof (NautilusOpenWithDialogClass),
- NULL,
- NULL,
- (GClassInitFunc)nautilus_open_with_dialog_class_init,
- NULL,
- NULL,
- sizeof (NautilusOpenWithDialog),
- 0,
- (GInstanceInitFunc)nautilus_open_with_dialog_instance_init,
- };
-
- type = g_type_register_static (GTK_TYPE_DIALOG,
- "NautilusOpenWithDialog",
- &info, 0);
- }
-
- return type;
-}
Modified: trunk/src/file-manager/fm-icon-container.c
==============================================================================
--- trunk/src/file-manager/fm-icon-container.c (original)
+++ trunk/src/file-manager/fm-icon-container.c Mon Feb 2 16:47:17 2009
@@ -36,7 +36,7 @@
#define ICON_TEXT_ATTRIBUTES_NUM_ITEMS 3
#define ICON_TEXT_ATTRIBUTES_DEFAULT_TOKENS "size,date_modified,type"
-G_DEFINE_TYPE (FMIconContainer, fm_icon_container, nautilus_icon_container_get_type ());
+G_DEFINE_TYPE (FMIconContainer, fm_icon_container, NAUTILUS_TYPE_ICON_CONTAINER);
static GQuark attribute_none_q;
Modified: trunk/src/file-manager/fm-list-model.c
==============================================================================
--- trunk/src/file-manager/fm-list-model.c (original)
+++ trunk/src/file-manager/fm-list-model.c Mon Feb 2 16:47:17 2009
@@ -54,8 +54,9 @@
static int fm_list_model_file_entry_compare_func (gconstpointer a,
gconstpointer b,
gpointer user_data);
-
-static GObjectClass *parent_class;
+static void fm_list_model_tree_model_init (GtkTreeModelIface *iface);
+static void fm_list_model_sortable_init (GtkTreeSortableIface *iface);
+static void fm_list_model_multi_drag_source_init (EggTreeMultiDragSourceIface *iface);
struct FMListModelDetails {
GSequence *files;
@@ -94,6 +95,14 @@
guint loaded : 1;
};
+G_DEFINE_TYPE_WITH_CODE (FMListModel, fm_list_model, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
+ fm_list_model_tree_model_init)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_SORTABLE,
+ fm_list_model_sortable_init)
+ G_IMPLEMENT_INTERFACE (EGG_TYPE_TREE_MULTI_DRAG_SOURCE,
+ fm_list_model_multi_drag_source_init));
+
static const GtkTargetEntry drag_types [] = {
{ NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
@@ -1532,8 +1541,8 @@
g_hash_table_destroy (model->details->directory_reverse_map);
model->details->directory_reverse_map = NULL;
}
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+
+ G_OBJECT_CLASS (fm_list_model_parent_class)->dispose (object);
}
static void
@@ -1544,8 +1553,8 @@
model = FM_LIST_MODEL (object);
g_free (model->details);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
+
+ G_OBJECT_CLASS (fm_list_model_parent_class)->finalize (object);
}
static void
@@ -1570,8 +1579,6 @@
attribute_date_modified_q = g_quark_from_static_string ("date_modified");
object_class = (GObjectClass *)klass;
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = fm_list_model_finalize;
object_class->dispose = fm_list_model_dispose;
@@ -1619,57 +1626,6 @@
iface->drag_data_delete = fm_list_model_multi_drag_data_delete;
}
-GType
-fm_list_model_get_type (void)
-{
- static GType object_type = 0;
-
- if (object_type == 0) {
- const GTypeInfo object_info = {
- sizeof (FMListModelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) fm_list_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (FMListModel),
- 0,
- (GInstanceInitFunc) fm_list_model_init,
- };
-
- const GInterfaceInfo tree_model_info = {
- (GInterfaceInitFunc) fm_list_model_tree_model_init,
- NULL,
- NULL
- };
-
- const GInterfaceInfo sortable_info = {
- (GInterfaceInitFunc) fm_list_model_sortable_init,
- NULL,
- NULL
- };
-
- const GInterfaceInfo multi_drag_source_info = {
- (GInterfaceInitFunc) fm_list_model_multi_drag_source_init,
- NULL,
- NULL
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT, "FMListModel", &object_info, 0);
- g_type_add_interface_static (object_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- g_type_add_interface_static (object_type,
- GTK_TYPE_TREE_SORTABLE,
- &sortable_info);
- g_type_add_interface_static (object_type,
- EGG_TYPE_TREE_MULTI_DRAG_SOURCE,
- &multi_drag_source_info);
- }
-
- return object_type;
-}
-
void
fm_list_model_subdirectory_done_loading (FMListModel *model, NautilusDirectory *directory)
{
Modified: trunk/src/file-manager/fm-tree-model.c
==============================================================================
--- trunk/src/file-manager/fm-tree-model.c (original)
+++ trunk/src/file-manager/fm-tree-model.c Mon Feb 2 16:47:17 2009
@@ -116,14 +116,17 @@
FMTreeModel *model;
} DoneLoadingParameters;
-static GObjectClass *parent_class;
-
+static void fm_tree_model_tree_model_init (GtkTreeModelIface *iface);
static void schedule_monitoring_update (FMTreeModel *model);
static void destroy_node_without_reporting (FMTreeModel *model,
TreeNode *node);
static void report_node_contents_changed (FMTreeModel *model,
TreeNode *node);
+G_DEFINE_TYPE_WITH_CODE (FMTreeModel, fm_tree_model, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
+ fm_tree_model_tree_model_init));
+
static GtkTreeModelFlags
fm_tree_model_get_flags (GtkTreeModel *tree_model)
{
@@ -1845,14 +1848,12 @@
g_free (model->details);
- parent_class->finalize (object);
+ G_OBJECT_CLASS (fm_tree_model_parent_class)->finalize (object);
}
static void
fm_tree_model_class_init (FMTreeModelClass *class)
{
- parent_class = g_type_class_peek_parent (class);
-
G_OBJECT_CLASS (class)->finalize = fm_tree_model_finalize;
tree_model_signals[ROW_LOADED] =
@@ -1885,35 +1886,4 @@
iface->unref_node = fm_tree_model_unref_node;
}
-GType
-fm_tree_model_get_type (void)
-{
- static GType object_type = 0;
- if (object_type == 0) {
- const GTypeInfo object_info = {
- sizeof (FMTreeModelClass),
- NULL,
- NULL,
- (GClassInitFunc) fm_tree_model_class_init,
- NULL,
- NULL,
- sizeof (FMTreeModel),
- 0,
- (GInstanceInitFunc) fm_tree_model_init,
- };
-
- const GInterfaceInfo tree_model_info = {
- (GInterfaceInitFunc) fm_tree_model_tree_model_init,
- NULL,
- NULL
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT, "FMTreeModel", &object_info, 0);
- g_type_add_interface_static (object_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return object_type;
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]