Commit b69eea8c authored by Michael Natterer's avatar Michael Natterer 😴

app: implement GObject::dispose() instead of GtkObject::destroy()

parent 3c18ba34
......@@ -70,9 +70,10 @@ struct _GimpDockPrivate
};
static void gimp_dock_dispose (GObject *object);
static void gimp_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_dock_destroy (GtkObject *object);
static gchar * gimp_dock_real_get_description (GimpDock *dock,
gboolean complete);
static void gimp_dock_real_book_added (GimpDock *dock,
......@@ -96,8 +97,8 @@ static guint dock_signals[LAST_SIGNAL] = { 0 };
static void
gimp_dock_class_init (GimpDockClass *klass)
{
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
dock_signals[BOOK_ADDED] =
g_signal_new ("book-added",
......@@ -137,7 +138,7 @@ gimp_dock_class_init (GimpDockClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gtk_object_class->destroy = gimp_dock_destroy;
object_class->dispose = gimp_dock_dispose;
widget_class->style_set = gimp_dock_style_set;
......@@ -177,7 +178,7 @@ gimp_dock_init (GimpDock *dock)
dock->p->temp_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (dock), dock->p->temp_vbox);
/* Never show it */
dock->p->main_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (dock), dock->p->main_vbox);
gtk_widget_show (dock->p->main_vbox);
......@@ -190,6 +191,17 @@ gimp_dock_init (GimpDock *dock)
gtk_widget_show (dock->p->paned_vbox);
}
static void
gimp_dock_dispose (GObject *object)
{
GimpDock *dock = GIMP_DOCK (object);
while (dock->p->dockbooks)
gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->p->dockbooks->data));
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style)
......@@ -239,17 +251,6 @@ gimp_dock_style_set (GtkWidget *widget,
}
}
static void
gimp_dock_destroy (GtkObject *object)
{
GimpDock *dock = GIMP_DOCK (object);
while (dock->p->dockbooks)
gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->p->dockbooks->data));
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gchar *
gimp_dock_real_get_description (GimpDock *dock,
gboolean complete)
......
......@@ -80,6 +80,7 @@ struct _GimpDockablePrivate
};
static void gimp_dockable_dispose (GObject *object);
static void gimp_dockable_set_property (GObject *object,
guint property_id,
const GValue *value,
......@@ -88,7 +89,7 @@ static void gimp_dockable_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_dockable_destroy (GtkObject *object);
static void gimp_dockable_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gimp_dockable_size_allocate (GtkWidget *widget,
......@@ -129,16 +130,14 @@ static const GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG };
static void
gimp_dockable_class_init (GimpDockableClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
object_class->dispose = gimp_dockable_dispose;
object_class->set_property = gimp_dockable_set_property;
object_class->get_property = gimp_dockable_get_property;
gtk_object_class->destroy = gimp_dockable_destroy;
widget_class->size_request = gimp_dockable_size_request;
widget_class->size_allocate = gimp_dockable_size_allocate;
widget_class->style_set = gimp_dockable_style_set;
......@@ -182,6 +181,45 @@ gimp_dockable_init (GimpDockable *dockable)
GDK_ACTION_MOVE);
}
static void
gimp_dockable_dispose (GObject *object)
{
GimpDockable *dockable = GIMP_DOCKABLE (object);
gimp_dockable_blink_cancel (dockable);
if (dockable->p->context)
gimp_dockable_set_context (dockable, NULL);
if (dockable->p->blurb)
{
if (dockable->p->blurb != dockable->p->name)
g_free (dockable->p->blurb);
dockable->p->blurb = NULL;
}
if (dockable->p->name)
{
g_free (dockable->p->name);
dockable->p->name = NULL;
}
if (dockable->p->stock_id)
{
g_free (dockable->p->stock_id);
dockable->p->stock_id = NULL;
}
if (dockable->p->help_id)
{
g_free (dockable->p->help_id);
dockable->p->help_id = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_dockable_set_property (GObject *object,
guint property_id,
......@@ -220,45 +258,6 @@ gimp_dockable_get_property (GObject *object,
}
}
static void
gimp_dockable_destroy (GtkObject *object)
{
GimpDockable *dockable = GIMP_DOCKABLE (object);
gimp_dockable_blink_cancel (dockable);
if (dockable->p->context)
gimp_dockable_set_context (dockable, NULL);
if (dockable->p->blurb)
{
if (dockable->p->blurb != dockable->p->name)
g_free (dockable->p->blurb);
dockable->p->blurb = NULL;
}
if (dockable->p->name)
{
g_free (dockable->p->name);
dockable->p->name = NULL;
}
if (dockable->p->stock_id)
{
g_free (dockable->p->stock_id);
dockable->p->stock_id = NULL;
}
if (dockable->p->help_id)
{
g_free (dockable->p->help_id);
dockable->p->help_id = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_dockable_size_request (GtkWidget *widget,
GtkRequisition *requisition)
......
......@@ -59,6 +59,7 @@ static void gimp_editor_docked_iface_init (GimpDockedInterface *iface);
static GObject * gimp_editor_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_editor_dispose (GObject *object);
static void gimp_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
......@@ -67,7 +68,7 @@ static void gimp_editor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_editor_destroy (GtkObject *object);
static void gimp_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style);
......@@ -93,16 +94,14 @@ G_DEFINE_TYPE_WITH_CODE (GimpEditor, gimp_editor, GTK_TYPE_VBOX,
static void
gimp_editor_class_init (GimpEditorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructor = gimp_editor_constructor;
object_class->dispose = gimp_editor_dispose;
object_class->set_property = gimp_editor_set_property;
object_class->get_property = gimp_editor_get_property;
gtk_object_class->destroy = gimp_editor_destroy;
widget_class->style_set = gimp_editor_style_set;
g_object_class_install_property (object_class, PROP_MENU_FACTORY,
......@@ -234,6 +233,38 @@ gimp_editor_constructor (GType type,
return object;
}
static void
gimp_editor_dispose (GObject *object)
{
GimpEditor *editor = GIMP_EDITOR (object);
if (editor->menu_factory)
{
g_object_unref (editor->menu_factory);
editor->menu_factory = NULL;
}
if (editor->menu_identifier)
{
g_free (editor->menu_identifier);
editor->menu_identifier = NULL;
}
if (editor->ui_manager)
{
g_object_unref (editor->ui_manager);
editor->ui_manager = NULL;
}
if (editor->ui_path)
{
g_free (editor->ui_path);
editor->ui_path = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_editor_set_property (GObject *object,
guint property_id,
......@@ -310,38 +341,6 @@ gimp_editor_get_property (GObject *object,
}
}
static void
gimp_editor_destroy (GtkObject *object)
{
GimpEditor *editor = GIMP_EDITOR (object);
if (editor->menu_factory)
{
g_object_unref (editor->menu_factory);
editor->menu_factory = NULL;
}
if (editor->menu_identifier)
{
g_free (editor->menu_identifier);
editor->menu_identifier = NULL;
}
if (editor->ui_manager)
{
g_object_unref (editor->ui_manager);
editor->ui_manager = NULL;
}
if (editor->ui_path)
{
g_free (editor->ui_path);
editor->ui_path = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style)
......
......@@ -43,8 +43,8 @@
static GObject * gimp_error_console_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_error_console_dispose (GObject *object);
static void gimp_error_console_destroy (GtkObject *object);
static void gimp_error_console_unmap (GtkWidget *widget);
static gboolean gimp_error_console_button_press (GtkWidget *widget,
......@@ -60,12 +60,12 @@ G_DEFINE_TYPE (GimpErrorConsole, gimp_error_console, GIMP_TYPE_EDITOR)
static void
gimp_error_console_class_init (GimpErrorConsoleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructor = gimp_error_console_constructor;
gtk_object_class->destroy = gimp_error_console_destroy;
object_class->dispose = gimp_error_console_dispose;
widget_class->unmap = gimp_error_console_unmap;
}
......@@ -133,7 +133,7 @@ gimp_error_console_constructor (GType type,
}
static void
gimp_error_console_destroy (GtkObject *object)
gimp_error_console_dispose (GObject *object)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (object);
......@@ -142,7 +142,7 @@ gimp_error_console_destroy (GtkObject *object)
console->gimp->message_handler = GIMP_MESSAGE_BOX;
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
......
......@@ -59,6 +59,7 @@ typedef enum
} FgBgTarget;
static void gimp_fg_bg_editor_dispose (GObject *object);
static void gimp_fg_bg_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
......@@ -68,7 +69,6 @@ static void gimp_fg_bg_editor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gimp_fg_bg_editor_destroy (GtkObject *object);
static gboolean gimp_fg_bg_editor_expose (GtkWidget *widget,
GdkEventExpose *eevent);
static gboolean gimp_fg_bg_editor_button_press (GtkWidget *widget,
......@@ -101,9 +101,8 @@ static guint editor_signals[LAST_SIGNAL] = { 0 };
static void
gimp_fg_bg_editor_class_init (GimpFgBgEditorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
editor_signals[COLOR_CLICKED] =
g_signal_new ("color-clicked",
......@@ -115,11 +114,10 @@ gimp_fg_bg_editor_class_init (GimpFgBgEditorClass *klass)
G_TYPE_NONE, 1,
GIMP_TYPE_ACTIVE_COLOR);
object_class->dispose = gimp_fg_bg_editor_dispose;
object_class->set_property = gimp_fg_bg_editor_set_property;
object_class->get_property = gimp_fg_bg_editor_get_property;
gtk_object_class->destroy = gimp_fg_bg_editor_destroy;
widget_class->expose_event = gimp_fg_bg_editor_expose;
widget_class->button_press_event = gimp_fg_bg_editor_button_press;
widget_class->button_release_event = gimp_fg_bg_editor_button_release;
......@@ -155,6 +153,29 @@ gimp_fg_bg_editor_init (GimpFgBgEditor *editor)
gimp_fg_bg_editor_drop_color, NULL);
}
static void
gimp_fg_bg_editor_dispose (GObject *object)
{
GimpFgBgEditor *editor = GIMP_FG_BG_EDITOR (object);
if (editor->context)
gimp_fg_bg_editor_set_context (editor, NULL);
if (editor->default_icon)
{
g_object_unref (editor->default_icon);
editor->default_icon = NULL;
}
if (editor->swap_icon)
{
g_object_unref (editor->swap_icon);
editor->swap_icon = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_fg_bg_editor_set_property (GObject *object,
guint property_id,
......@@ -199,29 +220,6 @@ gimp_fg_bg_editor_get_property (GObject *object,
}
}
static void
gimp_fg_bg_editor_destroy (GtkObject *object)
{
GimpFgBgEditor *editor = GIMP_FG_BG_EDITOR (object);
if (editor->context)
gimp_fg_bg_editor_set_context (editor, NULL);
if (editor->default_icon)
{
g_object_unref (editor->default_icon);
editor->default_icon = NULL;
}
if (editor->swap_icon)
{
g_object_unref (editor->swap_icon);
editor->swap_icon = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
gimp_fg_bg_editor_expose (GtkWidget *widget,
GdkEventExpose *eevent)
......
......@@ -43,6 +43,7 @@ enum
};
static void gimp_fg_bg_view_dispose (GObject *object);
static void gimp_fg_bg_view_set_property (GObject *object,
guint property_id,
const GValue *value,
......@@ -52,7 +53,6 @@ static void gimp_fg_bg_view_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gimp_fg_bg_view_destroy (GtkObject *object);
static gboolean gimp_fg_bg_view_expose (GtkWidget *widget,
GdkEventExpose *eevent);
......@@ -65,15 +65,13 @@ G_DEFINE_TYPE (GimpFgBgView, gimp_fg_bg_view, GTK_TYPE_WIDGET)
static void
gimp_fg_bg_view_class_init (GimpFgBgViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->dispose = gimp_fg_bg_view_dispose;
object_class->set_property = gimp_fg_bg_view_set_property;
object_class->get_property = gimp_fg_bg_view_get_property;
gtk_object_class->destroy = gimp_fg_bg_view_destroy;
widget_class->expose_event = gimp_fg_bg_view_expose;
g_object_class_install_property (object_class, PROP_CONTEXT,
......@@ -91,6 +89,17 @@ gimp_fg_bg_view_init (GimpFgBgView *view)
view->context = NULL;
}
static void
gimp_fg_bg_view_dispose (GObject *object)
{
GimpFgBgView *view = GIMP_FG_BG_VIEW (object);
if (view->context)
gimp_fg_bg_view_set_context (view, NULL);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_fg_bg_view_set_property (GObject *object,
guint property_id,
......@@ -131,17 +140,6 @@ gimp_fg_bg_view_get_property (GObject *object,
}
}
static void
gimp_fg_bg_view_destroy (GtkObject *object)
{
GimpFgBgView *view = GIMP_FG_BG_VIEW (object);
if (view->context)
gimp_fg_bg_view_set_context (view, NULL);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
gimp_fg_bg_view_expose (GtkWidget *widget,
GdkEventExpose *eevent)
......
......@@ -68,7 +68,8 @@ struct _GimpFileDialogState
static void gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface);
static void gimp_file_dialog_destroy (GtkObject *object);
static void gimp_file_dialog_dispose (GObject *object);
static gboolean gimp_file_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_file_dialog_response (GtkDialog *dialog,
......@@ -135,11 +136,11 @@ G_DEFINE_TYPE_WITH_CODE (GimpFileDialog, gimp_file_dialog,
static void
gimp_file_dialog_class_init (GimpFileDialogClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
object_class->destroy = gimp_file_dialog_destroy;
object_class->dispose = gimp_file_dialog_dispose;
widget_class->delete_event = gimp_file_dialog_delete_event;
......@@ -165,11 +166,11 @@ gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface)
}
static void
gimp_file_dialog_destroy (GtkObject *object)
gimp_file_dialog_dispose (GObject *object)
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
dialog->progress = NULL;
}
......
......@@ -108,8 +108,8 @@ static void gimp_gradient_editor_docked_iface_init (GimpDockedInterface *face);
static GObject * gimp_gradient_editor_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_gradient_editor_dispose (GObject *object);
static void gimp_gradient_editor_destroy (GtkObject *object);
static void gimp_gradient_editor_unmap (GtkWidget *widget);
static void gimp_gradient_editor_set_data (GimpDataEditor *editor,
GimpData *data);
......@@ -260,14 +260,12 @@ static GimpDockedInterface *parent_docked_iface = NULL;
static void
gimp_gradient_editor_class_init (GimpGradientEditorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
object_class->constructor = gimp_gradient_editor_constructor;
gtk_object_class->destroy = gimp_gradient_editor_destroy;
object_class->dispose = gimp_gradient_editor_dispose;
widget_class->unmap = gimp_gradient_editor_unmap;
......@@ -473,7 +471,7 @@ gimp_gradient_editor_constructor (GType type,
}
static void
gimp_gradient_editor_destroy (GtkObject *object)
gimp_gradient_editor_dispose (GObject *object)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (object);
......@@ -481,7 +479,7 @@ gimp_gradient_editor_destroy (GtkObject *object)
gtk_dialog_response (GTK_DIALOG (editor->color_dialog),
GTK_RESPONSE_CANCEL);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
......
......@@ -34,7 +34,9 @@ static void gimp_image_editor_docked_iface_init (GimpDockedInterface *iface);
static void gimp_image_editor_set_context (GimpDocked *docked,
GimpContext *context);
static void gimp_image_editor_destroy (GtkObject *object);
static void gimp_image_editor_dispose (GObject *object);
static void gimp_image_editor_real_set_image (GimpImageEditor *editor,
GimpImage *image);
static void gimp_image_editor_image_flush (GimpImage *image,
......@@ -52,9 +54,9 @@ G_DEFINE_TYPE_WITH_CODE (GimpImageEditor, gimp_image_editor, GIMP_TYPE_EDITOR,
static void
gimp_image_editor_class_init (GimpImageEditorClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->destroy = gimp_image_editor_destroy;
object_class->dispose = gimp_image_editor_dispose;
klass->set_image = gimp_image_editor_real_set_image;
}
......@@ -100,14 +102,14 @@ gimp_image_editor_set_context (GimpDocked *docked,
}
static void
gimp_image_editor_destroy (GtkObject *object)
gimp_image_editor_dispose (GObject *object)
{
GimpImageEditor *editor = GIMP_IMAGE_EDITOR (object);
if (editor->image)
gimp_image_editor_set_image (editor, NULL);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);