mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
Merge from master
This commit is contained in:
commit
247b37620c
@ -79,7 +79,7 @@ in the file:
|
||||
|
||||
Or online at:
|
||||
|
||||
http://developer.gnome.org/doc/API/2.0/glib/glib-building.html
|
||||
http://library.gnome.org/devel/glib/stable/glib-building.html
|
||||
|
||||
|
||||
Installation directories
|
||||
|
277
NEWS
277
NEWS
@ -1,3 +1,280 @@
|
||||
Overview of Changes from GLib 2.27.2 to 2.27.3
|
||||
==============================================
|
||||
|
||||
* The GTimeSpec type that was introduced in the 2.27.2 has been
|
||||
dropped again in favour of APIs that return microseconds as
|
||||
64-bit integer.
|
||||
Affected functions:
|
||||
g_source_get_time
|
||||
g_periodic_unblock
|
||||
g_get_monotonic_time
|
||||
g_get_real_time
|
||||
The similar GTimeVal struct is still around, but its use is
|
||||
discouraged.
|
||||
|
||||
* GTimer is now using monotonic time unconditionally
|
||||
|
||||
* There are some new functions to facilitate error reporting
|
||||
in async GIO APIs:
|
||||
g_simple_async_result_take_error
|
||||
g_simple_async_result_new_take_error
|
||||
g_simple_async_report_take_gerror_in_idle
|
||||
|
||||
* There is new convenience API to us GVariant dictionaries:
|
||||
g_variant_lookup
|
||||
|
||||
* It is now possible to delay sending match rules to the
|
||||
D-Bus daemon in GDBus:
|
||||
G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE
|
||||
|
||||
* Support has been added for XDG_RUNTIME_DIR:
|
||||
g_get_user_runtime_dir
|
||||
|
||||
* Various fixes for Win64/MSVC builds have been committed
|
||||
|
||||
* Bugs fixed:
|
||||
620263 Add g_clear_object, g_clear_pointer, g_clear_boxed
|
||||
633075 update Project Files and sources for MSVC 2008/C89
|
||||
633381 gsettings Makefile rules should handle empty list...
|
||||
633685 Use g_simple_async_result_{new_,}take_error
|
||||
633686 Add g_simple_async_report_take_gerror_in_idle
|
||||
|
||||
* Translation updates:
|
||||
Belarusian
|
||||
Galician
|
||||
Hebrew
|
||||
Punjabi
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes from GLib 2.27.1 to 2.27.2
|
||||
==============================================
|
||||
|
||||
* GApplication
|
||||
- Export actions over DBus and support activating them from remote instances
|
||||
- Support environment passing
|
||||
|
||||
* GSettings
|
||||
- The gsettings utility has a list-recursively command
|
||||
- The gsettings utility has commandline completion for enum values
|
||||
|
||||
* GLib is now linked against librt and uses monotonic time for
|
||||
timeouts and GPeriod sources. GSource has a new g_source_get_time()
|
||||
which returns monotonic time, and g_source_get_current_time() has
|
||||
been deprecated
|
||||
|
||||
* Bugs fixed:
|
||||
158725 free linked list with data
|
||||
626320 GVariant: Avoid locking in g_variant_get_child_value() if possible
|
||||
629247 add gsimpleasyncresult methods to take over a GError
|
||||
629274 GNetworkService does not do fallback when there is no SRV record
|
||||
631264 gsettings-tool choice/range support
|
||||
631482 g_date_time_from_instant: 1000000000000000000
|
||||
632169 docs for manual use of gsettings-data-convert
|
||||
632571 Add equivalent to gconftool-2's -R option
|
||||
633115 GSettings m4 doesn't fail the build for broken schemas
|
||||
633206 Default g_application_local_command_line() doesn't set exit_status...
|
||||
633339 support more complex gapplication setups
|
||||
633356 Make timeout G_MAXINT mean "no timeout"
|
||||
|
||||
* Translation updates:
|
||||
Catalan (Valencian)
|
||||
Indonesian
|
||||
Japanese
|
||||
|
||||
|
||||
Overview of Changes from GLib 2.27.0 to 2.27.1
|
||||
==============================================
|
||||
|
||||
* GDateTime now has full week number support.
|
||||
New API: g_date_time_get_week_numbering_year
|
||||
|
||||
* The GSettings schema compiler will now skip over
|
||||
broken .xml schema files instead of aborting altogether
|
||||
|
||||
* GSettings now works properly on bigendian systems
|
||||
|
||||
* GSettings has more complete support for ranges
|
||||
New API:
|
||||
g_settings_get_range
|
||||
g_settings_range_check
|
||||
The gsettings commandline tool supports ranges too.
|
||||
|
||||
* GApplication has been rewritten; see the API docs for details
|
||||
and examples. The action support is not complete yet.
|
||||
|
||||
* The GLib mainloop has gained 'dispatch to context' functionality,
|
||||
which can replace manually created idles in many cases.
|
||||
New API:
|
||||
g_main_context_invoke
|
||||
g_main_context_invoke_full
|
||||
|
||||
* The gio-desktop-app-info-lookup extension point has been
|
||||
removed from GIO. GIO now uses x-scheme-handler mimetypes when
|
||||
looking for default applications.
|
||||
|
||||
* On win32, make g_get_user_data_dir() return the CSIDL_LOCAL_APPDATA
|
||||
folder on Windows, and not CSIDL_PERSONAL. This matches what Qt does,
|
||||
and has been widely requested. Also make g_get_user_config_dir() return
|
||||
this and not the (roaming) CSIDL_APPDATA folder.
|
||||
|
||||
* A periodic event clock has been added in GIO: GPeriodic. Note that this
|
||||
API is still experimental and expected to undergo changes before it
|
||||
will be incorporated into a stable GLib release. Use at your own risk.
|
||||
|
||||
Bug fixes:
|
||||
613822 gobject signal connect/disconnect not thread safe
|
||||
618737 "dispatch to context" functionality
|
||||
620710 g_get_user_data_dir() uses CSIDL_PERSONAL and not CSIDL_APPDATA
|
||||
623400 acquire context before dispatching
|
||||
627126 gsettings schema files don't get installed on FreeBSD
|
||||
627171 g_socket_new_from_fd() doesn't set the right protocol
|
||||
628876 Wrong error description
|
||||
628937 gracefully handle broken schemas
|
||||
629274 GNetworkService doesn't fallback when there is no SRV record
|
||||
629289 g_error() used wrong, produces core dump
|
||||
629687 leaks class refcount in gsocketcontrolmessage
|
||||
629849 GLib-CRITICAL **: g_source_get_context: assertion `!SOURCE_...
|
||||
629945 GDBus deadlock in g_bus_get_sync()
|
||||
630000 g_date_time_difference
|
||||
630077 GDateTime week number support
|
||||
630185 Allow NULL strings in g_quark_try_string()
|
||||
630797 docs mention non-existent g_object_dispose()
|
||||
630968 gschema-compile problems on power g5
|
||||
631263 GSettings needs range/choice APIs
|
||||
631264 gsettings-tool choice/range support
|
||||
631379 GDBus nonce-tcp test failing
|
||||
631410 Port gapplookupgconf.c to using x-scheme-handler/
|
||||
632884 Possible deadlock in g_object_remove_toggle_ref()
|
||||
|
||||
Transation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
British English
|
||||
Bulgarian
|
||||
Czech
|
||||
Dutch
|
||||
Estonian
|
||||
French
|
||||
Galician
|
||||
German
|
||||
Greek
|
||||
Hebrew
|
||||
Hungarian
|
||||
Japanese
|
||||
Lithuanian
|
||||
Polish
|
||||
Portuguese
|
||||
Romanian
|
||||
Simplified Chinese
|
||||
Slovenian
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes from GLib 2.25.15 to GLib 2.27.0
|
||||
====================================================
|
||||
|
||||
Build:
|
||||
- massive restructuring to reduce #include abuse
|
||||
- tweaks to silence some harmless compiler warnings
|
||||
- rename gschema-compile.c to glib-compile-schemas.c
|
||||
- Windows fixes
|
||||
- fix building with zlib < 1.2.4 on win32
|
||||
|
||||
GDateTime:
|
||||
- better msgctxt for translating month and weekday names
|
||||
- API is changed quite a lot, implementation is improved
|
||||
- GTimeZone is now exposed
|
||||
|
||||
GObject:
|
||||
- make ordering for overridden interface properties consistent
|
||||
- ->priv structures are limited to 64k but this was not documented,
|
||||
and exceeding this limit produced bad results. Add docs and enforce
|
||||
the limit properly.
|
||||
- add g_object_class_install_properties() to install multiple
|
||||
properties in one go
|
||||
- improve debugging output for GValue containing G_TYPE_STRV
|
||||
|
||||
GIO:
|
||||
- fix priority sorting of GIO extensions
|
||||
- add GCredentials support on FreeBSD
|
||||
- fix support for IPv6 addresses in URI parsing functions
|
||||
- GSocketClient fixes for when g_socket_connect succeeds immediately
|
||||
- clarify string encoding for GFile constructors in docs
|
||||
- new functions g_data_input_stream_read_upto{,async,finish}
|
||||
- tweak confusing documentation for g_output_stream_write()
|
||||
|
||||
GDBus:
|
||||
- GDBusMessage can now be locked and copied (like in libdbus)
|
||||
- GDBusConnection filter function API has changed again
|
||||
- GDBusServer: ::new-connection now declares if the connection was claimed
|
||||
- add a partial workaround for GObject bug 627724.
|
||||
- very many memory leaks fixed
|
||||
|
||||
GVariant:
|
||||
- check for size == 0 in g_variant_get_bytestring to avoid a crash
|
||||
when attempting to get_bytestring() from an empty array
|
||||
- improve gobject-introspection annotations
|
||||
|
||||
GSettings:
|
||||
- add GSettings Windows registry backend
|
||||
- some internal tweaks to the backend API
|
||||
- remove g_settings_list_items
|
||||
- add g_settings_list_children and _list_keys to replace it
|
||||
- add schema compiler restrictions for dealing with lists
|
||||
- don't automatically emit value changed signals on writability
|
||||
changes
|
||||
|
||||
Other:
|
||||
- constify the 'parser' vtable param to g_markup_parse_context_push()
|
||||
- plug many memory leaks in test cases
|
||||
|
||||
Bugs closed:
|
||||
50076 Time API to go with date API
|
||||
584284 g_data_input_stream_read_until_async different from sync version
|
||||
624546 Modification of GDBusMessage in filter function
|
||||
626919 Let g_object_class_install_property() return the installed GParamSpec*
|
||||
628029 GDateTime missing get_week_of_year method
|
||||
628253 Interface properties not listed in a consistent order
|
||||
628331 Plug lots of mem leaks in gio test suite
|
||||
628345 Plug a mem leak
|
||||
628436 Plug a mem leak
|
||||
628505 Fix building with zlib < 1.2.4 on win32
|
||||
628839 [PATCH] datetime: Rename shadowing variables
|
||||
628904 [PATCH] Add credential support for FreeBSD and fix a socket issue
|
||||
628952 incorrect glib_major_version and other variables on cygwin.
|
||||
629192 g_strdup_value_contents(): dump GStrv more usefully
|
||||
629251 g_socket_client_async_connect_complete: assertion failed
|
||||
629259 Failed to connect to "::1"
|
||||
629328 g_markup_parse_context_push doesn't respect const structs
|
||||
629429 month "May" short and full form same with "GDateTime" msgctxt
|
||||
629689 GDBusConnection leaks its GCredentials
|
||||
629698 Segfault in g_variant_get_bytestring()
|
||||
|
||||
Updated translations:
|
||||
Arabic
|
||||
Armenian
|
||||
Basque
|
||||
British English
|
||||
Czech
|
||||
Finnish
|
||||
Galician
|
||||
German
|
||||
Hungarian
|
||||
Indonesian
|
||||
Japanese
|
||||
Lithuanian
|
||||
Norwegian bokmål
|
||||
Polish
|
||||
Portuguese
|
||||
Punjabi
|
||||
Simplified Chinese
|
||||
Slovenian
|
||||
Spanish
|
||||
Swedish
|
||||
Swedish
|
||||
Traditional Chinese
|
||||
|
||||
Overview of Changes from GLib 2.25.14 to GLib 2.25.15
|
||||
=====================================================
|
||||
|
||||
|
@ -19,7 +19,7 @@ if libtoolize --version < /dev/null > /dev/null 2>&1 ; then
|
||||
sed -e 's/^\(.*\)([^)]*)\(.*\)$/\1\2/g' \
|
||||
-e 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
|
||||
case $libtool_version in
|
||||
2.2*)
|
||||
2.2*|2.4*)
|
||||
have_libtool=true
|
||||
;;
|
||||
esac
|
||||
|
@ -7,12 +7,25 @@ the .in files needed, mainly config.h.win32.in into config.h.win32 and
|
||||
glibconfig.h.win32.in into glibconfig.h.win32. You will also need to
|
||||
expand the .vcprojin files here into .vcproj files.
|
||||
|
||||
The only external dependency is proxy-libintl. Fetch the latest
|
||||
proxy-libintl-dev zipfile from
|
||||
The required dependencies are zlib and proxy-libintl. Fetch the latest
|
||||
proxy-libintl-dev and zlib-dev zipfiles from
|
||||
http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ for 32-bit
|
||||
builds, and correspondingly
|
||||
http://ftp.gnome.org/pub/GNOME/binaries/win64/dependencies/ for 64-bit
|
||||
builds. Set up the source tree as follows under some arbitrary top
|
||||
builds.
|
||||
|
||||
One may optionally use his/her own PCRE installation by selecting the
|
||||
(BuildType)_ExtPCRE configuration, but please note the PCRE must be built
|
||||
with VS9 with unicode support using the /MD (release) or /MDd (debug)
|
||||
runtime option which corresponds to your GLib build flavour (release, debug).
|
||||
(These are the defaults set by CMAKE, which is used in recent versions of PCRE.)
|
||||
Not doing so will most probably result in unexpected crashes in
|
||||
your programs due to the use of different CRTs. If using a static PCRE
|
||||
build, add PCRE_STATIC to the "preprocessor definitions".
|
||||
Note that one may still continue to build with the bundled PCRE by selecting
|
||||
the (BuildType) configuration.
|
||||
|
||||
Set up the source tree as follows under some arbitrary top
|
||||
folder <root>:
|
||||
|
||||
<root>\glib\<this-glib-source-tree>
|
||||
@ -36,3 +49,4 @@ project files higher in the stack are supposed to look for them, not
|
||||
from a specific GLib source tree.
|
||||
|
||||
--Tor Lillqvist <tml@iki.fi>
|
||||
--Updated by Chun-wei Fan <fanc999@gmail.com>
|
||||
|
@ -160,6 +160,13 @@
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
#include "libgio.sourcefiles"
|
||||
<File RelativePath="..\..\..\gio\gregistrysettingsbackend.c" />
|
||||
<File RelativePath="..\..\..\gio\gwin32appinfo.c" />
|
||||
<File RelativePath="..\..\..\gio\win32\gwin32directorymonitor.c" />
|
||||
<File RelativePath="..\..\..\gio\win32\gwinhttpfile.c" />
|
||||
<File RelativePath="..\..\..\gio\win32\gwinhttpfileinputstream.c" />
|
||||
<File RelativePath="..\..\..\gio\win32\gwinhttpfileoutputstream.c" />
|
||||
<File RelativePath="..\..\..\gio\win32\gwinhttpvfs.c" />
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
@ -55,6 +55,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj",
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C} = {C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA} = {289240E7-E167-47CE-A20C-58D852E520BA}
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753} = {F172EFFC-E30F-4593-809E-DB2024B1E753}
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C} = {64E09909-5599-40C0-B808-27F55F7B823C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
@ -63,6 +64,10 @@ Global
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
Debug_ExtPCRE|Win32 = Debug_ExtPCRE|Win32
|
||||
Debug_ExtPCRE|x64 = Debug_ExtPCRE|x64
|
||||
Release_ExtPCRE|Win32 = Release_ExtPCRE|Win32
|
||||
Release_ExtPCRE|x64 = Release_ExtPCRE|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -73,6 +78,14 @@ Global
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Release|Win32.Build.0 = Release|Win32
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Release|x64.ActiveCfg = Release|x64
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Release|x64.Build.0 = Release|x64
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Debug_ExtPCRE|Win32.ActiveCfg = Debug_ExtPCRE|Win32
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Debug_ExtPCRE|Win32.Build.0 = Debug_ExtPCRE|Win32
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Debug_ExtPCRE|x64.ActiveCfg = Debug_ExtPCRE|x64
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Debug_ExtPCRE|x64.Build.0 = Debug_ExtPCRE|x64
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Release_ExtPCRE|Win32.ActiveCfg = Release_ExtPCRE|Win32
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Release_ExtPCRE|Win32.Build.0 = Release_ExtPCRE|Win32
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Release_ExtPCRE|x64.ActiveCfg = Release_ExtPCRE|x64
|
||||
{12BCA020-EABF-429E-876A-A476BC9C10C0}.Release_ExtPCRE|x64.Build.0 = Release_ExtPCRE|x64
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -81,6 +94,14 @@ Global
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Release|Win32.Build.0 = Release|Win32
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Release|x64.ActiveCfg = Release|x64
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Release|x64.Build.0 = Release|x64
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{4214047C-F5C1-40B3-8369-5DCED8C32770}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -89,6 +110,14 @@ Global
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Release|Win32.Build.0 = Release|Win32
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Release|x64.ActiveCfg = Release|x64
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Release|x64.Build.0 = Release|x64
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{F172EFFC-E30F-4593-809E-DB2024B1E753}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -97,6 +126,14 @@ Global
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Release|Win32.Build.0 = Release|Win32
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Release|x64.ActiveCfg = Release|x64
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Release|x64.Build.0 = Release|x64
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{C8AFB8C3-FFFD-460F-BC13-9AC25D7B117C}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -105,6 +142,14 @@ Global
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Release|Win32.Build.0 = Release|Win32
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Release|x64.ActiveCfg = Release|x64
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Release|x64.Build.0 = Release|x64
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{BD12E835-5C52-4E5D-8234-1C579F33E27A}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -113,6 +158,14 @@ Global
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Release|Win32.Build.0 = Release|Win32
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Release|x64.ActiveCfg = Release|x64
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Release|x64.Build.0 = Release|x64
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{F3D1583C-5613-4809-BD98-7CC1C1276F92}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -121,6 +174,14 @@ Global
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Release|Win32.Build.0 = Release|Win32
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Release|x64.ActiveCfg = Release|x64
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Release|x64.Build.0 = Release|x64
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{289240E7-E167-47CE-A20C-58D852E520BA}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -129,6 +190,14 @@ Global
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Release|Win32.Build.0 = Release|Win32
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Release|x64.ActiveCfg = Release|x64
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Release|x64.Build.0 = Release|x64
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{E40E8A7E-7CAE-4659-9B8B-BC38898E3074}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -137,6 +206,14 @@ Global
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|Win32.Build.0 = Release|Win32
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|x64.ActiveCfg = Release|x64
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release|x64.Build.0 = Release|x64
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{64E09909-5599-40C0-B808-27F55F7B823C}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -145,6 +222,14 @@ Global
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Release|Win32.Build.0 = Release|Win32
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Release|x64.ActiveCfg = Release|x64
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Release|x64.Build.0 = Release|x64
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|Win32.ActiveCfg = Debug|Win32
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|Win32.Build.0 = Debug|Win32
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|x64.ActiveCfg = Debug|x64
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Debug_ExtPCRE|x64.Build.0 = Debug|x64
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Release_ExtPCRE|Win32.ActiveCfg = Release|Win32
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Release_ExtPCRE|Win32.Build.0 = Release|Win32
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Release_ExtPCRE|x64.ActiveCfg = Release|x64
|
||||
{2093D218-190E-4194-9421-3BA7CBF33B10}.Release_ExtPCRE|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -51,6 +51,38 @@
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug_ExtPCRE|Win32"
|
||||
InheritedPropertySheets=".\glib.vsprops"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GLIB_COMPILATION;DLL_EXPORT;G_LOG_DOMAIN=\"Glib\";G_ENABLE_DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib pcred.lib"
|
||||
OutputFile="$(OutDir)\$(GlibDllPrefix)$(ProjectName)$(GlibDllSuffix).dll"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="$(IntDir)\glib.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)$(ProjectName)-2.0.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
InheritedPropertySheets=".\glib.vsprops"
|
||||
@ -83,6 +115,38 @@
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug_ExtPCRE|x64"
|
||||
InheritedPropertySheets=".\glib.vsprops"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GLIB_COMPILATION;DLL_EXPORT;G_LOG_DOMAIN=\"Glib\";G_ENABLE_DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib pcred.lib"
|
||||
OutputFile="$(OutDir)\$(GlibDllPrefix)$(ProjectName)$(GlibDllSuffix).dll"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="$(IntDir)\glib.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)$(ProjectName)-2.0.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
InheritedPropertySheets=".\glib.vsprops"
|
||||
@ -115,6 +179,38 @@
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release_ExtPCRE|Win32"
|
||||
InheritedPropertySheets=".\glib.vsprops"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GLIB_COMPILATION;DLL_EXPORT;G_LOG_DOMAIN=\"Glib\""
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib pcre.lib"
|
||||
OutputFile="$(OutDir)\$(GlibDllPrefix)$(ProjectName)$(GlibDllSuffix).dll"
|
||||
LinkIncremental="1"
|
||||
ModuleDefinitionFile="$(IntDir)\glib.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)$(ProjectName)-2.0.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
InheritedPropertySheets=".\glib.vsprops"
|
||||
@ -147,6 +243,38 @@
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release_ExtPCRE|x64"
|
||||
InheritedPropertySheets=".\glib.vsprops"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GLIB_COMPILATION;DLL_EXPORT;G_LOG_DOMAIN=\"Glib\""
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib pcre.lib"
|
||||
OutputFile="$(OutDir)\$(GlibDllPrefix)$(ProjectName)$(GlibDllSuffix).dll"
|
||||
LinkIncremental="1"
|
||||
ModuleDefinitionFile="$(IntDir)\glib.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)$(ProjectName)-2.0.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
@ -175,6 +303,14 @@
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug_ExtPCRE|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
@ -183,6 +319,14 @@
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug_ExtPCRE|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
@ -191,6 +335,14 @@
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release_ExtPCRE|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
@ -199,6 +351,14 @@
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release_ExtPCRE|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="LIBDIR="/irrelevant/lib""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
@ -213,26 +373,96 @@
|
||||
<Filter
|
||||
Name="pcre"
|
||||
>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_chartables.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_compile.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_config.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_dfa_exec.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_exec.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_fullinfo.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_get.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_globals.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_info.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_maketables.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_newline.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_ord2utf8.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_refcount.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_study.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_tables.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_try_flipped.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_ucp_searchfuncs.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_valid_utf8.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_version.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_xclass.c" />
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_chartables.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_compile.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_config.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_dfa_exec.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_exec.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_fullinfo.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_get.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_globals.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_newline.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_ord2utf8.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_study.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_tables.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_try_flipped.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_ucp_searchfuncs.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\glib\pcre\pcre_xclass.c" >
|
||||
<FileConfiguration Name="Debug_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Debug_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
<FileConfiguration Name="Release_ExtPCRE|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
@ -264,7 +494,7 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
Name="Debug_ExtPCRE|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
@ -273,6 +503,26 @@
|
||||
Outputs="$(IntDir)\glib.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating glib.def"
|
||||
CommandLine="$(GlibGenerateGlibDefW64)"
|
||||
Outputs="$(IntDir)\glib.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug_ExtPCRE|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating glib.def"
|
||||
CommandLine="$(GlibGenerateGlibDefW64)"
|
||||
Outputs="$(IntDir)\glib.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
@ -284,7 +534,7 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
Name="Release_ExtPCRE|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
@ -293,6 +543,26 @@
|
||||
Outputs="$(IntDir)\glib.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating glib.def"
|
||||
CommandLine="$(GlibGenerateGlibDefW64)"
|
||||
Outputs="$(IntDir)\glib.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release_ExtPCRE|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating glib.def"
|
||||
CommandLine="$(GlibGenerateGlibDefW64)"
|
||||
Outputs="$(IntDir)\glib.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
|
@ -24,8 +24,8 @@ if exist ..\..\..\config.h goto DONE_CONFIG_H

|
||||
copy ..\..\..\config.h.win32 ..\..\..\config.h

|
||||
:DONE_CONFIG_H

|
||||
|
||||
if exist ..\..\..\glibconfig.h goto DONE_GLIBCONFIG_H

|
||||
copy ..\..\..\glibconfig.h.win32 ..\..\..\glibconfig.h

|
||||
if exist ..\..\..\glib\glibconfig.h goto DONE_GLIBCONFIG_H

|
||||
copy ..\..\..\glib\glibconfig.h.win32 ..\..\..\glib\glibconfig.h

|
||||
:DONE_GLIBCONFIG_H

|
||||
|
||||
if exist ..\..\..\gmodule\gmoduleconf.h goto DONE_GMODULECONF_H

|
||||
@ -39,6 +39,7 @@ copy ..\..\..\gmodule\gmoduleconf.h.win32 ..\..\..\gmodule\gmoduleconf.h
&#
|
||||
mkdir $(OutDir)

|
||||
mkdir $(OutDir)\bin

|
||||
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\*.dll $(OutDir)\bin

|
||||
if exist $(SolutionDir)$(ConfigurationName)_ExtPCRE copy $(SolutionDir)$(ConfigurationName)_ExtPCRE\$(PlatformName)\bin\*.dll $(OutDir)\bin

|
||||
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\glib-genmarshal.exe $(OutDir)\bin

|
||||
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\gspawn-win32-helper*.exe $(OutDir)\bin

|
||||
|
||||
@ -61,6 +62,7 @@ copy ..\..\..\glib\gcompletion.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gconvert.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gdataset.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gdate.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gdatetime.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gdir.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gerror.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gfileutils.h $(OutDir)\include\glib-2.0\glib

|
||||
@ -103,6 +105,7 @@ copy ..\..\..\glib\gtestutils.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gthread.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gthreadpool.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gtimer.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gtimezone.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gtree.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gtypes.h $(OutDir)\include\glib-2.0\glib

|
||||
copy ..\..\..\glib\gunicode.h $(OutDir)\include\glib-2.0\glib

|
||||
@ -135,8 +138,11 @@ copy ..\..\..\gobject\gvaluecollector.h $(OutDir)\include\glib-2.0\gobject
|
||||
copy ..\..\..\gobject\gvaluetypes.h $(OutDir)\include\glib-2.0\gobject

|
||||
|
||||
mkdir $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gaction.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gactiongroup.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gappinfo.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gapplication.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gapplicationcommandline.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gasyncinitable.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gasyncresult.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gbufferedinputstream.h $(OutDir)\include\glib-2.0\gio

|
||||
@ -199,10 +205,19 @@ copy ..\..\..\gio\gnativevolumemonitor.h $(OutDir)\include\glib-2.0\gio
&#x
|
||||
copy ..\..\..\gio\gnetworkaddress.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gnetworkservice.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\goutputstream.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gperiodic.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gpermission.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gproxy.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gproxyaddress.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gproxyaddressenumerator.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gproxyresolver.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gresolver.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gseekable.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsettings.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsimpleasyncresult.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsimpleaction.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsimpleactiongroup.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsimplepermission.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsocket.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsocketaddress.h $(OutDir)\include\glib-2.0\gio

|
||||
copy ..\..\..\gio\gsocketaddressenumerator.h $(OutDir)\include\glib-2.0\gio

|
||||
@ -227,19 +242,28 @@ copy ..\..\..\gio\gwin32inputstream.h $(OutDir)\include\gio-win32-2.0\gio
&
|
||||
copy ..\..\..\gio\gwin32outputstream.h $(OutDir)\include\gio-win32-2.0\gio

|
||||
|
||||
mkdir $(OutDir)\lib\glib-2.0\include

|
||||
copy ..\..\..\glibconfig.h $(OutDir)\lib\glib-2.0\include

|
||||
copy ..\..\..\glib\glibconfig.h $(OutDir)\lib\glib-2.0\include

|
||||
|
||||
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\*-2.0.lib $(OutDir)\lib

|
||||
if exist $(SolutionDir)$(ConfigurationName)_ExtPCRE copy $(SolutionDir)$(ConfigurationName)_ExtPCRE\$(PlatformName)\bin\*-2.0.lib $(OutDir)\lib

|
||||
"
|
||||
/>
|
||||
<UserMacro
|
||||
Name="GlibGenerateGlibDef"
|
||||
Value="echo EXPORTS >"$(IntDir)\glib.def" && cl /EP -DG_OS_WIN32 -DINCLUDE_INTERNAL_SYMBOLS -DALL_FILES -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF -DG_GNUC_FORMAT=;G_GNUC_FORMAT ..\..\..\glib\glib.symbols >>"$(IntDir)\glib.def""
|
||||
/>
|
||||
<UserMacro
|
||||
Name="GlibGenerateGlibDefW64"
|
||||
Value="echo EXPORTS >"$(IntDir)\glib.def" && cl /EP -DG_OS_WIN32 -D_WIN64 -DINCLUDE_INTERNAL_SYMBOLS -DALL_FILES -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF -DG_GNUC_FORMAT=;G_GNUC_FORMAT ..\..\..\glib\glib.symbols >>"$(IntDir)\glib.def""
|
||||
/>
|
||||
<UserMacro
|
||||
Name="GlibGenerateGmoduleDef"
|
||||
Value="echo EXPORTS >"$(IntDir)\gmodule.def" && cl /EP -DG_OS_WIN32 ..\..\..\gmodule\gmodule.symbols >>"$(IntDir)\gmodule.def""
|
||||
/>
|
||||
<UserMacro
|
||||
Name="GlibGenerateGmoduleDefW64"
|
||||
Value="echo EXPORTS >"$(IntDir)\gmodule.def" && cl /EP -DG_OS_WIN32 -D_WIN64 ..\..\..\gmodule\gmodule.symbols >>"$(IntDir)\gmodule.def""
|
||||
/>
|
||||
<UserMacro
|
||||
Name="GlibGenerateGobjectDef"
|
||||
Value="echo EXPORTS >"$(IntDir)\gobject.def" && cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF ..\..\..\gobject\gobject.symbols >>"$(IntDir)\gobject.def""
|
||||
|
@ -191,7 +191,7 @@
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating gmodule.def"
|
||||
CommandLine="$(GlibGenerateGmoduleDef)"
|
||||
CommandLine="$(GlibGenerateGmoduleDefW64)"
|
||||
Outputs="$(IntDir)/gmodule.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
@ -211,7 +211,7 @@
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating gmodule.def"
|
||||
CommandLine="$(GlibGenerateGmoduleDef)"
|
||||
CommandLine="$(GlibGenerateGmoduleDefW64)"
|
||||
Outputs="$(IntDir)/gmodule.def"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
|
16
configure.ac
16
configure.ac
@ -21,8 +21,8 @@ m4_define(glib_configure_ac)
|
||||
# set glib_binary_age _and_ glib_interface_age to 0.
|
||||
#
|
||||
m4_define([glib_major_version], [2])
|
||||
m4_define([glib_minor_version], [25])
|
||||
m4_define([glib_micro_version], [16])
|
||||
m4_define([glib_minor_version], [27])
|
||||
m4_define([glib_micro_version], [4])
|
||||
m4_define([glib_interface_age], [0])
|
||||
m4_define([glib_binary_age],
|
||||
[m4_eval(100 * glib_minor_version + glib_micro_version)])
|
||||
@ -955,7 +955,6 @@ AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strn
|
||||
AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link statvfs statfs utimes getgrgid getpwuid)
|
||||
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getmntinfo)
|
||||
# Check for high-resolution sleep functions
|
||||
AC_CHECK_FUNCS(nanosleep nsleep)
|
||||
AC_CHECK_FUNCS(splice)
|
||||
|
||||
AC_CHECK_HEADERS(crt_externs.h)
|
||||
@ -2384,8 +2383,10 @@ AC_CHECK_FUNCS(clock_gettime, [], [
|
||||
AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
|
||||
G_THREAD_LIBS="$G_THREAD_LIBS -lrt"
|
||||
G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS_FOR_GTHREAD -lrt"
|
||||
GLIB_RT_LIBS="-lrt"
|
||||
])
|
||||
])
|
||||
AC_SUBST(GLIB_RT_LIBS)
|
||||
|
||||
AC_CACHE_CHECK(for monotonic clocks,
|
||||
glib_cv_monotonic_clock,AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
@ -2785,11 +2786,12 @@ if test "x$enable_dtrace" != xno; then
|
||||
if test "x$enable_dtrace" = xyes; then
|
||||
AC_MSG_ERROR([dtrace not found])
|
||||
fi
|
||||
else
|
||||
AC_CHECK_HEADER([sys/sdt.h],have_dtrace=yes,
|
||||
[if test "x$enable_dtrace" = xyes; then
|
||||
AC_MSG_ERROR([dtrace support needs sys/sdt.h header])
|
||||
fi])
|
||||
fi
|
||||
AC_CHECK_HEADER([sys/sdt.h],have_dtrace=yes,
|
||||
[if test "x$enable_dtrace" = xyes; then
|
||||
AC_MSG_ERROR([dtrace support needs sys/sdt.h header])
|
||||
fi])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
|
@ -38,7 +38,9 @@ IGNORE_HFILES= \
|
||||
gdbus-tests.h \
|
||||
gdummyproxyresolver.h \
|
||||
testenums.h \
|
||||
gapplicationimpl.h \
|
||||
gdelayedsettingsbackend.h \
|
||||
gregistrysettingsbackend.h \
|
||||
gdummyfile.h \
|
||||
gfamdirectorymonitor.h \
|
||||
gfamfilemonitor.h \
|
||||
|
@ -170,6 +170,11 @@
|
||||
<xi:include href="xml/gaction.xml"/>
|
||||
<xi:include href="xml/gsimpleaction.xml"/>
|
||||
<xi:include href="xml/gapplication.xml"/>
|
||||
<xi:include href="xml/gapplicationcommandline.xml"/>
|
||||
</chapter>
|
||||
<chapter id="periodic">
|
||||
<title>Periodic Timer</title>
|
||||
<xi:include href="xml/gperiodic.xml"/>
|
||||
</chapter>
|
||||
<chapter id="extending">
|
||||
<title>Extending GIO</title>
|
||||
|
@ -671,6 +671,9 @@ g_data_input_stream_read_uint64
|
||||
g_data_input_stream_read_line
|
||||
g_data_input_stream_read_line_async
|
||||
g_data_input_stream_read_line_finish
|
||||
g_data_input_stream_read_upto
|
||||
g_data_input_stream_read_upto_async
|
||||
g_data_input_stream_read_upto_finish
|
||||
g_data_input_stream_read_until
|
||||
g_data_input_stream_read_until_async
|
||||
g_data_input_stream_read_until_finish
|
||||
@ -1149,6 +1152,7 @@ GSimpleAsyncThreadFunc
|
||||
g_simple_async_result_new
|
||||
g_simple_async_result_new_error
|
||||
g_simple_async_result_new_from_error
|
||||
g_simple_async_result_new_take_error
|
||||
g_simple_async_result_set_op_res_gpointer
|
||||
g_simple_async_result_get_op_res_gpointer
|
||||
g_simple_async_result_set_op_res_gssize
|
||||
@ -1162,11 +1166,13 @@ g_simple_async_result_complete
|
||||
g_simple_async_result_complete_in_idle
|
||||
g_simple_async_result_run_in_thread
|
||||
g_simple_async_result_set_from_error
|
||||
g_simple_async_result_take_error
|
||||
g_simple_async_result_propagate_error
|
||||
g_simple_async_result_set_error
|
||||
g_simple_async_result_set_error_va
|
||||
g_simple_async_report_error_in_idle
|
||||
g_simple_async_report_gerror_in_idle
|
||||
g_simple_async_report_take_gerror_in_idle
|
||||
<SUBSECTION Standard>
|
||||
GSimpleAsyncResultClass
|
||||
G_SIMPLE_ASYNC_RESULT
|
||||
@ -1385,9 +1391,6 @@ g_desktop_app_info_new
|
||||
g_desktop_app_info_get_filename
|
||||
g_desktop_app_info_get_is_hidden
|
||||
g_desktop_app_info_set_desktop_env
|
||||
GDesktopAppInfoLookup
|
||||
G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME
|
||||
g_desktop_app_info_lookup_get_default_for_uri_scheme
|
||||
<SUBSECTION Standard>
|
||||
GDesktopAppInfoClass
|
||||
G_TYPE_DESKTOP_APP_INFO
|
||||
@ -1396,14 +1399,8 @@ G_DESKTOP_APP_INFO_CLASS
|
||||
G_IS_DESKTOP_APP_INFO
|
||||
G_IS_DESKTOP_APP_INFO_CLASS
|
||||
G_DESKTOP_APP_INFO_GET_CLASS
|
||||
GDesktopAppInfoLookupIface
|
||||
G_DESKTOP_APP_INFO_LOOKUP
|
||||
G_TYPE_DESKTOP_APP_INFO_LOOKUP
|
||||
G_DESKTOP_APP_INFO_LOOKUP_GET_IFACE
|
||||
G_IS_DESKTOP_APP_INFO_LOOKUP
|
||||
<SUBSECTION Private>
|
||||
g_desktop_app_info_get_type
|
||||
g_desktop_app_info_lookup_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@ -2172,7 +2169,11 @@ g_settings_reset
|
||||
|
||||
<SUBSECTION Introspection>
|
||||
g_settings_list_schemas
|
||||
g_settings_list_items
|
||||
g_settings_list_relocatable_schemas
|
||||
g_settings_list_keys
|
||||
g_settings_list_children
|
||||
g_settings_get_range
|
||||
g_settings_range_check
|
||||
|
||||
<SUBSECTION Convenience>
|
||||
g_settings_get
|
||||
@ -2658,23 +2659,33 @@ g_simple_permission_get_type
|
||||
<FILE>gapplication</FILE>
|
||||
GApplication
|
||||
GApplicationClass
|
||||
|
||||
<SUBSECTION>
|
||||
GApplicationFlags
|
||||
g_application_id_is_valid
|
||||
g_application_new
|
||||
<SUBSECTION>
|
||||
g_application_get_application_id
|
||||
g_application_set_application_id
|
||||
<SUBSECTION>
|
||||
g_application_get_inactivity_timeout
|
||||
g_application_set_inactivity_timeout
|
||||
<SUBSECTION>
|
||||
g_application_get_flags
|
||||
g_application_set_flags
|
||||
<SUBSECTION>
|
||||
g_application_set_action_group
|
||||
<SUBSECTION>
|
||||
g_application_get_is_registered
|
||||
g_application_get_is_remote
|
||||
g_application_register
|
||||
g_application_try_new
|
||||
g_application_unregistered_try_new
|
||||
g_application_get_instance
|
||||
g_application_get_id
|
||||
g_application_add_action
|
||||
g_application_remove_action
|
||||
g_application_list_actions
|
||||
g_application_set_action_enabled
|
||||
g_application_get_action_enabled
|
||||
g_application_get_action_description
|
||||
g_application_invoke_action
|
||||
<SUBSECTION>
|
||||
g_application_hold
|
||||
g_application_release
|
||||
<SUBSECTION>
|
||||
g_application_activate
|
||||
g_application_open
|
||||
<SUBSECTION>
|
||||
g_application_run
|
||||
g_application_quit_with_data
|
||||
g_application_is_remote
|
||||
<SUBSECTION Standard>
|
||||
G_TYPE_APPLICATION
|
||||
G_APPLICATION
|
||||
@ -2687,6 +2698,36 @@ GApplicationPrivate
|
||||
g_application_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gapplicationcommandline</FILE>
|
||||
GApplicationCommandLine
|
||||
GApplicationCommandLineClass
|
||||
<SUBSECTION>
|
||||
g_application_command_line_get_arguments
|
||||
g_application_command_line_get_cwd
|
||||
g_application_command_line_get_environ
|
||||
g_application_command_line_getenv
|
||||
g_application_command_line_get_is_remote
|
||||
g_application_command_line_get_platform_data
|
||||
<SUBSECTION>
|
||||
g_application_command_line_set_exit_status
|
||||
g_application_command_line_get_exit_status
|
||||
<SUBSECTION>
|
||||
g_application_command_line_print
|
||||
g_application_command_line_printerr
|
||||
<SUBSECTION Standard>
|
||||
G_TYPE_APPLICATION_COMMAND_LINE
|
||||
G_APPLICATION_COMMAND_LINE
|
||||
G_APPLICATION_COMMAND_LINE_CLASS
|
||||
G_IS_APPLICATION_COMMAND_LINE
|
||||
G_IS_APPLICATION_COMMAND_LINE_CLASS
|
||||
G_APPLICATION_COMMAND_LINE_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GApplicationCommandLinePrivate
|
||||
g_application_command_line_get_type
|
||||
</SECTION>
|
||||
|
||||
|
||||
<SECTION>
|
||||
<FILE>gactiongroup</FILE>
|
||||
<TITLE>GActionGroup</TITLE>
|
||||
@ -2697,17 +2738,17 @@ g_action_group_has_action
|
||||
g_action_group_list_actions
|
||||
|
||||
<SUBSECTION>
|
||||
g_action_group_get_enabled
|
||||
g_action_group_get_parameter_type
|
||||
g_action_group_get_state_type
|
||||
g_action_group_get_state_hint
|
||||
g_action_group_get_action_enabled
|
||||
g_action_group_get_action_parameter_type
|
||||
g_action_group_get_action_state_type
|
||||
g_action_group_get_action_state_hint
|
||||
|
||||
<SUBSECTION>
|
||||
g_action_group_get_state
|
||||
g_action_group_set_state
|
||||
g_action_group_get_action_state
|
||||
g_action_group_change_action_state
|
||||
|
||||
<SUBSECTION>
|
||||
g_action_group_activate
|
||||
g_action_group_activate_action
|
||||
|
||||
<SUBSECTION>
|
||||
g_action_group_action_added
|
||||
@ -2720,7 +2761,7 @@ g_action_group_get_type
|
||||
GActionGroupPrivate
|
||||
G_TYPE_ACTION_GROUP
|
||||
G_IS_ACTION_GROUP
|
||||
G_ACTION_GROUP_GET_INTERFACE
|
||||
G_ACTION_GROUP_GET_IFACE
|
||||
G_ACTION_GROUP
|
||||
</SECTION>
|
||||
|
||||
@ -2729,6 +2770,7 @@ G_ACTION_GROUP
|
||||
<TITLE>GAction</TITLE>
|
||||
GAction
|
||||
|
||||
|
||||
<SUBSECTION>
|
||||
g_action_get_name
|
||||
g_action_get_parameter_type
|
||||
@ -2747,7 +2789,7 @@ g_action_activate
|
||||
g_action_get_type
|
||||
G_TYPE_ACTION
|
||||
G_IS_ACTION
|
||||
G_ACTION_GET_INTERFACE
|
||||
G_ACTION_GET_IFACE
|
||||
G_ACTION
|
||||
</SECTION>
|
||||
|
||||
@ -2788,9 +2830,6 @@ g_simple_action_group_lookup
|
||||
g_simple_action_group_insert
|
||||
g_simple_action_group_remove
|
||||
|
||||
<SUBSECTION>
|
||||
g_simple_action_group_set_enabled
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GSimpleActionGroupClass
|
||||
GSimpleActionGroupPrivate
|
||||
@ -2807,7 +2846,7 @@ G_SIMPLE_ACTION_GROUP
|
||||
<FILE>gproxyresolver</FILE>
|
||||
<TITLE>GProxyResolver</TITLE>
|
||||
GProxyResolver
|
||||
GProxyResolverIface
|
||||
GProxyResolverInterface
|
||||
G_PROXY_RESOLVER_EXTENSION_POINT_NAME
|
||||
g_proxy_resolver_get_default
|
||||
g_proxy_resolver_is_supported
|
||||
@ -2850,7 +2889,7 @@ g_proxy_address_get_type
|
||||
<FILE>gproxy</FILE>
|
||||
<TITLE>GProxy</TITLE>
|
||||
GProxy
|
||||
GProxyIface
|
||||
GProxyInterface
|
||||
G_PROXY_EXTENSION_POINT_NAME
|
||||
g_proxy_connect
|
||||
g_proxy_connect_async
|
||||
@ -2865,3 +2904,29 @@ G_TYPE_PROXY
|
||||
<SUBSECTION Private>
|
||||
g_proxy_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gperiodic</FILE>
|
||||
<TITLE>GPeriodic</TITLE>
|
||||
GPeriodic
|
||||
<SUBSECTION>
|
||||
g_periodic_new
|
||||
g_periodic_get_hz
|
||||
g_periodic_get_high_priority
|
||||
g_periodic_get_low_priority
|
||||
<SUBSECTION>
|
||||
GPeriodicTickFunc
|
||||
g_periodic_add
|
||||
g_periodic_remove
|
||||
<SUBSECTION>
|
||||
g_periodic_block
|
||||
g_periodic_unblock
|
||||
<SUBSECTION>
|
||||
g_periodic_damaged
|
||||
<SUBSECTION Standard>
|
||||
G_TYPE_PERIODIC
|
||||
G_PERIODIC
|
||||
G_IS_PERIODIC
|
||||
<SUBSECTION Private>
|
||||
g_periodic_get_type
|
||||
</SECTION>
|
||||
|
@ -23,7 +23,6 @@ g_data_output_stream_get_type
|
||||
g_data_stream_byte_order_get_type
|
||||
g_data_stream_newline_type_get_type
|
||||
g_desktop_app_info_get_type
|
||||
g_desktop_app_info_lookup_get_type
|
||||
g_drive_get_type
|
||||
g_emblem_get_type
|
||||
g_emblem_origin_get_type
|
||||
@ -75,6 +74,7 @@ g_network_service_get_type
|
||||
g_output_stream_get_type
|
||||
g_output_stream_splice_flags_get_type
|
||||
g_password_save_get_type
|
||||
g_periodic_get_type
|
||||
g_permission_get_type
|
||||
g_proxy_address_enumerator_get_type
|
||||
g_proxy_address_get_type
|
||||
|
@ -449,5 +449,69 @@ some-odd-key1 = /apps/myapp/some_ODD-key1
|
||||
script if you are making use of the GConf backend or the conversion
|
||||
utility.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If, as an application developer, you are interested in manually
|
||||
ensuring that <command>gsettings-data-convert</command> has been
|
||||
invoked (for example, to deal with the case where the user is
|
||||
logged in during a distribution upgrade or for non-XDG desktop
|
||||
environments which do not run the command as an autostart) you
|
||||
may invoke it manually during your program initialisation. This
|
||||
is not recommended for all application authors -- it is your
|
||||
choice if this use case concerns you enough.
|
||||
</para>
|
||||
<para>
|
||||
Internally, <command>gsettings-data-convert</command> uses a
|
||||
keyfile to track which settings have been migrated. The
|
||||
following code fragment will check that keyfile to see if your
|
||||
data conversion script has been run yet and, if not, will
|
||||
attempt to invoke the tool to run it. You should adapt it to
|
||||
your application as you see fit.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
static void
|
||||
ensure_migrated (const gchar *name)
|
||||
{
|
||||
gboolean needed = TRUE;
|
||||
GKeyFile *kf;
|
||||
gchar **list;
|
||||
gsize i, n;
|
||||
|
||||
kf = g_key_file_new ();
|
||||
|
||||
g_key_file_load_from_data_dirs (kf, "gsettings-data-convert",
|
||||
NULL, G_KEY_FILE_NONE, NULL);
|
||||
list = g_key_file_get_string_list (kf, "State", "converted", &n, NULL);
|
||||
|
||||
if (list)
|
||||
{
|
||||
for (i = 0; i < n; i++)
|
||||
if (strcmp (list[i], name) == 0)
|
||||
{
|
||||
needed = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
g_strfreev (list);
|
||||
}
|
||||
|
||||
g_key_file_free (kf);
|
||||
|
||||
if (needed)
|
||||
g_spawn_command_line_sync ("gsettings-data-convert",
|
||||
NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Although there is the possibility that the
|
||||
<command>gsettings-data-convert</command> script will end up
|
||||
running multiple times concurrently with this approach, it is
|
||||
believed that this is safe.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
|
@ -76,6 +76,7 @@ synchronize their operation.
|
||||
<xi:include href="xml/checksum.xml" />
|
||||
<xi:include href="xml/i18n.xml" />
|
||||
<xi:include href="xml/date.xml" />
|
||||
<xi:include href="xml/timezone.xml" />
|
||||
<xi:include href="xml/date-time.xml" />
|
||||
<xi:include href="xml/random_numbers.xml" />
|
||||
<xi:include href="xml/hooks.xml" />
|
||||
|
@ -475,6 +475,8 @@ g_main_context_remove_poll
|
||||
g_main_depth
|
||||
g_main_current_source
|
||||
g_main_set_poll_func
|
||||
g_main_context_invoke
|
||||
g_main_context_invoke_full
|
||||
|
||||
<SUBSECTION>
|
||||
g_main_context_get_thread_default
|
||||
@ -533,6 +535,7 @@ GSourceFunc
|
||||
g_source_set_callback_indirect
|
||||
g_source_add_poll
|
||||
g_source_remove_poll
|
||||
g_source_get_time
|
||||
g_source_get_current_time
|
||||
g_source_remove
|
||||
g_source_remove_by_funcs_user_data
|
||||
@ -1317,6 +1320,10 @@ g_time_val_add
|
||||
g_time_val_from_iso8601
|
||||
g_time_val_to_iso8601
|
||||
|
||||
<SUBSECTION>
|
||||
g_get_monotonic_time
|
||||
g_get_real_time
|
||||
|
||||
<SUBSECTION>
|
||||
GDate
|
||||
GTime
|
||||
@ -1407,67 +1414,120 @@ g_date_monday_weeks_in_year
|
||||
g_date_sunday_weeks_in_year
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>timezone</FILE>
|
||||
<SUBSECTION>
|
||||
GTimeZone
|
||||
g_time_zone_unref
|
||||
g_time_zone_ref
|
||||
<SUBSECTION>
|
||||
g_time_zone_new
|
||||
g_time_zone_new_local
|
||||
g_time_zone_new_utc
|
||||
<SUBSECTION>
|
||||
GTimeType
|
||||
g_time_zone_find_interval
|
||||
g_time_zone_adjust_time
|
||||
<SUBSECTION>
|
||||
g_time_zone_get_abbreviation
|
||||
g_time_zone_get_offset
|
||||
g_time_zone_is_dst
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>date-time</FILE>
|
||||
GTimeSpan
|
||||
G_TIME_SPAN_DAY
|
||||
G_TIME_SPAN_HOUR
|
||||
G_TIME_SPAN_MINUTE
|
||||
G_TIME_SPAN_SECOND
|
||||
G_TIME_SPAN_MILLISECONT
|
||||
GTimeSpan
|
||||
G_TIME_SPAN_MILLISECOND
|
||||
|
||||
<SUBSECTION>
|
||||
GDateTime
|
||||
g_date_time_new_full
|
||||
g_date_time_new_from_date
|
||||
g_date_time_new_from_epoch
|
||||
g_date_time_new_from_timeval
|
||||
g_date_time_new_now
|
||||
g_date_time_new_utc_now
|
||||
g_date_time_new_today
|
||||
g_date_time_copy
|
||||
g_date_time_ref
|
||||
g_date_time_unref
|
||||
g_date_time_ref
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_new_now
|
||||
g_date_time_new_now_local
|
||||
g_date_time_new_now_utc
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_new_from_unix_local
|
||||
g_date_time_new_from_unix_utc
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_new_from_timeval_local
|
||||
g_date_time_new_from_timeval_utc
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_new
|
||||
g_date_time_new_local
|
||||
g_date_time_new_utc
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_add
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_add_years
|
||||
g_date_time_add_months
|
||||
g_date_time_add_weeks
|
||||
g_date_time_add_days
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_add_hours
|
||||
g_date_time_add_minutes
|
||||
g_date_time_add_seconds
|
||||
g_date_time_add_milliseconds
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_add_full
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_difference
|
||||
g_date_time_compare
|
||||
g_date_time_equal
|
||||
g_date_time_difference
|
||||
g_date_time_hash
|
||||
g_date_time_equal
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_get_ymd
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_get_dmy
|
||||
g_date_time_get_year
|
||||
g_date_time_get_month
|
||||
g_date_time_get_week_of_year
|
||||
g_date_time_get_day_of_month
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_get_week_numbering_year
|
||||
g_date_time_get_week_of_year
|
||||
g_date_time_get_day_of_week
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_get_day_of_year
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_get_hour
|
||||
g_date_time_get_minute
|
||||
g_date_time_get_second
|
||||
g_date_time_get_millisecond
|
||||
g_date_time_get_microsecond
|
||||
g_date_time_get_julian
|
||||
g_date_time_get_utc_offset
|
||||
g_date_time_get_timezone_name
|
||||
g_date_time_is_daylight_savings
|
||||
g_date_time_is_leap_year
|
||||
g_date_time_get_seconds
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_day
|
||||
g_date_time_to_epoch
|
||||
g_date_time_to_local
|
||||
g_date_time_to_unix
|
||||
g_date_time_to_timeval
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_get_utc_offset
|
||||
g_date_time_get_timezone_abbreviation
|
||||
g_date_time_is_daylight_savings
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_to_timezone
|
||||
g_date_time_to_local
|
||||
g_date_time_to_utc
|
||||
g_date_time_printf
|
||||
|
||||
<SUBSECTION>
|
||||
g_date_time_format
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@ -1537,6 +1597,7 @@ g_get_application_name
|
||||
g_set_application_name
|
||||
g_get_prgname
|
||||
g_set_prgname
|
||||
g_get_environ
|
||||
g_getenv
|
||||
g_setenv
|
||||
g_unsetenv
|
||||
@ -1546,6 +1607,7 @@ g_get_real_name
|
||||
g_get_user_cache_dir
|
||||
g_get_user_data_dir
|
||||
g_get_user_config_dir
|
||||
g_get_user_runtime_dir
|
||||
GUserDirectory
|
||||
g_get_user_special_dir
|
||||
g_get_system_data_dirs
|
||||
@ -1932,6 +1994,7 @@ g_list_remove_link
|
||||
g_list_delete_link
|
||||
g_list_remove_all
|
||||
g_list_free
|
||||
g_list_free_full
|
||||
|
||||
<SUBSECTION>
|
||||
g_list_alloc
|
||||
@ -1988,6 +2051,7 @@ g_slist_remove_link
|
||||
g_slist_delete_link
|
||||
g_slist_remove_all
|
||||
g_slist_free
|
||||
g_slist_free_full
|
||||
g_slist_free_1
|
||||
g_slist_free1
|
||||
|
||||
@ -2952,6 +3016,8 @@ g_variant_get_maybe
|
||||
g_variant_n_children
|
||||
g_variant_get_child_value
|
||||
g_variant_get_child
|
||||
g_variant_lookup_value
|
||||
g_variant_lookup
|
||||
g_variant_get_fixed_array
|
||||
|
||||
<SUBSECTION>
|
||||
|
2
docs/reference/glib/tmpl/.gitignore
vendored
2
docs/reference/glib/tmpl/.gitignore
vendored
@ -8,6 +8,7 @@ checksum.sgml
|
||||
completion.sgml
|
||||
datasets.sgml
|
||||
datalist.sgml
|
||||
date-time.sgml
|
||||
ghostutils.sgml
|
||||
gurifuncs.sgml
|
||||
gvarianttype.sgml
|
||||
@ -31,3 +32,4 @@ threads.sgml
|
||||
trees-binary.sgml
|
||||
trees-nary.sgml
|
||||
timers.sgml
|
||||
timezone.sgml
|
||||
|
@ -52,10 +52,7 @@ representation is valid. Sometimes neither is valid. Use the API.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
GLib doesn't contain any time-manipulation functions; however, there
|
||||
is a #GTime typedef and a #GTimeVal struct which represents a more
|
||||
precise time (with microseconds). You can request the current time as
|
||||
a #GTimeVal with g_get_current_time().
|
||||
GLib also features #GDateTime which represents a precise time.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
@ -84,6 +81,12 @@ Similar to the <structname>struct timeval</structname> returned by
|
||||
the <function>gettimeofday()</function> UNIX call.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
GLib is attempting to unify around the use of 64bit integers to
|
||||
represent microsecond-precision time. As such, this type will be
|
||||
removed from a future version of GLib.
|
||||
</para>
|
||||
|
||||
@tv_sec: seconds
|
||||
@tv_usec: microseconds
|
||||
|
||||
@ -134,6 +137,14 @@ length of the sleep.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### STRUCT GTimeSpec ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tv_sec:
|
||||
@tv_nsec:
|
||||
|
||||
<!-- ##### STRUCT GDate ##### -->
|
||||
<para>
|
||||
Represents a day between January 1, Year 1 and a few thousand years in
|
||||
|
@ -937,46 +937,6 @@ Turns the argument into a string literal by using the '#' stringizing operator.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_binary_age ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glib_check_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@required_major:
|
||||
@required_minor:
|
||||
@required_micro:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### VARIABLE glib_interface_age ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_major_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_micro_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_minor_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO lseek ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -153,6 +153,12 @@ GdkColor *favourite = traveller_get_favourite_colour (traveller);
|
||||
The G_STATIC_ASSERT macro lets the programmer check a condition at compile time,
|
||||
the condition needs to be compile time computable.
|
||||
The macro can be used in any place where a <literal>typedef</literal> is valid.
|
||||
</para>
|
||||
<note><para>
|
||||
A <literal>typedef</literal> is generally allowed in exactly the same
|
||||
places that a variable declaration is allowed. For this reason, you should not use <literal>G_STATIC_ASSERT</literal> in the middle of blocks of code.
|
||||
</para></note>
|
||||
<para>
|
||||
The macro should only be used once per source code line.
|
||||
</para>
|
||||
|
||||
|
@ -117,15 +117,18 @@ documentation.
|
||||
@args: the parameters to insert into the format string.
|
||||
|
||||
|
||||
<!-- ##### MACRO g_message ##### -->
|
||||
<!-- ##### FUNCTION g_message ##### -->
|
||||
<para>
|
||||
A convenience function/macro to log a normal message.
|
||||
</para>
|
||||
|
||||
@format:
|
||||
@Varargs:
|
||||
<!-- # Unused Parameters # -->
|
||||
@...: format string, followed by parameters to insert into the format string (as with printf())
|
||||
|
||||
|
||||
<!-- ##### MACRO g_warning ##### -->
|
||||
<!-- ##### FUNCTION g_warning ##### -->
|
||||
<para>
|
||||
A convenience function/macro to log a warning message.
|
||||
</para>
|
||||
@ -135,10 +138,13 @@ You can make warnings fatal at runtime by setting the %G_DEBUG environment
|
||||
variable (see <ulink url="glib-running.html">Running GLib Applications</ulink>).
|
||||
</para>
|
||||
|
||||
@format:
|
||||
@Varargs:
|
||||
<!-- # Unused Parameters # -->
|
||||
@...: format string, followed by parameters to insert into the format string (as with printf())
|
||||
|
||||
|
||||
<!-- ##### MACRO g_critical ##### -->
|
||||
<!-- ##### FUNCTION g_critical ##### -->
|
||||
<para>
|
||||
Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less
|
||||
application-defined what constitutes a critical vs. a regular
|
||||
@ -153,10 +159,13 @@ the %G_DEBUG environment variable (see
|
||||
<ulink url="glib-running.html">Running GLib Applications</ulink>).
|
||||
</para>
|
||||
|
||||
@format:
|
||||
@Varargs:
|
||||
<!-- # Unused Parameters # -->
|
||||
@...: format string, followed by parameters to insert into the format string (as with printf())
|
||||
|
||||
|
||||
<!-- ##### MACRO g_error ##### -->
|
||||
<!-- ##### FUNCTION g_error ##### -->
|
||||
<para>
|
||||
A convenience function/macro to log an error message.
|
||||
Error messages are always fatal, resulting in a call to
|
||||
@ -166,16 +175,22 @@ expect. Using this function indicates a bug in your program, i.e. an
|
||||
assertion failure.
|
||||
</para>
|
||||
|
||||
@format:
|
||||
@Varargs:
|
||||
<!-- # Unused Parameters # -->
|
||||
@...: format string, followed by parameters to insert into the format string (as with printf())
|
||||
|
||||
|
||||
<!-- ##### MACRO g_debug ##### -->
|
||||
<!-- ##### FUNCTION g_debug ##### -->
|
||||
<para>
|
||||
A convenience function/macro to log a debug message.
|
||||
</para>
|
||||
|
||||
@...: format string, followed by parameters to insert into the format string (as with printf())
|
||||
@format:
|
||||
@Varargs:
|
||||
@Since: 2.6
|
||||
<!-- # Unused Parameters # -->
|
||||
@...: format string, followed by parameters to insert into the format string (as with printf())
|
||||
|
||||
|
||||
<!-- ##### FUNCTION g_log_set_handler ##### -->
|
||||
|
@ -22,6 +22,47 @@ typically use the features described here.
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_major_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_minor_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_micro_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_binary_age ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### VARIABLE glib_interface_age ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glib_check_version ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@required_major:
|
||||
@required_minor:
|
||||
@required_micro:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO GLIB_MAJOR_VERSION ##### -->
|
||||
<para>
|
||||
The major version number of the GLib library.
|
||||
|
@ -40,7 +40,7 @@ GTKDOC_LIBS = \
|
||||
|
||||
# Images to copy into HTML directory
|
||||
HTML_IMAGES = \
|
||||
$(srcdir)/images/glue.png
|
||||
images/glue.png
|
||||
|
||||
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
|
||||
content_files = version.xml \
|
||||
|
@ -244,6 +244,7 @@ G_OBJECT_TYPE_NAME
|
||||
G_OBJECT_CLASS_TYPE
|
||||
G_OBJECT_CLASS_NAME
|
||||
g_object_class_install_property
|
||||
g_object_class_install_properties
|
||||
g_object_class_find_property
|
||||
g_object_class_list_properties
|
||||
g_object_class_override_property
|
||||
@ -256,6 +257,7 @@ GParameter
|
||||
g_object_ref
|
||||
g_object_unref
|
||||
g_object_ref_sink
|
||||
g_clear_object
|
||||
GInitiallyUnowned
|
||||
GInitiallyUnownedClass
|
||||
G_TYPE_INITIALLY_UNOWNED
|
||||
@ -788,6 +790,7 @@ g_signal_remove_emission_hook
|
||||
g_signal_parse_name
|
||||
g_signal_get_invocation_hint
|
||||
g_signal_type_cclosure_new
|
||||
g_signal_accumulator_first_wins
|
||||
g_signal_accumulator_true_handled
|
||||
<SUBSECTION Private>
|
||||
g_signal_handlers_destroy
|
||||
|
@ -8,11 +8,11 @@
|
||||
<para>
|
||||
The two previous chapters discussed the details of GLib's Dynamic Type System
|
||||
and its signal control system. The GObject library also contains an implementation
|
||||
for a base fundamental type named <type><link linkend="GObject">GObject</link></type>.
|
||||
for a base fundamental type named <link linkend="GObject"><type>GObject</type></link>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<type><link linkend="GObject">GObject</link></type> is a fundamental classed instantiable type. It implements:
|
||||
<link linkend="GObject"><type>GObject</type></link> is a fundamental classed instantiable type. It implements:
|
||||
<itemizedlist>
|
||||
<listitem><para>Memory management with reference counting</para></listitem>
|
||||
<listitem><para>Construction/Destruction of instances</para></listitem>
|
||||
@ -20,7 +20,7 @@
|
||||
<listitem><para>Easy use of signals</para></listitem>
|
||||
</itemizedlist>
|
||||
All the GNOME libraries which use the GLib type system (like GTK+ and GStreamer)
|
||||
inherit from <type><link linkend="GObject">GObject</link></type> which is why it is important to understand
|
||||
inherit from <link linkend="GObject"><type>GObject</type></link> which is why it is important to understand
|
||||
the details of how it works.
|
||||
</para>
|
||||
|
||||
@ -97,10 +97,7 @@ maman_bar_constructor (GType gtype,
|
||||
|
||||
{
|
||||
/* Always chain up to the parent constructor */
|
||||
MamanBarClass *klass;
|
||||
GObjectClass *parent_class;
|
||||
parent_class = G_OBJECT_CLASS (maman_bar_parent_class);
|
||||
obj = parent_class->constructor (gtype, n_properties, properties);
|
||||
obj = G_OBJECT_CLASS (maman_bar_parent_class)->constructor (gtype, n_properties, properties);
|
||||
}
|
||||
|
||||
/* update the object state depending on constructor properties */
|
||||
@ -459,7 +456,7 @@ void g_object_run_dispose (GObject *object);
|
||||
<para>
|
||||
This two-step destruction process is very useful to break reference counting cycles.
|
||||
While the detection of the cycles is up to the external code, once the cycles have been
|
||||
detected, the external code can invoke <function><link linkend="g-object-dispose">g_object_dispose</link></function> which
|
||||
detected, the external code can invoke <function><link linkend="g-object-run-dispose">g_object_run_dispose</link></function> which
|
||||
will indeed break any existing cycles since it will run the dispose handler associated
|
||||
to the object and thus release all references to other objects.
|
||||
</para>
|
||||
@ -469,7 +466,7 @@ void g_object_run_dispose (GObject *object);
|
||||
we stated a bit sooner: the dispose handler can be invoked multiple times. Let's say we
|
||||
have a reference count cycle: object A references B which itself references object A.
|
||||
Let's say we have detected the cycle and we want to destroy the two objects. One way to
|
||||
do this would be to invoke <function><link linkend="g-object-dispose">g_object_dispose</link></function> on one of the
|
||||
do this would be to invoke <function><link linkend="g-object-run-dispose">g_object_run_dispose</link></function> on one of the
|
||||
objects.
|
||||
</para>
|
||||
|
||||
@ -644,13 +641,14 @@ g_value_unset (&val);
|
||||
</para>
|
||||
|
||||
<para>
|
||||
After transformation, the <type><link linkend="GValue">GValue</link></type> is validated by
|
||||
After transformation, the <link linkend="GValue"><type>GValue</type></link> is validated by
|
||||
<function><link linkend="g-param-value-validate">g_param_value_validate</link></function> which makes sure the user's
|
||||
data stored in the <type><link linkend="GValue">GValue</link></type> matches the characteristics specified by
|
||||
the property's <type><link linkend="GParamSpec">GParamSpec</link></type>. Here, the <type><link linkend="GParamSpec">GParamSpec</link></type> we
|
||||
data stored in the <link linkend="GValue"><type>GValue</type></link> matches the characteristics specified by
|
||||
the property's <link linkend="GParamSpec"><type>GParamSpec</type></link>.
|
||||
Here, the <link linkend="GParamSpec"><type>GParamSpec</type></link> we
|
||||
provided in class_init has a validation function which makes sure that the GValue
|
||||
contains a value which respects the minimum and maximum bounds of the
|
||||
<type><link linkend="GParamSpec">GParamSpec</link></type>. In the example above, the client's GValue does not
|
||||
<link linkend="GParamSpec"><type>GParamSpec</type></link>. In the example above, the client's GValue does not
|
||||
respect these constraints (it is set to 11, while the maximum is 10). As such, the
|
||||
<function><link linkend="g-object-set-property">g_object_set_property</link></function> function will return with an error.
|
||||
</para>
|
||||
@ -660,11 +658,11 @@ g_value_unset (&val);
|
||||
would have proceeded with calling the object's set_property class method. Here, since our
|
||||
implementation of Foo did override this method, the code path would jump to
|
||||
<function>foo_set_property</function> after having retrieved from the
|
||||
<type><link linkend="GParamSpec">GParamSpec</link></type> the <emphasis>param_id</emphasis>
|
||||
<link linkend="GParamSpec"><type>GParamSpec</type></link> the <emphasis>param_id</emphasis>
|
||||
<footnote>
|
||||
<para>
|
||||
It should be noted that the param_id used here need only to uniquely identify each
|
||||
<type><link linkend="GParamSpec">GParamSpec</link></type> within the <type><link linkend="FooClass">FooClass</link></type> such that the switch
|
||||
<link linkend="GParamSpec"><type>GParamSpec</type></link> within the <link linkend="FooClass"><type>FooClass</type></link> such that the switch
|
||||
used in the set and get methods actually works. Of course, this locally-unique
|
||||
integer is purely an optimization: it would have been possible to use a set of
|
||||
<emphasis>if (strcmp (a, b) == 0) {} else if (strcmp (a, b) == 0) {}</emphasis> statements.
|
||||
|
@ -31,7 +31,7 @@ return_type function_callback (... , gpointer user_data);
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <type><link linkend="GClosure">GClosure</link></type> structure represents the common functionality of all
|
||||
The <link linkend="GClosure"><type>GClosure</type></link> structure represents the common functionality of all
|
||||
closure implementations: there exists a different Closure implementation for
|
||||
each separate runtime which wants to use the GObject type system.
|
||||
<footnote><para>
|
||||
@ -42,11 +42,11 @@ return_type function_callback (... , gpointer user_data);
|
||||
it behaves as a normal C object for GTK+ and as a normal Python object for
|
||||
Python code.
|
||||
</para></footnote>
|
||||
The GObject library provides a simple <type><link linkend="GCClosure">GCClosure</link></type> type which
|
||||
The GObject library provides a simple <link linkend="GCClosure"><type>GCClosure</type></link> type which
|
||||
is a specific implementation of closures to be used with C/C++ callbacks.
|
||||
</para>
|
||||
<para>
|
||||
A <type><link linkend="GClosure">GClosure</link></type> provides simple services:
|
||||
A <link linkend="GClosure"><type>GClosure</type></link> provides simple services:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Invocation (<function><link linkend="g-closure-invoke">g_closure_invoke</link></function>): this is what closures
|
||||
@ -77,7 +77,7 @@ return_type function_callback (... , gpointer user_data);
|
||||
|
||||
<para>
|
||||
If you are using C or C++
|
||||
to connect a callback to a given event, you will either use simple <type><link linkend="GCClosure">GCClosure</link></type>s
|
||||
to connect a callback to a given event, you will either use simple <link linkend="GCClosure"><type>GCClosure</type></link>s
|
||||
which have a pretty minimal API or the even simpler <function><link linkend="g-signal-connect">g_signal_connect</link></function>
|
||||
functions (which will be presented a bit later :).
|
||||
<programlisting>
|
||||
@ -432,7 +432,7 @@ void g_signal_emitv (const GValue *instance_and_params,
|
||||
|
||||
<para>
|
||||
Of the three main connection functions,
|
||||
only one has an explicit detail parameter as a <type><link linkend="GQuark">GQuark</link></type>
|
||||
only one has an explicit detail parameter as a <link linkend="GQuark"><type>GQuark</type></link>
|
||||
<footnote>
|
||||
<para>A GQuark is an integer which uniquely represents a string. It is possible to transform
|
||||
back and forth between the integer and string representations with the functions
|
||||
@ -469,7 +469,7 @@ gulong g_signal_connect_data (gpointer instance,
|
||||
|
||||
<para>
|
||||
Of the four main signal emission functions, three have an explicit detail parameter as a
|
||||
<type><link linkend="GQuark">GQuark</link></type> again:
|
||||
<link linkend="GQuark"><type>GQuark</type></link> again:
|
||||
<programlisting>
|
||||
void g_signal_emitv (const GValue *instance_and_params,
|
||||
guint signal_id,
|
||||
|
@ -49,7 +49,7 @@ GType g_type_register_fundamental (GType type_id,
|
||||
<function><link linkend="g-type-register-fundamental">g_type_register_fundamental</link></function>
|
||||
are the C functions, defined in
|
||||
<filename>gtype.h</filename> and implemented in <filename>gtype.c</filename>
|
||||
which you should use to register a new <type><link linkend="GType">GType</link></type> in the program's type system.
|
||||
which you should use to register a new <link linkend="GType"><type>GType</type></link> in the program's type system.
|
||||
It is not likely you will ever need to use
|
||||
<function><link linkend="g-type-register-fundamental">g_type_register_fundamental</link></function> (you have to be Tim Janik
|
||||
to do that) but in case you want to, the last chapter explains how to create
|
||||
@ -77,34 +77,34 @@ GType g_type_register_fundamental (GType type_id,
|
||||
Fundamental and non-fundamental types are defined by:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
class size: the class_size field in <type><link linkend="GTypeInfo">GTypeInfo</link></type>.
|
||||
class size: the class_size field in <link linkend="GTypeInfo"><type>GTypeInfo</type></link>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
class initialization functions (C++ constructor): the base_init and
|
||||
class_init fields in <type><link linkend="GTypeInfo">GTypeInfo</link></type>.
|
||||
class_init fields in <link linkend="GTypeInfo"><type>GTypeInfo</type></link>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
class destruction functions (C++ destructor): the base_finalize and
|
||||
class_finalize fields in <type><link linkend="GTypeInfo">GTypeInfo</link></type>.
|
||||
class_finalize fields in <link linkend="GTypeInfo"><type>GTypeInfo</type></link>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
instance size (C++ parameter to new): the instance_size field in
|
||||
<type><link linkend="GTypeInfo">GTypeInfo</link></type>.
|
||||
<link linkend="GTypeInfo"><type>GTypeInfo</type></link>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
instantiation policy (C++ type of new operator): the n_preallocs
|
||||
field in <type><link linkend="GTypeInfo">GTypeInfo</link></type>.
|
||||
field in <link linkend="GTypeInfo"><type>GTypeInfo</type></link>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
copy functions (C++ copy operators): the value_table field in
|
||||
<type><link linkend="GTypeInfo">GTypeInfo</link></type>.
|
||||
<link linkend="GTypeInfo"><type>GTypeInfo</type></link>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
type characteristic flags: <type><link linkend="GTypeFlags">GTypeFlags</link></type>.
|
||||
type characteristic flags: <link linkend="GTypeFlags"><type>GTypeFlags</type></link>.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
Fundamental types are also defined by a set of <type><link linkend="GTypeFundamentalFlags">GTypeFundamentalFlags</link></type>
|
||||
which are stored in a <type><link linkend="GTypeFundamentalInfo">GTypeFundamentalInfo</link></type>.
|
||||
Fundamental types are also defined by a set of <link linkend="GTypeFundamentalFlags"><type>GTypeFundamentalFlags</type></link>
|
||||
which are stored in a <link linkend="GTypeFundamentalInfo"><type>GTypeFundamentalInfo</type></link>.
|
||||
Non-fundamental types are furthermore defined by the type of their parent which is
|
||||
passed as the parent_type parameter to <function><link linkend="g-type-register-static">g_type_register_static</link></function>
|
||||
and <function><link linkend="g-type-register-dynamic">g_type_register_dynamic</link></function>.
|
||||
@ -120,17 +120,17 @@ GType g_type_register_fundamental (GType type_id,
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <type><link linkend="GValue">GValue</link></type> structure is used as an abstract container for all of these
|
||||
The <link linkend="GValue"><type>GValue</type></link> structure is used as an abstract container for all of these
|
||||
types. Its simplistic API (defined in <filename>gobject/gvalue.h</filename>) can be
|
||||
used to invoke the value_table functions registered
|
||||
during type registration: for example <function><link linkend="g-value-copy">g_value_copy</link></function> copies the
|
||||
content of a <type><link linkend="GValue">GValue</link></type> to another <type><link linkend="GValue">GValue</link></type>. This is similar
|
||||
content of a <link linkend="GValue"><type>GValue</type></link> to another <link linkend="GValue"><type>GValue</type></link>. This is similar
|
||||
to a C++ assignment which invokes the C++ copy operator to modify the default
|
||||
bit-by-bit copy semantics of C++/C structures/classes.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following code shows how you can copy around a 64 bit integer, as well as a <type><link linkend="GObject">GObject</link></type>
|
||||
The following code shows how you can copy around a 64 bit integer, as well as a <link linkend="GObject"><type>GObject</type></link>
|
||||
instance pointer (sample code for this is located in the source tarball for this document in
|
||||
<filename>sample/gtype/test.c</filename>):
|
||||
<programlisting>
|
||||
@ -342,7 +342,7 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT)
|
||||
|
||||
<para>
|
||||
To register such a type in the type system, you just need to fill the
|
||||
<type><link linkend="GTypeInfo">GTypeInfo</link></type> structure with zeros since these types are also most of the time
|
||||
<link linkend="GTypeInfo"><type>GTypeInfo</type></link> structure with zeros since these types are also most of the time
|
||||
fundamental:
|
||||
<programlisting>
|
||||
GTypeInfo info = {
|
||||
@ -376,9 +376,9 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT)
|
||||
<para>
|
||||
Having non-instantiable types might seem a bit useless: what good is a type
|
||||
if you cannot instantiate an instance of that type ? Most of these types
|
||||
are used in conjunction with <type><link linkend="GValue">GValue</link></type>s: a GValue is initialized
|
||||
are used in conjunction with <link linkend="GValue"><type>GValue</type></link>s: a GValue is initialized
|
||||
with an integer or a string and it is passed around by using the registered
|
||||
type's value_table. <type><link linkend="GValue">GValue</link></type>s (and by extension these trivial fundamental
|
||||
type's value_table. <link linkend="GValue"><type>GValue</type></link>s (and by extension these trivial fundamental
|
||||
types) are most useful when used in conjunction with object properties and signals.
|
||||
</para>
|
||||
|
||||
@ -390,7 +390,7 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT)
|
||||
<para>
|
||||
Types which are registered with a class and are declared instantiable are
|
||||
what most closely resembles an <emphasis>object</emphasis>.
|
||||
Although <type><link linkend="GObject">GObject</link></type>s (detailed in <xref linkend="chapter-gobject"/>)
|
||||
Although <link linkend="GObject"><type>GObject</type></link>s (detailed in <xref linkend="chapter-gobject"/>)
|
||||
are the most well known type of instantiable
|
||||
classed types, other kinds of similar objects used as the base of an inheritance
|
||||
hierarchy have been externally developed and they are all built on the fundamental
|
||||
@ -448,8 +448,8 @@ maman_bar_get_type (void)
|
||||
<para>
|
||||
Every object must define two structures: its class structure and its
|
||||
instance structure. All class structures must contain as first member
|
||||
a <type><link linkend="GTypeClass">GTypeClass</link></type> structure. All instance structures must contain as first
|
||||
member a <type><link linkend="GTypeInstance">GTypeInstance</link></type> structure. The declaration of these C types,
|
||||
a <link linkend="GTypeClass"><type>GTypeClass</type></link> structure. All instance structures must contain as first
|
||||
member a <link linkend="GTypeInstance"><type>GTypeInstance</type></link> structure. The declaration of these C types,
|
||||
coming from <filename>gtype.h</filename> is shown below:
|
||||
<programlisting>
|
||||
struct _GTypeClass
|
||||
@ -537,9 +537,9 @@ void g_type_free_instance (GTypeInstance *instance);
|
||||
a class structure: it allocates a buffer to hold the object's class structure and
|
||||
initializes it. It first copies the parent's class structure over this structure
|
||||
(if there is no parent, it initializes it to zero). It then invokes the
|
||||
base_class_initialization functions (<type><link linkend="GBaseInitFunc">GBaseInitFunc</link></type>) from topmost
|
||||
base_class_initialization functions (<link linkend="GBaseInitFunc"><type>GBaseInitFunc</type></link>) from topmost
|
||||
fundamental object to bottom-most most derived object. The object's class_init
|
||||
(<type><link linkend="GClassInitFunc">GClassInitFunc</link></type>) function is invoked afterwards to complete
|
||||
(<link linkend="GClassInitFunc"><type>GClassInitFunc</type></link>) function is invoked afterwards to complete
|
||||
initialization of the class structure.
|
||||
Finally, the object's interfaces are initialized (we will discuss interface initialization
|
||||
in more detail later).
|
||||
@ -548,7 +548,7 @@ void g_type_free_instance (GTypeInstance *instance);
|
||||
<para>
|
||||
Once the type system has a pointer to an initialized class structure, it sets the object's
|
||||
instance class pointer to the object's class structure and invokes the object's
|
||||
instance_init (<type><link linkend="GInstanceInitFunc">GInstanceInitFunc</link></type>)functions, from top-most fundamental
|
||||
instance_init (<link linkend="GInstanceInitFunc"><type>GInstanceInitFunc</type></link>)functions, from top-most fundamental
|
||||
type to bottom-most most derived type.
|
||||
</para>
|
||||
|
||||
@ -564,8 +564,8 @@ void g_type_free_instance (GTypeInstance *instance);
|
||||
referred to as finalization in GType) is the symmetric process of
|
||||
the initialization: interfaces are destroyed first.
|
||||
Then, the most derived
|
||||
class_finalize (<type><link linkend="ClassFinalizeFunc">ClassFinalizeFunc</link></type>) function is invoked. The
|
||||
base_class_finalize (<type><link linkend="GBaseFinalizeFunc">GBaseFinalizeFunc</link></type>) functions are
|
||||
class_finalize (<link linkend="ClassFinalizeFunc"><type>ClassFinalizeFunc</type></link>) function is invoked. The
|
||||
base_class_finalize (<link linkend="GBaseFinalizeFunc"><type>GBaseFinalizeFunc</type></link>) functions are
|
||||
Finally invoked from bottom-most most-derived type to top-most fundamental type and
|
||||
the class structure is freed.
|
||||
</para>
|
||||
@ -659,12 +659,12 @@ void g_type_free_instance (GTypeInstance *instance);
|
||||
control your CD player, MP3 player or anything that uses these symbols.
|
||||
To declare an interface you have to register a non-instantiable
|
||||
classed type which derives from
|
||||
<type><link linkend="GTypeInterface">GTypeInterface</link></type>. The following piece of code declares such an interface.
|
||||
<link linkend="GTypeInterface"><type>GTypeInterface</type></link>. The following piece of code declares such an interface.
|
||||
<programlisting>
|
||||
#define MAMAN_IBAZ_TYPE (maman_ibaz_get_type ())
|
||||
#define MAMAN_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_IBAZ_TYPE, MamanIbaz))
|
||||
#define MAMAN_IS_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_IBAZ_TYPE))
|
||||
#define MAMAN_IBAZ_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), MAMAN_IBAZ_TYPE, MamanIbazInterface))
|
||||
#define MAMAN_TYPE_IBAZ (maman_ibaz_get_type ())
|
||||
#define MAMAN_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_IBAZ, MamanIbaz))
|
||||
#define MAMAN_IS_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_IBAZ))
|
||||
#define MAMAN_IBAZ_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), MAMAN_TYPE_IBAZ, MamanIbazInterface))
|
||||
|
||||
typedef struct _MamanIbaz MamanIbaz; /* dummy object */
|
||||
typedef struct _MamanIbazInterface MamanIbazInterface;
|
||||
@ -694,7 +694,7 @@ void maman_ibaz_do_action (MamanIbaz *self)
|
||||
|
||||
<para>
|
||||
An interface is defined by only one structure which must contain as first member
|
||||
a <type><link linkend="GTypeInterface">GTypeInterface</link></type> structure. The interface structure is expected to
|
||||
a <link linkend="GTypeInterface"><type>GTypeInterface</type></link> structure. The interface structure is expected to
|
||||
contain the function pointers of the interface methods. It is good style to
|
||||
define helper functions for each of the interface methods which simply call
|
||||
the interface' method directly: <function>maman_ibaz_do_action</function>
|
||||
@ -704,7 +704,7 @@ void maman_ibaz_do_action (MamanIbaz *self)
|
||||
<para>
|
||||
Once an interface type is registered, you must register implementations for these
|
||||
interfaces. The function named <function>maman_baz_get_type</function> registers
|
||||
a new GType named MamanBaz which inherits from <type><link linkend="GObject">GObject</link></type> and which
|
||||
a new GType named MamanBaz which inherits from <link linkend="GObject"><type>GObject</type></link> and which
|
||||
implements the interface <type>MamanIBaz</type>.
|
||||
<programlisting>
|
||||
static void maman_baz_do_action (MamanIbaz *self)
|
||||
@ -746,7 +746,7 @@ maman_baz_get_type (void)
|
||||
"MamanBazType",
|
||||
&info, 0);
|
||||
g_type_add_interface_static (type,
|
||||
MAMAN_IBAZ_TYPE,
|
||||
MAMAN_TYPE_IBAZ,
|
||||
&ibaz_info);
|
||||
}
|
||||
return type;
|
||||
@ -759,7 +759,7 @@ maman_baz_get_type (void)
|
||||
a given type implements also <type>FooInterface</type>
|
||||
(<function>foo_interface_get_type</function> returns the type of
|
||||
<type>FooInterface</type>).
|
||||
The <type><link linkend="GInterfaceInfo">GInterfaceInfo</link></type> structure holds
|
||||
The <link linkend="GInterfaceInfo"><type>GInterfaceInfo</type></link> structure holds
|
||||
information about the implementation of the interface:
|
||||
<programlisting>
|
||||
struct _GInterfaceInfo
|
||||
|
@ -57,8 +57,8 @@
|
||||
<filename>mamanbar.h</filename> and <filename>mamanbar.c</filename>.
|
||||
(this is the convention used by GTK+)</para></listitem>
|
||||
</itemizedlist>
|
||||
I personally like the first solution better: it makes reading file names
|
||||
easier for those with poor eyesight like me.
|
||||
Some people like the first two solutions better: it makes reading file
|
||||
names easier for those with poor eyesight.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -339,26 +339,26 @@ maman_bar_init (MamanBar *self)
|
||||
Now, if you need special construction properties, install the properties in the class_init function,
|
||||
override the set and get methods and implement the get and set methods as described in
|
||||
<xref linkend="gobject-properties"/>. Make sure that these properties use a construct only
|
||||
<type><link linkend="GParamSpec">GParamSpec</link></type> by setting the param spec's flag field to G_PARAM_CONSTRUCT_ONLY: this helps
|
||||
<link linkend="GParamSpec"><type>GParamSpec</type></link> by setting the param spec's flag field to G_PARAM_CONSTRUCT_ONLY: this helps
|
||||
GType ensure that these properties are not set again later by malicious user code.
|
||||
<programlisting>
|
||||
static void
|
||||
bar_class_init (MamanBarClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *maman_param_spec;
|
||||
GParamSpec *pspec;
|
||||
|
||||
gobject_class->set_property = bar_set_property;
|
||||
gobject_class->get_property = bar_get_property;
|
||||
|
||||
maman_param_spec = g_param_spec_string ("maman",
|
||||
pspec = g_param_spec_string ("maman",
|
||||
"Maman construct prop",
|
||||
"Set maman's name",
|
||||
"no-name-set" /* default value */,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MAMAN,
|
||||
maman_param_spec);
|
||||
pspec);
|
||||
}
|
||||
</programlisting>
|
||||
If you need this, make sure you can build and run code similar to the code shown above. Make sure
|
||||
@ -820,8 +820,8 @@ void maman_ibaz_do_action (MamanIbaz *self);
|
||||
|
||||
#endif /* __MAMAN_IBAZ_H__ */
|
||||
</programlisting>
|
||||
This code is the same as the code for a normal <type><link linkend="GType">GType</link></type>
|
||||
which derives from a <type><link linkend="GObject">GObject</link></type> except for a few details:
|
||||
This code is the same as the code for a normal <link linkend="GType"><type>GType</type></link>
|
||||
which derives from a <link linkend="GObject"><type>GObject</type></link> except for a few details:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
The <function>_GET_CLASS</function> macro is called <function>_GET_INTERFACE</function>
|
||||
@ -1652,7 +1652,7 @@ klass->write_signal_id =
|
||||
Usually, the <function><link linkend="g-signal-new">g_signal_new</link></function> function is preferred over
|
||||
<function><link linkend="g-signal-newv">g_signal_newv</link></function>. When <function><link linkend="g-signal-new">g_signal_new</link></function>
|
||||
is used, the default closure is exported as a class function. For example,
|
||||
<filename>gobject.h</filename> contains the declaration of <type><link linkend="GObjectClass">GObjectClass</link></type>
|
||||
<filename>gobject.h</filename> contains the declaration of <link linkend="GObjectClass"><type>GObjectClass</type></link>
|
||||
whose notify class function is the default handler for the <emphasis>notify</emphasis>
|
||||
signal:
|
||||
<programlisting>
|
||||
@ -1693,7 +1693,7 @@ g_object_do_class_init (GObjectClass *class)
|
||||
1, G_TYPE_PARAM);
|
||||
}
|
||||
</programlisting>
|
||||
<function><link linkend="g-signal-new">g_signal_new</link></function> creates a <type><link linkend="GClosure">GClosure</link></type> which dereferences the
|
||||
<function><link linkend="g-signal-new">g_signal_new</link></function> creates a <link linkend="GClosure"><type>GClosure</type></link> which dereferences the
|
||||
type's class structure to access the class function pointer and invoke it if it not NULL. The
|
||||
class function is ignored it is set to NULL.
|
||||
</para>
|
||||
|
@ -124,9 +124,9 @@ gtk_widget_freeze_child_notify (GtkWidget *widget)
|
||||
</para>
|
||||
<para>
|
||||
Thorough
|
||||
<ulink url="http://developer.gnome.org/arch/doc/authors.html">documentation</ulink>
|
||||
on how to set up and use gtk-doc in your
|
||||
project is provided on the GNOME developer website.
|
||||
<ulink url="http://library.gnome.org/devel/gtk-doc-manual/stable/">documentation</ulink>
|
||||
on how to set up and use gtk-doc in your project is provided on the
|
||||
<ulink url="http://library.gnome.org/devel/">GNOME developer website</ulink>.
|
||||
</para>
|
||||
</chapter>
|
||||
</part>
|
||||
|
@ -139,13 +139,17 @@ application_headers = \
|
||||
gsimpleactiongroup.h \
|
||||
gaction.h \
|
||||
gsimpleaction.h \
|
||||
gapplicationcommandline.h \
|
||||
gapplication.h
|
||||
|
||||
application_sources = \
|
||||
gactiongroup.c \
|
||||
gsimpleactiongroup.c \
|
||||
gaction.c \
|
||||
gsimpleaction.c \
|
||||
gactiongroup.c \
|
||||
gsimpleactiongroup.c \
|
||||
gaction.c \
|
||||
gsimpleaction.c \
|
||||
gapplicationcommandline.c \
|
||||
gapplicationimpl.h \
|
||||
gapplicationimpl-dbus.c \
|
||||
gapplication.c
|
||||
|
||||
local_sources = \
|
||||
@ -343,6 +347,7 @@ libgio_2_0_la_SOURCES = \
|
||||
gnetworkingprivate.h \
|
||||
gnetworkservice.c \
|
||||
goutputstream.c \
|
||||
gperiodic.c \
|
||||
gpermission.c \
|
||||
gpollfilemonitor.c \
|
||||
gpollfilemonitor.h \
|
||||
@ -395,7 +400,7 @@ libgio_2_0_la_SOURCES = \
|
||||
$(marshal_sources) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST += gnullapplication.c gdbusapplication.c strinfo.c
|
||||
EXTRA_DIST += strinfo.c
|
||||
|
||||
$(libgio_2_0_la_OBJECTS): $(marshal_sources)
|
||||
|
||||
@ -498,6 +503,7 @@ gio_headers = \
|
||||
gnetworkaddress.h \
|
||||
gnetworkservice.h \
|
||||
goutputstream.h \
|
||||
gperiodic.h \
|
||||
gpermission.h \
|
||||
gproxyaddress.h \
|
||||
gproxy.h \
|
||||
|
@ -70,7 +70,7 @@ g_action_default_init (GActionInterface *iface)
|
||||
* The name of the action. This is mostly meaningful for identifying
|
||||
* the action once it has been added to a #GActionGroup.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_string ("name",
|
||||
@ -86,7 +86,7 @@ g_action_default_init (GActionInterface *iface)
|
||||
* The type of the parameter that must be given when activating the
|
||||
* action.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_boxed ("parameter-type",
|
||||
@ -104,7 +104,7 @@ g_action_default_init (GActionInterface *iface)
|
||||
* If the action is disabled then calls to g_action_activate() and
|
||||
* g_action_set_state() have no effect.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_boolean ("enabled",
|
||||
@ -120,7 +120,7 @@ g_action_default_init (GActionInterface *iface)
|
||||
* The #GVariantType of the state that the action has, or %NULL if the
|
||||
* action is stateless.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_boxed ("state-type",
|
||||
@ -135,7 +135,7 @@ g_action_default_init (GActionInterface *iface)
|
||||
*
|
||||
* The state of the action, or %NULL if the action is stateless.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_variant ("state",
|
||||
@ -164,7 +164,7 @@ g_action_default_init (GActionInterface *iface)
|
||||
*
|
||||
* If the @value GVariant is floating, it is consumed.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_set_state (GAction *action,
|
||||
@ -199,9 +199,9 @@ g_action_set_state (GAction *action,
|
||||
* The return value (if non-%NULL) should be freed with
|
||||
* g_variant_unref() when it is no longer required.
|
||||
*
|
||||
* Returns: (allow-none): the current state of the action
|
||||
* Returns: (transfer full): the current state of the action
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
GVariant *
|
||||
g_action_get_state (GAction *action)
|
||||
@ -220,7 +220,7 @@ g_action_get_state (GAction *action)
|
||||
*
|
||||
* Returns: the name of the action
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
const gchar *
|
||||
g_action_get_name (GAction *action)
|
||||
@ -246,7 +246,7 @@ g_action_get_name (GAction *action)
|
||||
*
|
||||
* Returns: (allow-none): the parameter type
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
const GVariantType *
|
||||
g_action_get_parameter_type (GAction *action)
|
||||
@ -276,7 +276,7 @@ g_action_get_parameter_type (GAction *action)
|
||||
*
|
||||
* Returns: (allow-none): the state type, if the action is stateful
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
const GVariantType *
|
||||
g_action_get_state_type (GAction *action)
|
||||
@ -310,9 +310,9 @@ g_action_get_state_type (GAction *action)
|
||||
* The return value (if non-%NULL) should be freed with
|
||||
* g_variant_unref() when it is no longer required.
|
||||
*
|
||||
* Returns: (allow-none): the state range hint
|
||||
* Returns: (transfer full): the state range hint
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
GVariant *
|
||||
g_action_get_state_hint (GAction *action)
|
||||
@ -334,7 +334,7 @@ g_action_get_state_hint (GAction *action)
|
||||
*
|
||||
* Returns: whether the action is enabled
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
gboolean
|
||||
g_action_get_enabled (GAction *action)
|
||||
@ -356,7 +356,7 @@ g_action_get_enabled (GAction *action)
|
||||
* the parameter type given at construction time). If the parameter
|
||||
* type was %NULL then @parameter must also be %NULL.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_activate (GAction *action,
|
||||
|
@ -66,7 +66,7 @@ struct _GActionInterface
|
||||
gboolean (* get_enabled) (GAction *action);
|
||||
GVariant * (* get_state) (GAction *action);
|
||||
void (* set_state) (GAction *action,
|
||||
GVariant *state);
|
||||
GVariant *value);
|
||||
|
||||
void (* activate) (GAction *action,
|
||||
GVariant *parameter);
|
||||
|
@ -72,7 +72,7 @@ g_action_group_default_init (GActionGroupInterface *class)
|
||||
* Signals that a new action was just added to the group. This signal
|
||||
* is emitted after the action has been added and is now visible.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_action_group_signals[SIGNAL_ACTION_ADDED] =
|
||||
g_signal_new (I_("action-added"),
|
||||
@ -93,7 +93,7 @@ g_action_group_default_init (GActionGroupInterface *class)
|
||||
* This signal is emitted before the action is removed, so the action
|
||||
* is still visible and can be queried from the signal handler.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_action_group_signals[SIGNAL_ACTION_REMOVED] =
|
||||
g_signal_new (I_("action-removed"),
|
||||
@ -114,7 +114,7 @@ g_action_group_default_init (GActionGroupInterface *class)
|
||||
*
|
||||
* Signals that the enabled status of the named action has changed.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_action_group_signals[SIGNAL_ACTION_ENABLED_CHANGED] =
|
||||
g_signal_new (I_("action-enabled-changed"),
|
||||
@ -136,7 +136,7 @@ g_action_group_default_init (GActionGroupInterface *class)
|
||||
*
|
||||
* Signals that the state of the named action has changed.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
g_action_group_signals[SIGNAL_ACTION_STATE_CHANGED] =
|
||||
g_signal_new (I_("action-state-changed"),
|
||||
@ -160,9 +160,10 @@ g_action_group_default_init (GActionGroupInterface *class)
|
||||
* The caller is responsible for freeing the list with g_strfreev() when
|
||||
* it is no longer required.
|
||||
*
|
||||
* Returns: a %NULL-terminated array of the names of the actions in the group
|
||||
* Returns: (transfer full): a %NULL-terminated array of the names of the
|
||||
* actions in the groupb
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
gchar **
|
||||
g_action_group_list_actions (GActionGroup *action_group)
|
||||
@ -182,7 +183,7 @@ g_action_group_list_actions (GActionGroup *action_group)
|
||||
*
|
||||
* Returns: whether the named action exists
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
gboolean
|
||||
g_action_group_has_action (GActionGroup *action_group,
|
||||
@ -195,7 +196,7 @@ g_action_group_has_action (GActionGroup *action_group,
|
||||
}
|
||||
|
||||
/**
|
||||
* g_action_group_get_parameter_type:
|
||||
* g_action_group_get_action_parameter_type:
|
||||
* @action_group: a #GActionGroup
|
||||
* @action_name: the name of the action to query
|
||||
*
|
||||
@ -215,20 +216,20 @@ g_action_group_has_action (GActionGroup *action_group,
|
||||
*
|
||||
* Return value: the parameter type
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
const GVariantType *
|
||||
g_action_group_get_parameter_type (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
g_action_group_get_action_parameter_type (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
return G_ACTION_GROUP_GET_IFACE (action_group)
|
||||
->get_parameter_type (action_group, action_name);
|
||||
->get_action_parameter_type (action_group, action_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_action_group_get_state_type:
|
||||
* g_action_group_get_action_state_type:
|
||||
* @action_group: a #GActionGroup
|
||||
* @action_name: the name of the action to query
|
||||
*
|
||||
@ -248,22 +249,22 @@ g_action_group_get_parameter_type (GActionGroup *action_group,
|
||||
* possible for an action to be removed and for a new action to be added
|
||||
* with the same name but a different state type.
|
||||
*
|
||||
* Returns: (allow-none): the state type, if the action is stateful
|
||||
* Returns: (transfer full): the state type, if the action is stateful
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
const GVariantType *
|
||||
g_action_group_get_state_type (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
g_action_group_get_action_state_type (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
return G_ACTION_GROUP_GET_IFACE (action_group)
|
||||
->get_state_type (action_group, action_name);
|
||||
->get_action_state_type (action_group, action_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_action_group_get_state_hint:
|
||||
* g_action_group_get_action_state_hint:
|
||||
* @action_group: a #GActionGroup
|
||||
* @action_name: the name of the action to query
|
||||
*
|
||||
@ -286,22 +287,22 @@ g_action_group_get_state_type (GActionGroup *action_group,
|
||||
* The return value (if non-%NULL) should be freed with
|
||||
* g_variant_unref() when it is no longer required.
|
||||
*
|
||||
* Return value: the state range hint
|
||||
* Return value: (transfer full): the state range hint
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
GVariant *
|
||||
g_action_group_get_state_hint (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
g_action_group_get_action_state_hint (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
return G_ACTION_GROUP_GET_IFACE (action_group)
|
||||
->get_state_hint (action_group, action_name);
|
||||
->get_action_state_hint (action_group, action_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_action_group_get_enabled:
|
||||
* g_action_group_get_action_enabled:
|
||||
* @action_group: a #GActionGroup
|
||||
* @action_name: the name of the action to query
|
||||
*
|
||||
@ -312,20 +313,20 @@ g_action_group_get_state_hint (GActionGroup *action_group,
|
||||
*
|
||||
* Return value: whether or not the action is currently enabled
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
gboolean
|
||||
g_action_group_get_enabled (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
g_action_group_get_action_enabled (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), FALSE);
|
||||
|
||||
return G_ACTION_GROUP_GET_IFACE (action_group)
|
||||
->get_enabled (action_group, action_name);
|
||||
->get_action_enabled (action_group, action_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_action_group_get_state:
|
||||
* g_action_group_get_action_state:
|
||||
* @action_group: a #GActionGroup
|
||||
* @action_name: the name of the action to query
|
||||
*
|
||||
@ -340,20 +341,20 @@ g_action_group_get_enabled (GActionGroup *action_group,
|
||||
*
|
||||
* Return value: (allow-none): the current state of the action
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
GVariant *
|
||||
g_action_group_get_state (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
g_action_group_get_action_state (GActionGroup *action_group,
|
||||
const gchar *action_name)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
return G_ACTION_GROUP_GET_IFACE (action_group)
|
||||
->get_state (action_group, action_name);
|
||||
->get_action_state (action_group, action_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_action_group_set_state:
|
||||
* g_action_group_change_action_state:
|
||||
* @action_group: a #GActionGroup
|
||||
* @action_name: the name of the action to request the change on
|
||||
* @value: the new state
|
||||
@ -370,23 +371,23 @@ g_action_group_get_state (GActionGroup *action_group,
|
||||
*
|
||||
* If the @value GVariant is floating, it is consumed.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_group_set_state (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value)
|
||||
g_action_group_change_action_state (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value)
|
||||
{
|
||||
g_return_if_fail (G_IS_ACTION_GROUP (action_group));
|
||||
g_return_if_fail (action_name != NULL);
|
||||
g_return_if_fail (value != NULL);
|
||||
|
||||
G_ACTION_GROUP_GET_IFACE (action_group)
|
||||
->set_state (action_group, action_name, value);
|
||||
->change_action_state (action_group, action_name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_action_group_activate:
|
||||
* g_action_group_activate_action:
|
||||
* @action_group: a #GActionGroup
|
||||
* @action_name: the name of the action to activate
|
||||
* @parameter: (allow-none): parameters to the activation
|
||||
@ -398,18 +399,18 @@ g_action_group_set_state (GActionGroup *action_group,
|
||||
* parameters then @parameter must be %NULL. See
|
||||
* g_action_group_get_parameter_type().
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_group_activate (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter)
|
||||
g_action_group_activate_action (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter)
|
||||
{
|
||||
g_return_if_fail (G_IS_ACTION_GROUP (action_group));
|
||||
g_return_if_fail (action_name != NULL);
|
||||
|
||||
G_ACTION_GROUP_GET_IFACE (action_group)
|
||||
->activate (action_group, action_name, parameter);
|
||||
->activate_action (action_group, action_name, parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,7 +422,7 @@ g_action_group_activate (GActionGroup *action_group,
|
||||
*
|
||||
* This function should only be called by #GActionGroup implementations.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_group_action_added (GActionGroup *action_group,
|
||||
@ -445,7 +446,7 @@ g_action_group_action_added (GActionGroup *action_group,
|
||||
*
|
||||
* This function should only be called by #GActionGroup implementations.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_group_action_removed (GActionGroup *action_group,
|
||||
@ -470,7 +471,7 @@ g_action_group_action_removed (GActionGroup *action_group,
|
||||
*
|
||||
* This function should only be called by #GActionGroup implementations.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_group_action_enabled_changed (GActionGroup *action_group,
|
||||
@ -499,7 +500,7 @@ g_action_group_action_enabled_changed (GActionGroup *action_group,
|
||||
*
|
||||
* This function should only be called by #GActionGroup implementations.
|
||||
*
|
||||
* Since: 2.26
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_action_group_action_state_changed (GActionGroup *action_group,
|
||||
|
@ -30,6 +30,14 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_TYPE_ACTION_GROUP (g_action_group_get_type ())
|
||||
#define G_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
||||
G_TYPE_ACTION_GROUP, GActionGroup))
|
||||
#define G_IS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
|
||||
G_TYPE_ACTION_GROUP))
|
||||
#define G_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
|
||||
G_TYPE_ACTION_GROUP, GActionGroupInterface))
|
||||
|
||||
#define G_TYPE_ACTION_GROUP (g_action_group_get_type ())
|
||||
#define G_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
||||
G_TYPE_ACTION_GROUP, GActionGroup))
|
||||
@ -65,45 +73,45 @@ struct _GActionGroupInterface
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* virtual functions */
|
||||
gboolean (* has_action) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
gboolean (* has_action) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
gchar ** (* list_actions) (GActionGroup *action_group);
|
||||
gchar ** (* list_actions) (GActionGroup *action_group);
|
||||
|
||||
gboolean (* get_enabled) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
gboolean (* get_action_enabled) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
const GVariantType * (* get_parameter_type) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
const GVariantType * (* get_action_parameter_type) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
const GVariantType * (* get_state_type) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
const GVariantType * (* get_action_state_type) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
GVariant * (* get_state_hint) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
GVariant * (* get_action_state_hint) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
GVariant * (* get_state) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
GVariant * (* get_action_state) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
void (* set_state) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value);
|
||||
void (* change_action_state) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value);
|
||||
|
||||
void (* activate) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter);
|
||||
void (* activate_action) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter);
|
||||
|
||||
/* signals */
|
||||
void (* action_added) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
void (* action_removed) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
void (* action_enabled_changed) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
gboolean enabled);
|
||||
void (* action_state_changed) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value);
|
||||
void (* action_added) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
void (* action_removed) (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
void (* action_enabled_changed) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
gboolean enabled);
|
||||
void (* action_state_changed) (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value);
|
||||
};
|
||||
|
||||
GType g_action_group_get_type (void) G_GNUC_CONST;
|
||||
@ -112,23 +120,23 @@ gboolean g_action_group_has_action (GAction
|
||||
const gchar *action_name);
|
||||
gchar ** g_action_group_list_actions (GActionGroup *action_group);
|
||||
|
||||
const GVariantType * g_action_group_get_parameter_type (GActionGroup *action_group,
|
||||
const GVariantType * g_action_group_get_action_parameter_type (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
const GVariantType * g_action_group_get_state_type (GActionGroup *action_group,
|
||||
const GVariantType * g_action_group_get_action_state_type (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
GVariant * g_action_group_get_state_hint (GActionGroup *action_group,
|
||||
GVariant * g_action_group_get_action_state_hint (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
gboolean g_action_group_get_enabled (GActionGroup *action_group,
|
||||
gboolean g_action_group_get_action_enabled (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
|
||||
GVariant * g_action_group_get_state (GActionGroup *action_group,
|
||||
GVariant * g_action_group_get_action_state (GActionGroup *action_group,
|
||||
const gchar *action_name);
|
||||
void g_action_group_set_state (GActionGroup *action_group,
|
||||
void g_action_group_change_action_state (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value);
|
||||
|
||||
void g_action_group_activate (GActionGroup *action_group,
|
||||
void g_action_group_activate_action (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter);
|
||||
|
||||
|
@ -100,7 +100,7 @@ g_app_info_default_init (GAppInfoInterface *iface)
|
||||
*
|
||||
* Creates a duplicate of a #GAppInfo.
|
||||
*
|
||||
* Returns: a duplicate of @appinfo.
|
||||
* Returns: (transfer full): a duplicate of @appinfo.
|
||||
**/
|
||||
GAppInfo *
|
||||
g_app_info_dup (GAppInfo *appinfo)
|
||||
@ -476,13 +476,13 @@ g_app_info_get_icon (GAppInfo *appinfo)
|
||||
* a textual uri you want to pass in as argument, consider using
|
||||
* g_app_info_launch_uris() instead.
|
||||
*
|
||||
* On UNIX, this function sets the <envvar>GIO_LAUNCHED_DESKTOP_FILE</envvar>
|
||||
* On UNIX, this function sets the <envar>GIO_LAUNCHED_DESKTOP_FILE</envar>
|
||||
* environment variable with the path of the launched desktop file and
|
||||
* <envvar>GIO_LAUNCHED_DESKTOP_FILE_PID</envvar> to the process
|
||||
* <envar>GIO_LAUNCHED_DESKTOP_FILE_PID</envar> to the process
|
||||
* id of the launched process. This can be used to ignore
|
||||
* <envvar>GIO_LAUNCHED_DESKTOP_FILE</envvar>, should it be inherited
|
||||
* by further processes. The <envvar>DISPLAY</envvar> and
|
||||
* <envvar>DESKTOP_STARTUP_ID</envvar> environment variables are also
|
||||
* <envar>GIO_LAUNCHED_DESKTOP_FILE</envar>, should it be inherited
|
||||
* by further processes. The <envar>DISPLAY</envar> and
|
||||
* <envar>DESKTOP_STARTUP_ID</envar> environment variables are also
|
||||
* set, based on information provided in @launch_context.
|
||||
*
|
||||
* Returns: %TRUE on successful launch, %FALSE otherwise.
|
||||
@ -681,7 +681,8 @@ g_app_info_can_delete (GAppInfo *appinfo)
|
||||
* On some platforms, there may be a difference between user-defined
|
||||
* #GAppInfo<!-- -->s which can be deleted, and system-wide ones which
|
||||
* cannot. See g_app_info_can_delete().
|
||||
*
|
||||
*
|
||||
* Virtual: do_delete
|
||||
* Returns: %TRUE if @appinfo has been deleted
|
||||
*
|
||||
* Since: 2.20
|
||||
@ -732,7 +733,7 @@ g_app_launch_context_init (GAppLaunchContext *launch_context)
|
||||
* g_app_launch_context_get_display:
|
||||
* @context: a #GAppLaunchContext
|
||||
* @info: a #GAppInfo
|
||||
* @files: a #GList of #GFile objects
|
||||
* @files: (element-type GFile): a #GList of #GFile objects
|
||||
*
|
||||
* Gets the display string for the @context. This is used to ensure new
|
||||
* applications are started on the same display as the launching
|
||||
@ -762,7 +763,7 @@ g_app_launch_context_get_display (GAppLaunchContext *context,
|
||||
* g_app_launch_context_get_startup_notify_id:
|
||||
* @context: a #GAppLaunchContext
|
||||
* @info: a #GAppInfo
|
||||
* @files: a #GList of of #GFile objects
|
||||
* @files: (element-type GFile): a #GList of of #GFile objects
|
||||
*
|
||||
* Initiates startup notification for the application and returns the
|
||||
* <envvar>DESKTOP_STARTUP_ID</envvar> for the launched operation,
|
||||
|
2508
gio/gapplication.c
2508
gio/gapplication.c
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,5 @@
|
||||
/* GIO - GLib Input, Output and Streaming Library
|
||||
*
|
||||
* Copyright © 2010 Red Hat, Inc
|
||||
/*
|
||||
* Copyright © 2010 Codethink Limited
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
@ -17,8 +16,7 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Colin Walters <walters@verbum.org>
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
* Authors: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
|
||||
@ -28,21 +26,22 @@
|
||||
#ifndef __G_APPLICATION_H__
|
||||
#define __G_APPLICATION_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/giotypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_TYPE_APPLICATION (g_application_get_type ())
|
||||
#define G_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_APPLICATION, GApplication))
|
||||
#define G_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_APPLICATION, GApplicationClass))
|
||||
#define G_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_APPLICATION))
|
||||
#define G_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_APPLICATION))
|
||||
#define G_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_APPLICATION, GApplicationClass))
|
||||
#define G_TYPE_APPLICATION (g_application_get_type ())
|
||||
#define G_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
||||
G_TYPE_APPLICATION, GApplication))
|
||||
#define G_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
|
||||
G_TYPE_APPLICATION, GApplicationClass))
|
||||
#define G_IS_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_APPLICATION))
|
||||
#define G_IS_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_APPLICATION))
|
||||
#define G_APPLICATION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
|
||||
G_TYPE_APPLICATION, GApplicationClass))
|
||||
|
||||
typedef struct _GApplication GApplication;
|
||||
typedef struct _GApplicationPrivate GApplicationPrivate;
|
||||
typedef struct _GApplicationClass GApplicationClass;
|
||||
typedef struct _GApplicationPrivate GApplicationPrivate;
|
||||
typedef struct _GApplicationClass GApplicationClass;
|
||||
|
||||
/**
|
||||
* GApplication:
|
||||
@ -62,13 +61,22 @@ struct _GApplication
|
||||
|
||||
/**
|
||||
* GApplicationClass:
|
||||
* @action_with_data: class handler for the #GApplication::action-with-data signal
|
||||
* @quit_with_data: class handler for the #GApplication::quit-with-data signal
|
||||
* @prepare_activation: class handler for the #GApplication::prepare-activation signal
|
||||
* @run: virtual function, called by g_application_run()
|
||||
*
|
||||
* The <structname>GApplicationClass</structname> structure contains
|
||||
* private data only
|
||||
* @startup: invoked on the primary instance immediately after registration
|
||||
* @activate: invoked on the primary instance when an activation occurs
|
||||
* @open: invoked on the primary instance when there are files to open
|
||||
* @command_line: invoked on the primary instance when a command-line is
|
||||
* not handled locally
|
||||
* @local_command_line: invoked (locally) when the process has been invoked
|
||||
* via commandline execution. The virtual function has the chance to
|
||||
* inspect (and possibly replace) the list of command line arguments.
|
||||
* See g_application_run() for more information.
|
||||
* @before_emit: invoked on the primary instance before 'activate', 'open' or any action invocation
|
||||
* @after_emit: invoked on the primary instance after 'activate', 'open' or any action invocation
|
||||
* @add_platform_data: invoked (locally) to add 'platform data' to be sent to the primary instance when
|
||||
* activating, opening or invoking actions
|
||||
* @quit_mainloop: invoked on the primary instance when the use count of the application drops to zero (and
|
||||
* after any inactivity timeout, if requested)
|
||||
* @run_mainloop: invoked on the primary instance from g_application_run() if the use-count is non-zero
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -79,70 +87,78 @@ struct _GApplicationClass
|
||||
|
||||
/*< public >*/
|
||||
/* signals */
|
||||
void (* action_with_data) (GApplication *application,
|
||||
const gchar *action_name,
|
||||
GVariant *platform_data);
|
||||
gboolean (* quit_with_data) (GApplication *application,
|
||||
GVariant *platform_data);
|
||||
void (* prepare_activation) (GApplication *application,
|
||||
GVariant *arguments,
|
||||
GVariant *platform_data);
|
||||
void (* startup) (GApplication *application);
|
||||
|
||||
void (* activate) (GApplication *application);
|
||||
|
||||
void (* open) (GApplication *application,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint);
|
||||
|
||||
int (* command_line) (GApplication *application,
|
||||
GApplicationCommandLine *command_line);
|
||||
|
||||
/* vfuncs */
|
||||
void (* run) (GApplication *application);
|
||||
gboolean (* local_command_line) (GApplication *application,
|
||||
gchar ***arguments,
|
||||
int *exit_status);
|
||||
|
||||
void (* before_emit) (GApplication *application,
|
||||
GVariant *platform_data);
|
||||
void (* after_emit) (GApplication *application,
|
||||
GVariant *platform_data);
|
||||
void (* add_platform_data) (GApplication *application,
|
||||
GVariantBuilder *builder);
|
||||
void (* quit_mainloop) (GApplication *application);
|
||||
void (* run_mainloop) (GApplication *application);
|
||||
|
||||
/*< private >*/
|
||||
/* Padding for future expansion */
|
||||
void (*_g_reserved1) (void);
|
||||
void (*_g_reserved2) (void);
|
||||
void (*_g_reserved3) (void);
|
||||
void (*_g_reserved4) (void);
|
||||
void (*_g_reserved5) (void);
|
||||
void (*_g_reserved6) (void);
|
||||
gpointer padding[12];
|
||||
};
|
||||
GType g_application_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GApplication * g_application_new (const gchar *appid,
|
||||
int argc,
|
||||
char **argv);
|
||||
GType g_application_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GApplication * g_application_try_new (const gchar *appid,
|
||||
int argc,
|
||||
char **argv,
|
||||
GError **error);
|
||||
gboolean g_application_id_is_valid (const gchar *application_id);
|
||||
|
||||
GApplication * g_application_unregistered_try_new (const gchar *appid,
|
||||
int argc,
|
||||
char **argv,
|
||||
GError **error);
|
||||
GApplication * g_application_new (const gchar *application_id,
|
||||
GApplicationFlags flags);
|
||||
|
||||
gboolean g_application_register (GApplication *application);
|
||||
const gchar * g_application_get_application_id (GApplication *application);
|
||||
void g_application_set_application_id (GApplication *application,
|
||||
const gchar *application_id);
|
||||
|
||||
GApplication * g_application_get_instance (void);
|
||||
G_CONST_RETURN gchar * g_application_get_id (GApplication *application);
|
||||
guint g_application_get_inactivity_timeout (GApplication *application);
|
||||
void g_application_set_inactivity_timeout (GApplication *application,
|
||||
guint inactivity_timeout);
|
||||
|
||||
void g_application_add_action (GApplication *application,
|
||||
const gchar *name,
|
||||
const gchar *description);
|
||||
void g_application_remove_action (GApplication *application,
|
||||
const gchar *name);
|
||||
gchar ** g_application_list_actions (GApplication *application);
|
||||
void g_application_set_action_enabled (GApplication *application,
|
||||
const gchar *name,
|
||||
gboolean enabled);
|
||||
gboolean g_application_get_action_enabled (GApplication *application,
|
||||
const gchar *name);
|
||||
G_CONST_RETURN gchar * g_application_get_action_description (GApplication *application,
|
||||
const gchar *name);
|
||||
void g_application_invoke_action (GApplication *application,
|
||||
const gchar *name,
|
||||
GVariant *platform_data);
|
||||
GApplicationFlags g_application_get_flags (GApplication *application);
|
||||
void g_application_set_flags (GApplication *application,
|
||||
GApplicationFlags flags);
|
||||
|
||||
void g_application_run (GApplication *application);
|
||||
gboolean g_application_quit_with_data (GApplication *application,
|
||||
GVariant *platform_data);
|
||||
void g_application_set_action_group (GApplication *application,
|
||||
GActionGroup *action_group);
|
||||
|
||||
gboolean g_application_is_remote (GApplication *application);
|
||||
gboolean g_application_get_is_registered (GApplication *application);
|
||||
gboolean g_application_get_is_remote (GApplication *application);
|
||||
|
||||
gboolean g_application_register (GApplication *application,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void g_application_hold (GApplication *application);
|
||||
void g_application_release (GApplication *application);
|
||||
|
||||
void g_application_activate (GApplication *application);
|
||||
|
||||
void g_application_open (GApplication *application,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint);
|
||||
|
||||
int g_application_run (GApplication *application,
|
||||
int argc,
|
||||
char **argv);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
542
gio/gapplicationcommandline.c
Normal file
542
gio/gapplicationcommandline.c
Normal file
@ -0,0 +1,542 @@
|
||||
/*
|
||||
* Copyright © 2010 Codethink Limited
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* licence or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* Authors: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gapplicationcommandline.h"
|
||||
|
||||
#include "glibintl.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
G_DEFINE_TYPE (GApplicationCommandLine, g_application_command_line, G_TYPE_OBJECT)
|
||||
|
||||
/**
|
||||
* SECTION:gapplicationcommandline
|
||||
* @title: GApplicationCommandLine
|
||||
* @short_description: A class representing a command-line invocation of
|
||||
* an application
|
||||
* @see_also: #GApplication
|
||||
*
|
||||
* #GApplicationCommandLine represents a command-line invocation of
|
||||
* an application. It is created by #GApplication and emitted
|
||||
* in the #GApplication::command-line signal and virtual function.
|
||||
*
|
||||
* The class contains the list of arguments that the program was invoked
|
||||
* with. It is also possible to query if the commandline invocation was
|
||||
* local (ie: the current process is running in direct response to the
|
||||
* invocation) or remote (ie: some other process forwarded the
|
||||
* commandline to this process).
|
||||
*
|
||||
* The exit status of the originally-invoked process may be set and
|
||||
* messages can be printed to stdout or stderr of that process. The
|
||||
* lifecycle of the originally-invoked process is tied to the lifecycle
|
||||
* of this object (ie: the process exits when the last reference is
|
||||
* dropped).
|
||||
*
|
||||
* <example id="gapplication-example-cmdline"><title>Handling commandline arguments with GApplication</title>
|
||||
* <programlisting>
|
||||
* <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gapplication-example-cmdline.c">
|
||||
* <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
|
||||
* </xi:include>
|
||||
* </programlisting>
|
||||
* </example>
|
||||
*
|
||||
* <example id="gapplication-example-cmdline2"><title>Complicated commandline handling</title>
|
||||
* <programlisting>
|
||||
* <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gapplication-example-cmdline2.c">
|
||||
* <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
|
||||
* </xi:include>
|
||||
* </programlisting>
|
||||
* </example>
|
||||
**/
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_NONE,
|
||||
PROP_ARGUMENTS,
|
||||
PROP_PLATFORM_DATA,
|
||||
PROP_IS_REMOTE
|
||||
};
|
||||
|
||||
struct _GApplicationCommandLinePrivate
|
||||
{
|
||||
GVariant *platform_data;
|
||||
GVariant *arguments;
|
||||
GVariant *cwd;
|
||||
|
||||
const gchar **environ;
|
||||
gint exit_status;
|
||||
};
|
||||
|
||||
/* All subclasses represent remote invocations of some kind. */
|
||||
#define IS_REMOTE(cmdline) (G_TYPE_FROM_INSTANCE (cmdline) != \
|
||||
G_TYPE_APPLICATION_COMMAND_LINE)
|
||||
|
||||
static void
|
||||
grok_platform_data (GApplicationCommandLine *cmdline)
|
||||
{
|
||||
GVariantIter iter;
|
||||
const gchar *key;
|
||||
GVariant *value;
|
||||
|
||||
g_variant_iter_init (&iter, cmdline->priv->platform_data);
|
||||
|
||||
while (g_variant_iter_loop (&iter, "{&sv}", &key, &value))
|
||||
if (strcmp (key, "cwd") == 0)
|
||||
{
|
||||
if (!cmdline->priv->cwd)
|
||||
cmdline->priv->cwd = g_variant_ref (value);
|
||||
}
|
||||
|
||||
else if (strcmp (key, "environ") == 0)
|
||||
{
|
||||
if (!cmdline->priv->environ)
|
||||
cmdline->priv->environ =
|
||||
g_variant_get_bytestring_array (value, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_command_line_real_print_literal (GApplicationCommandLine *cmdline,
|
||||
const gchar *message)
|
||||
{
|
||||
g_print ("%s\n", message);
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_command_line_real_printerr_literal (GApplicationCommandLine *cmdline,
|
||||
const gchar *message)
|
||||
{
|
||||
g_printerr ("%s\n", message);
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_command_line_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GApplicationCommandLine *cmdline = G_APPLICATION_COMMAND_LINE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ARGUMENTS:
|
||||
g_value_set_variant (value, cmdline->priv->arguments);
|
||||
break;
|
||||
|
||||
case PROP_PLATFORM_DATA:
|
||||
g_value_set_variant (value, cmdline->priv->platform_data);
|
||||
break;
|
||||
|
||||
case PROP_IS_REMOTE:
|
||||
g_value_set_boolean (value, IS_REMOTE (cmdline));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_command_line_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GApplicationCommandLine *cmdline = G_APPLICATION_COMMAND_LINE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ARGUMENTS:
|
||||
g_assert (cmdline->priv->arguments == NULL);
|
||||
cmdline->priv->arguments = g_value_dup_variant (value);
|
||||
break;
|
||||
|
||||
case PROP_PLATFORM_DATA:
|
||||
g_assert (cmdline->priv->platform_data == NULL);
|
||||
cmdline->priv->platform_data = g_value_dup_variant (value);
|
||||
if (cmdline->priv->platform_data != NULL)
|
||||
grok_platform_data (cmdline);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_command_line_finalize (GObject *object)
|
||||
{
|
||||
GApplicationCommandLine *cmdline = G_APPLICATION_COMMAND_LINE (object);
|
||||
|
||||
if (cmdline->priv->platform_data)
|
||||
g_variant_unref (cmdline->priv->platform_data);
|
||||
if (cmdline->priv->arguments)
|
||||
g_variant_unref (cmdline->priv->arguments);
|
||||
if (cmdline->priv->cwd)
|
||||
g_variant_unref (cmdline->priv->cwd);
|
||||
|
||||
G_OBJECT_CLASS (g_application_command_line_parent_class)
|
||||
->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_command_line_init (GApplicationCommandLine *cmdline)
|
||||
{
|
||||
cmdline->priv =
|
||||
G_TYPE_INSTANCE_GET_PRIVATE (cmdline,
|
||||
G_TYPE_APPLICATION_COMMAND_LINE,
|
||||
GApplicationCommandLinePrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_command_line_class_init (GApplicationCommandLineClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->get_property = g_application_command_line_get_property;
|
||||
object_class->set_property = g_application_command_line_set_property;
|
||||
object_class->finalize = g_application_command_line_finalize;
|
||||
class->printerr_literal = g_application_command_line_real_printerr_literal;
|
||||
class->print_literal = g_application_command_line_real_print_literal;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ARGUMENTS,
|
||||
g_param_spec_variant ("arguments",
|
||||
P_("Commandline arguments"),
|
||||
P_("The commandline that caused this ::command-line signal emission"),
|
||||
G_VARIANT_TYPE_BYTESTRING_ARRAY, NULL,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_PLATFORM_DATA,
|
||||
g_param_spec_variant ("platform-data",
|
||||
P_("Platform data"),
|
||||
P_("Platform-specific data for the commandline"),
|
||||
G_VARIANT_TYPE ("a{sv}"), NULL,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_IS_REMOTE,
|
||||
g_param_spec_boolean ("is-remote",
|
||||
P_("Is remote"),
|
||||
P_("TRUE if this is a remote commandline"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (class, sizeof (GApplicationCommandLinePrivate));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* g_application_command_line_get_arguments:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
* @argc: the length of the arguments array, or %NULL
|
||||
*
|
||||
* Gets the list of arguments that was passed on the command line.
|
||||
*
|
||||
* The strings in the array may contain non-utf8 data.
|
||||
*
|
||||
* The return value is %NULL-terminated and should be freed using
|
||||
* g_strfreev().
|
||||
*
|
||||
* Returns: the string array containing the arguments (the argv)
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
gchar **
|
||||
g_application_command_line_get_arguments (GApplicationCommandLine *cmdline,
|
||||
int *argc)
|
||||
{
|
||||
gchar **argv;
|
||||
gsize len;
|
||||
|
||||
g_return_val_if_fail (G_IS_APPLICATION_COMMAND_LINE (cmdline), NULL);
|
||||
|
||||
argv = g_variant_dup_bytestring_array (cmdline->priv->arguments, &len);
|
||||
|
||||
if (argc)
|
||||
*argc = len;
|
||||
|
||||
return argv;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_get_cwd:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
*
|
||||
* Gets the working directory of the command line invocation. The
|
||||
* string may contain non-utf8 data.
|
||||
*
|
||||
* It is possible that the remote application did not send a working
|
||||
* directory, so this may be %NULL.
|
||||
*
|
||||
* The return value should not be modified or freed and is valid for as
|
||||
* long as @cmdline exists.
|
||||
*
|
||||
* Returns: the current directory, or %NULL
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
const gchar *
|
||||
g_application_command_line_get_cwd (GApplicationCommandLine *cmdline)
|
||||
{
|
||||
if (cmdline->priv->cwd)
|
||||
return g_variant_get_bytestring (cmdline->priv->cwd);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_get_environ:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
*
|
||||
* Gets the contents of the 'environ' variable of the command line
|
||||
* invocation, as would be returned by g_get_environ(). The strings may
|
||||
* contain non-utf8 data.
|
||||
*
|
||||
* The remote application usually does not send an environment. Use
|
||||
* %G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag
|
||||
* set it is possible that the environment is still not available (due
|
||||
* to invocation messages from other applications).
|
||||
*
|
||||
* The return value should not be modified or freed and is valid for as
|
||||
* long as @cmdline exists.
|
||||
*
|
||||
* Returns: the environment strings, or %NULL if they were not sent
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
const gchar * const *
|
||||
g_application_command_line_get_environ (GApplicationCommandLine *cmdline)
|
||||
{
|
||||
return cmdline->priv->environ;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_getenv:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
* @name: the environment variable to get
|
||||
*
|
||||
* Gets the value of a particular environment variable of the command
|
||||
* line invocation, as would be returned by g_getenv(). The strings may
|
||||
* contain non-utf8 data.
|
||||
*
|
||||
* The remote application usually does not send an environment. Use
|
||||
* %G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag
|
||||
* set it is possible that the environment is still not available (due
|
||||
* to invocation messages from other applications).
|
||||
*
|
||||
* The return value should not be modified or freed and is valid for as
|
||||
* long as @cmdline exists.
|
||||
*
|
||||
* Returns: the value of the variable, or %NULL if unset or unsent
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
const gchar *
|
||||
g_application_command_line_getenv (GApplicationCommandLine *cmdline,
|
||||
const gchar *name)
|
||||
{
|
||||
gint length = strlen (name);
|
||||
gint i;
|
||||
|
||||
/* TODO: expand on windows */
|
||||
if (cmdline->priv->environ)
|
||||
for (i = 0; cmdline->priv->environ[i]; i++)
|
||||
if (strncmp (cmdline->priv->environ[i], name, length) == 0 &&
|
||||
cmdline->priv->environ[i][length] == '=')
|
||||
return cmdline->priv->environ[i] + length + 1;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_get_is_remote:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
*
|
||||
* Determines if @cmdline represents a remote invocation.
|
||||
*
|
||||
* Returns: %TRUE if the invocation was remote
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
gboolean
|
||||
g_application_command_line_get_is_remote (GApplicationCommandLine *cmdline)
|
||||
{
|
||||
return IS_REMOTE (cmdline);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_print:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
* @format: a printf-style format string
|
||||
* @...: arguments, as per @format
|
||||
*
|
||||
* Formats a message and prints it using the stdout print handler in the
|
||||
* invoking process.
|
||||
*
|
||||
* If @cmdline is a local invocation then this is exactly equivalent to
|
||||
* g_print(). If @cmdline is remote then this is equivalent to calling
|
||||
* g_print() in the invoking process.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_application_command_line_print (GApplicationCommandLine *cmdline,
|
||||
const gchar *format,
|
||||
...)
|
||||
{
|
||||
gchar *message;
|
||||
va_list ap;
|
||||
|
||||
g_return_if_fail (G_IS_APPLICATION_COMMAND_LINE (cmdline));
|
||||
g_return_if_fail (format != NULL);
|
||||
|
||||
va_start (ap, format);
|
||||
message = g_strdup_vprintf (format, ap);
|
||||
va_end (ap);
|
||||
|
||||
G_APPLICATION_COMMAND_LINE_GET_CLASS (cmdline)
|
||||
->print_literal (cmdline, message);
|
||||
g_free (message);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_printerr:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
* @format: a printf-style format string
|
||||
* @...: arguments, as per @format
|
||||
*
|
||||
* Formats a message and prints it using the stderr print handler in the
|
||||
* invoking process.
|
||||
*
|
||||
* If @cmdline is a local invocation then this is exactly equivalent to
|
||||
* g_printerr(). If @cmdline is remote then this is equivalent to
|
||||
* calling g_printerr() in the invoking process.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_application_command_line_printerr (GApplicationCommandLine *cmdline,
|
||||
const gchar *format,
|
||||
...)
|
||||
{
|
||||
gchar *message;
|
||||
va_list ap;
|
||||
|
||||
g_return_if_fail (G_IS_APPLICATION_COMMAND_LINE (cmdline));
|
||||
g_return_if_fail (format != NULL);
|
||||
|
||||
va_start (ap, format);
|
||||
message = g_strdup_vprintf (format, ap);
|
||||
va_end (ap);
|
||||
|
||||
G_APPLICATION_COMMAND_LINE_GET_CLASS (cmdline)
|
||||
->printerr_literal (cmdline, message);
|
||||
g_free (message);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_set_exit_status:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
* @exit_status: the exit status
|
||||
*
|
||||
* Sets the exit status that will be used when the invoking process
|
||||
* exits.
|
||||
*
|
||||
* The return value of the #GApplication::command-line signal is
|
||||
* passed to this function when the handler returns. This is the usual
|
||||
* way of setting the exit status.
|
||||
*
|
||||
* In the event that you want the remote invocation to continue running
|
||||
* and want to decide on the exit status in the future, you can use this
|
||||
* call. For the case of a remote invocation, the remote process will
|
||||
* typically exit when the last reference is dropped on @cmdline. The
|
||||
* exit status of the remote process will be equal to the last value
|
||||
* that was set with this function.
|
||||
*
|
||||
* In the case that the commandline invocation is local, the situation
|
||||
* is slightly more complicated. If the commandline invocation results
|
||||
* in the mainloop running (ie: because the use-count of the application
|
||||
* increased to a non-zero value) then the application is considered to
|
||||
* have been 'successful' in a certain sense, and the exit status is
|
||||
* always zero. If the application use count is zero, though, the exit
|
||||
* status of the local #GApplicationCommandLine is used.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_application_command_line_set_exit_status (GApplicationCommandLine *cmdline,
|
||||
int exit_status)
|
||||
{
|
||||
g_return_if_fail (G_IS_APPLICATION_COMMAND_LINE (cmdline));
|
||||
|
||||
cmdline->priv->exit_status = exit_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_get_exit_status:
|
||||
* @cmdline: a #GApplicationCommandLine
|
||||
*
|
||||
* Gets the exit status of @cmdline. See
|
||||
* g_application_command_line_set_exit_status() for more information.
|
||||
*
|
||||
* Returns: the exit status
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
int
|
||||
g_application_command_line_get_exit_status (GApplicationCommandLine *cmdline)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_APPLICATION_COMMAND_LINE (cmdline), -1);
|
||||
|
||||
return cmdline->priv->exit_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_application_command_line_get_platform_data:
|
||||
* @cmdline: #GApplicationCommandLine
|
||||
*
|
||||
* Gets the platform data associated with the invocation of @cmdline.
|
||||
*
|
||||
* This is a #GVariant dictionary containing information about the
|
||||
* context in which the invocation occured. It typically contains
|
||||
* information like the current working directory and the startup
|
||||
* notification ID.
|
||||
*
|
||||
* For local invocation, it will be %NULL.
|
||||
*
|
||||
* Returns: the platform data, or %NULL
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
GVariant *
|
||||
g_application_command_line_get_platform_data (GApplicationCommandLine *cmdline)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_APPLICATION_COMMAND_LINE (cmdline), NULL);
|
||||
|
||||
if (cmdline->priv->platform_data)
|
||||
return g_variant_ref (cmdline->priv->platform_data);
|
||||
else
|
||||
return NULL;
|
||||
}
|
118
gio/gapplicationcommandline.h
Normal file
118
gio/gapplicationcommandline.h
Normal file
@ -0,0 +1,118 @@
|
||||
/* GIO - GLib Input, Output and Streaming Library
|
||||
*
|
||||
* Copyright © 2010 Codethink Limited
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the licence or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
|
||||
#error "Only <gio/gio.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __G_APPLICATION_COMMAND_LINE_H__
|
||||
#define __G_APPLICATION_COMMAND_LINE_H__
|
||||
|
||||
#include <gio/giotypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_TYPE_APPLICATION_COMMAND_LINE (g_application_command_line_get_type ())
|
||||
#define G_APPLICATION_COMMAND_LINE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
||||
G_TYPE_APPLICATION_COMMAND_LINE, \
|
||||
GApplicationCommandLine))
|
||||
#define G_APPLICATION_COMMAND_LINE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
|
||||
G_TYPE_APPLICATION_COMMAND_LINE, \
|
||||
GApplicationCommandLineClass))
|
||||
#define G_IS_APPLICATION_COMMAND_LINE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
|
||||
G_TYPE_APPLICATION_COMMAND_LINE))
|
||||
#define G_IS_APPLICATION_COMMAND_LINE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
|
||||
G_TYPE_APPLICATION_COMMAND_LINE))
|
||||
#define G_APPLICATION_COMMAND_LINE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
|
||||
G_TYPE_APPLICATION_COMMAND_LINE, \
|
||||
GApplicationCommandLineClass))
|
||||
|
||||
typedef struct _GApplicationCommandLinePrivate GApplicationCommandLinePrivate;
|
||||
typedef struct _GApplicationCommandLineClass GApplicationCommandLineClass;
|
||||
|
||||
/**
|
||||
* GApplicationCommandLine:
|
||||
*
|
||||
* The <structname>GApplicationCommandLine</structname> structure contains private
|
||||
* data and should only be accessed using the provided API
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
struct _GApplicationCommandLine
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent_instance;
|
||||
|
||||
GApplicationCommandLinePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* GApplicationCommandLineClass:
|
||||
*
|
||||
* The <structname>GApplicationCommandLineClass</structname> structure contains
|
||||
* private data only
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
struct _GApplicationCommandLineClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* print_literal) (GApplicationCommandLine *cmdline,
|
||||
const gchar *message);
|
||||
void (* printerr_literal) (GApplicationCommandLine *cmdline,
|
||||
const gchar *message);
|
||||
|
||||
gpointer padding[12];
|
||||
};
|
||||
|
||||
GType g_application_command_line_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gchar ** g_application_command_line_get_arguments (GApplicationCommandLine *cmdline,
|
||||
int *argc);
|
||||
|
||||
const gchar * const * g_application_command_line_get_environ (GApplicationCommandLine *cmdline);
|
||||
|
||||
const gchar * g_application_command_line_getenv (GApplicationCommandLine *cmdline,
|
||||
const gchar *name);
|
||||
|
||||
const gchar * g_application_command_line_get_cwd (GApplicationCommandLine *cmdline);
|
||||
|
||||
gboolean g_application_command_line_get_is_remote (GApplicationCommandLine *cmdline);
|
||||
|
||||
void g_application_command_line_print (GApplicationCommandLine *cmdline,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF(2, 3);
|
||||
void g_application_command_line_printerr (GApplicationCommandLine *cmdline,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF(2, 3);
|
||||
|
||||
int g_application_command_line_get_exit_status (GApplicationCommandLine *cmdline);
|
||||
void g_application_command_line_set_exit_status (GApplicationCommandLine *cmdline,
|
||||
int exit_status);
|
||||
|
||||
GVariant * g_application_command_line_get_platform_data (GApplicationCommandLine *cmdline);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_APPLICATION_COMMAND_LINE_H__ */
|
1030
gio/gapplicationimpl-dbus.c
Normal file
1030
gio/gapplicationimpl-dbus.c
Normal file
File diff suppressed because it is too large
Load Diff
54
gio/gapplicationimpl.h
Normal file
54
gio/gapplicationimpl.h
Normal file
@ -0,0 +1,54 @@
|
||||
#include "giotypes.h"
|
||||
|
||||
typedef struct _GApplicationImpl GApplicationImpl;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *name;
|
||||
|
||||
GVariantType *parameter_type;
|
||||
gboolean enabled;
|
||||
GVariant *state;
|
||||
} RemoteActionInfo;
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void g_application_impl_destroy (GApplicationImpl *impl);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GApplicationImpl * g_application_impl_register (GApplication *application,
|
||||
const gchar *appid,
|
||||
GApplicationFlags flags,
|
||||
GHashTable **remote_actions,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void g_application_impl_activate (GApplicationImpl *impl,
|
||||
GVariant *platform_data);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void g_application_impl_open (GApplicationImpl *impl,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint,
|
||||
GVariant *platform_data);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
int g_application_impl_command_line (GApplicationImpl *impl,
|
||||
gchar **arguments,
|
||||
GVariant *platform_data);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void g_application_impl_change_action_state (GApplicationImpl *impl,
|
||||
const gchar *action_name,
|
||||
GVariant *value,
|
||||
GVariant *platform_data);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void g_application_impl_activate_action (GApplicationImpl *impl,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter,
|
||||
GVariant *platform_data);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void g_application_impl_flush (GApplicationImpl *impl);
|
@ -266,10 +266,7 @@ async_init_thread (GSimpleAsyncResult *res,
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_initable_init (G_INITABLE (object), cancellable, &error))
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -437,7 +434,7 @@ g_async_initable_new_valist_async (GType object_type,
|
||||
* Finishes the async construction for the various g_async_initable_new calls,
|
||||
* returning the created object or %NULL on error.
|
||||
*
|
||||
* Returns: a newly created #GObject, or %NULL on error. Free with
|
||||
* Returns: (transfer full): a newly created #GObject, or %NULL on error. Free with
|
||||
* g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
|
@ -122,7 +122,7 @@ g_async_result_default_init (GAsyncResultInterface *iface)
|
||||
*
|
||||
* Gets the user data from a #GAsyncResult.
|
||||
*
|
||||
* Returns: the user data for @res.
|
||||
* Returns: (transfer full): the user data for @res.
|
||||
**/
|
||||
gpointer
|
||||
g_async_result_get_user_data (GAsyncResult *res)
|
||||
@ -142,7 +142,7 @@ g_async_result_get_user_data (GAsyncResult *res)
|
||||
*
|
||||
* Gets the source object from a #GAsyncResult.
|
||||
*
|
||||
* Returns: a new reference to the source object for the @res,
|
||||
* Returns: (transfer full): a new reference to the source object for the @res,
|
||||
* or %NULL if there is none.
|
||||
*/
|
||||
GObject *
|
||||
|
@ -496,11 +496,10 @@ g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
|
||||
|
||||
if (!g_input_stream_set_pending (G_INPUT_STREAM (stream), &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -937,8 +936,7 @@ fill_async_callback (GObject *source_object,
|
||||
g_simple_async_result_set_op_res_gssize (simple, res);
|
||||
if (res == -1)
|
||||
{
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1049,14 +1047,13 @@ large_read_callback (GObject *source_object,
|
||||
|
||||
/* Only report the error if we've not already read some data */
|
||||
if (nread < 0 && data->bytes_read == 0)
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
else if (error)
|
||||
g_error_free (error);
|
||||
|
||||
if (nread > 0)
|
||||
data->bytes_read += nread;
|
||||
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
|
||||
/* Complete immediately, not in idle, since we're already
|
||||
* in a mainloop callout
|
||||
*/
|
||||
@ -1087,8 +1084,9 @@ read_fill_buffer_callback (GObject *source_object,
|
||||
result, &error);
|
||||
|
||||
if (nread < 0 && data->bytes_read == 0)
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
else if (error)
|
||||
g_error_free (error);
|
||||
|
||||
if (nread > 0)
|
||||
{
|
||||
@ -1100,9 +1098,6 @@ read_fill_buffer_callback (GObject *source_object,
|
||||
priv->pos += data->count;
|
||||
}
|
||||
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
|
||||
/* Complete immediately, not in idle, since we're already
|
||||
* in a mainloop callout
|
||||
*/
|
||||
@ -1234,14 +1229,13 @@ large_skip_callback (GObject *source_object,
|
||||
|
||||
/* Only report the error if we've not already read some data */
|
||||
if (nread < 0 && data->bytes_skipped == 0)
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
else if (error)
|
||||
g_error_free (error);
|
||||
|
||||
if (nread > 0)
|
||||
data->bytes_skipped += nread;
|
||||
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
|
||||
/* Complete immediately, not in idle, since we're already
|
||||
* in a mainloop callout
|
||||
*/
|
||||
@ -1272,7 +1266,9 @@ skip_fill_buffer_callback (GObject *source_object,
|
||||
result, &error);
|
||||
|
||||
if (nread < 0 && data->bytes_skipped == 0)
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
else if (error)
|
||||
g_error_free (error);
|
||||
|
||||
if (nread > 0)
|
||||
{
|
||||
@ -1283,9 +1279,6 @@ skip_fill_buffer_callback (GObject *source_object,
|
||||
priv->pos += data->count;
|
||||
}
|
||||
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
|
||||
/* Complete immediately, not in idle, since we're already
|
||||
* in a mainloop callout
|
||||
*/
|
||||
|
@ -575,10 +575,7 @@ flush_buffer_thread (GSimpleAsyncResult *result,
|
||||
}
|
||||
|
||||
if (res == FALSE)
|
||||
{
|
||||
g_simple_async_result_set_from_error (result, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (result, error);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -333,7 +333,7 @@ g_cancellable_pop_current (GCancellable *cancellable)
|
||||
*
|
||||
* Gets the top cancellable from the stack.
|
||||
*
|
||||
* Returns: a #GCancellable from the top of the stack, or %NULL
|
||||
* Returns: (transfer none): a #GCancellable from the top of the stack, or %NULL
|
||||
* if the stack is empty.
|
||||
**/
|
||||
GCancellable *
|
||||
|
@ -743,7 +743,7 @@ g_content_type_get_mime_type (const char *type)
|
||||
*
|
||||
* Gets the icon for a content type.
|
||||
*
|
||||
* Returns: #GIcon corresponding to the content type. Free the returned
|
||||
* Returns: (transfer full): #GIcon corresponding to the content type. Free the returned
|
||||
* object with g_object_unref()
|
||||
*/
|
||||
GIcon *
|
||||
@ -1066,7 +1066,7 @@ enumerate_mimetypes_dir (const char *dir,
|
||||
* g_list_free (list);
|
||||
* </programlisting>
|
||||
*
|
||||
* Returns: #GList of the registered content types
|
||||
* Returns: (element-type utf8) (transfer full): #GList of the registered content types
|
||||
*/
|
||||
GList *
|
||||
g_content_types_get_registered (void)
|
||||
@ -1651,7 +1651,7 @@ match_match (TreeMatch *match,
|
||||
* This function is useful in the implementation of
|
||||
* g_mount_guess_content_type().
|
||||
*
|
||||
* Returns: an %NULL-terminated array of zero or more content types,
|
||||
* Returns: (transfer full): an %NULL-terminated array of zero or more content types,
|
||||
* or %NULL. Free with g_strfreev()
|
||||
*
|
||||
* Since: 2.18
|
||||
|
@ -542,7 +542,7 @@ g_converter_input_stream_read (GInputStream *stream,
|
||||
*
|
||||
* Gets the #GConverter that is used by @converter_stream.
|
||||
*
|
||||
* Returns: the converter of the converter input stream
|
||||
* Returns: (transfer none): the converter of the converter input stream
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
|
@ -602,7 +602,7 @@ g_converter_output_stream_flush (GOutputStream *stream,
|
||||
*
|
||||
* Gets the #GConverter that is used by @converter_stream.
|
||||
*
|
||||
* Returns: the converter of the converter output stream
|
||||
* Returns: (transfer none): the converter of the converter output stream
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
|
@ -250,7 +250,7 @@ g_credentials_is_same_user (GCredentials *credentials,
|
||||
}
|
||||
|
||||
/**
|
||||
* g_credentials_get_native:
|
||||
* g_credentials_get_native: (skip)
|
||||
* @credentials: A #GCredentials.
|
||||
* @native_type: The type of native credentials to get.
|
||||
*
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "gioerror.h"
|
||||
#include "glibintl.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* SECTION:gdatainputstream
|
||||
@ -811,7 +812,8 @@ g_data_input_stream_read_line (GDataInputStream *stream,
|
||||
static gssize
|
||||
scan_for_chars (GDataInputStream *stream,
|
||||
gsize *checked_out,
|
||||
const char *stop_chars)
|
||||
const char *stop_chars,
|
||||
gssize stop_chars_len)
|
||||
{
|
||||
GBufferedInputStream *bstream;
|
||||
const char *buffer;
|
||||
@ -819,8 +821,10 @@ scan_for_chars (GDataInputStream *stream,
|
||||
int i;
|
||||
gsize available, checked;
|
||||
const char *stop_char;
|
||||
const char *stop_end;
|
||||
|
||||
bstream = G_BUFFERED_INPUT_STREAM (stream);
|
||||
stop_end = stop_chars + stop_chars_len;
|
||||
|
||||
checked = *checked_out;
|
||||
|
||||
@ -831,7 +835,7 @@ scan_for_chars (GDataInputStream *stream,
|
||||
|
||||
for (i = 0; checked < available && i < peeked; i++)
|
||||
{
|
||||
for (stop_char = stop_chars; *stop_char != '\0'; stop_char++)
|
||||
for (stop_char = stop_chars; stop_char != stop_end; stop_char++)
|
||||
{
|
||||
if (buffer[i] == *stop_char)
|
||||
return (start + i);
|
||||
@ -858,6 +862,12 @@ scan_for_chars (GDataInputStream *stream,
|
||||
* Note that, in contrast to g_data_input_stream_read_until_async(),
|
||||
* this function consumes the stop character that it finds.
|
||||
*
|
||||
* Don't use this function in new code. Its functionality is
|
||||
* inconsistent with g_data_input_stream_read_until_async(). Both
|
||||
* functions will be marked as deprecated in a future release. Use
|
||||
* g_data_input_stream_read_upto() instead, but note that that function
|
||||
* does not consume the stop character.
|
||||
*
|
||||
* Returns: a string with the data that was read before encountering
|
||||
* any of the stop characters. Set @length to a #gsize to get the length
|
||||
* of the string. This function will return %NULL on an error.
|
||||
@ -870,59 +880,24 @@ g_data_input_stream_read_until (GDataInputStream *stream,
|
||||
GError **error)
|
||||
{
|
||||
GBufferedInputStream *bstream;
|
||||
gsize checked;
|
||||
gssize found_pos;
|
||||
gssize res;
|
||||
int stop_char_len;
|
||||
char *data_until;
|
||||
|
||||
g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), NULL);
|
||||
gchar *result;
|
||||
|
||||
bstream = G_BUFFERED_INPUT_STREAM (stream);
|
||||
|
||||
stop_char_len = 1;
|
||||
checked = 0;
|
||||
result = g_data_input_stream_read_upto (stream, stop_chars, -1,
|
||||
length, cancellable, error);
|
||||
|
||||
while ((found_pos = scan_for_chars (stream, &checked, stop_chars)) == -1)
|
||||
/* If we're not at end of stream then we have a stop_char to consume. */
|
||||
if (result != NULL && g_buffered_input_stream_get_available (bstream) > 0)
|
||||
{
|
||||
if (g_buffered_input_stream_get_available (bstream) ==
|
||||
g_buffered_input_stream_get_buffer_size (bstream))
|
||||
g_buffered_input_stream_set_buffer_size (bstream,
|
||||
2 * g_buffered_input_stream_get_buffer_size (bstream));
|
||||
gsize res;
|
||||
gchar b;
|
||||
|
||||
res = g_buffered_input_stream_fill (bstream, -1, cancellable, error);
|
||||
if (res < 0)
|
||||
return NULL;
|
||||
if (res == 0)
|
||||
{
|
||||
/* End of stream */
|
||||
if (g_buffered_input_stream_get_available (bstream) == 0)
|
||||
{
|
||||
if (length)
|
||||
*length = 0;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
found_pos = checked;
|
||||
stop_char_len = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
res = g_input_stream_read (G_INPUT_STREAM (stream), &b, 1, NULL, NULL);
|
||||
g_assert (res == 1);
|
||||
}
|
||||
|
||||
data_until = g_malloc (found_pos + stop_char_len + 1);
|
||||
|
||||
res = g_input_stream_read (G_INPUT_STREAM (stream),
|
||||
data_until,
|
||||
found_pos + stop_char_len,
|
||||
NULL, NULL);
|
||||
if (length)
|
||||
*length = (gsize)found_pos;
|
||||
g_warn_if_fail (res == found_pos + stop_char_len);
|
||||
data_until[found_pos] = 0;
|
||||
|
||||
return data_until;
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@ -935,6 +910,7 @@ typedef struct
|
||||
GCancellable *cancellable;
|
||||
|
||||
gchar *stop_chars;
|
||||
gssize stop_chars_len;
|
||||
gchar *line;
|
||||
gsize length;
|
||||
} GDataInputStreamReadData;
|
||||
@ -994,8 +970,7 @@ g_data_input_stream_read_line_ready (GObject *object,
|
||||
if (bytes < 0)
|
||||
/* stream error. */
|
||||
{
|
||||
g_simple_async_result_set_from_error (data->simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (data->simple, error);
|
||||
data->checked = 0;
|
||||
}
|
||||
|
||||
@ -1010,7 +985,8 @@ g_data_input_stream_read_line_ready (GObject *object,
|
||||
{
|
||||
found_pos = scan_for_chars (data->stream,
|
||||
&data->checked,
|
||||
data->stop_chars);
|
||||
data->stop_chars,
|
||||
data->stop_chars_len);
|
||||
newline_len = 0;
|
||||
}
|
||||
else
|
||||
@ -1062,6 +1038,7 @@ g_data_input_stream_read_data_free (gpointer user_data)
|
||||
static void
|
||||
g_data_input_stream_read_async (GDataInputStream *stream,
|
||||
const gchar *stop_chars,
|
||||
gssize stop_chars_len,
|
||||
gint io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
@ -1075,7 +1052,10 @@ g_data_input_stream_read_async (GDataInputStream *stream,
|
||||
if (cancellable)
|
||||
g_object_ref (cancellable);
|
||||
data->cancellable = cancellable;
|
||||
data->stop_chars = g_strdup (stop_chars);
|
||||
if (stop_chars_len == -1)
|
||||
stop_chars_len = strlen (stop_chars);
|
||||
data->stop_chars = g_memdup (stop_chars, stop_chars_len);
|
||||
data->stop_chars_len = stop_chars_len;
|
||||
data->io_priority = io_priority;
|
||||
data->last_saw_cr = FALSE;
|
||||
data->checked = 0;
|
||||
@ -1142,7 +1122,7 @@ g_data_input_stream_read_line_async (GDataInputStream *stream,
|
||||
g_return_if_fail (G_IS_DATA_INPUT_STREAM (stream));
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
g_data_input_stream_read_async (stream, NULL, io_priority,
|
||||
g_data_input_stream_read_async (stream, NULL, 0, io_priority,
|
||||
cancellable, callback, user_data,
|
||||
g_data_input_stream_read_line_async);
|
||||
}
|
||||
@ -1168,6 +1148,11 @@ g_data_input_stream_read_line_async (GDataInputStream *stream,
|
||||
* can then call g_data_input_stream_read_until_finish() to get
|
||||
* the result of the operation.
|
||||
*
|
||||
* Don't use this function in new code. Its functionality is
|
||||
* inconsistent with g_data_input_stream_read_until(). Both functions
|
||||
* will be marked as deprecated in a future release. Use
|
||||
* g_data_input_stream_read_upto_async() instead.
|
||||
*
|
||||
* Since: 2.20
|
||||
*/
|
||||
void
|
||||
@ -1182,7 +1167,7 @@ g_data_input_stream_read_until_async (GDataInputStream *stream,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
g_return_if_fail (stop_chars != NULL);
|
||||
|
||||
g_data_input_stream_read_async (stream, stop_chars, io_priority,
|
||||
g_data_input_stream_read_async (stream, stop_chars, -1, io_priority,
|
||||
cancellable, callback, user_data,
|
||||
g_data_input_stream_read_until_async);
|
||||
}
|
||||
@ -1245,3 +1230,174 @@ g_data_input_stream_read_until_finish (GDataInputStream *stream,
|
||||
|
||||
return g_data_input_stream_read_finish (stream, result, length, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_data_input_stream_read_upto:
|
||||
* @stream: a #GDataInputStream
|
||||
* @stop_chars: characters to terminate the read
|
||||
* @stop_chars_len: length of @stop_chars. May be -1 if @stop_chars is
|
||||
* nul-terminated
|
||||
* @length: a #gsize to get the length of the data read in
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore
|
||||
* @error: #GError for error reporting
|
||||
*
|
||||
* Reads a string from the data input stream, up to the first
|
||||
* occurrence of any of the stop characters.
|
||||
*
|
||||
* In contrast to g_data_input_stream_read_until(), this function
|
||||
* does <emphasis>not</emphasis> consume the stop character. You have
|
||||
* to use g_data_input_stream_read_byte() to get it before calling
|
||||
* g_data_input_stream_read_upto() again.
|
||||
*
|
||||
* Note that @stop_chars may contain '\0' if @stop_chars_len is
|
||||
* specified.
|
||||
*
|
||||
* Returns: a string with the data that was read before encountering
|
||||
* any of the stop characters. Set @length to a #gsize to get the length
|
||||
* of the string. This function will return %NULL on an error
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
char *
|
||||
g_data_input_stream_read_upto (GDataInputStream *stream,
|
||||
const gchar *stop_chars,
|
||||
gssize stop_chars_len,
|
||||
gsize *length,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GBufferedInputStream *bstream;
|
||||
gsize checked;
|
||||
gssize found_pos;
|
||||
gssize res;
|
||||
char *data_until;
|
||||
|
||||
g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), NULL);
|
||||
|
||||
if (stop_chars_len < 0)
|
||||
stop_chars_len = strlen (stop_chars);
|
||||
|
||||
bstream = G_BUFFERED_INPUT_STREAM (stream);
|
||||
|
||||
checked = 0;
|
||||
|
||||
while ((found_pos = scan_for_chars (stream, &checked, stop_chars, stop_chars_len)) == -1)
|
||||
{
|
||||
if (g_buffered_input_stream_get_available (bstream) ==
|
||||
g_buffered_input_stream_get_buffer_size (bstream))
|
||||
g_buffered_input_stream_set_buffer_size (bstream,
|
||||
2 * g_buffered_input_stream_get_buffer_size (bstream));
|
||||
|
||||
res = g_buffered_input_stream_fill (bstream, -1, cancellable, error);
|
||||
if (res < 0)
|
||||
return NULL;
|
||||
if (res == 0)
|
||||
{
|
||||
/* End of stream */
|
||||
if (g_buffered_input_stream_get_available (bstream) == 0)
|
||||
{
|
||||
if (length)
|
||||
*length = 0;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
found_pos = checked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data_until = g_malloc (found_pos + 1);
|
||||
|
||||
res = g_input_stream_read (G_INPUT_STREAM (stream),
|
||||
data_until,
|
||||
found_pos,
|
||||
NULL, NULL);
|
||||
if (length)
|
||||
*length = (gsize)found_pos;
|
||||
g_warn_if_fail (res == found_pos);
|
||||
data_until[found_pos] = 0;
|
||||
|
||||
return data_until;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_data_input_stream_read_upto_async:
|
||||
* @stream: a #GDataInputStream
|
||||
* @stop_chars: characters to terminate the read
|
||||
* @stop_chars_len: length of @stop_chars. May be -1 if @stop_chars is
|
||||
* nul-terminated
|
||||
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
||||
* of the request.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore
|
||||
* @callback: callback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* The asynchronous version of g_data_input_stream_read_upto().
|
||||
* It is an error to have two outstanding calls to this function.
|
||||
*
|
||||
* In contrast to g_data_input_stream_read_until(), this function
|
||||
* does <emphasis>not</emphasis> consume the stop character. You have
|
||||
* to use g_data_input_stream_read_byte() to get it before calling
|
||||
* g_data_input_stream_read_upto() again.
|
||||
*
|
||||
* Note that @stop_chars may contain '\0' if @stop_chars_len is
|
||||
* specified.
|
||||
*
|
||||
* When the operation is finished, @callback will be called. You
|
||||
* can then call g_data_input_stream_read_upto_finish() to get
|
||||
* the result of the operation.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
void
|
||||
g_data_input_stream_read_upto_async (GDataInputStream *stream,
|
||||
const gchar *stop_chars,
|
||||
gssize stop_chars_len,
|
||||
gint io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (G_IS_DATA_INPUT_STREAM (stream));
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
g_return_if_fail (stop_chars != NULL);
|
||||
|
||||
g_data_input_stream_read_async (stream, stop_chars, stop_chars_len, io_priority,
|
||||
cancellable, callback, user_data,
|
||||
g_data_input_stream_read_upto_async);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_data_input_stream_read_upto_finish:
|
||||
* @stream: a #GDataInputStream
|
||||
* @result: the #GAsyncResult that was provided to the callback
|
||||
* @length: a #gsize to get the length of the data read in
|
||||
* @error: #GError for error reporting
|
||||
*
|
||||
* Finish an asynchronous call started by
|
||||
* g_data_input_stream_read_upto_async().
|
||||
*
|
||||
* Note that this function does <emphasis>not</emphasis> consume the
|
||||
* stop character. You have to use g_data_input_stream_read_byte() to
|
||||
* get it before calling g_data_input_stream_read_upto_async() again.
|
||||
*
|
||||
* Returns: a string with the data that was read before encountering
|
||||
* any of the stop characters. Set @length to a #gsize to get the length
|
||||
* of the string. This function will return %NULL on an error.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
gchar *
|
||||
g_data_input_stream_read_upto_finish (GDataInputStream *stream,
|
||||
GAsyncResult *result,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (
|
||||
g_simple_async_result_is_valid (result, G_OBJECT (stream),
|
||||
g_data_input_stream_read_upto_async), NULL);
|
||||
|
||||
return g_data_input_stream_read_finish (stream, result, length, error);
|
||||
}
|
||||
|
@ -72,36 +72,36 @@ GType g_data_input_stream_get_type (void) G_GNUC_CO
|
||||
GDataInputStream * g_data_input_stream_new (GInputStream *base_stream);
|
||||
|
||||
void g_data_input_stream_set_byte_order (GDataInputStream *stream,
|
||||
GDataStreamByteOrder order);
|
||||
GDataStreamByteOrder order);
|
||||
GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
|
||||
void g_data_input_stream_set_newline_type (GDataInputStream *stream,
|
||||
GDataStreamNewlineType type);
|
||||
GDataStreamNewlineType type);
|
||||
GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
|
||||
guchar g_data_input_stream_read_byte (GDataInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gint16 g_data_input_stream_read_int16 (GDataInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gint32 g_data_input_stream_read_int32 (GDataInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gint64 g_data_input_stream_read_int64 (GDataInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * g_data_input_stream_read_line (GDataInputStream *stream,
|
||||
gsize *length,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gsize *length,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void g_data_input_stream_read_line_async (GDataInputStream *stream,
|
||||
gint io_priority,
|
||||
GCancellable *cancellable,
|
||||
@ -112,12 +112,12 @@ char * g_data_input_stream_read_line_finish (GDataInputStrea
|
||||
gsize *length,
|
||||
GError **error);
|
||||
char * g_data_input_stream_read_until (GDataInputStream *stream,
|
||||
const gchar *stop_chars,
|
||||
gsize *length,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
const gchar *stop_chars,
|
||||
gsize *length,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void g_data_input_stream_read_until_async (GDataInputStream *stream,
|
||||
const gchar *stop_chars,
|
||||
const gchar *stop_chars,
|
||||
gint io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
@ -127,6 +127,24 @@ char * g_data_input_stream_read_until_finish (GDataInputStrea
|
||||
gsize *length,
|
||||
GError **error);
|
||||
|
||||
char * g_data_input_stream_read_upto (GDataInputStream *stream,
|
||||
const gchar *stop_chars,
|
||||
gssize stop_chars_len,
|
||||
gsize *length,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void g_data_input_stream_read_upto_async (GDataInputStream *stream,
|
||||
const gchar *stop_chars,
|
||||
gssize stop_chars_len,
|
||||
gint io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char * g_data_input_stream_read_upto_finish (GDataInputStream *stream,
|
||||
GAsyncResult *result,
|
||||
gsize *length,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_DATA_INPUT_STREAM_H__ */
|
||||
|
@ -806,10 +806,7 @@ get_stream_thread_func (GSimpleAsyncResult *res,
|
||||
cancellable,
|
||||
&error);
|
||||
if (data->stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -867,7 +864,7 @@ g_dbus_address_get_stream (const gchar *address,
|
||||
*
|
||||
* Finishes an operation started with g_dbus_address_get_stream().
|
||||
*
|
||||
* Returns: A #GIOStream or %NULL if @error is set.
|
||||
* Returns: (transfer full): A #GIOStream or %NULL if @error is set.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -913,7 +910,7 @@ g_dbus_address_get_stream_finish (GAsyncResult *res,
|
||||
* This is a synchronous failable function. See
|
||||
* g_dbus_address_get_stream() for the asynchronous version.
|
||||
*
|
||||
* Returns: A #GIOStream or %NULL if @error is set.
|
||||
* Returns: (transfer full): A #GIOStream or %NULL if @error is set.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
|
@ -1,424 +0,0 @@
|
||||
/* GIO - GLib Input, Output and Streaming Library
|
||||
*
|
||||
* Copyright © 2010 Red Hat, Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Colin Walters <walters@verbum.org>
|
||||
*/
|
||||
|
||||
#define G_APPLICATION_IFACE "org.gtk.Application"
|
||||
|
||||
static void
|
||||
application_dbus_method_call (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *method_name,
|
||||
GVariant *parameters,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
{
|
||||
GApplication *app = G_APPLICATION (user_data);
|
||||
|
||||
if (method_name == NULL && *method_name == '\0')
|
||||
return;
|
||||
|
||||
if (strcmp (method_name, "Quit") == 0)
|
||||
{
|
||||
GVariant *platform_data;
|
||||
|
||||
g_variant_get (parameters, "(@a{sv})", &platform_data);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
|
||||
g_application_quit_with_data (app, platform_data);
|
||||
|
||||
g_variant_unref (platform_data);
|
||||
}
|
||||
else if (strcmp (method_name, "ListActions") == 0)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
GApplicationAction *value;
|
||||
GVariantBuilder builder;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("(a{s(sb)})"));
|
||||
g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{s(sb)}"));
|
||||
g_hash_table_iter_init (&iter, app->priv->actions);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&value))
|
||||
g_variant_builder_add (&builder, "{s(sb)}",
|
||||
value->name,
|
||||
value->description ? value->description : "",
|
||||
value->enabled);
|
||||
g_variant_builder_close (&builder);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_builder_end (&builder));
|
||||
}
|
||||
else if (strcmp (method_name, "InvokeAction") == 0)
|
||||
{
|
||||
const char *action_name;
|
||||
GVariant *platform_data;
|
||||
GApplicationAction *action;
|
||||
|
||||
g_variant_get (parameters, "(&s@a{sv})", &action_name, &platform_data);
|
||||
|
||||
action = g_hash_table_lookup (app->priv->actions, action_name);
|
||||
|
||||
if (!action)
|
||||
{
|
||||
char *errmsg = g_strdup_printf ("Invalid action: %s", action_name);
|
||||
g_dbus_method_invocation_return_dbus_error (invocation, G_APPLICATION_IFACE ".InvalidAction", errmsg);
|
||||
g_free (errmsg);
|
||||
g_variant_unref (platform_data);
|
||||
return;
|
||||
}
|
||||
|
||||
g_signal_emit (app, application_signals[ACTION_WITH_DATA],
|
||||
g_quark_from_string (action_name), action_name, platform_data);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
g_variant_unref (platform_data);
|
||||
}
|
||||
else if (strcmp (method_name, "Activate") == 0)
|
||||
{
|
||||
GVariant *args;
|
||||
GVariant *platform_data;
|
||||
|
||||
g_variant_get (parameters, "(@aay@a{sv})", &args, &platform_data);
|
||||
|
||||
g_signal_emit (app, application_signals[PREPARE_ACTIVATION], 0, args, platform_data);
|
||||
|
||||
g_variant_unref (args);
|
||||
g_variant_unref (platform_data);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static const GDBusArgInfo application_quit_in_args[] =
|
||||
{
|
||||
{
|
||||
-1,
|
||||
"platform_data",
|
||||
"a{sv}",
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const GDBusArgInfo * const application_quit_in_args_p[] = {
|
||||
&application_quit_in_args[0],
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusArgInfo application_list_actions_out_args[] =
|
||||
{
|
||||
{
|
||||
-1,
|
||||
"actions",
|
||||
"a{s(sb)}",
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const GDBusArgInfo * const application_list_actions_out_args_p[] = {
|
||||
&application_list_actions_out_args[0],
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusArgInfo application_invoke_action_in_args[] =
|
||||
{
|
||||
{
|
||||
-1,
|
||||
"action",
|
||||
"s",
|
||||
NULL
|
||||
},
|
||||
{
|
||||
-1,
|
||||
"platform_data",
|
||||
"a{sv}",
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const GDBusArgInfo * const application_invoke_action_in_args_p[] = {
|
||||
&application_invoke_action_in_args[0],
|
||||
&application_invoke_action_in_args[1],
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusMethodInfo application_quit_method_info =
|
||||
{
|
||||
-1,
|
||||
"Quit",
|
||||
(GDBusArgInfo **) &application_quit_in_args_p,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusMethodInfo application_list_actions_method_info =
|
||||
{
|
||||
-1,
|
||||
"ListActions",
|
||||
NULL,
|
||||
(GDBusArgInfo **) &application_list_actions_out_args_p,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusMethodInfo application_invoke_action_method_info =
|
||||
{
|
||||
-1,
|
||||
"InvokeAction",
|
||||
(GDBusArgInfo **) &application_invoke_action_in_args_p,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusArgInfo application_activate_in_args[] =
|
||||
{
|
||||
{
|
||||
-1,
|
||||
"arguments",
|
||||
"aay",
|
||||
NULL
|
||||
},
|
||||
{
|
||||
-1,
|
||||
"data",
|
||||
"a{sv}",
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const GDBusArgInfo * const application_activate_in_args_p[] = {
|
||||
&application_activate_in_args[0],
|
||||
&application_activate_in_args[1],
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusMethodInfo application_activate_method_info =
|
||||
{
|
||||
-1,
|
||||
"Activate",
|
||||
(GDBusArgInfo **) &application_activate_in_args_p,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusMethodInfo * const application_dbus_method_info_p[] =
|
||||
{
|
||||
&application_quit_method_info,
|
||||
&application_list_actions_method_info,
|
||||
&application_invoke_action_method_info,
|
||||
&application_activate_method_info,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusSignalInfo application_dbus_signal_info[] =
|
||||
{
|
||||
{
|
||||
-1,
|
||||
"ActionsChanged",
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const GDBusSignalInfo * const application_dbus_signal_info_p[] = {
|
||||
&application_dbus_signal_info[0],
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GDBusInterfaceInfo application_dbus_interface_info =
|
||||
{
|
||||
-1,
|
||||
G_APPLICATION_IFACE,
|
||||
(GDBusMethodInfo **) application_dbus_method_info_p,
|
||||
(GDBusSignalInfo **) application_dbus_signal_info_p,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static GDBusInterfaceVTable application_dbus_vtable =
|
||||
{
|
||||
application_dbus_method_call,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static gchar *
|
||||
application_path_from_appid (const gchar *appid)
|
||||
{
|
||||
gchar *appid_path, *iter;
|
||||
|
||||
|
||||
appid_path = g_strconcat ("/", appid, NULL);
|
||||
for (iter = appid_path; *iter; iter++)
|
||||
{
|
||||
if (*iter == '.')
|
||||
*iter = '/';
|
||||
}
|
||||
|
||||
return appid_path;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_g_application_platform_init (GApplication *app,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
if (app->priv->session_bus == NULL)
|
||||
app->priv->session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, error);
|
||||
if (!app->priv->session_bus)
|
||||
return FALSE;
|
||||
|
||||
if (!app->priv->dbus_path)
|
||||
app->priv->dbus_path = application_path_from_appid (app->priv->appid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_g_application_platform_register (GApplication *app,
|
||||
gboolean *unique,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GVariant *request_result;
|
||||
guint32 request_status;
|
||||
gboolean result;
|
||||
guint registration_id;
|
||||
|
||||
/* Callers should have verified this */
|
||||
g_assert (app->priv->registration_tried == FALSE);
|
||||
app->priv->registration_tried = TRUE;
|
||||
|
||||
registration_id = g_dbus_connection_register_object (app->priv->session_bus,
|
||||
app->priv->dbus_path,
|
||||
(GDBusInterfaceInfo *) &application_dbus_interface_info,
|
||||
&application_dbus_vtable,
|
||||
app,
|
||||
NULL,
|
||||
error);
|
||||
if (registration_id == 0)
|
||||
return FALSE;
|
||||
|
||||
request_result = g_dbus_connection_call_sync (app->priv->session_bus,
|
||||
"org.freedesktop.DBus",
|
||||
"/org/freedesktop/DBus",
|
||||
"org.freedesktop.DBus",
|
||||
"RequestName",
|
||||
g_variant_new ("(su)", app->priv->appid, 0x4),
|
||||
NULL, 0, -1, cancellable, error);
|
||||
|
||||
if (request_result == NULL)
|
||||
{
|
||||
result = FALSE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (g_variant_is_of_type (request_result, G_VARIANT_TYPE ("(u)")))
|
||||
g_variant_get (request_result, "(u)", &request_status);
|
||||
else
|
||||
request_status = 0;
|
||||
|
||||
g_variant_unref (request_result);
|
||||
|
||||
*unique = (request_status == 1 || request_status == 4);
|
||||
result = TRUE;
|
||||
|
||||
if (*unique)
|
||||
{
|
||||
app->priv->is_remote = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
GVariant *message;
|
||||
GVariant *result;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("(aaya{sv})"));
|
||||
g_variant_builder_add_value (&builder, app->priv->argv);
|
||||
g_variant_builder_add_value (&builder, app->priv->platform_data);
|
||||
message = g_variant_builder_end (&builder);
|
||||
|
||||
result = g_dbus_connection_call_sync (app->priv->session_bus,
|
||||
app->priv->appid,
|
||||
app->priv->dbus_path,
|
||||
G_APPLICATION_IFACE,
|
||||
"Activate",
|
||||
message,
|
||||
NULL, 0, -1, NULL, NULL);
|
||||
|
||||
if (result)
|
||||
g_variant_unref (result);
|
||||
|
||||
if (app->priv->default_quit)
|
||||
exit (0);
|
||||
}
|
||||
|
||||
done:
|
||||
if (!result)
|
||||
g_dbus_connection_unregister_object (app->priv->session_bus, registration_id);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_on_actions_changed (GApplication *app)
|
||||
{
|
||||
g_dbus_connection_emit_signal (app->priv->session_bus, NULL,
|
||||
app->priv->dbus_path,
|
||||
G_APPLICATION_IFACE,
|
||||
"ActionsChanged", NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_remote_invoke_action (GApplication *app,
|
||||
const gchar *action,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
GVariant *result;
|
||||
|
||||
result = g_dbus_connection_call_sync (app->priv->session_bus,
|
||||
app->priv->appid,
|
||||
app->priv->dbus_path,
|
||||
G_APPLICATION_IFACE,
|
||||
"InvokeAction",
|
||||
g_variant_new ("(s@a{sv})",
|
||||
action,
|
||||
platform_data),
|
||||
NULL, 0, -1, NULL, NULL);
|
||||
if (result)
|
||||
g_variant_unref (result);
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_remote_quit (GApplication *app,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
GVariant *result;
|
||||
|
||||
result = g_dbus_connection_call_sync (app->priv->session_bus,
|
||||
app->priv->appid,
|
||||
app->priv->dbus_path,
|
||||
G_APPLICATION_IFACE,
|
||||
"Quit",
|
||||
g_variant_new ("(@a{sv})",
|
||||
platform_data),
|
||||
NULL, 0, -1, NULL, NULL);
|
||||
if (result)
|
||||
g_variant_unref (result);
|
||||
}
|
@ -805,7 +805,7 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
||||
{
|
||||
gchar *encoded;
|
||||
gchar *decoded_data;
|
||||
gsize decoded_data_len;
|
||||
gsize decoded_data_len = 0;
|
||||
|
||||
encoded = g_strdup (line + 5);
|
||||
g_free (line);
|
||||
@ -1230,7 +1230,7 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
{
|
||||
gchar *encoded;
|
||||
gchar *decoded_data;
|
||||
gsize decoded_data_len;
|
||||
gsize decoded_data_len = 0;
|
||||
|
||||
encoded = g_strdup (line + 5);
|
||||
g_free (line);
|
||||
|
@ -90,6 +90,15 @@
|
||||
* kind of pitfalls it avoids
|
||||
* - Export objects before claiming names
|
||||
* - Talk about auto-starting services (cf. GBusNameWatcherFlags)
|
||||
*
|
||||
* - use abstract sockets in test code
|
||||
* - right now it doesn't work, dbus-daemon(1) fails with
|
||||
*
|
||||
* /gdbus/connection/filter: Failed to start message bus: Failed to bind
|
||||
* socket "/tmp/g-dbus-tests-pid-28531": Address already in use
|
||||
* ** WARNING **: Error reading address from dbus daemon, 0 bytes read
|
||||
*
|
||||
* or similar.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -180,6 +189,77 @@ static GDBusConnection *the_system_bus = NULL;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GDestroyNotify callback;
|
||||
gpointer user_data;
|
||||
GMainContext *context;
|
||||
} CallDestroyNotifyData;
|
||||
|
||||
static gboolean
|
||||
call_destroy_notify_data_in_idle (gpointer user_data)
|
||||
{
|
||||
CallDestroyNotifyData *data = user_data;
|
||||
data->callback (data->user_data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
call_destroy_notify_data_free (CallDestroyNotifyData *data)
|
||||
{
|
||||
if (data->context != NULL)
|
||||
g_main_context_unref (data->context);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/*
|
||||
* call_destroy_notify: <internal>
|
||||
* @context: A #GMainContext or %NULL.
|
||||
* @callback: A #GDestroyNotify or %NULL.
|
||||
* @user_data: Data to pass to @callback.
|
||||
*
|
||||
* Schedules @callback to run in @context.
|
||||
*/
|
||||
static void
|
||||
call_destroy_notify (GMainContext *context,
|
||||
GDestroyNotify callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (callback == NULL)
|
||||
goto out;
|
||||
|
||||
if (context == g_main_context_get_thread_default ())
|
||||
{
|
||||
callback (user_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
GSource *idle_source;
|
||||
CallDestroyNotifyData *data;
|
||||
|
||||
data = g_new0 (CallDestroyNotifyData, 1);
|
||||
data->callback = callback;
|
||||
data->user_data = user_data;
|
||||
data->context = context;
|
||||
if (data->context != NULL)
|
||||
g_main_context_ref (data->context);
|
||||
|
||||
idle_source = g_idle_source_new ();
|
||||
g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
|
||||
g_source_set_callback (idle_source,
|
||||
call_destroy_notify_data_in_idle,
|
||||
data,
|
||||
(GDestroyNotify) call_destroy_notify_data_free);
|
||||
g_source_attach (idle_source, data->context);
|
||||
g_source_unref (idle_source);
|
||||
}
|
||||
|
||||
out:
|
||||
;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
_g_strv_has_string (const gchar* const *haystack,
|
||||
const gchar *needle)
|
||||
@ -375,13 +455,14 @@ G_DEFINE_TYPE_WITH_CODE (GDBusConnection, g_dbus_connection, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
|
||||
);
|
||||
|
||||
static GHashTable *alive_connections = NULL;
|
||||
|
||||
static void
|
||||
g_dbus_connection_dispose (GObject *object)
|
||||
{
|
||||
GDBusConnection *connection = G_DBUS_CONNECTION (object);
|
||||
|
||||
G_LOCK (message_bus_lock);
|
||||
//g_debug ("disposing %p", connection);
|
||||
if (connection == the_session_bus)
|
||||
{
|
||||
the_session_bus = NULL;
|
||||
@ -390,11 +471,20 @@ g_dbus_connection_dispose (GObject *object)
|
||||
{
|
||||
the_system_bus = NULL;
|
||||
}
|
||||
CONNECTION_LOCK (connection);
|
||||
if (connection->worker != NULL)
|
||||
{
|
||||
_g_dbus_worker_stop (connection->worker);
|
||||
connection->worker = NULL;
|
||||
if (alive_connections != NULL)
|
||||
g_warn_if_fail (g_hash_table_remove (alive_connections, connection));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (alive_connections != NULL)
|
||||
g_warn_if_fail (g_hash_table_lookup (alive_connections, connection) == NULL);
|
||||
}
|
||||
CONNECTION_UNLOCK (connection);
|
||||
G_UNLOCK (message_bus_lock);
|
||||
|
||||
if (G_OBJECT_CLASS (g_dbus_connection_parent_class)->dispose != NULL)
|
||||
@ -419,6 +509,9 @@ g_dbus_connection_finalize (GObject *object)
|
||||
if (connection->auth != NULL)
|
||||
g_object_unref (connection->auth);
|
||||
|
||||
if (connection->credentials)
|
||||
g_object_unref (connection->credentials);
|
||||
|
||||
if (connection->stream != NULL)
|
||||
{
|
||||
/* We don't really care if closing the stream succeeds or not */
|
||||
@ -857,7 +950,7 @@ g_dbus_connection_init (GDBusConnection *connection)
|
||||
*
|
||||
* Gets the underlying stream used for IO.
|
||||
*
|
||||
* Returns: the stream used for IO
|
||||
* Returns: (transfer none): the stream used for IO
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -933,10 +1026,7 @@ flush_in_thread_func (GSimpleAsyncResult *res,
|
||||
if (!g_dbus_connection_flush_sync (G_DBUS_CONNECTION (object),
|
||||
cancellable,
|
||||
&error))
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1144,10 +1234,7 @@ close_in_thread_func (GSimpleAsyncResult *res,
|
||||
if (!g_dbus_connection_close_sync (G_DBUS_CONNECTION (object),
|
||||
cancellable,
|
||||
&error))
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1655,7 +1742,7 @@ g_dbus_connection_send_message_with_reply_unlocked (GDBusConnection *connect
|
||||
error = NULL;
|
||||
if (!g_dbus_connection_send_message_unlocked (connection, message, flags, out_serial, &error))
|
||||
{
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete_in_idle (simple);
|
||||
g_object_unref (simple);
|
||||
goto out;
|
||||
@ -1683,14 +1770,17 @@ g_dbus_connection_send_message_with_reply_unlocked (GDBusConnection *connect
|
||||
(GDestroyNotify) g_object_unref);
|
||||
}
|
||||
|
||||
data->timeout_source = g_timeout_source_new (timeout_msec);
|
||||
g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT);
|
||||
g_source_set_callback (data->timeout_source,
|
||||
send_message_with_reply_timeout_cb,
|
||||
send_message_data_ref (data),
|
||||
(GDestroyNotify) send_message_data_unref);
|
||||
g_source_attach (data->timeout_source, data->main_context);
|
||||
g_source_unref (data->timeout_source);
|
||||
if (timeout_msec != G_MAXINT)
|
||||
{
|
||||
data->timeout_source = g_timeout_source_new (timeout_msec);
|
||||
g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT);
|
||||
g_source_set_callback (data->timeout_source,
|
||||
send_message_with_reply_timeout_cb,
|
||||
send_message_data_ref (data),
|
||||
(GDestroyNotify) send_message_data_unref);
|
||||
g_source_attach (data->timeout_source, data->main_context);
|
||||
g_source_unref (data->timeout_source);
|
||||
}
|
||||
|
||||
g_hash_table_insert (connection->map_method_serial_to_send_message_data,
|
||||
GUINT_TO_POINTER (*out_serial),
|
||||
@ -1705,7 +1795,8 @@ g_dbus_connection_send_message_with_reply_unlocked (GDBusConnection *connect
|
||||
* @connection: A #GDBusConnection.
|
||||
* @message: A #GDBusMessage.
|
||||
* @flags: Flags affecting how the message is sent.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||
* @timeout_msec: The timeout in milliseconds, -1 to use the default
|
||||
* timeout or %G_MAXINT for no timeout.
|
||||
* @out_serial: Return location for serial number assigned to @message when sending it or %NULL.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
|
||||
@ -1785,7 +1876,7 @@ g_dbus_connection_send_message_with_reply (GDBusConnection *connection,
|
||||
* linkend="gdbus-unix-fd-client"/> for an example of how to use this
|
||||
* low-level API to send and receive UNIX file descriptors.
|
||||
*
|
||||
* Returns: A locked #GDBusMessage or %NULL if @error is set.
|
||||
* Returns: (transfer full): A locked #GDBusMessage or %NULL if @error is set.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -1847,7 +1938,8 @@ send_message_with_reply_sync_cb (GDBusConnection *connection,
|
||||
* @connection: A #GDBusConnection.
|
||||
* @message: A #GDBusMessage.
|
||||
* @flags: Flags affecting how the message is sent.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||
* @timeout_msec: The timeout in milliseconds, -1 to use the default
|
||||
* timeout or %G_MAXINT for no timeout.
|
||||
* @out_serial: Return location for serial number assigned to @message when sending it or %NULL.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @error: Return location for error or %NULL.
|
||||
@ -1881,7 +1973,7 @@ send_message_with_reply_sync_cb (GDBusConnection *connection,
|
||||
* Note that @message must be unlocked, unless @flags contain the
|
||||
* %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
|
||||
*
|
||||
* Returns: A locked #GDBusMessage that is the reply to @message or %NULL if @error is set.
|
||||
* Returns: (transfer full): A locked #GDBusMessage that is the reply to @message or %NULL if @error is set.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -1954,19 +2046,31 @@ on_worker_message_received (GDBusWorker *worker,
|
||||
GDBusMessage *message,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDBusConnection *connection = G_DBUS_CONNECTION (user_data);
|
||||
GDBusConnection *connection;
|
||||
FilterCallback *filters;
|
||||
gboolean consumed_by_filter;
|
||||
gboolean altered_by_filter;
|
||||
guint num_filters;
|
||||
guint n;
|
||||
gboolean alive;
|
||||
|
||||
G_LOCK (message_bus_lock);
|
||||
alive = (g_hash_table_lookup (alive_connections, user_data) != NULL);
|
||||
if (!alive)
|
||||
{
|
||||
G_UNLOCK (message_bus_lock);
|
||||
return;
|
||||
}
|
||||
connection = G_DBUS_CONNECTION (user_data);
|
||||
g_object_ref (connection);
|
||||
G_UNLOCK (message_bus_lock);
|
||||
|
||||
//g_debug ("in on_worker_message_received");
|
||||
|
||||
g_object_ref (message);
|
||||
g_dbus_message_lock (message);
|
||||
|
||||
g_object_ref (connection);
|
||||
//g_debug ("boo ref_count = %d %p %p", G_OBJECT (connection)->ref_count, connection, connection->worker);
|
||||
|
||||
/* First collect the set of callback functions */
|
||||
CONNECTION_LOCK (connection);
|
||||
@ -2048,13 +2152,24 @@ on_worker_message_about_to_be_sent (GDBusWorker *worker,
|
||||
GDBusMessage *message,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDBusConnection *connection = G_DBUS_CONNECTION (user_data);
|
||||
GDBusConnection *connection;
|
||||
FilterCallback *filters;
|
||||
guint num_filters;
|
||||
guint n;
|
||||
gboolean alive;
|
||||
|
||||
G_LOCK (message_bus_lock);
|
||||
alive = (g_hash_table_lookup (alive_connections, user_data) != NULL);
|
||||
if (!alive)
|
||||
{
|
||||
G_UNLOCK (message_bus_lock);
|
||||
return message;
|
||||
}
|
||||
connection = G_DBUS_CONNECTION (user_data);
|
||||
g_object_ref (connection);
|
||||
G_UNLOCK (message_bus_lock);
|
||||
|
||||
//g_debug ("in on_worker_message_about_to_be_sent");
|
||||
g_object_ref (connection);
|
||||
|
||||
/* First collect the set of callback functions */
|
||||
CONNECTION_LOCK (connection);
|
||||
@ -2093,7 +2208,19 @@ on_worker_closed (GDBusWorker *worker,
|
||||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDBusConnection *connection = G_DBUS_CONNECTION (user_data);
|
||||
GDBusConnection *connection;
|
||||
gboolean alive;
|
||||
|
||||
G_LOCK (message_bus_lock);
|
||||
alive = (g_hash_table_lookup (alive_connections, user_data) != NULL);
|
||||
if (!alive)
|
||||
{
|
||||
G_UNLOCK (message_bus_lock);
|
||||
return;
|
||||
}
|
||||
connection = G_DBUS_CONNECTION (user_data);
|
||||
g_object_ref (connection);
|
||||
G_UNLOCK (message_bus_lock);
|
||||
|
||||
//g_debug ("in on_worker_closed: %s", error->message);
|
||||
|
||||
@ -2101,6 +2228,8 @@ on_worker_closed (GDBusWorker *worker,
|
||||
if (!connection->closed)
|
||||
set_closed_unlocked (connection, remote_peer_vanished, error);
|
||||
CONNECTION_UNLOCK (connection);
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
@ -2241,6 +2370,12 @@ initable_init (GInitable *initable,
|
||||
}
|
||||
#endif
|
||||
|
||||
G_LOCK (message_bus_lock);
|
||||
if (alive_connections == NULL)
|
||||
alive_connections = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
g_hash_table_insert (alive_connections, connection, connection);
|
||||
G_UNLOCK (message_bus_lock);
|
||||
|
||||
connection->worker = _g_dbus_worker_new (connection->stream,
|
||||
connection->capabilities,
|
||||
(connection->flags & G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING),
|
||||
@ -2666,7 +2801,7 @@ g_dbus_connection_get_unique_name (GDBusConnection *connection)
|
||||
* each application is a client. So this method will always return
|
||||
* %NULL for message bus clients.
|
||||
*
|
||||
* Returns: A #GCredentials or %NULL if not available. Do not free
|
||||
* Returns: (transfer none): A #GCredentials or %NULL if not available. Do not free
|
||||
* this object, it is owned by @connection.
|
||||
*
|
||||
* Since: 2.26
|
||||
@ -2842,11 +2977,14 @@ args_to_rule (const gchar *sender,
|
||||
const gchar *interface_name,
|
||||
const gchar *member,
|
||||
const gchar *object_path,
|
||||
const gchar *arg0)
|
||||
const gchar *arg0,
|
||||
gboolean negate)
|
||||
{
|
||||
GString *rule;
|
||||
|
||||
rule = g_string_new ("type='signal'");
|
||||
if (negate)
|
||||
g_string_prepend_c (rule, '-');
|
||||
if (sender != NULL)
|
||||
g_string_append_printf (rule, ",sender='%s'", sender);
|
||||
if (interface_name != NULL)
|
||||
@ -2875,6 +3013,9 @@ add_match_rule (GDBusConnection *connection,
|
||||
GError *error;
|
||||
GDBusMessage *message;
|
||||
|
||||
if (match_rule[0] == '-')
|
||||
return;
|
||||
|
||||
message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */
|
||||
"/org/freedesktop/DBus", /* path */
|
||||
"org.freedesktop.DBus", /* interface */
|
||||
@ -2903,6 +3044,9 @@ remove_match_rule (GDBusConnection *connection,
|
||||
GError *error;
|
||||
GDBusMessage *message;
|
||||
|
||||
if (match_rule[0] == '-')
|
||||
return;
|
||||
|
||||
message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */
|
||||
"/org/freedesktop/DBus", /* path */
|
||||
"org.freedesktop.DBus", /* interface */
|
||||
@ -3006,7 +3150,16 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
|
||||
|
||||
CONNECTION_LOCK (connection);
|
||||
|
||||
rule = args_to_rule (sender, interface_name, member, object_path, arg0);
|
||||
/* If G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE was specified, we will end up
|
||||
* with a '-' character to prefix the rule (which will otherwise be
|
||||
* normal).
|
||||
*
|
||||
* This allows us to hash the rule and do our lifecycle tracking in
|
||||
* the usual way, but the '-' prevents the match rule from ever
|
||||
* actually being send to the bus (either for add or remove).
|
||||
*/
|
||||
rule = args_to_rule (sender, interface_name, member, object_path, arg0,
|
||||
(flags & G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE) != 0);
|
||||
|
||||
if (sender != NULL && (g_dbus_is_unique_name (sender) || g_strcmp0 (sender, "org.freedesktop.DBus") == 0))
|
||||
sender_unique_name = sender;
|
||||
@ -3178,8 +3331,9 @@ g_dbus_connection_signal_unsubscribe (GDBusConnection *connection,
|
||||
{
|
||||
SignalSubscriber *subscriber;
|
||||
subscriber = &(g_array_index (subscribers, SignalSubscriber, n));
|
||||
if (subscriber->user_data_free_func != NULL)
|
||||
subscriber->user_data_free_func (subscriber->user_data);
|
||||
call_destroy_notify (subscriber->context,
|
||||
subscriber->user_data_free_func,
|
||||
subscriber->user_data);
|
||||
if (subscriber->context != NULL)
|
||||
g_main_context_unref (subscriber->context);
|
||||
}
|
||||
@ -3425,8 +3579,9 @@ purge_all_signal_subscriptions (GDBusConnection *connection)
|
||||
{
|
||||
SignalSubscriber *subscriber;
|
||||
subscriber = &(g_array_index (subscribers, SignalSubscriber, n));
|
||||
if (subscriber->user_data_free_func != NULL)
|
||||
subscriber->user_data_free_func (subscriber->user_data);
|
||||
call_destroy_notify (subscriber->context,
|
||||
subscriber->user_data_free_func,
|
||||
subscriber->user_data);
|
||||
if (subscriber->context != NULL)
|
||||
g_main_context_unref (subscriber->context);
|
||||
}
|
||||
@ -3508,9 +3663,9 @@ exported_interface_free (ExportedInterface *ei)
|
||||
{
|
||||
g_dbus_interface_info_unref ((GDBusInterfaceInfo *) ei->interface_info);
|
||||
|
||||
if (ei->user_data_free_func != NULL)
|
||||
/* TODO: push to thread-default mainloop */
|
||||
ei->user_data_free_func (ei->user_data);
|
||||
call_destroy_notify (ei->context,
|
||||
ei->user_data_free_func,
|
||||
ei->user_data);
|
||||
|
||||
if (ei->context != NULL)
|
||||
g_main_context_unref (ei->context);
|
||||
@ -4831,10 +4986,7 @@ g_dbus_connection_call_done (GObject *source,
|
||||
value = NULL;
|
||||
|
||||
if (value == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (state->simple, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (state->simple, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gpointer (state->simple, value,
|
||||
(GDestroyNotify) g_variant_unref);
|
||||
@ -4857,7 +5009,8 @@ g_dbus_connection_call_done (GObject *source,
|
||||
* @parameters: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
|
||||
* @reply_type: The expected type of the reply, or %NULL.
|
||||
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||
* @timeout_msec: The timeout in milliseconds, -1 to use the default
|
||||
* timeout or %G_MAXINT for no timeout.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
|
||||
* care about the result of the method invocation.
|
||||
@ -5023,7 +5176,8 @@ g_dbus_connection_call_finish (GDBusConnection *connection,
|
||||
* @parameters: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
|
||||
* @reply_type: The expected type of the reply, or %NULL.
|
||||
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||
* @timeout_msec: The timeout in milliseconds, -1 to use the default
|
||||
* timeout or %G_MAXINT for no timeout.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @error: Return location for error or %NULL.
|
||||
*
|
||||
@ -5193,9 +5347,9 @@ struct ExportedSubtree
|
||||
static void
|
||||
exported_subtree_free (ExportedSubtree *es)
|
||||
{
|
||||
if (es->user_data_free_func != NULL)
|
||||
/* TODO: push to thread-default mainloop */
|
||||
es->user_data_free_func (es->user_data);
|
||||
call_destroy_notify (es->context,
|
||||
es->user_data_free_func,
|
||||
es->user_data);
|
||||
|
||||
if (es->context != NULL)
|
||||
g_main_context_unref (es->context);
|
||||
@ -6098,7 +6252,7 @@ get_uninitialized_connection (GBusType bus_type,
|
||||
* Note that the returned #GDBusConnection object will (usually) have
|
||||
* the #GDBusConnection:exit-on-close property set to %TRUE.
|
||||
*
|
||||
* Returns: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
|
||||
* Returns: (transfer full): A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -6139,8 +6293,7 @@ bus_get_async_initable_cb (GObject *source_object,
|
||||
&error))
|
||||
{
|
||||
g_assert (error != NULL);
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_object_unref (source_object);
|
||||
}
|
||||
else
|
||||
@ -6190,8 +6343,7 @@ g_bus_get (GBusType bus_type,
|
||||
if (connection == NULL)
|
||||
{
|
||||
g_assert (error != NULL);
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete_in_idle (simple);
|
||||
g_object_unref (simple);
|
||||
}
|
||||
@ -6221,7 +6373,7 @@ g_bus_get (GBusType bus_type,
|
||||
* Note that the returned #GDBusConnection object will (usually) have
|
||||
* the #GDBusConnection:exit-on-close property set to %TRUE.
|
||||
*
|
||||
* Returns: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
|
||||
* Returns: (transfer full): A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
/**
|
||||
* SECTION:gdbuserror
|
||||
* @title: GDBusError
|
||||
* @short_description: Mapping D-Bus errors to and from #GError
|
||||
* @short_description: Mapping D-Bus errors to and from GError
|
||||
* @include: gio/gio.h
|
||||
*
|
||||
* All facilities that return errors from remote methods (such as
|
||||
|
@ -294,7 +294,7 @@ g_dbus_message_new_signal (const gchar *path,
|
||||
*
|
||||
* Creates a new #GDBusMessage that is a reply to @method_call_message.
|
||||
*
|
||||
* Returns: A #GDBusMessage. Free with g_object_unref().
|
||||
* Returns: (transfer full): #GDBusMessage. Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -332,7 +332,7 @@ g_dbus_message_new_method_reply (GDBusMessage *method_call_message)
|
||||
*
|
||||
* Creates a new #GDBusMessage that is an error reply to @method_call_message.
|
||||
*
|
||||
* Returns: A #GDBusMessage. Free with g_object_unref().
|
||||
* Returns: (transfer full): A #GDBusMessage. Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -364,7 +364,7 @@ g_dbus_message_new_method_error (GDBusMessage *method_call_message,
|
||||
*
|
||||
* Creates a new #GDBusMessage that is an error reply to @method_call_message.
|
||||
*
|
||||
* Returns: A #GDBusMessage. Free with g_object_unref().
|
||||
* Returns: (transfer full): A #GDBusMessage. Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -409,7 +409,7 @@ g_dbus_message_new_method_error_literal (GDBusMessage *method_call_message,
|
||||
*
|
||||
* Like g_dbus_message_new_method_error() but intended for language bindings.
|
||||
*
|
||||
* Returns: A #GDBusMessage. Free with g_object_unref().
|
||||
* Returns: (transfer full): A #GDBusMessage. Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -780,7 +780,7 @@ g_dbus_message_set_body (GDBusMessage *message,
|
||||
*
|
||||
* This method is only available on UNIX.
|
||||
*
|
||||
* Returns: A #GUnixFDList or %NULL if no file descriptors are
|
||||
* Returns: (transfer none):A #GUnixFDList or %NULL if no file descriptors are
|
||||
* associated. Do not free, this object is owned by @message.
|
||||
*
|
||||
* Since: 2.26
|
||||
@ -1183,10 +1183,10 @@ parse_value_from_blob (GMemoryInputStream *mis,
|
||||
{
|
||||
guint64 v;
|
||||
gdouble *encoded;
|
||||
G_STATIC_ASSERT (sizeof (gdouble) == sizeof (guint64));
|
||||
v = g_data_input_stream_read_uint64 (dis, NULL, &local_error);
|
||||
if (local_error != NULL)
|
||||
goto fail;
|
||||
G_STATIC_ASSERT (sizeof (gdouble) == sizeof (guint64));
|
||||
encoded = (gdouble *) &v;
|
||||
ret = g_variant_new_double (*encoded);
|
||||
}
|
||||
@ -3195,7 +3195,7 @@ g_dbus_message_lock (GDBusMessage *message)
|
||||
* This operation can fail if e.g. @message contains file descriptors
|
||||
* and the per-process or system-wide open files limit is reached.
|
||||
*
|
||||
* Returns: A new #GDBusMessage or %NULL if @error is set. Free with
|
||||
* Returns: (transfer full): A new #GDBusMessage or %NULL if @error is set. Free with
|
||||
* g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
|
@ -210,7 +210,7 @@ g_dbus_method_invocation_get_method_name (GDBusMethodInvocation *invocation)
|
||||
*
|
||||
* Gets the #GDBusConnection the method was invoked on.
|
||||
*
|
||||
* Returns: A #GDBusConnection. Do not free, it is owned by @invocation.
|
||||
* Returns: (transfer none):A #GDBusConnection. Do not free, it is owned by @invocation.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -234,7 +234,7 @@ g_dbus_method_invocation_get_connection (GDBusMethodInvocation *invocation)
|
||||
* linkend="gdbus-unix-fd-client"/> for an example of how to use this
|
||||
* low-level API to send and receive UNIX file descriptors.
|
||||
*
|
||||
* Returns: A #GDBusMessage. Do not free, it is owned by @invocation.
|
||||
* Returns: (transfer none): #GDBusMessage. Do not free, it is owned by @invocation.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -263,7 +263,7 @@ g_dbus_method_invocation_get_parameters (GDBusMethodInvocation *invocation)
|
||||
}
|
||||
|
||||
/**
|
||||
* g_dbus_method_invocation_get_user_data:
|
||||
* g_dbus_method_invocation_get_user_data: (skip)
|
||||
* @invocation: A #GDBusMethodInvocation.
|
||||
*
|
||||
* Gets the @user_data #gpointer passed to g_dbus_connection_register_object().
|
||||
|
@ -153,8 +153,7 @@ _g_socket_read_with_control_messages_ready (GSocket *socket,
|
||||
else
|
||||
{
|
||||
g_assert (error != NULL);
|
||||
g_simple_async_result_set_from_error (data->simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (data->simple, error);
|
||||
}
|
||||
|
||||
if (data->from_mainloop)
|
||||
@ -876,7 +875,8 @@ static void
|
||||
message_to_write_data_free (MessageToWriteData *data)
|
||||
{
|
||||
_g_dbus_worker_unref (data->worker);
|
||||
g_object_unref (data->message);
|
||||
if (data->message)
|
||||
g_object_unref (data->message);
|
||||
g_free (data->blob);
|
||||
g_free (data);
|
||||
}
|
||||
@ -907,8 +907,7 @@ write_message_async_cb (GObject *source_object,
|
||||
&error);
|
||||
if (bytes_written == -1)
|
||||
{
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete (simple);
|
||||
g_object_unref (simple);
|
||||
goto out;
|
||||
@ -1027,8 +1026,7 @@ write_message_continue_writing (MessageToWriteData *data)
|
||||
g_error_free (error);
|
||||
goto out;
|
||||
}
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete (simple);
|
||||
g_object_unref (simple);
|
||||
goto out;
|
||||
@ -1443,22 +1441,14 @@ _g_dbus_worker_new (GIOStream *stream,
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* This can be called from any thread - frees worker - guarantees no callbacks
|
||||
* will ever be issued again
|
||||
/* This can be called from any thread - frees worker. Note that
|
||||
* callbacks might still happen if called from another thread than the
|
||||
* worker - use your own synchronization primitive in the callbacks.
|
||||
*/
|
||||
void
|
||||
_g_dbus_worker_stop (GDBusWorker *worker)
|
||||
{
|
||||
/* If we're called in the worker thread it means we are called from
|
||||
* a worker callback. This is fine, we just can't lock in that case since
|
||||
* we're already holding the lock...
|
||||
*/
|
||||
if (g_thread_self () != worker->thread)
|
||||
g_mutex_lock (worker->read_lock);
|
||||
worker->stopped = TRUE;
|
||||
if (g_thread_self () != worker->thread)
|
||||
g_mutex_unlock (worker->read_lock);
|
||||
|
||||
g_cancellable_cancel (worker->cancellable);
|
||||
_g_dbus_worker_unref (worker);
|
||||
}
|
||||
|
@ -1140,8 +1140,7 @@ async_init_get_name_owner_cb (GDBusConnection *connection,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_simple_async_result_set_from_error (data->simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (data->simple, error);
|
||||
g_simple_async_result_complete_in_idle (data->simple);
|
||||
async_init_data_free (data);
|
||||
goto out;
|
||||
@ -1265,8 +1264,7 @@ async_init_start_service_by_name_cb (GDBusConnection *connection,
|
||||
|
||||
failed:
|
||||
g_warn_if_fail (error != NULL);
|
||||
g_simple_async_result_set_from_error (data->simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (data->simple, error);
|
||||
g_simple_async_result_complete_in_idle (data->simple);
|
||||
async_init_data_free (data);
|
||||
}
|
||||
@ -1453,8 +1451,7 @@ get_connection_cb (GObject *source_object,
|
||||
data->callback,
|
||||
data->user_data,
|
||||
NULL);
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete_in_idle (simple);
|
||||
g_object_unref (simple);
|
||||
}
|
||||
@ -1905,7 +1902,7 @@ g_dbus_proxy_new_for_bus_sync (GBusType bus_type,
|
||||
*
|
||||
* Gets the connection @proxy is for.
|
||||
*
|
||||
* Returns: A #GDBusConnection owned by @proxy. Do not free.
|
||||
* Returns: (transfer none): A #GDBusConnection owned by @proxy. Do not free.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -2148,9 +2145,7 @@ reply_cb (GDBusConnection *connection,
|
||||
&error);
|
||||
if (error != NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (simple,
|
||||
error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2214,7 +2209,8 @@ get_destination_for_call (GDBusProxy *proxy)
|
||||
* @method_name: Name of method to invoke.
|
||||
* @parameters: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
|
||||
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the proxy default timeout.
|
||||
* @timeout_msec: The timeout in milliseconds (with %G_MAXINT meaning
|
||||
* "infinite") or -1 to use the proxy default timeout.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
|
||||
* care about the result of the method invocation.
|
||||
@ -2381,7 +2377,8 @@ g_dbus_proxy_call_finish (GDBusProxy *proxy,
|
||||
* @method_name: Name of method to invoke.
|
||||
* @parameters: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
|
||||
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the proxy default timeout.
|
||||
* @timeout_msec: The timeout in milliseconds (with %G_MAXINT meaning
|
||||
* "infinite") or -1 to use the proxy default timeout.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @error: Return location for error or %NULL.
|
||||
*
|
||||
|
@ -70,21 +70,7 @@ g_delayed_settings_backend_notify_unapplied (GDelayedSettingsBackend *delayed)
|
||||
g_static_mutex_unlock (&delayed->priv->lock);
|
||||
|
||||
if (target != NULL)
|
||||
{
|
||||
if (g_settings_backend_get_active_context () != target_context)
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_priority (source, G_PRIORITY_DEFAULT);
|
||||
g_source_set_callback (source, invoke_notify_unapplied,
|
||||
target, g_object_unref);
|
||||
g_source_attach (source, target_context);
|
||||
g_source_unref (source);
|
||||
}
|
||||
else
|
||||
invoke_notify_unapplied (target);
|
||||
}
|
||||
g_main_context_invoke (target_context, invoke_notify_unapplied, target);
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include <crt_externs.h>
|
||||
#endif
|
||||
|
||||
#undef G_DISABLE_DEPRECATED
|
||||
|
||||
#include "gcontenttypeprivate.h"
|
||||
#include "gdesktopappinfo.h"
|
||||
#include "gfile.h"
|
||||
@ -1635,7 +1637,7 @@ g_desktop_app_info_delete (GAppInfo *appinfo)
|
||||
*
|
||||
* Creates a new #GAppInfo from the given information.
|
||||
*
|
||||
* Returns: new #GAppInfo for given command.
|
||||
* Returns: (transfer full): new #GAppInfo for given command.
|
||||
**/
|
||||
GAppInfo *
|
||||
g_app_info_create_from_commandline (const char *commandline,
|
||||
@ -1838,57 +1840,18 @@ g_app_info_get_default_for_type (const char *content_type,
|
||||
GAppInfo *
|
||||
g_app_info_get_default_for_uri_scheme (const char *uri_scheme)
|
||||
{
|
||||
static gsize lookup = 0;
|
||||
|
||||
if (g_once_init_enter (&lookup))
|
||||
{
|
||||
gsize setup_value = 1;
|
||||
GDesktopAppInfoLookup *lookup_instance;
|
||||
const char *use_this;
|
||||
GIOExtensionPoint *ep;
|
||||
GIOExtension *extension;
|
||||
GList *l;
|
||||
GAppInfo *app_info;
|
||||
char *content_type, *scheme_down;
|
||||
|
||||
use_this = g_getenv ("GIO_USE_URI_ASSOCIATION");
|
||||
|
||||
/* Ensure vfs in modules loaded */
|
||||
_g_io_modules_ensure_loaded ();
|
||||
|
||||
ep = g_io_extension_point_lookup (G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME);
|
||||
scheme_down = g_ascii_strdown (uri_scheme, -1);
|
||||
content_type = g_strdup_printf ("x-scheme-handler/%s", scheme_down);
|
||||
g_free (scheme_down);
|
||||
app_info = g_app_info_get_default_for_type (content_type, FALSE);
|
||||
g_free (content_type);
|
||||
|
||||
lookup_instance = NULL;
|
||||
if (use_this)
|
||||
{
|
||||
extension = g_io_extension_point_get_extension_by_name (ep, use_this);
|
||||
if (extension)
|
||||
lookup_instance = g_object_new (g_io_extension_get_type (extension), NULL);
|
||||
}
|
||||
|
||||
if (lookup_instance == NULL)
|
||||
{
|
||||
for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next)
|
||||
{
|
||||
extension = l->data;
|
||||
lookup_instance = g_object_new (g_io_extension_get_type (extension), NULL);
|
||||
if (lookup_instance != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lookup_instance != NULL)
|
||||
setup_value = (gsize)lookup_instance;
|
||||
|
||||
g_once_init_leave (&lookup, setup_value);
|
||||
}
|
||||
|
||||
if (lookup == 1)
|
||||
return NULL;
|
||||
|
||||
return g_desktop_app_info_lookup_get_default_for_uri_scheme (G_DESKTOP_APP_INFO_LOOKUP (lookup),
|
||||
uri_scheme);
|
||||
return app_info;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
get_apps_from_dir (GHashTable *apps,
|
||||
const char *dirname,
|
||||
@ -2701,7 +2664,9 @@ g_desktop_app_info_lookup_default_init (GDesktopAppInfoLookupInterface *iface)
|
||||
* in a GIO module. There is no reason for applications to use it
|
||||
* directly. Applications should use g_app_info_get_default_for_uri_scheme().
|
||||
*
|
||||
* Returns: #GAppInfo for given @uri_scheme or %NULL on error.
|
||||
* Returns: (transfer full): #GAppInfo for given @uri_scheme or %NULL on error.
|
||||
*
|
||||
* Deprecated: The #GDesktopAppInfoLookup interface is deprecated and unused by gio.
|
||||
*/
|
||||
GAppInfo *
|
||||
g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
|
||||
|
@ -56,6 +56,8 @@ gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
|
||||
void g_desktop_app_info_set_desktop_env (const char *desktop_env);
|
||||
|
||||
|
||||
#ifndef G_DISABLE_DEPRECATED
|
||||
|
||||
#define G_TYPE_DESKTOP_APP_INFO_LOOKUP (g_desktop_app_info_lookup_get_type ())
|
||||
#define G_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookup))
|
||||
#define G_IS_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP))
|
||||
@ -91,6 +93,8 @@ GType g_desktop_app_info_lookup_get_type (void) G_GNUC_CON
|
||||
GAppInfo *g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
|
||||
const char *uri_scheme);
|
||||
|
||||
#endif /* G_DISABLE_DEPRECATED */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_DESKTOP_APP_INFO_H__ */
|
||||
|
@ -159,7 +159,7 @@ g_drive_get_name (GDrive *drive)
|
||||
*
|
||||
* Gets the icon for @drive.
|
||||
*
|
||||
* Returns: #GIcon for the @drive.
|
||||
* Returns: (transfer full): #GIcon for the @drive.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GIcon *
|
||||
@ -594,7 +594,7 @@ g_drive_get_identifier (GDrive *drive,
|
||||
* Use g_drive_get_identifer() to obtain the identifiers
|
||||
* themselves.
|
||||
*
|
||||
* Returns: a %NULL-terminated array of strings containing
|
||||
* Returns: (transfer full): a %NULL-terminated array of strings containing
|
||||
* kinds of identifiers. Use g_strfreev() to free.
|
||||
*/
|
||||
char **
|
||||
|
@ -105,8 +105,7 @@ g_dummy_proxy_resolver_lookup_async (GProxyResolver *resolver,
|
||||
|
||||
if (proxies == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ g_emblem_new_with_origin (GIcon *icon,
|
||||
*
|
||||
* Gives back the icon from @emblem.
|
||||
*
|
||||
* Returns: a #GIcon. The returned object belongs to the emblem
|
||||
* Returns: (transfer full): a #GIcon. The returned object belongs to the emblem
|
||||
* and should not be modified or freed.
|
||||
*
|
||||
* Since: 2.18
|
||||
|
@ -95,11 +95,11 @@ g_emblemed_icon_init (GEmblemedIcon *emblemed)
|
||||
/**
|
||||
* g_emblemed_icon_new:
|
||||
* @icon: a #GIcon
|
||||
* @emblem: a #GEmblem
|
||||
* @emblem: (allow-none): a #GEmblem, or %NULL
|
||||
*
|
||||
* Creates a new emblemed icon for @icon with the emblem @emblem.
|
||||
*
|
||||
* Returns: a new #GIcon
|
||||
* Returns: (transfer full): a new #GIcon
|
||||
*
|
||||
* Since: 2.18
|
||||
**/
|
||||
@ -111,12 +111,12 @@ g_emblemed_icon_new (GIcon *icon,
|
||||
|
||||
g_return_val_if_fail (G_IS_ICON (icon), NULL);
|
||||
g_return_val_if_fail (!G_IS_EMBLEM (icon), NULL);
|
||||
g_return_val_if_fail (G_IS_EMBLEM (emblem), NULL);
|
||||
|
||||
emblemed = G_EMBLEMED_ICON (g_object_new (G_TYPE_EMBLEMED_ICON, NULL));
|
||||
emblemed->icon = g_object_ref (icon);
|
||||
|
||||
g_emblemed_icon_add_emblem (emblemed, emblem);
|
||||
|
||||
if (emblem != NULL)
|
||||
g_emblemed_icon_add_emblem (emblemed, emblem);
|
||||
|
||||
return G_ICON (emblemed);
|
||||
}
|
||||
@ -128,7 +128,7 @@ g_emblemed_icon_new (GIcon *icon,
|
||||
*
|
||||
* Gets the main icon for @emblemed.
|
||||
*
|
||||
* Returns: a #GIcon that is owned by @emblemed
|
||||
* Returns: (transfer full): a #GIcon that is owned by @emblemed
|
||||
*
|
||||
* Since: 2.18
|
||||
**/
|
||||
@ -146,7 +146,8 @@ g_emblemed_icon_get_icon (GEmblemedIcon *emblemed)
|
||||
*
|
||||
* Gets the list of emblems for the @icon.
|
||||
*
|
||||
* Returns: a #GList of #GEmblem <!-- -->s that is owned by @emblemed
|
||||
* Returns: (element-type utf8) (transfer none): a #GList of #GEmblem <!-- -->s that
|
||||
* is owned by @emblemed
|
||||
*
|
||||
* Since: 2.18
|
||||
**/
|
||||
|
169
gio/gfile.c
169
gio/gfile.c
@ -521,7 +521,7 @@ g_file_get_parse_name (GFile *file)
|
||||
*
|
||||
* This call does no blocking i/o.
|
||||
*
|
||||
* Returns: a new #GFile that is a duplicate of the given #GFile.
|
||||
* Returns: (transfer full): a new #GFile that is a duplicate of the given #GFile.
|
||||
**/
|
||||
GFile *
|
||||
g_file_dup (GFile *file)
|
||||
@ -542,7 +542,8 @@ g_file_dup (GFile *file)
|
||||
* Creates a hash value for a #GFile.
|
||||
*
|
||||
* This call does no blocking i/o.
|
||||
*
|
||||
*
|
||||
* Virtual: hash
|
||||
* Returns: 0 if @file is not a valid #GFile, otherwise an
|
||||
* integer that can be used as hash value for the #GFile.
|
||||
* This function is intended for easily hashing a #GFile to
|
||||
@ -603,7 +604,7 @@ g_file_equal (GFile *file1,
|
||||
*
|
||||
* This call does no blocking i/o.
|
||||
*
|
||||
* Returns: a #GFile structure to the parent of the given
|
||||
* Returns: (transfer full): a #GFile structure to the parent of the given
|
||||
* #GFile or %NULL if there is no parent.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
@ -675,7 +676,7 @@ g_file_has_parent (GFile *file,
|
||||
*
|
||||
* This call does no blocking i/o.
|
||||
*
|
||||
* Returns: a #GFile to a child specified by @name.
|
||||
* Returns: (transfer full): a #GFile to a child specified by @name.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
@ -702,7 +703,7 @@ g_file_get_child (GFile *file,
|
||||
*
|
||||
* This call does no blocking i/o.
|
||||
*
|
||||
* Returns: a #GFile to the specified child, or
|
||||
* Returns: (transfer full): a #GFile to the specified child, or
|
||||
* %NULL if the display name couldn't be converted.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
@ -736,6 +737,7 @@ g_file_get_child_for_display_name (GFile *file,
|
||||
* filesystem point of view), because the prefix of @file is an alias
|
||||
* of @prefix.
|
||||
*
|
||||
* Virtual: prefix_matches
|
||||
* Returns: %TRUE if the @files's parent, grandparent, etc is @prefix.
|
||||
* %FALSE otherwise.
|
||||
**/
|
||||
@ -797,7 +799,7 @@ g_file_get_relative_path (GFile *parent,
|
||||
*
|
||||
* This call does no blocking i/o.
|
||||
*
|
||||
* Returns: #GFile to the resolved path. %NULL if @relative_path
|
||||
* Returns: (transfer full): #GFile to the resolved path. %NULL if @relative_path
|
||||
* is %NULL or if @file is invalid.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
@ -843,7 +845,7 @@ g_file_resolve_relative_path (GFile *file,
|
||||
* If the file is not a directory, the G_FILE_ERROR_NOTDIR error will be returned.
|
||||
* Other errors are possible too.
|
||||
*
|
||||
* Returns: A #GFileEnumerator if successful, %NULL on error.
|
||||
* Returns: (transfer full): A #GFileEnumerator if successful, %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileEnumerator *
|
||||
@ -928,7 +930,7 @@ g_file_enumerate_children_async (GFile *file,
|
||||
* Finishes an async enumerate children operation.
|
||||
* See g_file_enumerate_children_async().
|
||||
*
|
||||
* Returns: a #GFileEnumerator or %NULL if an error occurred.
|
||||
* Returns: (transfer full): a #GFileEnumerator or %NULL if an error occurred.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileEnumerator *
|
||||
@ -1074,7 +1076,7 @@ g_file_query_file_type (GFile *file,
|
||||
* If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
|
||||
* Other errors are possible too, and depend on what kind of filesystem the file is on.
|
||||
*
|
||||
* Returns: a #GFileInfo for the given @file, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileInfo for the given @file, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileInfo *
|
||||
@ -1157,7 +1159,7 @@ g_file_query_info_async (GFile *file,
|
||||
* Finishes an asynchronous file info query.
|
||||
* See g_file_query_info_async().
|
||||
*
|
||||
* Returns: #GFileInfo for given @file or %NULL on error.
|
||||
* Returns: (transfer full): #GFileInfo for given @file or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileInfo *
|
||||
@ -1210,7 +1212,7 @@ g_file_query_info_finish (GFile *file,
|
||||
* If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
|
||||
* Other errors are possible too, and depend on what kind of filesystem the file is on.
|
||||
*
|
||||
* Returns: a #GFileInfo or %NULL if there was an error.
|
||||
* Returns: (transfer full): a #GFileInfo or %NULL if there was an error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileInfo *
|
||||
@ -1291,7 +1293,7 @@ g_file_query_filesystem_info_async (GFile *file,
|
||||
* Finishes an asynchronous filesystem info query. See
|
||||
* g_file_query_filesystem_info_async().
|
||||
*
|
||||
* Returns: #GFileInfo for given @file or %NULL on error.
|
||||
* Returns: (transfer full): #GFileInfo for given @file or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileInfo *
|
||||
@ -1331,7 +1333,7 @@ g_file_query_filesystem_info_finish (GFile *file,
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GMount where the @file is located or %NULL on error.
|
||||
* Returns: (transfer full): a #GMount where the @file is located or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GMount *
|
||||
@ -1405,7 +1407,7 @@ g_file_find_enclosing_mount_async (GFile *file,
|
||||
* Finishes an asynchronous find mount request.
|
||||
* See g_file_find_enclosing_mount_async().
|
||||
*
|
||||
* Returns: #GMount for given @file or %NULL on error.
|
||||
* Returns: (transfer full): #GMount for given @file or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GMount *
|
||||
@ -1447,7 +1449,8 @@ g_file_find_enclosing_mount_finish (GFile *file,
|
||||
* If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be returned.
|
||||
* Other errors are possible too, and depend on what kind of filesystem the file is on.
|
||||
*
|
||||
* Returns: #GFileInputStream or %NULL on error.
|
||||
* Virtual: read_fn
|
||||
* Returns: (transfer full): #GFileInputStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileInputStream *
|
||||
@ -1500,7 +1503,7 @@ g_file_read (GFile *file,
|
||||
* returned. Other errors are possible too, and depend on what kind of
|
||||
* filesystem the file is on.
|
||||
*
|
||||
* Returns: a #GFileOutputStream, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileOutputStream, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileOutputStream *
|
||||
@ -1556,7 +1559,7 @@ g_file_append_to (GFile *file,
|
||||
* Other errors are possible too, and depend on what kind of
|
||||
* filesystem the file is on.
|
||||
*
|
||||
* Returns: a #GFileOutputStream for the newly created file, or
|
||||
* Returns: (transfer full): a #GFileOutputStream for the newly created file, or
|
||||
* %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
@ -1638,7 +1641,7 @@ g_file_create (GFile *file,
|
||||
* Other errors are possible too, and depend on what kind of
|
||||
* filesystem the file is on.
|
||||
*
|
||||
* Returns: a #GFileOutputStream or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileOutputStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileOutputStream *
|
||||
@ -1694,7 +1697,7 @@ g_file_replace (GFile *file,
|
||||
* so make sure you really need to do read and write streaming, rather than
|
||||
* just opening for reading or writing.
|
||||
*
|
||||
* Returns: #GFileIOStream or %NULL on error.
|
||||
* Returns: (transfer full): #GFileIOStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
@ -1753,7 +1756,7 @@ g_file_open_readwrite (GFile *file,
|
||||
* supported, so make sure you really need to do read and write streaming,
|
||||
* rather than just opening for reading or writing.
|
||||
*
|
||||
* Returns: a #GFileIOStream for the newly created file, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileIOStream for the newly created file, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
@ -1805,7 +1808,7 @@ g_file_create_readwrite (GFile *file,
|
||||
* supported, so make sure you really need to do read and write streaming,
|
||||
* rather than just opening for reading or writing.
|
||||
*
|
||||
* Returns: a #GFileIOStream or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileIOStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
@ -1883,7 +1886,7 @@ g_file_read_async (GFile *file,
|
||||
* Finishes an asynchronous file read operation started with
|
||||
* g_file_read_async().
|
||||
*
|
||||
* Returns: a #GFileInputStream or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileInputStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileInputStream *
|
||||
@ -1955,7 +1958,7 @@ g_file_append_to_async (GFile *file,
|
||||
* Finishes an asynchronous file append operation started with
|
||||
* g_file_append_to_async().
|
||||
*
|
||||
* Returns: a valid #GFileOutputStream or %NULL on error.
|
||||
* Returns: (transfer full): a valid #GFileOutputStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileOutputStream *
|
||||
@ -2028,7 +2031,7 @@ g_file_create_async (GFile *file,
|
||||
* Finishes an asynchronous file create operation started with
|
||||
* g_file_create_async().
|
||||
*
|
||||
* Returns: a #GFileOutputStream or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileOutputStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileOutputStream *
|
||||
@ -2108,7 +2111,7 @@ g_file_replace_async (GFile *file,
|
||||
* Finishes an asynchronous file replace operation started with
|
||||
* g_file_replace_async().
|
||||
*
|
||||
* Returns: a #GFileOutputStream, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileOutputStream, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileOutputStream *
|
||||
@ -2180,7 +2183,7 @@ g_file_open_readwrite_async (GFile *file,
|
||||
* Finishes an asynchronous file read operation started with
|
||||
* g_file_open_readwrite_async().
|
||||
*
|
||||
* Returns: a #GFileIOStream or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileIOStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
@ -2258,7 +2261,7 @@ g_file_create_readwrite_async (GFile *file,
|
||||
* Finishes an asynchronous file create operation started with
|
||||
* g_file_create_readwrite_async().
|
||||
*
|
||||
* Returns: a #GFileIOStream or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileIOStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
@ -2342,7 +2345,7 @@ g_file_replace_readwrite_async (GFile *file,
|
||||
* Finishes an asynchronous file replace operation started with
|
||||
* g_file_replace_readwrite_async().
|
||||
*
|
||||
* Returns: a #GFileIOStream, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileIOStream, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
@ -3506,7 +3509,8 @@ g_file_make_symbolic_link (GFile *file,
|
||||
* If @cancellable is not %NULL, then the operation can be cancelled by
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
*
|
||||
* Virtual: delete_file
|
||||
* Returns: %TRUE if the file was deleted. %FALSE otherwise.
|
||||
**/
|
||||
gboolean
|
||||
@ -3599,7 +3603,7 @@ g_file_trash (GFile *file,
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GFile specifying what @file was renamed to, or %NULL
|
||||
* Returns: (transfer full): a #GFile specifying what @file was renamed to, or %NULL
|
||||
* if there was an error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
@ -3680,7 +3684,7 @@ g_file_set_display_name_async (GFile *file,
|
||||
* Finishes setting a display name started with
|
||||
* g_file_set_display_name_async().
|
||||
*
|
||||
* Returns: a #GFile or %NULL on error.
|
||||
* Returns: (transfer full): a #GFile or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
@ -4279,7 +4283,7 @@ g_file_mount_mountable (GFile *file,
|
||||
* Finish an asynchronous mount operation that was started
|
||||
* with g_file_mount_mountable().
|
||||
*
|
||||
* Returns: a #GFile or %NULL on error.
|
||||
* Returns: (transfer full): a #GFile or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
@ -4686,8 +4690,9 @@ g_file_eject_mountable_with_operation_finish (GFile *file,
|
||||
* If @cancellable is not %NULL, then the operation can be cancelled by
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GFileMonitor for the given @file, or %NULL on error.
|
||||
*
|
||||
* Virtual: monitor_dir
|
||||
* Returns: (transfer full): a #GFileMonitor for the given @file, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileMonitor*
|
||||
@ -4730,7 +4735,7 @@ g_file_monitor_directory (GFile *file,
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GFileMonitor for the given @file, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileMonitor for the given @file, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
**/
|
||||
GFileMonitor*
|
||||
@ -4775,7 +4780,7 @@ g_file_monitor_file (GFile *file,
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GFileMonitor for the given @file, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileMonitor for the given @file, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.18
|
||||
@ -4825,10 +4830,7 @@ query_info_async_thread (GSimpleAsyncResult *res,
|
||||
info = g_file_query_info (G_FILE (object), data->attributes, data->flags, cancellable, &error);
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->info = info;
|
||||
}
|
||||
@ -4901,10 +4903,7 @@ query_filesystem_info_async_thread (GSimpleAsyncResult *res,
|
||||
info = g_file_query_filesystem_info (G_FILE (object), data->attributes, cancellable, &error);
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->info = info;
|
||||
}
|
||||
@ -4976,10 +4975,7 @@ enumerate_children_async_thread (GSimpleAsyncResult *res,
|
||||
enumerator = g_file_enumerate_children (G_FILE (object), data->attributes, data->flags, cancellable, &error);
|
||||
|
||||
if (enumerator == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->enumerator = enumerator;
|
||||
}
|
||||
@ -5041,8 +5037,7 @@ open_read_async_thread (GSimpleAsyncResult *res,
|
||||
G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Operation not supported"));
|
||||
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (res, error);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -5050,10 +5045,7 @@ open_read_async_thread (GSimpleAsyncResult *res,
|
||||
stream = iface->read_fn (G_FILE (object), cancellable, &error);
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gpointer (res, stream, g_object_unref);
|
||||
}
|
||||
@ -5107,10 +5099,7 @@ append_to_async_thread (GSimpleAsyncResult *res,
|
||||
stream = iface->append_to (G_FILE (object), *data, cancellable, &error);
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gpointer (res, stream, g_object_unref);
|
||||
}
|
||||
@ -5170,10 +5159,7 @@ create_async_thread (GSimpleAsyncResult *res,
|
||||
stream = iface->create (G_FILE (object), *data, cancellable, &error);
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gpointer (res, stream, g_object_unref);
|
||||
}
|
||||
@ -5254,10 +5240,7 @@ replace_async_thread (GSimpleAsyncResult *res,
|
||||
&error);
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->stream = stream;
|
||||
}
|
||||
@ -5321,8 +5304,7 @@ open_readwrite_async_thread (GSimpleAsyncResult *res,
|
||||
G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Operation not supported"));
|
||||
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (res, error);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -5330,10 +5312,7 @@ open_readwrite_async_thread (GSimpleAsyncResult *res,
|
||||
stream = iface->open_readwrite (G_FILE (object), cancellable, &error);
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gpointer (res, stream, g_object_unref);
|
||||
}
|
||||
@ -5390,8 +5369,7 @@ create_readwrite_async_thread (GSimpleAsyncResult *res,
|
||||
G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Operation not supported"));
|
||||
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (res, error);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -5399,10 +5377,7 @@ create_readwrite_async_thread (GSimpleAsyncResult *res,
|
||||
stream = iface->create_readwrite (G_FILE (object), *data, cancellable, &error);
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gpointer (res, stream, g_object_unref);
|
||||
}
|
||||
@ -5483,10 +5458,7 @@ replace_readwrite_async_thread (GSimpleAsyncResult *res,
|
||||
&error);
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->stream = stream;
|
||||
}
|
||||
@ -5561,10 +5533,7 @@ set_display_name_async_thread (GSimpleAsyncResult *res,
|
||||
file = g_file_set_display_name (G_FILE (object), data->name, cancellable, &error);
|
||||
|
||||
if (file == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->file = file;
|
||||
}
|
||||
@ -5697,10 +5666,7 @@ find_enclosing_mount_async_thread (GSimpleAsyncResult *res,
|
||||
mount = g_file_find_enclosing_mount (G_FILE (object), cancellable, &error);
|
||||
|
||||
if (mount == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gpointer (res, mount, (GDestroyNotify)g_object_unref);
|
||||
}
|
||||
@ -5829,10 +5795,7 @@ copy_async_thread (GIOSchedulerJob *job,
|
||||
NULL, NULL);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
|
||||
g_simple_async_result_complete_in_idle (res);
|
||||
|
||||
@ -5889,7 +5852,7 @@ g_file_real_copy_finish (GFile *file,
|
||||
* fails, but the returned object might not support any I/O
|
||||
* operation if @path is malformed.
|
||||
*
|
||||
* Returns: a new #GFile for the given @path.
|
||||
* Returns: (transfer full): a new #GFile for the given @path.
|
||||
**/
|
||||
GFile *
|
||||
g_file_new_for_path (const char *path)
|
||||
@ -5908,7 +5871,7 @@ g_file_new_for_path (const char *path)
|
||||
* operation if @uri is malformed or if the uri type is
|
||||
* not supported.
|
||||
*
|
||||
* Returns: a #GFile for the given @uri.
|
||||
* Returns: (transfer full): a #GFile for the given @uri.
|
||||
**/
|
||||
GFile *
|
||||
g_file_new_for_uri (const char *uri)
|
||||
@ -5926,7 +5889,7 @@ g_file_new_for_uri (const char *uri)
|
||||
* This operation never fails, but the returned object might not support any I/O
|
||||
* operation if the @parse_name cannot be parsed.
|
||||
*
|
||||
* Returns: a new #GFile.
|
||||
* Returns: (transfer full): a new #GFile.
|
||||
**/
|
||||
GFile *
|
||||
g_file_parse_name (const char *parse_name)
|
||||
@ -5972,7 +5935,7 @@ has_valid_scheme (const char *uri)
|
||||
* This operation never fails, but the returned object might not support any
|
||||
* I/O operation if @arg points to a malformed path.
|
||||
*
|
||||
* Returns: a new #GFile.
|
||||
* Returns: (transfer full): a new #GFile.
|
||||
**/
|
||||
GFile *
|
||||
g_file_new_for_commandline_arg (const char *arg)
|
||||
@ -6097,7 +6060,7 @@ g_file_mount_enclosing_volume_finish (GFile *location,
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GAppInfo if the handle was found, %NULL if there were errors.
|
||||
* Returns: (transfer full): a #GAppInfo if the handle was found, %NULL if there were errors.
|
||||
* When you are done with it, release it with g_object_unref()
|
||||
**/
|
||||
GAppInfo *
|
||||
@ -6405,12 +6368,11 @@ load_contents_open_callback (GObject *obj,
|
||||
}
|
||||
else
|
||||
{
|
||||
res = g_simple_async_result_new_from_error (G_OBJECT (data->file),
|
||||
res = g_simple_async_result_new_take_error (G_OBJECT (data->file),
|
||||
data->callback,
|
||||
data->user_data,
|
||||
error);
|
||||
g_simple_async_result_complete (res);
|
||||
g_error_free (error);
|
||||
load_contents_data_free (data);
|
||||
g_object_unref (res);
|
||||
}
|
||||
@ -6615,7 +6577,7 @@ g_file_load_contents_finish (GFile *file,
|
||||
* for the document, or %NULL
|
||||
* @make_backup: %TRUE if a backup should be created.
|
||||
* @flags: a set of #GFileCreateFlags.
|
||||
* @new_etag: a location to a new <link linkend="gfile-etag">entity tag</link>
|
||||
* @new_etag: (allow-none) (out): a location to a new <link linkend="gfile-etag">entity tag</link>
|
||||
* for the document. This should be freed with g_free() when no longer
|
||||
* needed, or %NULL
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
@ -6809,12 +6771,11 @@ replace_contents_open_callback (GObject *obj,
|
||||
}
|
||||
else
|
||||
{
|
||||
res = g_simple_async_result_new_from_error (G_OBJECT (data->file),
|
||||
res = g_simple_async_result_new_take_error (G_OBJECT (data->file),
|
||||
data->callback,
|
||||
data->user_data,
|
||||
error);
|
||||
g_simple_async_result_complete (res);
|
||||
g_error_free (error);
|
||||
replace_contents_data_free (data);
|
||||
g_object_unref (res);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ g_file_enumerator_init (GFileEnumerator *enumerator)
|
||||
* enumerator is at the end, %NULL will be returned and @error will
|
||||
* be unset.
|
||||
*
|
||||
* Return value: A #GFileInfo or %NULL on error or end of enumerator.
|
||||
* Return value: (transfer full): A #GFileInfo or %NULL on error or end of enumerator.
|
||||
* Free the returned object with g_object_unref() when no longer needed.
|
||||
**/
|
||||
GFileInfo *
|
||||
@ -390,7 +390,7 @@ g_file_enumerator_next_files_async (GFileEnumerator *enumerator,
|
||||
*
|
||||
* Finishes the asynchronous operation started with g_file_enumerator_next_files_async().
|
||||
*
|
||||
* Returns: (transfer full) (element-type FileInfo): a #GList of #GFileInfo<!---->s. You must free the list with
|
||||
* Returns: (transfer full) (element-type Gio.FileInfo): a #GList of #GFileInfo<!---->s. You must free the list with
|
||||
* g_list_free() and unref the infos with g_object_unref() when you're
|
||||
* done with them.
|
||||
**/
|
||||
@ -586,7 +586,7 @@ g_file_enumerator_set_pending (GFileEnumerator *enumerator,
|
||||
*
|
||||
* Get the #GFile container which is being enumerated.
|
||||
*
|
||||
* Returns: the #GFile which is being enumerated.
|
||||
* Returns: (transfer full): the #GFile which is being enumerated.
|
||||
*
|
||||
* Since: 2.18
|
||||
*/
|
||||
@ -718,10 +718,7 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
class = G_FILE_ENUMERATOR_GET_CLASS (object);
|
||||
result = class->close_fn (G_FILE_ENUMERATOR (object), cancellable, &error);
|
||||
if (!result)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,7 +158,7 @@ g_file_icon_init (GFileIcon *file)
|
||||
*
|
||||
* Creates a new icon for a file.
|
||||
*
|
||||
* Returns: a #GIcon for the given @file, or %NULL on error.
|
||||
* Returns: (transfer full): a #GIcon for the given @file, or %NULL on error.
|
||||
**/
|
||||
GIcon *
|
||||
g_file_icon_new (GFile *file)
|
||||
@ -174,7 +174,7 @@ g_file_icon_new (GFile *file)
|
||||
*
|
||||
* Gets the #GFile associated with the given @icon.
|
||||
*
|
||||
* Returns: a #GFile, or %NULL.
|
||||
* Returns: (transfer none): a #GFile, or %NULL.
|
||||
**/
|
||||
GFile *
|
||||
g_file_icon_get_file (GFileIcon *icon)
|
||||
@ -309,11 +309,10 @@ load_async_callback (GObject *source_object,
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
simple = g_simple_async_result_new_from_error (G_OBJECT (data->icon),
|
||||
simple = g_simple_async_result_new_take_error (G_OBJECT (data->icon),
|
||||
data->callback,
|
||||
data->user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ g_file_info_copy_into (GFileInfo *src_info,
|
||||
*
|
||||
* Duplicates a file info structure.
|
||||
*
|
||||
* Returns: a duplicate #GFileInfo of @other.
|
||||
* Returns: (transfer full): a duplicate #GFileInfo of @other.
|
||||
**/
|
||||
GFileInfo *
|
||||
g_file_info_dup (GFileInfo *other)
|
||||
@ -921,7 +921,7 @@ g_file_info_get_attribute_byte_string (GFileInfo *info,
|
||||
* Gets the value of a stringv attribute. If the attribute does
|
||||
* not contain a stringv, %NULL will be returned.
|
||||
*
|
||||
* Returns: the contents of the @attribute value as a stringv, or
|
||||
* Returns: (transfer none): the contents of the @attribute value as a stringv, or
|
||||
* %NULL otherwise. Do not free.
|
||||
*
|
||||
* Since: 2.22
|
||||
|
@ -122,7 +122,7 @@ g_file_input_stream_init (GFileInputStream *stream)
|
||||
* stream is blocked, the stream will set the pending flag internally, and
|
||||
* any other operations on the stream will fail with %G_IO_ERROR_PENDING.
|
||||
*
|
||||
* Returns: a #GFileInfo, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileInfo, or %NULL on error.
|
||||
**/
|
||||
GFileInfo *
|
||||
g_file_input_stream_query_info (GFileInputStream *stream,
|
||||
@ -215,11 +215,10 @@ g_file_input_stream_query_info_async (GFileInputStream *stream,
|
||||
|
||||
if (!g_input_stream_set_pending (input_stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -240,7 +239,7 @@ g_file_input_stream_query_info_async (GFileInputStream *stream,
|
||||
*
|
||||
* Finishes an asynchronous info query operation.
|
||||
*
|
||||
* Returns: #GFileInfo.
|
||||
* Returns: (transfer full): #GFileInfo.
|
||||
**/
|
||||
GFileInfo *
|
||||
g_file_input_stream_query_info_finish (GFileInputStream *stream,
|
||||
@ -421,10 +420,7 @@ query_info_async_thread (GSimpleAsyncResult *res,
|
||||
_("Stream doesn't support query_info"));
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->info = info;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ g_file_io_stream_init (GFileIOStream *stream)
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %NULL will
|
||||
* be returned.
|
||||
*
|
||||
* Returns: a #GFileInfo for the @stream, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileInfo for the @stream, or %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
@ -227,11 +227,10 @@ g_file_io_stream_query_info_async (GFileIOStream *stream,
|
||||
|
||||
if (!g_io_stream_set_pending (io_stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -252,7 +251,7 @@ g_file_io_stream_query_info_async (GFileIOStream *stream,
|
||||
* Finalizes the asynchronous query started
|
||||
* by g_file_io_stream_query_info_async().
|
||||
*
|
||||
* Returns: A #GFileInfo for the finished query.
|
||||
* Returns: (transfer full): A #GFileInfo for the finished query.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
|
@ -137,7 +137,7 @@ g_file_output_stream_init (GFileOutputStream *stream)
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %NULL will
|
||||
* be returned.
|
||||
*
|
||||
* Returns: a #GFileInfo for the @stream, or %NULL on error.
|
||||
* Returns: (transfer full): a #GFileInfo for the @stream, or %NULL on error.
|
||||
**/
|
||||
GFileInfo *
|
||||
g_file_output_stream_query_info (GFileOutputStream *stream,
|
||||
@ -225,11 +225,10 @@ g_file_output_stream_query_info_async (GFileOutputStream *stream,
|
||||
|
||||
if (!g_output_stream_set_pending (output_stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -250,7 +249,7 @@ g_file_output_stream_query_info_async (GFileOutputStream *stream,
|
||||
* Finalizes the asynchronous query started
|
||||
* by g_file_output_stream_query_info_async().
|
||||
*
|
||||
* Returns: A #GFileInfo for the finished query.
|
||||
* Returns: (transfer full): A #GFileInfo for the finished query.
|
||||
**/
|
||||
GFileInfo *
|
||||
g_file_output_stream_query_info_finish (GFileOutputStream *stream,
|
||||
@ -524,10 +523,7 @@ query_info_async_thread (GSimpleAsyncResult *res,
|
||||
_("Stream doesn't support query_info"));
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
else
|
||||
data->info = info;
|
||||
}
|
||||
|
@ -75,7 +75,8 @@ g_icon_default_init (GIconInterface *iface)
|
||||
* @icon: #gconstpointer to an icon object.
|
||||
*
|
||||
* Gets a hash for an icon.
|
||||
*
|
||||
*
|
||||
* Virtual: hash
|
||||
* Returns: a #guint containing a hash for the @icon, suitable for
|
||||
* use in a #GHashTable or similar data structure.
|
||||
**/
|
||||
@ -198,6 +199,7 @@ g_icon_to_string_tokenized (GIcon *icon, GString *s)
|
||||
* </para></listitem>
|
||||
* </itemizedlist>
|
||||
*
|
||||
* Virtual: to_tokens
|
||||
* Returns: An allocated NUL-terminated UTF8 string or %NULL if @icon can't
|
||||
* be serialized. Use g_free() to free.
|
||||
*
|
||||
|
@ -289,7 +289,7 @@ g_inet_socket_address_new (GInetAddress *address,
|
||||
*
|
||||
* Gets @address's #GInetAddress.
|
||||
*
|
||||
* Returns: the #GInetAddress for @address, which must be
|
||||
* Returns: (transfer full): the #GInetAddress for @address, which must be
|
||||
* g_object_ref()'d if it will be stored
|
||||
*
|
||||
* Since: 2.22
|
||||
|
@ -120,7 +120,7 @@ g_initable_init (GInitable *initable,
|
||||
* similar to g_object_new() but also initializes the object
|
||||
* and returns %NULL, setting an error on failure.
|
||||
*
|
||||
* Return value: a newly allocated #GObject, or %NULL on error
|
||||
* Return value: (transfer full): a newly allocated #GObject, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -156,7 +156,7 @@ g_initable_new (GType object_type,
|
||||
* similar to g_object_newv() but also initializes the object
|
||||
* and returns %NULL, setting an error on failure.
|
||||
*
|
||||
* Return value: a newly allocated #GObject, or %NULL on error
|
||||
* Return value: (transfer full): a newly allocated #GObject, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -196,7 +196,7 @@ g_initable_newv (GType object_type,
|
||||
* similar to g_object_new_valist() but also initializes the object
|
||||
* and returns %NULL, setting an error on failure.
|
||||
*
|
||||
* Return value: a newly allocated #GObject, or %NULL on error
|
||||
* Return value: (transfer full): a newly allocated #GObject, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
|
@ -560,11 +560,10 @@ g_input_stream_read_async (GInputStream *stream,
|
||||
|
||||
if (!g_input_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -685,11 +684,10 @@ g_input_stream_skip_async (GInputStream *stream,
|
||||
|
||||
if (!g_input_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -784,11 +782,10 @@ g_input_stream_close_async (GInputStream *stream,
|
||||
|
||||
if (!g_input_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -947,10 +944,7 @@ read_async_thread (GSimpleAsyncResult *res,
|
||||
op->buffer, op->count_requested,
|
||||
cancellable, &error);
|
||||
if (op->count_read == -1)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1012,10 +1006,7 @@ skip_async_thread (GSimpleAsyncResult *res,
|
||||
op->count_requested,
|
||||
cancellable, &error);
|
||||
if (op->count_skipped == -1)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -1066,13 +1057,12 @@ skip_callback_wrapper (GObject *source_object,
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
if (data->count_skipped &&
|
||||
error->domain == G_IO_ERROR &&
|
||||
error->code == G_IO_ERROR_CANCELLED)
|
||||
{ /* No error, return partial read */ }
|
||||
if (data->count_skipped &&
|
||||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
/* No error, return partial read */
|
||||
g_error_free (error);
|
||||
else
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
}
|
||||
|
||||
/* Complete immediately, not in idle, since we're already in a mainloop callout */
|
||||
@ -1164,10 +1154,7 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
{
|
||||
result = class->close_fn (G_INPUT_STREAM (object), cancellable, &error);
|
||||
if (!result)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,7 @@ VOID:STRING,STRING,VARIANT
|
||||
VOID:STRING
|
||||
VOID:STRING,STRING
|
||||
VOID:STRING,BOOLEAN
|
||||
BOOL:OBJECT
|
||||
VOID:POINTER,INT,STRING
|
||||
BOOLEAN:OBJECT
|
||||
INT:OBJECT
|
||||
VOID:INT64
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <gio/gactiongroup.h>
|
||||
#include <gio/gsimpleactiongroup.h>
|
||||
#include <gio/gapplication.h>
|
||||
#include <gio/gapplicationcommandline.h>
|
||||
#include <gio/gasyncinitable.h>
|
||||
#include <gio/gasyncresult.h>
|
||||
#include <gio/gbufferedinputstream.h>
|
||||
@ -92,6 +93,7 @@
|
||||
#include <gio/gnetworkaddress.h>
|
||||
#include <gio/gnetworkservice.h>
|
||||
#include <gio/goutputstream.h>
|
||||
#include <gio/gperiodic.h>
|
||||
#include <gio/gpermission.h>
|
||||
#include <gio/gproxy.h>
|
||||
#include <gio/gproxyaddress.h>
|
||||
|
@ -27,22 +27,40 @@ g_vfs_get_local
|
||||
#if IN_HEADER(__G_APPLICATION_H__)
|
||||
#if IN_FILE(__G_APPLICATION_C__)
|
||||
g_application_get_type G_GNUC_CONST
|
||||
g_application_activate
|
||||
g_application_flags_get_type
|
||||
g_application_get_application_id
|
||||
g_application_get_flags
|
||||
g_application_get_inactivity_timeout
|
||||
g_application_get_is_registered
|
||||
g_application_get_is_remote
|
||||
g_application_hold
|
||||
g_application_id_is_valid
|
||||
g_application_new
|
||||
g_application_get_instance
|
||||
g_application_get_id
|
||||
g_application_set_action_enabled
|
||||
g_application_get_action_enabled
|
||||
g_application_get_action_description
|
||||
g_application_add_action
|
||||
g_application_remove_action
|
||||
g_application_invoke_action
|
||||
g_application_list_actions
|
||||
g_application_run
|
||||
g_application_open
|
||||
g_application_register
|
||||
g_application_try_new
|
||||
g_application_unregistered_try_new
|
||||
g_application_quit_with_data
|
||||
g_application_is_remote
|
||||
g_application_release
|
||||
g_application_run
|
||||
g_application_set_action_group
|
||||
g_application_set_application_id
|
||||
g_application_set_flags
|
||||
g_application_set_inactivity_timeout
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__G_APPLICATION_COMMAND_LINE_H__)
|
||||
#if IN_FILE(__G_APPLICATION_COMMAND_LINE_C__)
|
||||
g_application_command_line_get_arguments
|
||||
g_application_command_line_get_cwd
|
||||
g_application_command_line_get_environ
|
||||
g_application_command_line_getenv
|
||||
g_application_command_line_get_exit_status
|
||||
g_application_command_line_get_is_remote
|
||||
g_application_command_line_get_platform_data
|
||||
g_application_command_line_get_type
|
||||
g_application_command_line_print
|
||||
g_application_command_line_printerr
|
||||
g_application_command_line_set_exit_status
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -247,6 +265,9 @@ g_data_input_stream_read_line_finish
|
||||
g_data_input_stream_read_until
|
||||
g_data_input_stream_read_until_async
|
||||
g_data_input_stream_read_until_finish
|
||||
g_data_input_stream_read_upto
|
||||
g_data_input_stream_read_upto_async
|
||||
g_data_input_stream_read_upto_finish
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -771,6 +792,7 @@ g_simple_async_result_get_type G_GNUC_CONST
|
||||
g_simple_async_result_new
|
||||
g_simple_async_result_new_error
|
||||
g_simple_async_result_new_from_error
|
||||
g_simple_async_result_new_take_error
|
||||
g_simple_async_result_set_op_res_gpointer
|
||||
g_simple_async_result_get_op_res_gpointer
|
||||
g_simple_async_result_set_op_res_gssize
|
||||
@ -783,12 +805,14 @@ g_simple_async_result_complete
|
||||
g_simple_async_result_complete_in_idle
|
||||
g_simple_async_result_run_in_thread
|
||||
g_simple_async_result_set_from_error
|
||||
g_simple_async_result_take_error
|
||||
g_simple_async_result_propagate_error
|
||||
g_simple_async_result_set_error
|
||||
g_simple_async_result_set_error_va
|
||||
g_simple_async_result_is_valid
|
||||
g_simple_async_report_error_in_idle
|
||||
g_simple_async_report_gerror_in_idle
|
||||
g_simple_async_report_take_gerror_in_idle
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1517,6 +1541,7 @@ g_keyfile_settings_backend_new
|
||||
#if IN_HEADER(__G_SETTINGS_H__)
|
||||
#if IN_FILE(__G_SETTINGS_SCHEMA_C__)
|
||||
g_settings_list_schemas
|
||||
g_settings_list_relocatable_schemas
|
||||
#endif
|
||||
|
||||
#if IN_FILE(__G_SETTINGS_C__)
|
||||
@ -1563,6 +1588,8 @@ g_settings_can_add_child
|
||||
g_settings_can_remove_child
|
||||
g_settings_remove_child
|
||||
g_settings_get_destroyed
|
||||
g_settings_get_range
|
||||
g_settings_range_check
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1887,16 +1914,16 @@ g_action_group_action_added
|
||||
g_action_group_action_enabled_changed
|
||||
g_action_group_action_removed
|
||||
g_action_group_action_state_changed
|
||||
g_action_group_activate
|
||||
g_action_group_get_enabled
|
||||
g_action_group_get_parameter_type
|
||||
g_action_group_get_state
|
||||
g_action_group_get_state_hint
|
||||
g_action_group_get_state_type
|
||||
g_action_group_activate_action
|
||||
g_action_group_get_action_enabled
|
||||
g_action_group_get_action_parameter_type
|
||||
g_action_group_get_action_state
|
||||
g_action_group_get_action_state_hint
|
||||
g_action_group_get_action_state_type
|
||||
g_action_group_get_type
|
||||
g_action_group_has_action
|
||||
g_action_group_list_actions
|
||||
g_action_group_set_state
|
||||
g_action_group_change_action_state
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1933,3 +1960,18 @@ g_simple_action_new_stateful
|
||||
g_simple_action_set_enabled
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__G_PERIODIC_H__)
|
||||
#if IN_FILE(__G_PERIODIC_C__)
|
||||
g_periodic_block
|
||||
g_periodic_damaged
|
||||
g_periodic_get_hz
|
||||
g_periodic_get_high_priority
|
||||
g_periodic_get_low_priority
|
||||
g_periodic_get_type
|
||||
g_periodic_new
|
||||
g_periodic_add
|
||||
g_periodic_remove
|
||||
g_periodic_unblock
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1157,6 +1157,9 @@ typedef enum
|
||||
/**
|
||||
* GDBusSignalFlags:
|
||||
* @G_DBUS_SIGNAL_FLAGS_NONE: No flags set.
|
||||
* @G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE: Don't actually send the AddMatch
|
||||
* DBus call for this signal subscription. This gives you more control
|
||||
* over which match rules you add (but you must add them manually).
|
||||
*
|
||||
* Flags used when subscribing to signals via g_dbus_connection_signal_subscribe().
|
||||
*
|
||||
@ -1164,7 +1167,8 @@ typedef enum
|
||||
*/
|
||||
typedef enum /*< flags >*/
|
||||
{
|
||||
G_DBUS_SIGNAL_FLAGS_NONE = 0
|
||||
G_DBUS_SIGNAL_FLAGS_NONE = 0,
|
||||
G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE = (1<<0)
|
||||
} GDBusSignalFlags;
|
||||
|
||||
/**
|
||||
@ -1216,6 +1220,35 @@ typedef enum
|
||||
G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN = 'l'
|
||||
} GDBusMessageByteOrder;
|
||||
|
||||
/**
|
||||
* GApplicationFlags:
|
||||
* @G_APPLICATION_FLAGS_NONE: Default
|
||||
* @G_APPLICATION_IS_SERVICE: Run as a service. In this mode, registration
|
||||
* fails if the service is already running, and the application will
|
||||
* stay around for a while when the use count falls to zero.
|
||||
* @G_APPLICATION_IS_LAUNCHER: Don't try to become the primary instance.
|
||||
* @G_APPLICATION_HANDLES_OPEN: This application handles opening files (in the
|
||||
* primary instance)
|
||||
* @G_APPLICATION_HANDLES_COMMAND_LINE: This application handles command line
|
||||
* arguments (in the primary instance)
|
||||
* @G_APPLICATION_SEND_ENVIRONMENT: Send the environment of the
|
||||
* launching process to the primary instance
|
||||
*
|
||||
* Flags used to define the behaviour of a #GApplication.
|
||||
*
|
||||
* Since: 2.26
|
||||
**/
|
||||
typedef enum
|
||||
{
|
||||
G_APPLICATION_FLAGS_NONE,
|
||||
G_APPLICATION_IS_SERVICE = (1 << 0),
|
||||
G_APPLICATION_IS_LAUNCHER = (1 << 1),
|
||||
|
||||
G_APPLICATION_HANDLES_OPEN = (1 << 2),
|
||||
G_APPLICATION_HANDLES_COMMAND_LINE = (1 << 3),
|
||||
G_APPLICATION_SEND_ENVIRONMENT = (1 << 4)
|
||||
} GApplicationFlags;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIO_ENUMS_H__ */
|
||||
|
@ -36,14 +36,17 @@
|
||||
#include "gsocks4aproxy.h"
|
||||
#include "gsocks5proxy.h"
|
||||
#include "gvfs.h"
|
||||
#ifdef G_OS_UNIX
|
||||
#include "gdesktopappinfo.h"
|
||||
#endif
|
||||
#ifdef G_OS_WIN32
|
||||
#include "gregistrysettingsbackend.h"
|
||||
#endif
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#undef G_DISABLE_DEPRECATED
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#include "gdesktopappinfo.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* SECTION:giomodule
|
||||
* @short_description: Loadable GIO Modules
|
||||
@ -411,7 +414,8 @@ g_io_modules_scan_all_in_directory (const char *dirname)
|
||||
* all gtypes) then you can use g_io_modules_scan_all_in_directory()
|
||||
* which allows delayed/lazy loading of modules.
|
||||
*
|
||||
* Returns: a list of #GIOModules loaded from the directory,
|
||||
* Returns: (element-type GIOModule) (transfer full): a list of #GIOModules loaded
|
||||
* from the directory,
|
||||
* All the modules are loaded into memory, if you want to
|
||||
* unload them (enabling on-demand loading) you must call
|
||||
* g_type_module_unuse() on all the modules. Free the list
|
||||
@ -523,8 +527,10 @@ _g_io_modules_ensure_extension_points_registered (void)
|
||||
registered_extensions = TRUE;
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#if !GLIB_CHECK_VERSION (3, 0, 0)
|
||||
ep = g_io_extension_point_register (G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME);
|
||||
g_io_extension_point_set_required_type (ep, G_TYPE_DESKTOP_APP_INFO_LOOKUP);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ep = g_io_extension_point_register (G_LOCAL_DIRECTORY_MONITOR_EXTENSION_POINT_NAME);
|
||||
@ -763,7 +769,7 @@ g_io_extension_point_get_extensions (GIOExtensionPoint *extension_point)
|
||||
*
|
||||
* Finds a #GIOExtension for an extension point by name.
|
||||
*
|
||||
* Returns: the #GIOExtension for @extension_point that has the
|
||||
* Returns: (transfer none): the #GIOExtension for @extension_point that has the
|
||||
* given name, or %NULL if there is no extension with that name
|
||||
*/
|
||||
GIOExtension *
|
||||
@ -871,7 +877,7 @@ g_io_extension_point_implement (const char *extension_point_name,
|
||||
* Gets a reference to the class for the type that is
|
||||
* associated with @extension.
|
||||
*
|
||||
* Returns: the #GTypeClass for the type of @extension
|
||||
* Returns: (transfer full): the #GTypeClass for the type of @extension
|
||||
*/
|
||||
GTypeClass *
|
||||
g_io_extension_ref_class (GIOExtension *extension)
|
||||
|
@ -119,7 +119,7 @@ void g_io_module_unload (GIOModule *module);
|
||||
* run gio-querymodules in order to build the cache files required for
|
||||
* lazy loading.
|
||||
*
|
||||
* Returns: A %NULL-terminated array of strings, listing the supported
|
||||
* Returns: (transfer full): A %NULL-terminated array of strings, listing the supported
|
||||
* extension points of the module. The array must be suitable for
|
||||
* freeing with g_strfreev().
|
||||
*
|
||||
|
@ -497,11 +497,10 @@ g_io_stream_close_async (GIOStream *stream,
|
||||
|
||||
if (!g_io_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -570,10 +569,7 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
{
|
||||
result = class->close_fn (G_IO_STREAM (object), cancellable, &error);
|
||||
if (!result)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,8 @@ typedef struct _GSimpleActionGroup GSimpleActionGroup;
|
||||
typedef struct _GActionGroup GActionGroup;
|
||||
typedef struct _GSimpleAction GSimpleAction;
|
||||
typedef struct _GAction GAction;
|
||||
typedef struct _GApplication GApplication;
|
||||
typedef struct _GApplicationCommandLine GApplicationCommandLine;
|
||||
typedef struct _GSettingsBackend GSettingsBackend;
|
||||
typedef struct _GSettings GSettings;
|
||||
typedef struct _GPermission GPermission;
|
||||
|
@ -581,7 +581,7 @@ dir_changed (GFileMonitor *monitor,
|
||||
* @root_path: the path under which all settings keys appear
|
||||
* @root_group: (allow-none): the group name corresponding to
|
||||
* @root_path, or %NULL
|
||||
* @returns: a keyfile-backed #GSettingsBackend
|
||||
* @returns: (transfer full): a keyfile-backed #GSettingsBackend
|
||||
*
|
||||
* Creates a keyfile-backed #GSettingsBackend.
|
||||
*
|
||||
|
@ -107,6 +107,12 @@ enum_state_add_value (EnumState *state,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Silently drop the null case if it is mentioned.
|
||||
* It is properly denoted with an empty array.
|
||||
*/
|
||||
if (state->is_flags && value == 0)
|
||||
return;
|
||||
|
||||
if (state->is_flags && (value & (value - 1)))
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR,
|
||||
@ -121,7 +127,6 @@ enum_state_add_value (EnumState *state,
|
||||
* If we loosen the one-bit-set restriction we need an overlap check.
|
||||
*/
|
||||
|
||||
|
||||
strinfo_builder_append_item (state->strinfo, nick, value);
|
||||
}
|
||||
|
||||
@ -135,9 +140,10 @@ enum_state_end (EnumState **state_ptr,
|
||||
*state_ptr = NULL;
|
||||
|
||||
if (state->strinfo->len == 0)
|
||||
g_set_error_literal (error,
|
||||
G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"<enum> must contain at least one <value>");
|
||||
g_set_error (error,
|
||||
G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"<%s> must contain at least one <value>",
|
||||
state->is_flags ? "flags" : "enum");
|
||||
}
|
||||
|
||||
/* Handling of <key> {{{1 */
|
||||
@ -496,8 +502,7 @@ key_state_start_aliases (KeyState *state,
|
||||
g_set_error_literal (error, G_MARKUP_ERROR,
|
||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"<aliases> already specified for this key");
|
||||
|
||||
if (!state->is_flags && !state->is_enum && !state->has_choices)
|
||||
else if (!state->is_flags && !state->is_enum && !state->has_choices)
|
||||
g_set_error_literal (error, G_MARKUP_ERROR,
|
||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"<aliases> can only be specified for keys with "
|
||||
@ -623,12 +628,18 @@ key_state_serialise (KeyState *state)
|
||||
if (state->strinfo->len)
|
||||
{
|
||||
GVariant *array;
|
||||
guint32 *words;
|
||||
gpointer data;
|
||||
gsize size;
|
||||
gint i;
|
||||
|
||||
data = state->strinfo->str;
|
||||
size = state->strinfo->len;
|
||||
|
||||
words = data;
|
||||
for (i = 0; i < size / sizeof (guint32); i++)
|
||||
words[i] = GUINT32_TO_LE (words[i]);
|
||||
|
||||
array = g_variant_new_from_data (G_VARIANT_TYPE ("au"),
|
||||
data, size, TRUE,
|
||||
g_free, data);
|
||||
@ -992,6 +1003,10 @@ typedef struct
|
||||
GHashTable *flags_table; /* string -> EnumState */
|
||||
GHashTable *enum_table; /* string -> EnumState */
|
||||
|
||||
GSList *this_file_schemas; /* strings: <schema>s in this file */
|
||||
GSList *this_file_flagss; /* strings: <flags>s in this file */
|
||||
GSList *this_file_enums; /* strings: <enum>s in this file */
|
||||
|
||||
gchar *schemalist_domain; /* the <schemalist> gettext domain */
|
||||
|
||||
SchemaState *schema_state; /* non-NULL when inside <schema> */
|
||||
@ -1028,6 +1043,7 @@ parse_state_start_schema (ParseState *state,
|
||||
GError **error)
|
||||
{
|
||||
SchemaState *extends;
|
||||
gchar *my_id;
|
||||
|
||||
if (g_hash_table_lookup (state->schema_table, id))
|
||||
{
|
||||
@ -1129,8 +1145,10 @@ parse_state_start_schema (ParseState *state,
|
||||
|
||||
state->schema_state = schema_state_new (path, gettext_domain,
|
||||
extends, extends_name, list_of);
|
||||
g_hash_table_insert (state->schema_table, g_strdup (id),
|
||||
state->schema_state);
|
||||
|
||||
my_id = g_strdup (id);
|
||||
state->this_file_schemas = g_slist_prepend (state->this_file_schemas, my_id);
|
||||
g_hash_table_insert (state->schema_table, my_id, state->schema_state);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1139,7 +1157,9 @@ parse_state_start_enum (ParseState *state,
|
||||
gboolean is_flags,
|
||||
GError **error)
|
||||
{
|
||||
GSList **list = is_flags ? &state->this_file_flagss : &state->this_file_enums;
|
||||
GHashTable *table = is_flags ? state->flags_table : state->enum_table;
|
||||
gchar *my_id;
|
||||
|
||||
if (g_hash_table_lookup (table, id))
|
||||
{
|
||||
@ -1151,7 +1171,10 @@ parse_state_start_enum (ParseState *state,
|
||||
}
|
||||
|
||||
state->enum_state = enum_state_new (is_flags);
|
||||
g_hash_table_insert (table, g_strdup (id), state->enum_state);
|
||||
|
||||
my_id = g_strdup (id);
|
||||
*list = g_slist_prepend (*list, my_id);
|
||||
g_hash_table_insert (table, my_id, state->enum_state);
|
||||
}
|
||||
|
||||
/* GMarkup Parser Functions {{{1 */
|
||||
@ -1569,12 +1592,13 @@ write_to_file (GHashTable *schema_table,
|
||||
|
||||
/* Parser driver {{{1 */
|
||||
static GHashTable *
|
||||
parse_gschema_files (gchar **files,
|
||||
GError **error)
|
||||
parse_gschema_files (gchar **files,
|
||||
gboolean strict)
|
||||
{
|
||||
GMarkupParser parser = { start_element, end_element, text };
|
||||
ParseState state = { 0, };
|
||||
const gchar *filename;
|
||||
GError *error = NULL;
|
||||
|
||||
state.enum_table = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, enum_state_free);
|
||||
@ -1591,28 +1615,62 @@ parse_gschema_files (gchar **files,
|
||||
gchar *contents;
|
||||
gsize size;
|
||||
|
||||
if (!g_file_get_contents (filename, &contents, &size, &error))
|
||||
{
|
||||
fprintf (stderr, "%s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
continue;
|
||||
}
|
||||
|
||||
context = g_markup_parse_context_new (&parser,
|
||||
G_MARKUP_PREFIX_ERROR_POSITION,
|
||||
&state, NULL);
|
||||
|
||||
if (!g_file_get_contents (filename, &contents, &size, error))
|
||||
return NULL;
|
||||
|
||||
if (!g_markup_parse_context_parse (context, contents, size, error))
|
||||
if (!g_markup_parse_context_parse (context, contents, size, &error) ||
|
||||
!g_markup_parse_context_end_parse (context, &error))
|
||||
{
|
||||
g_prefix_error (error, "%s: ", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!g_markup_parse_context_end_parse (context, error))
|
||||
{
|
||||
g_prefix_error (error, "%s: ", filename);
|
||||
return NULL;
|
||||
GSList *item;
|
||||
|
||||
/* back out any changes from this file */
|
||||
for (item = state.this_file_schemas; item; item = item->next)
|
||||
g_hash_table_remove (state.schema_table, item->data);
|
||||
|
||||
for (item = state.this_file_flagss; item; item = item->next)
|
||||
g_hash_table_remove (state.flags_table, item->data);
|
||||
|
||||
for (item = state.this_file_enums; item; item = item->next)
|
||||
g_hash_table_remove (state.enum_table, item->data);
|
||||
|
||||
/* let them know */
|
||||
fprintf (stderr, "%s: %s. ", filename, error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
if (strict)
|
||||
{
|
||||
/* Translators: Do not translate "--strict". */
|
||||
fprintf (stderr, _("--strict was specified; exiting.\n"));
|
||||
g_hash_table_unref (state.schema_table);
|
||||
g_hash_table_unref (state.flags_table);
|
||||
g_hash_table_unref (state.enum_table);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
fprintf (stderr, _("This entire file has been ignored.\n"));
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
g_markup_parse_context_free (context);
|
||||
g_slist_free (state.this_file_schemas);
|
||||
g_slist_free (state.this_file_flagss);
|
||||
g_slist_free (state.this_file_enums);
|
||||
state.this_file_schemas = NULL;
|
||||
state.this_file_flagss = NULL;
|
||||
state.this_file_enums = NULL;
|
||||
}
|
||||
|
||||
g_hash_table_unref (state.flags_table);
|
||||
g_hash_table_unref (state.enum_table);
|
||||
|
||||
return state.schema_table;
|
||||
@ -1638,9 +1696,10 @@ compare_strings (gconstpointer a,
|
||||
static gboolean
|
||||
set_overrides (GHashTable *schema_table,
|
||||
gchar **files,
|
||||
GError **error)
|
||||
gboolean strict)
|
||||
{
|
||||
const gchar *filename;
|
||||
GError *error = NULL;
|
||||
|
||||
while ((filename = *files++))
|
||||
{
|
||||
@ -1649,10 +1708,19 @@ set_overrides (GHashTable *schema_table,
|
||||
gint i;
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
if (!g_key_file_load_from_file (key_file, filename, 0, error))
|
||||
if (!g_key_file_load_from_file (key_file, filename, 0, &error))
|
||||
{
|
||||
fprintf (stderr, "%s: %s. ", filename, error->message);
|
||||
g_key_file_free (key_file);
|
||||
g_clear_error (&error);
|
||||
|
||||
if (!strict)
|
||||
{
|
||||
fprintf (stderr, _("Ignoring this file.\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf (stderr, _("--strict was specified; exiting.\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1668,16 +1736,11 @@ set_overrides (GHashTable *schema_table,
|
||||
schema = g_hash_table_lookup (schema_table, group);
|
||||
|
||||
if (schema == NULL)
|
||||
{
|
||||
g_set_error (error, G_KEY_FILE_ERROR,
|
||||
G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
|
||||
_("No such schema `%s' specified in "
|
||||
"override file `%s'"), group, filename);
|
||||
g_key_file_free (key_file);
|
||||
g_strfreev (groups);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
/* Having the schema not be installed is expected to be a
|
||||
* common case. Don't even emit an error message about
|
||||
* that.
|
||||
*/
|
||||
continue;
|
||||
|
||||
keys = g_key_file_get_keys (key_file, group, NULL, NULL);
|
||||
g_assert (keys != NULL);
|
||||
@ -1693,11 +1756,17 @@ set_overrides (GHashTable *schema_table,
|
||||
|
||||
if (state == NULL)
|
||||
{
|
||||
g_set_error (error, G_KEY_FILE_ERROR,
|
||||
G_KEY_FILE_ERROR_KEY_NOT_FOUND,
|
||||
_("No such key `%s' in schema `%s' as "
|
||||
"specified in override file `%s'"),
|
||||
key, group, filename);
|
||||
fprintf (stderr, _("No such key `%s' in schema `%s' as "
|
||||
"specified in override file `%s'"),
|
||||
key, group, filename);
|
||||
|
||||
if (!strict)
|
||||
{
|
||||
fprintf (stderr, _("; ignoring override for this key.\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf (stderr, _(" and --strict was specified; exiting.\n"));
|
||||
g_key_file_free (key_file);
|
||||
g_strfreev (groups);
|
||||
g_strfreev (keys);
|
||||
@ -1709,14 +1778,28 @@ set_overrides (GHashTable *schema_table,
|
||||
g_assert (string != NULL);
|
||||
|
||||
value = g_variant_parse (state->type, string,
|
||||
NULL, NULL, error);
|
||||
NULL, NULL, &error);
|
||||
|
||||
if (value == NULL)
|
||||
{
|
||||
fprintf (stderr, _("error parsing key `%s' in schema `%s' "
|
||||
"as specified in override file `%s': "
|
||||
"%s. "),
|
||||
key, group, filename, error->message);
|
||||
|
||||
g_clear_error (&error);
|
||||
g_free (string);
|
||||
|
||||
if (!strict)
|
||||
{
|
||||
fprintf (stderr, _("Ignoring override for this key.\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf (stderr, _("--strict was specified; exiting.\n"));
|
||||
g_key_file_free (key_file);
|
||||
g_strfreev (groups);
|
||||
g_strfreev (keys);
|
||||
g_free (string);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -1726,18 +1809,25 @@ set_overrides (GHashTable *schema_table,
|
||||
if (g_variant_compare (value, state->minimum) < 0 ||
|
||||
g_variant_compare (value, state->maximum) > 0)
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR,
|
||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
_("override for key `%s' in schema `%s' in "
|
||||
"override file `%s' is out of the range "
|
||||
"given in the schema"),
|
||||
key, group, filename);
|
||||
fprintf (stderr,
|
||||
_("override for key `%s' in schema `%s' in "
|
||||
"override file `%s' is out of the range "
|
||||
"given in the schema"),
|
||||
key, group, filename);
|
||||
|
||||
g_key_file_free (key_file);
|
||||
g_variant_unref (value);
|
||||
g_free (string);
|
||||
|
||||
if (!strict)
|
||||
{
|
||||
fprintf (stderr, _("; ignoring override for this key.\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf (stderr, _(" and --strict was specified; exiting.\n"));
|
||||
g_key_file_free (key_file);
|
||||
g_strfreev (groups);
|
||||
g_strfreev (keys);
|
||||
g_free (string);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -1747,18 +1837,25 @@ set_overrides (GHashTable *schema_table,
|
||||
{
|
||||
if (!is_valid_choices (value, state->strinfo))
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR,
|
||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
_("override for key `%s' in schema `%s' in "
|
||||
"override file `%s' is not in the list "
|
||||
"of valid choices"),
|
||||
key, group, filename);
|
||||
fprintf (stderr,
|
||||
_("override for key `%s' in schema `%s' in "
|
||||
"override file `%s' is not in the list "
|
||||
"of valid choices"),
|
||||
key, group, filename);
|
||||
|
||||
g_key_file_free (key_file);
|
||||
g_variant_unref (value);
|
||||
g_free (string);
|
||||
|
||||
if (!strict)
|
||||
{
|
||||
fprintf (stderr, _("; ignoring override for this key.\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf (stderr, _(" and --strict was specified; exiting.\n"));
|
||||
g_key_file_free (key_file);
|
||||
g_strfreev (groups);
|
||||
g_strfreev (keys);
|
||||
g_free (string);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -1766,9 +1863,9 @@ set_overrides (GHashTable *schema_table,
|
||||
|
||||
g_variant_unref (state->default_value);
|
||||
state->default_value = value;
|
||||
g_free (string);
|
||||
}
|
||||
|
||||
|
||||
g_strfreev (keys);
|
||||
}
|
||||
|
||||
@ -1790,11 +1887,13 @@ main (int argc, char **argv)
|
||||
gchar *target;
|
||||
gboolean uninstall = FALSE;
|
||||
gboolean dry_run = FALSE;
|
||||
gboolean strict = FALSE;
|
||||
gchar **schema_files = NULL;
|
||||
gchar **override_files = NULL;
|
||||
GOptionContext *context;
|
||||
GOptionEntry entries[] = {
|
||||
{ "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("where to store the gschemas.compiled file"), N_("DIRECTORY") },
|
||||
{ "strict", 0, 0, G_OPTION_ARG_NONE, &strict, N_("Abort on any errors in schemas"), NULL },
|
||||
{ "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, N_("Do not write the gschema.compiled file"), NULL },
|
||||
{ "uninstall", 0, 0, G_OPTION_ARG_NONE, &uninstall, N_("This option will be removed soon.") },
|
||||
{ "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions") },
|
||||
@ -1817,7 +1916,7 @@ main (int argc, char **argv)
|
||||
error = NULL;
|
||||
if (!g_option_context_parse (context, &argc, &argv, &error))
|
||||
{
|
||||
fprintf (stderr, "%s", error->message);
|
||||
fprintf (stderr, "%s\n", error->message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1884,12 +1983,23 @@ main (int argc, char **argv)
|
||||
override_files = (gchar **) g_ptr_array_free (overrides, FALSE);
|
||||
}
|
||||
|
||||
if ((table = parse_gschema_files (schema_files, strict)) == NULL)
|
||||
{
|
||||
g_free (target);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(table = parse_gschema_files (schema_files, &error)) ||
|
||||
(override_files != NULL && !set_overrides (table, override_files, &error)) ||
|
||||
(!dry_run && !write_to_file (table, target, &error)))
|
||||
if (override_files != NULL &&
|
||||
!set_overrides (table, override_files, strict))
|
||||
{
|
||||
g_free (target);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!dry_run && !write_to_file (table, target, &error))
|
||||
{
|
||||
fprintf (stderr, "%s\n", error->message);
|
||||
g_free (target);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ g_loadable_icon_default_init (GLoadableIconIface *iface)
|
||||
* Loads a loadable icon. For the asynchronous version of this function,
|
||||
* see g_loadable_icon_load_async().
|
||||
*
|
||||
* Returns: a #GInputStream to read the icon from.
|
||||
* Returns: (transfer full): a #GInputStream to read the icon from.
|
||||
**/
|
||||
GInputStream *
|
||||
g_loadable_icon_load (GLoadableIcon *icon,
|
||||
@ -126,7 +126,7 @@ g_loadable_icon_load_async (GLoadableIcon *icon,
|
||||
*
|
||||
* Finishes an asynchronous icon load started in g_loadable_icon_load_async().
|
||||
*
|
||||
* Returns: a #GInputStream to read the icon from.
|
||||
* Returns: (transfer full): a #GInputStream to read the icon from.
|
||||
**/
|
||||
GInputStream *
|
||||
g_loadable_icon_load_finish (GLoadableIcon *icon,
|
||||
@ -188,8 +188,7 @@ load_async_thread (GSimpleAsyncResult *res,
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -119,18 +119,18 @@ static GHashTable *gid_cache = NULL;
|
||||
char *
|
||||
_g_local_file_info_create_etag (GLocalFileStat *statbuf)
|
||||
{
|
||||
GTimeVal tv;
|
||||
|
||||
tv.tv_sec = statbuf->st_mtime;
|
||||
glong sec, usec;
|
||||
|
||||
sec = statbuf->st_mtime;
|
||||
#if defined (HAVE_STRUCT_STAT_ST_MTIMENSEC)
|
||||
tv.tv_usec = statbuf->st_mtimensec / 1000;
|
||||
usec = statbuf->st_mtimensec / 1000;
|
||||
#elif defined (HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
|
||||
tv.tv_usec = statbuf->st_mtim.tv_nsec / 1000;
|
||||
usec = statbuf->st_mtim.tv_nsec / 1000;
|
||||
#else
|
||||
tv.tv_usec = 0;
|
||||
usec = 0;
|
||||
#endif
|
||||
|
||||
return g_strdup_printf ("%lu:%lu", tv.tv_sec, tv.tv_usec);
|
||||
return g_strdup_printf ("%lu:%lu", sec, usec);
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -376,7 +376,7 @@ g_memory_output_stream_new (gpointer data,
|
||||
}
|
||||
|
||||
/**
|
||||
* g_memory_output_stream_get_data:
|
||||
* g_memory_output_stream_get_data: (skip)
|
||||
* @ostream: a #GMemoryOutputStream
|
||||
*
|
||||
* Gets any loaded data from the @ostream.
|
||||
|
16
gio/gmount.c
16
gio/gmount.c
@ -39,7 +39,7 @@
|
||||
* SECTION:gmount
|
||||
* @short_description: Mount management
|
||||
* @include: gio/gio.h
|
||||
* @see also: GVolume, GUnixMount
|
||||
* @see_also: GVolume, GUnixMount
|
||||
*
|
||||
* The #GMount interface represents user-visible mounts. Note, when
|
||||
* porting from GnomeVFS, #GMount is the moral equivalent of #GnomeVFSVolume.
|
||||
@ -122,7 +122,7 @@ g_mount_default_init (GMountInterface *iface)
|
||||
*
|
||||
* Gets the root directory on @mount.
|
||||
*
|
||||
* Returns: a #GFile.
|
||||
* Returns: (transfer full): a #GFile.
|
||||
* The returned object should be unreffed with
|
||||
* g_object_unref() when no longer needed.
|
||||
**/
|
||||
@ -146,7 +146,7 @@ g_mount_get_root (GMount *mount)
|
||||
* @mount is a path that reflects the main entry point for the user (e.g.
|
||||
* the home directory, or the root of the volume).
|
||||
*
|
||||
* Returns: a #GFile.
|
||||
* Returns: (transfer full): a #GFile.
|
||||
* The returned object should be unreffed with
|
||||
* g_object_unref() when no longer needed.
|
||||
**/
|
||||
@ -197,7 +197,7 @@ g_mount_get_name (GMount *mount)
|
||||
*
|
||||
* Gets the icon for @mount.
|
||||
*
|
||||
* Returns: a #GIcon.
|
||||
* Returns: (transfer full): a #GIcon.
|
||||
* The returned object should be unreffed with
|
||||
* g_object_unref() when no longer needed.
|
||||
**/
|
||||
@ -244,7 +244,7 @@ g_mount_get_uuid (GMount *mount)
|
||||
*
|
||||
* Gets the volume for the @mount.
|
||||
*
|
||||
* Returns: a #GVolume or %NULL if @mount is not associated with a volume.
|
||||
* Returns: (transfer full): a #GVolume or %NULL if @mount is not associated with a volume.
|
||||
* The returned object should be unreffed with
|
||||
* g_object_unref() when no longer needed.
|
||||
**/
|
||||
@ -269,7 +269,7 @@ g_mount_get_volume (GMount *mount)
|
||||
* This is a convenience method for getting the #GVolume and then
|
||||
* using that object to get the #GDrive.
|
||||
*
|
||||
* Returns: a #GDrive or %NULL if @mount is not associated with a volume or a drive.
|
||||
* Returns: (transfer full): a #GDrive or %NULL if @mount is not associated with a volume or a drive.
|
||||
* The returned object should be unreffed with
|
||||
* g_object_unref() when no longer needed.
|
||||
**/
|
||||
@ -800,7 +800,7 @@ g_mount_guess_content_type (GMount *mount,
|
||||
* %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
|
||||
* guessing.
|
||||
*
|
||||
* Returns: a %NULL-terminated array of content types or %NULL on error.
|
||||
* Returns: (transfer full) (element-type utf8): a %NULL-terminated array of content types or %NULL on error.
|
||||
* Caller should free this array with g_strfreev() when done with it.
|
||||
*
|
||||
* Since: 2.18
|
||||
@ -844,7 +844,7 @@ g_mount_guess_content_type_finish (GMount *mount,
|
||||
* This is an synchronous operation and as such may block doing IO;
|
||||
* see g_mount_guess_content_type() for the asynchronous version.
|
||||
*
|
||||
* Returns: a %NULL-terminated array of content types or %NULL on error.
|
||||
* Returns: (transfer full) (element-type utf8): a %NULL-terminated array of content types or %NULL on error.
|
||||
* Caller should free this array with g_strfreev() when done with it.
|
||||
*
|
||||
* Since: 2.18
|
||||
|
@ -251,7 +251,7 @@ g_network_address_set_addresses (GNetworkAddress *addr,
|
||||
* Creates a new #GSocketConnectable for connecting to the given
|
||||
* @hostname and @port.
|
||||
*
|
||||
* Return value: the new #GNetworkAddress
|
||||
* Return value: (transfer full): the new #GNetworkAddress
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -275,7 +275,7 @@ g_network_address_new (const gchar *hostname,
|
||||
* @hostname and @port. May fail and return %NULL in case
|
||||
* parsing @host_and_port fails.
|
||||
*
|
||||
* @host_and_port may be in any of a number of recognised formats: an IPv6
|
||||
* @host_and_port may be in any of a number of recognised formats; an IPv6
|
||||
* address, an IPv4 address, or a domain name (in which case a DNS
|
||||
* lookup is performed). Quoting with [] is supported for all address
|
||||
* types. A port override may be specified in the usual way with a
|
||||
@ -289,7 +289,7 @@ g_network_address_new (const gchar *hostname,
|
||||
* (allowing them to give the hostname, and a port overide if necessary)
|
||||
* and @default_port is expected to be provided by the application.
|
||||
*
|
||||
* Return value: the new #GNetworkAddress, or %NULL on error
|
||||
* Return value: (transfer full): the new #GNetworkAddress, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -680,7 +680,7 @@ _g_uri_from_authority (const gchar *protocol,
|
||||
* g_network_address_parse_host() allows #GSocketClient to determine
|
||||
* when to use application-specific proxy protocols.
|
||||
*
|
||||
* Return value: the new #GNetworkAddress, or %NULL on error
|
||||
* Return value: (transfer full): the new #GNetworkAddress, or %NULL on error
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
@ -855,8 +855,7 @@ got_addresses (GObject *source_object,
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -245,7 +245,7 @@ g_network_service_get_property (GObject *object,
|
||||
* @protocol, and @domain. This will initially be unresolved; use the
|
||||
* #GSocketConnectable interface to resolve it.
|
||||
*
|
||||
* Return value: a new #GNetworkService
|
||||
* Return value: (transfer full): a new #GNetworkService
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -361,6 +361,25 @@ g_network_service_set_scheme (GNetworkService *srv,
|
||||
g_object_notify (G_OBJECT (srv), "scheme");
|
||||
}
|
||||
|
||||
static GList *
|
||||
g_network_service_fallback_targets (GNetworkService *srv)
|
||||
{
|
||||
GSrvTarget *target;
|
||||
struct servent *entry;
|
||||
guint16 port;
|
||||
|
||||
entry = getservbyname (srv->priv->service, "tcp");
|
||||
port = entry ? g_ntohs (entry->s_port) : 0;
|
||||
#ifdef HAVE_ENDSERVENT
|
||||
endservent ();
|
||||
#endif
|
||||
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
|
||||
target = g_srv_target_new (srv->priv->domain, port, 0, 0);
|
||||
return g_list_append (NULL, target);
|
||||
}
|
||||
|
||||
#define G_TYPE_NETWORK_SERVICE_ADDRESS_ENUMERATOR (_g_network_service_address_enumerator_get_type ())
|
||||
#define G_NETWORK_SERVICE_ADDRESS_ENUMERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_NETWORK_SERVICE_ADDRESS_ENUMERATOR, GNetworkServiceAddressEnumerator))
|
||||
@ -401,14 +420,26 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator
|
||||
if (!srv_enum->srv->priv->targets)
|
||||
{
|
||||
GList *targets;
|
||||
GError *my_error = NULL;
|
||||
|
||||
targets = g_resolver_lookup_service (srv_enum->resolver,
|
||||
srv_enum->srv->priv->service,
|
||||
srv_enum->srv->priv->protocol,
|
||||
srv_enum->srv->priv->domain,
|
||||
cancellable, error);
|
||||
if (!targets)
|
||||
return NULL;
|
||||
cancellable, &my_error);
|
||||
if (!targets && g_error_matches (my_error, G_RESOLVER_ERROR,
|
||||
G_RESOLVER_ERROR_NOT_FOUND))
|
||||
{
|
||||
targets = g_network_service_fallback_targets (srv_enum->srv);
|
||||
if (targets)
|
||||
g_clear_error (&my_error);
|
||||
}
|
||||
|
||||
if (my_error)
|
||||
{
|
||||
g_propagate_error (error, my_error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
srv_enum->srv->priv->targets = targets;
|
||||
srv_enum->t = srv_enum->srv->priv->targets;
|
||||
@ -478,7 +509,10 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator
|
||||
srv_enum->error = error;
|
||||
else
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
g_object_unref (srv_enum->addr_enum);
|
||||
srv_enum->addr_enum = NULL;
|
||||
}
|
||||
@ -543,23 +577,31 @@ next_async_resolved_targets (GObject *source_object,
|
||||
{
|
||||
GNetworkServiceAddressEnumerator *srv_enum = user_data;
|
||||
GError *error = NULL;
|
||||
GList *targets;
|
||||
|
||||
srv_enum->srv->priv->targets =
|
||||
g_resolver_lookup_service_finish (srv_enum->resolver, result, &error);
|
||||
targets = g_resolver_lookup_service_finish (srv_enum->resolver,
|
||||
result, &error);
|
||||
|
||||
if (!targets && g_error_matches (error, G_RESOLVER_ERROR,
|
||||
G_RESOLVER_ERROR_NOT_FOUND))
|
||||
{
|
||||
targets = g_network_service_fallback_targets (srv_enum->srv);
|
||||
if (targets)
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
GSimpleAsyncResult *simple = srv_enum->result;
|
||||
|
||||
srv_enum->result = NULL;
|
||||
g_simple_async_result_set_from_error (simple, error);
|
||||
g_error_free (error);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete (simple);
|
||||
g_object_unref (simple);
|
||||
}
|
||||
else
|
||||
{
|
||||
srv_enum->t = srv_enum->srv->priv->targets;
|
||||
srv_enum->t = srv_enum->srv->priv->targets = targets;
|
||||
next_async_have_targets (srv_enum);
|
||||
}
|
||||
}
|
||||
@ -599,8 +641,7 @@ next_async_have_targets (GNetworkServiceAddressEnumerator *srv_enum)
|
||||
|
||||
if (srv_enum->error)
|
||||
{
|
||||
g_simple_async_result_set_from_error (simple, srv_enum->error);
|
||||
g_error_free (srv_enum->error);
|
||||
g_simple_async_result_take_error (simple, srv_enum->error);
|
||||
srv_enum->error = NULL;
|
||||
}
|
||||
|
||||
@ -628,7 +669,10 @@ next_async_have_address (GObject *source_object,
|
||||
srv_enum->error = error;
|
||||
else
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (!address)
|
||||
{
|
||||
g_object_unref (srv_enum->addr_enum);
|
||||
srv_enum->addr_enum = NULL;
|
||||
|
||||
|
@ -1,74 +0,0 @@
|
||||
/* GIO - GLib Input, Output and Streaming Library
|
||||
*
|
||||
* Copyright © 2010 Red Hat, Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Colin Walters <walters@verbum.org>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gioerror.h"
|
||||
|
||||
static gboolean
|
||||
_g_application_platform_init (GApplication *app,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_g_application_platform_register (GApplication *app,
|
||||
gboolean *unique,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_on_actions_changed (GApplication *app)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_remote_invoke_action (GApplication *app,
|
||||
const gchar *action,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_remote_quit (GApplication *app,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_default_quit (void)
|
||||
{
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static void
|
||||
_g_application_platform_activate (GApplication *app,
|
||||
GVariant *data)
|
||||
{
|
||||
exit (0);
|
||||
}
|
@ -148,7 +148,7 @@ g_output_stream_init (GOutputStream *stream)
|
||||
/**
|
||||
* g_output_stream_write:
|
||||
* @stream: a #GOutputStream.
|
||||
* @buffer: (array length=count) (element-type uint8): the buffer containing the data to write.
|
||||
* @buffer: (array length=count) (element-type guint8): the buffer containing the data to write.
|
||||
* @count: the number of bytes to write
|
||||
* @cancellable: optional cancellable object
|
||||
* @error: location to store the error occuring, or %NULL to ignore
|
||||
@ -156,18 +156,19 @@ g_output_stream_init (GOutputStream *stream)
|
||||
* Tries to write @count bytes from @buffer into the stream. Will block
|
||||
* during the operation.
|
||||
*
|
||||
* If count is zero returns zero and does nothing. A value of @count
|
||||
* If count is 0, returns 0 and does nothing. A value of @count
|
||||
* larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
|
||||
*
|
||||
* On success, the number of bytes written to the stream is returned.
|
||||
* It is not an error if this is not the same as the requested size, as it
|
||||
* can happen e.g. on a partial i/o error, or if there is not enough
|
||||
* storage in the stream. All writes either block until at least one byte
|
||||
* is written, so zero is never returned (unless @count is zero).
|
||||
* can happen e.g. on a partial I/O error, or if there is not enough
|
||||
* storage in the stream. All writes block until at least one byte
|
||||
* is written or an error occurs; 0 is never returned (unless
|
||||
* @count is 0).
|
||||
*
|
||||
* If @cancellable is not NULL, then the operation can be cancelled by
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
|
||||
* operation was partially finished when the operation was cancelled the
|
||||
* partial result will be returned, without an error.
|
||||
*
|
||||
@ -226,7 +227,7 @@ g_output_stream_write (GOutputStream *stream,
|
||||
/**
|
||||
* g_output_stream_write_all:
|
||||
* @stream: a #GOutputStream.
|
||||
* @buffer: (array length=count) (element-type uint8): the buffer containing the data to write.
|
||||
* @buffer: (array length=count) (element-type guint8): the buffer containing the data to write.
|
||||
* @count: the number of bytes to write
|
||||
* @bytes_written: location to store the number of bytes that was
|
||||
* written to the stream
|
||||
@ -594,10 +595,11 @@ async_ready_close_callback_wrapper (GObject *source_object,
|
||||
{
|
||||
GSimpleAsyncResult *err;
|
||||
|
||||
err = g_simple_async_result_new_from_error (source_object,
|
||||
err = g_simple_async_result_new_take_error (source_object,
|
||||
stream->priv->outstanding_callback,
|
||||
data->user_data,
|
||||
data->flush_error);
|
||||
data->flush_error = NULL;
|
||||
|
||||
(*stream->priv->outstanding_callback) (source_object,
|
||||
G_ASYNC_RESULT (err),
|
||||
@ -650,7 +652,7 @@ async_ready_close_flushed_callback_wrapper (GObject *source_object,
|
||||
/**
|
||||
* g_output_stream_write_async:
|
||||
* @stream: A #GOutputStream.
|
||||
* @buffer: (array length=count) (element-type uint8): the buffer containing the data to write.
|
||||
* @buffer: (array length=count) (element-type guint8): the buffer containing the data to write.
|
||||
* @count: the number of bytes to write
|
||||
* @io_priority: the io priority of the request.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
@ -728,11 +730,10 @@ g_output_stream_write_async (GOutputStream *stream,
|
||||
|
||||
if (!g_output_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -851,11 +852,10 @@ g_output_stream_splice_async (GOutputStream *stream,
|
||||
|
||||
if (!g_output_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -934,11 +934,10 @@ g_output_stream_flush_async (GOutputStream *stream,
|
||||
|
||||
if (!g_output_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1046,11 +1045,10 @@ g_output_stream_close_async (GOutputStream *stream,
|
||||
|
||||
if (!g_output_stream_set_pending (stream, &error))
|
||||
{
|
||||
g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1253,10 +1251,7 @@ write_async_thread (GSimpleAsyncResult *res,
|
||||
op->count_written = class->write_fn (G_OUTPUT_STREAM (object), op->buffer, op->count_requested,
|
||||
cancellable, &error);
|
||||
if (op->count_written == -1)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1320,10 +1315,7 @@ splice_async_thread (GSimpleAsyncResult *result,
|
||||
cancellable,
|
||||
&error);
|
||||
if (op->bytes_copied == -1)
|
||||
{
|
||||
g_simple_async_result_set_from_error (result, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (result, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1380,10 +1372,7 @@ flush_async_thread (GSimpleAsyncResult *res,
|
||||
result = class->flush (G_OUTPUT_STREAM (object), cancellable, &error);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1443,10 +1432,7 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
result = class->close_fn (G_OUTPUT_STREAM (object), cancellable, &error);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
g_simple_async_result_set_from_error (res, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_simple_async_result_take_error (res, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
744
gio/gperiodic.c
Normal file
744
gio/gperiodic.c
Normal file
@ -0,0 +1,744 @@
|
||||
/*
|
||||
* Copyright © 2010 Codethink Limited
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* licence, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gperiodic.h"
|
||||
|
||||
#include "gio-marshal.h"
|
||||
|
||||
/**
|
||||
* SECTION:gperiodic
|
||||
* @title: GPeriodic
|
||||
* @short_description: a periodic event clock
|
||||
*
|
||||
* #GPeriodic is a periodic event clock that fires a configurable number
|
||||
* of times per second and is capable of being put into synch with an
|
||||
* external time source.
|
||||
*
|
||||
* A number of #GPeriodicTickFunc<!-- -->s are registered with
|
||||
* g_periodic_add() and are called each time the clock "ticks".
|
||||
*
|
||||
* The tick functions can report "damage" (ie: updates that need to be
|
||||
* performed) that are handled in a "repair" phase that follows all the
|
||||
* tick functions having been run. It is also possible to report damage
|
||||
* while the clock is not running, in which case the rate of repairs
|
||||
* will be rate limited as if the clock were running.
|
||||
*
|
||||
* #GPeriodic has a configurable priority range consisting of a high and
|
||||
* low value. Other sources with a priority higher than the high value
|
||||
* might starve #GPeriodic and sources with the priority lower than the
|
||||
* low value may be starved by #GPeriodic.
|
||||
*
|
||||
* #GPeriodic will engage in dynamic scheduling with respect to sources
|
||||
* that have their priorities within the high to low range. A given
|
||||
* #GPeriodic will ensure that the events dispatched from itself are
|
||||
* generally using less than 50% of the CPU (on average) if other tasks
|
||||
* are pending. If no other sources within the range are pending then
|
||||
* #GPeriodic will use up to all of the available CPU (which can lead to
|
||||
* starvation of lower-priority sources, as mentioned above). The 50%
|
||||
* figure is entirely arbitrary and may change or become configurable in
|
||||
* the future.
|
||||
*
|
||||
* For example, if a #GPeriodic has been set to run at 10Hz and a
|
||||
* particular iteration uses 140ms of time, then 2 ticks will be
|
||||
* "skipped" to give other sources a chance to run (ie: the next tick
|
||||
* will occur 300ms later rather than 100ms later, giving 160ms of time
|
||||
* for other sources).
|
||||
*
|
||||
* This means that the high priority value for #GPeriodic should be set
|
||||
* quite high (above anything else) and the low priority value for
|
||||
* #GPeriodic should be set lower than everything except true "idle"
|
||||
* handlers (ie: things that you want to run only when the program is
|
||||
* truly idle).
|
||||
*
|
||||
* #GPeriodic generally assumes that although the things attached to it
|
||||
* may be poorly behaved in terms of non-yielding behaviour (either
|
||||
* individually or in aggregate), the other sources on the main loop
|
||||
* should be "well behaved". Other sources should try not to block the
|
||||
* CPU for a substantial portion of the periodic interval.
|
||||
*
|
||||
* The sources attached to a #GPeriodic are permitted to be somewhat
|
||||
* less well-behaved because they are generally rendering the UI for the
|
||||
* user (which should be done smoothly) and also because they will be
|
||||
* throttled by #GPeriodic.
|
||||
*
|
||||
* #GPeriodic is intended to be used as a paint clock for managing
|
||||
* geometry updates and painting of windows.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
|
||||
/**
|
||||
* GPeriodic:
|
||||
*
|
||||
* #GPeriodic is an opaque structure type.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GPeriodicTickFunc callback;
|
||||
gpointer user_data;
|
||||
GDestroyNotify notify;
|
||||
guint id;
|
||||
} GPeriodicTick;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GSource source;
|
||||
GPeriodic *periodic;
|
||||
} GPeriodicSource;
|
||||
|
||||
struct _GPeriodicPrivate
|
||||
{
|
||||
GSource *source; /* GPeriodicSource */
|
||||
guint64 last_run;
|
||||
guint blocked;
|
||||
guint hz;
|
||||
guint skip_frames;
|
||||
guint stop_skip_id;
|
||||
gint low_priority;
|
||||
|
||||
GSList *ticks; /* List<GPeriodicTick> */
|
||||
|
||||
guint damaged : 1;
|
||||
|
||||
/* debug */
|
||||
guint in_tick : 1;
|
||||
guint in_repair : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GPeriodic, g_periodic, G_TYPE_OBJECT)
|
||||
|
||||
#define PERIODIC_FROM_SOURCE(src) (((GPeriodicSource *) (src))->periodic)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_NONE,
|
||||
PROP_HZ,
|
||||
PROP_HIGH_PRIORITY,
|
||||
PROP_LOW_PRIORITY
|
||||
};
|
||||
|
||||
static guint g_periodic_tick;
|
||||
static guint g_periodic_repair;
|
||||
|
||||
static guint64
|
||||
g_periodic_get_microticks (GPeriodic *periodic)
|
||||
{
|
||||
return g_source_get_time (periodic->priv->source) * periodic->priv->hz;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_periodic_stop_skip (gpointer data)
|
||||
{
|
||||
GPeriodic *periodic = data;
|
||||
|
||||
periodic->priv->skip_frames = 0;
|
||||
|
||||
g_message ("Skipping frames ends");
|
||||
|
||||
periodic->priv->stop_skip_id = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_real_tick (GPeriodic *periodic,
|
||||
gint64 timestamp)
|
||||
{
|
||||
GSList *iter;
|
||||
|
||||
for (iter = periodic->priv->ticks; iter; iter = iter->next)
|
||||
{
|
||||
GPeriodicTick *tick = iter->data;
|
||||
|
||||
tick->callback (periodic, timestamp, tick->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_real_repair (GPeriodic *periodic)
|
||||
{
|
||||
periodic->priv->damaged = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_run (GPeriodic *periodic)
|
||||
{
|
||||
gint64 start, usec;
|
||||
|
||||
g_assert (periodic->priv->blocked == 0);
|
||||
|
||||
start = g_get_monotonic_time ();
|
||||
|
||||
if (periodic->priv->ticks)
|
||||
{
|
||||
guint64 microseconds;
|
||||
|
||||
periodic->priv->in_tick = TRUE;
|
||||
microseconds = periodic->priv->last_run / periodic->priv->hz;
|
||||
g_signal_emit (periodic, g_periodic_tick, 0, microseconds);
|
||||
periodic->priv->in_tick = FALSE;
|
||||
}
|
||||
|
||||
g_assert (periodic->priv->blocked == 0);
|
||||
|
||||
if (periodic->priv->damaged)
|
||||
{
|
||||
periodic->priv->in_repair = TRUE;
|
||||
g_signal_emit (periodic, g_periodic_repair, 0);
|
||||
periodic->priv->in_repair = FALSE;
|
||||
}
|
||||
|
||||
g_assert (!periodic->priv->damaged);
|
||||
|
||||
usec = g_get_monotonic_time () - start;
|
||||
g_assert (usec >= 0);
|
||||
|
||||
/* Take the time it took to render, multiply by two and round down to
|
||||
* a whole number of frames. This ensures that we don't take more
|
||||
* than 50% of the CPU with rendering.
|
||||
*
|
||||
* Examples (at 10fps for easy math. 1 frame = 100ms):
|
||||
*
|
||||
* 0-49ms to render: no frames skipped
|
||||
*
|
||||
* We used less than half of the time to render. OK. We will run
|
||||
* the next frame 100ms after this one ran (no skips).
|
||||
*
|
||||
* 50-99ms to render: 1 frame skipped
|
||||
*
|
||||
* We used more than half the time. Skip one frame so that we run
|
||||
* 200ms later rather than 100ms later. We already used up to
|
||||
* 99ms worth of that 200ms window, so that gives 101ms for other
|
||||
* things to run (50%). For figures closer to 50ms the other
|
||||
* stuff will actually get more than 50%.
|
||||
*
|
||||
* 100-150ms to render: 2 frames skipped, etc.
|
||||
*/
|
||||
periodic->priv->skip_frames = 2 * usec * periodic->priv->hz / 1000000;
|
||||
|
||||
if (periodic->priv->skip_frames)
|
||||
{
|
||||
g_message ("Slow painting; (possibly) skipping %d frames\n",
|
||||
periodic->priv->skip_frames);
|
||||
|
||||
if (periodic->priv->stop_skip_id == 0)
|
||||
periodic->priv->stop_skip_id =
|
||||
g_idle_add_full (periodic->priv->low_priority,
|
||||
g_periodic_stop_skip,
|
||||
periodic, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_periodic_prepare (GSource *source,
|
||||
gint *timeout)
|
||||
{
|
||||
GPeriodic *periodic = PERIODIC_FROM_SOURCE (source);
|
||||
|
||||
if ((periodic->priv->ticks || periodic->priv->damaged) && !periodic->priv->blocked)
|
||||
/* We need to run. */
|
||||
{
|
||||
gint64 remaining;
|
||||
|
||||
remaining = periodic->priv->last_run + 1000000 * (1 + periodic->priv->skip_frames) -
|
||||
g_periodic_get_microticks (periodic);
|
||||
|
||||
if (remaining > 0)
|
||||
/* It's too soon. Wait some more before running. */
|
||||
{
|
||||
/* Round-up the timeout.
|
||||
*
|
||||
* If we round down, then we will quite often wake to discover
|
||||
* that not enough time has passed and want to sleep again, so
|
||||
* save ourselves the future bother.
|
||||
*/
|
||||
*timeout = (remaining + periodic->priv->hz - 1) / periodic->priv->hz / 1000;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
else
|
||||
/* Enough time has passed. Run now. */
|
||||
{
|
||||
*timeout = 0;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* We shouldn't be running now at all. */
|
||||
{
|
||||
*timeout = -1;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_periodic_check (GSource *source)
|
||||
{
|
||||
GPeriodic *periodic = PERIODIC_FROM_SOURCE (source);
|
||||
|
||||
if ((periodic->priv->ticks || periodic->priv->damaged) && !periodic->priv->blocked)
|
||||
/* We need to run. */
|
||||
{
|
||||
guint64 now = g_periodic_get_microticks (periodic);
|
||||
|
||||
/* Run if it's not too soon. */
|
||||
return !(now < periodic->priv->last_run + 1000000 * (periodic->priv->skip_frames + 1));
|
||||
}
|
||||
|
||||
else
|
||||
/* We shouldn't be running now at all. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_periodic_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GPeriodic *periodic = PERIODIC_FROM_SOURCE (source);
|
||||
guint64 elapsed_ticks;
|
||||
guint64 now;
|
||||
|
||||
g_assert (periodic->priv->blocked == 0);
|
||||
|
||||
/* Update the last_run.
|
||||
*
|
||||
* In the normal case we want to add exactly 1 tick to it. This
|
||||
* ensures that the clock runs at the proper rate in the normal case
|
||||
* (ie: the dispatch overhead time is not lost).
|
||||
*
|
||||
* If more than one tick has elapsed, we set it equal to the current
|
||||
* time. This has two purposes:
|
||||
*
|
||||
* - sets last_run to something reasonable if the clock is running
|
||||
* for the first time or after a long period of inactivity
|
||||
*
|
||||
* - resets our stride if we missed a frame
|
||||
*/
|
||||
now = g_periodic_get_microticks (periodic);
|
||||
elapsed_ticks = (now - periodic->priv->last_run) / 1000000;
|
||||
g_assert (elapsed_ticks > 0);
|
||||
|
||||
if G_LIKELY (elapsed_ticks == 1)
|
||||
periodic->priv->last_run += 1000000;
|
||||
else
|
||||
periodic->priv->last_run = now;
|
||||
|
||||
g_periodic_run (periodic);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GPeriodic *periodic = G_PERIODIC (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HIGH_PRIORITY:
|
||||
g_value_set_int (value, g_source_get_priority (periodic->priv->source));
|
||||
break;
|
||||
|
||||
case PROP_LOW_PRIORITY:
|
||||
g_value_set_int (value, periodic->priv->low_priority);
|
||||
break;
|
||||
|
||||
case PROP_HZ:
|
||||
g_value_set_uint (value, periodic->priv->hz);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GPeriodic *periodic = G_PERIODIC (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HIGH_PRIORITY:
|
||||
g_source_set_priority (periodic->priv->source, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
case PROP_LOW_PRIORITY:
|
||||
periodic->priv->low_priority = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_HZ:
|
||||
periodic->priv->hz = g_value_get_uint (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_finalize (GObject *object)
|
||||
{
|
||||
GPeriodic *periodic = G_PERIODIC (object);
|
||||
|
||||
g_source_destroy (periodic->priv->source);
|
||||
g_source_unref (periodic->priv->source);
|
||||
|
||||
G_OBJECT_CLASS (g_periodic_parent_class)
|
||||
->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_init (GPeriodic *periodic)
|
||||
{
|
||||
static GSourceFuncs source_funcs = {
|
||||
g_periodic_prepare, g_periodic_check, g_periodic_dispatch
|
||||
};
|
||||
|
||||
periodic->priv = G_TYPE_INSTANCE_GET_PRIVATE (periodic,
|
||||
G_TYPE_PERIODIC,
|
||||
GPeriodicPrivate);
|
||||
|
||||
periodic->priv->source = g_source_new (&source_funcs,
|
||||
sizeof (GPeriodicSource));
|
||||
((GPeriodicSource *) periodic->priv->source)->periodic = periodic;
|
||||
g_source_attach (periodic->priv->source,
|
||||
g_main_context_get_thread_default ());
|
||||
}
|
||||
|
||||
static void
|
||||
g_periodic_class_init (GPeriodicClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
class->tick = g_periodic_real_tick;
|
||||
class->repair = g_periodic_real_repair;
|
||||
|
||||
object_class->get_property = g_periodic_get_property;
|
||||
object_class->set_property = g_periodic_set_property;
|
||||
object_class->finalize = g_periodic_finalize;
|
||||
|
||||
g_periodic_tick = g_signal_new ("tick", G_TYPE_PERIODIC,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GPeriodicClass, tick),
|
||||
NULL, NULL, _gio_marshal_VOID__INT64,
|
||||
G_TYPE_NONE, 1, G_TYPE_INT64);
|
||||
g_periodic_repair = g_signal_new ("repair", G_TYPE_PERIODIC,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GPeriodicClass, repair),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HZ,
|
||||
g_param_spec_uint ("hz", "ticks per second",
|
||||
"rate (in Hz) at which the 'tick' signal is emitted",
|
||||
1, 120, 1, G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HIGH_PRIORITY,
|
||||
g_param_spec_int ("high-priority", "high priority level",
|
||||
"the GSource priority level to run at",
|
||||
G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_LOW_PRIORITY,
|
||||
g_param_spec_int ("low-priority", "low priority level",
|
||||
"ignore tasks below this priority level",
|
||||
G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (class, sizeof (GPeriodicPrivate));
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_block:
|
||||
* @periodic: a #GPeriodic clock
|
||||
*
|
||||
* Temporarily blocks @periodic from running in order to bring it in
|
||||
* synch with an external time source.
|
||||
*
|
||||
* This function must be called from a handler of the "repair" signal.
|
||||
*
|
||||
* If this function is called, emission of the tick signal will be
|
||||
* suspended until g_periodic_unblock() is called an equal number of
|
||||
* times. Once that happens, the "tick" signal will run immediately and
|
||||
* future "tick" signals will be emitted relative to the time at which
|
||||
* the last call to g_periodic_unblock() occured.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_periodic_block (GPeriodic *periodic)
|
||||
{
|
||||
g_return_if_fail (G_IS_PERIODIC (periodic));
|
||||
g_return_if_fail (periodic->priv->in_repair);
|
||||
|
||||
periodic->priv->blocked++;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_unblock:
|
||||
* @periodic: a #GPeriodic clock
|
||||
* @unblock_time: the unblock time
|
||||
*
|
||||
* Reverses the effect of a previous call to g_periodic_block().
|
||||
*
|
||||
* If this call removes the last block, the tick signal is immediately
|
||||
* run. The repair signal may also be run if the clock is marked as
|
||||
* damaged.
|
||||
*
|
||||
* @unblock_time is the monotonic time, as per g_get_monotonic_time(),
|
||||
* at which the event causing the unblock occured.
|
||||
*
|
||||
* This function may not be called from handlers of any signal emitted
|
||||
* by @periodic.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_periodic_unblock (GPeriodic *periodic,
|
||||
gint64 unblock_time)
|
||||
{
|
||||
g_return_if_fail (G_IS_PERIODIC (periodic));
|
||||
g_return_if_fail (!periodic->priv->in_repair);
|
||||
g_return_if_fail (!periodic->priv->in_tick);
|
||||
g_return_if_fail (periodic->priv->blocked);
|
||||
|
||||
if (--periodic->priv->blocked)
|
||||
{
|
||||
periodic->priv->last_run = unblock_time * periodic->priv->hz;
|
||||
g_periodic_run (periodic);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_add:
|
||||
* @periodic: a #GPeriodic clock
|
||||
* @callback: a #GPeriodicTickFunc function
|
||||
* @user_data: data for @callback
|
||||
* @notify: for freeing @user_data when it is no longer needed
|
||||
*
|
||||
* Request periodic calls to @callback to start. The periodicity of the
|
||||
* calls is determined by the 'hz' property.
|
||||
*
|
||||
* This function may not be called from a handler of the repair signal,
|
||||
* but it is perfectly reasonable to call it from a handler of the tick
|
||||
* signal.
|
||||
*
|
||||
* The callback may be cancelled later by using g_periodic_remove() on
|
||||
* the return value of this function.
|
||||
*
|
||||
* Returns: a non-zero tag identifying this callback
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
/**
|
||||
* GPeriodicTickFunc:
|
||||
* @periodic: the #GPeriodic clock that is ticking
|
||||
* @timestamp: the timestamp at the time of the tick
|
||||
* @user_data: the user data given to g_periodic_add()
|
||||
*
|
||||
* The signature of the callback function that is called when the
|
||||
* #GPeriodic clock ticks.
|
||||
*
|
||||
* The @timestamp parameter is equal for all callbacks called during a
|
||||
* particular tick on a given clock.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
guint
|
||||
g_periodic_add (GPeriodic *periodic,
|
||||
GPeriodicTickFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GPeriodicTick *tick;
|
||||
static guint id;
|
||||
|
||||
g_return_val_if_fail (G_IS_PERIODIC (periodic), 0);
|
||||
g_return_val_if_fail (!periodic->priv->in_repair, 0);
|
||||
|
||||
tick = g_slice_new (GPeriodicTick);
|
||||
tick->callback = callback;
|
||||
tick->user_data = user_data;
|
||||
tick->notify = notify;
|
||||
tick->id = ++id;
|
||||
|
||||
periodic->priv->ticks = g_slist_prepend (periodic->priv->ticks, tick);
|
||||
|
||||
return tick->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_remove:
|
||||
* @periodic: a #GPeriodic clock
|
||||
* @tag: the ID of the callback to remove
|
||||
*
|
||||
* Reverse the effect of a previous call to g_periodic_start().
|
||||
*
|
||||
* @tag is the ID returned by that function.
|
||||
*
|
||||
* This function may not be called from a handler of the repair signal,
|
||||
* but it is perfectly reasonable to call it from a handler of the tick
|
||||
* signal.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_periodic_remove (GPeriodic *periodic,
|
||||
guint tag)
|
||||
{
|
||||
GSList **iter;
|
||||
|
||||
g_return_if_fail (G_IS_PERIODIC (periodic));
|
||||
g_return_if_fail (!periodic->priv->in_repair);
|
||||
|
||||
for (iter = &periodic->priv->ticks; *iter; iter = &(*iter)->next)
|
||||
{
|
||||
GPeriodicTick *tick = (*iter)->data;
|
||||
|
||||
if (tick->id == tag)
|
||||
{
|
||||
/* do this first incase the destroy notify re-enters */
|
||||
*iter = g_slist_remove (*iter, tick);
|
||||
|
||||
if (tick->notify)
|
||||
tick->notify (tick->user_data);
|
||||
|
||||
g_slice_free (GPeriodicTick, tick);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_critical ("GPeriodic: tag %u not registered", tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_damaged:
|
||||
* @periodic: a #GPeriodic clock
|
||||
*
|
||||
* Report damage and schedule the "repair" signal to be emitted during
|
||||
* the next repair phase.
|
||||
*
|
||||
* You may not call this function during the repair phase.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_periodic_damaged (GPeriodic *periodic)
|
||||
{
|
||||
g_return_if_fail (G_IS_PERIODIC (periodic));
|
||||
g_return_if_fail (!periodic->priv->in_repair);
|
||||
|
||||
periodic->priv->damaged = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_get_hz:
|
||||
* @periodic: a #GPeriodic clock
|
||||
*
|
||||
* Gets the frequency of the clock.
|
||||
*
|
||||
* Returns: the frquency of the clock, in Hz
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
guint
|
||||
g_periodic_get_hz (GPeriodic *periodic)
|
||||
{
|
||||
return periodic->priv->hz;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_get_high_priority:
|
||||
* @periodic: a #GPeriodic clock
|
||||
*
|
||||
* Gets the #GSource priority of the clock.
|
||||
*
|
||||
* Returns: the high priority level
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
gint
|
||||
g_periodic_get_high_priority (GPeriodic *periodic)
|
||||
{
|
||||
return g_source_get_priority (periodic->priv->source);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_get_low_priority:
|
||||
* @periodic: a #GPeriodic clock
|
||||
*
|
||||
* Gets the priority level that #GPeriodic uses to check for mainloop
|
||||
* inactivity. Other sources scheduled below this level of priority are
|
||||
* effectively ignored by #GPeriodic and may be starved.
|
||||
*
|
||||
* Returns: the low priority level
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
gint
|
||||
g_periodic_get_low_priority (GPeriodic *periodic)
|
||||
{
|
||||
return periodic->priv->low_priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_periodic_new:
|
||||
* @hz: the frequency of the new clock in Hz (between 1 and 120)
|
||||
* @priority: the #GSource priority to run at
|
||||
*
|
||||
* Creates a new #GPeriodic clock.
|
||||
*
|
||||
* The created clock is attached to the thread-default main context in
|
||||
* effect at the time of the call to this function. See
|
||||
* g_main_context_push_thread_default() for more information.
|
||||
*
|
||||
* Due to the fact that #GMainContext is only accurate to the nearest
|
||||
* millisecond, the frequency can not meaningfully get too close to
|
||||
* 1000. For this reason, it is arbitrarily bounded at 120.
|
||||
*
|
||||
* Returns: a new #GPeriodic
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
GPeriodic *
|
||||
g_periodic_new (guint hz,
|
||||
gint high_priority,
|
||||
gint low_priority)
|
||||
{
|
||||
g_return_val_if_fail (1 <= hz && hz <= 120, NULL);
|
||||
|
||||
return g_object_new (G_TYPE_PERIODIC,
|
||||
"hz", hz,
|
||||
"high-priority", high_priority,
|
||||
"low-priority", low_priority,
|
||||
NULL);
|
||||
}
|
88
gio/gperiodic.h
Normal file
88
gio/gperiodic.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright © 2010 Codethink Limited
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* licence, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
|
||||
#error "Only <gio/gio.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __G_PERIODIC_H__
|
||||
#define __G_PERIODIC_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_TYPE_PERIODIC (g_periodic_get_type ())
|
||||
#define G_PERIODIC(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
||||
G_TYPE_PERIODIC, GPeriodic))
|
||||
#define G_IS_PERIODIC(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_PERIODIC))
|
||||
|
||||
typedef struct _GPeriodicPrivate GPeriodicPrivate;
|
||||
typedef struct _GPeriodicClass GPeriodicClass;
|
||||
typedef struct _GPeriodic GPeriodic;
|
||||
|
||||
struct _GPeriodicClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*tick) (GPeriodic *periodic,
|
||||
gint64 timestamp);
|
||||
void (*repair) (GPeriodic *periodic);
|
||||
|
||||
/*< private >*/
|
||||
gpointer padding[14];
|
||||
};
|
||||
|
||||
struct _GPeriodic
|
||||
{
|
||||
GObject parent_instance;
|
||||
/*< private >*/
|
||||
GPeriodicPrivate *priv;
|
||||
};
|
||||
|
||||
typedef void (* GPeriodicTickFunc) (GPeriodic *periodic,
|
||||
gint64 timestamp,
|
||||
gpointer user_data);
|
||||
|
||||
GType g_periodic_get_type (void);
|
||||
GPeriodic * g_periodic_new (guint hz,
|
||||
gint high_priority,
|
||||
gint low_priority);
|
||||
guint g_periodic_get_hz (GPeriodic *periodic);
|
||||
gint g_periodic_get_high_priority (GPeriodic *periodic);
|
||||
gint g_periodic_get_low_priority (GPeriodic *periodic);
|
||||
|
||||
guint g_periodic_add (GPeriodic *periodic,
|
||||
GPeriodicTickFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
void g_periodic_remove (GPeriodic *periodic,
|
||||
guint tag);
|
||||
|
||||
void g_periodic_block (GPeriodic *periodic);
|
||||
void g_periodic_unblock (GPeriodic *periodic,
|
||||
gint64 unblock_time);
|
||||
|
||||
void g_periodic_damaged (GPeriodic *periodic);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_PERIODIC_H__ */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user