view subtly/gobject.rb @ 39:6838c7123945

Tidied up code
author unexist
date Sat, 23 Jan 2010 23:23:54 +0100
parents c86846c6b2da
children c6f35cf6c4f6
line wrap: on
line source
##
# @package subtly
#
# @file GObject bindings
# @author Christoph Kappel <unexist@dorfelite.net>
# @version $Id: subtly/gobject.rb,v 39 1264285434.0-3600 unexist $
#
# This program can be distributed under the terms of the GNU GPL.
##

require "ffi"

module Subtly
  module GObject
    extend FFI::Library

    ffi_lib("libgobject-2.0")

    # Callback type
    callback :g_callback2, [ :pointer, :pointer ],                     :void
    callback :g_callback3, [ :pointer, :pointer, :pointer ],           :void
    callback :g_callback4, [ :pointer, :pointer, :pointer, :pointer ], :void

    ## ffi_signal_connect
    # Add signal callback
    #
    # @param [Pointer, #read]  Widget to attach callback
    # @param [String,  #read]  Signal name
    # @param [Pointer, #read]  Callback function
    # @param [Pointer, #read]  Callback data
    ##

    attach_function(:ffi_signal_connect2,
      :g_signal_connect_data, [ :pointer, :string, :g_callback2, :pointer, :pointer, :int ], :ulong
    )
    attach_function(:ffi_signal_connect3,
      :g_signal_connect_data, [ :pointer, :string, :g_callback3, :pointer, :pointer, :int ], :ulong
    )
    attach_function(:ffi_signal_connect4,
      :g_signal_connect_data, [ :pointer, :string, :g_callback4, :pointer, :pointer, :int ], :ulong
    )
  end
end