Mail Archives: geda-user/2014/09/19/05:25:14
Hi,
On Thu, Sep 18, 2014 at 01:06:03PM +0200, Riccardo Lucchese wrote:
> Verbatim from Gtk+ 2 Reference Manual: "gtk_object_unref has been
> deprecated since version 2.12 and should not be used in newly-written
> code. Use g_object_unref() instead."
> ---
> gattrib/src/gtksheet_2_2.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gattrib/src/gtksheet_2_2.c b/gattrib/src/gtksheet_2_2.c
> index 1df38f3..5bbad13 100644
> --- a/gattrib/src/gtksheet_2_2.c
> +++ b/gattrib/src/gtksheet_2_2.c
> @@ -2381,7 +2381,7 @@ gtk_sheet_set_vadjustment (GtkSheet *sheet,
> if (sheet->vadjustment)
> {
> gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->vadjustment), sheet);
> - gtk_object_unref (GTK_OBJECT (sheet->vadjustment));
> + g_object_unref(GTK_OBJECT(sheet->vadjustment));
> }
>
Actuall the cast to GTK_OBJECT becomes unnecessary since g_object_unref
takes a gpointer (which is a void*).
With the cast it will complain in debugging mode if the object you pass in is
not a descendant of GtkObject but it won't help against passing in a GtkWidget
or any of its descendants.
If you insist in keeping the casts, you should mention it specifically in the
commit message.
I consider the casts to be more noise than anything else (and in practice they
have never triggered for my code), but someone might have a strong reason
to keep them. But for example in this case GTK_ADJUSTMENT(sheet->vadjustment)
would be more precise in debugging mode and generate the same code otherwise.
This comment also applies to patch 43/43 and perhaps also to 23/43.
> sheet->vadjustment = adjustment;
> @@ -2427,7 +2427,7 @@ gtk_sheet_set_hadjustment (GtkSheet *sheet,
> if (sheet->hadjustment)
> {
> gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->hadjustment), sheet);
> - gtk_object_unref (GTK_OBJECT (sheet->hadjustment));
> + g_object_unref(GTK_OBJECT(sheet->hadjustment));
> }
>
> sheet->hadjustment = adjustment;
> @@ -2538,13 +2538,13 @@ gtk_sheet_destroy (GtkObject * object)
> if (sheet->hadjustment)
> {
> gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->hadjustment), sheet);
> - gtk_object_unref (GTK_OBJECT (sheet->hadjustment));
> + g_object_unref(GTK_OBJECT(sheet->hadjustment));
> sheet->hadjustment = NULL;
> }
> if (sheet->vadjustment)
> {
> gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->vadjustment), sheet);
> - gtk_object_unref (GTK_OBJECT (sheet->vadjustment));
> + g_object_unref(GTK_OBJECT(sheet->vadjustment));
> sheet->vadjustment = NULL;
> }
Regards,
Gabriel
- Raw text -