Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== gtk-server [[toc:]] === Introduction A trivial GTK3 binding using [[http://gtk-server.org/|GTK-server]]. === Author Felix Winkelmann, [[/users/wasamasa|Vasilij Schneidermann]] === Repository [[https://depp.brause.cc/gtk-server]] === Current state of the bindings Based on [[http://gtk-server.org/demo-stdin.scm.txt|a demo]] by Felix Winkelmann. Only the stdin API is supported. If you need to communicate with GTK-server via TCP, UDP, FIFO, IPC or FFI, please use [[https://depp.brause.cc/gtk-server/gtk-server-impl.scm|gtk-server-impl.scm]] as your starting point. === API <procedure>(start-gtk-server! [program-name: PROGRAM-NAME] [args: ARGS])</procedure> Launches a {{gtk-server}} process using the stdin API and returns a {{GTK-SERVER}} record representing it. The location of the {{gtk-server}} executable can be customized by using the {{#:program-name}} keyword argument. Further customizations to the GTK-server behavior can be performed by passing a list of command-line arguments using the {{#:args}} keyword argument. Refer to the GTK-server manual for a list of all supported command-line arguments. <procedure>(gtk-send! GTK-SERVER #!rest ARGS)</procedure> Send a GTK command to {{GTK-SERVER}}. Command arguments are converted to strings if necessary and concatenated into a space-separated string. To pass a string argument containing spaces to GTK, it must be quoted using single or double quotes. For example {{(gtk-send gtk-server "foo bar baz")}}, {{(gtk-send gtk-server "foo" "bar" "baz")}} and {{(gtk-send gtk-server 'foo 'bar 'baz)}} are all interpreted as three arguments, but {{(gtk-send gtk-server "\"foo bar baz\"")}} and {{(gtk-send gtk-server "'foo bar baz'")}} are interpreted as one string argument. Refer to [[http://gtk-server.org/docs.html|the GTK-server]] and [[https://developer.gnome.org/references|GNOME documentation]] for allowed commands. <procedure>(stop-gtk-server! GTK-SERVER)</procedure> Shuts down the process associated with {{GTK-SERVER}} and frees all open resources. This procedure should be called at the end of the program, for example after exiting the main loop. === Example <enscript highlight="scheme"> (import scheme) (import (chicken base)) (import gtk-server) (define gtk-server (start-gtk-server! args: '("-log=/tmp/scheme.gtk"))) (define (gtk #!rest args) (apply gtk-send! gtk-server args)) (gtk "gtk_init NULL NULL") (define win (gtk "gtk_window_new 0")) (gtk "gtk_window_set_title" win "'This is a title'") (gtk "gtk_window_set_default_size" win "100 100") (gtk "gtk_window_set_position" win "1") (define table (gtk "gtk_table_new 30 30 1")) (gtk "gtk_container_add" win table) (define button1 (gtk "gtk_button_new_with_label Exit")) (gtk "gtk_table_attach_defaults" table button1 "17 28 20 25") (define button2 (gtk "gtk_button_new_with_label 'Print text'")) (gtk "gtk_table_attach_defaults" table button2 "2 13 20 25") (define entry (gtk "gtk_entry_new")) (gtk "gtk_table_attach_defaults" table entry "2 28 5 15") (gtk "gtk_widget_show_all" win) (let loop () (let ((event (gtk "gtk_server_callback wait"))) (when (equal? event button2) (print "This is the contents: " (gtk "gtk_entry_get_text" entry))) (unless (member event (list button1 win)) (loop)))) (stop-gtk-server! gtk-server) </enscript> See [[https://depp.brause.cc/gtk-server/examples/|the examples directory]] for further examples. === License Copyright 2021 Vasilij Schneidermann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>. === Version history ==== 0.1 * Initial release
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 6 to 19?