|
From: Axel S. <si...@co...> - 2010-05-01 15:19:10
|
Sat May 1 09:30:50 EDT 2010 Axe...@in...
* Let the default Signal template import GtkInternals.
Ignore-this: 2f2e8944aa1cc5a5831cabd8c86f119c
addfile ./gtk/Graphics/UI/Gtk/Signals.chs.template
hunk ./gtk/Graphics/UI/Gtk/Signals.chs.template 1
+{-# OPTIONS_HADDOCK hide #-}
+-- -*-haskell-*-
+-- -------------------- automatically generated file - do not edit ------------
+-- Callback installers for the GIMP Toolkit (GTK) Binding for Haskell
+--
+-- Author : Axel Simon
+--
+-- Created: 1 July 2000
+--
+-- Copyright (C) 2000-2005 Axel Simon
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public
+-- License as published by the Free Software Foundation; either
+-- version 2.1 of the License, or (at your option) any later version.
+--
+-- This library 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
+-- Lesser General Public License for more details.
+--
+-- #hide
+
+-- These functions are used to connect signals to widgets. They are auto-
+-- matically created through HookGenerator.hs which takes a list of possible
+-- function signatures that are included in the GTK sources (gtkmarshal.list).
+--
+-- The object system in the second version of GTK is based on GObject from
+-- GLIB. This base class is rather primitive in that it only implements
+-- ref and unref methods (and others that are not interesting to us). If
+-- the marshall list mentions OBJECT it refers to an instance of this [_$_]
+-- GObject which is automatically wrapped with a ref and unref call.
+-- Structures which are not derived from GObject have to be passed as
+-- BOXED which gives the signal connect function a possibility to do the
+-- conversion into a proper ForeignPtr type. In special cases the signal
+-- connect function use a PTR type which will then be mangled in the
+-- user function directly. The latter is needed if a signal delivers a
+-- pointer to a string and its length in a separate integer.
+--
+module @MODULE_NAME@ (
+ module System.Glib.Signals,
+
+ @MODULE_EXPORTS@
+ ) where
+
+import Control.Monad (liftM)
+
+import System.Glib.FFI
+import System.Glib.UTFString (peekUTFString)
+import System.Glib.GError (failOnGError)
+{#import System.Glib.Signals#}
+{#import System.Glib.GObject#} [_$_]
+import Graphics.UI.Gtk.General.Threading
+
+{#context lib="gtk" prefix="gtk" #}
+
+
+-- Here are the generators that turn a Haskell function into
+-- a C function pointer. The fist Argument is always the widget,
+-- the last one is the user g_pointer. Both are ignored.
+
+@MODULE_BODY@
hunk ./gtk/gtk.cabal 27
+ Graphics/UI/Gtk/Signals.chs.template
hunk ./gtk/gtk.cabal 208
- Graphics.UI.Gtk.General.Threading
hunk ./gtk/gtk.cabal 217
+ Graphics.UI.Gtk.General.Threading
hunk ./gtk/gtk.cabal 227
+ -- the following field is only needed because the gtk package needs a slightly different
+ -- Signals.chs template file to avoid circular imports with GtkInternals
+ x-Signals-Template: Graphics/UI/Gtk/Signals.chs.template
hunk ./tools/callbackGen/HookGenerator.hs 8
-import Data.List (nub)
+import Data.List (nub, isPrefixOf)
hunk ./tools/callbackGen/HookGenerator.hs 442
- "Program to generate callback hook for Gtk signals. Usage:\n"++
- "HookGenerator <moduleName>\n"++
+ "Program to generate callback hook for Gtk signals. Usage:\n\n"++
+ "HookGenerator [--template=<template-file>] [--types=<types-file>]--modname=<moduleName> > <outFile>\n"++
hunk ./tools/callbackGen/HookGenerator.hs 445
- " <moduleName> the module name for <outFile>\n"
+ " <moduleName> the module name for <outFile>\n"++
+ " <template-file> a path to the Signal.chs.template file\n"++
+ " <types-file> a path to a gtkmarshal.list file\n"
hunk ./tools/callbackGen/HookGenerator.hs 452
- if (length args /= 1) then usage else do
- typesFile <- getDataFileName "callbackGen/gtkmarshal.list"
- templateFile <- getDataFileName "callbackGen/Signal.chs.template"
- let [outModuleName] = args
+ let showHelp = not (null (filter ("-h" `isPrefixOf`) args++
+ filter ("--help" `isPrefixOf`) args)) || null args
+ if showHelp then usage else do
+ let outModuleName = case map (drop 10) (filter ("--modname=" `isPrefixOf`) args) of
+ (modName:_) -> modName
+ templateFile <- case map (drop 11) (filter ("--template=" `isPrefixOf`) args) of
+ [tplName] -> return tplName
+ _ -> getDataFileName "callbackGen/Signal.chs.template"
+ typesFile <- case map (drop 11) (filter ("--types=" `isPrefixOf`) args) of
+ [typName] -> return typName
+ _ -> getDataFileName "callbackGen/gtkmarshal.list"
hunk ./tools/callbackGen/Signal.chs.template 53
-import Graphics.UI.Gtk.General.Threading
+import Graphics.UI.GtkInternals
|