tiny fix for notify signals
This commit is contained in:
parent
6c150113e8
commit
8a8e53489a
2 changed files with 10 additions and 5 deletions
|
|
@ -18,7 +18,7 @@ proc ct5nt(s: string): string =
|
||||||
proc findSignal(name, obj: NimNode): string =
|
proc findSignal(name, obj: NimNode): string =
|
||||||
let str = ($name).replace("-", "_") & RecSep
|
let str = ($name).replace("-", "_") & RecSep
|
||||||
#echo str
|
#echo str
|
||||||
if str.startsWith("notify::"):
|
if str == "notify!" or str.startsWith("notify::"):
|
||||||
#return "notify!Object!1!(self: Object; paramSpec: ParamSpec)!(self: ptr Object00; paramSpec: ptr ParamSpec00)"
|
#return "notify!Object!1!(self: Object; paramSpec: ParamSpec)!(self: ptr Object00; paramSpec: ptr ParamSpec00)"
|
||||||
return "notify!gobject.Object!1!(self: gobject.Object; paramSpec: gobject.ParamSpec)!(self: ptr gobject.Object00; paramSpec: ptr gobject.ParamSpec00)" # v0.9.7
|
return "notify!gobject.Object!1!(self: gobject.Object; paramSpec: gobject.ParamSpec)!(self: ptr gobject.Object00; paramSpec: ptr gobject.ParamSpec00)" # v0.9.7
|
||||||
# "size_allocate!Widget!1!(self: Widget; allocation: gdk.Rectangle)!(self: ptr Widget00; allocation: gdk.Rectangle)"
|
# "size_allocate!Widget!1!(self: Widget; allocation: gdk.Rectangle)!(self: ptr Widget00; allocation: gdk.Rectangle)"
|
||||||
|
|
@ -105,7 +105,7 @@ macro mconnect(widget: gobject.Object; signal: string; p: typed; arg: typed; ign
|
||||||
var signalName = ($signal).replace("-", "_") # maybe we should just use plain proc names
|
var signalName = ($signal).replace("-", "_") # maybe we should just use plain proc names
|
||||||
var sigName: string # for the notify:: signals
|
var sigName: string # for the notify:: signals
|
||||||
|
|
||||||
if signalName.startsWith("notify::"):
|
if signalName == "notify" or signalName.startsWith("notify::"):
|
||||||
#sfstr.add(", " & signalName)
|
#sfstr.add(", " & signalName)
|
||||||
sigName = ", \"" & signalName.replace("_", "-") & "\"" # https://mail.gnome.org/archives/gtk-app-devel-list/2008-March/msg00197.html
|
sigName = ", \"" & signalName.replace("_", "-") & "\"" # https://mail.gnome.org/archives/gtk-app-devel-list/2008-March/msg00197.html
|
||||||
signalName = "notify" # https://discourse.gnome.org/t/notify-signal-and-underscore-vs-hyphen/6835
|
signalName = "notify" # https://discourse.gnome.org/t/notify-signal-and-underscore-vs-hyphen/6835
|
||||||
|
|
@ -297,12 +297,17 @@ proc $1$2 {.cdecl.} =
|
||||||
|
|
||||||
ahl = ahl.replace(": cstring", ": string")
|
ahl = ahl.replace(": cstring", ": string")
|
||||||
|
|
||||||
|
|
||||||
|
#if signalName.startsWith("notify"):
|
||||||
|
# sigName = ", \"notify\""
|
||||||
|
|
||||||
|
|
||||||
# maybe we write this better this way:
|
# maybe we write this better this way:
|
||||||
let r2s =
|
let r2s =
|
||||||
if ignoreArg.boolVal:
|
if ignoreArg.boolVal:
|
||||||
"""
|
"""
|
||||||
proc $1(self: $2; p: proc $3): culong {.discardable.} =
|
proc $1(self: $2; p: proc $3): culong {.discardable.} =
|
||||||
sc$4(self, $5, nil, $8)
|
sc$4(self, $5, nil, $8 $9)
|
||||||
$1($6, $7)
|
$1($6, $7)
|
||||||
""" % [$procName, wts, ahl, signalName, $procNameCdecl, $(widget.toStrLit), $p, sfstr, sigName]
|
""" % [$procName, wts, ahl, signalName, $procNameCdecl, $(widget.toStrLit), $p, sfstr, sigName]
|
||||||
elif getTypeInst(arg).typeKind == ntyRef:
|
elif getTypeInst(arg).typeKind == ntyRef:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language
|
# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language
|
||||||
# nimpretty --maxLineLen:130 gen.nim
|
# nimpretty --maxLineLen:130 gen.nim
|
||||||
# v 0.9.9 2022-OCT-20
|
# v 0.9.9 2022-OCT-28
|
||||||
# (c) S. Salewski 2018, 2019, 2020, 2021, 2022, 2023
|
# (c) S. Salewski 2018, 2019, 2020, 2021, 2022, 2023
|
||||||
|
|
||||||
# https://gnome.pages.gitlab.gnome.org/gobject-introspection/girepository/
|
# https://gnome.pages.gitlab.gnome.org/gobject-introspection/girepository/
|
||||||
|
|
@ -2017,7 +2017,7 @@ proc writeMethod(info: GIBaseInfo; minfo: GIFunctionInfo) =
|
||||||
|
|
||||||
pars = genPars(mInfo, false, info)#, tryOut2Ret = tryOut2Ret)
|
pars = genPars(mInfo, false, info)#, tryOut2Ret = tryOut2Ret)
|
||||||
processedFunctions.incl(sym)
|
processedFunctions.incl(sym)
|
||||||
if not (sym.startsWith("g_param_spec_uref") or sym.startsWith("g_param_spec_unref")): # v0.9.8, uref/unref fix in latest gobject
|
if not (sym.startsWith("g_param_spec_uref") or sym.startsWith("g_param_spec_unref") or sym.startsWith("g_param_spec_get_name")): # v0.9.8, uref/unref fix in latest gobject
|
||||||
if sym.startsWith("g_param_spec_", "g_type_interface_", "g_object_interface_"): return
|
if sym.startsWith("g_param_spec_", "g_type_interface_", "g_object_interface_"): return
|
||||||
if sym in ["gtk_widget_class_find_style_property", "gtk_container_class_find_child_property",
|
if sym in ["gtk_widget_class_find_style_property", "gtk_container_class_find_child_property",
|
||||||
"gtk_cell_area_class_find_cell_property"]: return
|
"gtk_cell_area_class_find_cell_property"]: return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue