bug-sourceinstall
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-sourceinstall] Autochecking the options in package configuratio


From: Claudio Fontana
Subject: Re: [bug-sourceinstall] Autochecking the options in package configuration
Date: Wed, 25 Jun 2008 00:55:32 +0200

On Wed, Jun 25, 2008 at 12:10 AM, Nicola Fontana <address@hidden> wrote:
> On Tue, 24 Jun 2008 21:53:04 +0200
> "Claudio Fontana" <address@hidden> wrote:
>
>> I'd still apply some changes to the patch:
>>
>> > +static void autocheck(GtkWidget *entry, GtkWidget *check_button)
>> > +{
>> > +    const gchar *text;
>> > +
>> > +    text = gtk_entry_get_text(entry);
>> > +
>> > +    if (text[0] != '\0')
>> > +     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), 
>> > TRUE);
>> > +}
>> > +
>>
>> the assignment should be text = gtk_entry_get_text(GTK_ENTRY(entry));
>
> Right, I missed the warning.
>
>> As for how the signal is connected, you used the g_signal_connect_object,
>> but since we run a modal dialog, where entry and check_button will share
>> the same fate as far as destruction goes (and the g_signal_connect_object
>> is bugged anyway), I'd replace with a normal g_signal_connect:
>>
>> g_signal_connect(entry, "changed", G_CALLBACK(autocheck), check_button);
>>
>> or do you feel strongly about connect_object?
>
> Dealing with objects I prefer to always use
> g_signal_connect_object(). Thinking about it I don't see any
> problem in using g_signal_connect() but still I'd keep the
> reference... predicting signals can be really hard and I'm a bit
> paranoic.
>
> Anyway, if you are sure and you see a reasonable advantage, feel
> free to use g_signal_connect().

I have used g_signal_connect throughout the code, but I would not consider
myself an expert GTK programmer, and was unaware about this issue.
I would like to be consistent, by either using g_signal_connect or
g_signal_connect_object consistently for objects.

At the same time, you can see that the objects in sourceinstall-gtk are
either alive for the whole duration of the program, or they live and die
in the context of the same function (as in dialog_configure), via
gtk_dialog_run.

The fact that the bug in g_signal_connect_object is (still) in the official
API reference gives me a bad feeling about the API (why not just fix it?)

http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect-object

Would you still replace all instances of g_signal_connect
with g_signal_connect_object ?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]