added gstreamer and gboxed types support
This commit is contained in:
parent
f3a8dcfdbe
commit
c2b13b0b90
9 changed files with 350 additions and 3220 deletions
20
examples/gtk3/gstBasicTutorial1.nim
Normal file
20
examples/gtk3/gstBasicTutorial1.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html?gi-language=c
|
||||
# nim c gstBasicTutorial1.nim
|
||||
import gintro/gst
|
||||
|
||||
proc main =
|
||||
var pipeline: gst.Element
|
||||
var bus: gst.Bus
|
||||
var msg: gst.Message
|
||||
## Initialize GStreamer
|
||||
gst.init()
|
||||
## Build the pipeline
|
||||
pipeline = gst.parseLaunch("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm")
|
||||
## Start playing
|
||||
discard gst.setState(pipeline, gst.State.playing)
|
||||
## Wait until error or EOS
|
||||
bus = gst.getBus(pipeline)
|
||||
msg = gst.timedPopFiltered(bus, gst.Clock_Time_None, {gst.MessageFlag.error, gst.MessageFlag.eos})
|
||||
discard gst.setState(pipeline, gst.State.null) # is this necessary?
|
||||
|
||||
main()
|
||||
|
|
@ -24,7 +24,7 @@ proc appendItem(widget: Button; entry: Entry) =
|
|||
val: Value
|
||||
iter: TreeIter
|
||||
let store = listStore(getModel(list))
|
||||
let gtype = typeFromName("gchararray")
|
||||
let gtype = gStringGetType() # typeFromName("gchararray")
|
||||
discard init(val, gtype)
|
||||
setString(val, entry.text)
|
||||
store.append(iter)
|
||||
|
|
@ -57,7 +57,7 @@ proc initList(list: TreeView) =
|
|||
column.packStart(renderer, true)
|
||||
column.addAttribute(renderer, "text", LIST_ITEM)
|
||||
discard list.appendColumn(column)
|
||||
let gtype = typeFromName("gchararray")
|
||||
let gtype = gStringGetType() # typeFromName("gchararray")
|
||||
let store = newListStore(N_COLUMNS, cast[pointer]( unsafeaddr gtype)) # cast due to bug in gtk.nim
|
||||
list.setModel(store)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,3 +16,6 @@ nim c simpledrawingarea.nim
|
|||
nim c css_colored_listview.nim
|
||||
nim c gearsmenu.nim
|
||||
nim c cairoImage.nim
|
||||
nim c gstBasicTutorial1.nim
|
||||
nim c sourceview_test.nim
|
||||
nim c overlay_tree1.nim
|
||||
|
|
|
|||
16
examples/gtk3/sourceview_test.nim
Normal file
16
examples/gtk3/sourceview_test.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import gintro/[gtk, glib, gobject, gio, gtksource]
|
||||
|
||||
proc appActivate (app: Application) =
|
||||
let window = newApplicationWindow(app)
|
||||
window.title = "GTKSourceView"
|
||||
window.defaultSize = (250, 350)
|
||||
let view = newView()
|
||||
window.add(view)
|
||||
window.showAll
|
||||
|
||||
proc main =
|
||||
let app = newApplication("org.gtk.example")
|
||||
connect(app, "activate", appActivate)
|
||||
discard app.run
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue