/* * To compile: valac --pkg=linux --pkg=posix inputeventreader.vala * * Description: * This example uses of the GLib's main loop and IOChannel's * to listen for Input.Event's on one or more /dev/input/event* * devices, and outputs the values to standard output. * * Copyright 2010, Robert Thomson. * * Released under the MIT License */ using Linux; using Posix; class InputEventReader { // Read a single input event from the channel, and print out the values. private static bool gio_in(IOChannel gio, IOCondition condition) { if((condition & IO
[indent=4] /* Build with valac --pkg gtk+-2.0 --pkg cairo yourfile.gs */ uses Gtk Cairo class TransparentWindow : Gtk.Window init this.type = Gtk.WindowType.TOPLEVEL /* Set the title is useless !
/* archive.vala - Example for using the libarchive bindings in Vala.
*
* Copyright (C) 2009 Julian Andres Klode <jak@debian.org>
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved./**
*
* Description : A simple snippet to demonstrate how to extract Arabic Words in Vala programming language
* Vala version : 0.7.8
* Developed by : Emad Al-Bloushi
* Date : Mon 23 Nov, 2009
* Compile with : valac --pkg gee-1.0 word.vala
*
**//**
*
* Description : A simple snippet to demonstrate how to use Google AJAX API in Vala programming language
* Vala version : 0.7.8
* Developed by : Emad Al-Bloushi
* Date : Thu 12 Nov, 2009
* Compile with : valac --thread --pkg libsoup-2.4 --pkg json-glib-1.0 GoogleTranslator.vala
* Refer to : http://code.google.com/apis/ajaxlanguage/documentation/#fonje
*
**/[indent=4] /* Requires Vala >= 0.7.9 valac --pkg clutter-1.0 yourfile.gs */ uses Clutter class ClutterDemo animations : array of Animation stage : Stage rectangles : array of Rectangle const colors : array of string = { "blanched almond", "OldLace", "MistyRose", "White", "LavenderBlush", "CornflowerBlue", "chartreuse", "chocolate", "light coral", "medium violet red", "LemonChiffon2", "RosyBrown3" } construct () stage = Stage.get_default () rectangles = new array of Rectangle[colors.length] stage.hide.connect (Clutter.main_q
[indent=4] def default_handler(server : Soup.Server, msg : Soup.Message, path : string, query : GLib.HashTable?, client : Soup.ClientContext) response_text : string = "<html><body><p>Current location: %s</p><p><a href=\"/xml\">Test XML</a></p>
[indent=4] def process_request (input : InputStream, output : OutputStream) raises Error var data_in = new DataInputStream (input) line : string while ((line = data_in.read_line (null, null)) != null) print line if (line.strip () == "") do break content : string = "<html><h1>Hello from Genie server</h1></html>" var header = new StringBuilder () header.append ("HTTP/1.0 200 OK\r\n") header.append ("Content-Type: text/html\r\n") header.append_printf ("Content-Length: %lu\r\n\r\n", content.size ()) output.write (header.str, heade
//compile with: valac --thread --pkg libsoup-2.4 main.vala -o soup_post using Soup; class rpc_request { private static rpc_request request_instance; private HashTable<string,string> args; private rpc_request() { args=new HashTable<string,string>(str_hash,str_equal); } public static rpc_request get_instance() { if(null==request_instance) { request_instance=new rpc_request(); } return request_instance; } public void add_parameter(string name,string val) { args.insert(name,val); } private string prepare() { Soup.URI myuri=new Soup.URI("http://
/**
* You'll need to grab the attached files and remove the .txt at the end of them in order to use this.
* I put both the vapi and deps file in /usr/share/vala/vapi/ to have them readily available. You can also keep them in your project folder if you want, * but you'll need to update the compile line to reflect that
* the compiled .so and gedit-plugin files go in ~/.gnome2/gedit/plugins/
* Sample makefile is also attached.
*
* Displays a button on the top Gedit panel that displays a color dialog when clicked.