mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Convert some destroy functions to finalize functions. Destroy can be
called multiple times in gtk2. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gnucash-gnome2-dev@9666 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -426,8 +426,8 @@ gnc_date_edit_destroy (GtkObject *object)
|
||||
|
||||
if (gde->cal_popup != NULL) {
|
||||
gtk_widget_destroy (gde->cal_popup);
|
||||
gde->cal_popup = NULL;
|
||||
}
|
||||
gde->cal_popup = NULL;
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
|
||||
@@ -72,7 +72,7 @@ static gint date_format_signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gnc_date_format_init (GNCDateFormat *gdf);
|
||||
static void gnc_date_format_class_init (GNCDateFormatClass *class);
|
||||
static void gnc_date_format_destroy (GtkObject *object);
|
||||
static void gnc_date_format_finalize (GObject *object);
|
||||
static void gnc_date_format_compute_format(GNCDateFormat *gdf);
|
||||
|
||||
/* Used by glade_xml_signal_autoconnect_full */
|
||||
@@ -112,10 +112,9 @@ gnc_date_format_get_type (void)
|
||||
static void
|
||||
gnc_date_format_class_init (GNCDateFormatClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) class;
|
||||
GtkObjectClass *object_class = (GtkObjectClass *) class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_hbox_get_type ());
|
||||
|
||||
date_format_signals [FORMAT_CHANGED] =
|
||||
@@ -129,7 +128,7 @@ gnc_date_format_class_init (GNCDateFormatClass *class)
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
|
||||
object_class->destroy = gnc_date_format_destroy;
|
||||
gobject_class->finalize = gnc_date_format_finalize;
|
||||
|
||||
class->format_changed = NULL;
|
||||
}
|
||||
@@ -187,7 +186,7 @@ gnc_date_format_init (GNCDateFormat *gdf)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_date_format_destroy (GtkObject *object)
|
||||
gnc_date_format_finalize (GObject *object)
|
||||
{
|
||||
GNCDateFormat *gdf;
|
||||
|
||||
@@ -198,8 +197,8 @@ gnc_date_format_destroy (GtkObject *object)
|
||||
|
||||
g_free(gdf->priv);
|
||||
|
||||
if (GTK_OBJECT_CLASS(parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS(parent_class)->destroy) (object);
|
||||
if (G_OBJECT_CLASS(parent_class)->finalize)
|
||||
(* G_OBJECT_CLASS(parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ static short module = MOD_SX;
|
||||
|
||||
static void gnc_dense_cal_class_init (GncDenseCalClass *class);
|
||||
static void gnc_dense_cal_init (GncDenseCal *dcal);
|
||||
static void gnc_dense_cal_finalize (GObject *object);
|
||||
static void gnc_dense_cal_destroy (GtkObject *object);
|
||||
static void gnc_dense_cal_realize (GtkWidget *widget);
|
||||
static void gnc_dense_cal_draw_to_buffer( GncDenseCal *dcal );
|
||||
@@ -243,6 +244,7 @@ gnc_dense_cal_class_init (GncDenseCalClass *class)
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
|
||||
object_class->finalize = gnc_dense_cal_finalize;
|
||||
gtkobject_class->destroy = gnc_dense_cal_destroy;
|
||||
widget_class->realize = gnc_dense_cal_realize;
|
||||
widget_class->expose_event = gnc_dense_cal_expose;
|
||||
@@ -473,16 +475,27 @@ gnc_dense_cal_destroy (GtkObject *object)
|
||||
g_return_if_fail (GNC_IS_DENSE_CAL (object));
|
||||
|
||||
dcal = GNC_DENSE_CAL(object);
|
||||
if ( dcal->drawbuf )
|
||||
if ( dcal->drawbuf ) {
|
||||
gdk_pixmap_unref( dcal->drawbuf );
|
||||
dcal->drawbuf = NULL;
|
||||
}
|
||||
|
||||
/* FIXME: we have a bunch of cleanup to do, here. */
|
||||
/* monthLabelFont, dayLabelFont */
|
||||
gdk_font_unref( dcal->monthLabelFont );
|
||||
gdk_font_unref( dcal->dayLabelFont );
|
||||
if ( dcal->monthLabelFont ) {
|
||||
gdk_font_unref( dcal->monthLabelFont );
|
||||
dcal->monthLabelFont = NULL;
|
||||
}
|
||||
if ( dcal->dayLabelFont ) {
|
||||
gdk_font_unref( dcal->dayLabelFont );
|
||||
dcal->dayLabelFont = NULL;
|
||||
}
|
||||
/* month labels */
|
||||
for ( i=0; i < 12; i++ ) {
|
||||
gdk_pixmap_unref( dcal->monthLabels[i] );
|
||||
if ( dcal->monthLabels[0] ) {
|
||||
for ( i=0; i < 12; i++ ) {
|
||||
gdk_pixmap_unref( dcal->monthLabels[i] );
|
||||
dcal->monthLabels[i] = NULL;
|
||||
}
|
||||
}
|
||||
/* mark data */
|
||||
gdc_free_all_mark_data( dcal );
|
||||
@@ -491,6 +504,21 @@ gnc_dense_cal_destroy (GtkObject *object)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_dense_cal_finalize (GObject *object)
|
||||
{
|
||||
GncDenseCal *dcal;
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GNC_IS_DENSE_CAL (object));
|
||||
|
||||
/* mark data */
|
||||
dcal = GNC_DENSE_CAL(object);
|
||||
gdc_free_all_mark_data( dcal );
|
||||
|
||||
if (G_OBJECT_CLASS (parent_class)->finalize)
|
||||
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_dense_cal_realize (GtkWidget *widget)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ enum
|
||||
|
||||
static void gnc_general_select_init (GNCGeneralSelect *gsl);
|
||||
static void gnc_general_select_class_init (GNCGeneralSelectClass *class);
|
||||
static void gnc_general_select_destroy (GtkObject *object);
|
||||
static void gnc_general_select_finalize (GObject *object);
|
||||
|
||||
static GtkHBoxClass *parent_class;
|
||||
static guint general_select_signals[LAST_SIGNAL];
|
||||
@@ -104,10 +104,10 @@ gnc_general_select_forall (GtkContainer *container, gboolean include_internals,
|
||||
static void
|
||||
gnc_general_select_class_init (GNCGeneralSelectClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class = (GtkObjectClass *) klass;
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
GtkContainerClass *container_class = (GtkContainerClass *) klass;
|
||||
|
||||
object_class = (GtkObjectClass*) klass;
|
||||
object_class = (GObjectClass*) klass;
|
||||
|
||||
parent_class = gtk_type_class (gtk_hbox_get_type ());
|
||||
|
||||
@@ -122,7 +122,7 @@ gnc_general_select_class_init (GNCGeneralSelectClass *klass)
|
||||
|
||||
container_class->forall = gnc_general_select_forall;
|
||||
|
||||
object_class->destroy = gnc_general_select_destroy;
|
||||
object_class->finalize = gnc_general_select_finalize;
|
||||
|
||||
klass->changed = NULL;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ gnc_general_select_init (GNCGeneralSelect *gsl)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_general_select_destroy (GtkObject *object)
|
||||
gnc_general_select_finalize (GObject *object)
|
||||
{
|
||||
GNCGeneralSelect *gsl;
|
||||
|
||||
@@ -146,8 +146,8 @@ gnc_general_select_destroy (GtkObject *object)
|
||||
gsl->entry = NULL;
|
||||
gsl->button = NULL;
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
if (G_OBJECT_CLASS (parent_class)->finalize)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -100,14 +100,22 @@ gtk_select_class_init (GtkSelectClass * klass)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_select_destroy (GtkObject * select)
|
||||
gtk_select_destroy (GtkObject * object)
|
||||
{
|
||||
gtk_widget_destroy (GTK_SELECT (select)->popwin);
|
||||
g_object_unref (GTK_SELECT (select)->popwin);
|
||||
g_object_unref (GTK_SELECT (select)->empty);
|
||||
GtkSelect *select = GTK_SELECT (object);
|
||||
|
||||
if (select->popwin) {
|
||||
gtk_widget_destroy (select->popwin);
|
||||
g_object_unref (select->popwin);
|
||||
select->popwin = NULL;
|
||||
}
|
||||
if (select->empty) {
|
||||
g_object_unref (GTK_SELECT (select)->empty);
|
||||
select->empty = NULL;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(*GTK_OBJECT_CLASS (parent_class)->destroy) (select);
|
||||
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
Reference in New Issue
Block a user