diff --git a/.travis.yml b/.travis.yml index 4dc4bd00..d851f961 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,4 +19,4 @@ script: - ./build.sh - if [ "$GTK" = "3.18" ]; then FEAT="gtk_3_18"; fi - echo $FEAT - - cargo build --features "$FEAT gtk/embed-lgpl-docs" + - cargo build --features "$FEAT gtk/embed-lgpl-docs" --jobs 1 diff --git a/gdk/vendor.md b/gdk/vendor.md index 46de22a1..3fa78ad0 100644 --- a/gdk/vendor.md +++ b/gdk/vendor.md @@ -21,17 +21,27 @@ if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error)) g_object_unref (context); ``` + +# Implements + +[`AppLaunchContextExt`](trait.AppLaunchContextExt.html) + +Trait containing all `AppLaunchContext` methods. + +# Implementors + +[`AppLaunchContext`](struct.AppLaunchContext.html) Creates a new `AppLaunchContext`. # Deprecated since 3.0 -Use `Display::get_app_launch_context` instead +Use `DisplayExt::get_app_launch_context` instead # Returns a new `AppLaunchContext` - + Sets the workspace on which applications will be launched when using this context when running under a window manager that supports multiple workspaces, as described in the @@ -42,29 +52,29 @@ it is up to the window manager to pick one, typically it will be the current workspace. ## `desktop` the number of a workspace, or -1 - + Sets the display on which applications will be launched when -using this context. See also `AppLaunchContext::set_screen`. +using this context. See also `AppLaunchContextExt::set_screen`. # Deprecated since 3.0 -Use `Display::get_app_launch_context` instead +Use `DisplayExt::get_app_launch_context` instead ## `display` a `Display` - + Sets the icon for applications that are launched with this context. Window Managers can use this information when displaying startup notification. -See also `AppLaunchContext::set_icon_name`. +See also `AppLaunchContextExt::set_icon_name`. ## `icon` a `gio::Icon`, or `None` - + Sets the icon for applications that are launched with this context. The `icon_name` will be interpreted in the same way as the Icon field -in desktop files. See also `AppLaunchContext::set_icon`. +in desktop files. See also `AppLaunchContextExt::set_icon`. If both `icon` and `icon_name` are set, the `icon_name` takes priority. If neither `icon` or `icon_name` is set, the icon is taken from either @@ -72,16 +82,16 @@ the file that is passed to launched application or from the `gio::AppInfo` for the launched application itself. ## `icon_name` an icon name, or `None` - + Sets the screen on which applications will be launched when -using this context. See also `AppLaunchContext::set_display`. +using this context. See also `AppLaunchContextExt::set_display`. If both `screen` and `display` are set, the `screen` takes priority. If neither `screen` or `display` are set, the default screen and display are used. ## `screen` a `Screen` - + Sets the timestamp of `self`. The timestamp should ideally be taken from the event that triggered the launch. @@ -91,10 +101,55 @@ typing in another window. This is also known as 'focus stealing prevention'. ## `timestamp` a timestamp + +An opaque type representing a string as an index into a table +of strings on the X server. + +Determines the string corresponding to an atom. + +# Returns + +a newly-allocated string containing the string + corresponding to `self`. When you are done with the + return value, you should free it using `g_free`. + +Finds or creates an atom corresponding to a given string. +## `atom_name` +a string. +## `only_if_exists` +if `true`, GDK is allowed to not create a new atom, but + just return `GDK_NONE` if the requested atom doesn’t already + exists. Currently, the flag is ignored, since checking the + existance of an atom is as expensive as creating it. + +# Returns + +the atom corresponding to `atom_name`. + +Finds or creates an atom corresponding to a given string. + +Note that this function is identical to `Atom_::intern` except +that if a new `Atom` is created the string itself is used rather +than a copy. This saves memory, but can only be used if the string +will always exist. It can be used with statically +allocated strings in the main program, but not with statically +allocated memory in dynamically loaded modules, if you expect to +ever unload the module again (e.g. do not use this function in +GTK+ theme engines). +## `atom_name` +a static string + +# Returns + +the atom corresponding to `atom_name` An enumeration describing the way in which a device axis (valuator) maps onto the predefined valuator types that GTK+ understands. + +Note that the X and Y axes are not really needed; pointer devices +report their location via the x/y members of events regardless. Whether +X and Y are present as axes depends on the GDK backend. the axis is ignored. @@ -109,6 +164,12 @@ the axis is used for x tilt information. the axis is used for y tilt information. the axis is used for wheel information. + +the axis is used for pen/tablet distance information. (Since: 3.22) + +the axis is used for pen rotation information. (Since: 3.22) + +the axis is used for pen slider information. (Since: 3.22) a constant equal to the numerically highest axis value. @@ -149,6 +210,16 @@ crossing because of a device switch (i.e. is synthetic as the pointer didn’t leave the window. A `Cursor` represents a cursor. Its contents are private. + +# Implements + +[`CursorExt`](trait.CursorExt.html) + +Trait containing all `Cursor` methods. + +# Implementors + +[`Cursor`](struct.Cursor.html) Creates a new cursor from the set of builtin cursors for the default display. See `Cursor::new_for_display`. @@ -166,25 +237,6 @@ cursor to create a new `Cursor` Creates a new cursor from the set of builtin cursors. -Some useful ones are: --  `CursorType::RightPtr` (right-facing arrow) --  `CursorType::Crosshair` (crosshair) --  `CursorType::Xterm` (I-beam) --  `CursorType::Watch` (busy) --  `CursorType::Fleur` (for moving objects) --  `CursorType::Hand1` (a right-pointing hand) --  `CursorType::Hand2` (a left-pointing hand) --  `CursorType::LeftSide` (resize left side) --  `CursorType::RightSide` (resize right side) --  `CursorType::TopLeftCorner` (resize northwest corner) --  `CursorType::TopRightCorner` (resize northeast corner) --  `CursorType::BottomLeftCorner` (resize southwest corner) --  `CursorType::BottomRightCorner` (resize southeast corner) --  `CursorType::TopSide` (resize top side) --  `CursorType::BottomSide` (resize bottom side) --  `CursorType::SbHDoubleArrow` (move vertical splitter) --  `CursorType::SbVDoubleArrow` (move horizontal splitter) -- `CursorType::BlankCursor` (Blank cursor). Since 2.16 ## `display` the `Display` for which the cursor will be created ## `cursor_type` @@ -196,6 +248,44 @@ a new `Cursor` Creates a new cursor by looking up `name` in the current cursor theme. + +A recommended set of cursor names that will work across different +platforms can be found in the CSS specification: +- "none" +-  "default" +-  "help" +-  "pointer" +-  "context-menu" +-  "progress" +-  "wait" +-  "cell" +-  "crosshair" +-  "text" +-  "vertical-text" +-  "alias" +-  "copy" +-  "no-drop" +-  "move" +-  "not-allowed" +-  "grab" +-  "grabbing" +-  "all-scroll" +-  "col-resize" +-  "row-resize" +-  "n-resize" +-  "e-resize" +-  "s-resize" +-  "w-resize" +-  "ne-resize" +-  "nw-resize" +-  "sw-resize" +-  "se-resize" +-  "ew-resize" +-  "ns-resize" +-  "nesw-resize" +-  "nwse-resize" +-  "zoom-in" +-  "zoom-out" ## `display` the `Display` for which the cursor will be created ## `name` @@ -210,11 +300,11 @@ Creates a new cursor from a pixbuf. Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. -The functions `Display::supports_cursor_alpha` and -`Display::supports_cursor_color` can be used to determine +The functions `DisplayExt::supports_cursor_alpha` and +`DisplayExt::supports_cursor_color` can be used to determine whether RGBA cursors are supported; -`Display::get_default_cursor_size` and -`Display::get_maximal_cursor_size` give information about +`DisplayExt::get_default_cursor_size` and +`DisplayExt::get_maximal_cursor_size` give information about cursor sizes. If `x` or `y` are `-1`, the pixbuf must have @@ -241,11 +331,11 @@ Creates a new cursor from a cairo image surface. Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. -The functions `Display::supports_cursor_alpha` and -`Display::supports_cursor_color` can be used to determine +The functions `DisplayExt::supports_cursor_alpha` and +`DisplayExt::supports_cursor_color` can be used to determine whether RGBA cursors are supported; -`Display::get_default_cursor_size` and -`Display::get_maximal_cursor_size` give information about +`DisplayExt::get_default_cursor_size` and +`DisplayExt::get_maximal_cursor_size` give information about cursor sizes. On the X backend, support for RGBA cursors requires a @@ -265,19 +355,19 @@ the vertical offset of the “hotspot” of the cursor # Returns a new `Cursor`. - + Returns the cursor type for this cursor. # Returns a `CursorType` - + Returns the display on which the `Cursor` is defined. # Returns the `Display` associated to `self` - + Returns a `gdk_pixbuf::Pixbuf` with the image used to display the cursor. Note that depending on the capabilities of the windowing system and @@ -288,7 +378,7 @@ case, `None` is returned. a `gdk_pixbuf::Pixbuf` representing `self`, or `None` - + Returns a cairo image surface with the image used to display the cursor. Note that depending on the capabilities of the windowing system and @@ -308,7 +398,7 @@ Location to store the hotspot y position, a `cairo::Surface` representing `self`, or `None` - + Adds a reference to `self`. # Deprecated since 3.0 @@ -318,7 +408,7 @@ Use `gobject::Object::ref` instead # Returns Same `self` that was passed in - + Removes a reference from `self`, deallocating the cursor if no references remain. @@ -326,7 +416,12 @@ if no references remain. Use `gobject::Object::unref` instead -The standard cursors available. +Predefined cursors. + +Note that these IDs are directly taken from the X cursor font, and many +of these cursors are either not useful, or are not available on other platforms. + +The recommended way to create cursors is to use `Cursor::new_from_name`.  @@ -495,8 +590,18 @@ as a keyboard, a mouse, a touchpad, etc. See the `DeviceManager` documentation for more information about the various kinds of master and slave devices, and their relationships. + +# Implements + +[`DeviceExt`](trait.DeviceExt.html) + +Trait containing all `Device` methods. + +# Implementors + +[`Device`](struct.Device.html) -Frees an array of `TimeCoord` that was returned by `Device::get_history`. +Frees an array of `TimeCoord` that was returned by `DeviceExt::get_history`. ## `events` an array of `TimeCoord`. ## `n_events` @@ -524,7 +629,7 @@ location to store boolean indicating whether `true` if this application currently has the keyboard grabbed. - + Returns the associated device to `self`, if `self` is of type `DeviceType::Master`, it will return the paired pointer or keyboard. @@ -539,7 +644,12 @@ returned, as there is no associated device. The associated device, or `None` - + +Returns the axes currently available on the device. + +Feature: `v3_22` + + Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use. ## `axes` @@ -552,7 +662,7 @@ location to store the found value. # Returns `true` if the given axis use was found, otherwise `false` - + Returns the axis use for `index_`. ## `index_` the index of the axis. @@ -560,10 +670,10 @@ the index of the axis. # Returns a `AxisUse` specifying how the axis is used. - + Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis label, as returned -by `Device::list_axes` +by `DeviceExt::list_axes` ## `axes` pointer to an array of axes ## `axis_label` @@ -574,27 +684,27 @@ location to store the found value. # Returns `true` if the given axis use was found, otherwise `false`. - + Returns the device type for `self`. # Returns the `DeviceType` for `self`. - + Returns the `Display` to which `self` pertains. # Returns a `Display`. This memory is owned by GTK+, and must not be freed or unreffed. - + Determines whether the pointer follows device motion. This is not meaningful for keyboard devices, which don't have a pointer. # Returns `true` if the pointer follows device motion - + Obtains the motion history for a pointer device; given a starting and ending timestamp, return all events in the motion history for the device in the given range of time. Some windowing systems @@ -602,7 +712,7 @@ do not support motion history, in which case, `false` will be returned. (This is not distinguishable from the case where motion history is supported and no events were found.) -Note that there is also `Window::set_event_compression` to get +Note that there is also `WindowExt::set_event_compression` to get more motion events delivered directly, independent of the windowing system. ## `window` @@ -623,7 +733,7 @@ location to store the length of `true` if the windowing system supports motion history and at least one event was found. - + If `index_` has a valid keyval, this function will return `true` and fill in `keyval` and `modifiers` with the keyval settings. ## `index_` @@ -636,7 +746,7 @@ return value for modifiers. # Returns `true` if keyval is set for `index`. - + Gets information about which window the given pointer device is in, based on events that have been received so far from the display server. If another application has a pointer grab, or this application has a grab with owner_events = `false`, @@ -649,35 +759,35 @@ Feature: `v3_12` # Returns the last window the device - + Determines the mode of the device. # Returns a `InputSource` - + Returns the number of axes the device currently has. # Returns the number of axes. - + Returns the number of keys the device currently has. # Returns the number of keys. - + Determines the name of the device. # Returns a name - + Gets the current location of `self`. As a slave device coordinates are those of its master pointer, This function may not be called on devices of type `DeviceType::Slave`, -unless there is an ongoing grab on them, see `Device::grab`. +unless there is an ongoing grab on them, see `DeviceExt::grab`. ## `screen` location to store the `Screen` the `self` is on, or `None`. @@ -685,11 +795,11 @@ location to store the `Screen` location to store root window X coordinate of `self`, or `None`. ## `y` location to store root window Y coordinate of `self`, or `None`. - + Gets the current location of `self` in double precision. As a slave device's coordinates are those of its master pointer, this function may not be called on devices of type `DeviceType::Slave`, -unless there is an ongoing grab on them. See `Device::grab`. +unless there is an ongoing grab on them. See `DeviceExt::grab`. Feature: `v3_10` @@ -700,10 +810,10 @@ location to store the `Screen` location to store root window X coordinate of `self`, or `None`. ## `y` location to store root window Y coordinate of `self`, or `None`. - + Returns the product ID of this device, or `None` if this information couldn't be obtained. This ID is retrieved from the device, and is thus constant for -it. See `Device::get_vendor_id` for more information. +it. See `DeviceExt::get_vendor_id` for more information. Feature: `v3_16` @@ -711,17 +821,27 @@ Feature: `v3_16` # Returns the product ID, or `None` - + +Returns the `Seat` the device belongs to. + +Feature: `v3_20` + + +# Returns + +A `Seat`. This memory is owned by GTK+ and + must not be freed. + Determines the type of the device. # Returns a `InputSource` - + Gets the current state of a pointer device relative to `window`. As a slave device’s coordinates are those of its master pointer, this function may not be called on devices of type `DeviceType::Slave`, -unless there is an ongoing grab on them. See `Device::grab`. +unless there is an ongoing grab on them. See `DeviceExt::grab`. ## `window` a `Window`. ## `axes` @@ -729,12 +849,12 @@ an array of doubles to store the values of the axes of `self` in, or `None`. ## `mask` location to store the modifiers, or `None`. - + Returns the vendor ID of this device, or `None` if this information couldn't be obtained. This ID is retrieved from the device, and is thus constant for it. -This function, together with `Device::get_product_id`, can be used to eg. +This function, together with `DeviceExt::get_product_id`, can be used to eg. compose `gio::Settings` paths to store settings for this device. @@ -764,13 +884,13 @@ Feature: `v3_16` # Returns the vendor ID, or `None` - + Obtains the window underneath `self`, returning the location of the device in `win_x` and `win_y`. Returns `None` if the window tree under `self` is not known to GDK (for example, belongs to another application). As a slave device coordinates are those of its master pointer, This function may not be called on devices of type `DeviceType::Slave`, -unless there is an ongoing grab on them, see `Device::grab`. +unless there is an ongoing grab on them, see `DeviceExt::grab`. ## `win_x` return location for the X coordinate of the device location, relative to the window origin, or `None`. @@ -782,14 +902,14 @@ return location for the Y coordinate of the device location, the `Window` under the device position, or `None`. - + Obtains the window underneath `self`, returning the location of the device in `win_x` and `win_y` in double precision. Returns `None` if the window tree under `self` is not known to GDK (for example, belongs to another application). As a slave device coordinates are those of its master pointer, This function may not be called on devices of type `DeviceType::Slave`, -unless there is an ongoing grab on them, see `Device::grab`. +unless there is an ongoing grab on them, see `DeviceExt::grab`. ## `win_x` return location for the X coordinate of the device location, relative to the window origin, or `None`. @@ -801,9 +921,9 @@ return location for the Y coordinate of the device location, the `Window` under the device position, or `None`. - + Grabs the device so that all events coming from this device are passed to -this application until the device is ungrabbed with `Device::ungrab`, +this application until the device is ungrabbed with `DeviceExt::ungrab`, or the window becomes unviewable. This overrides any previous grab on the device by this client. @@ -823,6 +943,10 @@ It is equivalent to a pointer grab on the window with `owner_events` set to If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the `EventGrabBroken` events that are emitted when the grab ends unvoluntarily. + +# Deprecated since 3.20 + +Use `SeatExt::grab` instead. ## `window` the `Window` which will own the grab (the grab window) ## `grab_ownership` @@ -850,7 +974,7 @@ the timestamp of the event which led to this pointer grab. This # Returns `GrabStatus::Success` if the grab was successful. - + Returns a `glib::List` of ``GdkAtoms``, containing the labels for the axes that `self` currently has. @@ -858,7 +982,7 @@ the axes that `self` currently has. A `glib::List` of ``GdkAtoms``, free with `glib::List::free`. - + If the device if of type `DeviceType::Master`, it will return the list of slave devices attached to it, otherwise it will return `None` @@ -869,13 +993,13 @@ the list of slave devices attached to it, otherwise it will return the list of slave devices, or `None`. The list must be freed with `glib::List::free`, the contents of the list are owned by GTK+ and should not be freed. - + Specifies how an axis of a device is used. ## `index_` the index of the axis ## `use_` specifies how the axis is used - + Specifies the X key event to generate when a macro button of a device is pressed. ## `index_` @@ -884,7 +1008,7 @@ the index of the macro button to set the keyval to generate ## `modifiers` the modifiers to set - + Sets a the mode of an input device. The mode controls if the device is active and whether the device’s range is mapped to the entire screen or to a single window. @@ -898,11 +1022,15 @@ the input mode. # Returns `true` if the mode was successfully changed. - + Release any grab on `self`. + +# Deprecated since 3.20 + +Use `SeatExt::ungrab` instead. ## `time_` a timestap (e.g. `GDK_CURRENT_TIME`). - + Warps `self` in `display` to the point `x`,`y` on the screen `screen`, unless the device is confined to a window by a grab, in which case it will be moved @@ -940,9 +1068,9 @@ There should rarely be a need to do that though, since GDK defaults to a compatibility mode in which it will emit just one enter/leave event pair for all devices on a window. To enable per-device enter/leave events and other multi-pointer interaction features, -`Window::set_support_multidevice` must be called on +`WindowExt::set_support_multidevice` must be called on ``GdkWindows`` (or `gtk_widget_set_support_multidevice` on widgets). -window. See the `Window::set_support_multidevice` documentation +window. See the `WindowExt::set_support_multidevice` documentation for more information. On X11, multi-device support is implemented through XInput 2. @@ -954,7 +1082,7 @@ For simple applications that don’t have any special interest in input devices, the so-called “client pointer” provides a reasonable approximation to a simple setup with a single pointer and keyboard. The device that has been set as the client -pointer can be accessed via `DeviceManager::get_client_pointer`. +pointer can be accessed via `DeviceManagerExt::get_client_pointer`. Conceptually, in multidevice mode there are 2 device types. Virtual devices (or master devices) are represented by the pointer cursors @@ -964,7 +1092,7 @@ devices, and thus have no visible cursor on the screen. Virtual devices are always paired, so there is a keyboard device for every pointer device. Associations between devices may be inspected through -`Device::get_associated_device`. +`DeviceExt::get_associated_device`. There may be several virtual devices, and several physical devices could be controlling each of these virtual devices. Physical devices may also @@ -1013,26 +1141,40 @@ more permanently by user modifications to the device hierarchy. On certain application specific setups, it may make sense to detach a physical device from its master pointer, and mapping it to an specific window. This can be achieved by the combination of -`Device::grab` and `Device::set_mode`. +`DeviceExt::grab` and `DeviceExt::set_mode`. In order to listen for events coming from devices -other than a virtual device, `Window::set_device_events` must be +other than a virtual device, `WindowExt::set_device_events` must be called. Generally, this function can be used to modify the event mask for any given device. Input devices may also provide additional information besides X/Y. For example, graphics tablets may also provide pressure and X/Y tilt information. This information is device-dependent, and may be -queried through `Device::get_axis`. In multidevice mode, virtual +queried through `DeviceExt::get_axis`. In multidevice mode, virtual devices will change axes in order to always represent the physical device that is routing events through it. Whenever the physical device changes, the `Device:n-axes` property will be notified, and -`Device::list_axes` will return the new device axes. +`DeviceExt::list_axes` will return the new device axes. Devices may also have associated “keys” or macro buttons. Such keys can be globally set to map into normal X -keyboard events. The mapping is set using `Device::set_key`. - +keyboard events. The mapping is set using `DeviceExt::set_key`. + +In GTK+ 3.20, a new `Seat` object has been introduced that +supersedes `DeviceManager` and should be preferred in newly +written code. + +# Implements + +[`DeviceManagerExt`](trait.DeviceManagerExt.html) + +Trait containing all `DeviceManager` methods. + +# Implementors + +[`DeviceManager`](struct.DeviceManager.html) + Returns the client pointer, that is, the master pointer that acts as the core pointer for this application. In X11, window managers may change this depending on the interaction pattern under the presence of several pointers. @@ -1040,11 +1182,15 @@ pattern under the presence of several pointers. You should use this function seldomly, only in code that isn’t triggered by a ``GdkEvent`` and there aren’t other means to get a meaningful `Device` to operate on. +# Deprecated since 3.20 + +Use `SeatExt::get_pointer` instead. + # Returns The client pointer. This memory is owned by GDK and must not be freed or unreferenced. - + Gets the `Display` associated to `self`. # Returns @@ -1052,9 +1198,14 @@ Gets the `Display` associated to `self`. the `Display` to which `self` is associated to, or `None`. This memory is owned by GDK and must not be freed or unreferenced. - + Returns the list of devices of type `type_` currently attached to `self`. + +# Deprecated since 3.20 + +, use `SeatExt::get_pointer`, `SeatExt::get_keyboard` + and `SeatExt::get_slaves` instead. ## `type_` device type to get. @@ -1064,6 +1215,81 @@ a list of ``GdkDevices``. The returned list must be freed with g_list_free (). The list elements are owned by GTK+ and must not be freed or unreffed. + + + +Feature: `v3_22` + +# Implements + +[`DeviceToolExt`](trait.DeviceToolExt.html) + +Trait containing all `DeviceTool` methods. + +Feature: `v3_22` + +# Implementors + +[`DeviceTool`](struct.DeviceTool.html) + +Gets the hardware ID of this tool, or 0 if it's not known. When +non-zero, the identificator is unique for the given tool model, +meaning that two identical tools will share the same `hardware_id`, +but will have different serial numbers (see `DeviceToolExt::get_serial`). + +This is a more concrete (and device specific) method to identify +a `DeviceTool` than `DeviceToolExt::get_tool_type`, as a tablet +may support multiple devices with the same `DeviceToolType`, +but having different hardware identificators. + +Feature: `v3_22` + + +# Returns + +The hardware identificator of this tool. + +Gets the serial of this tool, this value can be used to identify a +physical tool (eg. a tablet pen) across program executions. + +Feature: `v3_22` + + +# Returns + +The serial ID for this tool + +Gets the `DeviceToolType` of the tool. + +Feature: `v3_22` + + +# Returns + +The physical type for this tool. This can be used to figure out what +sort of pen is being used, such as an airbrush or a pencil. + +Indicates the specific type of tool being used being a tablet. Such as an +airbrush, pencil, etc. + +Tool is of an unknown type. + +Tool is a standard tablet stylus. + +Tool is standard tablet eraser. + +Tool is a brush stylus. + +Tool is a pencil stylus. + +Tool is an airbrush stylus. + +Tool is a mouse. + +Tool is a lens cursor. + +Feature: `v3_22` + Indicates the device type. See [above][`DeviceManager`.description] for more information about the meaning of these device types. @@ -1093,7 +1319,17 @@ access the keyboard(s) and mouse pointer(s) of the display. Most of the input device handling has been factored out into the separate `DeviceManager` object. Every display has a device manager, which you can obtain using -`Display::get_device_manager`. +`DisplayExt::get_device_manager`. + +# Implements + +[`DisplayExt`](trait.DisplayExt.html) + +Trait containing all `Display` methods. + +# Implementors + +[`Display`](struct.Display.html) Gets the default `Display`. This is a convenience function for: @@ -1128,12 +1364,12 @@ This symbol was never meant to be used outside the default display, if it could be opened, otherwise `None`. - + Emits a short beep on `self` - + Closes the connection to the windowing system for the given display, and cleans up associated resources. - + Returns `true` if there is an ongoing grab on `device` for `self`. ## `device` a `Device` @@ -1141,7 +1377,7 @@ a `Device` # Returns `true` if there is a grab in effect for `device`. - + Flushes any requests queued for the windowing system; this happens automatically when the main loop blocks waiting for new events, but if your application is drawing without returning control to the main loop, you may need @@ -1151,7 +1387,7 @@ from a thread other than the thread where the main loop is running. This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing. - + Returns a `AppLaunchContext` suitable for launching applications on the given display. @@ -1159,36 +1395,49 @@ applications on the given display. a new `AppLaunchContext` for `self`. Free with `gobject::Object::unref` when done - + Returns the default size to use for cursors on `self`. # Returns the default cursor size. - + Returns the default group leader window for all toplevel windows on `self`. This window is implicitly created by GDK. -See `Window::set_group`. +See `WindowExt::set_group`. # Returns The default group leader window for `self` - + Get the default `Screen` for `self`. # Returns the default `Screen` object for `self` - + +Returns the default `Seat` for this display. + +Feature: `v3_20` + + +# Returns + +the default seat. + Returns the `DeviceManager` associated to `self`. +# Deprecated since 3.20 + +Use `DisplayExt::get_default_seat` and `Seat` operations. + # Returns A `DeviceManager`, or `None`. This memory is owned by GDK and must not be freed or unreferenced. - + Gets the next ``GdkEvent`` to be processed for `self`, fetching events from the windowing system if necessary. @@ -1197,13 +1446,64 @@ windowing system if necessary. the next ``GdkEvent`` to be processed, or `None` if no events are pending. The returned ``GdkEvent`` should be freed with `gdk_event_free`. - + Gets the maximal size to use for cursors on `self`. ## `width` the return location for the maximal cursor width ## `height` the return location for the maximal cursor height - + +Gets a monitor associated with this display. + +Feature: `v3_22` + +## `monitor_num` +number of the monitor + +# Returns + +the `Monitor`, or `None` if + `monitor_num` is not a valid monitor number + +Gets the monitor in which the point (`x`, `y`) is located, +or a nearby monitor if the point is not in any monitor. + +Feature: `v3_22` + +## `x` +the x coordinate of the point +## `y` +the y coordinate of the point + +# Returns + +the monitor containing the point + +Gets the monitor in which the largest area of `window` +resides, or a monitor close to `window` if it is outside +of all monitors. + +Feature: `v3_22` + +## `window` +a `Window` + +# Returns + +the monitor with the largest overlap with `window` + +Gets the number of monitors that belong to `self`. + +The returned number is valid until the next emission of the +`Display::monitor-added` or `Display::monitor-removed` signal. + +Feature: `v3_22` + + +# Returns + +the number of monitors + Gets the number of screen managed by the `self`. # Deprecated since 3.10 @@ -1213,20 +1513,20 @@ The number of screens is always 1. # Returns number of screens. - + Gets the name of the display. # Returns a string representing the display name. This string is owned by GDK and should not be modified or freed. - + Gets the current location of the pointer and the current modifier mask for a given display. # Deprecated since 3.0 -Use `Device::get_position` instead. +Use `DeviceExt::get_position` instead. ## `screen` location to store the screen that the cursor is on, or `None`. @@ -1236,15 +1536,34 @@ location to store root window X coordinate of pointer, or `None`. location to store root window Y coordinate of pointer, or `None`. ## `mask` location to store current modifier mask, or `None` - + +Gets the primary monitor for the display. + +The primary monitor is considered the monitor where the “main desktop” +lives. While normal application windows typically allow the window +manager to place the windows, specialized desktop applications +such as panels should place themselves on the primary monitor. + +Feature: `v3_22` + + +# Returns + +the primary monitor, or `None` if no primary + monitor is configured by the user + Returns a screen object for one of the screens of the display. + +# Deprecated since 3.20 + +There is only one screen; use `DisplayExt::get_default_screen` to get it. ## `screen_num` the screen number # Returns the `Screen` object - + Obtains the window underneath the mouse pointer, returning the location of the pointer in that window in `win_x`, `win_y` for `screen`. Returns `None` if the window under the mouse pointer is not known to GDK (for example, @@ -1252,7 +1571,7 @@ belongs to another application). # Deprecated since 3.0 -Use `Device::get_window_at_position` instead. +Use `DeviceExt::get_window_at_position` instead. ## `win_x` return location for x coordinate of the pointer location relative to the window origin, or `None` @@ -1264,41 +1583,51 @@ return location for y coordinate of the pointer location relative the window under the mouse pointer, or `None` - + Returns whether the display has events that are waiting to be processed. # Returns `true` if there are events ready to be processed. - + Finds out if the display has been closed. # Returns `true` if the display is closed. - + Release any keyboard grab # Deprecated since 3.0 -Use `Device::ungrab`, together with `Device::grab` +Use `DeviceExt::ungrab`, together with `DeviceExt::grab` instead. ## `time_` a timestap (e.g `GDK_CURRENT_TIME`). - + Returns the list of available input devices attached to `self`. The list is statically allocated and should not be freed. # Deprecated since 3.0 -Use `DeviceManager::list_devices` instead. +Use `DeviceManagerExt::list_devices` instead. # Returns a list of `Device` - + +Returns the list of seats known to `self`. + +Feature: `v3_20` + + +# Returns + +the + list of seats known to the `Display` + Indicates to the GUI environment that the application has finished loading, using a given identifier. @@ -1309,7 +1638,7 @@ disable that feature. ## `startup_id` a startup-notification identifier, for which notification process should be completed - + Gets a copy of the first ``GdkEvent`` in the `self`’s event queue, without removing the event from the queue. (Note that this function will not get more events from the windowing system. It only checks the events @@ -1320,31 +1649,31 @@ that have already been moved to the GDK event queue.) a copy of the first ``GdkEvent`` on the event queue, or `None` if no events are in the queue. The returned ``GdkEvent`` should be freed with `gdk_event_free`. - + Test if the pointer is grabbed. # Deprecated since 3.0 -Use `Display::device_is_grabbed` instead. +Use `DisplayExt::device_is_grabbed` instead. # Returns `true` if an active X pointer grab is in effect - + Release any pointer grab. # Deprecated since 3.0 -Use `Device::ungrab`, together with `Device::grab` +Use `DeviceExt::ungrab`, together with `DeviceExt::grab` instead. ## `time_` a timestap (e.g. `GDK_CURRENT_TIME`). - + Appends a copy of the given event onto the front of the event queue for `self`. ## `event` a ``GdkEvent``. - + Request `EventOwnerChange` events for ownership changes of the selection named by the given atom. ## `selection` @@ -1355,22 +1684,22 @@ the `Atom` naming the selection for which whether `EventOwnerChange` events will be sent. - + Sets the double click distance (two clicks within this distance count as a double click and result in a `EventType::2buttonPress` event). -See also `Display::set_double_click_time`. +See also `DisplayExt::set_double_click_time`. Applications should not set this, it is a global user-configured setting. ## `distance` distance in pixels - + Sets the double click time (two clicks within this time interval count as a double click and result in a `EventType::2buttonPress` event). Applications should not set this, it is a global user-configured setting. ## `msec` double click time in milliseconds (thousandths of a second) - + Issues a request to the clipboard manager to store the clipboard data. On X11, this is a special program that works according to the @@ -1385,7 +1714,7 @@ an array of targets if all available targets should be saved. ## `n_targets` length of the `targets` array - + Returns whether the speicifed display supports clipboard persistance; i.e. if it’s possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is @@ -1394,8 +1723,8 @@ running. # Returns `true` if the display supports clipboard persistance. - -Returns `true` if `Window::set_composited` can be used + +Returns `true` if `WindowExt::set_composited` can be used to redirect drawing on the window using compositing. Currently this only works on X11 with XComposite and @@ -1409,7 +1738,7 @@ Compositing is an outdated technology that # Returns `true` if windows may be composited. - + Returns `true` if cursors can use an 8bit alpha channel on `self`. Otherwise, cursors are restricted to bilevel alpha (i.e. a mask). @@ -1417,7 +1746,7 @@ alpha (i.e. a mask). # Returns whether cursors can have alpha channels. - + Returns `true` if multicolored cursors are supported on `self`. Otherwise, cursors have only a forground and a background color. @@ -1425,14 +1754,14 @@ and a background color. # Returns whether cursors can have multiple colors. - + Returns `true` if `gdk_window_input_shape_combine_mask` can be used to modify the input shape of windows on `self`. # Returns `true` if windows with modified input shape are supported - + Returns whether `EventOwnerChange` events will be sent when the owner of a selection changes. @@ -1440,24 +1769,24 @@ sent when the owner of a selection changes. whether `EventOwnerChange` events will be sent. - + Returns `true` if `gdk_window_shape_combine_mask` can be used to create shaped windows on `self`. # Returns `true` if shaped windows are supported - + Flushes any requests queued for the windowing system and waits until all requests have been handled. This is often used for making sure that the display is synchronized with the current state of the program. Calling -`Display::sync` before `gdk_error_trap_pop` makes sure that any errors +`DisplayExt::sync` before `gdk_error_trap_pop` makes sure that any errors generated from earlier requests are handled before the error trap is removed. This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing. - + Warps the pointer of `self` to the point `x`,`y` on the screen `screen`, unless the pointer is confined to a window by a grab, in which case it will be moved @@ -1472,7 +1801,7 @@ for the color picker in the ``GtkColorSelectionDialog``. # Deprecated since 3.0 -Use `Device::warp` instead. +Use `DeviceExt::warp` instead. ## `screen` the screen of `self` to warp the pointer to ## `x` @@ -1520,6 +1849,16 @@ macros like GDK_IS_X11_DISPLAY() to find out which backend is in use: #endif g_error ("Unsupported GDK backend"); ``` + +# Implements + +[`DisplayManagerExt`](trait.DisplayManagerExt.html) + +Trait containing all `DisplayManager` methods. + +# Implementors + +[`DisplayManager`](struct.DisplayManager.html) Gets the singleton `DisplayManager` object. @@ -1534,14 +1873,14 @@ to limit what backends can be used. The global `DisplayManager` singleton; `gdk_parse_args`, `gdk_init`, or `gdk_init_check` must have been called first. - + Gets the default `Display`. # Returns a `Display`, or `None` if there is no default display. - + List all currently open displays. # Returns @@ -1549,7 +1888,7 @@ List all currently open displays. a newly allocated `glib::SList` of `Display` objects. Free with `glib::SList::free` when you are done with it. - + Opens a display. ## `name` the name of the display to open @@ -1558,66 +1897,140 @@ the name of the display to open a `Display`, or `None` if the display could not be opened - + Sets `display` as the default display. ## `display` a `Display` + +Used in `DragContext` to the reason of a cancelled DND operation. + +There is no suitable drop target. + +Drag cancelled by the user + +Unspecified error. + +Feature: `v3_20` + - + +# Implements + +[`DragContextExt`](trait.DragContextExt.html) + +Trait containing all `DragContext` methods. + +# Implementors + +[`DragContext`](struct.DragContext.html) + Determines the bitmask of actions proposed by the source if -`DragContext::get_suggested_action` returns `DragAction::Ask`. +`DragContextExt::get_suggested_action` returns `DragAction::Ask`. # Returns the `DragAction` flags - + Returns the destination windw for the DND operation. # Returns a `Window` - + Returns the `Device` associated to the drag context. # Returns The `Device` associated to `self`. - + +Returns the window on which the drag icon should be rendered +during the drag operation. Note that the window may not be +available until the drag operation has begun. GDK will move +the window in accordance with the ongoing drag operation. +The window is owned by `self` and will be destroyed when +the drag operation is over. + +Feature: `v3_20` + + +# Returns + +the drag window, or `None` + Returns the drag protocol thats used by this context. # Returns the drag protocol - + Determines the action chosen by the drag destination. # Returns a `DragAction` value - + Returns the `Window` where the DND operation started. # Returns a `Window` - + Determines the suggested drag action of the context. # Returns a `DragAction` value - + Retrieves the list of targets of the context. # Returns a `glib::List` of targets - + +Requests the drag and drop operation to be managed by `self`. +When a drag and drop operation becomes managed, the `DragContext` +will internally handle all input and source-side `EventDND` events +as required by the windowing system. + +Once the drag and drop operation is managed, the drag context will +emit the following signals: +- The `DragContext::action-changed` signal whenever the final action + to be performed by the drag and drop operation changes. +- The `DragContext::drop-performed` signal after the user performs + the drag and drop gesture (typically by releasing the mouse button). +- The `DragContext::dnd-finished` signal after the drag and drop + operation concludes (after all ``GdkSelection`` transfers happen). +- The `DragContext::cancel` signal if the drag and drop operation is + finished but doesn't happen over an accepting destination, or is + cancelled through other means. + +Feature: `v3_20` + +## `ipc_window` +Window to use for IPC messaging/events +## `actions` +the actions supported by the drag source + +# Returns + +`true` if the drag and drop operation is managed. + Associates a `Device` to `self`, so all Drag and Drop events for `self` are emitted as if they came from this device. ## `device` a `Device` + +Sets the position of the drag window that will be kept +under the cursor hotspot. Initially, the hotspot is at the +top left corner of the drag window. + +Feature: `v3_20` + +## `hot_x` +x coordinate of the drag window hotspot +## `hot_y` +y coordinate of the drag window hotspot Used in `DragContext` to indicate the protocol according to which DND is done. @@ -1638,6 +2051,74 @@ The complex OLE2 DND protocol (not implemented). Intra-application DND. Wayland DND protocol. + +`DrawingContext` is an object that represents the current drawing +state of a `Window`. + +It's possible to use a `DrawingContext` to draw on a `Window` +via rendering API like Cairo or OpenGL. + +A `DrawingContext` can only be created by calling `WindowExt::begin_draw_frame` +and will be valid until a call to `WindowExt::end_draw_frame`. + +`DrawingContext` is available since GDK 3.22 + +Feature: `v3_22` + +# Implements + +[`DrawingContextExt`](trait.DrawingContextExt.html) + +Trait containing all `DrawingContext` methods. + +Feature: `v3_22` + +# Implementors + +[`DrawingContext`](struct.DrawingContext.html) + +Retrieves a Cairo context to be used to draw on the `Window` +that created the `DrawingContext`. + +The returned context is guaranteed to be valid as long as the +`DrawingContext` is valid, that is between a call to +`WindowExt::begin_draw_frame` and `WindowExt::end_draw_frame`. + +Feature: `v3_22` + + +# Returns + +a Cairo context to be used to draw + the contents of the `Window`. The context is owned by the + `DrawingContext` and should not be destroyed + +Retrieves a copy of the clip region used when creating the `self`. + +Feature: `v3_22` + + +# Returns + +a Cairo region + +Retrieves the window that created the drawing `self`. + +Feature: `v3_22` + + +# Returns + +a `Window` + +Checks whether the given `DrawingContext` is valid. + +Feature: `v3_22` + + +# Returns + +`true` if the context is valid Used for button press and button release events. The `type` field will be one of `EventType::ButtonPress`, @@ -1852,6 +2333,27 @@ A touch event sequence has finished. This event type A touch event sequence has been canceled. This event type was added in 3.4. + +A touchpad swipe gesture event, the current state + is determined by its phase field. This event type was added in 3.18. + +A touchpad pinch gesture event, the current state + is determined by its phase field. This event type was added in 3.18. + +A tablet pad button press event. This event type + was added in 3.22. + +A tablet pad button release event. This event type + was added in 3.22. + +A tablet pad axis event from a "ring". This event type was + added in 3.22. + +A tablet pad axis event from a "strip". This event type was + added in 3.22. + +A tablet pad group mode change. This event type was + added in 3.22. marks the end of the `EventType` enumeration. Added in 2.18 @@ -1865,15 +2367,6 @@ Modern composited windowing systems with pervasive information. Generated when the state of a toplevel window changes. - -Specifies the result of applying a ``GdkFilterFunc`` to a native event. - -event not handled, continue processing. - -native event translated into a GDK event and stored - in the `event` structure that was passed in. - -event handled, terminate processing. A `FrameClock` tells the application when to update and repaint a window. This may be synced to the vertical refresh rate of the @@ -1889,44 +2382,56 @@ implementation or with mozRequestAnimationFrame in Firefox, for example. A frame clock is idle until someone requests a frame with -`FrameClock::request_phase`. At some later point that makes +`FrameClockExt::request_phase`. At some later point that makes sense for the synchronization being implemented, the clock will process a frame and emit signals for each phase that has been requested. (See the signals of the `FrameClock` class for documentation of the phases. `FrameClockPhase::Update` and the `FrameClock::update` signal are most interesting for application writers, and are used to update the animations, using the frame time -given by `FrameClock::get_frame_time`. +given by `FrameClockExt::get_frame_time`. The frame time is reported in microseconds and generally in the same timescale as `g_get_monotonic_time`, however, it is not the same as `g_get_monotonic_time`. The frame time does not advance during the time a frame is being painted, and outside of a frame, an attempt -is made so that all calls to `FrameClock::get_frame_time` that +is made so that all calls to `FrameClockExt::get_frame_time` that are called at a “similar” time get the same value. This means that if different animations are timed by looking at the difference in -time between an initial value from `FrameClock::get_frame_time` +time between an initial value from `FrameClockExt::get_frame_time` and the value inside the `FrameClock::update` signal of the clock, they will stay exactly synchronized. Feature: `v3_8` - + +# Implements + +[`FrameClockExt`](trait.FrameClockExt.html) + +Trait containing all `FrameClock` methods. + +Feature: `v3_8` + +# Implementors + +[`FrameClock`](struct.FrameClock.html) + Starts updates for an animation. Until a matching call to -`FrameClock::end_updating` is made, the frame clock will continually +`FrameClockExt::end_updating` is made, the frame clock will continually request a new frame with the `FrameClockPhase::Update` phase. This function may be called multiple times and frames will be -requested until `FrameClock::end_updating` is called the same +requested until `FrameClockExt::end_updating` is called the same number of times. Feature: `v3_8` - + Stops updates for an animation. See the documentation for -`FrameClock::begin_updating`. +`FrameClockExt::begin_updating`. Feature: `v3_8` - + Gets the frame timings for the current frame. Feature: `v3_8` @@ -1938,7 +2443,7 @@ the `FrameTimings` for the frame currently being processed, or even no frame is being processed, for the previous frame. Before any frames have been procesed, returns `None`. - + A `FrameClock` maintains a 64-bit counter that increments for each frame drawn. @@ -1950,7 +2455,7 @@ Feature: `v3_8` inside frame processing, the value of the frame counter for the current frame. Outside of frame processing, the frame counter for the last frame. - + Gets the time that should currently be used for animations. Inside the processing of a frame, it’s the time used to compute the animation position of everything in a frame. Outside of a frame, it's @@ -1965,13 +2470,13 @@ Feature: `v3_8` a timestamp in microseconds, in the timescale of of `g_get_monotonic_time`. - + `FrameClock` internally keeps a history of `FrameTimings` objects for recent frames that can be retrieved with -`FrameClock::get_timings`. The set of stored frames +`FrameClockExt::get_timings`. The set of stored frames is the set from the counter values given by -`FrameClock::get_history_start` and -`FrameClock::get_frame_counter`, inclusive. +`FrameClockExt::get_history_start` and +`FrameClockExt::get_frame_counter`, inclusive. Feature: `v3_8` @@ -1981,7 +2486,7 @@ Feature: `v3_8` the frame counter value for the oldest frame that is available in the internal frame history of the `FrameClock`. - + Using the frame history stored in the frame clock, finds the last known presentation time and refresh interval, and assuming that presentation times are separated by the refresh interval, @@ -2000,7 +2505,7 @@ a location to store the determined refresh a location to store the next candidate presentation time after the given base time. 0 will be will be stored if no history is present. - + Retrieves a `FrameTimings` object holding timing information for the current frame or a recent frame. The `FrameTimings` object may not yet be complete: see `FrameTimings::get_complete`. @@ -2015,16 +2520,16 @@ the frame counter value identifying the frame to the `FrameTimings` object for the specified frame, or `None` if it is not available. See - `FrameClock::get_history_start`. - + `FrameClockExt::get_history_start`. + Asks the frame clock to run a particular phase. The signal corresponding the requested phase will be emitted the next time the frame clock processes. Multiple calls to -`FrameClock::request_phase` will be combined together +`FrameClockExt::request_phase` will be combined together and only one frame processed. If you are displaying animated content and want to continually request the `FrameClockPhase::Update` phase for a period of time, -you should use `FrameClock::begin_updating` instead, since +you should use `FrameClockExt::begin_updating` instead, since this allows GTK+ to adjust system parameters to get maximally smooth animations. @@ -2035,10 +2540,12 @@ the phase that is requested A `FrameTimings` object holds timing information for a single frame of the application’s displays. To retrieve `FrameTimings` objects, -use `FrameClock::get_timings` or `FrameClock::get_current_timings`. +use `FrameClockExt::get_timings` or `FrameClockExt::get_current_timings`. The information in `FrameTimings` is useful for precise synchronization of video with the event or audio streams, and for measuring quality metrics for the application’s display, such as latency and jitter. + +Feature: `v3_8` The timing information in a `FrameTimings` is filled in incrementally as the frame as drawn and passed off to the @@ -2070,7 +2577,7 @@ the frame counter value for this frame Returns the frame time for the frame. This is the time value that is typically used to time animations for the frame. See -`FrameClock::get_frame_time`. +`FrameClockExt::get_frame_time`. # Returns @@ -2082,7 +2589,7 @@ no predicted time may be available, if one is available, it will be available while the frame is being generated, in contrast to `FrameTimings::get_presentation_time`, which is only available after the frame has been presented. In general, if you are simply -animating, you should use `FrameClock::get_frame_time` rather +animating, you should use `FrameClockExt::get_frame_time` rather than this function, but this function is useful for applications that want exact control over latency. For example, a movie player may want this information for Audio/Video synchronization. @@ -2150,7 +2657,7 @@ Feature: `v3_8` OpenGL drawing context. ``GdkGLContexts`` are created for a `Window` using -`Window::create_gl_context`, and the context will match +`WindowExt::create_gl_context`, and the context will match the `Visual` of the window. A `GLContext` is not tied to any particular normal framebuffer. @@ -2172,11 +2679,11 @@ In order to create a new `GLContext` instance you need a `Window`, which you typically get during the realize call of a widget. -A `GLContext` is not realized until either `GLContext::make_current`, -or until it is realized using `GLContext::realize`. It is possible to +A `GLContext` is not realized until either `GLContextExt::make_current`, +or until it is realized using `GLContextExt::realize`. It is possible to specify details of the GL context like the OpenGL version to be used, or whether the GL context should have extra state validation enabled after -calling `Window::create_gl_context` by calling `GLContext::realize`. +calling `WindowExt::create_gl_context` by calling `GLContextExt::realize`. If the realization fails you have the option to change the settings of the `GLContext` and try again. @@ -2200,11 +2707,23 @@ You can check which `GLContext` is the current one by using that is currently set by calling `GLContext::clear_current`. Feature: `v3_16` + +# Implements + +[`GLContextExt`](trait.GLContextExt.html) + +Trait containing all `GLContext` methods. + +Feature: `v3_16` + +# Implementors + +[`GLContext`](struct.GLContext.html) Clears the current `GLContext`. Any OpenGL call after this function returns will be ignored -until `GLContext::make_current` is called. +until `GLContextExt::make_current` is called. Feature: `v3_16` @@ -2217,8 +2736,8 @@ Feature: `v3_16` # Returns the current `GLContext`, or `None` - -Retrieves the value set using `GLContext::set_debug_enabled`. + +Retrieves the value set using `GLContextExt::set_debug_enabled`. Feature: `v3_16` @@ -2226,7 +2745,7 @@ Feature: `v3_16` # Returns `true` if debugging is enabled - + Retrieves the `Display` the `self` is created for Feature: `v3_16` @@ -2235,8 +2754,8 @@ Feature: `v3_16` # Returns a `Display` or `None` - -Retrieves the value set using `GLContext::set_forward_compatible`. + +Retrieves the value set using `GLContextExt::set_forward_compatible`. Feature: `v3_16` @@ -2244,9 +2763,9 @@ Feature: `v3_16` # Returns `true` if the context should be forward compatible - + Retrieves the major and minor version requested by calling -`GLContext::set_required_version`. +`GLContextExt::set_required_version`. Feature: `v3_16` @@ -2254,7 +2773,7 @@ Feature: `v3_16` return location for the major version to request ## `minor` return location for the minor version to request - + Retrieves the `GLContext` that this `self` share data with. Feature: `v3_16` @@ -2263,7 +2782,16 @@ Feature: `v3_16` # Returns a `GLContext` or `None` - + +Checks whether the `self` is using an OpenGL or OpenGL ES profile. + +Feature: `v3_22` + + +# Returns + +`true` if the `GLContext` is using an OpenGL ES profile + Retrieves the OpenGL version of the `self`. The `self` must be realized prior to calling this function. @@ -2274,7 +2802,7 @@ Feature: `v3_16` return location for the major version ## `minor` return location for the minor version - + Retrieves the `Window` used by the `self`. Feature: `v3_16` @@ -2283,12 +2811,36 @@ Feature: `v3_16` # Returns a `Window` or `None` - + +Whether the `GLContext` is in legacy mode or not. + +The `GLContext` must be realized before calling this function. + +When realizing a GL context, GDK will try to use the OpenGL 3.2 core +profile; this profile removes all the OpenGL API that was deprecated +prior to the 3.2 version of the specification. If the realization is +successful, this function will return `false`. + +If the underlying OpenGL implementation does not support core profiles, +GDK will fall back to a pre-3.2 compatibility profile, and this function +will return `true`. + +You can use the value returned by this function to decide which kind +of OpenGL API to use, or whether to do extension discovery, or what +kind of shader programs to load. + +Feature: `v3_20` + + +# Returns + +`true` if the GL context is in legacy mode + Makes the `self` the current one. Feature: `v3_16` - + Realizes the given `GLContext`. It is safe to call this function on a realized `GLContext`. @@ -2299,7 +2851,7 @@ Feature: `v3_16` # Returns `true` if the context is realized - + Sets whether the `GLContext` should perform extra validations and run time checking. This is useful during development, but has additional overhead. @@ -2311,7 +2863,7 @@ Feature: `v3_16` ## `enabled` whether to enable debugging in the context - + Sets whether the `GLContext` should be forward compatible. Forward compatibile contexts must not support OpenGL functionality that @@ -2326,7 +2878,7 @@ Feature: `v3_16` ## `compatible` whether the context should be forward compatible - + Sets the major and minor version of OpenGL to request. Setting `major` and `minor` to zero will use the default values. @@ -2340,6 +2892,25 @@ Feature: `v3_16` the major version to request ## `minor` the minor version to request + +Requests that GDK create a OpenGL ES context instead of an OpenGL one, +if the platform and windowing system allows it. + +The `self` must not have been realized. + +By default, GDK will attempt to automatically detect whether the +underlying GL implementation is OpenGL or OpenGL ES once the `self` +is realized. + +You should check the return value of `GLContextExt::get_use_es` after +calling `GLContextExt::realize` to decide whether to use the OpenGL or +OpenGL ES API, extensions, or shaders. + +Feature: `v3_22` + +## `use_es` +whether the context should use OpenGL ES instead of OpenGL, + or -1 to allow auto-detection Error enumeration for `GLContext`. @@ -2351,6 +2922,63 @@ The requested profile is not supported Feature: `v3_16` + +The `Geometry` struct gives the window manager information about +a window’s geometry constraints. Normally you would set these on +the GTK+ level using `gtk_window_set_geometry_hints`. ``GtkWindow`` +then sets the hints on the `Window` it creates. + +`WindowExt::set_geometry_hints` expects the hints to be fully valid already +and simply passes them to the window manager; in contrast, +`gtk_window_set_geometry_hints` performs some interpretation. For example, +``GtkWindow`` will apply the hints to the geometry widget instead of the +toplevel window, if you set a geometry widget. Also, the +`min_width`/`min_height`/`max_width`/`max_height` fields may be set to -1, and +``GtkWindow`` will substitute the size request of the window or geometry widget. +If the minimum size hint is not provided, ``GtkWindow`` will use its requisition +as the minimum size. If the minimum size is provided and a geometry widget is +set, ``GtkWindow`` will take the minimum size as the minimum size of the +geometry widget rather than the entire window. The base size is treated +similarly. + +The canonical use-case for `gtk_window_set_geometry_hints` is to get a +terminal widget to resize properly. Here, the terminal text area should be +the geometry widget; ``GtkWindow`` will then automatically set the base size to +the size of other widgets in the terminal window, such as the menubar and +scrollbar. Then, the `width_inc` and `height_inc` fields should be set to the +size of one character in the terminal. Finally, the base size should be set +to the size of one character. The net effect is that the minimum size of the +terminal will have a 1x1 character terminal area, and only terminal sizes on +the “character grid” will be allowed. + +Here’s an example of how the terminal example would be implemented, assuming +a terminal area widget called “terminal” and a toplevel window “toplevel”: + + +```C + GdkGeometry hints; + + hints.base_width = terminal->char_width; + hints.base_height = terminal->char_height; + hints.min_width = terminal->char_width; + hints.min_height = terminal->char_height; + hints.width_inc = terminal->char_width; + hints.height_inc = terminal->char_height; + + gtk_window_set_geometry_hints (GTK_WINDOW (toplevel), + GTK_WIDGET (terminal), + &hints, + GDK_HINT_RESIZE_INC | + GDK_HINT_MIN_SIZE | + GDK_HINT_BASE_SIZE); +``` + +The other useful fields are the `min_aspect` and `max_aspect` fields; these +contain a width/height ratio as a floating point number. If a geometry widget +is set, the aspect applies to the geometry widget rather than the entire +window. The most common use of these hints is probably to set `min_aspect` and +`max_aspect` to the same value, thus forcing the window to keep a constant +aspect ratio. Defines how device grabs interact with other devices. @@ -2360,7 +2988,7 @@ Other devices’ events are blocked for the grab window. Other devices’ events are blocked for the whole application. -Returned by `Device::grab`, `gdk_pointer_grab` and `gdk_keyboard_grab` to +Returned by `DeviceExt::grab`, `gdk_pointer_grab` and `gdk_keyboard_grab` to indicate success or the reason for the failure of the grab attempt. the resource was successfully grabbed. @@ -2375,7 +3003,7 @@ the grab window or the `confine_to` window are not the resource is frozen by an active grab of another client. -the grab failed for some other reason. +the grab failed for some other reason. Since 3.16 Defines the reference point of a window and the meaning of coordinates passed to `gtk_window_move`. See `gtk_window_move` and the "implementation @@ -2435,6 +3063,13 @@ the device is a direct-input touch device, such the device is an indirect touch device, such as a touchpad. This device type has been added in 3.4. + +the device is a trackpoint. This device type has been + added in 3.22 + +the device is a "pad", a collection of buttons, + rings and strips found in drawing tablets. This device type has been + added in 3.22. This enum is used with `Keymap::get_modifier_mask` in order to determine what modifiers the @@ -2463,6 +3098,149 @@ when any of these modifiers is pressed, the the modifier that switches between keyboard groups (AltGr on X11/Windows and Option/Alt on OS X). + +The set of modifier masks accepted +as modifiers in accelerators. Needed because Command is mapped to MOD2 on +OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a +mod key is problematic at best. +Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125. + +`Monitor` objects represent the individual outputs that are +associated with a `Display`. `Display` has APIs to enumerate +monitors with `gdk_display_get_monitors` and to find particular +monitors with `DisplayExt::get_primary_monitor` or +`DisplayExt::get_monitor_at_window`. + +`Monitor` was introduced in GTK+ 3.22 and supersedes earlier +APIs in `Screen` to obtain monitor-related information. + +Feature: `v3_22` + +# Implements + +[`MonitorExt`](trait.MonitorExt.html) + +Trait containing all `Monitor` methods. + +Feature: `v3_22` + +# Implementors + +[`Monitor`](struct.Monitor.html) + +Gets the display that this monitor belongs to. + +Feature: `v3_22` + + +# Returns + +the display + +Retrieves the size and position of an individual monitor within the +display coordinate space. The returned geometry is in ”application pixels”, +not in ”device pixels” (see `MonitorExt::get_scale_factor`). + +Feature: `v3_22` + +## `geometry` +a `Rectangle` to be filled wiht the monitor geometry + +Gets the height in millimeters of the monitor. + +Feature: `v3_22` + + +# Returns + +the physical height of the monitor + +Gets the name of the monitor's manufacturer, if available. + +# Returns + +the name of the manufacturer, or `None` + +Gets the a string identifying the monitor model, if available. + +# Returns + +the monitor model, or `None` + +Gets the refresh rate of the monitor, if available. + +The value is in milli-Hertz, so a refresh rate of 60Hz +is returned as 60000. + +Feature: `v3_22` + + +# Returns + +the refresh rate in milli-Hertz, or 0 + +Gets the internal scale factor that maps from monitor coordinates +to the actual device pixels. On traditional systems this is 1, but +on very high density outputs this can be a higher value (often 2). + +This can be used if you want to create pixel based data for a +particular monitor, but most of the time you’re drawing to a window +where it is better to use `WindowExt::get_scale_factor` instead. + +Feature: `v3_22` + + +# Returns + +the scale factor + +Gets information about the layout of red, green and blue +primaries for each pixel in this monitor, if available. + +Feature: `v3_22` + + +# Returns + +the subpixel layout + +Gets the width in millimeters of the monitor. + +Feature: `v3_22` + + +# Returns + +the physical width of the monitor + +Retrieves the size and position of the “work area” on a monitor +within the display coordinate space. The returned geometry is in +”application pixels”, not in ”device pixels” (see +`MonitorExt::get_scale_factor`). + +The work area should be considered when positioning menus and +similar popups, to avoid placing them below panels, docks or other +desktop components. + +Note that not all backends may have a concept of workarea. This +function will return the monitor geometry if a workarea is not +available, or does not apply. + +Feature: `v3_22` + +## `workarea` +a `Rectangle` to be filled with + the monitor workarea + +Gets whether this monitor should be considered primary +(see `DisplayExt::get_primary_monitor`). + +Feature: `v3_22` + + +# Returns + +`true` if `self` is primary Specifies the kind of crossing for `EventCrossing`. @@ -2495,33 +3273,146 @@ some other app claimed the ownership the window was destroyed the client was closed - -Describes how existing data is combined with new data when -using `gdk_property_change`. - -the new data replaces the existing data. - -the new data is prepended to the existing data. - -the new data is appended to the existing data. Specifies the type of a property change for a `EventProperty`. the property value was changed. the property was deleted. + +A `RGBA` is used to represent a (possibly translucent) +color, in a way that is compatible with cairos notion of color. + +Makes a copy of a `RGBA`. + +The result must be freed through `RGBA::free`. + +# Returns + +A newly allocated `RGBA`, with the same contents as `self` + +Compares two RGBA colors. +## `p2` +another `RGBA` pointer + +# Returns + +`true` if the two colors compare equal + +Frees a `RGBA` created with `RGBA::copy` + +A hash function suitable for using for a hash +table that stores ``GdkRGBAs``. + +# Returns + +The hash value for `self` + +Parses a textual representation of a color, filling in +the `red`, `green`, `blue` and `alpha` fields of the `self` `RGBA`. + +The string can be either one of: +- A standard name (Taken from the X11 rgb.txt file). +- A hexadecimal value in the form “\#rgb”, “\#rrggbb”, + “\#rrrgggbbb” or ”\#rrrrggggbbbb” +- A RGB color in the form “rgb(r,g,b)” (In this case the color will + have full opacity) +- A RGBA color in the form “rgba(r,g,b,a)” + +Where “r”, “g”, “b” and “a” are respectively the red, green, blue and +alpha color values. In the last two cases, r g and b are either integers +in the range 0 to 255 or precentage values in the range 0% to 100%, and +a is a floating point value in the range 0 to 1. +## `spec` +the string specifying the color + +# Returns + +`true` if the parsing succeeded + +Returns a textual specification of `self` in the form +`rgb (r, g, b)` or +`rgba (r, g, b, a)`, +where “r”, “g”, “b” and “a” represent the red, green, +blue and alpha values respectively. r, g, and b are +represented as integers in the range 0 to 255, and a +is represented as floating point value in the range 0 to 1. + +These string forms are string forms those supported by +the CSS3 colors module, and can be parsed by `RGBA::parse`. + +Note that this string representation may lose some +precision, since r, g and b are represented as 8-bit +integers. If this is a concern, you should use a +different representation. + +# Returns + +A newly allocated text string + +Defines the position and size of a rectangle. It is identical to +`cairo::RectangleInt`. + +Checks if the two given rectangles are equal. + +Feature: `v3_20` + +## `rect2` +a `Rectangle` + +# Returns + +`true` if the rectangles are equal. + +Calculates the intersection of two rectangles. It is allowed for +`dest` to be the same as either `self` or `src2`. If the rectangles +do not intersect, `dest`’s width and height is set to 0 and its x +and y values are undefined. If you are only interested in whether +the rectangles intersect, but not in the intersecting area itself, +pass `None` for `dest`. +## `src2` +a `Rectangle` +## `dest` +return location for the +intersection of `self` and `src2`, or `None` + +# Returns + +`true` if the rectangles intersect. + +Calculates the union of two rectangles. +The union of rectangles `self` and `src2` is the smallest rectangle which +includes both `self` and `src2` within it. +It is allowed for `dest` to be the same as either `self` or `src2`. + +Note that this function does not ignore 'empty' rectangles (ie. with +zero width or height). +## `src2` +a `Rectangle` +## `dest` +return location for the union of `self` and `src2` `Screen` objects are the GDK representation of the screen on which windows can be displayed and on which the pointer moves. X originally identified screens with physical screens, but nowadays it is more common to have a single `Screen` which -combines several physical monitors (see `Screen::get_n_monitors`). +combines several physical monitors (see `ScreenExt::get_n_monitors`). `Screen` is used throughout GDK and GTK+ to specify which screen the top level windows are to be displayed on. it is also used to query the screen specification and default settings such as -the default visual (`Screen::get_system_visual`), the dimensions -of the physical monitors (`Screen::get_monitor_geometry`), etc. +the default visual (`ScreenExt::get_system_visual`), the dimensions +of the physical monitors (`ScreenExt::get_monitor_geometry`), etc. + +# Implements + +[`ScreenExt`](trait.ScreenExt.html) + +Trait containing all `Screen` methods. + +# Implementors + +[`Screen`](struct.Screen.html) Gets the default screen for the default display. (See gdk_display_get_default ()). @@ -2531,7 +3422,13 @@ gdk_display_get_default ()). a `Screen`, or `None` if there is no default display. -Returns the height of the default screen in pixels. +Gets the height of the default screen in pixels. The returned +size is in ”application pixels”, not in ”device pixels” (see +`ScreenExt::get_monitor_scale_factor`). + +# Deprecated since 3.22 + +Use per-monitor information # Returns @@ -2540,12 +3437,22 @@ the height of the default screen in pixels. Returns the height of the default screen in millimeters. Note that on many X servers this value will not be correct. +# Deprecated since 3.22 + +Use per-monitor information + # Returns the height of the default screen in millimeters, though it is not always correct. -Returns the width of the default screen in pixels. +Gets the width of the default screen in pixels. The returned +size is in ”application pixels”, not in ”device pixels” (see +`ScreenExt::get_monitor_scale_factor`). + +# Deprecated since 3.22 + +Use per-monitor information # Returns @@ -2554,11 +3461,15 @@ the width of the default screen in pixels. Returns the width of the default screen in millimeters. Note that on many X servers this value will not be correct. +# Deprecated since 3.22 + +Use per-monitor information + # Returns the width of the default screen in millimeters, though it is not always correct. - + Returns the screen’s currently active window. On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property @@ -2574,38 +3485,58 @@ it is implementable on that platform. The returned window should be unrefed using `gobject::Object::unref` when no longer needed. +# Deprecated since 3.22 + + # Returns the currently active window, or `None`. - + Gets the display to which the `self` belongs. # Returns the display to which `self` belongs - -Gets any options previously set with `Screen::set_font_options`. + +Gets any options previously set with `ScreenExt::set_font_options`. # Returns the current font options, or `None` if no default font options have been set. - -Gets the height of `self` in pixels + +Gets the height of `self` in pixels. The returned size is in +”application pixels”, not in ”device pixels” (see +`ScreenExt::get_monitor_scale_factor`). + +# Deprecated since 3.22 + +Use per-monitor information instead # Returns the height of `self` in pixels. - + Returns the height of `self` in millimeters. -Note that on some X servers this value will not be correct. + +Note that this value is somewhat ill-defined when the screen +has multiple monitors of different resolution. It is recommended +to use the monitor dimensions instead. + +# Deprecated since 3.22 + +Use per-monitor information instead # Returns the heigth of `self` in millimeters. - + Returns the monitor number in which the point (`x`,`y`) is located. + +# Deprecated since 3.22 + +Use `DisplayExt::get_monitor_at_point` instead ## `x` the x coordinate in the virtual screen. ## `y` @@ -2615,9 +3546,13 @@ the y coordinate in the virtual screen. the monitor number in which the point (`x`,`y`) lies, or a monitor close to (`x`,`y`) if the point is not in any monitor. - + Returns the number of the monitor in which the largest area of the bounding rectangle of `window` resides. + +# Deprecated since 3.22 + +Use `DisplayExt::get_monitor_at_window` instead ## `window` a `Window` @@ -2626,32 +3561,46 @@ a `Window` the monitor number in which most of `window` is located, or if `window` does not intersect any monitors, a monitor, close to `window`. - + Retrieves the `Rectangle` representing the size and position of -the individual monitor within the entire screen area. +the individual monitor within the entire screen area. The returned +geometry is in ”application pixels”, not in ”device pixels” (see +`ScreenExt::get_monitor_scale_factor`). Monitor numbers start at 0. To obtain the number of monitors of -`self`, use `Screen::get_n_monitors`. +`self`, use `ScreenExt::get_n_monitors`. Note that the size of the entire screen area can be retrieved via -`Screen::get_width` and `Screen::get_height`. +`ScreenExt::get_width` and `ScreenExt::get_height`. + +# Deprecated since 3.22 + +Use `MonitorExt::get_geometry` instead ## `monitor_num` the monitor number ## `dest` a `Rectangle` to be filled with the monitor geometry - + Gets the height in millimeters of the specified monitor. + +# Deprecated since 3.22 + +Use `MonitorExt::get_height_mm` instead ## `monitor_num` number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) # Returns the height of the monitor, or -1 if not available - + Returns the output name of the specified monitor. Usually something like VGA, DVI, or TV, not the actual product name of the display device. + +# Deprecated since 3.22 + +Use `MonitorExt::get_model` instead ## `monitor_num` number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) @@ -2659,34 +3608,44 @@ number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) a newly-allocated string containing the name of the monitor, or `None` if the name cannot be determined - -Returns the internal scale factor that maps from monitor coordiantes + +Returns the internal scale factor that maps from monitor coordinates to the actual device pixels. On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2). This can be used if you want to create pixel based data for a -particula monitor, but most of the time you’re drawing to a window -where it is better to use `Window::get_scale_factor` instead. +particular monitor, but most of the time you’re drawing to a window +where it is better to use `WindowExt::get_scale_factor` instead. Feature: `v3_10` + +# Deprecated since 3.22 + +Use `MonitorExt::get_scale_factor` instead ## `monitor_num` number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) # Returns the scale factor - + Gets the width in millimeters of the specified monitor, if available. + +# Deprecated since 3.22 + +Use `MonitorExt::get_width_mm` instead ## `monitor_num` number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) # Returns the width of the monitor, or -1 if not available - + Retrieves the `Rectangle` representing the size and position of -the “work area” on a monitor within the entire screen area. +the “work area” on a monitor within the entire screen area. The returned +geometry is in ”application pixels”, not in ”device pixels” (see +`ScreenExt::get_monitor_scale_factor`). The work area should be considered when positioning menus and similar popups, to avoid placing them below panels, docks or other @@ -2697,26 +3656,37 @@ function will return the monitor geometry if a workarea is not available, or does not apply. Monitor numbers start at 0. To obtain the number of monitors of -`self`, use `Screen::get_n_monitors`. +`self`, use `ScreenExt::get_n_monitors`. + +# Deprecated since 3.22 + +Use `MonitorExt::get_workarea` instead ## `monitor_num` the monitor number ## `dest` a `Rectangle` to be filled with the monitor workarea - + Returns the number of monitors which `self` consists of. +# Deprecated since 3.22 + +Use `DisplayExt::get_n_monitors` instead + # Returns number of monitors which `self` consists of - + Gets the index of `self` among the screens in the display -to which it belongs. (See `Screen::get_display`) +to which it belongs. (See `ScreenExt::get_display`) + +# Deprecated since 3.22 + # Returns the index - + Gets the primary monitor for `self`. The primary monitor is considered the monitor where the “main desktop” lives. While normal application windows typically allow the window @@ -2726,18 +3696,22 @@ such as panels should place themselves on the primary monitor. If no primary monitor is configured by the user, the return value will be 0, defaulting to the first monitor. +# Deprecated since 3.22 + +Use `DisplayExt::get_primary_monitor` instead + # Returns An integer index for the primary monitor, or 0 if none is configured. - + Gets the resolution for font handling on the screen; see -`Screen::set_resolution` for full details. +`ScreenExt::set_resolution` for full details. # Returns the current resolution, or -1 if no resolution has been set. - + Gets a visual to use for creating windows with an alpha channel. The windowing system on which GTK+ is running may not support this capability, in which case `None` will @@ -2750,20 +3724,20 @@ must be running to provide appropriate display. This functionality is not implemented in the Windows backend. For setting an overall opacity for a top-level window, see -`Window::set_opacity`. +`WindowExt::set_opacity`. # Returns a visual to use for windows with an alpha channel or `None` if the capability is not available. - + Gets the root window of `self`. # Returns the root window - + Retrieves a desktop-wide setting such as double-click time for the `Screen` `self`. @@ -2778,7 +3752,7 @@ location to store the value of the setting `true` if the setting existed and a value was stored in `value`, `false` otherwise. - + Get the system’s default visual for `self`. This is the visual for the root window of the display. The return value should not be freed. @@ -2786,7 +3760,7 @@ The return value should not be freed. # Returns the system visual - + Obtains a list of all toplevel windows known to GDK on the screen `self`. A toplevel window is a child of the root window (see `gdk_get_default_root_window`). @@ -2798,20 +3772,33 @@ its elements need not be freed. list of toplevel windows, free with `glib::List::free` - -Gets the width of `self` in pixels + +Gets the width of `self` in pixels. The returned size is in +”application pixels”, not in ”device pixels” (see +`ScreenExt::get_monitor_scale_factor`). + +# Deprecated since 3.22 + +Use per-monitor information instead # Returns the width of `self` in pixels. - + Gets the width of `self` in millimeters. -Note that on some X servers this value will not be correct. + +Note that this value is somewhat ill-defined when the screen +has multiple monitors of different resolution. It is recommended +to use the monitor dimensions instead. + +# Deprecated since 3.22 + +Use per-monitor information instead # Returns the width of `self` in millimeters. - + Returns a `glib::List` of ``GdkWindows`` representing the current window stack. @@ -2832,7 +3819,7 @@ its windows unrefed using `gobject::Object::unref` when no longer needed. a list of ``GdkWindows`` for the current window stack, or `None`. - + Returns whether windows with an RGBA visual can reasonably be expected to have their alpha channel drawn correctly on the screen. @@ -2844,7 +3831,7 @@ compositing `self`. Whether windows with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen. - + Lists the available visuals for the specified `self`. A visual describes a hardware image data format. For example, a visual might support 24-bit color, or 8-bit color, @@ -2856,14 +3843,17 @@ Call `glib::List::free` on the return value when you’re finished with it. a list of visuals; the list must be freed, but not its contents - + Determines the name to pass to `Display::open` to get a `Display` with this screen as the default screen. +# Deprecated since 3.22 + + # Returns a newly allocated string, free with `g_free` - + Sets the default font options for the screen. These options will be set on any `pango::Context`’s newly created with `gdk_pango_context_get_for_screen`. Changing the @@ -2872,7 +3862,7 @@ have already been created. ## `options` a `cairo::FontOptions`, or `None` to unset any previously set default font options. - + Sets the resolution for font handling on the screen. This is a scale factor between points specified in a `pango::FontDescription` and cairo units. The default value is 96, meaning that a 10 point @@ -2893,6 +3883,134 @@ the window is scrolled to the right. the scrolling is determined by the delta values in `EventScroll`. See `gdk_event_get_scroll_deltas`. Since: 3.4 + +The `Seat` object represents a collection of input devices +that belong to a user. + +Feature: `v3_20` + +# Implements + +[`SeatExt`](trait.SeatExt.html) + +Trait containing all `Seat` methods. + +Feature: `v3_20` + +# Implementors + +[`Seat`](struct.Seat.html) + +Returns the capabilities this `Seat` currently has. + +Feature: `v3_20` + + +# Returns + +the seat capabilities + +Returns the `Display` this seat belongs to. + +# Returns + +a `Display`. This object is owned by GTK+ + and must not be freed. + +Returns the master device that routes keyboard events. + +Feature: `v3_20` + + +# Returns + +a master `Device` with keyboard + capabilities. This object is owned by GTK+ and must not be freed. + +Returns the master device that routes pointer events. + +Feature: `v3_20` + + +# Returns + +a master `Device` with pointer + capabilities. This object is owned by GTK+ and must not be freed. + +Returns the slave devices that match the given capabilities. + +Feature: `v3_20` + +## `capabilities` +capabilities to get devices for + +# Returns + +A list of ``GdkDevices``. + The list must be freed with `glib::List::free`, the elements are owned + by GDK and must not be freed. + +Grabs the seat so that all events corresponding to the given `capabilities` +are passed to this application until the seat is ungrabbed with `SeatExt::ungrab`, +or the window becomes hidden. This overrides any previous grab on the +seat by this client. + +As a rule of thumb, if a grab is desired over `SeatCapabilities::Pointer`, +all other "pointing" capabilities (eg. `SeatCapabilities::Touch`) should +be grabbed too, so the user is able to interact with all of those while +the grab holds, you should thus use `SeatCapabilities::AllPointing` most +commonly. + +Grabs are used for operations which need complete control over the +events corresponding to the given capabilities. For example in GTK+ this +is used for Drag and Drop operations, popup menus and such. + +Note that if the event mask of a `Window` has selected both button press +and button release events, or touch begin and touch end, then a press event +will cause an automatic grab until the button is released, equivalent to a +grab on the window with `owner_events` set to `true`. This is done because most +applications expect to receive paired press and release events. + +If you set up anything at the time you take the grab that needs to be +cleaned up when the grab ends, you should handle the `EventGrabBroken` +events that are emitted when the grab ends unvoluntarily. + +Feature: `v3_20` + +## `window` +the `Window` which will own the grab +## `capabilities` +capabilities that will be grabbed +## `owner_events` +if `false` then all device events are reported with respect to + `window` and are only reported if selected by `event_mask`. If + `true` then pointer events for this application are reported + as normal, but pointer events outside this application are + reported with respect to `window` and only if selected by + `event_mask`. In either mode, unreported events are discarded. +## `cursor` +the cursor to display while the grab is active. If + this is `None` then the normal cursors are used for + `window` and its descendants, and the cursor for `window` is used + elsewhere. +## `event` +the event that is triggering the grab, or `None` if none + is available. +## `prepare_func` +function to + prepare the window to be grabbed, it can be `None` if `window` is + visible before this call. +## `prepare_func_data` +user data to pass to `prepare_func` + +# Returns + +`GrabStatus::Success` if the grab was successful. + +Releases a grab added through `SeatExt::grab`. + +Feature: `v3_20` + Specifies the kind of modification applied to a setting in a `EventSetting`. @@ -2902,7 +4020,24 @@ a setting was added. a setting was changed. a setting was deleted. - + +This enumeration describes how the red, green and blue components +of physical pixels on an output device are laid out. + +The layout is not known + +Not organized in this way + +The layout is horizontal, the order is RGB + +The layout is horizontal, the order is BGR + +The layout is vertical, the order is RGB + +The layout is vertical, the order is BGR + +Feature: `v3_22` + Specifies the visiblity status of a window for a `EventVisibility`. @@ -2914,6 +4049,16 @@ the window is not visible at all. A `Visual` contains information about a particular visual. + +# Implements + +[`VisualExt`](trait.VisualExt.html) + +Trait containing all `Visual` methods. + +# Implementors + +[`Visual`](struct.Visual.html) Get the visual with the most available colors for the default GDK screen. The return value should not be freed. @@ -2977,13 +4122,20 @@ The return value should not be freed. # Returns system visual - + Returns the number of significant bits per red, green and blue value. +Not all GDK backend provide a meaningful value for this function. + +# Deprecated since 3.22 + +Use `VisualExt::get_red_pixel_details` and its variants to + learn about the pixel layout of TrueColor and DirectColor visuals + # Returns The number of significant bits per color value for `self`. - + Obtains values that are needed to calculate blue pixel values in TrueColor and DirectColor. The “mask” is the significant bits within the pixel. The “shift” is the number of bits left we must shift a primary for it @@ -2995,25 +4147,40 @@ A pointer to a `guint32` to be filled in, or `None` A pointer to a `gint` to be filled in, or `None` ## `precision` A pointer to a `gint` to be filled in, or `None` - + Returns the byte order of this visual. +The information returned by this function is only relevant +when working with XImages, and not all backends return +meaningful information for this. + +# Deprecated since 3.22 + +This information is not useful + # Returns A `ByteOrder` stating the byte order of `self`. - + Returns the size of a colormap for this visual. +You have to use platform-specific APIs to manipulate colormaps. + +# Deprecated since 3.22 + +This information is not useful, since GDK does not + provide APIs to operate on colormaps. + # Returns The size of a colormap that is suitable for `self`. - + Returns the bit depth of this visual. # Returns The bit depth of this visual. - + Obtains values that are needed to calculate green pixel values in TrueColor and DirectColor. The “mask” is the significant bits within the pixel. The “shift” is the number of bits left we must shift a primary for it @@ -3025,7 +4192,7 @@ A pointer to a `guint32` to be filled in, or `None` A pointer to a `gint` to be filled in, or `None` ## `precision` A pointer to a `gint` to be filled in, or `None` - + Obtains values that are needed to calculate red pixel values in TrueColor and DirectColor. The “mask” is the significant bits within the pixel. The “shift” is the number of bits left we must shift a primary for it @@ -3037,13 +4204,13 @@ A pointer to a `guint32` to be filled in, or `None` A pointer to a `gint` to be filled in, or `None` ## `precision` A pointer to a `gint` to be filled in, or `None` - + Gets the screen to which this visual belongs # Returns the screen to which this visual belongs. - + Returns the type of visual this is (PseudoColor, TrueColor, etc). # Returns @@ -3068,7 +4235,7 @@ Each pixel is an index into a color map that an application. Each pixel value directly contains red, green, - and blue components. Use `Visual::get_red_pixel_details`, etc, + and blue components. Use `VisualExt::get_red_pixel_details`, etc, to obtain information about how the components are assembled into a pixel value. @@ -3078,6 +4245,16 @@ Each pixel value contains red, green, and blue being converted directly. + +# Implements + +[`WindowExt`](trait.WindowExt.html) + +Trait containing all `Window` methods. + +# Implementors + +[`Window`](struct.Window.html) Creates a new `Window` using the attributes from `attributes`. See `WindowAttr` and `WindowAttributesType` for @@ -3103,11 +4280,11 @@ belongs to another application and a `Window` hasn’t been created for it with `gdk_window_foreign_new`) NOTE: For multihead-aware widgets or applications use -`Display::get_window_at_pointer` instead. +`DisplayExt::get_window_at_pointer` instead. # Deprecated since 3.0 -Use `Device::get_window_at_position` instead. +Use `DeviceExt::get_window_at_position` instead. ## `win_x` return location for origin of the window under the pointer ## `win_y` @@ -3132,14 +4309,14 @@ location to store resulting width ## `new_height` location to store resulting height -Calls `Window::process_updates` for all windows (see `Window`) +Calls `WindowExt::process_updates` for all windows (see `Window`) in the application. With update debugging enabled, calls to -`Window::invalidate_region` clear the invalidated region of the +`WindowExt::invalidate_region` clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during -`Window::process_updates`. The net effect is that you can see +`WindowExt::process_updates`. The net effect is that you can see the invalid region for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your application. @@ -3154,9 +4331,12 @@ enables this debug option at application startup time. That's usually more useful than calling `Window::set_debug_updates` yourself, though you might want to use this function to enable updates sometime after application startup time. + +# Deprecated since 3.22 + ## `setting` `true` to turn on update debugging - + Adds an event filter to `self`, allowing you to intercept events before they reach GDK. This is a low-level operation and makes it easy to break GDK and/or GTK+, so you have to know what you're @@ -3170,15 +4350,54 @@ XFreeEventData() must not be called within `function`. filter callback ## `data` data to pass to filter callback - + Emits a short beep associated to `self` in the appropriate display, if supported. Otherwise, emits a short beep on -the display just as `Display::beep`. - +the display just as `DisplayExt::beep`. + +Indicates that you are beginning the process of redrawing `region` +on `self`, and provides you with a `DrawingContext`. + +If `self` is a top level `Window`, backed by a native window +implementation, a backing store (offscreen buffer) large enough to +contain `region` will be created. The backing store will be initialized +with the background color or background surface for `self`. Then, all +drawing operations performed on `self` will be diverted to the +backing store. When you call `gdk_window_end_frame`, the contents of +the backing store will be copied to `self`, making it visible +on screen. Only the part of `self` contained in `region` will be +modified; that is, drawing operations are clipped to `region`. + +The net result of all this is to remove flicker, because the user +sees the finished product appear all at once when you call +`WindowExt::end_draw_frame`. If you draw to `self` directly without +calling `WindowExt::begin_draw_frame`, the user may see flicker +as individual drawing operations are performed in sequence. + +When using GTK+, the widget system automatically places calls to +`WindowExt::begin_draw_frame` and `WindowExt::end_draw_frame` around +emissions of the `GtkWidget::draw` signal. That is, if you’re +drawing the contents of the widget yourself, you can assume that the +widget has a cleared background, is already set as the clip region, +and already has a backing store. Therefore in most cases, application +code in GTK does not need to call `WindowExt::begin_draw_frame` +explicitly. + +Feature: `v3_22` + +## `region` +a Cairo region + +# Returns + +a `DrawingContext` context that should be + used to draw the contents of the window; the returned context is owned + by GDK. + Begins a window move operation (for a toplevel window). This function assumes that the drag is controlled by the -client pointer device, use `Window::begin_move_drag_for_device` +client pointer device, use `WindowExt::begin_move_drag_for_device` to begin a drag with a different device. ## `button` the button being used to drag, or 0 for a keyboard-initiated drag @@ -3188,7 +4407,7 @@ root window X coordinate of mouse click that began the drag root window Y coordinate of mouse click that began the drag ## `timestamp` timestamp of mouse click that began the drag - + Begins a window move operation (for a toplevel window). You might use this function to implement a “window move grip,” for example. The function works best with window managers that support the @@ -3204,58 +4423,66 @@ root window X coordinate of mouse click that began the drag root window Y coordinate of mouse click that began the drag ## `timestamp` timestamp of mouse click that began the drag - -A convenience wrapper around `Window::begin_paint_region` which + +A convenience wrapper around `WindowExt::begin_paint_region` which creates a rectangular region for you. See -`Window::begin_paint_region` for details. +`WindowExt::begin_paint_region` for details. + +# Deprecated since 3.22 + +Use `WindowExt::begin_draw_frame` instead ## `rectangle` rectangle you intend to draw to - + Indicates that you are beginning the process of redrawing `region`. A backing store (offscreen buffer) large enough to contain `region` will be created. The backing store will be initialized with the background color or background surface for `self`. Then, all drawing operations performed on `self` will be diverted to the -backing store. When you call `Window::end_paint`, the backing +backing store. When you call `WindowExt::end_paint`, the backing store will be copied to `self`, making it visible onscreen. Only the part of `self` contained in `region` will be modified; that is, drawing operations are clipped to `region`. The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call -`Window::end_paint`. If you draw to `self` directly without -calling `Window::begin_paint_region`, the user may see flicker +`WindowExt::end_paint`. If you draw to `self` directly without +calling `WindowExt::begin_paint_region`, the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of -`Window::begin_paint_region` are conveniences for the +`WindowExt::begin_paint_region` are conveniences for the programmer, so you can avoid doing that work yourself. When using GTK+, the widget system automatically places calls to -`Window::begin_paint_region` and `Window::end_paint` around +`WindowExt::begin_paint_region` and `WindowExt::end_paint` around emissions of the expose_event signal. That is, if you’re writing an expose event handler, you can assume that the exposed area in `EventExpose` has already been cleared to the window background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code need not call -`Window::begin_paint_region`. (You can disable the automatic +`WindowExt::begin_paint_region`. (You can disable the automatic calls around expose events on a widget-by-widget basis by calling `gtk_widget_set_double_buffered`.) If you call this function multiple times before calling the -matching `Window::end_paint`, the backing stores are pushed onto -a stack. `Window::end_paint` copies the topmost backing store +matching `WindowExt::end_paint`, the backing stores are pushed onto +a stack. `WindowExt::end_paint` copies the topmost backing store onscreen, subtracts the topmost region from all other regions in the stack, and pops the stack. All drawing operations affect only the topmost backing store in the stack. One matching call to -`Window::end_paint` is required for each call to -`Window::begin_paint_region`. +`WindowExt::end_paint` is required for each call to +`WindowExt::begin_paint_region`. + +# Deprecated since 3.22 + +Use `WindowExt::begin_draw_frame` instead ## `region` region you intend to draw to - + Begins a window resize operation (for a toplevel window). This function assumes that the drag is controlled by the -client pointer device, use `Window::begin_resize_drag_for_device` +client pointer device, use `WindowExt::begin_resize_drag_for_device` to begin a drag with a different device. ## `edge` the edge or corner from which the drag is started @@ -3267,7 +4494,7 @@ root window X coordinate of mouse click that began the drag root window Y coordinate of mouse click that began the drag ## `timestamp` timestamp of mouse click that began the drag (use `gdk_event_get_time`) - + Begins a window resize operation (for a toplevel window). You might use this function to implement a “window resize grip,” for example; in fact ``GtkStatusbar`` uses it. The function works best @@ -3286,21 +4513,21 @@ root window X coordinate of mouse click that began the drag root window Y coordinate of mouse click that began the drag ## `timestamp` timestamp of mouse click that began the drag (use `gdk_event_get_time`) - + Does nothing, present only for compatiblity. # Deprecated since 3.8 this function is no longer needed - + Transforms window coordinates from a parent window to a child window, where the parent window is the normal parent as returned by -`Window::get_parent` for normal windows, and the window's +`WindowExt::get_parent` for normal windows, and the window's embedder as returned by `gdk_offscreen_window_get_embedder` for offscreen windows. For normal windows, calling this function is equivalent to subtracting -the return values of `Window::get_position` from the parent coordinates. +the return values of `WindowExt::get_position` from the parent coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls the `Window`::from-embedder: signal to translate the coordinates. @@ -3308,7 +4535,7 @@ the coordinates. You should always use this function when writing generic code that walks down a window hierarchy. -See also: `Window::coords_to_parent` +See also: `WindowExt::coords_to_parent` ## `parent_x` X coordinate in parent’s coordinate system ## `parent_y` @@ -3317,15 +4544,15 @@ Y coordinate in parent’s coordinate system return location for X coordinate in child’s coordinate system ## `y` return location for Y coordinate in child’s coordinate system - + Transforms window coordinates from a child window to its parent window, where the parent window is the normal parent as returned by -`Window::get_parent` for normal windows, and the window's +`WindowExt::get_parent` for normal windows, and the window's embedder as returned by `gdk_offscreen_window_get_embedder` for offscreen windows. For normal windows, calling this function is equivalent to adding -the return values of `Window::get_position` to the child coordinates. +the return values of `WindowExt::get_position` to the child coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls the `Window`::to-embedder: signal to translate the coordinates. @@ -3333,7 +4560,7 @@ the coordinates. You should always use this function when writing generic code that walks up a window hierarchy. -See also: `Window::coords_from_parent` +See also: `WindowExt::coords_from_parent` ## `x` X coordinate in child’s coordinate system ## `y` @@ -3344,7 +4571,7 @@ in parent’s coordinate system, or `None` ## `parent_y` return location for Y coordinate in parent’s coordinate system, or `None` - + Creates a new `GLContext` matching the framebuffer format to the visual of the `Window`. The context is disconnected from any particular window or surface. @@ -3352,7 +4579,7 @@ is disconnected from any particular window or surface. If the creation of the `GLContext` failed, `error` will be set. Before using the returned `GLContext`, you will need to -call `GLContext::make_current` or `GLContext::realize`. +call `GLContextExt::make_current` or `GLContextExt::realize`. Feature: `v3_16` @@ -3361,13 +4588,33 @@ Feature: `v3_16` the newly created `GLContext`, or `None` on error - + Create a new image surface that is efficient to draw on the given `self`. Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.) +The `width` and `height` of the new surface are not affected by +the scaling factor of the `self`, or by the `scale` argument; they +are the size of the surface in device pixels. If you wish to create +an image surface capable of holding the contents of `self` you can +use: + + +```C + int scale = gdk_window_get_scale_factor (window); + int width = gdk_window_get_width (window) * scale; + int height = gdk_window_get_height (window) * scale; + + // format is set elsewhere + cairo_surface_t *surface = + gdk_window_create_similar_image_surface (window, + format, + width, height, + scale); +``` + Feature: `v3_10` ## `format` @@ -3388,7 +4635,7 @@ with it. This function always returns a valid pointer, but it will return a pointer to a “nil” surface if `other` is already in an error state or any other error occurs. - + Create a new surface that is as compatible as possible with the given `self`. For example the new surface will have the same fallback resolution and font options as `self`. Generally, the new @@ -3414,35 +4661,48 @@ with it. This function always returns a valid pointer, but it will return a pointer to a “nil” surface if `other` is already in an error state or any other error occurs. - + Attempt to deiconify (unminimize) `self`. On X11 the window manager may choose to ignore the request to deiconify. When using GTK+, use `gtk_window_deiconify` instead of the `Window` variant. Or better yet, you probably want to use `gtk_window_present`, which raises the window, focuses it, unminimizes it, and puts it on the current desktop. - + Destroys the window system resources associated with `self` and decrements `self`'s reference count. The window system resources for all children of `self` are also destroyed, but the children’s reference counts are not decremented. Note that a window will not be destroyed automatically when its reference count reaches zero. You must call this function yourself before that happens. - + Does nothing, present only for compatiblity. # Deprecated since 3.8 this function is no longer needed - + +Indicates that the drawing of the contents of `self` started with +`gdk_window_begin_frame` has been completed. + +This function will take care of destroying the `DrawingContext`. + +It is an error to call this function without a matching +`gdk_window_begin_frame` first. + +Feature: `v3_22` + +## `context` +the `DrawingContext` created by `WindowExt::begin_draw_frame` + Indicates that the backing store created by the most recent call -to `Window::begin_paint_region` should be copied onscreen and +to `WindowExt::begin_paint_region` should be copied onscreen and deleted, leaving the next-most-recent backing store or no backing store at all as the active paint region. See -`Window::begin_paint_region` for full details. +`WindowExt::begin_paint_region` for full details. It is an error to call this function without a matching -`Window::begin_paint_region` first. - +`WindowExt::begin_paint_region` first. + Tries to ensure that there is a window-system native window for this `Window`. This may fail in some situations, returning `false`. @@ -3453,23 +4713,23 @@ Some backends may not support native child windows. # Returns `true` if the window has a native window, `false` otherwise - + This function does nothing. # Deprecated since 3.14 - + Sets keyboard focus to `self`. In most cases, `gtk_window_present` should be used on a ``GtkWindow``, rather than calling this function. ## `timestamp` timestamp of the event triggering the window focus - + Temporarily freezes a window and all its descendants such that it won't receive expose events. The window will begin receiving expose events -again when `Window::thaw_toplevel_updates_libgtk_only` is called. If -`Window::freeze_toplevel_updates_libgtk_only` +again when `WindowExt::thaw_toplevel_updates_libgtk_only` is called. If +`WindowExt::freeze_toplevel_updates_libgtk_only` has been called more than once, -`Window::thaw_toplevel_updates_libgtk_only` must be called +`WindowExt::thaw_toplevel_updates_libgtk_only` must be called an equal number of times to begin processing exposes. This function is not part of the GDK public API and is only @@ -3478,13 +4738,13 @@ for use by GTK+. # Deprecated since 3.16 This symbol was never meant to be used outside of GTK+ - + Temporarily freezes a window such that it won’t receive expose events. The window will begin receiving expose events again when -`Window::thaw_updates` is called. If `Window::freeze_updates` -has been called more than once, `Window::thaw_updates` must be called +`WindowExt::thaw_updates` is called. If `WindowExt::freeze_updates` +has been called more than once, `WindowExt::thaw_updates` must be called an equal number of times to begin processing exposes. - + Moves the window into fullscreen mode. This means the window covers the entire screen and is above any panels or task bars. @@ -3498,27 +4758,38 @@ don’t have a concept of “fullscreen”; so you can’t rely on the fullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. - + +Moves the window into fullscreen mode on the given monitor. This means +the window covers the entire screen and is above any panels or task bars. + +If the window was already fullscreen, then this function does nothing. +## `monitor` +Which monitor to display fullscreen on. + This function informs GDK that the geometry of an embedded offscreen window has changed. This is necessary for GDK to keep track of which offscreen window the pointer is in. - + Determines whether or not the desktop environment shuld be hinted that the window does not want to receive input focus. # Returns whether or not the window should receive input focus. - + Gets the pattern used to clear the background on `self`. If `self` does not have its own background and reuses the parent's, `None` is returned and you’ll have to query it yourself. +# Deprecated since 3.22 + +Don't use this function + # Returns The pattern to use for the background or `None` to use the parent’s background. - + Gets the list of children of `self` known to GDK. This function only returns children created via GDK, so for example it’s useless when used with the root window; @@ -3531,7 +4802,7 @@ list need not be. list of child windows inside `self` - + Gets the list of children of `self` known to GDK with a particular `user_data` set on it. @@ -3550,7 +4821,7 @@ user data to look for list of child windows inside `self` - + Computes the region of a window that potentially can be written to by drawing primitives. This region may not take into account other factors such as if the window is obscured by other windows, @@ -3561,10 +4832,10 @@ primitives. a `cairo::Region`. This must be freed with `cairo_region_destroy` when you are done. - + Determines whether `self` is composited. -See `Window::set_composited`. +See `WindowExt::set_composited`. # Deprecated since 3.16 @@ -3574,7 +4845,7 @@ Compositing is an outdated technology that # Returns `true` if the window is composited. - + Retrieves a `Cursor` pointer for the cursor currently set on the specified `Window`, or `None`. If the return value is `None` then there is no custom cursor set on the specified window, and it is @@ -3584,18 +4855,18 @@ using the cursor for its parent window. a `Cursor`, or `None`. The returned object is owned by the `Window` and should not be - unreferenced directly. Use `Window::set_cursor` to unset the + unreferenced directly. Use `WindowExt::set_cursor` to unset the cursor of the window - + Returns the decorations set on the `Window` with -`Window::set_decorations`. +`WindowExt::set_decorations`. ## `decorations` The window decorations will be written here # Returns `true` if the window has decorations set, `false` otherwise. - + Retrieves a `Cursor` pointer for the `device` currently set on the specified `Window`, or `None`. If the return value is `None` then there is no custom cursor set on the specified window, and it is @@ -3607,9 +4878,9 @@ a master, pointer `Device`. a `Cursor`, or `None`. The returned object is owned by the `Window` and should not be - unreferenced directly. Use `Window::set_cursor` to unset the + unreferenced directly. Use `WindowExt::set_cursor` to unset the cursor of the window - + Returns the event mask for `self` corresponding to an specific device. ## `device` a `Device`. @@ -3617,12 +4888,12 @@ a `Device`. # Returns device event mask for `self` - + Obtains the current device position and modifier state. The position is given in coordinates relative to the upper left corner of `self`. -Use `Window::get_device_position_double` if you need subpixel precision. +Use `WindowExt::get_device_position_double` if you need subpixel precision. ## `device` pointer `Device` to query to. ## `x` @@ -3635,9 +4906,9 @@ return location for the modifier mask, or `None`. # Returns The window underneath `device` -(as with `Device::get_window_at_position`), or `None` if the +(as with `DeviceExt::get_window_at_position`), or `None` if the window is not known to GDK. - + Obtains the current device position in doubles and modifier state. The position is given in coordinates relative to the upper left corner of `self`. @@ -3656,15 +4927,15 @@ return location for the modifier mask, or `None`. # Returns The window underneath `device` -(as with `Device::get_window_at_position`), or `None` if the +(as with `DeviceExt::get_window_at_position`), or `None` if the window is not known to GDK. - + Gets the `Display` associated with a `Window`. # Returns the `Display` associated with `self` - + Finds out the DND protocol supported by a window. ## `target` location of the window @@ -3674,9 +4945,9 @@ location of the window # Returns the supported DND protocol. - + Obtains the parent of `self`, as known to GDK. Works like -`Window::get_parent` for normal windows, but returns the +`WindowExt::get_parent` for normal windows, but returns the window’s embedder for offscreen windows. See also: `gdk_offscreen_window_get_embedder` @@ -3684,18 +4955,18 @@ See also: `gdk_offscreen_window_get_embedder` # Returns effective parent of `self` - + Gets the toplevel window that’s an ancestor of `self`. -Works like `Window::get_toplevel`, but treats an offscreen window's -embedder as its parent, using `Window::get_effective_parent`. +Works like `WindowExt::get_toplevel`, but treats an offscreen window's +embedder as its parent, using `WindowExt::get_effective_parent`. See also: `gdk_offscreen_window_get_embedder` # Returns the effective toplevel window containing `self` - + Get the current event compression setting for this window. Feature: `v3_12` @@ -3704,14 +4975,14 @@ Feature: `v3_12` # Returns `true` if motion events will be compressed - + Gets the event mask for `self` for all master input devices. See -`Window::set_events`. +`WindowExt::set_events`. # Returns event mask for `self` - + Determines whether or not the desktop environment should be hinted that the window does not want to receive input focus when it is mapped. @@ -3719,7 +4990,7 @@ window does not want to receive input focus when it is mapped. whether or not the window wants to receive input focus when it is mapped. - + Gets the frame clock for the window. The frame clock for a window never changes unless the window is reparented to a new toplevel window. @@ -3730,14 +5001,14 @@ Feature: `v3_8` # Returns the frame clock - + Obtains the bounding box of the window, including window manager titlebar/borders if any. The frame position is given in root window coordinates. To get the position of the window itself (rather than -the frame) in root window coordinates, use `Window::get_origin`. +the frame) in root window coordinates, use `WindowExt::get_origin`. ## `rect` rectangle to fill with bounding box of the window frame - + Obtains the `FullscreenMode` of the `self`. Feature: `v3_8` @@ -3746,7 +5017,7 @@ Feature: `v3_8` # Returns The `FullscreenMode` applied to the window when fullscreen. - + Any of the return location arguments to this function may be `None`, if you aren’t interested in getting the value of that field. @@ -3758,14 +5029,14 @@ root window (screen-size background window). On the X11 platform, the geometry is obtained from the X server, so reflects the latest position of `self`; this may be out-of-sync with the position of `self` delivered in the most-recently-processed -`EventConfigure`. `Window::get_position` in contrast gets the +`EventConfigure`. `WindowExt::get_position` in contrast gets the position from the most recent configure event. Note: If `self` is not a toplevel, it is much better -to call `Window::get_position`, `Window::get_width` and -`Window::get_height` instead, because it avoids the roundtrip to +to call `WindowExt::get_position`, `WindowExt::get_width` and +`WindowExt::get_height` instead, because it avoids the roundtrip to the X server and because these functions support the full 32-bit -coordinate space, whereas `Window::get_geometry` is restricted to +coordinate space, whereas `WindowExt::get_geometry` is restricted to the 16-bit coordinates of X11. ## `x` return location for X coordinate of window (relative to its parent) @@ -3775,13 +5046,13 @@ return location for Y coordinate of window (relative to its parent) return location for width of window ## `height` return location for height of window - -Returns the group leader window for `self`. See `Window::set_group`. + +Returns the group leader window for `self`. See `WindowExt::set_group`. # Returns the group leader window for `self` - + Returns the height of the given `self`. On the X11 platform the returned size is the size reported in the @@ -3791,17 +5062,17 @@ size on the X server. # Returns The height of `self` - + Determines whether or not the window manager is hinted that `self` has modal behaviour. # Returns whether or not the window has the modal hint set. - + Obtains the position of a window in root window coordinates. -(Compare with `Window::get_position` and -`Window::get_geometry` which return the position of a window +(Compare with `WindowExt::get_position` and +`WindowExt::get_geometry` which return the position of a window relative to its parent window.) ## `x` return location for X coordinate @@ -3811,7 +5082,7 @@ return location for Y coordinate # Returns not meaningful, ignore - + Obtains the parent of `self`, as known to GDK. Does not query the X server; thus this returns the parent as passed to `Window::new`, not the actual parent. This should never matter unless you’re using @@ -3819,22 +5090,30 @@ Xlib calls mixed with GDK calls on the X11 platform. It may also matter for toplevel windows, because the window manager may choose to reparent them. -Note that you should use `Window::get_effective_parent` when +Note that you should use `WindowExt::get_effective_parent` when writing generic code that walks up a window hierarchy, because -`Window::get_parent` will most likely not do what you expect if +`WindowExt::get_parent` will most likely not do what you expect if there are offscreen windows in the hierarchy. # Returns parent of `self` - + +Returns whether input to the window is passed through to the window +below. + +See `WindowExt::set_pass_through` for details + +Feature: `v3_18` + + Obtains the current pointer position and modifier state. The position is given in coordinates relative to the upper left corner of `self`. # Deprecated since 3.0 -Use `Window::get_device_position` instead. +Use `WindowExt::get_device_position` instead. ## `x` return location for X coordinate of pointer or `None` to not return the X coordinate @@ -3850,10 +5129,10 @@ return location for modifier mask or `None` to not return the the window containing the pointer (as with `Window::at_pointer`), or `None` if the window containing the pointer isn’t known to GDK - + Obtains the position of the window as reported in the most-recently-processed `EventConfigure`. Contrast with -`Window::get_geometry` which queries the X server for the +`WindowExt::get_geometry` which queries the X server for the current window position, regardless of which events have been received or processed. @@ -3862,10 +5141,10 @@ The position coordinates are relative to the window’s parent window. X coordinate of window ## `y` Y coordinate of window - + Obtains the position of a window position in root window coordinates. This is similar to -`Window::get_origin` but allows you to pass +`WindowExt::get_origin` but allows you to pass in any position in the window, not just the origin. ## `x` X coordinate in window @@ -3875,14 +5154,14 @@ Y coordinate in window return location for X coordinate ## `root_y` return location for Y coordinate - + Obtains the top-left corner of the window manager frame in root window coordinates. ## `x` return location for X position of window frame ## `y` return location for Y position of window frame - + Returns the internal scale factor that maps from window coordiantes to the actual device pixels. On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2). @@ -3902,13 +5181,13 @@ Feature: `v3_10` # Returns the scale factor - + Gets the `Screen` associated with a `Window`. # Returns the `Screen` associated with `self` - + Returns the event mask for `self` corresponding to the device class specified by `source`. ## `source` @@ -3917,58 +5196,58 @@ a `InputSource` to define the source class. # Returns source event mask for `self` - + Gets the bitwise OR of the currently active window state flags, from the `WindowState` enumeration. # Returns window state bitfield - + Returns `true` if the window is aware of the existence of multiple devices. # Returns `true` if the window handles multidevice features. - + Gets the toplevel window that’s an ancestor of `self`. Any window type but `WindowType::Child` is considered a toplevel window, as is a `WindowType::Child` window that has a root window as parent. -Note that you should use `Window::get_effective_toplevel` when +Note that you should use `WindowExt::get_effective_toplevel` when you want to get to a window’s toplevel as seen on screen, because -`Window::get_toplevel` will most likely not do what you expect +`WindowExt::get_toplevel` will most likely not do what you expect if there are offscreen windows in the hierarchy. # Returns the toplevel window containing `self` - + This function returns the type hint set for a window. # Returns The type hint set for `self` - + Transfers ownership of the update area from `self` to the caller of the function. That is, after calling this function, `self` will no longer have an invalid/dirty region; the update area is removed from `self` and handed to you. If a window has no update area, -`Window::get_update_area` returns `None`. You are responsible for +`WindowExt::get_update_area` returns `None`. You are responsible for calling `cairo_region_destroy` on the returned region if it’s non-`None`. # Returns the update area for `self` - + Retrieves the user data for `self`, which is normally the widget -that `self` belongs to. See `Window::set_user_data`. +that `self` belongs to. See `WindowExt::set_user_data`. ## `data` return location for user data - + Computes the region of the `self` that is potentially visible. This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region @@ -3978,13 +5257,13 @@ is visible. a `cairo::Region`. This must be freed with `cairo_region_destroy` when you are done. - + Gets the `Visual` describing the pixel format of `self`. # Returns a `Visual` - + Returns the width of the given `self`. On the X11 platform the returned size is the size reported in the @@ -3994,32 +5273,32 @@ size on the X server. # Returns The width of `self` - + Gets the type of the window. See `WindowType`. # Returns type of window - + Checks whether the window has a native window or not. Note that -you can use `Window::ensure_native` if a native window is needed. +you can use `WindowExt::ensure_native` if a native window is needed. # Returns `true` if the `self` has a native window, `false` otherwise. - + For toplevel windows, withdraws them, so they will no longer be known to the window manager; for all windows, unmaps them, so they won’t be displayed. Normally done automatically as part of `gtk_widget_hide`. - + Asks to iconify (minimize) `self`. The window manager may choose to ignore the request, but normally will honor it. Using `gtk_window_iconify` is preferred, if you have a ``GtkWindow`` widget. This function only makes sense when `self` is a toplevel window. - -Like `Window::shape_combine_region`, but the shape applies + +Like `WindowExt::shape_combine_region`, but the shape applies only to event handling. Mouse events which happen while the pointer position corresponds to an unset bit in the mask will be passed on the window below `self`. @@ -4041,10 +5320,10 @@ region of window to be non-transparent X position of `shape_region` in `self` coordinates ## `offset_y` Y position of `shape_region` in `self` coordinates - + Adds `region` to the update area for `self`. The update area is the region that needs to be redrawn, or “dirty region.” The call -`Window::process_updates` sends one or more expose events to the +`WindowExt::process_updates` sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of `self` in response to those expose events. @@ -4065,19 +5344,19 @@ function to use to decide if to recurse to a child, `None` means never recurse. ## `user_data` data passed to `child_func` - -A convenience wrapper around `Window::invalidate_region` which + +A convenience wrapper around `WindowExt::invalidate_region` which invalidates a rectangular region. See -`Window::invalidate_region` for details. +`WindowExt::invalidate_region` for details. ## `rect` rectangle to invalidate or `None` to invalidate the whole window ## `invalidate_children` whether to also invalidate child windows - + Adds `region` to the update area for `self`. The update area is the region that needs to be redrawn, or “dirty region.” The call -`Window::process_updates` sends one or more expose events to the +`WindowExt::process_updates` sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of `self` in response to those expose events. @@ -4096,25 +5375,25 @@ fine grained control over which children are invalidated. a `cairo::Region` ## `invalidate_children` `true` to also invalidate child windows - + Check to see if a window is destroyed.. # Returns `true` if the window is destroyed - + Determines whether or not the window is an input only window. # Returns `true` if `self` is input only - + Determines whether or not the window is shaped. # Returns `true` if `self` is shaped - + Check if the window and all ancestors of the window are mapped. (This is not necessarily "viewable" in the X sense, since we only check as far as we have GDK window parents, not to the root @@ -4123,27 +5402,27 @@ window.) # Returns `true` if the window is viewable - -Checks whether the window has been mapped (with `Window::show` or -`Window::show_unraised`). + +Checks whether the window has been mapped (with `WindowExt::show` or +`WindowExt::show_unraised`). # Returns `true` if the window is mapped - + Lowers `self` to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above `self`. This is true whether or not the other windows are visible. If `self` is a toplevel, the window manager may choose to deny the -request to move the window in the Z-order, `Window::lower` only +request to move the window in the Z-order, `WindowExt::lower` only requests the restack, does not guarantee it. -Note that `Window::show` raises the window again, so don’t call this -function before `Window::show`. (Try `Window::show_unraised`.) - -If you call this during a paint (e.g. between `Window::begin_paint_region` -and `Window::end_paint` then GDK will mark the current clip region of the +Note that `WindowExt::show` raises the window again, so don’t call this +function before `WindowExt::show`. (Try `WindowExt::show_unraised`.) + +If you call this during a paint (e.g. between `WindowExt::begin_paint_region` +and `WindowExt::end_paint` then GDK will mark the current clip region of the window as being drawn. This is required when mixing GL rendering via `gdk_cairo_draw_from_gl` and cairo rendering, as otherwise GDK has no way of knowing when something paints over the GL-drawn regions. @@ -4155,7 +5434,7 @@ Feature: `v3_16` ## `cr` a `cairo::Context` - + Maximizes the window. If the window was already maximized, then this function does nothing. @@ -4167,38 +5446,38 @@ happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. On Windows, reliably maximizes the window. - + Merges the input shape masks for any child windows into the input shape mask for `self`. i.e. the union of all input masks for `self` and its children will become the new input mask -for `self`. See `Window::input_shape_combine_region`. +for `self`. See `WindowExt::input_shape_combine_region`. -This function is distinct from `Window::set_child_input_shapes` +This function is distinct from `WindowExt::set_child_input_shapes` because it includes `self`’s input shape mask in the set of shapes to be merged. - + Merges the shape masks for any child windows into the shape mask for `self`. i.e. the union of all masks for `self` and its children will become the new mask -for `self`. See `Window::shape_combine_region`. +for `self`. See `WindowExt::shape_combine_region`. -This function is distinct from `Window::set_child_shapes` +This function is distinct from `WindowExt::set_child_shapes` because it includes `self`’s shape mask in the set of shapes to be merged. - + Repositions a window relative to its parent window. For toplevel windows, window managers may ignore or modify the move; you should probably use `gtk_window_move` on a ``GtkWindow`` widget anyway, instead of using GDK functions. For child windows, the move will reliably succeed. -If you’re also planning to resize the window, use `Window::move_resize` +If you’re also planning to resize the window, use `WindowExt::move_resize` to both move and resize simultaneously, for a nicer visual effect. ## `x` X coordinate relative to window’s parent ## `y` Y coordinate relative to window’s parent - + Move the part of `self` indicated by `region` by `dy` pixels in the Y direction and `dx` pixels in the X direction. The portions of `region` that not covered by the new position of `region` are invalidated. @@ -4210,11 +5489,11 @@ The `cairo::Region` to move Amount to move in the X direction ## `dy` Amount to move in the Y direction - -Equivalent to calling `Window::move` and `Window::resize`, + +Equivalent to calling `WindowExt::move` and `WindowExt::resize`, except that both operations are performed at once, avoiding strange visual effects. (i.e. the user may be able to see the window first -move, then resize, if you don’t use `Window::move_resize`.) +move, then resize, if you don’t use `WindowExt::move_resize`.) ## `x` new X position relative to window’s parent ## `y` @@ -4223,18 +5502,18 @@ new Y position relative to window’s parent new width ## `height` new height - -Like `Window::get_children`, but does not copy the list of + +Like `WindowExt::get_children`, but does not copy the list of children, so the list does not need to be freed. # Returns a reference to the list of child windows in `self` - + Sends one or more expose events to `self`. The areas in each expose event will cover the entire update area for the window (see -`Window::invalidate_region` for details). Normally GDK calls +`WindowExt::invalidate_region` for details). Normally GDK calls `Window::process_all_updates` on your behalf, so there’s no need to call this function unless you want to force expose events to be delivered immediately and synchronously (vs. the usual @@ -4242,23 +5521,23 @@ case, where GDK delivers them in an idle handler). Occasionally this is useful to produce nicer scrolling behavior, for example. ## `update_children` whether to also process updates for child windows - + Raises `self` to the top of the Z-order (stacking order), so that other windows with the same parent window appear below `self`. This is true whether or not the windows are visible. If `self` is a toplevel, the window manager may choose to deny the -request to move the window in the Z-order, `Window::raise` only +request to move the window in the Z-order, `WindowExt::raise` only requests the restack, does not guarantee it. - + Registers a window as a potential drop destination. - -Remove a filter previously added with `Window::add_filter`. + +Remove a filter previously added with `WindowExt::add_filter`. ## `function` previously-added filter function ## `data` user data for previously-added filter function - + Reparents `self` into the given `new_parent`. The window being reparented will be unmapped as a side effect. ## `new_parent` @@ -4267,20 +5546,20 @@ new parent to move `self` into X location inside the new parent ## `y` Y location inside the new parent - + Resizes `self`; for toplevel windows, asks the window manager to resize the window. The window manager may not allow the resize. When using GTK+, use `gtk_window_resize` instead of this low-level GDK function. Windows may not be resized below 1x1. -If you’re also planning to move the window, use `Window::move_resize` +If you’re also planning to move the window, use `WindowExt::move_resize` to both move and resize simultaneously, for a nicer visual effect. ## `width` new width of the window ## `height` new height of the window - + Changes the position of `self` in the Z-order (stacking order), so that it is above `sibling` (if `above` is `true`) or below `sibling` (if `above` is `false`). @@ -4289,13 +5568,13 @@ If `sibling` is `None`, then this either raises (if `above` is `true`) or lowers the window. If `self` is a toplevel, the window manager may choose to deny the -request to move the window in the Z-order, `Window::restack` only +request to move the window in the Z-order, `WindowExt::restack` only requests the restack, does not guarantee it. ## `sibling` a `Window` that is a sibling of `self`, or `None` ## `above` a boolean - + Scroll the contents of `self`, both pixels and children, by the given amount. `self` itself does not move. Portions of the window that the scroll operation brings in from offscreen areas are @@ -4311,7 +5590,7 @@ artifacts and unnecessary invalidations. Amount to scroll in the X direction ## `dy` Amount to scroll in the Y direction - + Setting `accept_focus` to `false` hints the desktop environment that the window doesn’t want to receive input focus. @@ -4319,7 +5598,7 @@ On X, it is the responsibility of the window manager to interpret this hint. ICCCM-compliant window manager usually respect it. ## `accept_focus` `true` if the window should receive input focus - + Sets the background color of `self`. However, when using GTK+, influence the background of a widget @@ -4327,14 +5606,12 @@ using a style class or CSS — if you’re an application — or with `gtk_style_context_set_background` — if you're implementing a custom widget. -See also `Window::set_background_pattern`. - # Deprecated since 3.4 -Use `Window::set_background_rgba` instead. +Don't use this function ## `color` a `Color` - + Sets the background of `self`. A background of `None` means that the window will inherit its @@ -4342,25 +5619,33 @@ background from its parent window. The windowing system will normally fill a window with its background when the window is obscured then exposed. + +# Deprecated since 3.22 + +Don't use this function ## `pattern` a pattern to use, or `None` - + Sets the background color of `self`. -See also `Window::set_background_pattern`. +See also `WindowExt::set_background_pattern`. + +# Deprecated since 3.22 + +Don't use this function ## `rgba` a `RGBA` color - + Sets the input shape mask of `self` to the union of input shape masks for all children of `self`, ignoring the input shape mask of `self` -itself. Contrast with `Window::merge_child_input_shapes` which includes +itself. Contrast with `WindowExt::merge_child_input_shapes` which includes the input shape mask of `self` in the masks to be merged. - + Sets the shape mask of `self` to the union of shape masks for all children of `self`, ignoring the shape mask of `self` -itself. Contrast with `Window::merge_child_shapes` which includes +itself. Contrast with `WindowExt::merge_child_shapes` which includes the shape mask of `self` in the masks to be merged. - + Sets a `Window` as composited, or unsets it. Composited windows do not automatically have their contents drawn to the screen. Drawing is redirected to an offscreen buffer @@ -4370,7 +5655,7 @@ to manually merge the off-screen content onto the screen in whatever way it sees fit. It only makes sense for child windows to be composited; see -`Window::set_opacity` if you need translucent toplevel +`WindowExt::set_opacity` if you need translucent toplevel windows. An additional effect of this call is that the area of this @@ -4380,7 +5665,7 @@ window are also no longer clipped by the child. This call is only supported on some systems (currently, only X11 with new enough Xcomposite and Xdamage extensions). -You must call `Display::supports_composite` to check if +You must call `DisplayExt::supports_composite` to check if setting a window as composited is supported before attempting to do so. @@ -4390,19 +5675,19 @@ Compositing is an outdated technology that only ever worked on X11. ## `composited` `true` to set the window as composited - + Sets the default mouse pointer for a `Window`. Note that `cursor` must be for the same display as `self`. Use `Cursor::new_for_display` or `Cursor::new_from_pixbuf` to create the cursor. To make the cursor invisible, use `CursorType::BlankCursor`. -Passing `None` for the `cursor` argument to `Window::set_cursor` means +Passing `None` for the `cursor` argument to `WindowExt::set_cursor` means that `self` will use the cursor of its parent window. Most windows should use this default. ## `cursor` a cursor - + “Decorations” are the features the window manager adds to a toplevel `Window`. This function sets the traditional Motif window manager hints that tell the window manager which decorations you would like your window to have. @@ -4419,18 +5704,18 @@ Most window managers honor a decorations hint of 0 to disable all decorations, but very few honor all possible combinations of bits. ## `decorations` decoration hint mask - + Sets a specific `Cursor` for a given device when it gets inside `self`. Use `Cursor::new_for_display` or `Cursor::new_from_pixbuf` to create the cursor. To make the cursor invisible, use `CursorType::BlankCursor`. Passing -`None` for the `cursor` argument to `Window::set_cursor` means that +`None` for the `cursor` argument to `WindowExt::set_cursor` means that `self` will use the cursor of its parent window. Most windows should use this default. ## `device` a master, pointer `Device` ## `cursor` a `Cursor` - + Sets the event mask for a given device (Normally a floating device, not attached to any visible pointer) to `self`. For example, an event mask including `EventMask::ButtonPressMask` means the window should report button @@ -4442,7 +5727,7 @@ See the [input handling overview][event-masks] for details. `Device` to enable events for. ## `event_mask` event mask for `self` - + Determines whether or not extra unprocessed motion events in the event queue can be discarded. If `true` only the most recent event will be delivered. @@ -4456,7 +5741,7 @@ Feature: `v3_12` ## `event_compression` `true` if motion events should be compressed - + The event mask for a window determines which events will be reported for that window from all master input devices. For example, an event mask including `EventMask::ButtonPressMask` means the window should report button @@ -4466,7 +5751,7 @@ press events. The event mask is the bitwise OR of values from the See the [input handling overview][event-masks] for details. ## `event_mask` event mask for `self` - + Setting `focus_on_map` to `false` hints the desktop environment that the window doesn’t want to receive input focus when it is mapped. focus_on_map should be turned off for windows that aren’t triggered @@ -4477,7 +5762,7 @@ this hint. Window managers following the freedesktop.org window manager extension specification should respect it. ## `focus_on_map` `true` if the window should receive input focus when mapped - + Specifies whether the `self` should span over all monitors (in a multi-head setup) or only the current monitor when in fullscreen mode. @@ -4500,7 +5785,7 @@ Feature: `v3_8` ## `mode` fullscreen mode - + Sets hints about the window management functions to make available via buttons on the window frame. @@ -4516,7 +5801,7 @@ it doesn’t include `WMFunction::All`, it indicates which functions to enable. ## `functions` bitmask of operations to allow on `self` - + Sets the geometry hints for `self`. Hints flagged in `geom_mask` are set, hints not flagged in `geom_mask` are unset. To unset all hints, use a `geom_mask` of 0 and a `geometry` of `None`. @@ -4526,12 +5811,12 @@ acceptable sizes for a toplevel window. The purpose of this is to constrain user resizing, but the windowing system will typically (but is not required to) also constrain the current size of the window to the provided values and -constrain programatic resizing via `Window::resize` or -`Window::move_resize`. +constrain programatic resizing via `WindowExt::resize` or +`WindowExt::move_resize`. Note that on X11, this effect has no effect on windows of type `WindowType::Temp` or windows where override redirect -has been turned on via `Window::set_override_redirect` +has been turned on via `WindowExt::set_override_redirect` since these windows are not resizable by the user. Since you can’t count on the windowing system doing the @@ -4542,7 +5827,7 @@ appropriate sizes. geometry hints ## `geom_mask` bitmask indicating fields of `geometry` to pay attention to - + Sets the group leader window for `self`. By default, GDK sets the group leader for all toplevel windows to a global window implicitly created by GDK. With this function @@ -4555,7 +5840,7 @@ application at once. You should only set a non-default group window if your application pretends to be multiple applications. ## `leader` group leader window, or `None` to restore the default group leader window - + Sets a list of icons for the window. One of these will be used to represent the window when it has been iconified. The icon is usually shown in an icon box or some sort of task bar. Which icon @@ -4563,23 +5848,27 @@ size is shown depends on the window manager. The window manager can scale the icon but setting several size icons can give better image quality since the window manager may only need to scale the icon by a small amount or not at all. + +Note that some platforms don't support window icons. ## `pixbufs` A list of pixbufs, of different sizes. - + Windows may have a name used while minimized, distinct from the name they display in their titlebar. Most of the time this is a bad idea from a user interface standpoint. But you can set such a name with this function, if you like. -After calling this with a non-`None` `name`, calls to `Window::set_title` +After calling this with a non-`None` `name`, calls to `WindowExt::set_title` will not update the icon title. Using `None` for `name` unsets the icon title; further calls to -`Window::set_title` will again update the icon title as well. +`WindowExt::set_title` will again update the icon title as well. + +Note that some platforms don't support window icons. ## `name` name of window while iconified (minimized) - + Registers an invalidate handler for a specific window. This will get called whenever a region in the window or its children is invalidated. @@ -4594,7 +5883,7 @@ Feature: `v3_10` ## `handler` a ``GdkWindowInvalidateHandlerFunc`` callback function - + Set if `self` must be kept above other windows. If the window was already above, then this function does nothing. @@ -4606,7 +5895,7 @@ But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. ## `setting` whether to keep `self` above other windows - + Set if `self` must be kept below other windows. If the window was already below, then this function does nothing. @@ -4618,17 +5907,17 @@ But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. ## `setting` whether to keep `self` below other windows - + The application can use this hint to tell the window manager that a certain window has modal behaviour. The window manager can use this information to handle modal windows in a special way. You should only use this on windows for which you have -previously called `Window::set_transient_for` +previously called `WindowExt::set_transient_for` ## `modal` `true` if the window is modal, `false` otherwise. - + Set `self` to render as partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.) @@ -4644,13 +5933,13 @@ for your widgets. For child windows this function only works for non-native windows. -For setting up per-pixel alpha topelevels, see `Screen::get_rgba_visual`, -and for non-toplevels, see `Window::set_composited`. +For setting up per-pixel alpha topelevels, see `ScreenExt::get_rgba_visual`, +and for non-toplevels, see `WindowExt::set_composited`. Support for non-toplevel windows was added in 3.8. ## `opacity` opacity - + For optimisation purposes, compositing window managers may like to not draw obscured regions of windows, or turn off blending during for these regions. With RGB windows with no transparency, @@ -4669,7 +5958,7 @@ Feature: `v3_10` ## `region` a region, or `None` - + An override redirect window is not under the control of the window manager. This means it won’t have a titlebar, won’t be minimizable, etc. - it will be entirely under the control of the application. The window manager @@ -4680,7 +5969,31 @@ windows, such as popup menus. ``GtkMenu`` uses an override redirect window in its implementation, for example. ## `override_redirect` `true` if window should be override redirect - + +Sets whether input to the window is passed through to the window +below. + +The default value of this is `false`, which means that pointer +events that happen inside the window are send first to the window, +but if the event is not selected by the event mask then the event +is sent to the parent window, and so on up the hierarchy. + +If `pass_through` is `true` then such pointer events happen as if the +window wasn't there at all, and thus will be sent first to any +windows below `self`. This is useful if the window is used in a +transparent fashion. In the terminology of the web this would be called +"pointer-events: none". + +Note that a window with `pass_through` `true` can still have a subwindow +without pass through, so you can get events on a subset of a window. And in +that cases you would get the in-between related events such as the pointer +enter/leave events on its way to the destination window. + +Feature: `v3_18` + +## `pass_through` +a boolean + When using GTK+, typically you should use `gtk_window_set_role` instead of this low-level function. @@ -4695,7 +6008,7 @@ you use for the role, as long as you have a different role for each non-interchangeable kind of window. ## `role` a string indicating its role - + Newer GTK+ windows using client-side decorations use extra geometry around their frames for effects like shadows and invisible borders. Window managers that want to maximize windows or snap to edges need @@ -4716,27 +6029,27 @@ The right extent The top extent ## `bottom` The bottom extent - + Toggles whether a window should appear in a pager (workspace switcher, or other desktop utility program that displays a small thumbnail representation of the windows on the desktop). If a -window’s semantic type as specified with `Window::set_type_hint` +window’s semantic type as specified with `WindowExt::set_type_hint` already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type. ## `skips_pager` `true` to skip the pager - + Toggles whether a window should appear in a task list or window list. If a window’s semantic type as specified with -`Window::set_type_hint` already fully describes the window, this +`WindowExt::set_type_hint` already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type. ## `skips_taskbar` `true` to skip the taskbar - + Sets the event mask for any floating device (i.e. not attached to any visible pointer) that has the source defined as `source`. This event mask will be applied both to currently existing, newly added devices @@ -4745,12 +6058,12 @@ after this call, and devices being attached/detached. a `InputSource` to define the source class. ## `event_mask` event mask for `self` - + When using GTK+, typically you should use `gtk_window_set_startup_id` instead of this low-level function. ## `startup_id` a string with startup-notification identifier - + Used to set the bit gravity of the given window to static, and flag it so all children get static subwindow gravity. This is used if you are implementing scary features that involve deep knowledge of the @@ -4766,22 +6079,22 @@ static gravities haven't worked on anything but X11 # Returns `false` - + This function will enable multidevice features in `self`. Multidevice aware windows will need to handle properly multiple, per device enter/leave events, device grabs and grab ownerships. ## `support_multidevice` `true` to enable multidevice support in `self`. - + Sets the title of a toplevel window, to be displayed in the titlebar. If you haven’t explicitly set the icon name for the window -(using `Window::set_icon_name`), the icon name will be set to +(using `WindowExt::set_icon_name`), the icon name will be set to `title` as well. `title` must be in UTF-8 encoding (as with all user-readable strings in GDK/GTK+). `title` may not be `None`. ## `title` title of `self` - + Indicates to the window manager that `self` is a transient dialog associated with the application window `parent`. This allows the window manager to do things like center `self` on `parent` and @@ -4791,7 +6104,7 @@ See `gtk_window_set_transient_for` if you’re using ``GtkWindow`` or ``GtkDialog``. ## `parent` another toplevel `Window` - + The application can use this call to provide a hint to the window manager about the functionality of a window. The window manager can use this information when determining the decoration and behaviour @@ -4800,12 +6113,12 @@ of the window. The hint must be set before the window is mapped. ## `hint` A hint of the function this window will have - + Toggles whether a window needs the user's urgent attention. ## `urgent` `true` if the window is urgent - + For most purposes this function is deprecated in favor of `gobject::Object::set_data`. However, for historical reasons GTK+ stores the ``GtkWidget`` that owns a `Window` as user data on the @@ -4815,7 +6128,7 @@ and the user data for the window is non-`None`, GTK+ will assume the user data is a ``GtkWidget``, and forward the event to that widget. ## `user_data` user data - + Makes pixels in `self` outside `shape_region` be transparent, so that the window may be nonrectangular. @@ -4836,25 +6149,25 @@ region of window to be non-transparent X position of `shape_region` in `self` coordinates ## `offset_y` Y position of `shape_region` in `self` coordinates - -Like `Window::show_unraised`, but also raises the window to the + +Like `WindowExt::show_unraised`, but also raises the window to the top of the window stack (moves the window to the front of the Z-order). This function maps a window so it’s visible onscreen. Its opposite -is `Window::hide`. +is `WindowExt::hide`. When implementing a ``GtkWidget``, you should call this function on the widget's `Window` as part of the “map” method. - + Shows a `Window` onscreen, but does not modify its stacking -order. In contrast, `Window::show` will raise the window +order. In contrast, `WindowExt::show` will raise the window to the top of the window stack. On the X11 platform, in Xlib terms, this function calls XMapWindow() (it also updates some internal GDK state, which means that you can’t really use XMapWindow() directly on a GDK window). - + Asks the windowing system to show the window menu. The window menu is the menu shown when right-clicking the titlebar on traditional windows managed by the window manager. This is useful for windows @@ -4869,7 +6182,7 @@ a ``GdkEvent`` to show the menu for # Returns `true` if the window menu was shown and `false` otherwise. - + “Pins” a window such that it’s on all workspaces and does not scroll with viewports, for window managers that have scrollable viewports. (When using ``GtkWindow``, `gtk_window_stick` may be more useful.) @@ -4879,9 +6192,9 @@ support, so may have no effect with many window managers. However, GDK will do the best it can to convince the window manager to stick the window. For window managers that don’t support this operation, there’s nothing you can do to force it to happen. - + Thaws a window frozen with -`Window::freeze_toplevel_updates_libgtk_only`. +`WindowExt::freeze_toplevel_updates_libgtk_only`. This function is not part of the GDK public API and is only for use by GTK+. @@ -4889,9 +6202,9 @@ for use by GTK+. # Deprecated since 3.16 This symbol was never meant to be used outside of GTK+ - -Thaws a window frozen with `Window::freeze_updates`. - + +Thaws a window frozen with `WindowExt::freeze_updates`. + Moves the window out of fullscreen mode. If the window was not fullscreen, does nothing. @@ -4902,7 +6215,7 @@ don’t have a concept of “fullscreen”; so you can’t rely on the unfullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. - + Unmaximizes the window. If the window wasn’t maximized, then this function does nothing. @@ -4914,12 +6227,12 @@ actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. On Windows, reliably unmaximizes the window. - -Reverse operation for `Window::stick`; see `Window::stick`, + +Reverse operation for `WindowExt::stick`; see `WindowExt::stick`, and `gtk_window_unstick`. - + Withdraws a window (unmaps it and asks the window manager to forget about it). -This function is not really useful as `Window::hide` automatically +This function is not really useful as `WindowExt::hide` automatically withdraws toplevel windows before hiding them. Determines a window edge or corner. diff --git a/gio/vendor.md b/gio/vendor.md new file mode 100644 index 00000000..31d96201 --- /dev/null +++ b/gio/vendor.md @@ -0,0 +1,8311 @@ + + +`Action` represents a single named action. + +The main interface to an action is that it can be activated with +`Action::activate`. This results in the 'activate' signal being +emitted. An activation has a `glib::Variant` parameter (which may be +`None`). The correct type for the parameter is determined by a static +parameter type (which is given at construction time). + +An action may optionally have a state, in which case the state may be +set with `Action::change_state`. This call takes a `glib::Variant`. The +correct type for the state is determined by a static state type +(which is given at construction time). + +The state may have a hint associated with it, specifying its valid +range. + +`Action` is merely the interface to the concept of an action, as +described above. Various implementations of actions exist, including +`SimpleAction`. + +In all cases, the implementing class is responsible for storing the +name of the action, the parameter type, the enabled state, the +optional state type and the state and emitting the appropriate +signals when these change. The implementor is responsible for filtering +calls to `Action::activate` and `Action::change_state` for type +safety and for the state being enabled. + +Probably the only useful thing to do with a `Action` is to put it +inside of a `SimpleActionGroup`. + +# Implements + +[`ActionExt`](trait.ActionExt.html) + +Trait containing all `Action` methods. + +# Implementors + +[`Action`](struct.Action.html), [`SimpleAction`](struct.SimpleAction.html) + +Checks if `action_name` is valid. + +`action_name` is valid if it consists only of alphanumeric characters, +plus '-' and '.'. The empty string is not a valid action name. + +It is an error to call this function with a non-utf8 `action_name`. +`action_name` must not be `None`. + +Feature: `v2_38` + +## `action_name` +an potential action name + +# Returns + +`true` if `action_name` is valid + +Parses a detailed action name into its separate name and target +components. + +Detailed action names can have three formats. + +The first format is used to represent an action name with no target +value and consists of just an action name containing no whitespace +nor the characters ':', '(' or ')'. For example: "app.action". + +The second format is used to represent an action with a target value +that is a non-empty string consisting only of alphanumerics, plus '-' +and '.'. In that case, the action name and target value are +separated by a double colon ("::"). For example: +"app.action::target". + +The third format is used to represent an action with any type of +target value, including strings. The target value follows the action +name, surrounded in parens. For example: "app.action(42)". The +target value is parsed using `glib::Variant::parse`. If a tuple-typed +value is desired, it must be specified in the same way, resulting in +two sets of parens, for example: "app.action((1,2,3))". A string +target can be specified this way as well: "app.action('target')". +For strings, this third format must be used if * target value is +empty or contains characters other than alphanumerics, '-' and '.'. + +Feature: `v2_38` + +## `detailed_name` +a detailed action name +## `action_name` +the action name +## `target_value` +the target value, or `None` for no target + +# Returns + +`true` if successful, else `false` with `error` set + +Formats a detailed action name from `action_name` and `target_value`. + +It is an error to call this function with an invalid action name. + +This function is the opposite of `Action::parse_detailed_name`. +It will produce a string that can be parsed back to the `action_name` +and `target_value` by that function. + +See that function for the types of strings that will be printed by +this function. + +Feature: `v2_38` + +## `action_name` +a valid action name +## `target_value` +a `glib::Variant` target value, or `None` + +# Returns + +a detailed format string + +Activates the action. + +`parameter` must be the correct type of parameter for the action (ie: +the parameter type given at construction time). If the parameter +type was `None` then `parameter` must also be `None`. + +If the `parameter` GVariant is floating, it is consumed. +## `parameter` +the parameter to the activation + +Request for the state of `self` to be changed to `value`. + +The action must be stateful and `value` must be of the correct type. +See `Action::get_state_type`. + +This call merely requests a change. The action may refuse to change +its state or may change its state to something other than `value`. +See `Action::get_state_hint`. + +If the `value` GVariant is floating, it is consumed. +## `value` +the new state + +Checks if `self` is currently enabled. + +An action must be enabled in order to be activated or in order to +have its state changed from outside callers. + +# Returns + +whether the action is enabled + +Queries the name of `self`. + +# Returns + +the name of the action + +Queries the type of the parameter that must be given when activating +`self`. + +When activating the action using `Action::activate`, the `glib::Variant` +given to that function must be of the type returned by this function. + +In the case that this function returns `None`, you must not give any +`glib::Variant`, but `None` instead. + +# Returns + +the parameter type + +Queries the current state of `self`. + +If the action is not stateful then `None` will be returned. If the +action is stateful then the type of the return value is the type +given by `Action::get_state_type`. + +The return value (if non-`None`) should be freed with +`glib::Variant::unref` when it is no longer required. + +# Returns + +the current state of the action + +Requests a hint about the valid range of values for the state of +`self`. + +If `None` is returned it either means that the action is not stateful +or that there is no hint about the valid range of values for the +state of the action. + +If a `glib::Variant` array is returned then each item in the array is a +possible value for the state. If a `glib::Variant` pair (ie: two-tuple) is +returned then the tuple specifies the inclusive lower and upper bound +of valid values for the state. + +In any case, the information is merely a hint. It may be possible to +have a state value outside of the hinted range and setting a value +within the range may fail. + +The return value (if non-`None`) should be freed with +`glib::Variant::unref` when it is no longer required. + +# Returns + +the state range hint + +Queries the type of the state of `self`. + +If the action is stateful (e.g. created with +`SimpleAction::new_stateful`) then this function returns the +`glib::VariantType` of the state. This is the type of the initial value +given as the state. All calls to `Action::change_state` must give a +`glib::Variant` of this type and `Action::get_state` will return a +`glib::Variant` of the same type. + +If the action is not stateful (e.g. created with `SimpleAction::new`) +then this function will return `None`. In that case, `Action::get_state` +will return `None` and you must not call `Action::change_state`. + +# Returns + +the state type, if the action is stateful + +`ActionGroup` represents a group of actions. Actions can be used to +expose functionality in a structured way, either from one part of a +program to another, or to the outside world. Action groups are often +used together with a `MenuModel` that provides additional +representation data for displaying the actions to the user, e.g. in +a menu. + +The main way to interact with the actions in a GActionGroup is to +activate them with `ActionGroup::activate_action`. Activating an +action may require a `glib::Variant` parameter. The required type of the +parameter can be inquired with `ActionGroup::get_action_parameter_type`. +Actions may be disabled, see `ActionGroup::get_action_enabled`. +Activating a disabled action has no effect. + +Actions may optionally have a state in the form of a `glib::Variant`. The +current state of an action can be inquired with +`ActionGroup::get_action_state`. Activating a stateful action may +change its state, but it is also possible to set the state by calling +`ActionGroup::change_action_state`. + +As typical example, consider a text editing application which has an +option to change the current font to 'bold'. A good way to represent +this would be a stateful action, with a boolean state. Activating the +action would toggle the state. + +Each action in the group has a unique name (which is a string). All +method calls, except `ActionGroup::list_actions` take the name of +an action as an argument. + +The `ActionGroup` API is meant to be the 'public' API to the action +group. The calls here are exactly the interaction that 'external +forces' (eg: UI, incoming D-Bus messages, etc.) are supposed to have +with actions. 'Internal' APIs (ie: ones meant only to be accessed by +the action group implementation) are found on subclasses. This is +why you will find - for example - `ActionGroup::get_action_enabled` +but not an equivalent `set` call. + +Signals are emitted on the action group in response to state changes +on individual actions. + +Implementations of `ActionGroup` should provide implementations for +the virtual functions `ActionGroup::list_actions` and +`ActionGroup::query_action`. The other virtual functions should +not be implemented - their "wrappers" are actually implemented with +calls to `ActionGroup::query_action`. + +# Implements + +[`ActionGroupExt`](trait.ActionGroupExt.html) + +Trait containing all `ActionGroup` methods. + +# Implementors + +[`ActionGroup`](struct.ActionGroup.html), [`Application`](struct.Application.html), [`SimpleActionGroup`](struct.SimpleActionGroup.html) + +Emits the `ActionGroup::action-added` signal on `self`. + +This function should only be called by `ActionGroup` implementations. +## `action_name` +the name of an action in the group + +Emits the `ActionGroup::action-enabled-changed` signal on `self`. + +This function should only be called by `ActionGroup` implementations. +## `action_name` +the name of an action in the group +## `enabled` +whether or not the action is now enabled + +Emits the `ActionGroup::action-removed` signal on `self`. + +This function should only be called by `ActionGroup` implementations. +## `action_name` +the name of an action in the group + +Emits the `ActionGroup::action-state-changed` signal on `self`. + +This function should only be called by `ActionGroup` implementations. +## `action_name` +the name of an action in the group +## `state` +the new state of the named action + +Activate the named action within `self`. + +If the action is expecting a parameter, then the correct type of +parameter must be given as `parameter`. If the action is expecting no +parameters then `parameter` must be `None`. See +`ActionGroup::get_action_parameter_type`. +## `action_name` +the name of the action to activate +## `parameter` +parameters to the activation + +Request for the state of the named action within `self` to be +changed to `value`. + +The action must be stateful and `value` must be of the correct type. +See `ActionGroup::get_action_state_type`. + +This call merely requests a change. The action may refuse to change +its state or may change its state to something other than `value`. +See `ActionGroup::get_action_state_hint`. + +If the `value` GVariant is floating, it is consumed. +## `action_name` +the name of the action to request the change on +## `value` +the new state + +Checks if the named action within `self` is currently enabled. + +An action must be enabled in order to be activated or in order to +have its state changed from outside callers. +## `action_name` +the name of the action to query + +# Returns + +whether or not the action is currently enabled + +Queries the type of the parameter that must be given when activating +the named action within `self`. + +When activating the action using `ActionGroup::activate_action`, +the `glib::Variant` given to that function must be of the type returned +by this function. + +In the case that this function returns `None`, you must not give any +`glib::Variant`, but `None` instead. + +The parameter type of a particular action will never change but it is +possible for an action to be removed and for a new action to be added +with the same name but a different parameter type. +## `action_name` +the name of the action to query + +# Returns + +the parameter type + +Queries the current state of the named action within `self`. + +If the action is not stateful then `None` will be returned. If the +action is stateful then the type of the return value is the type +given by `ActionGroup::get_action_state_type`. + +The return value (if non-`None`) should be freed with +`glib::Variant::unref` when it is no longer required. +## `action_name` +the name of the action to query + +# Returns + +the current state of the action + +Requests a hint about the valid range of values for the state of the +named action within `self`. + +If `None` is returned it either means that the action is not stateful +or that there is no hint about the valid range of values for the +state of the action. + +If a `glib::Variant` array is returned then each item in the array is a +possible value for the state. If a `glib::Variant` pair (ie: two-tuple) is +returned then the tuple specifies the inclusive lower and upper bound +of valid values for the state. + +In any case, the information is merely a hint. It may be possible to +have a state value outside of the hinted range and setting a value +within the range may fail. + +The return value (if non-`None`) should be freed with +`glib::Variant::unref` when it is no longer required. +## `action_name` +the name of the action to query + +# Returns + +the state range hint + +Queries the type of the state of the named action within +`self`. + +If the action is stateful then this function returns the +`glib::VariantType` of the state. All calls to +`ActionGroup::change_action_state` must give a `glib::Variant` of this +type and `ActionGroup::get_action_state` will return a `glib::Variant` +of the same type. + +If the action is not stateful then this function will return `None`. +In that case, `ActionGroup::get_action_state` will return `None` +and you must not call `ActionGroup::change_action_state`. + +The state type of a particular action will never change but it is +possible for an action to be removed and for a new action to be added +with the same name but a different state type. +## `action_name` +the name of the action to query + +# Returns + +the state type, if the action is stateful + +Checks if the named action exists within `self`. +## `action_name` +the name of the action to check for + +# Returns + +whether the named action exists + +Lists the actions contained within `self`. + +The caller is responsible for freeing the list with `g_strfreev` when +it is no longer required. + +# Returns + +a `None`-terminated array of the names of the +actions in the group + +Queries all aspects of the named action within an `self`. + +This function acquires the information available from +`ActionGroup::has_action`, `ActionGroup::get_action_enabled`, +`ActionGroup::get_action_parameter_type`, +`ActionGroup::get_action_state_type`, +`ActionGroup::get_action_state_hint` and +`ActionGroup::get_action_state` with a single function call. + +This provides two main benefits. + +The first is the improvement in efficiency that comes with not having +to perform repeated lookups of the action in order to discover +different things about it. The second is that implementing +`ActionGroup` can now be done by only overriding this one virtual +function. + +The interface provides a default implementation of this function that +calls the individual functions, as required, to fetch the +information. The interface also provides default implementations of +those functions that call this function. All implementations, +therefore, must override either this function or all of the others. + +If the action exists, `true` is returned and any of the requested +fields (as indicated by having a non-`None` reference passed in) are +filled. If the action doesn't exist, `false` is returned and the +fields may or may not have been modified. +## `action_name` +the name of an action in the group +## `enabled` +if the action is presently enabled +## `parameter_type` +the parameter type, or `None` if none needed +## `state_type` +the state type, or `None` if stateless +## `state_hint` +the state hint, or `None` if none +## `state` +the current state, or `None` if stateless + +# Returns + +`true` if the action exists, else `false` + +The GActionMap interface is implemented by `ActionGroup` +implementations that operate by containing a number of +named `Action` instances, such as `SimpleActionGroup`. + +One useful application of this interface is to map the +names of actions from various action groups to unique, +prefixed names (e.g. by prepending "app." or "win."). +This is the motivation for the 'Map' part of the interface +name. + +# Implements + +[`ActionMapExt`](trait.ActionMapExt.html) + +Trait containing all `ActionMap` methods. + +# Implementors + +[`ActionMap`](struct.ActionMap.html), [`Application`](struct.Application.html), [`SimpleActionGroup`](struct.SimpleActionGroup.html) + +Adds an action to the `self`. + +If the action map already contains an action with the same name +as `action` then the old action is dropped from the action map. + +The action map takes its own reference on `action`. +## `action` +a `Action` + +A convenience function for creating multiple `SimpleAction` instances +and adding them to a `ActionMap`. + +Each action is constructed as per one `ActionEntry`. + + +```C +static void +activate_quit (GSimpleAction *simple, + GVariant *parameter, + gpointer user_data) +{ + exit (0); +} + +static void +activate_print_string (GSimpleAction *simple, + GVariant *parameter, + gpointer user_data) +{ + g_print ("%s\n", g_variant_get_string (parameter, NULL)); +} + +static GActionGroup * +create_action_group (void) +{ + const GActionEntry entries[] = { + { "quit", activate_quit }, + { "print-string", activate_print_string, "s" } + }; + GSimpleActionGroup *group; + + group = g_simple_action_group_new (); + g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL); + + return G_ACTION_GROUP (group); +} +``` +## `entries` +a pointer to + the first item in an array of `ActionEntry` structs +## `n_entries` +the length of `entries`, or -1 if `entries` is `None`-terminated +## `user_data` +the user data for signal connections + +Looks up the action with the name `action_name` in `self`. + +If no such action exists, returns `None`. +## `action_name` +the name of an action + +# Returns + +a `Action`, or `None` + +Removes the named action from the action map. + +If no action of this name is in the map then nothing happens. +## `action_name` +the name of the action + +`AppInfo` and `AppLaunchContext` are used for describing and launching +applications installed on the system. + +As of GLib 2.20, URIs will always be converted to POSIX paths +(using `File::get_path`) when using `AppInfo::launch` even if +the application requested an URI and not a POSIX path. For example +for an desktop-file based application with Exec key `totem +%U` and a single URI, `sftp://foo/file.avi`, then +`/home/user/.gvfs/sftp on foo/file.avi` will be passed. This will +only work if a set of suitable GIO extensions (such as gvfs 2.26 +compiled with FUSE support), is available and operational; if this +is not the case, the URI will be passed unmodified to the application. +Some URIs, such as `mailto:`, of course cannot be mapped to a POSIX +path (in gvfs there's no FUSE mount for it); such URIs will be +passed unmodified to the application. + +Specifically for gvfs 2.26 and later, the POSIX URI will be mapped +back to the GIO URI in the `File` constructors (since gvfs +implements the `Vfs` extension point). As such, if the application +needs to examine the URI, it needs to use `File::get_uri` or +similar on `File`. In other words, an application cannot assume +that the URI passed to e.g. `File::new_for_commandline_arg` is +equal to the result of `File::get_uri`. The following snippet +illustrates this: + + +```text +GFile *f; +char *uri; + +file = g_file_new_for_commandline_arg (uri_from_commandline); + +uri = g_file_get_uri (file); +strcmp (uri, uri_from_commandline) == 0; +g_free (uri); + +if (g_file_has_uri_scheme (file, "cdda")) + { + // do something special with uri + } +g_object_unref (file); +``` + +This code will work when both `cdda://sr0/Track 1.wav` and +`/home/user/.gvfs/cdda on sr0/Track 1.wav` is passed to the +application. It should be noted that it's generally not safe +for applications to rely on the format of a particular URIs. +Different launcher applications (e.g. file managers) may have +different ideas of what a given URI means. + +# Implements + +[`AppInfoExt`](trait.AppInfoExt.html) + +Trait containing all `AppInfo` methods. + +# Implementors + +[`AppInfo`](struct.AppInfo.html) + +Creates a new `AppInfo` from the given information. + +Note that for `commandline`, the quoting rules of the Exec key of the +[freedesktop.org Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec) +are applied. For example, if the `commandline` contains +percent-encoded URIs, the percent-character must be doubled in order to prevent it from +being swallowed by Exec key unquoting. See the specification for exact quoting rules. +## `commandline` +the commandline to use +## `application_name` +the application name, or `None` to use `commandline` +## `flags` +flags that can specify details of the created `AppInfo` + +# Returns + +new `AppInfo` for given command. + +Gets a list of all of the applications currently registered +on this system. + +For desktop files, this includes applications that have +`NoDisplay=true` set or are excluded from display by means +of `OnlyShowIn` or `NotShowIn`. See `AppInfo::should_show`. +The returned list does not include applications which have +the `Hidden` key set. + +# Returns + +a newly allocated `glib::List` of references to `GAppInfos`. + +Gets a list of all `GAppInfos` for a given content type, +including the recommended and fallback `GAppInfos`. See +`AppInfo::get_recommended_for_type` and +`AppInfo::get_fallback_for_type`. +## `content_type` +the content type to find a `AppInfo` for + +# Returns + +`glib::List` of `GAppInfos` + for given `content_type` or `None` on error. + +Gets the default `AppInfo` for a given content type. +## `content_type` +the content type to find a `AppInfo` for +## `must_support_uris` +if `true`, the `AppInfo` is expected to + support URIs + +# Returns + +`AppInfo` for given `content_type` or + `None` on error. + +Gets the default application for handling URIs with +the given URI scheme. A URI scheme is the initial part +of the URI, up to but not including the ':', e.g. "http", +"ftp" or "sip". +## `uri_scheme` +a string containing a URI scheme. + +# Returns + +`AppInfo` for given `uri_scheme` or `None` on error. + +Gets a list of fallback `GAppInfos` for a given content type, i.e. +those applications which claim to support the given content type +by MIME type subclassing and not directly. +## `content_type` +the content type to find a `AppInfo` for + +# Returns + +`glib::List` of `GAppInfos` + for given `content_type` or `None` on error. + +Gets a list of recommended `GAppInfos` for a given content type, i.e. +those applications which claim to support the given content type exactly, +and not by MIME type subclassing. +Note that the first application of the list is the last used one, i.e. +the last one for which `AppInfo::set_as_last_used_for_type` has been +called. +## `content_type` +the content type to find a `AppInfo` for + +# Returns + +`glib::List` of `GAppInfos` + for given `content_type` or `None` on error. + +Utility function that launches the default application +registered to handle the specified uri. Synchronous I/O +is done on the uri to detect the type of the file if +required. +## `uri` +the uri to show +## `launch_context` +an optional `AppLaunchContext` + +# Returns + +`true` on success, `false` on error. + +Async version of `AppInfo::launch_default_for_uri`. + +This version is useful if you are interested in receiving +error information in the case where the application is +sandboxed and the portal may present an application chooser +dialog to the user. + +Feature: `v2_50` + +## `uri` +the uri to show +## `callback` +a `GASyncReadyCallback` to call when the request is done +## `user_data` +data to pass to `callback` + +Finishes an asynchronous launch-default-for-uri operation. + +Feature: `v2_50` + +## `result` +a `AsyncResult` + +# Returns + +`true` if the launch was successful, `false` if `error` is set + +Removes all changes to the type associations done by +`AppInfo::set_as_default_for_type`, +`AppInfo::set_as_default_for_extension`, +`AppInfo::add_supports_type` or +`AppInfo::remove_supports_type`. +## `content_type` +a content type + +Adds a content type to the application information to indicate the +application is capable of opening files with the given content type. +## `content_type` +a string. + +# Returns + +`true` on success, `false` on error. + +Obtains the information whether the `AppInfo` can be deleted. +See `AppInfo::delete`. + +# Returns + +`true` if `self` can be deleted + +Checks if a supported content type can be removed from an application. + +# Returns + +`true` if it is possible to remove supported + content types from a given `self`, `false` if not. + +Tries to delete a `AppInfo`. + +On some platforms, there may be a difference between user-defined +`GAppInfos` which can be deleted, and system-wide ones which cannot. +See `AppInfo::can_delete`. + +# Returns + +`true` if `self` has been deleted + +Creates a duplicate of a `AppInfo`. + +# Returns + +a duplicate of `self`. + +Checks if two `GAppInfos` are equal. +## `appinfo2` +the second `AppInfo`. + +# Returns + +`true` if `self` is equal to `appinfo2`. `false` otherwise. + +Gets the commandline with which the application will be +started. + +# Returns + +a string containing the `self`'s commandline, + or `None` if this information is not available + +Gets a human-readable description of an installed application. + +# Returns + +a string containing a description of the +application `self`, or `None` if none. + +Gets the display name of the application. The display name is often more +descriptive to the user than the name itself. + +# Returns + +the display name of the application for `self`, or the name if +no display name is available. + +Gets the executable's name for the installed application. + +# Returns + +a string containing the `self`'s application +binaries name + +Gets the icon for the application. + +# Returns + +the default `Icon` for `self` or `None` +if there is no default icon. + +Gets the ID of an application. An id is a string that +identifies the application. The exact format of the id is +platform dependent. For instance, on Unix this is the +desktop file id from the xdg menu specification. + +Note that the returned ID may be `None`, depending on how +the `self` has been constructed. + +# Returns + +a string containing the application's ID. + +Gets the installed name of the application. + +# Returns + +the name of the application for `self`. + +Retrieves the list of content types that `app_info` claims to support. +If this information is not provided by the environment, this function +will return `None`. +This function does not take in consideration associations added with +`AppInfo::add_supports_type`, but only those exported directly by +the application. + +Feature: `v2_34` + + +# Returns + + + a list of content types. + +Launches the application. Passes `files` to the launched application +as arguments, using the optional `launch_context` to get information +about the details of the launcher (like what screen it is on). +On error, `error` will be set accordingly. + +To launch the application without arguments pass a `None` `files` list. + +Note that even if the launch is successful the application launched +can fail to start if it runs into problems during startup. There is +no way to detect this. + +Some URIs can be changed when passed through a GFile (for instance +unsupported URIs with strange formats like mailto:), so if you have +a textual URI you want to pass in as argument, consider using +`AppInfo::launch_uris` instead. + +The launched application inherits the environment of the launching +process, but it can be modified with `AppLaunchContextExt::setenv` +and `AppLaunchContextExt::unsetenv`. + +On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE` +environment variable with the path of the launched desktop file and +`GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched +process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`, +should it be inherited by further processes. The `DISPLAY` and +`DESKTOP_STARTUP_ID` environment variables are also set, based +on information provided in `launch_context`. +## `files` +a `glib::List` of `File` objects +## `launch_context` +a `AppLaunchContext` or `None` + +# Returns + +`true` on successful launch, `false` otherwise. + +Launches the application. This passes the `uris` to the launched application +as arguments, using the optional `launch_context` to get information +about the details of the launcher (like what screen it is on). +On error, `error` will be set accordingly. + +To launch the application without arguments pass a `None` `uris` list. + +Note that even if the launch is successful the application launched +can fail to start if it runs into problems during startup. There is +no way to detect this. +## `uris` +a `glib::List` containing URIs to launch. +## `launch_context` +a `AppLaunchContext` or `None` + +# Returns + +`true` on successful launch, `false` otherwise. + +Removes a supported type from an application, if possible. +## `content_type` +a string. + +# Returns + +`true` on success, `false` on error. + +Sets the application as the default handler for the given file extension. +## `extension` +a string containing the file extension + (without the dot). + +# Returns + +`true` on success, `false` on error. + +Sets the application as the default handler for a given type. +## `content_type` +the content type. + +# Returns + +`true` on success, `false` on error. + +Sets the application as the last used application for a given type. +This will make the application appear as first in the list returned +by `AppInfo::get_recommended_for_type`, regardless of the default +application for that content type. +## `content_type` +the content type. + +# Returns + +`true` on success, `false` on error. + +Checks if the application info should be shown in menus that +list available applications. + +# Returns + +`true` if the `self` should be shown, `false` otherwise. + +Checks if the application accepts files as arguments. + +# Returns + +`true` if the `self` supports files. + +Checks if the application supports reading files and directories from URIs. + +# Returns + +`true` if the `self` supports URIs. + +Integrating the launch with the launching application. This is used to +handle for instance startup notification and launching the new application +on the same screen as the launching window. + +# Implements + +[`AppLaunchContextExt`](trait.AppLaunchContextExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `AppLaunchContext` methods. + +# Implementors + +[`AppLaunchContext`](struct.AppLaunchContext.html) + +Creates a new application launch context. This is not normally used, +instead you instantiate a subclass of this, such as ``GdkAppLaunchContext``. + +# Returns + +a `AppLaunchContext`. + +Gets the display string for the `self`. This is used to ensure new +applications are started on the same display as the launching +application, by setting the `DISPLAY` environment variable. +## `info` +a `AppInfo` +## `files` +a `glib::List` of `File` objects + +# Returns + +a display string for the display. + +Gets the complete environment variable list to be passed to +the child process when `self` is used to launch an application. +This is a `None`-terminated array of strings, where each string has +the form `KEY=VALUE`. + +# Returns + +the + child's environment + +Initiates startup notification for the application and returns the +`DESKTOP_STARTUP_ID` for the launched operation, if supported. + +Startup notification IDs are defined in the +[FreeDesktop.Org Startup Notifications standard](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt"). +## `info` +a `AppInfo` +## `files` +a `glib::List` of of `File` objects + +# Returns + +a startup notification ID for the application, or `None` if + not supported. + +Called when an application has failed to launch, so that it can cancel +the application startup notification started in `AppLaunchContextExt::get_startup_notify_id`. +## `startup_notify_id` +the startup notification id that was returned by `AppLaunchContextExt::get_startup_notify_id`. + +Arranges for `variable` to be set to `value` in the child's +environment when `self` is used to launch an application. +## `variable` +the environment variable to set +## `value` +the value for to set the variable to. + +Arranges for `variable` to be unset in the child's environment +when `self` is used to launch an application. +## `variable` +the environment variable to remove + +A `Application` is the foundation of an application. It wraps some +low-level platform-specific services and is intended to act as the +foundation for higher-level application classes such as +``GtkApplication`` or `MxApplication`. In general, you should not use +this class outside of a higher level framework. + +GApplication provides convenient life cycle management by maintaining +a "use count" for the primary application instance. The use count can +be changed using `ApplicationExt::hold` and `ApplicationExt::release`. If +it drops to zero, the application exits. Higher-level classes such as +``GtkApplication`` employ the use count to ensure that the application +stays alive as long as it has any opened windows. + +Another feature that GApplication (optionally) provides is process +uniqueness. Applications can make use of this functionality by +providing a unique application ID. If given, only one application +with this ID can be running at a time per session. The session +concept is platform-dependent, but corresponds roughly to a graphical +desktop login. When your application is launched again, its +arguments are passed through platform communication to the already +running program. The already running instance of the program is +called the "primary instance"; for non-unique applications this is +the always the current instance. On Linux, the D-Bus session bus +is used for communication. + +The use of `Application` differs from some other commonly-used +uniqueness libraries (such as libunique) in important ways. The +application is not expected to manually register itself and check +if it is the primary instance. Instead, the `main` function of a +`Application` should do very little more than instantiating the +application instance, possibly connecting signal handlers, then +calling `ApplicationExt::run`. All checks for uniqueness are done +internally. If the application is the primary instance then the +startup signal is emitted and the mainloop runs. If the application +is not the primary instance then a signal is sent to the primary +instance and `ApplicationExt::run` promptly returns. See the code +examples below. + +If used, the expected form of an application identifier is very close +to that of of a +[DBus bus name](http://dbus.freedesktop.org/doc/dbus-specification.html`message`-protocol-names-interface). +Examples include: "com.example.MyApp", "org.example.internal-apps.Calculator". +For details on valid application identifiers, see `Application::id_is_valid`. + +On Linux, the application identifier is claimed as a well-known bus name +on the user's session bus. This means that the uniqueness of your +application is scoped to the current session. It also means that your +application may provide additional services (through registration of other +object paths) at that bus name. The registration of these object paths +should be done with the shared GDBus session bus. Note that due to the +internal architecture of GDBus, method calls can be dispatched at any time +(even if a main loop is not running). For this reason, you must ensure that +any object paths that you wish to register are registered before `Application` +attempts to acquire the bus name of your application (which happens in +`ApplicationExt::register`). Unfortunately, this means that you cannot use +`ApplicationExt::get_is_remote` to decide if you want to register object paths. + +GApplication also implements the `ActionGroup` and `ActionMap` +interfaces and lets you easily export actions by adding them with +`ActionMap::add_action`. When invoking an action by calling +`ActionGroup::activate_action` on the application, it is always +invoked in the primary instance. The actions are also exported on +the session bus, and GIO provides the `DBusActionGroup` wrapper to +conveniently access them remotely. GIO provides a `DBusMenuModel` wrapper +for remote access to exported `GMenuModels`. + +There is a number of different entry points into a GApplication: + +- via 'Activate' (i.e. just starting the application) + +- via 'Open' (i.e. opening some files) + +- by handling a command-line + +- via activating an action + +The `Application::startup` signal lets you handle the application +initialization for all of these in a single place. + +Regardless of which of these entry points is used to start the +application, GApplication passes some "platform data from the +launching instance to the primary instance, in the form of a +`glib::Variant` dictionary mapping strings to variants. To use platform +data, override the `before_emit` or `after_emit` virtual functions +in your `Application` subclass. When dealing with +`ApplicationCommandLine` objects, the platform data is +directly available via `ApplicationCommandLine::get_cwd`, +`ApplicationCommandLine::get_environ` and +`ApplicationCommandLine::get_platform_data`. + +As the name indicates, the platform data may vary depending on the +operating system, but it always includes the current directory (key +"cwd"), and optionally the environment (ie the set of environment +variables and their values) of the calling process (key "environ"). +The environment is only added to the platform data if the +`ApplicationFlags::SendEnvironment` flag is set. `Application` subclasses +can add their own platform data by overriding the `add_platform_data` +virtual function. For instance, ``GtkApplication`` adds startup notification +data in this way. + +To parse commandline arguments you may handle the +`Application::command-line` signal or override the `local_command_line` +vfunc, to parse them in either the primary instance or the local instance, +respectively. + +For an example of opening files with a GApplication, see +[gapplication-example-open.c](https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-open.c). + +For an example of using actions with GApplication, see +[gapplication-example-actions.c](https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-actions.c). + +For an example of using extra D-Bus hooks with GApplication, see +[gapplication-example-dbushooks.c](https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-dbushooks.c). + +# Implements + +[`ApplicationExt`](trait.ApplicationExt.html), [`ObjectExt`](trait.ObjectExt.html), [`ActionGroupExt`](trait.ActionGroupExt.html), [`ActionMapExt`](trait.ActionMapExt.html) + +Trait containing all `Application` methods. + +# Implementors + +[`Application`](struct.Application.html) + +Creates a new `Application` instance. + +If non-`None`, the application id must be valid. See +`Application::id_is_valid`. + +If no application ID is given then some features of `Application` +(most notably application uniqueness) will be disabled. +## `application_id` +the application id +## `flags` +the application flags + +# Returns + +a new `Application` instance + +Returns the default `Application` instance for this process. + +Normally there is only one `Application` per process and it becomes +the default when it is created. You can exercise more control over +this by using `ApplicationExt::set_default`. + +If there is no default application then `None` is returned. + +# Returns + +the default application for this process, or `None` + +Checks if `application_id` is a valid application identifier. + +A valid ID is required for calls to `Application::new` and +`ApplicationExt::set_application_id`. + +For convenience, the restrictions on application identifiers are +reproduced here: + +- Application identifiers must contain only the ASCII characters + "[A-Z][a-z][0-9]_-." and must not begin with a digit. + +- Application identifiers must contain at least one '.' (period) + character (and thus at least three elements). + +- Application identifiers must not begin or end with a '.' (period) + character. + +- Application identifiers must not contain consecutive '.' (period) + characters. + +- Application identifiers must not exceed 255 characters. +## `application_id` +a potential application identifier + +# Returns + +`true` if `application_id` is valid + +Activates the application. + +In essence, this results in the `Application::activate` signal being +emitted in the primary instance. + +The application must be registered before calling this function. + +Add an option to be handled by `self`. + +Calling this function is the equivalent of calling +`ApplicationExt::add_main_option_entries` with a single `glib::OptionEntry` +that has its arg_data member set to `None`. + +The parsed arguments will be packed into a `glib::VariantDict` which +is passed to `Application::handle-local-options`. If +`ApplicationFlags::HandlesCommandLine` is set, then it will also +be sent to the primary instance. See +`ApplicationExt::add_main_option_entries` for more details. + +See `glib::OptionEntry` for more documentation of the arguments. + +Feature: `v2_42` + +## `long_name` +the long name of an option used to specify it in a commandline +## `short_name` +the short name of an option +## `flags` +flags from `glib::OptionFlags` +## `arg` +the type of the option, as a `glib::OptionArg` +## `description` +the description for the option in `--help` output +## `arg_description` +the placeholder to use for the extra argument + parsed by the option in `--help` output + +Adds main option entries to be handled by `self`. + +This function is comparable to `glib::OptionContext::add_main_entries`. + +After the commandline arguments are parsed, the +`Application::handle-local-options` signal will be emitted. At this +point, the application can inspect the values pointed to by `arg_data` +in the given `GOptionEntrys`. + +Unlike `glib::OptionContext`, `Application` supports giving a `None` +`arg_data` for a non-callback `glib::OptionEntry`. This results in the +argument in question being packed into a `glib::VariantDict` which is also +passed to `Application::handle-local-options`, where it can be +inspected and modified. If `ApplicationFlags::HandlesCommandLine` is +set, then the resulting dictionary is sent to the primary instance, +where `ApplicationCommandLine::get_options_dict` will return it. +This "packing" is done according to the type of the argument -- +booleans for normal flags, strings for strings, bytestrings for +filenames, etc. The packing only occurs if the flag is given (ie: we +do not pack a "false" `glib::Variant` in the case that a flag is missing). + +In general, it is recommended that all commandline arguments are +parsed locally. The options dictionary should then be used to +transmit the result of the parsing to the primary instance, where +`glib::VariantDict::lookup` can be used. For local options, it is +possible to either use `arg_data` in the usual way, or to consult (and +potentially remove) the option from the options dictionary. + +This function is new in GLib 2.40. Before then, the only real choice +was to send all of the commandline arguments (options and all) to the +primary instance for handling. `Application` ignored them completely +on the local side. Calling this function "opts in" to the new +behaviour, and in particular, means that unrecognised options will be +treated as errors. Unrecognised options have never been ignored when +`ApplicationFlags::HandlesCommandLine` is unset. + +If `Application::handle-local-options` needs to see the list of +filenames, then the use of `G_OPTION_REMAINING` is recommended. If +`arg_data` is `None` then `G_OPTION_REMAINING` can be used as a key into +the options dictionary. If you do use `G_OPTION_REMAINING` then you +need to handle these arguments for yourself because once they are +consumed, they will no longer be visible to the default handling +(which treats them as filenames to be opened). + +It is important to use the proper GVariant format when retrieving +the options with `glib::VariantDict::lookup`: +- for `glib::OptionArg::None`, use b +- for `glib::OptionArg::String`, use &s +- for `glib::OptionArg::Int`, use i +- for `glib::OptionArg::Int64`, use x +- for `glib::OptionArg::Double`, use d +- for `glib::OptionArg::Filename`, use ^ay +- for `glib::OptionArg::StringArray`, use &as +- for `glib::OptionArg::FilenameArray`, use ^aay + +Feature: `v2_40` + +## `entries` +a + `None`-terminated list of `GOptionEntrys` + +Adds a `glib::OptionGroup` to the commandline handling of `self`. + +This function is comparable to `glib::OptionContext::add_group`. + +Unlike `ApplicationExt::add_main_option_entries`, this function does +not deal with `None` `arg_data` and never transmits options to the +primary instance. + +The reason for that is because, by the time the options arrive at the +primary instance, it is typically too late to do anything with them. +Taking the GTK option group as an example: GTK will already have been +initialised by the time the `Application::command-line` handler runs. +In the case that this is not the first-running instance of the +application, the existing instance may already have been running for +a very long time. + +This means that the options from `glib::OptionGroup` are only really usable +in the case that the instance of the application being run is the +first instance. Passing options like `--display=` or `--gdk-debug=` +on future runs will have no effect on the existing primary instance. + +Calling this function will cause the options in the supplied option +group to be parsed, but it does not cause you to be "opted in" to the +new functionality whereby unrecognised options are rejected even if +`ApplicationFlags::HandlesCommandLine` was given. + +Feature: `v2_40` + +## `group` +a `glib::OptionGroup` + +Marks `self` as busy (see `ApplicationExt::mark_busy`) while +`property` on `object` is `true`. + +The binding holds a reference to `self` while it is active, but +not to `object`. Instead, the binding is destroyed when `object` is +finalized. + +Feature: `v2_44` + +## `object` +a `gobject::Object` +## `property` +the name of a boolean property of `object` + +Gets the unique identifier for `self`. + +# Returns + +the identifier for `self`, owned by `self` + +Gets the `DBusConnection` being used by the application, or `None`. + +If `Application` is using its D-Bus backend then this function will +return the `DBusConnection` being used for uniqueness and +communication with the desktop environment and other instances of the +application. + +If `Application` is not using D-Bus then this function will return +`None`. This includes the situation where the D-Bus backend would +normally be in use but we were unable to connect to the bus. + +This function must not be called before the application has been +registered. See `ApplicationExt::get_is_registered`. + +Feature: `v2_34` + + +# Returns + +a `DBusConnection`, or `None` + +Gets the D-Bus object path being used by the application, or `None`. + +If `Application` is using its D-Bus backend then this function will +return the D-Bus object path that `Application` is using. If the +application is the primary instance then there is an object published +at this path. If the application is not the primary instance then +the result of this function is undefined. + +If `Application` is not using D-Bus then this function will return +`None`. This includes the situation where the D-Bus backend would +normally be in use but we were unable to connect to the bus. + +This function must not be called before the application has been +registered. See `ApplicationExt::get_is_registered`. + +Feature: `v2_34` + + +# Returns + +the object path, or `None` + +Gets the flags for `self`. + +See `ApplicationFlags`. + +# Returns + +the flags for `self` + +Gets the current inactivity timeout for the application. + +This is the amount of time (in milliseconds) after the last call to +`ApplicationExt::release` before the application stops running. + +# Returns + +the timeout, in milliseconds + +Gets the application's current busy state, as set through +`ApplicationExt::mark_busy` or `ApplicationExt::bind_busy_property`. + +Feature: `v2_44` + + +# Returns + +`true` if `self` is currenty marked as busy + +Checks if `self` is registered. + +An application is registered if `ApplicationExt::register` has been +successfully called. + +# Returns + +`true` if `self` is registered + +Checks if `self` is remote. + +If `self` is remote then it means that another instance of +application already exists (the 'primary' instance). Calls to +perform actions on `self` will result in the actions being +performed by the primary instance. + +The value of this property cannot be accessed before +`ApplicationExt::register` has been called. See +`ApplicationExt::get_is_registered`. + +# Returns + +`true` if `self` is remote + +Gets the resource base path of `self`. + +See `ApplicationExt::set_resource_base_path` for more information. + +Feature: `v2_42` + + +# Returns + +the base resource path, if one is set + +Increases the use count of `self`. + +Use this function to indicate that the application has a reason to +continue to run. For example, `ApplicationExt::hold` is called by GTK+ +when a toplevel window is on the screen. + +To cancel the hold, call `ApplicationExt::release`. + +Increases the busy count of `self`. + +Use this function to indicate that the application is busy, for instance +while a long running operation is pending. + +The busy state will be exposed to other processes, so a session shell will +use that information to indicate the state to the user (e.g. with a +spinner). + +To cancel the busy indication, use `ApplicationExt::unmark_busy`. + +Feature: `v2_38` + + +Opens the given files. + +In essence, this results in the `Application::open` signal being emitted +in the primary instance. + +`n_files` must be greater than zero. + +`hint` is simply passed through to the ::open signal. It is +intended to be used by applications that have multiple modes for +opening files (eg: "view" vs "edit", etc). Unless you have a need +for this functionality, you should use "". + +The application must be registered before calling this function +and it must have the `ApplicationFlags::HandlesOpen` flag set. +## `files` +an array of `GFiles` to open +## `n_files` +the length of the `files` array +## `hint` +a hint (or ""), but never `None` + +Immediately quits the application. + +Upon return to the mainloop, `ApplicationExt::run` will return, +calling only the 'shutdown' function before doing so. + +The hold count is ignored. + +The result of calling `ApplicationExt::run` again after it returns is +unspecified. + +Attempts registration of the application. + +This is the point at which the application discovers if it is the +primary instance or merely acting as a remote for an already-existing +primary instance. This is implemented by attempting to acquire the +application identifier as a unique bus name on the session bus using +GDBus. + +If there is no application ID or if `ApplicationFlags::NonUnique` was +given, then this process will always become the primary instance. + +Due to the internal architecture of GDBus, method calls can be +dispatched at any time (even if a main loop is not running). For +this reason, you must ensure that any object paths that you wish to +register are registered before calling this function. + +If the application has already been registered then `true` is +returned with no work performed. + +The `Application::startup` signal is emitted if registration succeeds +and `self` is the primary instance (including the non-unique +case). + +In the event of an error (such as `cancellable` being cancelled, or a +failure to connect to the session bus), `false` is returned and `error` +is set appropriately. + +Note: the return value of this function is not an indicator that this +instance is or is not the primary instance of the application. See +`ApplicationExt::get_is_remote` for that. +## `cancellable` +a `Cancellable`, or `None` + +# Returns + +`true` if registration succeeded + +Decrease the use count of `self`. + +When the use count reaches zero, the application will stop running. + +Never call this function except to cancel the effect of a previous +call to `ApplicationExt::hold`. + +Runs the application. + +This function is intended to be run from `main` and its return value +is intended to be returned by `main`. Although you are expected to pass +the `argc`, `argv` parameters from `main` to this function, it is possible +to pass `None` if `argv` is not available or commandline handling is not +required. Note that on Windows, `argc` and `argv` are ignored, and +`g_win32_get_command_line` is called internally (for proper support +of Unicode commandline arguments). + +`Application` will attempt to parse the commandline arguments. You +can add commandline flags to the list of recognised options by way of +`ApplicationExt::add_main_option_entries`. After this, the +`Application::handle-local-options` signal is emitted, from which the +application can inspect the values of its `GOptionEntrys`. + +`Application::handle-local-options` is a good place to handle options +such as `--version`, where an immediate reply from the local process is +desired (instead of communicating with an already-running instance). +A `Application::handle-local-options` handler can stop further processing +by returning a non-negative value, which then becomes the exit status of +the process. + +What happens next depends on the flags: if +`ApplicationFlags::HandlesCommandLine` was specified then the remaining +commandline arguments are sent to the primary instance, where a +`Application::command-line` signal is emitted. Otherwise, the +remaining commandline arguments are assumed to be a list of files. +If there are no files listed, the application is activated via the +`Application::activate` signal. If there are one or more files, and +`ApplicationFlags::HandlesOpen` was specified then the files are opened +via the `Application::open` signal. + +If you are interested in doing more complicated local handling of the +commandline then you should implement your own `Application` subclass +and override `local_command_line`. In this case, you most likely want +to return `true` from your `local_command_line` implementation to +suppress the default handling. See +[gapplication-example-cmdline2.c][gapplication-example-cmdline2] +for an example. + +If, after the above is done, the use count of the application is zero +then the exit status is returned immediately. If the use count is +non-zero then the default main context is iterated until the use count +falls to zero, at which point 0 is returned. + +If the `ApplicationFlags::IsService` flag is set, then the service will +run for as much as 10 seconds with a use count of zero while waiting +for the message that caused the activation to arrive. After that, +if the use count falls to zero the application will exit immediately, +except in the case that `ApplicationExt::set_inactivity_timeout` is in +use. + +This function sets the prgname (`g_set_prgname`), if not already set, +to the basename of argv[0]. + +Much like `glib::MainLoop::run`, this function will acquire the main context +for the duration that the application is running. + +Since 2.40, applications that are not explicitly flagged as services +or launchers (ie: neither `ApplicationFlags::IsService` or +`ApplicationFlags::IsLauncher` are given as flags) will check (from the +default handler for local_command_line) if "--gapplication-service" +was given in the command line. If this flag is present then normal +commandline processing is interrupted and the +`ApplicationFlags::IsService` flag is set. This provides a "compromise" +solution whereby running an application directly from the commandline +will invoke it in the normal way (which can be useful for debugging) +while still allowing applications to be D-Bus activated in service +mode. The D-Bus service file should invoke the executable with +"--gapplication-service" as the sole commandline argument. This +approach is suitable for use by most graphical applications but +should not be used from applications like editors that need precise +control over when processes invoked via the commandline will exit and +what their exit status will be. +## `argc` +the argc from `main` (or 0 if `argv` is `None`) +## `argv` +the argv from `main`, or `None` + +# Returns + +the exit status + +Sends a notification on behalf of `self` to the desktop shell. +There is no guarantee that the notification is displayed immediately, +or even at all. + +Notifications may persist after the application exits. It will be +D-Bus-activated when the notification or one of its actions is +activated. + +Modifying `notification` after this call has no effect. However, the +object can be reused for a later call to this function. + +`id` may be any string that uniquely identifies the event for the +application. It does not need to be in any special format. For +example, "new-message" might be appropriate for a notification about +new messages. + +If a previous notification was sent with the same `id`, it will be +replaced with `notification` and shown again as if it was a new +notification. This works even for notifications sent from a previous +execution of the application, as long as `id` is the same string. + +`id` may be `None`, but it is impossible to replace or withdraw +notifications without an id. + +If `notification` is no longer relevant, it can be withdrawn with +`ApplicationExt::withdraw_notification`. + +Feature: `v2_40` + +## `id` +id of the notification, or `None` +## `notification` +the `Notification` to send + +This used to be how actions were associated with a `Application`. +Now there is `ActionMap` for that. + +# Deprecated since 2.32 + +Use the `ActionMap` interface instead. Never ever +mix use of this API with use of `ActionMap` on the same `self` +or things will go very badly wrong. This function is known to +introduce buggy behaviour (ie: signals not emitted on changes to the +action group), so you should really use `ActionMap` instead. +## `action_group` +a `ActionGroup`, or `None` + +Sets the unique identifier for `self`. + +The application id can only be modified if `self` has not yet +been registered. + +If non-`None`, the application id must be valid. See +`Application::id_is_valid`. +## `application_id` +the identifier for `self` + +Sets or unsets the default application for the process, as returned +by `Application::get_default`. + +This function does not take its own reference on `self`. If +`self` is destroyed then the default application will revert +back to `None`. + +Sets the flags for `self`. + +The flags can only be modified if `self` has not yet been +registered. + +See `ApplicationFlags`. +## `flags` +the flags for `self` + +Sets the current inactivity timeout for the application. + +This is the amount of time (in milliseconds) after the last call to +`ApplicationExt::release` before the application stops running. + +This call has no side effects of its own. The value set here is only +used for next time `ApplicationExt::release` drops the use count to +zero. Any timeouts currently in progress are not impacted. +## `inactivity_timeout` +the timeout, in milliseconds + +Sets (or unsets) the base resource path of `self`. + +The path is used to automatically load various [application +resources][gresource] such as menu layouts and action descriptions. +The various types of resources will be found at fixed names relative +to the given base path. + +By default, the resource base path is determined from the application +ID by prefixing '/' and replacing each '.' with '/'. This is done at +the time that the `Application` object is constructed. Changes to +the application ID after that point will not have an impact on the +resource base path. + +As an example, if the application has an ID of "org.example.app" then +the default resource base path will be "/org/example/app". If this +is a ``GtkApplication`` (and you have not manually changed the path) +then Gtk will then search for the menus of the application at +"/org/example/app/gtk/menus.ui". + +See `Resource` for more information about adding resources to your +application. + +You can disable automatic resource loading functionality by setting +the path to `None`. + +Changing the resource base path once the application is running is +not recommended. The point at which the resource path is consulted +for forming paths for various purposes is unspecified. When writing +a sub-class of `Application` you should either set the +`Application:resource-base-path` property at construction time, or call +this function during the instance initialization. Alternatively, you +can call this function in the `ApplicationClass.startup` virtual function, +before chaining up to the parent implementation. + +Feature: `v2_42` + +## `resource_path` +the resource path to use + +Destroys a binding between `property` and the busy state of +`self` that was previously created with +`ApplicationExt::bind_busy_property`. + +Feature: `v2_44` + +## `object` +a `gobject::Object` +## `property` +the name of a boolean property of `object` + +Decreases the busy count of `self`. + +When the busy count reaches zero, the new state will be propagated +to other processes. + +This function must only be called to cancel the effect of a previous +call to `ApplicationExt::mark_busy`. + +Feature: `v2_38` + + +Withdraws a notification that was sent with +`ApplicationExt::send_notification`. + +This call does nothing if a notification with `id` doesn't exist or +the notification was never sent. + +This function works even for notifications sent in previous +executions of this application, as long `id` is the same as it was for +the sent notification. + +Note that notifications are dismissed when the user clicks on one +of the buttons in a notification or triggers its default action, so +there is no need to explicitly withdraw the notification in that case. + +Feature: `v2_40` + +## `id` +id of a previously sent notification + +GCancellable is a thread-safe operation cancellation stack used +throughout GIO to allow for cancellation of synchronous and +asynchronous operations. + +# Implements + +[`CancellableExt`](trait.CancellableExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `Cancellable` methods. + +# Implementors + +[`Cancellable`](struct.Cancellable.html) + +Creates a new `Cancellable` object. + +Applications that want to start one or more operations +that should be cancellable should create a `Cancellable` +and pass it to the operations. + +One `Cancellable` can be used in multiple consecutive +operations or in multiple concurrent operations. + +# Returns + +a `Cancellable`. + +Gets the top cancellable from the stack. + +# Returns + +a `Cancellable` from the top +of the stack, or `None` if the stack is empty. + +Will set `self` to cancelled, and will emit the +`Cancellable::cancelled` signal. (However, see the warning about +race conditions in the documentation for that signal if you are +planning to connect to it.) + +This function is thread-safe. In other words, you can safely call +it from a thread other than the one running the operation that was +passed the `self`. + +If `self` is `None`, this function returns immediately for convenience. + +The convention within GIO is that cancelling an asynchronous +operation causes it to complete asynchronously. That is, if you +cancel the operation from the same thread in which it is running, +then the operation's `GAsyncReadyCallback` will not be invoked until +the application returns to the main loop. + +Convenience function to connect to the `Cancellable::cancelled` +signal. Also handles the race condition that may happen +if the cancellable is cancelled right before connecting. + +`callback` is called at most once, either directly at the +time of the connect if `self` is already cancelled, +or when `self` is cancelled in some thread. + +`data_destroy_func` will be called when the handler is +disconnected, or immediately if the cancellable is already +cancelled. + +See `Cancellable::cancelled` for details on how to use this. + +Since GLib 2.40, the lock protecting `self` is not held when +`callback` is invoked. This lifts a restriction in place for +earlier GLib versions which now makes it easier to write cleanup +code that unconditionally invokes e.g. `CancellableExt::cancel`. +## `callback` +The `GCallback` to connect. +## `data` +Data to pass to `callback`. +## `data_destroy_func` +Free function for `data` or `None`. + +# Returns + +The id of the signal handler or 0 if `self` has already + been cancelled. + +Disconnects a handler from a cancellable instance similar to +`g_signal_handler_disconnect`. Additionally, in the event that a +signal handler is currently running, this call will block until the +handler has finished. Calling this function from a +`Cancellable::cancelled` signal handler will therefore result in a +deadlock. + +This avoids a race condition where a thread cancels at the +same time as the cancellable operation is finished and the +signal handler is removed. See `Cancellable::cancelled` for +details on how to use this. + +If `self` is `None` or `handler_id` is `0` this function does +nothing. +## `handler_id` +Handler id of the handler to be disconnected, or `0`. + +Gets the file descriptor for a cancellable job. This can be used to +implement cancellable operations on Unix systems. The returned fd will +turn readable when `self` is cancelled. + +You are not supposed to read from the fd yourself, just check for +readable status. Reading to unset the readable status is done +with `CancellableExt::reset`. + +After a successful return from this function, you should use +`CancellableExt::release_fd` to free up resources allocated for +the returned file descriptor. + +See also `CancellableExt::make_pollfd`. + +# Returns + +A valid file descriptor. %-1 if the file descriptor +is not supported, or on errors. + +Checks if a cancellable job has been cancelled. + +# Returns + +`true` if `self` is cancelled, +FALSE if called with `None` or if item is not cancelled. + +Creates a `glib::PollFD` corresponding to `self`; this can be passed +to `g_poll` and used to poll for cancellation. This is useful both +for unix systems without a native poll and for portability to +windows. + +When this function returns `true`, you should use +`CancellableExt::release_fd` to free up resources allocated for the +`pollfd`. After a `false` return, do not call `CancellableExt::release_fd`. + +If this function returns `false`, either no `self` was given or +resource limits prevent this function from allocating the necessary +structures for polling. (On Linux, you will likely have reached +the maximum number of file descriptors.) The suggested way to handle +these cases is to ignore the `self`. + +You are not supposed to read from the fd yourself, just check for +readable status. Reading to unset the readable status is done +with `CancellableExt::reset`. +## `pollfd` +a pointer to a `glib::PollFD` + +# Returns + +`true` if `pollfd` was successfully initialized, `false` on + failure to prepare the cancellable. + +Pops `self` off the cancellable stack (verifying that `self` +is on the top of the stack). + +Pushes `self` onto the cancellable stack. The current +cancellable can then be received using `Cancellable::get_current`. + +This is useful when implementing cancellable operations in +code that does not allow you to pass down the cancellable object. + +This is typically called automatically by e.g. `File` operations, +so you rarely have to call this yourself. + +Releases a resources previously allocated by `CancellableExt::get_fd` +or `CancellableExt::make_pollfd`. + +For compatibility reasons with older releases, calling this function +is not strictly required, the resources will be automatically freed +when the `self` is finalized. However, the `self` will +block scarce file descriptors until it is finalized if this function +is not called. This can cause the application to run out of file +descriptors when many `GCancellables` are used at the same time. + +Resets `self` to its uncancelled state. + +If cancellable is currently in use by any cancellable operation +then the behavior of this function is undefined. + +Note that it is generally not a good idea to reuse an existing +cancellable for more operations after it has been cancelled once, +as this function might tempt you to do. The recommended practice +is to drop the reference to a cancellable after cancelling it, +and let it die with the outstanding async operations. You should +create a fresh cancellable for further async operations. + +If the `self` is cancelled, sets the error to notify +that the operation was cancelled. + +# Returns + +`true` if `self` was cancelled, `false` if it was not + +Creates a source that triggers if `self` is cancelled and +calls its callback of type `GCancellableSourceFunc`. This is +primarily useful for attaching to another (non-cancellable) source +with `glib::Source::add_child_source` to add cancellability to it. + +For convenience, you can call this with a `None` `Cancellable`, +in which case the source will never trigger. + +The new `glib::Source` will hold a reference to the `Cancellable`. + +# Returns + +the new `glib::Source`. + +`File` is a high level abstraction for manipulating files on a +virtual file system. `GFiles` are lightweight, immutable objects +that do no I/O upon creation. It is necessary to understand that +`File` objects do not represent files, merely an identifier for a +file. All file content I/O is implemented as streaming operations +(see `InputStream` and `OutputStream`). + +To construct a `File`, you can use: +- `File::new_for_path` if you have a path. +- `File::new_for_uri` if you have a URI. +- `File::new_for_commandline_arg` for a command line argument. +- `File::new_tmp` to create a temporary file from a template. +- `File::parse_name` from a UTF-8 string gotten from `File::get_parse_name`. + +One way to think of a `File` is as an abstraction of a pathname. For +normal files the system pathname is what is stored internally, but as +`GFiles` are extensible it could also be something else that corresponds +to a pathname in a userspace implementation of a filesystem. + +`GFiles` make up hierarchies of directories and files that correspond to +the files on a filesystem. You can move through the file system with +`File` using `File::get_parent` to get an identifier for the parent +directory, `File::get_child` to get a child within a directory, +`File::resolve_relative_path` to resolve a relative path between two +`GFiles`. There can be multiple hierarchies, so you may not end up at +the same root if you repeatedly call `File::get_parent` on two different +files. + +All `GFiles` have a basename (get with `File::get_basename`). These names +are byte strings that are used to identify the file on the filesystem +(relative to its parent directory) and there is no guarantees that they +have any particular charset encoding or even make any sense at all. If +you want to use filenames in a user interface you should use the display +name that you can get by requesting the +`G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME` attribute with `File::query_info`. +This is guaranteed to be in UTF-8 and can be used in a user interface. +But always store the real basename or the `File` to use to actually +access the file, because there is no way to go from a display name to +the actual name. + +Using `File` as an identifier has the same weaknesses as using a path +in that there may be multiple aliases for the same file. For instance, +hard or soft links may cause two different `GFiles` to refer to the same +file. Other possible causes for aliases are: case insensitive filesystems, +short and long names on FAT/NTFS, or bind mounts in Linux. If you want to +check if two `GFiles` point to the same file you can query for the +`G_FILE_ATTRIBUTE_ID_FILE` attribute. Note that `File` does some trivial +canonicalization of pathnames passed in, so that trivial differences in +the path string used at creation (duplicated slashes, slash at end of +path, "." or ".." path segments, etc) does not create different `GFiles`. + +Many `File` operations have both synchronous and asynchronous versions +to suit your application. Asynchronous versions of synchronous functions +simply have `_async` appended to their function names. The asynchronous +I/O functions call a `GAsyncReadyCallback` which is then used to finalize +the operation, producing a GAsyncResult which is then passed to the +function's matching `_finish` operation. + +It is highly recommended to use asynchronous calls when running within a +shared main loop, such as in the main thread of an application. This avoids +I/O operations blocking other sources on the main loop from being dispatched. +Synchronous I/O operations should be performed from worker threads. See the +[introduction to asynchronous programming section][async-programming] for +more. + +Some `File` operations almost always take a noticeable amount of time, and +so do not have synchronous analogs. Notable cases include: +- `File::mount_mountable` to mount a mountable file. +- `File::unmount_mountable_with_operation` to unmount a mountable file. +- `File::eject_mountable_with_operation` to eject a mountable file. + +## Entity Tags # {`gfile`-etag} + +One notable feature of `GFiles` are entity tags, or "etags" for +short. Entity tags are somewhat like a more abstract version of the +traditional mtime, and can be used to quickly determine if the file +has been modified from the version on the file system. See the +HTTP 1.1 +[specification](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) +for HTTP Etag headers, which are a very similar concept. + +# Implements + +[`FileExt`](trait.FileExt.html) + +Trait containing all `File` methods. + +# Implementors + +[`File`](struct.File.html) + +Creates a `File` with the given argument from the command line. +The value of `arg` can be either a URI, an absolute path or a +relative path resolved relative to the current working directory. +This operation never fails, but the returned object might not +support any I/O operation if `arg` points to a malformed path. + +Note that on Windows, this function expects its argument to be in +UTF-8 -- not the system code page. This means that you +should not use this function with string from argv as it is passed +to `main`. `g_win32_get_command_line` will return a UTF-8 version of +the commandline. `Application` also uses UTF-8 but +`ApplicationCommandLine::create_file_for_arg` may be more useful +for you there. It is also always possible to use this function with +`glib::OptionContext` arguments of type `glib::OptionArg::Filename`. +## `arg` +a command line string + +# Returns + +a new `File`. + Free the returned object with `gobject::ObjectExt::unref`. + +Creates a `File` with the given argument from the command line. + +This function is similar to `File::new_for_commandline_arg` except +that it allows for passing the current working directory as an +argument instead of using the current working directory of the +process. + +This is useful if the commandline argument was given in a context +other than the invocation of the current process. + +See also `ApplicationCommandLine::create_file_for_arg`. + +Feature: `v2_36` + +## `arg` +a command line string +## `cwd` +the current working directory of the commandline + +# Returns + +a new `File` + +Constructs a `File` for a given path. This operation never +fails, but the returned object might not support any I/O +operation if `path` is malformed. +## `path` +a string containing a relative or absolute path. + The string must be encoded in the glib filename encoding. + +# Returns + +a new `File` for the given `path`. + Free the returned object with `gobject::ObjectExt::unref`. + +Constructs a `File` for a given URI. This operation never +fails, but the returned object might not support any I/O +operation if `uri` is malformed or if the uri type is +not supported. +## `uri` +a UTF-8 string containing a URI + +# Returns + +a new `File` for the given `uri`. + Free the returned object with `gobject::ObjectExt::unref`. + +Opens a file in the preferred directory for temporary files (as +returned by `g_get_tmp_dir`) and returns a `File` and +`FileIOStream` pointing to it. + +`tmpl` should be a string in the GLib file name encoding +containing a sequence of six 'X' characters, and containing no +directory components. If it is `None`, a default template is used. + +Unlike the other `File` constructors, this will return `None` if +a temporary file could not be created. +## `tmpl` +Template for the file + name, as in `g_file_open_tmp`, or `None` for a default template +## `iostream` +on return, a `FileIOStream` for the created file + +# Returns + +a new `File`. + Free the returned object with `gobject::ObjectExt::unref`. + +Constructs a `File` with the given `parse_name` (i.e. something +given by `File::get_parse_name`). This operation never fails, +but the returned object might not support any I/O operation if +the `parse_name` cannot be parsed. +## `parse_name` +a file name or path to be parsed + +# Returns + +a new `File`. + +Gets an output stream for appending data to the file. +If the file doesn't already exist it is created. + +By default files created are generally readable by everyone, +but if you pass `FileCreateFlags::Private` in `flags` the file +will be made readable only to the current user, to the level that +is supported on the target filesystem. + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +Some file systems don't allow all file names, and may return an +`IOErrorEnum::InvalidFilename` error. If the file is a directory the +`IOErrorEnum::IsDirectory` error will be returned. Other errors are +possible too, and depend on what kind of filesystem the file is on. +## `flags` +a set of `FileCreateFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileOutputStream`, or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously opens `self` for appending. + +For more details, see `File::append_to` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::append_to_finish` to get the result +of the operation. +## `flags` +a set of `FileCreateFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file append operation started with +`File::append_to_async`. +## `res` +`AsyncResult` + +# Returns + +a valid `FileOutputStream` + or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Copies the file `self` to the location specified by `destination`. +Can not handle recursive copies of directories. + +If the flag `FileCopyFlags::Overwrite` is specified an already +existing `destination` file is overwritten. + +If the flag `FileCopyFlags::NofollowSymlinks` is specified then symlinks +will be copied as symlinks, otherwise the target of the +`self` symlink will be copied. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +If `progress_callback` is not `None`, then the operation can be monitored +by setting this to a `GFileProgressCallback` function. +`progress_callback_data` will be passed to this function. It is guaranteed +that this callback will be called after all data has been transferred with +the total number of bytes copied during the operation. + +If the `self` file does not exist, then the `IOErrorEnum::NotFound` error +is returned, independent on the status of the `destination`. + +If `FileCopyFlags::Overwrite` is not specified and the target exists, then +the error `IOErrorEnum::Exists` is returned. + +If trying to overwrite a file over a directory, the `IOErrorEnum::IsDirectory` +error is returned. If trying to overwrite a directory with a directory the +`IOErrorEnum::WouldMerge` error is returned. + +If the source is a directory and the target does not exist, or +`FileCopyFlags::Overwrite` is specified and the target is a file, then the +`IOErrorEnum::WouldRecurse` error is returned. + +If you are interested in copying the `File` object itself (not the on-disk +file), see `File::dup`. +## `destination` +destination `File` +## `flags` +set of `FileCopyFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `progress_callback` +function to callback with + progress information, or `None` if progress information is not needed +## `progress_callback_data` +user data to pass to `progress_callback` + +# Returns + +`true` on success, `false` otherwise. + +Copies the file `self` to the location specified by `destination` +asynchronously. For details of the behaviour, see `File::copy`. + +If `progress_callback` is not `None`, then that function that will be called +just like in `File::copy`. The callback will run in the default main context +of the thread calling `File::copy_async` — the same context as `callback` is +run in. + +When the operation is finished, `callback` will be called. You can then call +`File::copy_finish` to get the result of the operation. +## `destination` +destination `File` +## `flags` +set of `FileCopyFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `progress_callback` +function to callback with progress + information, or `None` if progress information is not needed +## `progress_callback_data` +user data to pass to `progress_callback` +## `callback` +a `GAsyncReadyCallback` to call when the request is satisfied +## `user_data` +the data to pass to callback function + +Copies the file attributes from `self` to `destination`. + +Normally only a subset of the file attributes are copied, +those that are copies in a normal file copy operation +(which for instance does not include e.g. owner). However +if `FileCopyFlags::AllMetadata` is specified in `flags`, then +all the metadata that is possible to copy is copied. This +is useful when implementing move by copy + delete source. +## `destination` +a `File` to copy attributes to +## `flags` +a set of `FileCopyFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the attributes were copied successfully, + `false` otherwise. + +Finishes copying the file started with `File::copy_async`. +## `res` +a `AsyncResult` + +# Returns + +a `true` on success, `false` on error. + +Creates a new file and returns an output stream for writing to it. +The file must not already exist. + +By default files created are generally readable by everyone, +but if you pass `FileCreateFlags::Private` in `flags` the file +will be made readable only to the current user, to the level +that is supported on the target filesystem. + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +If a file or directory with this name already exists the +`IOErrorEnum::Exists` error will be returned. Some file systems don't +allow all file names, and may return an `IOErrorEnum::InvalidFilename` +error, and if the name is to long `IOErrorEnum::FilenameTooLong` will +be returned. Other errors are possible too, and depend on what kind +of filesystem the file is on. +## `flags` +a set of `FileCreateFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileOutputStream` for the newly created + file, or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously creates a new file and returns an output stream +for writing to it. The file must not already exist. + +For more details, see `File::create` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::create_finish` to get the result +of the operation. +## `flags` +a set of `FileCreateFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file create operation started with +`File::create_async`. +## `res` +a `AsyncResult` + +# Returns + +a `FileOutputStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Creates a new file and returns a stream for reading and +writing to it. The file must not already exist. + +By default files created are generally readable by everyone, +but if you pass `FileCreateFlags::Private` in `flags` the file +will be made readable only to the current user, to the level +that is supported on the target filesystem. + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +If a file or directory with this name already exists, the +`IOErrorEnum::Exists` error will be returned. Some file systems don't +allow all file names, and may return an `IOErrorEnum::InvalidFilename` +error, and if the name is too long, `IOErrorEnum::FilenameTooLong` +will be returned. Other errors are possible too, and depend on what +kind of filesystem the file is on. + +Note that in many non-local file cases read and write streams are +not supported, so make sure you really need to do read and write +streaming, rather than just opening for reading or writing. +## `flags` +a set of `FileCreateFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileIOStream` for the newly created + file, or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously creates a new file and returns a stream +for reading and writing to it. The file must not already exist. + +For more details, see `File::create_readwrite` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::create_readwrite_finish` to get +the result of the operation. +## `flags` +a set of `FileCreateFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file create operation started with +`File::create_readwrite_async`. +## `res` +a `AsyncResult` + +# Returns + +a `FileIOStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Deletes a file. If the `self` is a directory, it will only be +deleted if it is empty. This has the same semantics as `g_unlink`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the file was deleted. `false` otherwise. + +Asynchronously delete a file. If the `self` is a directory, it will +only be deleted if it is empty. This has the same semantics as +`g_unlink`. + +Feature: `v2_34` + +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes deleting a file started with `File::delete_async`. + +Feature: `v2_34` + +## `result` +a `AsyncResult` + +# Returns + +`true` if the file was deleted. `false` otherwise. + +Duplicates a `File` handle. This operation does not duplicate +the actual file or directory represented by the `File`; see +`File::copy` if attempting to copy a file. + +This call does no blocking I/O. + +# Returns + +a new `File` that is a duplicate + of the given `File`. + +Starts an asynchronous eject on a mountable. +When this operation has completed, `callback` will be called with +`user_user` data, and the operation can be finalized with +`File::eject_mountable_finish`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +# Deprecated since 2.22 + +Use `File::eject_mountable_with_operation` instead. +## `flags` +flags affecting the operation +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes an asynchronous eject operation started by +`File::eject_mountable`. + +# Deprecated since 2.22 + +Use `File::eject_mountable_with_operation_finish` + instead. +## `result` +a `AsyncResult` + +# Returns + +`true` if the `self` was ejected successfully. + `false` otherwise. + +Starts an asynchronous eject on a mountable. +When this operation has completed, `callback` will be called with +`user_user` data, and the operation can be finalized with +`File::eject_mountable_with_operation_finish`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `flags` +flags affecting the operation +## `mount_operation` +a `MountOperation`, + or `None` to avoid user interaction +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes an asynchronous eject operation started by +`File::eject_mountable_with_operation`. +## `result` +a `AsyncResult` + +# Returns + +`true` if the `self` was ejected successfully. + `false` otherwise. + +Gets the requested information about the files in a directory. +The result is a `FileEnumerator` object that will give out +`FileInfo` objects for all the files in the directory. + +The `attributes` value is a string that specifies the file +attributes that should be gathered. It is not an error if +it's not possible to read a particular requested attribute +from a file - it just won't be set. `attributes` should +be a comma-separated list of attributes or attribute wildcards. +The wildcard "*" means all attributes, and a wildcard like +"standard::*" means all attributes in the standard namespace. +An example attribute query be "standard::*,owner::user". +The standard attributes are available as defines, like +`G_FILE_ATTRIBUTE_STANDARD_NAME`. + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +If the file does not exist, the `IOErrorEnum::NotFound` error will +be returned. If the file is not a directory, the `IOErrorEnum::NotDirectory` +error will be returned. Other errors are possible too. +## `attributes` +an attribute query string +## `flags` +a set of `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +A `FileEnumerator` if successful, + `None` on error. Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously gets the requested information about the files +in a directory. The result is a `FileEnumerator` object that will +give out `FileInfo` objects for all the files in the directory. + +For more details, see `File::enumerate_children` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. You can +then call `File::enumerate_children_finish` to get the result of +the operation. +## `attributes` +an attribute query string +## `flags` +a set of `FileQueryInfoFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call when the + request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an async enumerate children operation. +See `File::enumerate_children_async`. +## `res` +a `AsyncResult` + +# Returns + +a `FileEnumerator` or `None` + if an error occurred. + Free the returned object with `gobject::ObjectExt::unref`. + +Checks if the two given `GFiles` refer to the same file. + +Note that two `GFiles` that differ can still refer to the same +file on the filesystem due to various forms of filename +aliasing. + +This call does no blocking I/O. +## `file2` +the second `File` + +# Returns + +`true` if `self` and `file2` are equal. + +Gets a `Mount` for the `File`. + +If the `FileIface` for `self` does not have a mount (e.g. +possibly a remote share), `error` will be set to `IOErrorEnum::NotFound` +and `None` will be returned. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `Mount` where the `self` is located + or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously gets the mount for the file. + +For more details, see `File::find_enclosing_mount` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::find_enclosing_mount_finish` to +get the result of the operation. +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous find mount request. +See `File::find_enclosing_mount_async`. +## `res` +a `AsyncResult` + +# Returns + +`Mount` for given `self` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Gets the base name (the last component of the path) for a given `File`. + +If called for the top level of a system (such as the filesystem root +or a uri like sftp://host/) it will return a single directory separator +(and on Windows, possibly a drive letter). + +The base name is a byte string (not UTF-8). It has no defined encoding +or rules other than it may not contain zero bytes. If you want to use +filenames in a user interface you should use the display name that you +can get by requesting the `G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME` +attribute with `File::query_info`. + +This call does no blocking I/O. + +# Returns + +string containing the `File`'s + base name, or `None` if given `File` is invalid. The returned string + should be freed with `g_free` when no longer needed. + +Gets a child of `self` with basename equal to `name`. + +Note that the file with that specific name might not exist, but +you can still have a `File` that points to it. You can use this +for instance to create that file. + +This call does no blocking I/O. +## `name` +string containing the child's basename + +# Returns + +a `File` to a child specified by `name`. + Free the returned object with `gobject::ObjectExt::unref`. + +Gets the child of `self` for a given `display_name` (i.e. a UTF-8 +version of the name). If this function fails, it returns `None` +and `error` will be set. This is very useful when constructing a +`File` for a new file and the user entered the filename in the +user interface, for instance when you select a directory and +type a filename in the file selector. + +This call does no blocking I/O. +## `display_name` +string to a possible child + +# Returns + +a `File` to the specified child, or + `None` if the display name couldn't be converted. + Free the returned object with `gobject::ObjectExt::unref`. + +Gets the parent directory for the `self`. +If the `self` represents the root directory of the +file system, then `None` will be returned. + +This call does no blocking I/O. + +# Returns + +a `File` structure to the + parent of the given `File` or `None` if there is no parent. Free + the returned object with `gobject::ObjectExt::unref`. + +Gets the parse name of the `self`. +A parse name is a UTF-8 string that describes the +file such that one can get the `File` back using +`File::parse_name`. + +This is generally used to show the `File` as a nice +full-pathname kind of string in a user interface, +like in a location entry. + +For local files with names that can safely be converted +to UTF-8 the pathname is used, otherwise the IRI is used +(a form of URI that allows UTF-8 characters unescaped). + +This call does no blocking I/O. + +# Returns + +a string containing the `File`'s parse name. + The returned string should be freed with `g_free` + when no longer needed. + +Gets the local pathname for `File`, if one exists. If non-`None`, this is +guaranteed to be an absolute, canonical path. It might contain symlinks. + +This call does no blocking I/O. + +# Returns + +string containing the `File`'s path, + or `None` if no such path exists. The returned string should be freed + with `g_free` when no longer needed. + +Gets the path for `descendant` relative to `self`. + +This call does no blocking I/O. +## `descendant` +input `File` + +# Returns + +string with the relative path from + `descendant` to `self`, or `None` if `descendant` doesn't have `self` as + prefix. The returned string should be freed with `g_free` when + no longer needed. + +Gets the URI for the `self`. + +This call does no blocking I/O. + +# Returns + +a string containing the `File`'s URI. + The returned string should be freed with `g_free` + when no longer needed. + +Gets the URI scheme for a `File`. +RFC 3986 decodes the scheme as: + +```text +URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] +``` +Common schemes include "file", "http", "ftp", etc. + +This call does no blocking I/O. + +# Returns + +a string containing the URI scheme for the given + `File`. The returned string should be freed with `g_free` + when no longer needed. + +Checks if `self` has a parent, and optionally, if it is `parent`. + +If `parent` is `None` then this function returns `true` if `self` has any +parent at all. If `parent` is non-`None` then `true` is only returned +if `self` is an immediate child of `parent`. +## `parent` +the parent to check for, or `None` + +# Returns + +`true` if `self` is an immediate child of `parent` (or any parent in + the case that `parent` is `None`). + +Checks whether `self` has the prefix specified by `prefix`. + +In other words, if the names of initial elements of `self`'s +pathname match `prefix`. Only full pathname elements are matched, +so a path like /foo is not considered a prefix of /foobar, only +of /foo/bar. + +A `File` is not a prefix of itself. If you want to check for +equality, use `File::equal`. + +This call does no I/O, as it works purely on names. As such it can +sometimes return `false` even if `self` is inside a `prefix` (from a +filesystem point of view), because the prefix of `self` is an alias +of `prefix`. +## `prefix` +input `File` + +# Returns + +`true` if the `files`'s parent, grandparent, etc is `prefix`, + `false` otherwise. + +Checks to see if a `File` has a given URI scheme. + +This call does no blocking I/O. +## `uri_scheme` +a string containing a URI scheme + +# Returns + +`true` if `File`'s backend supports the + given URI scheme, `false` if URI scheme is `None`, + not supported, or `File` is invalid. + +Creates a hash value for a `File`. + +This call does no blocking I/O. + +# Returns + +0 if `self` is not a valid `File`, otherwise an + integer that can be used as hash value for the `File`. + This function is intended for easily hashing a `File` to + add to a `glib::HashTable` or similar data structure. + +Checks to see if a file is native to the platform. + +A native file s one expressed in the platform-native filename format, +e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, +as it might be on a locally mounted remote filesystem. + +On some systems non-native files may be available using the native +filesystem via a userspace filesystem (FUSE), in these cases this call +will return `false`, but `File::get_path` will still return a native path. + +This call does no blocking I/O. + +# Returns + +`true` if `self` is native + +Loads the content of the file into memory. The data is always +zero-terminated, but this is not included in the resultant `length`. +The returned `content` should be freed with `g_free` when no longer +needed. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, `None` to ignore +## `contents` +a location to place the contents of the file +## `length` +a location to place the length of the contents of the file, + or `None` if the length is not needed +## `etag_out` +a location to place the current entity tag for the file, + or `None` if the entity tag is not needed + +# Returns + +`true` if the `self`'s contents were successfully loaded. + `false` if there were errors. + +Starts an asynchronous load of the `self`'s contents. + +For more details, see `File::load_contents` which is +the synchronous version of this call. + +When the load operation has completed, `callback` will be called +with `user` data. To finish the operation, call +`File::load_contents_finish` with the `AsyncResult` returned by +the `callback`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous load of the `self`'s contents. +The contents are placed in `contents`, and `length` is set to the +size of the `contents` string. The `content` should be freed with +`g_free` when no longer needed. If `etag_out` is present, it will be +set to the new entity tag for the `self`. +## `res` +a `AsyncResult` +## `contents` +a location to place the contents of the file +## `length` +a location to place the length of the contents of the file, + or `None` if the length is not needed +## `etag_out` +a location to place the current entity tag for the file, + or `None` if the entity tag is not needed + +# Returns + +`true` if the load was successful. If `false` and `error` is + present, it will be set appropriately. + +Reads the partial contents of a file. A `GFileReadMoreCallback` should +be used to stop reading from the file when appropriate, else this +function will behave exactly as `File::load_contents_async`. This +operation can be finished by `File::load_partial_contents_finish`. + +Users of this function should be aware that `user_data` is passed to +both the `read_more_callback` and the `callback`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, `None` to ignore +## `read_more_callback` +a `GFileReadMoreCallback` to receive partial data + and to specify whether further data should be read +## `callback` +a `GAsyncReadyCallback` to call when the request is satisfied +## `user_data` +the data to pass to the callback functions + +Finishes an asynchronous partial load operation that was started +with `File::load_partial_contents_async`. The data is always +zero-terminated, but this is not included in the resultant `length`. +The returned `content` should be freed with `g_free` when no longer +needed. +## `res` +a `AsyncResult` +## `contents` +a location to place the contents of the file +## `length` +a location to place the length of the contents of the file, + or `None` if the length is not needed +## `etag_out` +a location to place the current entity tag for the file, + or `None` if the entity tag is not needed + +# Returns + +`true` if the load was successful. If `false` and `error` is + present, it will be set appropriately. + +Creates a directory. Note that this will only create a child directory +of the immediate parent directory of the path or URI given by the `File`. +To recursively create directories, see `File::make_directory_with_parents`. +This function will fail if the parent directory does not exist, setting +`error` to `IOErrorEnum::NotFound`. If the file system doesn't support +creating directories, this function will fail, setting `error` to +`IOErrorEnum::NotSupported`. + +For a local `File` the newly created directory will have the default +(current) ownership and permissions of the current process. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` on successful creation, `false` otherwise. + +Asynchronously creates a directory. + +Feature: `v2_38` + +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous directory creation, started with +`File::make_directory_async`. + +Feature: `v2_38` + +## `result` +a `AsyncResult` + +# Returns + +`true` on successful directory creation, `false` otherwise. + +Creates a directory and any parent directories that may not +exist similar to 'mkdir -p'. If the file system does not support +creating directories, this function will fail, setting `error` to +`IOErrorEnum::NotSupported`. If the directory itself already exists, +this function will fail setting `error` to `IOErrorEnum::Exists`, unlike +the similar `g_mkdir_with_parents`. + +For a local `File` the newly created directories will have the default +(current) ownership and permissions of the current process. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if all directories have been successfully created, `false` +otherwise. + +Creates a symbolic link named `self` which contains the string +`symlink_value`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `symlink_value` +a string with the path for the target + of the new symlink +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` on the creation of a new symlink, `false` otherwise. + +Recursively measures the disk usage of `self`. + +This is essentially an analog of the 'du' command, but it also +reports the number of directories and non-directory files encountered +(including things like symbolic links). + +By default, errors are only reported against the toplevel file +itself. Errors found while recursing are silently ignored, unless +`G_FILE_DISK_USAGE_REPORT_ALL_ERRORS` is given in `flags`. + +The returned size, `disk_usage`, is in bytes and should be formatted +with `g_format_size` in order to get something reasonable for showing +in a user interface. + +`progress_callback` and `progress_data` can be given to request +periodic progress updates while scanning. See the documentation for +`GFileMeasureProgressCallback` for information about when and how the +callback will be invoked. + +Feature: `v2_38` + +## `flags` +`FileMeasureFlags` +## `cancellable` +optional `Cancellable` +## `progress_callback` +a `GFileMeasureProgressCallback` +## `progress_data` +user_data for `progress_callback` +## `disk_usage` +the number of bytes of disk space used +## `num_dirs` +the number of directories encountered +## `num_files` +the number of non-directories encountered + +# Returns + +`true` if successful, with the out parameters set. + `false` otherwise, with `error` set. + +Recursively measures the disk usage of `self`. + +This is the asynchronous version of `File::measure_disk_usage`. See +there for more information. + +Feature: `v2_38` + +## `flags` +`FileMeasureFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` +## `progress_callback` +a `GFileMeasureProgressCallback` +## `progress_data` +user_data for `progress_callback` +## `callback` +a `GAsyncReadyCallback` to call when complete +## `user_data` +the data to pass to callback function + +Collects the results from an earlier call to +`File::measure_disk_usage_async`. See `File::measure_disk_usage` for +more information. + +Feature: `v2_38` + +## `result` +the `AsyncResult` passed to your `GAsyncReadyCallback` +## `disk_usage` +the number of bytes of disk space used +## `num_dirs` +the number of directories encountered +## `num_files` +the number of non-directories encountered + +# Returns + +`true` if successful, with the out parameters set. + `false` otherwise, with `error` set. + +Obtains a file or directory monitor for the given file, +depending on the type of the file. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `flags` +a set of `FileMonitorFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileMonitor` for the given `self`, + or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Obtains a directory monitor for the given file. +This may fail if directory monitoring is not supported. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +It does not make sense for `flags` to contain +`FileMonitorFlags::WatchHardLinks`, since hard links can not be made to +directories. It is not possible to monitor all the files in a +directory for changes made via hard links; if you want to do this then +you must register individual watches with `File::monitor`. +## `flags` +a set of `FileMonitorFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileMonitor` for the given `self`, + or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Obtains a file monitor for the given file. If no file notification +mechanism exists, then regular polling of the file is used. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +If `flags` contains `FileMonitorFlags::WatchHardLinks` then the monitor +will also attempt to report changes made to the file via another +filename (ie, a hard link). Without this flag, you can only rely on +changes made through the filename contained in `self` to be +reported. Using this flag may result in an increase in resource +usage, and may not have any effect depending on the `FileMonitor` +backend and/or filesystem type. +## `flags` +a set of `FileMonitorFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileMonitor` for the given `self`, + or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Starts a `mount_operation`, mounting the volume that contains +the file `self`. + +When this operation has completed, `callback` will be called with +`user_user` data, and the operation can be finalized with +`File::mount_enclosing_volume_finish`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `flags` +flags affecting the operation +## `mount_operation` +a `MountOperation` + or `None` to avoid user interaction +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes a mount operation started by `File::mount_enclosing_volume`. +## `result` +a `AsyncResult` + +# Returns + +`true` if successful. If an error has occurred, + this function will return `false` and set `error` + appropriately if present. + +Mounts a file of type G_FILE_TYPE_MOUNTABLE. +Using `mount_operation`, you can request callbacks when, for instance, +passwords are needed during authentication. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +When the operation is finished, `callback` will be called. +You can then call `File::mount_mountable_finish` to get +the result of the operation. +## `flags` +flags affecting the operation +## `mount_operation` +a `MountOperation`, + or `None` to avoid user interaction +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes a mount operation. See `File::mount_mountable` for details. + +Finish an asynchronous mount operation that was started +with `File::mount_mountable`. +## `result` +a `AsyncResult` + +# Returns + +a `File` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Tries to move the file or directory `self` to the location specified +by `destination`. If native move operations are supported then this is +used, otherwise a copy + delete fallback is used. The native +implementation may support moving directories (for instance on moves +inside the same filesystem), but the fallback code does not. + +If the flag `FileCopyFlags::Overwrite` is specified an already +existing `destination` file is overwritten. + +If the flag `FileCopyFlags::NofollowSymlinks` is specified then symlinks +will be copied as symlinks, otherwise the target of the +`self` symlink will be copied. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +If `progress_callback` is not `None`, then the operation can be monitored +by setting this to a `GFileProgressCallback` function. +`progress_callback_data` will be passed to this function. It is +guaranteed that this callback will be called after all data has been +transferred with the total number of bytes copied during the operation. + +If the `self` file does not exist, then the `IOErrorEnum::NotFound` +error is returned, independent on the status of the `destination`. + +If `FileCopyFlags::Overwrite` is not specified and the target exists, +then the error `IOErrorEnum::Exists` is returned. + +If trying to overwrite a file over a directory, the `IOErrorEnum::IsDirectory` +error is returned. If trying to overwrite a directory with a directory the +`IOErrorEnum::WouldMerge` error is returned. + +If the source is a directory and the target does not exist, or +`FileCopyFlags::Overwrite` is specified and the target is a file, then +the `IOErrorEnum::WouldRecurse` error may be returned (if the native +move operation isn't available). +## `destination` +`File` pointing to the destination location +## `flags` +set of `FileCopyFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `progress_callback` +`GFileProgressCallback` + function for updates +## `progress_callback_data` +gpointer to user data for + the callback function + +# Returns + +`true` on successful move, `false` otherwise. + +Opens an existing file for reading and writing. The result is +a `FileIOStream` that can be used to read and write the contents +of the file. + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +If the file does not exist, the `IOErrorEnum::NotFound` error will +be returned. If the file is a directory, the `IOErrorEnum::IsDirectory` +error will be returned. Other errors are possible too, and depend on +what kind of filesystem the file is on. Note that in many non-local +file cases read and write streams are not supported, so make sure you +really need to do read and write streaming, rather than just opening +for reading or writing. +## `cancellable` +a `Cancellable` + +# Returns + +`FileIOStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously opens `self` for reading and writing. + +For more details, see `File::open_readwrite` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::open_readwrite_finish` to get +the result of the operation. +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file read operation started with +`File::open_readwrite_async`. +## `res` +a `AsyncResult` + +# Returns + +a `FileIOStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Polls a file of type `FileType::Mountable`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +When the operation is finished, `callback` will be called. +You can then call `File::mount_mountable_finish` to get +the result of the operation. +## `cancellable` +optional `Cancellable` object, `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes a poll operation. See `File::poll_mountable` for details. + +Finish an asynchronous poll operation that was polled +with `File::poll_mountable`. +## `result` +a `AsyncResult` + +# Returns + +`true` if the operation finished successfully. `false` +otherwise. + +Returns the `AppInfo` that is registered as the default +application to handle the file specified by `self`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, `None` to ignore + +# Returns + +a `AppInfo` if the handle was found, + `None` if there were errors. + When you are done with it, release it with `gobject::ObjectExt::unref` + +Utility function to check if a particular file exists. This is +implemented using `File::query_info` and as such does blocking I/O. + +Note that in many cases it is racy to first check for file existence +and then execute something based on the outcome of that, because the +file might have been created or removed in between the operations. The +general approach to handling that is to not check, but just do the +operation and handle the errors as they come. + +As an example of race-free checking, take the case of reading a file, +and if it doesn't exist, creating it. There are two racy versions: read +it, and on error create it; and: check if it exists, if not create it. +These can both result in two processes creating the file (with perhaps +a partially written file as the result). The correct approach is to +always try to create the file with `File::create` which will either +atomically create the file or fail with a `IOErrorEnum::Exists` error. + +However, in many cases an existence check is useful in a user interface, +for instance to make a menu item sensitive/insensitive, so that you don't +have to fool users that something is possible and then just show an error +dialog. If you do this, you should make sure to also handle the errors +that can happen due to races when you execute the operation. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the file exists (and can be detected without error), + `false` otherwise (or if cancelled). + +Utility function to inspect the `FileType` of a file. This is +implemented using `File::query_info` and as such does blocking I/O. + +The primary use case of this method is to check if a file is +a regular file, directory, or symlink. +## `flags` +a set of `FileQueryInfoFlags` passed to `File::query_info` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +The `FileType` of the file and `FileType::Unknown` + if the file does not exist + +Similar to `File::query_info`, but obtains information +about the filesystem the `self` is on, rather than the file itself. +For instance the amount of space available and the type of +the filesystem. + +The `attributes` value is a string that specifies the attributes +that should be gathered. It is not an error if it's not possible +to read a particular requested attribute from a file - it just +won't be set. `attributes` should be a comma-separated list of +attributes or attribute wildcards. The wildcard "*" means all +attributes, and a wildcard like "filesystem::*" means all attributes +in the filesystem namespace. The standard namespace for filesystem +attributes is "filesystem". Common attributes of interest are +`G_FILE_ATTRIBUTE_FILESYSTEM_SIZE` (the total size of the filesystem +in bytes), `G_FILE_ATTRIBUTE_FILESYSTEM_FREE` (number of bytes available), +and `G_FILE_ATTRIBUTE_FILESYSTEM_TYPE` (type of the filesystem). + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +If the file does not exist, the `IOErrorEnum::NotFound` error will +be returned. Other errors are possible too, and depend on what +kind of filesystem the file is on. +## `attributes` +an attribute query string +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileInfo` or `None` if there was an error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously gets the requested information about the filesystem +that the specified `self` is on. The result is a `FileInfo` object +that contains key-value attributes (such as type or size for the +file). + +For more details, see `File::query_filesystem_info` which is the +synchronous version of this call. + +When the operation is finished, `callback` will be called. You can +then call `File::query_info_finish` to get the result of the +operation. +## `attributes` +an attribute query string +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous filesystem info query. +See `File::query_filesystem_info_async`. +## `res` +a `AsyncResult` + +# Returns + +`FileInfo` for given `self` + or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Gets the requested information about specified `self`. +The result is a `FileInfo` object that contains key-value +attributes (such as the type or size of the file). + +The `attributes` value is a string that specifies the file +attributes that should be gathered. It is not an error if +it's not possible to read a particular requested attribute +from a file - it just won't be set. `attributes` should be a +comma-separated list of attributes or attribute wildcards. +The wildcard "*" means all attributes, and a wildcard like +"standard::*" means all attributes in the standard namespace. +An example attribute query be "standard::*,owner::user". +The standard attributes are available as defines, like +`G_FILE_ATTRIBUTE_STANDARD_NAME`. + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +For symlinks, normally the information about the target of the +symlink is returned, rather than information about the symlink +itself. However if you pass `FileQueryInfoFlags::NofollowSymlinks` +in `flags` the information about the symlink itself will be returned. +Also, for symlinks that point to non-existing files the information +about the symlink itself will be returned. + +If the file does not exist, the `IOErrorEnum::NotFound` error will be +returned. Other errors are possible too, and depend on what kind of +filesystem the file is on. +## `attributes` +an attribute query string +## `flags` +a set of `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileInfo` for the given `self`, or `None` + on error. Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously gets the requested information about specified `self`. +The result is a `FileInfo` object that contains key-value attributes +(such as type or size for the file). + +For more details, see `File::query_info` which is the synchronous +version of this call. + +When the operation is finished, `callback` will be called. You can +then call `File::query_info_finish` to get the result of the operation. +## `attributes` +an attribute query string +## `flags` +a set of `FileQueryInfoFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call when the + request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file info query. +See `File::query_info_async`. +## `res` +a `AsyncResult` + +# Returns + +`FileInfo` for given `self` + or `None` on error. Free the returned object with + `gobject::ObjectExt::unref`. + +Obtain the list of settable attributes for the file. + +Returns the type and full attribute name of all the attributes +that can be set on this file. This doesn't mean setting it will +always succeed though, you might get an access failure, or some +specific file may not support a specific attribute. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileAttributeInfoList` describing the settable attributes. + When you are done with it, release it with + `FileAttributeInfoList::unref` + +Obtain the list of attribute namespaces where new attributes +can be created by a user. An example of this is extended +attributes (in the "xattr" namespace). + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileAttributeInfoList` describing the writable namespaces. + When you are done with it, release it with + `FileAttributeInfoList::unref` + +Opens a file for reading. The result is a `FileInputStream` that +can be used to read the contents of the file. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +If the file does not exist, the `IOErrorEnum::NotFound` error will be +returned. If the file is a directory, the `IOErrorEnum::IsDirectory` +error will be returned. Other errors are possible too, and depend +on what kind of filesystem the file is on. +## `cancellable` +a `Cancellable` + +# Returns + +`FileInputStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously opens `self` for reading. + +For more details, see `File::read` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::read_finish` to get the result +of the operation. +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file read operation started with +`File::read_async`. +## `res` +a `AsyncResult` + +# Returns + +a `FileInputStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Returns an output stream for overwriting the file, possibly +creating a backup copy of the file first. If the file doesn't exist, +it will be created. + +This will try to replace the file in the safest way possible so +that any errors during the writing will not affect an already +existing copy of the file. For instance, for local files it +may write to a temporary file and then atomically rename over +the destination when the stream is closed. + +By default files created are generally readable by everyone, +but if you pass `FileCreateFlags::Private` in `flags` the file +will be made readable only to the current user, to the level that +is supported on the target filesystem. + +If `cancellable` is not `None`, then the operation can be cancelled +by triggering the cancellable object from another thread. If the +operation was cancelled, the error `IOErrorEnum::Cancelled` will be +returned. + +If you pass in a non-`None` `etag` value and `self` already exists, then +this value is compared to the current entity tag of the file, and if +they differ an `IOErrorEnum::WrongEtag` error is returned. This +generally means that the file has been changed since you last read +it. You can get the new etag from `FileOutputStream::get_etag` +after you've finished writing and closed the `FileOutputStream`. When +you load a new file you can use `FileInputStream::query_info` to +get the etag of the file. + +If `make_backup` is `true`, this function will attempt to make a +backup of the current file before overwriting it. If this fails +a `IOErrorEnum::CantCreateBackup` error will be returned. If you +want to replace anyway, try again with `make_backup` set to `false`. + +If the file is a directory the `IOErrorEnum::IsDirectory` error will +be returned, and if the file is some other form of non-regular file +then a `IOErrorEnum::NotRegularFile` error will be returned. Some +file systems don't allow all file names, and may return an +`IOErrorEnum::InvalidFilename` error, and if the name is to long +`IOErrorEnum::FilenameTooLong` will be returned. Other errors are +possible too, and depend on what kind of filesystem the file is on. +## `etag` +an optional [entity tag][gfile-etag] + for the current `File`, or `None` to ignore +## `make_backup` +`true` if a backup should be created +## `flags` +a set of `FileCreateFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileOutputStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously overwrites the file, replacing the contents, +possibly creating a backup copy of the file first. + +For more details, see `File::replace` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::replace_finish` to get the result +of the operation. +## `etag` +an [entity tag][gfile-etag] for the current `File`, + or `None` to ignore +## `make_backup` +`true` if a backup should be created +## `flags` +a set of `FileCreateFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Replaces the contents of `self` with `contents` of `length` bytes. + +If `etag` is specified (not `None`), any existing file must have that etag, +or the error `IOErrorEnum::WrongEtag` will be returned. + +If `make_backup` is `true`, this function will attempt to make a backup +of `self`. Internally, it uses `File::replace`, so will try to replace the +file contents in the safest way possible. For example, atomic renames are +used when replacing local files’ contents. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +The returned `new_etag` can be used to verify that the file hasn't +changed the next time it is saved over. +## `contents` +a string containing the new contents for `self` +## `length` +the length of `contents` in bytes +## `etag` +the old [entity-tag][gfile-etag] for the document, + or `None` +## `make_backup` +`true` if a backup should be created +## `flags` +a set of `FileCreateFlags` +## `new_etag` +a location to a new [entity tag][gfile-etag] + for the document. This should be freed with `g_free` when no longer + needed, or `None` +## `cancellable` +optional `Cancellable` object, `None` to ignore + +# Returns + +`true` if successful. If an error has occurred, this function + will return `false` and set `error` appropriately if present. + +Starts an asynchronous replacement of `self` with the given +`contents` of `length` bytes. `etag` will replace the document's +current entity tag. + +When this operation has completed, `callback` will be called with +`user_user` data, and the operation can be finalized with +`File::replace_contents_finish`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +If `make_backup` is `true`, this function will attempt to +make a backup of `self`. + +Note that no copy of `content` will be made, so it must stay valid +until `callback` is called. See `File::replace_contents_bytes_async` +for a `glib::Bytes` version that will automatically hold a reference to the +contents (without copying) for the duration of the call. +## `contents` +string of contents to replace the file with +## `length` +the length of `contents` in bytes +## `etag` +a new [entity tag][gfile-etag] for the `self`, or `None` +## `make_backup` +`true` if a backup should be created +## `flags` +a set of `FileCreateFlags` +## `cancellable` +optional `Cancellable` object, `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call when the request is satisfied +## `user_data` +the data to pass to callback function + +Same as `File::replace_contents_async` but takes a `glib::Bytes` input instead. +This function will keep a ref on `contents` until the operation is done. +Unlike `File::replace_contents_async` this allows forgetting about the +content without waiting for the callback. + +When this operation has completed, `callback` will be called with +`user_user` data, and the operation can be finalized with +`File::replace_contents_finish`. + +Feature: `v2_40` + +## `contents` +a `glib::Bytes` +## `etag` +a new [entity tag][gfile-etag] for the `self`, or `None` +## `make_backup` +`true` if a backup should be created +## `flags` +a set of `FileCreateFlags` +## `cancellable` +optional `Cancellable` object, `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous replace of the given `self`. See +`File::replace_contents_async`. Sets `new_etag` to the new entity +tag for the document, if present. +## `res` +a `AsyncResult` +## `new_etag` +a location of a new [entity tag][gfile-etag] + for the document. This should be freed with `g_free` when it is no + longer needed, or `None` + +# Returns + +`true` on success, `false` on failure. + +Finishes an asynchronous file replace operation started with +`File::replace_async`. +## `res` +a `AsyncResult` + +# Returns + +a `FileOutputStream`, or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Returns an output stream for overwriting the file in readwrite mode, +possibly creating a backup copy of the file first. If the file doesn't +exist, it will be created. + +For details about the behaviour, see `File::replace` which does the +same thing but returns an output stream only. + +Note that in many non-local file cases read and write streams are not +supported, so make sure you really need to do read and write streaming, +rather than just opening for reading or writing. +## `etag` +an optional [entity tag][gfile-etag] + for the current `File`, or `None` to ignore +## `make_backup` +`true` if a backup should be created +## `flags` +a set of `FileCreateFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `FileIOStream` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously overwrites the file in read-write mode, +replacing the contents, possibly creating a backup copy +of the file first. + +For more details, see `File::replace_readwrite` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::replace_readwrite_finish` to get +the result of the operation. +## `etag` +an [entity tag][gfile-etag] for the current `File`, + or `None` to ignore +## `make_backup` +`true` if a backup should be created +## `flags` +a set of `FileCreateFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file replace operation started with +`File::replace_readwrite_async`. +## `res` +a `AsyncResult` + +# Returns + +a `FileIOStream`, or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Resolves a relative path for `self` to an absolute path. + +This call does no blocking I/O. +## `relative_path` +a given relative path string + +# Returns + +`File` to the resolved path. + `None` if `relative_path` is `None` or if `self` is invalid. + Free the returned object with `gobject::ObjectExt::unref`. + +Sets an attribute in the file with attribute name `attribute` to `value`. + +Some attributes can be unset by setting `attribute` to +`FileAttributeType::Invalid` and `value_p` to `None`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `attribute` +a string containing the attribute's name +## `type_` +The type of the attribute +## `value_p` +a pointer to the value (or the pointer + itself if the type is a pointer type) +## `flags` +a set of `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the attribute was set, `false` otherwise. + +Sets `attribute` of type `FileAttributeType::ByteString` to `value`. +If `attribute` is of a different type, this operation will fail, +returning `false`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `attribute` +a string containing the attribute's name +## `value` +a string containing the attribute's new value +## `flags` +a `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the `attribute` was successfully set to `value` + in the `self`, `false` otherwise. + +Sets `attribute` of type `FileAttributeType::Int32` to `value`. +If `attribute` is of a different type, this operation will fail. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `attribute` +a string containing the attribute's name +## `value` +a `gint32` containing the attribute's new value +## `flags` +a `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the `attribute` was successfully set to `value` + in the `self`, `false` otherwise. + +Sets `attribute` of type `FileAttributeType::Int64` to `value`. +If `attribute` is of a different type, this operation will fail. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `attribute` +a string containing the attribute's name +## `value` +a `guint64` containing the attribute's new value +## `flags` +a `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the `attribute` was successfully set, `false` otherwise. + +Sets `attribute` of type `FileAttributeType::String` to `value`. +If `attribute` is of a different type, this operation will fail. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `attribute` +a string containing the attribute's name +## `value` +a string containing the attribute's value +## `flags` +`FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the `attribute` was successfully set, `false` otherwise. + +Sets `attribute` of type `FileAttributeType::Uint32` to `value`. +If `attribute` is of a different type, this operation will fail. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `attribute` +a string containing the attribute's name +## `value` +a `guint32` containing the attribute's new value +## `flags` +a `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the `attribute` was successfully set to `value` + in the `self`, `false` otherwise. + +Sets `attribute` of type `FileAttributeType::Uint64` to `value`. +If `attribute` is of a different type, this operation will fail. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `attribute` +a string containing the attribute's name +## `value` +a `guint64` containing the attribute's new value +## `flags` +a `FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` if the `attribute` was successfully set to `value` + in the `self`, `false` otherwise. + +Asynchronously sets the attributes of `self` with `info`. + +For more details, see `File::set_attributes_from_info`, +which is the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::set_attributes_finish` to get +the result of the operation. +## `info` +a `FileInfo` +## `flags` +a `FileQueryInfoFlags` +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` +## `user_data` +a `gpointer` + +Finishes setting an attribute started in `File::set_attributes_async`. +## `result` +a `AsyncResult` +## `info` +a `FileInfo` + +# Returns + +`true` if the attributes were set correctly, `false` otherwise. + +Tries to set all attributes in the `FileInfo` on the target +values, not stopping on the first error. + +If there is any error during this operation then `error` will +be set to the first error. Error on particular fields are flagged +by setting the "status" field in the attribute value to +`FileAttributeStatus::ErrorSetting`, which means you can +also detect further errors. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `info` +a `FileInfo` +## `flags` +`FileQueryInfoFlags` +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`false` if there was any error, `true` otherwise. + +Renames `self` to the specified display name. + +The display name is converted from UTF-8 to the correct encoding +for the target filesystem if possible and the `self` is renamed to this. + +If you want to implement a rename operation in the user interface the +edit name (`G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME`) should be used as the +initial value in the rename widget, and then the result after editing +should be passed to `File::set_display_name`. + +On success the resulting converted filename is returned. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `display_name` +a string +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +a `File` specifying what `self` was renamed to, + or `None` if there was an error. + Free the returned object with `gobject::ObjectExt::unref`. + +Asynchronously sets the display name for a given `File`. + +For more details, see `File::set_display_name` which is +the synchronous version of this call. + +When the operation is finished, `callback` will be called. +You can then call `File::set_display_name_finish` to get +the result of the operation. +## `display_name` +a string +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes setting a display name started with +`File::set_display_name_async`. +## `res` +a `AsyncResult` + +# Returns + +a `File` or `None` on error. + Free the returned object with `gobject::ObjectExt::unref`. + +Starts a file of type `FileType::Mountable`. +Using `start_operation`, you can request callbacks when, for instance, +passwords are needed during authentication. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +When the operation is finished, `callback` will be called. +You can then call `File::mount_mountable_finish` to get +the result of the operation. +## `flags` +flags affecting the operation +## `start_operation` +a `MountOperation`, or `None` to avoid user interaction +## `cancellable` +optional `Cancellable` object, `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes a start operation. See `File::start_mountable` for details. + +Finish an asynchronous start operation that was started +with `File::start_mountable`. +## `result` +a `AsyncResult` + +# Returns + +`true` if the operation finished successfully. `false` +otherwise. + +Stops a file of type `FileType::Mountable`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +When the operation is finished, `callback` will be called. +You can then call `File::stop_mountable_finish` to get +the result of the operation. +## `flags` +flags affecting the operation +## `mount_operation` +a `MountOperation`, + or `None` to avoid user interaction. +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes an stop operation, see `File::stop_mountable` for details. + +Finish an asynchronous stop operation that was started +with `File::stop_mountable`. +## `result` +a `AsyncResult` + +# Returns + +`true` if the operation finished successfully. + `false` otherwise. + +Checks if `self` supports +[thread-default contexts][g-main-context-push-thread-default-context]. +If this returns `false`, you cannot perform asynchronous operations on +`self` in a thread that has a thread-default context. + +# Returns + +Whether or not `self` supports thread-default contexts. + +Sends `self` to the "Trashcan", if possible. This is similar to +deleting it, but the user can recover it before emptying the trashcan. +Not all file systems support trashing, so this call can return the +`IOErrorEnum::NotSupported` error. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. +## `cancellable` +optional `Cancellable` object, + `None` to ignore + +# Returns + +`true` on successful trash, `false` otherwise. + +Asynchronously sends `self` to the Trash location, if possible. + +Feature: `v2_38` + +## `io_priority` +the [I/O priority][io-priority] of the request +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied +## `user_data` +the data to pass to callback function + +Finishes an asynchronous file trashing operation, started with +`File::trash_async`. + +Feature: `v2_38` + +## `result` +a `AsyncResult` + +# Returns + +`true` on successful trash, `false` otherwise. + +Unmounts a file of type G_FILE_TYPE_MOUNTABLE. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +When the operation is finished, `callback` will be called. +You can then call `File::unmount_mountable_finish` to get +the result of the operation. + +# Deprecated since 2.22 + +Use `File::unmount_mountable_with_operation` instead. +## `flags` +flags affecting the operation +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes an unmount operation, see `File::unmount_mountable` for details. + +Finish an asynchronous unmount operation that was started +with `File::unmount_mountable`. + +# Deprecated since 2.22 + +Use `File::unmount_mountable_with_operation_finish` + instead. +## `result` +a `AsyncResult` + +# Returns + +`true` if the operation finished successfully. + `false` otherwise. + +Unmounts a file of type `FileType::Mountable`. + +If `cancellable` is not `None`, then the operation can be cancelled by +triggering the cancellable object from another thread. If the operation +was cancelled, the error `IOErrorEnum::Cancelled` will be returned. + +When the operation is finished, `callback` will be called. +You can then call `File::unmount_mountable_finish` to get +the result of the operation. +## `flags` +flags affecting the operation +## `mount_operation` +a `MountOperation`, + or `None` to avoid user interaction +## `cancellable` +optional `Cancellable` object, + `None` to ignore +## `callback` +a `GAsyncReadyCallback` to call + when the request is satisfied, or `None` +## `user_data` +the data to pass to callback function + +Finishes an unmount operation, +see `File::unmount_mountable_with_operation` for details. + +Finish an asynchronous unmount operation that was started +with `File::unmount_mountable_with_operation`. +## `result` +a `AsyncResult` + +# Returns + +`true` if the operation finished successfully. + `false` otherwise. + +Functionality for manipulating basic metadata for files. `FileInfo` +implements methods for getting information that all files should +contain, and allows for manipulation of extended attributes. + +See [GFileAttribute][gio-GFileAttribute] for more information on how +GIO handles file attributes. + +To obtain a `FileInfo` for a `File`, use `File::query_info` (or its +async variant). To obtain a `FileInfo` for a file input or output +stream, use `FileInputStream::query_info` or +`FileOutputStream::query_info` (or their async variants). + +To change the actual attributes of a file, you should then set the +attribute in the `FileInfo` and call `File::set_attributes_from_info` +or `File::set_attributes_async` on a GFile. + +However, not all attributes can be changed in the file. For instance, +the actual size of a file cannot be changed via `FileInfoExt::set_size`. +You may call `File::query_settable_attributes` and +`File::query_writable_namespaces` to discover the settable attributes +of a particular file at runtime. + +`FileAttributeMatcher` allows for searching through a `FileInfo` for +attributes. + +# Implements + +[`FileInfoExt`](trait.FileInfoExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `FileInfo` methods. + +# Implementors + +[`FileInfo`](struct.FileInfo.html) + +Creates a new file info structure. + +# Returns + +a `FileInfo`. + +Clears the status information from `self`. + +First clears all of the [GFileAttribute][gio-GFileAttribute] of `dest_info`, +and then copies all of the file attributes from `self` to `dest_info`. +## `dest_info` +destination to copy attributes to. + +Duplicates a file info structure. + +# Returns + +a duplicate `FileInfo` of `self`. + +Gets the value of a attribute, formated as a string. +This escapes things as needed to make the string valid +utf8. +## `attribute` +a file attribute key. + +# Returns + +a UTF-8 string associated with the given `attribute`. + When you're done with the string it must be freed with `g_free`. + +Gets the value of a boolean attribute. If the attribute does not +contain a boolean value, `false` will be returned. +## `attribute` +a file attribute key. + +# Returns + +the boolean value contained within the attribute. + +Gets the value of a byte string attribute. If the attribute does +not contain a byte string, `None` will be returned. +## `attribute` +a file attribute key. + +# Returns + +the contents of the `attribute` value as a byte string, or +`None` otherwise. + +Gets the attribute type, value and status for an attribute key. +## `attribute` +a file attribute key +## `type_` +return location for the attribute type, or `None` +## `value_pp` +return location for the + attribute value, or `None`; the attribute value will not be `None` +## `status` +return location for the attribute status, or `None` + +# Returns + +`true` if `self` has an attribute named `attribute`, + `false` otherwise. + +Gets a signed 32-bit integer contained within the attribute. If the +attribute does not contain a signed 32-bit integer, or is invalid, +0 will be returned. +## `attribute` +a file attribute key. + +# Returns + +a signed 32-bit integer from the attribute. + +Gets a signed 64-bit integer contained within the attribute. If the +attribute does not contain an signed 64-bit integer, or is invalid, +0 will be returned. +## `attribute` +a file attribute key. + +# Returns + +a signed 64-bit integer from the attribute. + +Gets the value of a `gobject::Object` attribute. If the attribute does +not contain a `gobject::Object`, `None` will be returned. +## `attribute` +a file attribute key. + +# Returns + +a `gobject::Object` associated with the given `attribute`, or +`None` otherwise. + +Gets the attribute status for an attribute key. +## `attribute` +a file attribute key + +# Returns + +a `FileAttributeStatus` for the given `attribute`, or + `FileAttributeStatus::Unset` if the key is invalid. + +Gets the value of a string attribute. If the attribute does +not contain a string, `None` will be returned. +## `attribute` +a file attribute key. + +# Returns + +the contents of the `attribute` value as a UTF-8 string, or +`None` otherwise. + +Gets the value of a stringv attribute. If the attribute does +not contain a stringv, `None` will be returned. +## `attribute` +a file attribute key. + +# Returns + +the contents of the `attribute` value as a stringv, or +`None` otherwise. Do not free. These returned strings are UTF-8. + +Gets the attribute type for an attribute key. +## `attribute` +a file attribute key. + +# Returns + +a `FileAttributeType` for the given `attribute`, or +`FileAttributeType::Invalid` if the key is not set. + +Gets an unsigned 32-bit integer contained within the attribute. If the +attribute does not contain an unsigned 32-bit integer, or is invalid, +0 will be returned. +## `attribute` +a file attribute key. + +# Returns + +an unsigned 32-bit integer from the attribute. + +Gets a unsigned 64-bit integer contained within the attribute. If the +attribute does not contain an unsigned 64-bit integer, or is invalid, +0 will be returned. +## `attribute` +a file attribute key. + +# Returns + +a unsigned 64-bit integer from the attribute. + +Gets the file's content type. + +# Returns + +a string containing the file's content type. + +Returns the `glib::DateTime` representing the deletion date of the file, as +available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the +G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, `None` is returned. + +Feature: `v2_36` + + +# Returns + +a `glib::DateTime`, or `None`. + +Gets a display name for a file. + +# Returns + +a string containing the display name. + +Gets the edit name for a file. + +# Returns + +a string containing the edit name. + +Gets the [entity tag][gfile-etag] for a given +`FileInfo`. See `G_FILE_ATTRIBUTE_ETAG_VALUE`. + +# Returns + +a string containing the value of the "etag:value" attribute. + +Gets a file's type (whether it is a regular file, symlink, etc). +This is different from the file's content type, see `FileInfoExt::get_content_type`. + +# Returns + +a `FileType` for the given file. + +Gets the icon for a file. + +# Returns + +`Icon` for the given `self`. + +Checks if a file is a backup file. + +# Returns + +`true` if file is a backup file, `false` otherwise. + +Checks if a file is hidden. + +# Returns + +`true` if the file is a hidden file, `false` otherwise. + +Checks if a file is a symlink. + +# Returns + +`true` if the given `self` is a symlink. + +Gets the modification time of the current `self` and sets it +in `result`. +## `result` +a `glib::TimeVal`. + +Gets the name for a file. + +# Returns + +a string containing the file name. + +Gets the file's size. + +# Returns + +a `goffset` containing the file's size. + +Gets the value of the sort_order attribute from the `FileInfo`. +See `G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER`. + +# Returns + +a `gint32` containing the value of the "standard::sort_order" attribute. + +Gets the symbolic icon for a file. + +Feature: `v2_34` + + +# Returns + +`Icon` for the given `self`. + +Gets the symlink target for a given `FileInfo`. + +# Returns + +a string containing the symlink target. + +Checks if a file info structure has an attribute named `attribute`. +## `attribute` +a file attribute key. + +# Returns + +`true` if `Ginfo` has an attribute named `attribute`, + `false` otherwise. + +Checks if a file info structure has an attribute in the +specified `name_space`. +## `name_space` +a file attribute namespace. + +# Returns + +`true` if `Ginfo` has an attribute in `name_space`, + `false` otherwise. + +Lists the file info structure's attributes. +## `name_space` +a file attribute key's namespace, or `None` to list + all attributes. + +# Returns + +a +null-terminated array of strings of all of the possible attribute +types for the given `name_space`, or `None` on error. + +Removes all cases of `attribute` from `self` if it exists. +## `attribute` +a file attribute key. + +Sets the `attribute` to contain the given value, if possible. To unset the +attribute, use `G_ATTRIBUTE_TYPE_INVALID` for `type_`. +## `attribute` +a file attribute key. +## `type_` +a `FileAttributeType` +## `value_p` +pointer to the value + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +a file attribute key. +## `attr_value` +a boolean value. + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +a file attribute key. +## `attr_value` +a byte string. + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +a file attribute key. +## `attr_value` +a signed 32-bit integer + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +attribute name to set. +## `attr_value` +int64 value to set attribute to. + +Sets `mask` on `self` to match specific attribute types. +## `mask` +a `FileAttributeMatcher`. + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +a file attribute key. +## `attr_value` +a `gobject::Object`. + +Sets the attribute status for an attribute key. This is only +needed by external code that implement `File::set_attributes_from_info` +or similar functions. + +The attribute must exist in `self` for this to work. Otherwise `false` +is returned and `self` is unchanged. +## `attribute` +a file attribute key +## `status` +a `FileAttributeStatus` + +# Returns + +`true` if the status was changed, `false` if the key was not set. + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +a file attribute key. +## `attr_value` +a UTF-8 string. + +Sets the `attribute` to contain the given `attr_value`, +if possible. + +Sinze: 2.22 +## `attribute` +a file attribute key +## `attr_value` +a `None` terminated array of UTF-8 strings. + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +a file attribute key. +## `attr_value` +an unsigned 32-bit integer. + +Sets the `attribute` to contain the given `attr_value`, +if possible. +## `attribute` +a file attribute key. +## `attr_value` +an unsigned 64-bit integer. + +Sets the content type attribute for a given `FileInfo`. +See `G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE`. +## `content_type` +a content type. See [GContentType][gio-GContentType] + +Sets the display name for the current `FileInfo`. +See `G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME`. +## `display_name` +a string containing a display name. + +Sets the edit name for the current file. +See `G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME`. +## `edit_name` +a string containing an edit name. + +Sets the file type in a `FileInfo` to `type_`. +See `G_FILE_ATTRIBUTE_STANDARD_TYPE`. +## `type_` +a `FileType`. + +Sets the icon for a given `FileInfo`. +See `G_FILE_ATTRIBUTE_STANDARD_ICON`. +## `icon` +a `Icon`. + +Sets the "is_hidden" attribute in a `FileInfo` according to `is_hidden`. +See `G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN`. +## `is_hidden` +a `gboolean`. + +Sets the "is_symlink" attribute in a `FileInfo` according to `is_symlink`. +See `G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK`. +## `is_symlink` +a `gboolean`. + +Sets the `G_FILE_ATTRIBUTE_TIME_MODIFIED` attribute in the file +info to the given time value. +## `mtime` +a `glib::TimeVal`. + +Sets the name attribute for the current `FileInfo`. +See `G_FILE_ATTRIBUTE_STANDARD_NAME`. +## `name` +a string containing a name. + +Sets the `G_FILE_ATTRIBUTE_STANDARD_SIZE` attribute in the file info +to the given size. +## `size` +a `goffset` containing the file's size. + +Sets the sort order attribute in the file info structure. See +`G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER`. +## `sort_order` +a sort order integer. + +Sets the symbolic icon for a given `FileInfo`. +See `G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON`. + +Feature: `v2_34` + +## `icon` +a `Icon`. + +Sets the `G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET` attribute in the file info +to the given symlink target. +## `symlink_target` +a static string containing a path to a symlink target. + +Unsets a mask set by `FileInfoExt::set_attribute_mask`, if one +is set. + +Indicates the file's on-disk type. + +File's type is unknown. + +File handle represents a regular file. + +File handle represents a directory. + +File handle represents a symbolic link + (Unix systems). + +File is a "special" file, such as a socket, fifo, + block device, or character device. + +File is a shortcut (Windows systems). + +File is a mountable location. + +`Icon` is a very minimal interface for icons. It provides functions +for checking the equality of two icons, hashing of icons and +serializing an icon to and from strings. + +`Icon` does not provide the actual pixmap for the icon as this is out +of GIO's scope, however implementations of `Icon` may contain the name +of an icon (see `ThemedIcon`), or the path to an icon (see `LoadableIcon`). + +To obtain a hash of a `Icon`, see `Icon::hash`. + +To check if two `GIcons` are equal, see `Icon::equal`. + +For serializing a `Icon`, use `Icon::serialize` and +`Icon::deserialize`. + +If you want to consume `Icon` (for example, in a toolkit) you must +be prepared to handle at least the three following cases: +`LoadableIcon`, `ThemedIcon` and `EmblemedIcon`. It may also make +sense to have fast-paths for other cases (like handling ``GdkPixbuf`` +directly, for example) but all compliant `Icon` implementations +outside of GIO must implement `LoadableIcon`. + +If your application or library provides one or more `Icon` +implementations you need to ensure that your new implementation also +implements `LoadableIcon`. Additionally, you must provide an +implementation of `Icon::serialize` that gives a result that is +understood by `Icon::deserialize`, yielding one of the built-in icon +types. + +# Implements + +[`IconExt`](trait.IconExt.html) + +Trait containing all `Icon` methods. + +# Implementors + +[`Icon`](struct.Icon.html), [`ThemedIcon`](struct.ThemedIcon.html) + +Deserializes a `Icon` previously serialized using `Icon::serialize`. + +Feature: `v2_38` + +## `value` +a `glib::Variant` created with `Icon::serialize` + +# Returns + +a `Icon`, or `None` when deserialization fails. + +Gets a hash for an icon. +## `icon` +`gconstpointer` to an icon object. + +# Returns + +a `guint` containing a hash for the `icon`, suitable for +use in a `glib::HashTable` or similar data structure. + +Generate a `Icon` instance from `str`. This function can fail if +`str` is not valid - see `Icon::to_string` for discussion. + +If your application or library provides one or more `Icon` +implementations you need to ensure that each `glib::Type` is registered +with the type system prior to calling `Icon::new_for_string`. +## `str` +A string obtained via `Icon::to_string`. + +# Returns + +An object implementing the `Icon` + interface or `None` if `error` is set. + +Checks if two icons are equal. +## `icon2` +pointer to the second `Icon`. + +# Returns + +`true` if `self` is equal to `icon2`. `false` otherwise. + +Serializes a `Icon` into a `glib::Variant`. An equivalent `Icon` can be retrieved +back by calling `Icon::deserialize` on the returned value. +As serialization will avoid using raw icon data when possible, it only +makes sense to transfer the `glib::Variant` between processes on the same machine, +(as opposed to over the network), and within the same file system namespace. + +Feature: `v2_38` + + +# Returns + +a `glib::Variant`, or `None` when serialization fails. + +Generates a textual representation of `self` that can be used for +serialization such as when passing `self` to a different process or +saving it to persistent storage. Use `Icon::new_for_string` to +get `self` back from the returned string. + +The encoding of the returned string is proprietary to `Icon` except +in the following two cases + +- If `self` is a `FileIcon`, the returned string is a native path + (such as `/path/to/my icon.png`) without escaping + if the `File` for `self` is a native file. If the file is not + native, the returned string is the result of `File::get_uri` + (such as `sftp://path/to/my%20icon.png`). + +- If `self` is a `ThemedIcon` with exactly one name, the encoding is + simply the name (such as `network-server`). + +# Returns + +An allocated NUL-terminated UTF8 string or +`None` if `self` can't be serialized. Use `g_free` to free. + +`Menu` is a simple implementation of `MenuModel`. +You populate a `Menu` by adding `MenuItem` instances to it. + +There are some convenience functions to allow you to directly +add items (avoiding `MenuItem`) for the common cases. To add +a regular item, use `MenuExt::insert`. To add a section, use +`MenuExt::insert_section`. To add a submenu, use +`MenuExt::insert_submenu`. + +# Implements + +[`MenuExt`](trait.MenuExt.html), [`MenuModelExt`](trait.MenuModelExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `Menu` methods. + +# Implementors + +[`Menu`](struct.Menu.html) + +Creates a new `Menu`. + +The new menu has no items. + +# Returns + +a new `Menu` + +Convenience function for appending a normal menu item to the end of +`self`. Combine `MenuItem::new` and `MenuExt::insert_item` for a more +flexible alternative. +## `label` +the section label, or `None` +## `detailed_action` +the detailed action string, or `None` + +Appends `item` to the end of `self`. + +See `MenuExt::insert_item` for more information. +## `item` +a `MenuItem` to append + +Convenience function for appending a section menu item to the end of +`self`. Combine `MenuItem::new_section` and `MenuExt::insert_item` for a +more flexible alternative. +## `label` +the section label, or `None` +## `section` +a `MenuModel` with the items of the section + +Convenience function for appending a submenu menu item to the end of +`self`. Combine `MenuItem::new_submenu` and `MenuExt::insert_item` for a +more flexible alternative. +## `label` +the section label, or `None` +## `submenu` +a `MenuModel` with the items of the submenu + +Marks `self` as frozen. + +After the menu is frozen, it is an error to attempt to make any +changes to it. In effect this means that the `Menu` API must no +longer be used. + +This function causes `MenuModelExt::is_mutable` to begin returning +`false`, which has some positive performance implications. + +Convenience function for inserting a normal menu item into `self`. +Combine `MenuItem::new` and `MenuExt::insert_item` for a more flexible +alternative. +## `position` +the position at which to insert the item +## `label` +the section label, or `None` +## `detailed_action` +the detailed action string, or `None` + +Inserts `item` into `self`. + +The "insertion" is actually done by copying all of the attribute and +link values of `item` and using them to form a new item within `self`. +As such, `item` itself is not really inserted, but rather, a menu item +that is exactly the same as the one presently described by `item`. + +This means that `item` is essentially useless after the insertion +occurs. Any changes you make to it are ignored unless it is inserted +again (at which point its updated values will be copied). + +You should probably just free `item` once you're done. + +There are many convenience functions to take care of common cases. +See `MenuExt::insert`, `MenuExt::insert_section` and +`MenuExt::insert_submenu` as well as "prepend" and "append" variants of +each of these functions. +## `position` +the position at which to insert the item +## `item` +the `MenuItem` to insert + +Convenience function for inserting a section menu item into `self`. +Combine `MenuItem::new_section` and `MenuExt::insert_item` for a more +flexible alternative. +## `position` +the position at which to insert the item +## `label` +the section label, or `None` +## `section` +a `MenuModel` with the items of the section + +Convenience function for inserting a submenu menu item into `self`. +Combine `MenuItem::new_submenu` and `MenuExt::insert_item` for a more +flexible alternative. +## `position` +the position at which to insert the item +## `label` +the section label, or `None` +## `submenu` +a `MenuModel` with the items of the submenu + +Convenience function for prepending a normal menu item to the start +of `self`. Combine `MenuItem::new` and `MenuExt::insert_item` for a more +flexible alternative. +## `label` +the section label, or `None` +## `detailed_action` +the detailed action string, or `None` + +Prepends `item` to the start of `self`. + +See `MenuExt::insert_item` for more information. +## `item` +a `MenuItem` to prepend + +Convenience function for prepending a section menu item to the start +of `self`. Combine `MenuItem::new_section` and `MenuExt::insert_item` for +a more flexible alternative. +## `label` +the section label, or `None` +## `section` +a `MenuModel` with the items of the section + +Convenience function for prepending a submenu menu item to the start +of `self`. Combine `MenuItem::new_submenu` and `MenuExt::insert_item` for +a more flexible alternative. +## `label` +the section label, or `None` +## `submenu` +a `MenuModel` with the items of the submenu + +Removes an item from the menu. + +`position` gives the index of the item to remove. + +It is an error if position is not in range the range from 0 to one +less than the number of items in the menu. + +It is not possible to remove items by identity since items are added +to the menu simply by copying their links and attributes (ie: +identity of the item itself is not preserved). +## `position` +the position of the item to remove + +Removes all items in the menu. + +Feature: `v2_38` + + +`MenuAttributeIter` is an opaque structure type. You must access it +using the functions below. + +# Implements + +[`MenuAttributeIterExt`](trait.MenuAttributeIterExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `MenuAttributeIter` methods. + +# Implementors + +[`MenuAttributeIter`](struct.MenuAttributeIter.html) + +Gets the name of the attribute at the current iterator position, as +a string. + +The iterator is not advanced. + +# Returns + +the name of the attribute + +This function combines `MenuAttributeIterExt::next` with +`MenuAttributeIterExt::get_name` and `MenuAttributeIterExt::get_value`. + +First the iterator is advanced to the next (possibly first) attribute. +If that fails, then `false` is returned and there are no other +effects. + +If successful, `name` and `value` are set to the name and value of the +attribute that has just been advanced to. At this point, +`MenuAttributeIterExt::get_name` and `MenuAttributeIterExt::get_value` will +return the same values again. + +The value returned in `name` remains valid for as long as the iterator +remains at the current position. The value returned in `value` must +be unreffed using `glib::Variant::unref` when it is no longer in use. +## `out_name` +the type of the attribute +## `value` +the attribute value + +# Returns + +`true` on success, or `false` if there is no additional + attribute + +Gets the value of the attribute at the current iterator position. + +The iterator is not advanced. + +# Returns + +the value of the current attribute + +Attempts to advance the iterator to the next (possibly first) +attribute. + +`true` is returned on success, or `false` if there are no more +attributes. + +You must call this function when you first acquire the iterator +to advance it to the first attribute (and determine if the first +attribute exists at all). + +# Returns + +`true` on success, or `false` when there are no more attributes + +`MenuItem` is an opaque structure type. You must access it using the +functions below. + +# Implements + +[`MenuItemExt`](trait.MenuItemExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `MenuItem` methods. + +# Implementors + +[`MenuItem`](struct.MenuItem.html) + +Creates a new `MenuItem`. + +If `label` is non-`None` it is used to set the "label" attribute of the +new item. + +If `detailed_action` is non-`None` it is used to set the "action" and +possibly the "target" attribute of the new item. See +`MenuItemExt::set_detailed_action` for more information. +## `label` +the section label, or `None` +## `detailed_action` +the detailed action string, or `None` + +# Returns + +a new `MenuItem` + +Creates a `MenuItem` as an exact copy of an existing menu item in a +`MenuModel`. + +`item_index` must be valid (ie: be sure to call +`MenuModelExt::get_n_items` first). + +Feature: `v2_34` + +## `model` +a `MenuModel` +## `item_index` +the index of an item in `model` + +# Returns + +a new `MenuItem`. + +Creates a new `MenuItem` representing a section. + +This is a convenience API around `MenuItem::new` and +`MenuItemExt::set_section`. + +The effect of having one menu appear as a section of another is +exactly as it sounds: the items from `section` become a direct part of +the menu that `menu_item` is added to. + +Visual separation is typically displayed between two non-empty +sections. If `label` is non-`None` then it will be encorporated into +this visual indication. This allows for labeled subsections of a +menu. + +As a simple example, consider a typical "Edit" menu from a simple +program. It probably contains an "Undo" and "Redo" item, followed by +a separator, followed by "Cut", "Copy" and "Paste". + +This would be accomplished by creating three `Menu` instances. The +first would be populated with the "Undo" and "Redo" items, and the +second with the "Cut", "Copy" and "Paste" items. The first and +second menus would then be added as submenus of the third. In XML +format, this would look something like the following: + +```text +
+``` + +The following example is exactly equivalent. It is more illustrative +of the exact relationship between the menus and items (keeping in +mind that the 'link' element defines a new menu that is linked to the +containing one). The style of the second example is more verbose and +difficult to read (and therefore not recommended except for the +purpose of understanding what is really going on). + +```text + +``` +## `label` +the section label, or `None` +## `section` +a `MenuModel` with the items of the section + +# Returns + +a new `MenuItem` + +Creates a new `MenuItem` representing a submenu. + +This is a convenience API around `MenuItem::new` and +`MenuItemExt::set_submenu`. +## `label` +the section label, or `None` +## `submenu` +a `MenuModel` with the items of the submenu + +# Returns + +a new `MenuItem` + +Queries the named `attribute` on `self`. + +If the attribute exists and matches the `glib::VariantType` corresponding +to `format_string` then `format_string` is used to deconstruct the +value into the positional parameters and `true` is returned. + +If the attribute does not exist, or it does exist but has the wrong +type, then the positional parameters are ignored and `false` is +returned. + +Feature: `v2_34` + +## `attribute` +the attribute name to query +## `format_string` +a `glib::Variant` format string + +# Returns + +`true` if the named attribute was found with the expected + type + +Queries the named `attribute` on `self`. + +If `expected_type` is specified and the attribute does not have this +type, `None` is returned. `None` is also returned if the attribute +simply does not exist. + +Feature: `v2_34` + +## `attribute` +the attribute name to query +## `expected_type` +the expected type of the attribute + +# Returns + +the attribute value, or `None` + +Queries the named `link` on `self`. + +Feature: `v2_34` + +## `link` +the link name to query + +# Returns + +the link, or `None` + +Sets or unsets the "action" and "target" attributes of `self`. + +If `action` is `None` then both the "action" and "target" attributes +are unset (and `format_string` is ignored along with the positional +parameters). + +If `action` is non-`None` then the "action" attribute is set. +`format_string` is then inspected. If it is non-`None` then the proper +position parameters are collected to create a `glib::Variant` instance to +use as the target value. If it is `None` then the positional +parameters are ignored and the "target" attribute is unset. + +See also `MenuItemExt::set_action_and_target_value` for an equivalent +call that directly accepts a `glib::Variant`. See +`MenuItemExt::set_detailed_action` for a more convenient version that +works with string-typed targets. + +See also `MenuItemExt::set_action_and_target_value` for a +description of the semantics of the action and target attributes. +## `action` +the name of the action for this item +## `format_string` +a GVariant format string + +Sets or unsets the "action" and "target" attributes of `self`. + +If `action` is `None` then both the "action" and "target" attributes +are unset (and `target_value` is ignored). + +If `action` is non-`None` then the "action" attribute is set. The +"target" attribute is then set to the value of `target_value` if it is +non-`None` or unset otherwise. + +Normal menu items (ie: not submenu, section or other custom item +types) are expected to have the "action" attribute set to identify +the action that they are associated with. The state type of the +action help to determine the disposition of the menu item. See +`Action` and `ActionGroup` for an overview of actions. + +In general, clicking on the menu item will result in activation of +the named action with the "target" attribute given as the parameter +to the action invocation. If the "target" attribute is not set then +the action is invoked with no parameter. + +If the action has no state then the menu item is usually drawn as a +plain menu item (ie: with no additional decoration). + +If the action has a boolean state then the menu item is usually drawn +as a toggle menu item (ie: with a checkmark or equivalent +indication). The item should be marked as 'toggled' or 'checked' +when the boolean state is `true`. + +If the action has a string state then the menu item is usually drawn +as a radio menu item (ie: with a radio bullet or equivalent +indication). The item should be marked as 'selected' when the string +state is equal to the value of the `target` property. + +See `MenuItemExt::set_action_and_target` or +`MenuItemExt::set_detailed_action` for two equivalent calls that are +probably more convenient for most uses. +## `action` +the name of the action for this item +## `target_value` +a `glib::Variant` to use as the action target + +Sets or unsets an attribute on `self`. + +The attribute to set or unset is specified by `attribute`. This +can be one of the standard attribute names `G_MENU_ATTRIBUTE_LABEL`, +`G_MENU_ATTRIBUTE_ACTION`, `G_MENU_ATTRIBUTE_TARGET`, or a custom +attribute name. +Attribute names are restricted to lowercase characters, numbers +and '-'. Furthermore, the names must begin with a lowercase character, +must not end with a '-', and must not contain consecutive dashes. + +If `format_string` is non-`None` then the proper position parameters +are collected to create a `glib::Variant` instance to use as the attribute +value. If it is `None` then the positional parameterrs are ignored +and the named attribute is unset. + +See also `MenuItemExt::set_attribute_value` for an equivalent call +that directly accepts a `glib::Variant`. +## `attribute` +the attribute to set +## `format_string` +a `glib::Variant` format string, or `None` + +Sets or unsets an attribute on `self`. + +The attribute to set or unset is specified by `attribute`. This +can be one of the standard attribute names `G_MENU_ATTRIBUTE_LABEL`, +`G_MENU_ATTRIBUTE_ACTION`, `G_MENU_ATTRIBUTE_TARGET`, or a custom +attribute name. +Attribute names are restricted to lowercase characters, numbers +and '-'. Furthermore, the names must begin with a lowercase character, +must not end with a '-', and must not contain consecutive dashes. + +must consist only of lowercase +ASCII characters, digits and '-'. + +If `value` is non-`None` then it is used as the new value for the +attribute. If `value` is `None` then the attribute is unset. If +the `value` `glib::Variant` is floating, it is consumed. + +See also `MenuItemExt::set_attribute` for a more convenient way to do +the same. +## `attribute` +the attribute to set +## `value` +a `glib::Variant` to use as the value, or `None` + +Sets the "action" and possibly the "target" attribute of `self`. + +The format of `detailed_action` is the same format parsed by +`Action::parse_detailed_name`. + +See `MenuItemExt::set_action_and_target` or +`MenuItemExt::set_action_and_target_value` for more flexible (but +slightly less convenient) alternatives. + +See also `MenuItemExt::set_action_and_target_value` for a description of +the semantics of the action and target attributes. +## `detailed_action` +the "detailed" action string + +Sets (or unsets) the icon on `self`. + +This call is the same as calling `Icon::serialize` and using the +result as the value to `MenuItemExt::set_attribute_value` for +`G_MENU_ATTRIBUTE_ICON`. + +This API is only intended for use with "noun" menu items; things like +bookmarks or applications in an "Open With" menu. Don't use it on +menu items corresponding to verbs (eg: stock icons for 'Save' or +'Quit'). + +If `icon` is `None` then the icon is unset. + +Feature: `v2_38` + +## `icon` +a `Icon`, or `None` + +Sets or unsets the "label" attribute of `self`. + +If `label` is non-`None` it is used as the label for the menu item. If +it is `None` then the label attribute is unset. +## `label` +the label to set, or `None` to unset + +Creates a link from `self` to `model` if non-`None`, or unsets it. + +Links are used to establish a relationship between a particular menu +item and another menu. For example, `G_MENU_LINK_SUBMENU` is used to +associate a submenu with a particular menu item, and `G_MENU_LINK_SECTION` +is used to create a section. Other types of link can be used, but there +is no guarantee that clients will be able to make sense of them. +Link types are restricted to lowercase characters, numbers +and '-'. Furthermore, the names must begin with a lowercase character, +must not end with a '-', and must not contain consecutive dashes. +## `link` +type of link to establish or unset +## `model` +the `MenuModel` to link to (or `None` to unset) + +Sets or unsets the "section" link of `self` to `section`. + +The effect of having one menu appear as a section of another is +exactly as it sounds: the items from `section` become a direct part of +the menu that `self` is added to. See `MenuItem::new_section` +for more information about what it means for a menu item to be a +section. +## `section` +a `MenuModel`, or `None` + +Sets or unsets the "submenu" link of `self` to `submenu`. + +If `submenu` is non-`None`, it is linked to. If it is `None` then the +link is unset. + +The effect of having one menu appear as a submenu of another is +exactly as it sounds. +## `submenu` +a `MenuModel`, or `None` + +`MenuLinkIter` is an opaque structure type. You must access it using +the functions below. + +# Implements + +[`MenuLinkIterExt`](trait.MenuLinkIterExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `MenuLinkIter` methods. + +# Implementors + +[`MenuLinkIter`](struct.MenuLinkIter.html) + +Gets the name of the link at the current iterator position. + +The iterator is not advanced. + +# Returns + +the type of the link + +This function combines `MenuLinkIterExt::next` with +`MenuLinkIterExt::get_name` and `MenuLinkIterExt::get_value`. + +First the iterator is advanced to the next (possibly first) link. +If that fails, then `false` is returned and there are no other effects. + +If successful, `out_link` and `value` are set to the name and `MenuModel` +of the link that has just been advanced to. At this point, +`MenuLinkIterExt::get_name` and `MenuLinkIterExt::get_value` will return the +same values again. + +The value returned in `out_link` remains valid for as long as the iterator +remains at the current position. The value returned in `value` must +be unreffed using `gobject::ObjectExt::unref` when it is no longer in use. +## `out_link` +the name of the link +## `value` +the linked `MenuModel` + +# Returns + +`true` on success, or `false` if there is no additional link + +Gets the linked `MenuModel` at the current iterator position. + +The iterator is not advanced. + +# Returns + +the `MenuModel` that is linked to + +Attempts to advance the iterator to the next (possibly first) +link. + +`true` is returned on success, or `false` if there are no more links. + +You must call this function when you first acquire the iterator to +advance it to the first link (and determine if the first link exists +at all). + +# Returns + +`true` on success, or `false` when there are no more links + +`MenuModel` represents the contents of a menu -- an ordered list of +menu items. The items are associated with actions, which can be +activated through them. Items can be grouped in sections, and may +have submenus associated with them. Both items and sections usually +have some representation data, such as labels or icons. The type of +the associated action (ie whether it is stateful, and what kind of +state it has) can influence the representation of the item. + +The conceptual model of menus in `MenuModel` is hierarchical: +sections and submenus are again represented by `GMenuModels`. +Menus themselves do not define their own roles. Rather, the role +of a particular `MenuModel` is defined by the item that references +it (or, in the case of the 'root' menu, is defined by the context +in which it is used). + +As an example, consider the visible portions of this menu: + +## An example menu # {`menu`-example} + + + +There are 8 "menus" visible in the screenshot: one menubar, two +submenus and 5 sections: + +- the toplevel menubar (containing 4 items) +- the View submenu (containing 3 sections) +- the first section of the View submenu (containing 2 items) +- the second section of the View submenu (containing 1 item) +- the final section of the View submenu (containing 1 item) +- the Highlight Mode submenu (containing 2 sections) +- the Sources section (containing 2 items) +- the Markup section (containing 2 items) + +The [example][menu-model] illustrates the conceptual connection between +these 8 menus. Each large block in the figure represents a menu and the +smaller blocks within the large block represent items in that menu. Some +items contain references to other menus. + +## A menu example # {`menu`-model} + + + +Notice that the separators visible in the [example][menu-example] +appear nowhere in the [menu model][menu-model]. This is because +separators are not explicitly represented in the menu model. Instead, +a separator is inserted between any two non-empty sections of a menu. +Section items can have labels just like any other item. In that case, +a display system may show a section header instead of a separator. + +The motivation for this abstract model of application controls is +that modern user interfaces tend to make these controls available +outside the application. Examples include global menus, jumplists, +dash boards, etc. To support such uses, it is necessary to 'export' +information about actions and their representation in menus, which +is exactly what the [GActionGroup exporter][gio-GActionGroup-exporter] +and the [GMenuModel exporter][gio-GMenuModel-exporter] do for +`ActionGroup` and `MenuModel`. The client-side counterparts to +make use of the exported information are `DBusActionGroup` and +`DBusMenuModel`. + +The API of `MenuModel` is very generic, with iterators for the +attributes and links of an item, see `MenuModelExt::iterate_item_attributes` +and `MenuModelExt::iterate_item_links`. The 'standard' attributes and +link types have predefined names: `G_MENU_ATTRIBUTE_LABEL`, +`G_MENU_ATTRIBUTE_ACTION`, `G_MENU_ATTRIBUTE_TARGET`, `G_MENU_LINK_SECTION` +and `G_MENU_LINK_SUBMENU`. + +Items in a `MenuModel` represent active controls if they refer to +an action that can get activated when the user interacts with the +menu item. The reference to the action is encoded by the string id +in the `G_MENU_ATTRIBUTE_ACTION` attribute. An action id uniquely +identifies an action in an action group. Which action group(s) provide +actions depends on the context in which the menu model is used. +E.g. when the model is exported as the application menu of a +``GtkApplication``, actions can be application-wide or window-specific +(and thus come from two different action groups). By convention, the +application-wide actions have names that start with "app.", while the +names of window-specific actions start with "win.". + +While a wide variety of stateful actions is possible, the following +is the minimum that is expected to be supported by all users of exported +menu information: +- an action with no parameter type and no state +- an action with no parameter type and boolean state +- an action with string parameter type and string state + +## Stateless + +A stateless action typically corresponds to an ordinary menu item. + +Selecting such a menu item will activate the action (with no parameter). + +## Boolean State + +An action with a boolean state will most typically be used with a "toggle" +or "switch" menu item. The state can be set directly, but activating the +action (with no parameter) results in the state being toggled. + +Selecting a toggle menu item will activate the action. The menu item should +be rendered as "checked" when the state is true. + +## String Parameter and State + +Actions with string parameters and state will most typically be used to +represent an enumerated choice over the items available for a group of +radio menu items. Activating the action with a string parameter is +equivalent to setting that parameter as the state. + +Radio menu items, in addition to being associated with the action, will +have a target value. Selecting that menu item will result in activation +of the action with the target value as the parameter. The menu item should +be rendered as "selected" when the state of the action is equal to the +target value of the menu item. + +# Implements + +[`MenuModelExt`](trait.MenuModelExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `MenuModel` methods. + +# Implementors + +[`MenuModel`](struct.MenuModel.html), [`Menu`](struct.Menu.html) + +Queries item at position `item_index` in `self` for the attribute +specified by `attribute`. + +If the attribute exists and matches the `glib::VariantType` corresponding +to `format_string` then `format_string` is used to deconstruct the +value into the positional parameters and `true` is returned. + +If the attribute does not exist, or it does exist but has the wrong +type, then the positional parameters are ignored and `false` is +returned. + +This function is a mix of `MenuModelExt::get_item_attribute_value` and +`glib::Variant::get`, followed by a `glib::Variant::unref`. As such, +`format_string` must make a complete copy of the data (since the +`glib::Variant` may go away after the call to `glib::Variant::unref`). In +particular, no '&' characters are allowed in `format_string`. +## `item_index` +the index of the item +## `attribute` +the attribute to query +## `format_string` +a `glib::Variant` format string + +# Returns + +`true` if the named attribute was found with the expected + type + +Queries the item at position `item_index` in `self` for the attribute +specified by `attribute`. + +If `expected_type` is non-`None` then it specifies the expected type of +the attribute. If it is `None` then any type will be accepted. + +If the attribute exists and matches `expected_type` (or if the +expected type is unspecified) then the value is returned. + +If the attribute does not exist, or does not match the expected type +then `None` is returned. +## `item_index` +the index of the item +## `attribute` +the attribute to query +## `expected_type` +the expected type of the attribute, or + `None` + +# Returns + +the value of the attribute + +Queries the item at position `item_index` in `self` for the link +specified by `link`. + +If the link exists, the linked `MenuModel` is returned. If the link +does not exist, `None` is returned. +## `item_index` +the index of the item +## `link` +the link to query + +# Returns + +the linked `MenuModel`, or `None` + +Query the number of items in `self`. + +# Returns + +the number of items + +Queries if `self` is mutable. + +An immutable `MenuModel` will never emit the `MenuModel::items-changed` +signal. Consumers of the model may make optimisations accordingly. + +# Returns + +`true` if the model is mutable (ie: "items-changed" may be + emitted). + +Requests emission of the `MenuModel::items-changed` signal on `self`. + +This function should never be called except by `MenuModel` +subclasses. Any other calls to this function will very likely lead +to a violation of the interface of the model. + +The implementation should update its internal representation of the +menu before emitting the signal. The implementation should further +expect to receive queries about the new state of the menu (and +particularly added menu items) while signal handlers are running. + +The implementation must dispatch this call directly from a mainloop +entry and not in response to calls -- particularly those from the +`MenuModel` API. Said another way: the menu must not change while +user code is running without returning to the mainloop. +## `position` +the position of the change +## `removed` +the number of items removed +## `added` +the number of items added + +Creates a `MenuAttributeIter` to iterate over the attributes of +the item at position `item_index` in `self`. + +You must free the iterator with `gobject::ObjectExt::unref` when you are done. +## `item_index` +the index of the item + +# Returns + +a new `MenuAttributeIter` + +Creates a `MenuLinkIter` to iterate over the links of the item at +position `item_index` in `self`. + +You must free the iterator with `gobject::ObjectExt::unref` when you are done. +## `item_index` +the index of the item + +# Returns + +a new `MenuLinkIter` + +`Notification` is a mechanism for creating a notification to be shown +to the user -- typically as a pop-up notification presented by the +desktop environment shell. + +The key difference between `Notification` and other similar APIs is +that, if supported by the desktop environment, notifications sent +with `Notification` will persist after the application has exited, +and even across system reboots. + +Since the user may click on a notification while the application is +not running, applications using `Notification` should be able to be +started as a D-Bus service, using `Application`. + +User interaction with a notification (either the default action, or +buttons) must be associated with actions on the application (ie: +"app." actions). It is not possible to route user interaction +through the notification itself, because the object will not exist if +the application is autostarted as a result of a notification being +clicked. + +A notification can be sent with `ApplicationExt::send_notification`. + +Feature: `v2_40` + +# Implements + +[`NotificationExt`](trait.NotificationExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `Notification` methods. + +Feature: `v2_40` + +# Implementors + +[`Notification`](struct.Notification.html) + +Creates a new `Notification` with `title` as its title. + +After populating `notification` with more details, it can be sent to +the desktop shell with `ApplicationExt::send_notification`. Changing +any properties after this call will not have any effect until +resending `notification`. + +Feature: `v2_40` + +## `title` +the title of the notification + +# Returns + +a new `Notification` instance + +Adds a button to `self` that activates the action in +`detailed_action` when clicked. That action must be an +application-wide action (starting with "app."). If `detailed_action` +contains a target, the action will be activated with that target as +its parameter. + +See `Action::parse_detailed_name` for a description of the format +for `detailed_action`. + +Feature: `v2_40` + +## `label` +label of the button +## `detailed_action` +a detailed action name + +Adds a button to `self` that activates `action` when clicked. +`action` must be an application-wide action (it must start with "app."). + +If `target_format` is given, it is used to collect remaining +positional parameters into a `glib::Variant` instance, similar to +`glib::Variant::new`. `action` will be activated with that `glib::Variant` as its +parameter. + +Feature: `v2_40` + +## `label` +label of the button +## `action` +an action name +## `target_format` +a `glib::Variant` format string, or `None` + +Adds a button to `self` that activates `action` when clicked. +`action` must be an application-wide action (it must start with "app."). + +If `target` is non-`None`, `action` will be activated with `target` as +its parameter. + +Feature: `v2_40` + +## `label` +label of the button +## `action` +an action name +## `target` +a `glib::Variant` to use as `action`'s parameter, or `None` + +Sets the body of `self` to `body`. + +Feature: `v2_40` + +## `body` +the new body for `self`, or `None` + +Sets the default action of `self` to `detailed_action`. This +action is activated when the notification is clicked on. + +The action in `detailed_action` must be an application-wide action (it +must start with "app."). If `detailed_action` contains a target, the +given action will be activated with that target as its parameter. +See `Action::parse_detailed_name` for a description of the format +for `detailed_action`. + +When no default action is set, the application that the notification +was sent on is activated. + +Feature: `v2_40` + +## `detailed_action` +a detailed action name + +Sets the default action of `self` to `action`. This action is +activated when the notification is clicked on. It must be an +application-wide action (it must start with "app."). + +If `target_format` is given, it is used to collect remaining +positional parameters into a `glib::Variant` instance, similar to +`glib::Variant::new`. `action` will be activated with that `glib::Variant` as its +parameter. + +When no default action is set, the application that the notification +was sent on is activated. + +Feature: `v2_40` + +## `action` +an action name +## `target_format` +a `glib::Variant` format string, or `None` + +Sets the default action of `self` to `action`. This action is +activated when the notification is clicked on. It must be an +application-wide action (start with "app."). + +If `target` is non-`None`, `action` will be activated with `target` as +its parameter. + +When no default action is set, the application that the notification +was sent on is activated. + +Feature: `v2_40` + +## `action` +an action name +## `target` +a `glib::Variant` to use as `action`'s parameter, or `None` + +Sets the icon of `self` to `icon`. + +Feature: `v2_40` + +## `icon` +the icon to be shown in `self`, as a `Icon` + +Sets the priority of `self` to `priority`. See +`NotificationPriority` for possible values. + +Feature: `v2_42` + +## `priority` +a `NotificationPriority` + +Sets the title of `self` to `title`. + +Feature: `v2_40` + +## `title` +the new title for `self` + +Deprecated in favor of `NotificationExt::set_priority`. + +Feature: `v2_40` + +## `urgent` +`true` if `self` is urgent + +Priority levels for `GNotifications`. + +the default priority, to be used for the + majority of notifications (for example email messages, software updates, + completed download/sync operations) + +for notifications that do not require + immediate attention - typically used for contextual background + information, such as contact birthdays or local weather + +for events that require more attention, + usually because responses are time-sensitive (for example chat and SMS + messages or alarms) + +for urgent notifications, or notifications + that require a response in a short space of time (for example phone calls + or emergency warnings) + +Feature: `v2_42` + + +A `Permission` represents the status of the caller's permission to +perform a certain action. + +You can query if the action is currently allowed and if it is +possible to acquire the permission so that the action will be allowed +in the future. + +There is also an API to actually acquire the permission and one to +release it. + +As an example, a `Permission` might represent the ability for the +user to write to a `Settings` object. This `Permission` object could +then be used to decide if it is appropriate to show a "Click here to +unlock" button in a dialog and to provide the mechanism to invoke +when that button is clicked. + +# Implements + +[`PermissionExt`](trait.PermissionExt.html), [`ObjectExt`](trait.ObjectExt.html) + +Trait containing all `Permission` methods. + +# Implementors + +[`Permission`](struct.Permission.html), [`SimplePermission`](struct.SimplePermission.html) + +Attempts to acquire the permission represented by `self`. + +The precise method by which this happens depends on the permission +and the underlying authentication mechanism. A simple example is +that a dialog may appear asking the user to enter their password. + +You should check with `PermissionExt::get_can_acquire` before calling +this function. + +If the permission is acquired then `true` is returned. Otherwise, +`false` is returned and `error` is set appropriately. + +This call is blocking, likely for a very long time (in the case that +user interaction is required). See `PermissionExt::acquire_async` for +the non-blocking version. +## `cancellable` +a `Cancellable`, or `None` + +# Returns + +`true` if the permission was successfully acquired + +Attempts to acquire the permission represented by `self`. + +This is the first half of the asynchronous version of +`PermissionExt::acquire`. +## `cancellable` +a `Cancellable`, or `None` +## `callback` +the `GAsyncReadyCallback` to call when done +## `user_data` +the user data to pass to `callback` + +Collects the result of attempting to acquire the permission +represented by `self`. + +This is the second half of the asynchronous version of +`PermissionExt::acquire`. +## `result` +the `AsyncResult` given to the `GAsyncReadyCallback` + +# Returns + +`true` if the permission was successfully acquired + +Gets the value of the 'allowed' property. This property is `true` if +the caller currently has permission to perform the action that +`self` represents the permission to perform. + +# Returns + +the value of the 'allowed' property + +Gets the value of the 'can-acquire' property. This property is `true` +if it is generally possible to acquire the permission by calling +`PermissionExt::acquire`. + +# Returns + +the value of the 'can-acquire' property + +Gets the value of the 'can-release' property. This property is `true` +if it is generally possible to release the permission by calling +`PermissionExt::release`. + +# Returns + +the value of the 'can-release' property + +This function is called by the `Permission` implementation to update +the properties of the permission. You should never call this +function except from a `Permission` implementation. + +GObject notify signals are generated, as appropriate. +## `allowed` +the new value for the 'allowed' property +## `can_acquire` +the new value for the 'can-acquire' property +## `can_release` +the new value for the 'can-release' property + +Attempts to release the permission represented by `self`. + +The precise method by which this happens depends on the permission +and the underlying authentication mechanism. In most cases the +permission will be dropped immediately without further action. + +You should check with `PermissionExt::get_can_release` before calling +this function. + +If the permission is released then `true` is returned. Otherwise, +`false` is returned and `error` is set appropriately. + +This call is blocking, likely for a very long time (in the case that +user interaction is required). See `PermissionExt::release_async` for +the non-blocking version. +## `cancellable` +a `Cancellable`, or `None` + +# Returns + +`true` if the permission was successfully released + +Attempts to release the permission represented by `self`. + +This is the first half of the asynchronous version of +`PermissionExt::release`. +## `cancellable` +a `Cancellable`, or `None` +## `callback` +the `GAsyncReadyCallback` to call when done +## `user_data` +the user data to pass to `callback` + +Collects the result of attempting to release the permission +represented by `self`. + +This is the second half of the asynchronous version of +`PermissionExt::release`. +## `result` +the `AsyncResult` given to the `GAsyncReadyCallback` + +# Returns + +`true` if the permission was successfully released + +Applications and libraries often contain binary or textual data that is +really part of the application, rather than user data. For instance +``GtkBuilder`` .ui files, splashscreen images, GMenu markup XML, CSS files, +icons, etc. These are often shipped as files in `$datadir/appname`, or +manually included as literal strings in the code. + +The `Resource` API and the [glib-compile-resources][glib-compile-resources] program +provide a convenient and efficient alternative to this which has some nice properties. You +maintain the files as normal files, so its easy to edit them, but during the build the files +are combined into a binary bundle that is linked into the executable. This means that loading +the resource files are efficient (as they are already in memory, shared with other instances) and +simple (no need to check for things like I/O errors or locate the files in the filesystem). It +also makes it easier to create relocatable applications. + +Resource files can also be marked as compressed. Such files will be included in the resource bundle +in a compressed form, but will be automatically uncompressed when the resource is used. This +is very useful e.g. for larger text files that are parsed once (or rarely) and then thrown away. + +Resource files can also be marked to be preprocessed, by setting the value of the +`preprocess` attribute to a comma-separated list of preprocessing options. +The only options currently supported are: + +`xml-stripblanks` which will use the xmllint command +to strip ignorable whitespace from the XML file. For this to work, +the `XMLLINT` environment variable must be set to the full path to +the xmllint executable, or xmllint must be in the `PATH`; otherwise +the preprocessing step is skipped. + +`to-pixdata` which will use the gdk-pixbuf-pixdata command to convert +images to the `GdkPixdata` format, which allows you to create pixbufs directly using the data inside +the resource file, rather than an (uncompressed) copy if it. For this, the gdk-pixbuf-pixdata +program must be in the PATH, or the `GDK_PIXBUF_PIXDATA` environment variable must be +set to the full path to the gdk-pixbuf-pixdata executable; otherwise the resource compiler will +abort. + +Resource bundles are created by the [glib-compile-resources][glib-compile-resources] program +which takes an XML file that describes the bundle, and a set of files that the XML references. These +are combined into a binary resource bundle. + +An example resource description: + +```text + + for T`
+
+Say you want to pass a `*mut GdkWindowAttr` to a foreign function. The `Stash`
+will own a `GdkWindowAttr` and a `CString` that `GdkWindowAttr::title` points into.
+
+```ignore
+impl <'a> ToGlibPtr<'a, *mut glib_ffi::GdkWindowAttr> for WindowAttr {
+ type Storage = (Box`-1`
` if the
document has not been completely paginated.
-Feature: `v2_2`
-
-
# Returns
the number of pages in the document or ``-1`
` if the
@@ -2646,9 +2546,6 @@ document has not been completely paginated.
Returns the current fraction of the document pagination that has been completed.
-Feature: `v2_2`
-
-
# Returns
a fraction from 0.0 to 1.0 inclusive.
@@ -2658,9 +2555,6 @@ footer will be printed if this function returns `true`
``
`
+`