RE: hy;hen/underscore equivalence in signal names?



Thanks for the clarification.  I'm surely not the only one that didn't
know this.

-----Original Message-----
From: Tristan Van Berkom [mailto:tristan van berkom gmail com]
Sent: Thursday, February 03, 2005 1:26 PM
To: Paul Pogonyshev
Cc: Boncek, John; gtk-app-devel-list gnome org
Subject: Re: hy;hen/underscore equivalence in signal names?


On Thu, 3 Feb 2005 21:06:21 +0200, Paul Pogonyshev <pogonyshev gmx net>
wrote:
Boncek, John wrote:
I typed an underscore instead of a hyphen by mistake in a GtkEntry
signal
name, "insert_text" instead of "insert-text", at one of 2 places the
name
was used.  It worked.  I inverted both of them and it still worked.
Apparently these are interchangeable, at least in this one instance,
in
GTK 2.2.4.

They are interchangeable, with the only requirement that you stick to
either of them in every string.  I.e. you can use "my-long-signal-name"
or "my_long_signal_name", but not "my_long-signal_name".  I'm not sure
why GLib people chose it to be this way, but I appreciate it, because
hyphens are my second best word separator after spaces :)

They are interchangeable but wait a second, Owen told me (a few months
ago) on this list that its safer to use hyphens in the case of
property notification
signals; i.e. g_signal_connect (... "notify::my-long-property-name" ...);

I guess there was some bug or technical reason why using underscores in
this case wasn't working. (ofcourse this is in the case of property names
and
not signal names, I just though you ought to know).

Cheers,
                                                     -Tristan



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