Re: g_connect_signal events. underscore vs dash



On Sat, Mar 29, 2008 at 10:20 PM, Gregory Hosler <ghosler redhat com> wrote:
[...]
 I have some old code, that in many places is using underscores instead of dashes. e.g.
 "button_release_event"; in fact I have cases where the same signal is g_connect'ed in
 different places in the code, one place with underscores ("button_release_event") and the
 other place with dashes ("button-release-event").

 My question: Is one preferred over the other ? is the underscore deprecated ? What's the
 best spelling to use ?

They are synonymous, but afaik they are all defined as dashes,
generally I always use dashes.

One slightly relevent thing though, when dealing with the GObject
"notify" signal, the
dash and underscore are not synonymous for the property names
(i.e. "notify::button-style" is not synonymous with "notify::button_style")

Through normal property accessors; dashes and underscores are also synonymous,
i.e. g_object_get (object, "button-style", &style, NULL) is the same as
g_object_get (object, "button_style", &style, NULL).

I believe the only exception here really is the signal detail
arguments that depict
property names.

Cheers,
                  -Tristan



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