diff --git a/gintro/gimplgobj.nim b/gintro/gimplgobj.nim index 9f92e18..4249cd8 100644 --- a/gintro/gimplgobj.nim +++ b/gintro/gimplgobj.nim @@ -18,7 +18,7 @@ proc ct5nt(s: string): string = proc findSignal(name, obj: NimNode): string = let str = ($name).replace("-", "_") & RecSep #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!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)" @@ -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 sigName: string # for the notify:: signals - if signalName.startsWith("notify::"): + if signalName == "notify" or signalName.startsWith("notify::"): #sfstr.add(", " & signalName) 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 @@ -297,12 +297,17 @@ proc $1$2 {.cdecl.} = ahl = ahl.replace(": cstring", ": string") + + #if signalName.startsWith("notify"): + # sigName = ", \"notify\"" + + # maybe we write this better this way: let r2s = if ignoreArg.boolVal: """ 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) """ % [$procName, wts, ahl, signalName, $procNameCdecl, $(widget.toStrLit), $p, sfstr, sigName] elif getTypeInst(arg).typeKind == ntyRef: diff --git a/tests/gen.nim b/tests/gen.nim index 0a3baf4..cedb7e9 100644 --- a/tests/gen.nim +++ b/tests/gen.nim @@ -1,6 +1,6 @@ # High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language # 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 # 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) 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 in ["gtk_widget_class_find_style_property", "gtk_container_class_find_child_property", "gtk_cell_area_class_find_cell_property"]: return