summaryrefslogtreecommitdiff
path: root/libnautilus-extension
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@pluto>2009-02-02 16:47:17 +0000
committerCosimo Cecchi <cosimoc@src.gnome.org>2009-02-02 16:47:17 +0000
commit0fa45e385b3c9e093e133a84afcd15543ab8c1c4 (patch)
tree3d6873ccb8fcf5c92aa225c18cff83b91f0c15bf /libnautilus-extension
parentd24d8800964bad8dac7a0fb0548c7fcd32a2586c (diff)
downloadnautilus-0fa45e385b3c9e093e133a84afcd15543ab8c1c4.tar.gz
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
Diffstat (limited to 'libnautilus-extension')
-rw-r--r--libnautilus-extension/nautilus-column.c34
-rw-r--r--libnautilus-extension/nautilus-menu.c30
2 files changed, 6 insertions, 58 deletions
diff --git a/libnautilus-extension/nautilus-column.c b/libnautilus-extension/nautilus-column.c
index efba54527..646e64ef4 100644
--- a/libnautilus-extension/nautilus-column.c
+++ b/libnautilus-extension/nautilus-column.c
@@ -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;
-}
diff --git a/libnautilus-extension/nautilus-menu.c b/libnautilus-extension/nautilus-menu.c
index 36a19cb31..dc2dac71f 100644
--- a/libnautilus-extension/nautilus-menu.c
+++ b/libnautilus-extension/nautilus-menu.c
@@ -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 *