You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(68) |
Aug
(4) |
Sep
|
Oct
(23) |
Nov
(95) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
(51) |
May
(81) |
Jun
(2) |
Jul
(86) |
Aug
(143) |
Sep
(3) |
Oct
(31) |
Nov
(63) |
Dec
(90) |
2005 |
Jan
(277) |
Feb
(157) |
Mar
(99) |
Apr
(195) |
May
(151) |
Jun
(148) |
Jul
(98) |
Aug
(123) |
Sep
(20) |
Oct
(174) |
Nov
(155) |
Dec
(26) |
2006 |
Jan
(51) |
Feb
(19) |
Mar
(16) |
Apr
(12) |
May
(5) |
Jun
|
Jul
(11) |
Aug
(7) |
Sep
(10) |
Oct
(31) |
Nov
(174) |
Dec
(56) |
2007 |
Jan
(45) |
Feb
(52) |
Mar
(10) |
Apr
(5) |
May
(47) |
Jun
(16) |
Jul
(80) |
Aug
(29) |
Sep
(14) |
Oct
(59) |
Nov
(46) |
Dec
(16) |
2008 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
(49) |
Jun
(26) |
Jul
(8) |
Aug
(4) |
Sep
(25) |
Oct
(53) |
Nov
(9) |
Dec
(1) |
2009 |
Jan
(66) |
Feb
(11) |
Mar
(1) |
Apr
(14) |
May
(8) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(9) |
Oct
(23) |
Nov
(35) |
Dec
|
2010 |
Jan
(7) |
Feb
(2) |
Mar
(39) |
Apr
(19) |
May
(161) |
Jun
(19) |
Jul
(32) |
Aug
(65) |
Sep
(113) |
Oct
(120) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
(5) |
Mar
(4) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(12) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(17) |
Mar
(4) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(8) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Andy S. <And...@co...> - 2010-09-07 09:22:24
|
diffing dir... Tue Sep 7 04:47:41 EDT 2010 Andy Stewart <laz...@gm...> * Add new module Buttons.LinkButton Ignore-this: 5e93f72ddb69fe983c9a7449fa93ab0d { addfile ./gtk/Graphics/UI/Gtk/Buttons/LinkButton.chs hunk ./gtk/Graphics/UI/Gtk/Buttons/LinkButton.chs 1 +{-# LANGUAGE CPP #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget LinkButton +-- +-- Author : Andy Stewart +-- +-- Created: 22 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Create buttons bound to a URL +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Buttons.LinkButton ( + +-- * Detail +-- +-- | A 'LinkButton' is a 'Button' with a hyperlink, similar to the one used by +-- web browsers, which triggers an action when clicked. It is useful to show +-- quick links to resources. +-- +-- A link button is created by calling either 'linkButtonNew' or +-- 'linkButtonNewWithLabel'. If using the former, the URI you pass to the +-- constructor is used as a label for the widget. +-- +-- The URI bound to a 'LinkButton' can be set specifically using +-- \"set linkButton [linkButtonURI := uri]\", and retrieved using \"uri <- get linkButton linkButtonURI\". +-- +-- 'LinkButton' offers a global hook, which is called when the used clicks +-- on it: see 'linkButtonSetURIHook'. +-- +-- 'LinkButton' was added in Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----'Bin' +-- | +----'Button' +-- | +----LinkButton +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + LinkButton, + LinkButtonClass, + castToLinkButton, + toLinkButton, + +-- * Constructors + linkButtonNew, + linkButtonNewWithLabel, + +-- * Methods + linkButtonSetUriHook, + +-- * Attributes + linkButtonURI, +#if GTK_CHECK_VERSION(2,14,0) + linkButtonVisited, +#endif +#endif + ) where + +import Control.Monad (liftM, unless) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) + +-------------------- +-- Constructors + +-- | Creates a new 'LinkButton' with the URI as its text. +-- +linkButtonNew :: + String -- ^ @uri@ - a valid URI + -> IO LinkButton +linkButtonNew uri = + makeNewObject mkLinkButton $ + liftM (castPtr :: Ptr Widget -> Ptr LinkButton) $ + withUTFString uri $ \uriPtr -> + {# call gtk_link_button_new #} + uriPtr + +-- | Creates a new 'LinkButton' containing a label. +-- +linkButtonNewWithLabel :: + String -- ^ @uri@ - a valid URI + -> String -- ^ @label@ - the text of the button + -> IO LinkButton +linkButtonNewWithLabel uri label = + makeNewObject mkLinkButton $ + liftM (castPtr :: Ptr Widget -> Ptr LinkButton) $ + withUTFString label $ \labelPtr -> + withUTFString uri $ \uriPtr -> + {# call gtk_link_button_new_with_label #} + uriPtr + labelPtr + +-------------------- +-- Methods + +-- | Sets @func@ as the function that should be invoked every time a user +-- clicks a 'LinkButton'. This function is called before every callback +-- registered for the \"clicked\" signal. +-- +-- If no uri hook has been set, Gtk+ defaults to calling 'showURI'. +-- +linkButtonSetUriHook :: (String -> IO ()) -> IO () +linkButtonSetUriHook func = do + pfPtr <- mkLinkButtonUriFunc $ \_ cstr _ -> do + str <- peekCString cstr + func str + {# call link_button_set_uri_hook #} pfPtr (castFunPtrToPtr pfPtr) destroyFunPtr + freeHaskellFunPtr pfPtr + [_$_] +{#pointer LinkButtonUriFunc#} + +foreign import ccall "wrapper" mkLinkButtonUriFunc :: + (Ptr LinkButton -> CString -> Ptr () -> IO ()) + -> IO LinkButtonUriFunc + +-------------------- +-- Attributes + +-- | The URI bound to this button. +-- [_$_] +-- Default value: \"\" +-- [_$_] +-- * Available since Gtk+ version 2.10 +-- +linkButtonURI :: LinkButtonClass self => Attr self String +linkButtonURI = newAttrFromStringProperty "uri" + +#if GTK_CHECK_VERSION(2,14,0) +-- | The 'visited' state of this button. A visited link is drawn in a different color. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- * Available since Gtk+ version 2.14 +-- +linkButtonVisited :: LinkButtonClass self => Attr self Bool +linkButtonVisited = newAttrFromBoolProperty "visited" +#endif +#endif } |
From: Andy S. <And...@co...> - 2010-09-07 09:22:19
|
diffing dir... Tue Sep 7 04:47:08 EDT 2010 Andy Stewart <laz...@gm...> * Add module in Gtk.chs Ignore-this: 35b6f9b2d9048de1ba55afbe83406fa2 { hunk ./gtk/Graphics/UI/Gtk.chs 92 + module Graphics.UI.Gtk.Buttons.LinkButton, + module Graphics.UI.Gtk.Buttons.ScaleButton, + module Graphics.UI.Gtk.Buttons.VolumeButton, hunk ./gtk/Graphics/UI/Gtk.chs 299 +import Graphics.UI.Gtk.Buttons.LinkButton +import Graphics.UI.Gtk.Buttons.ScaleButton +import Graphics.UI.Gtk.Buttons.VolumeButton } |
From: Andy S. <And...@co...> - 2010-09-07 08:24:15
|
diffing dir... Tue Sep 7 04:19:00 EDT 2010 Andy Stewart <laz...@gm...> * Fix entryBufferInsertText's define Ignore-this: 8b8dcbfb8c2fef678ed060565db24b79 { hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 139 + -> Int -- ^ @nChars@ the number of characters need insert hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 141 -entryBufferInsertText self position chars = +entryBufferInsertText self position chars nChars = hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 148 - (fromIntegral (length chars)) + (fromIntegral nChars) } |
From: Andy S. <And...@co...> - 2010-09-07 08:24:13
|
diffing dir... Tue Sep 7 04:01:12 EDT 2010 Andy Stewart <laz...@gm...> * Fix docs of EntryBuffer Ignore-this: e1c078521d72f86ed9af5744c2832c7c { hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 134 --- If @nChars@ is negative, then characters from chars will be inserted --- until a null-terminator is found. If @position@ or @nChars@ are out of --- bounds, or the maximum buffer text length is exceeded, then they are coerced --- to sane values. --- --- Note that the position and length are in characters, not in bytes. --- hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 153 --- If @position@ or @nChars@ are out of bounds, then they are coerced to --- sane values. --- --- Note that the positions are specified in characters, not bytes. --- hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 209 --- | The length (in characters) of the text in buffer. +-- | The length of the text in buffer. hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 220 --- | The maximum length (in characters) of the text in the buffer. +-- | The maximum length of the text in the buffer. } |
From: Andy S. <And...@co...> - 2010-09-07 07:58:41
|
diffing dir... Tue Sep 7 03:53:46 EDT 2010 Andy Stewart <laz...@gm...> * Fix docs of rgbToHsv Ignore-this: df39806c28b03691b97a08b243545d41 { hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 222 + -- ^ @(r, g, b)@ @r@ value for the red component [_$_] + -- @g@ value for the green component [_$_] + -- @b@ value for the blue component hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 226 + -- ^ @(h, s, v)@ [_$_] + -- @h@ - Return value for the hue [_$_] + -- @s@ - Return value for the saturation [_$_] + -- @v@ - Return value for the value } |
From: Andy S. <And...@co...> - 2010-09-07 07:58:41
|
diffing dir... Tue Sep 7 03:50:40 EDT 2010 Andy Stewart <laz...@gm...> * Add unsafePerformIO in functions : rgbToHsv, hsvToRgb Ignore-this: df6f9dd3ceae123c7a244a6fbf78a380 { hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 197 - -> IO (Double, Double, Double) -- ^ @(r, g, b)@ @r@ - Return value for the red - -- component @g@ - Return value for the green - -- component @b@ - Return value for the blue - -- component + -> (Double, Double, Double) -- ^ @(r, g, b)@ @r@ - Return value for the red + -- component @g@ - Return value for the green + -- component @b@ - Return value for the blue + -- component hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 202 + unsafePerformIO $ hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 220 -rgbToHsv :: (Double, Double, Double) -> IO (Double, Double, Double) +rgbToHsv :: [_$_] + (Double, Double, Double) [_$_] + -> (Double, Double, Double) hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 224 + unsafePerformIO $ } |
From: Andy S. <And...@co...> - 2010-09-07 07:58:37
|
diffing dir... Tue Sep 7 03:24:58 EDT 2010 Andy Stewart <laz...@gm...> * Fix typo. (sorry) Ignore-this: eb72d96a038d2caf217a5b4dbe66d02d { hunk ./gtk/Graphics/UI/Gtk/Special/HRuler.chs 56 - hrulerNew, + hRulerNew, hunk ./gtk/Graphics/UI/Gtk/Special/HRuler.chs 72 -hrulerNew :: IO HRuler -hrulerNew = +hRulerNew :: IO HRuler +hRulerNew = hunk ./gtk/Graphics/UI/Gtk/Special/VRuler.chs 56 - vrulerNew, + vRulerNew, hunk ./gtk/Graphics/UI/Gtk/Special/VRuler.chs 72 -vrulerNew :: IO VRuler -vrulerNew = +vRulerNew :: IO VRuler +vRulerNew = } |
From: Andy S. <And...@co...> - 2010-09-07 07:58:35
|
diffing dir... Tue Sep 7 03:20:31 EDT 2010 Andy Stewart <laz...@gm...> * rulerGetRange should be 'IO (Double, Double, Double, Double)' Ignore-this: 6d87203c7ba64b94476d70b6e407ac33 { hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs 108 - -> IO (Maybe (Double, Double, Double, Double)) + -> IO (Double, Double, Double, Double) hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs 120 - if lowerPtr == nullPtr || - upperPtr == nullPtr || - positionPtr == nullPtr || - maxSizePtr == nullPtr - then return Nothing - else do - lower <- peek lowerPtr - upper <- peek upperPtr - position <- peek positionPtr - maxSize <- peek maxSizePtr - return $ Just (realToFrac lower, realToFrac upper, realToFrac position, realToFrac maxSize) + lower <- peek lowerPtr + upper <- peek upperPtr + position <- peek positionPtr + maxSize <- peek maxSizePtr + return (realToFrac lower, realToFrac upper, realToFrac position, realToFrac maxSize) hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs 131 -rulerRange :: RulerClass self => ReadWriteAttr self (Maybe (Double, Double, Double, Double)) (Double, Double, Double, Double) +rulerRange :: RulerClass self => Attr self (Double, Double, Double, Double) } |
From: Andy S. <And...@co...> - 2010-09-07 03:21:22
|
diffing dir... Mon Sep 6 23:18:50 EDT 2010 Andy Stewart <laz...@gm...> * Use better name handle duplicate function/signal name. Ignore-this: 1c00336e0ddeb1dcee4d847f50f51768 { hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs 84 - infoBarResponse, + infoBarEmitResponse, hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs 92 - infoBarResponseSignal, + infoBarResponse, hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs 203 -infoBarResponse :: InfoBarClass self => self +infoBarEmitResponse :: InfoBarClass self => self hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs 206 -infoBarResponse self responseId = +infoBarEmitResponse self responseId = hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs 269 -infoBarResponseSignal :: InfoBarClass self => Signal self (Int -> IO ()) -infoBarResponseSignal = Signal (connect_INT__NONE "response") +infoBarResponse :: InfoBarClass self => Signal self (Int -> IO ()) +infoBarResponse = Signal (connect_INT__NONE "response") } |
From: Andy S. <And...@co...> - 2010-09-07 03:21:21
|
diffing dir... Mon Sep 6 23:17:01 EDT 2010 Andy Stewart <laz...@gm...> * Add new module Entry.EntryBuffer Ignore-this: cd62e6905f9fb43211f8a5d1e5e1a3a1 { hunk ./gtk/Graphics/UI/Gtk.chs 84 +#if GTK_CHECK_VERSION(2,18,0) + module Graphics.UI.Gtk.Display.InfoBar, +#endif hunk ./gtk/Graphics/UI/Gtk.chs 95 + module Graphics.UI.Gtk.Entry.EntryBuffer, hunk ./gtk/Graphics/UI/Gtk.chs 164 +#if GTK_CHECK_VERSION(2,14,0) + module Graphics.UI.Gtk.Selectors.HSV, +#endif + -- * Special-purpose features + module Graphics.UI.Gtk.Special.Ruler, + module Graphics.UI.Gtk.Special.HRuler, + module Graphics.UI.Gtk.Special.VRuler, hunk ./gtk/Graphics/UI/Gtk.chs 288 +#if GTK_CHECK_VERSION(2,18,0) +import Graphics.UI.Gtk.Display.InfoBar +#endif hunk ./gtk/Graphics/UI/Gtk.chs 299 +import Graphics.UI.Gtk.Entry.EntryBuffer hunk ./gtk/Graphics/UI/Gtk.chs 375 +#if GTK_CHECK_VERSION(2,14,0) +import Graphics.UI.Gtk.Selectors.HSV +#endif +-- Special-purpose features +import Graphics.UI.Gtk.Special.Ruler +import Graphics.UI.Gtk.Special.HRuler +import Graphics.UI.Gtk.Special.VRuler addfile ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs 1 +{-# LANGUAGE CPP #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget EntryBuffer +-- +-- Author : Andy Stewart +-- +-- Created: 22 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Text buffer for 'Entry' +-- +-- * Module available since Gtk+ version 2.18 +-- +module Graphics.UI.Gtk.Entry.EntryBuffer ( + +-- * Detail +-- +-- | The 'EntryBuffer' class contains the actual text displayed in a 'Entry' +-- widget. +-- +-- A single 'EntryBuffer' object can be shared by multiple 'Entry' widgets +-- which will then share the same text content, but not the cursor position, +-- visibility attributes, icon etc. +-- +-- 'EntryBuffer' may be derived from. Such a derived class might allow text +-- to be stored in an alternate location, such as non-pageable memory, useful +-- in the case of important passwords. Or a derived class could integrate with +-- an application's concept of undo\/redo. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----EntryBuffer +-- @ + +#if GTK_CHECK_VERSION(2,18,0) +-- * Types + EntryBuffer, + EntryBufferClass, + castToEntryBuffer, + toEntryBuffer, + +-- * Constructors + entryBufferNew, + +-- * Methods + entryBufferGetBytes, + entryBufferInsertText, + entryBufferDeleteText, + entryBufferEmitDeletedText, + entryBufferEmitInsertedText, + +-- * Attributes + entryBufferText, + entryBufferLength, + entryBufferMaxLength, + +-- * Signals + entryBufferInsertedText, + entryBufferDeletedText, +#endif + ) where + +import Control.Monad (liftM) +import Data.Maybe (fromJust) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,18,0) +-------------------- +-- Constructors + +-- | Create a new 'EntryBuffer' object. +-- +-- Optionally, specify initial text to set in the buffer. +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferNew :: + Maybe String -- ^ @initialChars@ - initial buffer text or 'Nothing' + -> IO EntryBuffer +entryBufferNew initialChars = + constructNewGObject mkEntryBuffer $ + maybeWith withUTFString initialChars $ \initialCharsPtr -> do + let chars = if initialCharsPtr == nullPtr + then (-1) + else length $ fromJust initialChars + {# call gtk_entry_buffer_new #} + initialCharsPtr + (fromIntegral chars) + +-------------------- +-- Methods + +-- | Retrieves the length in bytes of the buffer. See 'entryBufferGetLength'. +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferGetBytes :: EntryBufferClass self => self + -> IO Int -- ^ returns The byte length of the buffer. +entryBufferGetBytes self = + liftM fromIntegral $ [_$_] + {# call gtk_entry_buffer_get_bytes #} + (toEntryBuffer self) + +-- | Inserts @nChars@ characters of @chars@ into the contents of the buffer, +-- at position @position@. +-- +-- If @nChars@ is negative, then characters from chars will be inserted +-- until a null-terminator is found. If @position@ or @nChars@ are out of +-- bounds, or the maximum buffer text length is exceeded, then they are coerced +-- to sane values. +-- +-- Note that the position and length are in characters, not in bytes. +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferInsertText :: EntryBufferClass self => self + -> Int -- ^ @position@ - the position at which to insert text. + -> String -- ^ @chars@ - the text to insert into the buffer. + -> IO Int -- ^ returns The number of characters actually inserted. +entryBufferInsertText self position chars = + liftM fromIntegral $ + withUTFString chars $ \charsPtr -> + {# call gtk_entry_buffer_insert_text #} + (toEntryBuffer self) + (fromIntegral position) + charsPtr + (fromIntegral (length chars)) + +-- | Deletes a sequence of characters from the buffer. @nChars@ characters are +-- deleted starting at @position@. If @nChars@ is negative, then all characters +-- until the end of the text are deleted. +-- +-- If @position@ or @nChars@ are out of bounds, then they are coerced to +-- sane values. +-- +-- Note that the positions are specified in characters, not bytes. +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferDeleteText :: EntryBufferClass self => self + -> Int -- ^ @position@ - position at which to delete text + -> Int -- ^ @nChars@ - number of characters to delete + -> IO Int -- ^ returns The number of characters deleted. +entryBufferDeleteText self position nChars = + liftM fromIntegral $ + {# call gtk_entry_buffer_delete_text #} + (toEntryBuffer self) + (fromIntegral position) + (fromIntegral nChars) + +-- | Used when subclassing 'EntryBuffer' +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferEmitDeletedText :: EntryBufferClass self => self + -> Int -- ^ @position@ - position at which text was deleted + -> Int -- ^ @nChars@ - number of characters deleted + -> IO () +entryBufferEmitDeletedText self position nChars = + {# call gtk_entry_buffer_emit_deleted_text #} + (toEntryBuffer self) + (fromIntegral position) + (fromIntegral nChars) + +-- | Used when subclassing 'EntryBuffer' +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferEmitInsertedText :: EntryBufferClass self => self + -> Int -- ^ @position@ - position at which text was inserted + -> String -- ^ @chars@ - text that was inserted + -> Int -- ^ @nChars@ - number of characters inserted + -> IO () +entryBufferEmitInsertedText self position chars nChars = + withUTFString chars $ \charsPtr -> + {# call gtk_entry_buffer_emit_inserted_text #} + (toEntryBuffer self) + (fromIntegral position) + charsPtr + (fromIntegral nChars) + +-------------------- +-- Attributes + +-- | The contents of the buffer. +-- [_$_] +-- Default value: \"\" +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferText :: EntryBufferClass self => Attr self String +entryBufferText = newAttrFromStringProperty "text" + +-- | The length (in characters) of the text in buffer. +-- [_$_] +-- Allowed values: <= 65535 +-- [_$_] +-- Default value: 0 +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferLength :: EntryBufferClass self => ReadAttr self Int +entryBufferLength = readAttrFromIntProperty "length" + +-- | The maximum length (in characters) of the text in the buffer. +-- [_$_] +-- Allowed values: [0,65535] +-- [_$_] +-- Default value: 0 +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferMaxLength :: EntryBufferClass self => Attr self Int +entryBufferMaxLength = newAttrFromIntProperty "max-length" + +-------------------- +-- Signals + +-- | +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferInsertedText :: EntryBufferClass self => Signal self (Int -> String -> Int -> IO ()) +entryBufferInsertedText = Signal (connect_INT_STRING_INT__NONE "inserted_text") + +-- | +-- +-- * Available since Gtk+ version 2.18 +-- +entryBufferDeletedText :: EntryBufferClass self => Signal self (Int -> Int -> IO ()) +entryBufferDeletedText = Signal (connect_INT_INT__NONE "deleted_text") + +#endif hunk ./gtk/gtk.cabal 176 + Graphics.UI.Gtk.Entry.EntryBuffer hunk ./gtk/hierarchy.list 210 + GtkEntryBuffer if gtk-2.18 hunk ./gtk/marshal.list 158 +# For EntryBuffer +NONE:INT,STRING,INT } |
From: Andy S. <And...@co...> - 2010-09-07 02:46:01
|
diffing dir... Mon Sep 6 22:37:17 EDT 2010 Andy Stewart <laz...@gm...> * Add new module Display.InfoBar Ignore-this: ac8df0205af7de4793358f1e9c08f9b5 { addfile ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs 1 +{-# LANGUAGE CPP #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget InfoBar +-- +-- Author : Andy Stewart +-- +-- Created: 27 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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. +-- +-- The following varargs functions can't bound: +-- +-- gtk_info_bar_new_with_buttons +-- gtk_info_bar_add_buttons +-- +-- Use 'infoBarAddButton' replace. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Report important messages to the user +-- +module Graphics.UI.Gtk.Display.InfoBar ( + +-- * Detail +-- +-- | 'InfoBar' is a widget that can be used to show messages to the user +-- without showing a dialog. It is often temporarily shown at the top or bottom +-- of a document. In contrast to 'Dialog', which has a horizontal action area +-- at the bottom, 'InfoBar' has a vertical action area at the side. +-- +-- The API of 'InfoBar' is very similar to 'Dialog', allowing you to add +-- buttons to the action area with 'infoBarAddButton'. [_$_] +-- The sensitivity of action widgets can be controlled +-- with 'infoBarSetResponseSensitive'. To add widgets to the main content area +-- of a 'InfoBar', use 'infoBarGetContentArea' and add your widgets to the +-- container. +-- +-- Similar to 'MessageDialog', the contents of a 'InfoBar' can by classified +-- as error message, warning, informational message, etc, by using +-- 'infoBarSetMessageType'. Gtk+ uses the message type to determine the +-- background color of the message area. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----'Box' +-- | +----'HBox' +-- | +----InfoBar +-- @ + +#if GTK_CHECK_VERSION(2,18,0) +-- * Types + InfoBar, + InfoBarClass, + castToInfoBar, + toInfoBar, + +-- * Constructors + infoBarNew, + +-- * Methods + infoBarAddActionWidget, + infoBarAddButton, + infoBarSetResponseSensitive, + infoBarSetDefaultResponse, + infoBarResponse, + infoBarGetActionArea, + infoBarGetContentArea, + +-- * Attributes + infoBarMessageType, + +-- * Signals + infoBarResponseSignal, + infoBarClose, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Windows.MessageDialog#} (MessageType) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Interfaces + +-- instance BuildableClass InfoBar + +-------------------- +-- Constructors + +#if GTK_CHECK_VERSION(2,18,0) +-- | Creates a new 'InfoBar' object. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarNew :: IO InfoBar +infoBarNew = + makeNewObject mkInfoBar $ + liftM (castPtr :: Ptr Widget -> Ptr InfoBar) $ + {# call gtk_info_bar_new #} + +-------------------- +-- Methods + +-- | Add an activatable widget to the action area of a 'InfoBar', connecting a signal handler that will +-- emit the "response" signal on the message area when the widget is activated. The widget is appended +-- to the end of the message areas action area. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarAddActionWidget :: (InfoBarClass self, WidgetClass child) => self + -> child -- ^ @child@ - an activatable widget + -> Int -- ^ @responseId@ - response ID for @child@ + -> IO () +infoBarAddActionWidget self child responseId = + {# call gtk_info_bar_add_action_widget #} + (toInfoBar self) + (toWidget child) + (fromIntegral responseId) + +-- | Adds a button with the given text (or a stock button, if buttonText is a +-- stock ID) and sets things up so that clicking the button will emit the +-- \"response\" signal with the given responseId. The button is appended to +-- the end of the info bars's action area. The button widget is returned, but +-- usually you don't need it. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarAddButton :: InfoBarClass self => self + -> String -- ^ @buttonText@ - text of button, or stock ID + -> Int -- ^ @responseId@ - response ID for the button + -> IO Button -- ^ returns the button widget that was added +infoBarAddButton self buttonText responseId = + makeNewObject mkButton $ + withUTFString buttonText $ \buttonTextPtr -> + liftM (castPtr :: Ptr Widget -> Ptr Button) $ + {# call gtk_info_bar_add_button #} + (toInfoBar self) + buttonTextPtr + (fromIntegral responseId) + +-- | Calls 'widgetSetSensitive' for each widget in the +-- info bars's action area with the given responseId. A convenient way to +-- sensitize\/desensitize dialog buttons. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarSetResponseSensitive :: InfoBarClass self => self + -> Int -- ^ @responseId@ - a response ID + -> Bool -- ^ @setting@ - @True@ for sensitive + -> IO () +infoBarSetResponseSensitive self responseId setting = + {# call gtk_info_bar_set_response_sensitive #} + (toInfoBar self) + (fromIntegral responseId) + (fromBool setting) + +-- | Sets the last widget in the info bar's action area with the given +-- responseId as the default widget for the dialog. Pressing \"Enter\" +-- normally activates the default widget. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarSetDefaultResponse :: InfoBarClass self => self + -> Int -- ^ @responseId@ - a response ID + -> IO () +infoBarSetDefaultResponse self responseId = + {# call gtk_info_bar_set_default_response #} + (toInfoBar self) + (fromIntegral responseId) + +-- | Emits the \'response\' signal with the given @responseId@. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarResponse :: InfoBarClass self => self + -> Int -- ^ @responseId@ - a response ID + -> IO () +infoBarResponse self responseId = + {# call gtk_info_bar_response #} + (toInfoBar self) + (fromIntegral responseId) + +-- | Returns the action area of @infoBar@. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarGetActionArea :: InfoBarClass self => self + -> IO Widget -- ^ returns the action area. +infoBarGetActionArea self = + makeNewObject mkWidget $ + {# call gtk_info_bar_get_action_area #} + (toInfoBar self) + +-- | Returns the content area of @infoBar@. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarGetContentArea :: InfoBarClass self => self + -> IO Widget -- ^ returns the content area. +infoBarGetContentArea self = + makeNewObject mkWidget $ + {# call gtk_info_bar_get_content_area #} + (toInfoBar self) + +-------------------- +-- Attributes + +-- | The type of the message. +-- [_$_] +-- The type is used to determine the colors to use in the info bar. [_$_] +-- [_$_] +-- If the type is 'MessageOther', no info bar is painted but the colors are still set. +-- [_$_] +-- Default value: 'MessageInfo' +-- [_$_] +-- * Available since Gtk+ version 2.18 +-- +infoBarMessageType :: InfoBarClass self => Attr self MessageType +infoBarMessageType = newAttrFromEnumProperty "message-type" + {# call pure unsafe gtk_message_type_get_type #} + +-------------------- +-- Signals + +-- | The 'close' signal is a keybinding signal which gets emitted when the user uses a keybinding to +-- dismiss the info bar. +-- [_$_] +-- The default binding for this signal is the Escape key. +-- [_$_] +-- Since 2.18 +infoBarClose :: InfoBarClass self => Signal self (IO ()) +infoBarClose = Signal (connect_NONE__NONE "close") + [_$_] + +-- | Emitted when an action widget is clicked or the application programmer +-- calls 'dialogResponse'. The @responseId@ depends on which action widget was +-- clicked. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarResponseSignal :: InfoBarClass self => Signal self (Int -> IO ()) +infoBarResponseSignal = Signal (connect_INT__NONE "response") +#endif + hunk ./gtk/gtk.cabal 170 + Graphics.UI.Gtk.Display.InfoBar hunk ./gtk/hierarchy.list 121 + GtkInfoBar if gtk-2.18 } |
From: Andy S. <And...@co...> - 2010-09-07 00:39:29
|
diffing dir... Mon Sep 6 20:37:26 EDT 2010 Andy Stewart <laz...@gm...> * Add new module Selectors.HSV Ignore-this: 806626550d431c843cb9348f36ed24c4 { addfile ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 1 +{-# LANGUAGE CPP #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget HSV +-- +-- Author : Andy Stewart +-- +-- Created: 25 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A \'color wheel\' widget +-- +-- * Module available since Gtk+ version 2.14 +-- +module Graphics.UI.Gtk.Selectors.HSV ( hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs 32 +-- * Detail +-- +-- | 'HSV' is the \'color wheel\' part of a complete color selector widget. It +-- allows to select a color by determining its 'HSV' components in an intuitive +-- way. Moving the selection around the outer ring changes the hue, and moving +-- the selection point inside the inner triangle changes value and saturation. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----HSV +-- @ + +#if GTK_CHECK_VERSION(2,14,0) +-- * Types + HSV, + HSVClass, + castToHSV, + toHSV, + +-- * Constructors + hsvNew, + +-- * Methods + hsvIsAdjusting, + hsvToRgb, + rgbToHsv, + +-- * Attributes + hsvColor, + hsvMetrics, + +-- * Signals + hsvChanged, + hsvMove, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.General.Enums (DirectionType (..)) +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Signals#} +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,14,0) +-------------------- +-- Constructors + +-- | Creates a new 'HSV' color selector. +-- +-- * Available since 2.14 +-- +hsvNew :: IO HSV +hsvNew = + makeNewObject mkHSV $ + liftM (castPtr :: Ptr Widget -> Ptr HSV) $ + {# call gtk_hsv_new #} + +-------------------- +-- Methods + +-- | Sets the current color in an 'HSV' color selector. Color component values +-- must be in the [0.0, 1.0] range. +-- +-- * Available since 2.14 +-- +hsvSetColor :: HSVClass self => self + -> (Double, Double, Double) + -- ^ @(h, s, v)@ [_$_] + -- @h@ - value for the hue [_$_] + -- @s@ value for the saturation [_$_] + -- @v@ value for the value + -> IO () +hsvSetColor self (h, s, v) = + {# call gtk_hsv_set_color #} + (toHSV self) + (realToFrac h) + (realToFrac s) + (realToFrac v) + +-- | Queries the current color in an 'HSV' color selector. Returned values will +-- be in the [0.0, 1.0] range. +-- +hsvGetColor :: HSVClass self => self + -> IO (Double, Double, Double) -- ^ @(h, s, v)@ @h@ - Return value for the hue @s@ - + -- Return value for the saturation @v@ - Return + -- value for the value +hsvGetColor self = + alloca $ \hPtr -> + alloca $ \sPtr -> + alloca $ \vPtr -> do + {# call gtk_hsv_get_color #} + (toHSV self) + hPtr + sPtr + vPtr + h <- peek hPtr + s <- peek sPtr + v <- peek vPtr + return (realToFrac h, realToFrac s, realToFrac v) + +-- | Sets the size and ring width of an 'HSV' color selector. +-- +hsvSetMetrics :: HSVClass self => self + -> (Int, Int) + -- ^ @(size, ringWidth)@ [_$_] + -- ^ @size@ - Diameter for the hue ring + -- ^ @ringWidth@ - Width of the hue ring + -> IO () +hsvSetMetrics self (size, ringWidth) = + {# call gtk_hsv_set_metrics #} + (toHSV self) + (fromIntegral size) + (fromIntegral ringWidth) + +-- | Queries the size and ring width of an 'HSV' color selector. +-- +hsvGetMetrics :: HSVClass self => self + -> IO (Int, Int) -- ^ @(size, ringWidth)@ [_$_] + -- @size@ - Return value for the diameter of the hue ring + -- @ringWidth@ - Return value for the width of the hue ring +hsvGetMetrics self = + alloca $ \sizePtr -> + alloca $ \ringWidthPtr -> do + {# call gtk_hsv_get_metrics #} + (toHSV self) + sizePtr + ringWidthPtr + size <- peek sizePtr + ringWidth <- peek ringWidthPtr + return (fromIntegral size, fromIntegral ringWidth) + +-- | An 'HSV' color selector can be said to be adjusting if multiple rapid +-- changes are being made to its value, for example, when the user is adjusting +-- the value with the mouse. This function queries whether the 'HSV' color +-- selector is being adjusted or not. +-- +hsvIsAdjusting :: HSVClass self => self + -> IO Bool -- ^ returns @True@ if clients can ignore changes to the color + -- value, since they may be transitory, or @False@ if they should + -- consider the color value status to be final. +hsvIsAdjusting self = + liftM toBool $ + {# call gtk_hsv_is_adjusting #} + (toHSV self) + +-- | Converts a color from 'HSV' space to RGB. Input values must be in the [0.0, +-- 1.0] range; output values will be in the same range. +-- +hsvToRgb :: + (Double, Double, Double) + -- ^ @(h, s, v)@ [_$_] + -- @h@ - value for the hue [_$_] + -- @s@ value for the saturation [_$_] + -- @v@ value for the value + -> IO (Double, Double, Double) -- ^ @(r, g, b)@ @r@ - Return value for the red + -- component @g@ - Return value for the green + -- component @b@ - Return value for the blue + -- component +hsvToRgb (h, s, v) = + alloca $ \rPtr -> + alloca $ \gPtr -> + alloca $ \bPtr -> do + {# call gtk_hsv_to_rgb #} + (realToFrac h) + (realToFrac s) + (realToFrac v) + rPtr + gPtr + bPtr + r <- peek rPtr + g <- peek gPtr + b <- peek bPtr + return (realToFrac r, realToFrac g, realToFrac b) + +-- | Converts a color from RGB space to 'HSV'. Input values must be in the [0.0, 1.0] range; output values +-- will be in the same range. +rgbToHsv :: (Double, Double, Double) -> IO (Double, Double, Double) +rgbToHsv (r, g, b) = + alloca $ \hPtr -> + alloca $ \sPtr -> + alloca $ \vPtr -> do + {# call rgb_to_hsv #} + (realToFrac r) + (realToFrac g) + (realToFrac b) + hPtr + sPtr + vPtr + h <- peek hPtr + s <- peek sPtr + v <- peek vPtr + return (realToFrac h, realToFrac s, realToFrac v) + +-------------------- +-- Attributes +-- | Color in an 'HSV' color selector. [_$_] +-- Color component values must be in the [0.0, 1.0] range. +hsvColor :: HSVClass self => Attr self (Double, Double, Double) +hsvColor = newAttr + hsvGetColor + hsvSetColor + +-- | The size and ring width of an 'HSV' color selector. +hsvMetrics :: HSVClass self => Attr self (Int, Int) +hsvMetrics = newAttr + hsvGetMetrics + hsvSetMetrics + +-------------------- +-- Signals + +-- | +-- +hsvChanged :: HSVClass self => Signal self (IO ()) +hsvChanged = Signal (connect_NONE__NONE "changed") + +-- | +-- +hsvMove :: HSVClass self => Signal self (DirectionType -> IO ()) +hsvMove = Signal (connect_ENUM__NONE "move") + [_$_] +#endif hunk ./gtk/gtk.cabal 292 + Graphics.UI.Gtk.Selectors.HSV hunk ./gtk/hierarchy.list 58 + GtkHSV as HSV, gtk_hsv_get_type if gtk-2.14 } |
From: Andy S. <And...@co...> - 2010-09-07 00:10:03
|
diffing dir... Mon Sep 6 20:04:39 EDT 2010 Andy Stewart <laz...@gm...> * Add new module Special.VRuler Ignore-this: 6db57f3a326298504ec17b2a6d5c8e3e { addfile ./gtk/Graphics/UI/Gtk/Special/VRuler.chs hunk ./gtk/Graphics/UI/Gtk/Special/VRuler.chs 1 +{-# LANGUAGE CPP #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget VRuler +-- +-- Author : Andy Stewart +-- +-- Created: 28 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A vertical ruler +-- +module Graphics.UI.Gtk.Special.VRuler ( + +-- * Detail +-- +-- | The 'VRuler' widget is a widget arranged vertically creating a ruler that +-- is utilized around other widgets such as a text widget. The ruler is used to +-- show the location of the mouse on the window and to show the size of the +-- window in specified units. The available units of measurement are 'Pixels', +-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Ruler' +-- | +----VRuler +-- @ + +-- * Types + VRuler, + VRulerClass, + castToVRuler, + toVRuler, + +-- * Constructors + vrulerNew, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new vertical ruler +-- +vrulerNew :: IO VRuler +vrulerNew = + makeNewObject mkVRuler $ + liftM (castPtr :: Ptr Widget -> Ptr VRuler) $ + {# call gtk_vruler_new #} hunk ./gtk/gtk.cabal 294 + Graphics.UI.Gtk.Special.VRuler } |
From: Andy S. <And...@co...> - 2010-09-07 00:10:01
|
diffing dir... Mon Sep 6 20:04:17 EDT 2010 Andy Stewart <laz...@gm...> * Add new module Special.HRuler Ignore-this: 5fd40a008e1e2f81e8aced64d6768f2 { addfile ./gtk/Graphics/UI/Gtk/Special/HRuler.chs hunk ./gtk/Graphics/UI/Gtk/Special/HRuler.chs 1 +{-# LANGUAGE CPP #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget HRuler +-- +-- Author : Andy Stewart +-- +-- Created: 28 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A horizontal ruler +-- +module Graphics.UI.Gtk.Special.HRuler ( + +-- * Detail +-- +-- | The 'HRuler' widget is a widget arranged horizontally creating a ruler that +-- is utilized around other widgets such as a text widget. The ruler is used to +-- show the location of the mouse on the window and to show the size of the +-- window in specified units. The available units of measurement are 'Pixels', +-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Ruler' +-- | +----HRuler +-- @ + +-- * Types + HRuler, + HRulerClass, + castToHRuler, + toHRuler, + +-- * Constructors + hrulerNew, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new horizontal ruler. +-- +hrulerNew :: IO HRuler +hrulerNew = + makeNewObject mkHRuler $ + liftM (castPtr :: Ptr Widget -> Ptr HRuler) $ + {# call gtk_hruler_new #} hunk ./gtk/gtk.cabal 293 + Graphics.UI.Gtk.Special.HRuler } |
From: Andy S. <And...@co...> - 2010-09-07 00:09:59
|
diffing dir... Mon Sep 6 20:03:36 EDT 2010 Andy Stewart <laz...@gm...> * Add new module Gtk.Special.Ruler Ignore-this: 16c2a60034a417e5b60bfb45f091962c { adddir ./gtk/Graphics/UI/Gtk/Special addfile ./gtk/Graphics/UI/Gtk/Special/Ruler.chs hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs 1 +{-# LANGUAGE CPP #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Ruler +-- +-- Author : Andy Stewart +-- +-- Created: 28 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Base class for horizontal or vertical rulers +-- +module Graphics.UI.Gtk.Special.Ruler ( hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs 30 +-- * Detail +-- +-- | The 'Ruler' widget is a base class for horizontal and vertical rulers. +-- Rulers are used to show the mouse pointer's location in a window. The ruler +-- can either be horizontal or vertical on the window. Within the ruler a small +-- triangle indicates the location of the mouse relative to the horizontal or +-- vertical ruler. See 'HRuler' to learn how to create a new horizontal ruler. +-- See 'VRuler' to learn how to create a new vertical ruler. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----Ruler +-- | +----'HRuler' +-- | +----'VRuler' +-- @ + +-- * Types + Ruler, + RulerClass, + castToRuler, + toRuler, + +-- * Enums + MetricType (..), + +-- * Attributes + rulerRange, + rulerLower, + rulerUpper, + rulerPosition, + rulerMaxSize, +#if GTK_CHECK_VERSION(2,8,0) + rulerMetric, +#endif [_$_] + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.General.Enums +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Methods + +-- | This sets the range of the ruler. +-- +rulerSetRange :: RulerClass self => self + -> (Double + ,Double + ,Double + ,Double) [_$_] + -- ^ @lower@ - the lower limit of the ruler + -- ^ @upper@ - the upper limit of the ruler + -- ^ @position@ - the mark on the ruler + -- ^ @maxSize@ - the maximum size of the ruler used when calculating the space to leave for the text + -> IO () +rulerSetRange self (lower, upper, position, maxSize) = + {# call gtk_ruler_set_range #} + (toRuler self) + (realToFrac lower) + (realToFrac upper) + (realToFrac position) + (realToFrac maxSize) + +-- | Retrieves values indicating the range and current position of a 'Ruler'. +-- See 'rulerSetRange'. +-- +rulerGetRange :: RulerClass self => self + -> IO (Maybe (Double, Double, Double, Double)) +rulerGetRange self = + alloca $ \lowerPtr -> + alloca $ \upperPtr -> + alloca $ \positionPtr -> + alloca $ \maxSizePtr -> do + {# call gtk_ruler_get_range #} + (toRuler self) + lowerPtr + upperPtr + positionPtr + maxSizePtr + if lowerPtr == nullPtr || + upperPtr == nullPtr || + positionPtr == nullPtr || + maxSizePtr == nullPtr + then return Nothing + else do + lower <- peek lowerPtr + upper <- peek upperPtr + position <- peek positionPtr + maxSize <- peek maxSizePtr + return $ Just (realToFrac lower, realToFrac upper, realToFrac position, realToFrac maxSize) + +-------------------- +-- Attributes + +-- | Range of ruler +-- +rulerRange :: RulerClass self => ReadWriteAttr self (Maybe (Double, Double, Double, Double)) (Double, Double, Double, Double) +rulerRange = newAttr + rulerGetRange + rulerSetRange + +-- | Lower limit of ruler. +-- [_$_] +-- Default value: 0 +-- +rulerLower :: RulerClass self => Attr self Double +rulerLower = newAttrFromDoubleProperty "lower" + +-- | Upper limit of ruler. +-- [_$_] +-- Default value: 0 +-- +rulerUpper :: RulerClass self => Attr self Double +rulerUpper = newAttrFromDoubleProperty "upper" + +-- | Position of mark on the ruler. +-- [_$_] +-- Default value: 0 +-- +rulerPosition :: RulerClass self => Attr self Double +rulerPosition = newAttrFromDoubleProperty "position" + +-- | Maximum size of the ruler. +-- [_$_] +-- Default value: 0 +-- +rulerMaxSize :: RulerClass self => Attr self Double +rulerMaxSize = newAttrFromDoubleProperty "max-size" + +#if GTK_CHECK_VERSION(2,8,0) +-- | The metric used for the ruler. +-- [_$_] +-- Default value: ''Pixels'' +-- [_$_] +-- Since 2.8 +-- +rulerMetric :: RulerClass self => Attr self MetricType +rulerMetric = newAttrFromEnumProperty "metric" + {# call pure unsafe gtk_metric_type_get_type #} +#endif hunk ./gtk/gtk.cabal 292 + Graphics.UI.Gtk.Special.Ruler } |
From: Andy S. <And...@co...> - 2010-09-07 00:09:57
|
diffing dir... Mon Sep 6 20:01:42 EDT 2010 Andy Stewart <laz...@gm...> * Add 2.8.0 macro for MetricType Ignore-this: 6290196e2d49ec8bd080c5ba4251aff2 { hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs 48 +#if GTK_CHECK_VERSION(2,8,0) hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs 50 +#endif hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs 87 - module Graphics.UI.Gtk.Gdk.Enums +module Graphics.UI.Gtk.Gdk.Enums } |
From: Andy S. <And...@co...> - 2010-09-06 02:09:23
|
diffing dir... Sun Sep 5 21:39:50 EDT 2010 Andy Stewart <laz...@gm...> * Tag gtk2hs-buildtools-0.11.2 to support MSTRING signal Ignore-this: 9b80eb4319847b0dcf05d81e9acfc1bf hunk ./tools/gtk2hs-buildtools.cabal 2 -Version: 0.11.1 +Version: 0.11.2 |
From: Andy S. <And...@co...> - 2010-09-06 02:09:21
|
diffing dir... Sun Sep 5 21:38:48 EDT 2010 Andy Stewart <laz...@gm...> * Tag glib-0.11.2 to support maybePeekUTFString Ignore-this: b968e1caaae0eae942e765713d96faff hunk ./glib/glib.cabal 2 -Version: 0.11.1 +Version: 0.11.2 |
From: Andy S. <And...@co...> - 2010-09-06 02:09:19
|
diffing dir... Fri Sep 3 20:32:40 EDT 2010 Daniel Ehlers <dan...@mi...> * add mstring type to the callbackgen syntax Ignore-this: 941e7298bc573653b113ac1164021f66 With the maybePeekUTFString function we have the ability to marshal strings which could be Null, know we are also able to use this new functionality in the callback generation lists. { hunk ./tools/callbackGen/HookGenerator.hs 29 + | Tmstring [_$_] hunk ./tools/callbackGen/HookGenerator.hs 102 +scan ('M':'S':'T':'R':'I':'N':'G':xs) = TokType Tmstring:scan xs hunk ./tools/callbackGen/HookGenerator.hs 143 +identifier Tmstring = ss "MSTRING" hunk ./tools/callbackGen/HookGenerator.hs 168 +rawtype Tmstring = ss "CString" hunk ./tools/callbackGen/HookGenerator.hs 194 +rawtype Tmstring = ss "CString" hunk ./tools/callbackGen/HookGenerator.hs 219 +usertype Tmstring (c:cs) = (ss "Maybe String",cs) hunk ./tools/callbackGen/HookGenerator.hs 280 +nameArg Tmstring c = ss "str".shows c hunk ./tools/callbackGen/HookGenerator.hs 308 +marshExec Tmstring arg _ body = indent 5. ss "maybePeekUTFString ". arg. ss " >>= \\". arg. ss "\' ->". + body. sc ' '. arg. sc '\'' hunk ./tools/callbackGen/HookGenerator.hs 364 +marshExec Tmstring n = indent 4.ss "str".shows n. + ss "' <- maybePeekCString str".shows n hunk ./tools/callbackGen/Signal.chs.template 49 -import System.Glib.UTFString (peekUTFString) +import System.Glib.UTFString (peekUTFString,maybePeekUTFString) } |
From: Andy S. <And...@co...> - 2010-09-06 02:09:17
|
diffing dir... Fri Sep 3 20:27:19 EDT 2010 Daniel Ehlers <dan...@mi...> * add function maybePeekUTF8String Ignore-this: b8ba058cbae65702b6a1f1b707547946 In cases when a marshelled string maybe null the usual peekUTF8String generates a segfault. Hence we have to use maybePeek in combination with peekCString. { hunk ./glib/System/Glib/UTFString.hs 34 + maybePeekUTFString, hunk ./glib/System/Glib/UTFString.hs 51 +import Data.Maybe (maybe) hunk ./glib/System/Glib/UTFString.hs 80 +-- Define maybePeekUTFString to retrieve UTF-8 from a ptr which is maybe null. +-- +maybePeekUTFString :: CString -> IO (Maybe String) +maybePeekUTFString strPtr = liftM (maybe Nothing (Just . fromUTF)) $ maybePeek peekCString strPtr + } |
From: Andy S. <And...@co...> - 2010-09-05 16:46:08
|
diffing dir... Sun Sep 5 12:44:57 EDT 2010 Andy Stewart <laz...@gm...> * Update gio.cabal Ignore-this: 565e4e3f7a7082e402732ee550fc56d5 { hunk ./gio/gio.cabal 50 - System.GIO.Base hunk ./gio/gio.cabal 60 + System.GIO.File.FileInfo + System.GIO.File.FileMonitor + System.GIO.File.IOError + System.GIO.File.MountOperation + [_$_] + System.GIO.Icons.Emblem + System.GIO.Icons.EmblemedIcon + System.GIO.Icons.FileIcon + System.GIO.Icons.Icon + System.GIO.Icons.ThemedIcon + [_$_] + System.GIO.Volumes.Drive + System.GIO.Volumes.Mount + System.GIO.Volumes.Volume + System.GIO.Volumes.VolumeMonitor } |
From: Andy S. <And...@co...> - 2010-09-05 16:46:06
|
diffing dir... Sun Sep 5 12:44:13 EDT 2010 Andy Stewart <laz...@gm...> * Add module in System.GIO Ignore-this: cb99974515d793502ab366eb4cc7aff1 { hunk ./gio/System/GIO.hs 37 + module System.GIO.File.FileInfo, + module System.GIO.File.FileMonitor, + module System.GIO.File.IOError, + module System.GIO.File.MountOperation, + + module System.GIO.Icons.Emblem, + module System.GIO.Icons.EmblemedIcon, + module System.GIO.Icons.FileIcon, + module System.GIO.Icons.Icon, + module System.GIO.Icons.ThemedIcon, + + module System.GIO.Volumes.Drive, + module System.GIO.Volumes.Mount, + module System.GIO.Volumes.Volume, + module System.GIO.Volumes.VolumeMonitor, hunk ./gio/System/GIO.hs 61 +import System.GIO.File.FileInfo +import System.GIO.File.FileMonitor +import System.GIO.File.IOError +import System.GIO.File.MountOperation + +import System.GIO.Icons.Emblem +import System.GIO.Icons.EmblemedIcon +import System.GIO.Icons.FileIcon +import System.GIO.Icons.Icon +import System.GIO.Icons.ThemedIcon + +import System.GIO.Volumes.Drive +import System.GIO.Volumes.Mount +import System.GIO.Volumes.Volume +import System.GIO.Volumes.VolumeMonitor } |
From: Andy S. <And...@co...> - 2010-09-05 16:46:03
|
diffing dir... Sun Sep 5 12:43:42 EDT 2010 Andy Stewart <laz...@gm...> * Add new module System.GIO.Volumes.VolumeMonitor Ignore-this: 8c8a2b2ea167a19fe873a4dae735aad8 { addfile ./gio/System/GIO/Volumes/VolumeMonitor.chs hunk ./gio/System/GIO/Volumes/VolumeMonitor.chs 1 +{-# LANGUAGE CPP #-} +-- GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*- +-- +-- Author : Andy Stewart +-- Created: 30-Apirl-2010 +-- +-- Copyright (c) 2010 Andy Stewart +-- +-- 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 3 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. +-- [_$_] +-- You should have received a copy of the GNU Lesser General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/>. +-- [_$_] +-- GIO, the C library which this Haskell library depends on, is +-- available under LGPL Version 2. The documentation included with +-- this library is based on the original GIO documentation. +-- [_$_] +-- | Maintainer : gtk...@li... +-- Stability : alpha +-- Portability : portable (depends on GHC) +module System.GIO.Volumes.VolumeMonitor ( +-- * Details +-- +-- | 'VolumeMonitor' is for listing the user interesting devices and volumes on the computer. In other +-- words, what a file selector or file manager would show in a sidebar. +-- [_$_] +-- 'VolumeMonitor' is not thread-default-context aware, and so should not be used other than from the +-- main thread, with no thread-default-context active. + +-- * Types [_$_] + VolumeMonitor(..), + VolumeMonitorClass, + +-- * Methods + volumeMonitorGet, + volumeMonitorGetConnectedDrives, + volumeMonitorGetVolumes, + volumeMonitorGetMounts, + volumeMonitorGetMountForUUID, + volumeMonitorGetVolumeForUUID, + +-- * Signals + vmDriveChanged, + vmDriveConnected, + vmDriveDisconnected, + vmDriveEjectButton, + vmDriveStopButton, + vmMountAdded, + vmMountChanged, + vmMountPreUnmount, + vmMountRemoved, + vmVolumeAdded, + vmVolumeChanged, + vmVolumeRemoved, + ) where + +import Control.Monad +import System.GIO.Enums +import System.Glib.Attributes +import System.Glib.FFI +import System.Glib.Flags +import System.Glib.GError +import System.Glib.GList +import System.Glib.GObject +import System.Glib.Properties +import System.Glib.Signals +import System.Glib.UTFString +{#import System.GIO.Signals#} +{#import System.GIO.Types#} + +{# context lib = "gio" prefix = "g" #} + +-------------------- +-- Methods +-- | Gets the volume monitor used by gio. +volumeMonitorGet :: IO VolumeMonitor +volumeMonitorGet = + constructNewGObject mkVolumeMonitor $ + {#call g_volume_monitor_get #} + +-- | Gets a list of drives connected to the system. +volumeMonitorGetConnectedDrives :: VolumeMonitorClass monitor => monitor + -> IO [Drive] +volumeMonitorGetConnectedDrives monitor = do + glistPtr <- {#call g_volume_monitor_get_connected_drives #} (toVolumeMonitor monitor) + drivePtrs <- fromGList glistPtr + mapM (makeNewGObject mkDrive . return) drivePtrs + +-- | Gets a list of the volumes on the system. +volumeMonitorGetVolumes :: VolumeMonitorClass monitor => monitor + -> IO [Drive] +volumeMonitorGetVolumes monitor = do + glistPtr <- {#call g_volume_monitor_get_volumes #} (toVolumeMonitor monitor) + volumePtrs <- fromGList glistPtr + mapM (makeNewGObject mkDrive . return) volumePtrs + +-- | Gets a list of the mounts on the system. +volumeMonitorGetMounts :: VolumeMonitorClass monitor => monitor + -> IO [Drive] +volumeMonitorGetMounts monitor = do + glistPtr <- {#call g_volume_monitor_get_mounts #} (toVolumeMonitor monitor) + mountPtrs <- fromGList glistPtr + mapM (makeNewGObject mkDrive . return) mountPtrs + +-- | Finds a 'Mount' object by its UUID (see 'mountGetUuid' +volumeMonitorGetMountForUUID :: VolumeMonitorClass monitor => monitor + -> String -- ^ @uuid@ the UUID to look for + -> IO (Maybe Mount) -- ^ returns a 'Mount' or 'Nothing' if no such mount is available. +volumeMonitorGetMountForUUID monitor uuid = [_$_] + maybeNull (makeNewGObject mkMount) $ + withUTFString uuid $ \ uuidPtr -> [_$_] + {#call g_volume_monitor_get_mount_for_uuid#} (toVolumeMonitor monitor) uuidPtr + +-- | Finds a 'Volume' object by its UUID (see 'volumeGetUuid') +volumeMonitorGetVolumeForUUID :: VolumeMonitorClass monitor => monitor + -> String -- ^ @uuid@ the UUID to look for + -> IO (Maybe Volume) -- ^ returns a 'Volume' or 'Nothing' if no such volume is available. +volumeMonitorGetVolumeForUUID monitor uuid = [_$_] + maybeNull (makeNewGObject mkVolume) $ [_$_] + withUTFString uuid $ \ uuidPtr -> [_$_] + {#call g_volume_monitor_get_volume_for_uuid#} (toVolumeMonitor monitor) uuidPtr + +-------------------- +-- Signals +-- | Emitted when a drive changes. +vmDriveChanged :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) +vmDriveChanged = Signal (connect_OBJECT__NONE "drive-changed") + +-- | Emitted when a drive changes. +vmDriveConnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) +vmDriveConnected = Signal (connect_OBJECT__NONE "drive-connected") + +-- | Emitted when a drive changes. +vmDriveDisconnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) +vmDriveDisconnected = Signal (connect_OBJECT__NONE "drive-disconnected") + +#if GLIB_CHECK_VERSION(2,18,0) +-- | Emitted when the eject button is pressed on drive. +vmDriveEjectButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) +vmDriveEjectButton = Signal (connect_OBJECT__NONE "drive-eject-button") +#endif + +#if GLIB_CHECK_VERSION(2,22,0) +-- | Emitted when the stop button is pressed on drive. +vmDriveStopButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) +vmDriveStopButton = Signal (connect_OBJECT__NONE "drive-stop-button") +#endif + +-- | Emitted when a mount is added. +vmMountAdded :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) +vmMountAdded = Signal (connect_OBJECT__NONE "mount-added") + +-- | Emitted when a mount is changed. +vmMountChanged :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) +vmMountChanged = Signal (connect_OBJECT__NONE "mount-changed") + +-- | Emitted when a mount is about to be removed. +vmMountPreUnmount :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) +vmMountPreUnmount = Signal (connect_OBJECT__NONE "mount-pre-unmount") + +-- | Emitted when a mount is removed. +vmMountRemoved :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) +vmMountRemoved = Signal (connect_OBJECT__NONE "mount-removed") + +-- | Emitted when a volume is added. +vmVolumeAdded :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ()) +vmVolumeAdded = Signal (connect_OBJECT__NONE "volume-added") + +-- | Emitted when a volume is changed. +vmVolumeChanged :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ()) +vmVolumeChanged = Signal (connect_OBJECT__NONE "volume-changed") + +-- | Emitted when a volume is removed. +vmVolumeRemoved :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ()) +vmVolumeRemoved = Signal (connect_OBJECT__NONE "volume-removed") + } |
From: Andy S. <And...@co...> - 2010-09-05 16:46:00
|
diffing dir... Sun Sep 5 12:43:13 EDT 2010 Andy Stewart <laz...@gm...> * Add new module System.GIO.Volumes.Volume Ignore-this: 59880771201ed2c7880a317cb93657e0 { addfile ./gio/System/GIO/Volumes/Volume.chs hunk ./gio/System/GIO/Volumes/Volume.chs 1 +{-# LANGUAGE CPP #-} +-- GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*- +-- +-- Author : Andy Stewart +-- Created: 30-Apirl-2010 +-- +-- Copyright (c) 2010 Andy Stewart +-- +-- 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 3 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. +-- [_$_] +-- You should have received a copy of the GNU Lesser General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/>. +-- [_$_] +-- GIO, the C library which this Haskell library depends on, is +-- available under LGPL Version 2. The documentation included with +-- this library is based on the original GIO documentation. +-- [_$_] +-- | Maintainer : gtk...@li... +-- Stability : alpha +-- Portability : portable (depends on GHC) +module System.GIO.Volumes.Volume ( +-- * Details +-- +-- | The 'Volume' interface represents user-visible objects that can be mounted. Note, when porting from +-- GnomeVFS, 'Volume' is the moral equivalent of GnomeVFSDrive. +-- [_$_] +-- Mounting a 'Volume' instance is an asynchronous operation. For more information about asynchronous +-- operations, see 'AsyncReady' and GSimpleAsyncReady. To mount a 'Volume', first call 'volumeMount' +-- with (at least) the 'Volume' instance, optionally a 'MountOperation' object and a 'AsyncReadyCallback'. +-- [_$_] +-- Typically, one will only want to pass 'Nothing' for the 'MountOperation' if automounting all volumes when +-- a desktop session starts since it's not desirable to put up a lot of dialogs asking for credentials. +-- [_$_] +-- The callback will be fired when the operation has resolved (either with success or failure), and a +-- 'AsyncReady' structure will be passed to the callback. That callback should then call +-- 'volumeMountFinish' with the 'Volume' instance and the 'AsyncReady' data to see if the operation +-- was completed successfully. If an error is present when 'volumeMountFinish' is called, then it +-- will be filled with any error information. +-- [_$_] +-- It is sometimes necessary to directly access the underlying operating system object behind a volume +-- (e.g. for passing a volume to an application via the commandline). For this purpose, GIO allows to +-- obtain an 'identifier' for the volume. There can be different kinds of identifiers, such as Hal +-- UDIs, filesystem labels, traditional Unix devices (e.g. /dev/sda2), uuids. GIO uses predefind +-- strings as names for the different kinds of identifiers: 'VolumeIdentifierKindHalUdi', +-- 'VolumeIdentifierKindLabel', etc. Use 'volumeGetIdentifier' to obtain an identifier for a +-- volume. +-- [_$_] +-- Note that 'VolumeIdentifierKindHalUdi' will only be available when the gvfs hal volume monitor +-- is in use. Other volume monitors will generally be able to provide the +-- 'VolumeIdentifierKindUnixDevice' identifier, which can be used to obtain a hal device by means +-- of 'mangerFindDeviceStringMatch'. + +-- * Types [_$_] + Volume(..), + VolumeClass, + +-- * Methods + volumeGetName, + volumeGetUUID, + volumeGetIcon, + volumeGetDrive, + volumeGetMount, + volumeCanMount, + volumeShouldAutomount, +#if GLIB_CHECK_VERSION(2,18,0) + volumeGetActivationRoot, +#endif + volumeMount, [_$_] + volumeMountFinish, + volumeCanEject, +#if GLIB_CHECK_VERSION(2,22,0) + volumeEjectWithOperation, + volumeEjectWithOperationFinish, +#endif + volumeEnumerateIdentifiers, + volumeGetIdentifier, + +-- * Signals + volumeChanged, + volumeRemoved, + ) where + +import Control.Monad +import Data.Maybe (fromMaybe) +import System.GIO.Enums +import System.Glib.Attributes +import System.Glib.FFI +import System.Glib.Flags +import System.Glib.GError +import System.Glib.GObject +import System.Glib.Properties +import System.Glib.Signals +import System.Glib.UTFString +{#import System.GIO.Async.AsyncResult#} +{#import System.GIO.Signals#} +{#import System.GIO.Types#} + +{# context lib = "gio" prefix = "g" #} + +-------------------- +-- Methods +-- | Gets the name of volume. +volumeGetName :: VolumeClass volume => volume + -> IO String -- ^ returns the name for the given volume. [_$_] +volumeGetName volume = + {#call g_volume_get_name#} (toVolume volume) + >>= readUTFString + +-- | Gets the UUID for the volume. The reference is typically based on the file system UUID for the +-- volume in question and should be considered an opaque string. Returns 'Nothing' if there is no UUID +-- available. +volumeGetUUID :: VolumeClass volume => volume + -> IO (Maybe String) -- ^ returns the UUID for volume or 'Nothing' if no UUID can be computed. +volumeGetUUID volume = [_$_] + {#call g_volume_get_uuid#} (toVolume volume) + >>= maybePeek readUTFString + +-- | Gets the icon for volume. +volumeGetIcon :: VolumeClass volume => volume + -> IO Icon +volumeGetIcon volume = [_$_] + makeNewGObject mkIcon $ + {#call g_volume_get_icon#} (toVolume volume) + +-- | Gets the drive for the volume. +volumeGetDrive :: VolumeClass volume => volume + -> IO (Maybe Drive) -- ^ returns a 'Drive' or 'Nothing' if volume is not associated with a drive. +volumeGetDrive volume = [_$_] + maybeNull (makeNewGObject mkDrive) $ + {#call g_volume_get_drive#} (toVolume volume) + +-- | Gets the mount for the volume. +volumeGetMount :: VolumeClass volume => volume + -> IO (Maybe Mount) -- ^ returns a 'Mount' or 'Nothing' if volume is not associated with a mount. +volumeGetMount volume = [_$_] + maybeNull (makeNewGObject mkMount) $ + {#call g_volume_get_mount#} (toVolume volume) + +-- | Checks if a volume can be mounted. +volumeCanMount :: VolumeClass volume => volume + -> IO Bool -- ^ returns 'True' if the volume can be mounted. 'False' otherwise. [_$_] +volumeCanMount volume = + liftM toBool $ + {#call g_volume_can_mount#} (toVolume volume) + +-- | Returns whether the volume should be automatically mounted. +volumeShouldAutomount :: VolumeClass volume => volume + -> IO Bool -- ^ returns 'True' if the volume should be automatically mounted. [_$_] +volumeShouldAutomount volume = + liftM toBool $ + {#call g_volume_should_automount#} (toVolume volume) + +#if GLIB_CHECK_VERSION(2,18,0) +-- | Gets the activation root for a 'Volume' if it is known ahead of mount time. Returns 'Nothing' +-- otherwise. If not 'Nothing' and if volume is mounted, then the result of 'mountGetRoot' on the 'Mount' +-- object obtained from 'volumeGetMount' will always either be equal or a prefix of what this +-- function returns. +volumeGetActivationRoot :: VolumeClass volume => volume + -> IO (Maybe File) -- ^ returns the activation root of volume or 'Nothing'. [_$_] +volumeGetActivationRoot volume = [_$_] + maybeNull (makeNewGObject mkFile) $ + {#call g_volume_get_activation_root#} (toVolume volume) +#endif + +-- | Mounts a volume. This is an asynchronous operation, and is finished by calling +-- 'volumeMountFinish' with the volume and 'AsyncResult' returned in the callback. +volumeMount :: VolumeClass volume => volume + -> [MountMountFlags] -- ^ @flags@ flags affecting the operation [_$_] + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. [_$_] + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore. [_$_] + -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback' + -> IO () +volumeMount volume flags mountOperation cancellable callback = do + cCallback <- marshalAsyncReadyCallback callback + {#call g_volume_mount #} [_$_] + (toVolume volume) + ((fromIntegral . fromFlags) flags) + (fromMaybe (MountOperation nullForeignPtr) mountOperation) + (fromMaybe (Cancellable nullForeignPtr) cancellable) [_$_] + cCallback + (castFunPtrToPtr cCallback) + +-- | Finishes mounting a volume. If any errors occured during the operation, error will be set to contain +-- the errors and 'False' will be returned. +-- [_$_] +-- If the mount operation succeeded, 'volumeGetMount' on volume is guaranteed to return the mount +-- right after calling this function; there's no need to listen for the 'mount-added' signal on +-- 'VolumeMonitor'. +-- +-- Throws a 'GError' if an error occurs. +volumeMountFinish :: VolumeClass volume => volume + -> AsyncResult -- ^ @result@ a 'AsyncResult' [_$_] + -> IO () +volumeMountFinish volume result = + propagateGError (\gErrorPtr -> do + {#call g_volume_mount_finish#} [_$_] + (toVolume volume) [_$_] + result + gErrorPtr + return ()) + +-- | Checks if a volume can be ejected. +volumeCanEject :: VolumeClass volume => volume + -> IO Bool -- ^ returns 'True' if the volume can be ejected. 'False' otherwise. [_$_] +volumeCanEject volume = [_$_] + liftM toBool $ + {#call g_volume_can_eject#} (toVolume volume) + +#if GLIB_CHECK_VERSION(2,22,0) +-- | Ejects a volume. This is an asynchronous operation, and is finished by calling +-- 'volumeEjectWithOperationFinish' with the volume and 'AsyncResult' data returned in the +-- callback. +volumeEjectWithOperation :: VolumeClass volume => volume + -> [MountUnmountFlags] -- ^ @flags@ flags affecting the unmount if required for eject [_$_] + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. [_$_] + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore. [_$_] + -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback' + -> IO () +volumeEjectWithOperation volume flags mountOperation cancellable callback = do + cCallback <- marshalAsyncReadyCallback callback + {#call g_volume_eject_with_operation #} [_$_] + (toVolume volume) + ((fromIntegral . fromFlags) flags) + (fromMaybe (MountOperation nullForeignPtr) mountOperation) + (fromMaybe (Cancellable nullForeignPtr) cancellable) [_$_] + cCallback + (castFunPtrToPtr cCallback) + +-- | Finishes ejecting a volume. If any errors occurred during the operation, error will be set to +-- contain the errors and 'False' will be returned. +-- +-- Throws a 'GError' if an error occurs. +volumeEjectWithOperationFinish :: VolumeClass volume => volume + -> AsyncResult -- ^ @result@ a 'AsyncResult'. + -> IO () +volumeEjectWithOperationFinish volume result = + propagateGError (\gErrorPtr -> do + {#call g_volume_eject_with_operation_finish #} [_$_] + (toVolume volume) [_$_] + result + gErrorPtr + return ()) +#endif + +-- | Gets the kinds of identifiers that volume has. Use 'volumeGetIdentifer' to obtain the +-- identifiers themselves. +volumeEnumerateIdentifiers :: VolumeClass volume => volume + -> IO [String] +volumeEnumerateIdentifiers volume = [_$_] + {#call g_volume_enumerate_identifiers#} (toVolume volume) + >>= readUTFStringArray0 [_$_] + +-- | Gets the identifier of the given kind for volume. See the introduction for more information about +-- volume identifiers. +volumeGetIdentifier :: VolumeClass volume => volume + -> String -- ^ @kind@ the kind of identifier to return + -> IO String +volumeGetIdentifier volume kind = [_$_] + withUTFString kind $ \ kindPtr -> [_$_] + {#call g_volume_get_identifier#} (toVolume volume) kindPtr + >>= readUTFString + +-------------------- +-- Signals +-- | Emitted when the volume has been changed. +volumeChanged :: VolumeClass volume => Signal volume (IO ()) [_$_] +volumeChanged = Signal (connect_NONE__NONE "changed") + +-- | This signal is emitted when the 'Volume' have been removed. If the recipient is holding references to +-- the object they should release them so the object can be finalized. +volumeRemoved :: VolumeClass volume => Signal volume (IO ()) [_$_] +volumeRemoved = Signal (connect_NONE__NONE "removed") + } |
From: Andy S. <And...@co...> - 2010-09-05 16:25:15
|
diffing dir... Sun Sep 5 12:24:23 EDT 2010 Andy Stewart <laz...@gm...> * Add new module System.GIO.Volumes.Mount Ignore-this: 107a722f4d932758467bc51dda2b550b { addfile ./gio/System/GIO/Volumes/Mount.chs hunk ./gio/System/GIO/Volumes/Mount.chs 1 +{-# LANGUAGE CPP #-} +-- GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*- +-- +-- Author : Andy Stewart +-- Created: 30-Apirl-2010 +-- +-- Copyright (c) 2010 Andy Stewart +-- +-- 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 3 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. +-- [_$_] +-- You should have received a copy of the GNU Lesser General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/>. +-- [_$_] +-- GIO, the C library which this Haskell library depends on, is +-- available under LGPL Version 2. The documentation included with +-- this library is based on the original GIO documentation. +-- [_$_] +-- | Maintainer : gtk...@li... +-- Stability : alpha +-- Portability : portable (depends on GHC) +module System.GIO.Volumes.Mount ( +-- * Details +-- +-- | The 'Mount' interface represents user-visible mounts. Note, when porting from GnomeVFS, 'Mount' is the +-- moral equivalent of GnomeVFSVolume. +-- [_$_] +-- 'Mount' is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same +-- as a unix mount, it might be a gvfs mount, but you can still access the files on it if you use +-- GIO. Might or might not be related to a volume object. +-- [_$_] +-- Unmounting a 'Mount' instance is an asynchronous operation. For more information about asynchronous +-- operations, see 'AsyncReady' and GSimpleAsyncReady. To unmount a 'Mount' instance, first call +-- 'mountUnmountWithOperation' the 'Mount' instance and a 'AsyncReadyCallback'. The +-- callback will be fired when the operation has resolved (either with success or failure), and a +-- 'AsyncReady' structure will be passed to the callback. That callback should then call +-- 'mountUnmountWithOperationFinish' with the 'Mount' and the 'AsyncReady' data to see if the +-- operation was completed successfully. If an error is present when +-- 'mountUnmountWithOperationFinish' is called, then it will be filled with any error +-- information. + +-- * Types + Mount(..), + MountClass, + +-- * Methods + mountGetName, + mountGetUUID, + mountGetIcon, + mountGetDrive, + mountGetRoot, + mountGetVolume, + mountGetDefaultLocation, + mountCanUnmount, +#if GLIB_CHECK_VERSION(2,22,0) + mountUnmountWithOperation, + mountUnmountWithOperationFinish, +#endif + mountRemount, + mountRemountFinish, + mountCanEject, +#if GLIB_CHECK_VERSION(2,22,0) + mountEjectWithOperation, + mountEjectWithOperationFinish, +#endif +#if GLIB_CHECK_VERSION(2,18,0) + mountGuessContentType, + mountGuessContentTypeFinish, + mountGuessContentTypeSync, +#endif +#if GLIB_CHECK_VERSION(2,20,0) + mountIsShadowed, + mountShadow, + mountUnshadow, +#endif + +-- * Signals + mountChanged, +#if GLIB_CHECK_VERSION(2,22,0) + mountPreUnmount, +#endif + mountUnmounted, + ) where + +import Control.Monad +import Data.Maybe (fromMaybe) +import System.GIO.Enums +import System.Glib.Attributes +import System.Glib.FFI +import System.Glib.Flags +import System.Glib.GError +import System.Glib.GList +import System.Glib.GObject +import System.Glib.Properties +import System.Glib.Signals +import System.Glib.UTFString +{#import System.GIO.Async.AsyncResult#} +{#import System.GIO.Signals#} +{#import System.GIO.Types#} + +{# context lib = "gio" prefix = "g" #} + +-------------------- +-- Methods +-- | Gets the name of mount. +mountGetName :: MountClass mount => mount + -> IO String -- ^ returns the name for the given mount. [_$_] +mountGetName mount = [_$_] + {#call g_mount_get_name#} (toMount mount) [_$_] + >>= readUTFString + +-- | Gets the UUID for the mount. The reference is typically based on the file system UUID for the mount +-- in question and should be considered an opaque string. Returns 'Nothing' if there is no UUID available. +mountGetUUID :: MountClass mount => mount + -> IO (Maybe String) -- ^ returns the UUID for mount or 'Nothing' if no UUID can be computed. [_$_] +mountGetUUID mount = do + {#call g_mount_get_uuid#} (toMount mount) [_$_] + >>= maybePeek readUTFString + +-- | Gets the icon for mount. +mountGetIcon :: MountClass mount => mount + -> IO Icon -- ^ returns a 'Icon'. [_$_] +mountGetIcon mount = [_$_] + makeNewGObject mkIcon $ + {#call g_mount_get_icon#} (toMount mount) [_$_] + +-- | Gets the drive for the mount. +-- [_$_] +-- This is a convenience method for getting the 'Volume' and then using that object to get the 'Drive'. +mountGetDrive :: MountClass mount => mount + -> IO (Maybe Drive) -- ^ returns the 'Drive' for mount or 'Nothing' if no 'Drive' can be computed. [_$_] +mountGetDrive mount = [_$_] + maybeNull (makeNewGObject mkDrive) $ + {#call g_mount_get_drive#} (toMount mount) [_$_] + +-- | Gets the root directory on mount. +mountGetRoot :: MountClass mount => mount + -> IO File +mountGetRoot mount = [_$_] + makeNewGObject mkFile $ + {#call g_mount_get_root#} (toMount mount) [_$_] + +-- | Gets the volume directory on mount. +mountGetVolume :: MountClass mount => mount + -> IO (Maybe Volume) -- ^ returns a 'Volume' or 'Nothing' if mount is not associated with a volume. [_$_] +mountGetVolume mount = [_$_] + maybeNull (makeNewGObject mkVolume) $ + {#call g_mount_get_volume#} (toMount mount) [_$_] + +-- | Gets the default location of mount. The default location of the given mount is a path that reflects +-- the main entry point for the user (e.g. the home directory, or the root of the volume). +-- | Gets the root directory on mount. +mountGetDefaultLocation :: MountClass mount => mount + -> IO File +mountGetDefaultLocation mount = [_$_] + makeNewGObject mkFile $ + {#call g_mount_get_default_location#} (toMount mount) [_$_] + +-- | Checks if mount can be mounted. +mountCanUnmount :: MountClass mount => mount + -> IO Bool -- ^ returns 'True' if the mount can be unmounted. [_$_] +mountCanUnmount mount = + liftM toBool $ + {#call g_mount_can_unmount#} (toMount mount) + +#if GLIB_CHECK_VERSION(2,22,0) +-- | Unmounts a mount. This is an asynchronous operation, and is finished by calling +-- 'mountUnmountWithOperationFinish' with the mount and 'AsyncResult' data returned in the +-- callback. +mountUnmountWithOperation :: MountClass mount + => mount + -> [MountUnmountFlags] -- ^ @flags@ flags affecting the unmount if required for eject [_$_] + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. [_$_] + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore. [_$_] + -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback' + -> IO () +mountUnmountWithOperation mount flags mountOperation cancellable callback = do + cCallback <- marshalAsyncReadyCallback callback + {#call g_mount_unmount_with_operation #} [_$_] + (toMount mount) + ((fromIntegral . fromFlags) flags) + (fromMaybe (MountOperation nullForeignPtr) mountOperation) + (fromMaybe (Cancellable nullForeignPtr) cancellable) [_$_] + cCallback + (castFunPtrToPtr cCallback) + +-- | Finishes unmounting a mount. If any errors occurred during the operation, error will be set to +-- contain the errors and 'False' will be returned. +-- +-- Throws a 'GError' if an error occurs. +mountUnmountWithOperationFinish :: MountClass mount [_$_] + => mount + -> AsyncResult -- ^ @result@ a 'AsyncResult'. + -> IO () +mountUnmountWithOperationFinish mount result = + propagateGError (\gErrorPtr -> do + {#call g_mount_unmount_with_operation_finish #} [_$_] + (toMount mount) [_$_] + result + gErrorPtr + return ()) +#endif + +-- | Remounts a mount. This is an asynchronous operation, and is finished by calling +-- 'mountRemountFinish' with the mount and 'AsyncResult's data returned in the callback. +-- [_$_] +-- Remounting is useful when some setting affecting the operation of the volume has been changed, as +-- these may need a remount to take affect. While this is semantically equivalent with unmounting and +-- then remounting not all backends might need to actually be unmounted. +mountRemount :: MountClass mount [_$_] + => mount + -> [MountMountFlags] -- ^ @flags@ flags affecting the unmount if required for eject [_$_] + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. [_$_] + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore. [_$_] + -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback' + -> IO () +mountRemount mount flags mountOperation cancellable callback = do + cCallback <- marshalAsyncReadyCallback callback + {#call g_mount_remount #} [_$_] + (toMount mount) + ((fromIntegral . fromFlags) flags) + (fromMaybe (MountOperation nullForeignPtr) mountOperation) + (fromMaybe (Cancellable nullForeignPtr) cancellable) [_$_] + cCallback + (castFunPtrToPtr cCallback) + +-- | Finishes remounting a mount. If any errors occurred during the operation, error will be set to +-- contain the errors and 'False' will be returned. +-- +-- Throws a 'GError' if an error occurs. +mountRemountFinish :: MountClass mount [_$_] + => mount + -> AsyncResult -- ^ @result@ a 'AsyncResult'. + -> IO () +mountRemountFinish mount result = + propagateGError (\gErrorPtr -> do + {#call g_mount_remount_finish #} [_$_] + (toMount mount) [_$_] + result + gErrorPtr + return ()) + +-- | Checks if mount can be eject. +mountCanEject :: MountClass mount => mount + -> IO Bool -- ^ returns 'True' if the mount can be ejected. [_$_] +mountCanEject mount = + liftM toBool $ + {#call g_mount_can_eject#} (toMount mount) + +#if GLIB_CHECK_VERSION(2,22,0) +-- | Ejects a mount. This is an asynchronous operation, and is finished by calling +-- 'mountEjectWithOperationFinish' with the mount and 'AsyncResult' data returned in the callback. +mountEjectWithOperation :: MountClass mount + => mount + -> [MountUnmountFlags] -- ^ @flags@ flags affecting the unmount if required for eject [_$_] + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. [_$_] + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore. [_$_] + -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback' + -> IO () +mountEjectWithOperation mount flags mountOperation cancellable callback = do + cCallback <- marshalAsyncReadyCallback callback + {#call g_mount_eject_with_operation #} [_$_] + (toMount mount) + ((fromIntegral . fromFlags) flags) + (fromMaybe (MountOperation nullForeignPtr) mountOperation) + (fromMaybe (Cancellable nullForeignPtr) cancellable) [_$_] + cCallback + (castFunPtrToPtr cCallback) + +-- | Finishes ejecting a mount. If any errors occurred during the operation. +-- +-- Throws a 'GError' if an error occurs. +mountEjectWithOperationFinish :: MountClass mount [_$_] + => mount + -> AsyncResult -- ^ @result@ a 'AsyncResult'. + -> IO () +mountEjectWithOperationFinish mount result = + propagateGError (\gErrorPtr -> do + {#call g_mount_eject_with_operation_finish #} [_$_] + (toMount mount) [_$_] + result + gErrorPtr + return ()) +#endif + +#if GLIB_CHECK_VERSION(2,18,0) +-- | Tries to guess the type of content stored on mount. Returns one or more textual identifiers of +-- well-known content types (typically prefixed with \"x-content/\"), e.g. x-content/image-dcf for camera +-- memory cards. See the shared-mime-info specification for more on x-content types. +-- [_$_] +-- This is an asynchronous operation (see 'mountGuessContentTypeSync' for the synchronous +-- version), and is finished by calling 'mountGuessContentTypeFinish' with the mount and +-- 'AsyncResult' data returned in the callback. +mountGuessContentType :: MountClass mount => mount + -> Bool -- ^ @forceRescan@ Whether to force a rescan of the content. Otherwise a cached result will be used if available + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore + -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback' + -> IO () +mountGuessContentType mount forceRescan cancellable callback = do + cCallback <- marshalAsyncReadyCallback callback + {#call g_mount_guess_content_type #} [_$_] + (toMount mount) + (fromBool forceRescan) + (fromMaybe (Cancellable nullForeignPtr) cancellable) [_$_] + cCallback + (castFunPtrToPtr cCallback) + +-- | Finishes guessing content types of mount. If any errors occured during the operation, error will be +-- set to contain the errors and 'False' will be returned. In particular, you may get an +-- 'IoErrorNotSupported' if the mount does not support content guessing. +mountGuessContentTypeFinish :: MountClass mount => mount + -> AsyncResult -- ^ @result@ a 'AsyncResult'. + -> IO [String] -- ^ returns 'True' if the mount was successfully ejected. 'False' otherwise. [_$_] +mountGuessContentTypeFinish mount result = + propagateGError ({#call g_mount_guess_content_type_finish #} (toMount mount) result) + >>= readUTFStringArray0 + +-- | Tries to guess the type of content stored on mount. Returns one or more textual identifiers of +-- well-known content types (typically prefixed with \"x-content/\"), e.g. x-content/image-dcf for camera +-- memory cards. See the shared-mime-info specification for more on x-content types. +-- [_$_] +-- This is an synchronous operation and as such may block doing IO; see 'mountGuessContentType' +-- for the asynchronous version. +mountGuessContentTypeSync :: MountClass mount => mount + -> Bool -- ^ @forceRescan@ Whether to force a rescan of the content. Otherwise a cached result will be used if available + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore + -> IO [String] +mountGuessContentTypeSync mount forceRescan cancellable = + propagateGError ({#call g_mount_guess_content_type_sync #} + (toMount mount) [_$_] + (fromBool forceRescan) [_$_] + (fromMaybe (Cancellable nullForeignPtr) cancellable) [_$_] + ) + >>= readUTFStringArray0 +#endif + +#if GLIB_CHECK_VERSION(2,20,0) +-- | Determines if mount is shadowed. Applications or libraries should avoid displaying mount in the user +-- interface if it is shadowed. +-- [_$_] +-- A mount is said to be shadowed if there exists one or more user visible objects (currently 'Mount' +-- objects) with a root that is inside the root of mount. +-- [_$_] +-- One application of shadow mounts is when exposing a single file system that is used to address +-- several logical volumes. In this situation, a 'VolumeMonitor' implementation would create two 'Volume' +-- objects (for example, one for the camera functionality of the device and one for a SD card reader on +-- the device) with activation URIs gphoto2://[usb:001,002]/store1/ and +-- gphoto2://[usb:001,002]/store2/. When the underlying mount (with root gphoto2://[usb:001,002]/) is +-- mounted, said 'VolumeMonitor' implementation would create two 'Mount' objects (each with their root +-- matching the corresponding volume activation root) that would shadow the original mount. +-- [_$_] +-- The proxy monitor in GVfs 2.26 and later, automatically creates and manage shadow mounts (and +-- shadows the underlying mount) if the activation root on a 'Volume' is set. +mountIsShadowed :: MountClass mount => mount + -> IO Bool -- ^ returns 'True' if mount is shadowed. [_$_] +mountIsShadowed mount = [_$_] + liftM toBool $ + {#call g_mount_is_shadowed#} (toMount mount) + +-- | Increments the shadow count on mount. Usually used by 'VolumeMonitor' implementations when creating a +-- shadow mount for mount, see 'mountIsShadowed' for more information. The caller will need to emit +-- the "changed" signal on mount manually. +mountShadow :: MountClass mount => mount -> IO () +mountShadow mount = + {#call g_mount_shadow#} (toMount mount) + +-- | Decrements the shadow count on mount. Usually used by 'VolumeMonitor' implementations when destroying +-- a shadow mount for mount, see 'mountIsShadowed' for more information. The caller will need to +-- emit the "changed" signal on mount manually. +mountUnshadow :: MountClass mount => mount -> IO () +mountUnshadow mount = + {#call g_mount_unshadow#} (toMount mount) +#endif + +-------------------- +-- Signals +-- | Emitted when the mount has been changed. +mountChanged :: MountClass mount => Signal mount (IO ()) +mountChanged = Signal (connect_NONE__NONE "changed") + +#if GLIB_CHECK_VERSION(2,22,0) +-- | This signal is emitted when the 'Mount' is about to be unmounted. +mountPreUnmount :: MountClass mount => Signal mount (IO ()) +mountPreUnmount = Signal (connect_NONE__NONE "pre-unmount") +#endif + +-- | This signal is emitted when the 'Mount' have been unmounted. If the recipient is holding references +-- to the object they should release them so the object can be finalized. +mountUnmounted :: MountClass mount => Signal mount (IO ()) +mountUnmounted = Signal (connect_NONE__NONE "unmounted") } |