Merge branch 'master' into wip/gsettings-list

This commit is contained in:
Rodrigo Moya 2011-01-11 15:59:14 +01:00
commit d75842ff4c
157 changed files with 8691 additions and 6138 deletions

View File

@ -46,6 +46,11 @@ test-report perf-report full-report: ${TEST_PROGS}
GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
ignore_logdir=false ; \ ignore_logdir=false ; \
fi ; \ fi ; \
if test -d "$(top_srcdir)/.git" ; then \
REVISION=`git describe` ; \
else \
REVISION=$(VERSION) ; \
fi ; \
for subdir in $(SUBDIRS) . ; do \ for subdir in $(SUBDIRS) . ; do \
test "$$subdir" = "." -o "$$subdir" = "po" || \ test "$$subdir" = "." -o "$$subdir" = "po" || \
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
@ -56,6 +61,7 @@ test-report perf-report full-report: ${TEST_PROGS}
echo '<info>' >> $@.xml ; \ echo '<info>' >> $@.xml ; \
echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \ echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
echo ' <version>$(VERSION)</version>' >> $@.xml ; \ echo ' <version>$(VERSION)</version>' >> $@.xml ; \
echo " <revision>$$REVISION</revision>" >> $@.xml ; \
echo '</info>' >> $@.xml ; \ echo '</info>' >> $@.xml ; \
for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \

89
NEWS
View File

@ -1,3 +1,92 @@
Overview of Changes from GLib 2.27.5 to 2.27.90
===============================================
* Test reports created by gtester-report can now
include revision information
* The g_desktop_app_info_launch_* family of functions
now emit a DBus signal when an application is launched.
Additionally, there is a new variant
g_desktop_app_info_launch_uris_as_manager(), which
gives more control over the launched process.
* The memory and null GSettings backends are now available
as public API
* g_get_locale_variants() is a new function that returns a
list of variants of a locale identifier
* Bugs fixed:
587898 I/O timeouts for GSocket
606960 gio: Add extension point for informing parties...
631980 Handle an optional <revision> node in the report...
634569 Document that g_variant_builder_add_value consumes...
635998 Make _g_compute_locale_variants public
636806 Add g_{memory,null}_settings_backend_get_default
637262 Need a binary DER version of ::accepted-cas
637544 Skip fsync() on btrfs
637720 void functions should not return a value.
637738 object_interface_check_properties never actually...
637759 GIOChannel: fix a crash in g_io_channel_read_chars()
637852 Updates to glib.vsprops file for MSVC 2008 builds...
637858 Updates to test/testglib.c...
638349 parameter name of g_variant_new_* may conflict...
* Translation updates:
Hebrew
Norwegian bokmål
Simplified Chinese
Spanish
Swedish
Uyghur
Vietnamese
Overview of Changes from GLib 2.27.4 to 2.27.5
==============================================
* Network support:
- Add g_tls_certificate_verify() to verify a certificate
- Add GTlsConnection:use-system-certdb
- Other TLS api additions
* GIO:
- Add g_io_stream_splice_async()/_finish() to splice two iostreams
- Add g_emblemed_icon_clear_emblems() and make GEmblemedIcon derivable
- Remove GPeriodic; it did not receive the necessary review and
integration work to declare it stable
* GSequence:
- New methods g_sequence_lookup() and g_sequence_lookup_iter()
* Bugs fixed:
617254 Missing g_sequence_lookup
632544 g_dbus_connection_send_message can not send a locked message...
633350 g_hostname_to_ascii() ignores non-ascii dots
634583 Better error reporting for g_variant_parse()
635007 gsetting enum rule don't work for out-of-srcdir builds
635626 GDBus message idle can execute while flushes are pending
636100 Can't read GSettings:backend property
636305 Typo on g_queue_remove_all() function description
636311 appinfo: tweak application positioning for content-types
636351 g_simple_async_result_is_valid lacks a version tag
636387 gdb autoload files shadow the "dir" builtin
636673 g_simple_async_report_error_in_idle should allow object...
637147 Add a "delay-apply" property to GSettings
637171 emblemedicon: add g_emblemed_icon_clear_emblems()
637237 gapplication: plug a memory leak
* Translation updates:
Estonian
Galician
Hebrew
Norwegian bokmål
Simplified Chinese
Spanish
Traditional Chinese
Vietnamese
Overview of Changes from GLib 2.27.3 to 2.27.4 Overview of Changes from GLib 2.27.3 to 2.27.4
============================================== ==============================================

View File

@ -205,8 +205,9 @@ copy ..\..\..\gio\gnativevolumemonitor.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x
copy ..\..\..\gio\gnetworkaddress.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gnetworkaddress.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gnetworkservice.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gnetworkservice.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\goutputstream.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\goutputstream.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gperiodic.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gpermission.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gpermission.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gpollableinputstream.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gpollableoutputstream.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gproxy.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gproxy.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gproxyaddress.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gproxyaddress.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gproxyaddressenumerator.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gproxyaddressenumerator.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
@ -229,8 +230,14 @@ copy ..\..\..\gio\gsocketlistener.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gsocketservice.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gsocketservice.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gsrvtarget.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gsrvtarget.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gtcpconnection.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gtcpconnection.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gtcpwrapperconnection.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gthemedicon.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gthemedicon.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gthreadedsocketservice.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gthreadedsocketservice.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gtlsbackend.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gtlscertificate.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gtlsclientconnection.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gtlsconnection.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gtlsserverconnection.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gvfs.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gvfs.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gvolume.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gvolume.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;
copy ..\..\..\gio\gvolumemonitor.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A; copy ..\..\..\gio\gvolumemonitor.h $(OutDir)\include\glib-2.0\gio&#x0D;&#x0A;

View File

@ -22,7 +22,7 @@ m4_define(glib_configure_ac)
# #
m4_define([glib_major_version], [2]) m4_define([glib_major_version], [2])
m4_define([glib_minor_version], [27]) m4_define([glib_minor_version], [27])
m4_define([glib_micro_version], [5]) m4_define([glib_micro_version], [91])
m4_define([glib_interface_age], [0]) m4_define([glib_interface_age], [0])
m4_define([glib_binary_age], m4_define([glib_binary_age],
[m4_eval(100 * glib_minor_version + glib_micro_version)]) [m4_eval(100 * glib_minor_version + glib_micro_version)])
@ -49,6 +49,7 @@ AC_INIT(glib, [glib_version],
AC_CONFIG_HEADER([config.h]) AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([glib/glib.h]) AC_CONFIG_SRCDIR([glib/glib.h])
AC_CONFIG_MACRO_DIR([m4macros])
# Save this value here, since automake will set cflags later # Save this value here, since automake will set cflags later
cflags_set=${CFLAGS+set} cflags_set=${CFLAGS+set}
@ -224,10 +225,6 @@ AC_ARG_ENABLE(rebuilds,
[AC_HELP_STRING([--disable-rebuilds], [AC_HELP_STRING([--disable-rebuilds],
[disable all source autogeneration rules])],, [disable all source autogeneration rules])],,
[enable_rebuilds=yes]) [enable_rebuilds=yes])
AC_ARG_ENABLE(visibility,
[AC_HELP_STRING([--disable-visibility],
[don't use ELF visibility attributes])],,
[enable_visibility=yes])
if test "x$enable_threads" != "xyes"; then if test "x$enable_threads" != "xyes"; then
enable_threads=no enable_threads=no
@ -296,10 +293,6 @@ else
fi fi
fi fi
if test "x$enable_visibility" = "xno"; then
GLIB_DEBUG_FLAGS="$GLIB_DEBUG_FLAGS -DDISABLE_VISIBILITY"
fi
# Ensure MSVC-compatible struct packing convention is used when # Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc. # compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while

View File

@ -184,10 +184,6 @@
<xi:include href="xml/gapplication.xml"/> <xi:include href="xml/gapplication.xml"/>
<xi:include href="xml/gapplicationcommandline.xml"/> <xi:include href="xml/gapplicationcommandline.xml"/>
</chapter> </chapter>
<chapter id="periodic">
<title>Periodic Timer</title>
<xi:include href="xml/gperiodic.xml"/>
</chapter>
<chapter id="extending"> <chapter id="extending">
<title>Extending GIO</title> <title>Extending GIO</title>
<xi:include href="xml/gvfs.xml"/> <xi:include href="xml/gvfs.xml"/>

View File

@ -506,6 +506,7 @@ g_emblemed_icon_new
g_emblemed_icon_get_icon g_emblemed_icon_get_icon
g_emblemed_icon_get_emblems g_emblemed_icon_get_emblems
g_emblemed_icon_add_emblem g_emblemed_icon_add_emblem
g_emblemed_icon_clear_emblems
<SUBSECTION Standard> <SUBSECTION Standard>
GEmblemedIconClass GEmblemedIconClass
G_EMBLEMED_ICON G_EMBLEMED_ICON
@ -892,9 +893,12 @@ GUnixOutputStreamPrivate
<SECTION> <SECTION>
<FILE>giostream</FILE> <FILE>giostream</FILE>
<TITLE>GIOStream</TITLE> <TITLE>GIOStream</TITLE>
GIOStreamSpliceFlags
GIOStream GIOStream
g_io_stream_get_input_stream g_io_stream_get_input_stream
g_io_stream_get_output_stream g_io_stream_get_output_stream
g_io_stream_splice_async
g_io_stream_splice_finish
g_io_stream_close g_io_stream_close
g_io_stream_close_async g_io_stream_close_async
g_io_stream_close_finish g_io_stream_close_finish
@ -1252,6 +1256,7 @@ g_app_info_delete
g_app_info_reset_type_associations g_app_info_reset_type_associations
g_app_info_set_as_default_for_type g_app_info_set_as_default_for_type
g_app_info_set_as_default_for_extension g_app_info_set_as_default_for_extension
g_app_info_set_as_last_used_for_type
g_app_info_add_supports_type g_app_info_add_supports_type
g_app_info_can_remove_supports_type g_app_info_can_remove_supports_type
g_app_info_remove_supports_type g_app_info_remove_supports_type
@ -2153,6 +2158,7 @@ G_TYPE_FILE_DESCRIPTOR_BASED
GSettingsBackend GSettingsBackend
GSettingsBackendClass GSettingsBackendClass
G_SETTINGS_BACKEND_EXTENSION_POINT_NAME G_SETTINGS_BACKEND_EXTENSION_POINT_NAME
g_settings_backend_get_default
g_settings_backend_changed g_settings_backend_changed
g_settings_backend_path_changed g_settings_backend_path_changed
g_settings_backend_keys_changed g_settings_backend_keys_changed
@ -2161,6 +2167,8 @@ g_settings_backend_writable_changed
g_settings_backend_changed_tree g_settings_backend_changed_tree
g_settings_backend_flatten_tree g_settings_backend_flatten_tree
g_keyfile_settings_backend_new g_keyfile_settings_backend_new
g_memory_settings_backend_new
g_null_settings_backend_new
<SUBSECTION Standard> <SUBSECTION Standard>
G_IS_SETTINGS_BACKEND G_IS_SETTINGS_BACKEND
@ -2932,32 +2940,6 @@ G_TYPE_PROXY
g_proxy_get_type g_proxy_get_type
</SECTION> </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>
<SECTION> <SECTION>
<FILE>gpollableinputstream</FILE> <FILE>gpollableinputstream</FILE>
<TITLE>GPollableInputStream</TITLE> <TITLE>GPollableInputStream</TITLE>
@ -3038,6 +3020,7 @@ g_tls_certificate_new_from_file
g_tls_certificate_new_from_files g_tls_certificate_new_from_files
g_tls_certificate_list_new_from_file g_tls_certificate_list_new_from_file
g_tls_certificate_get_issuer g_tls_certificate_get_issuer
g_tls_certificate_verify
<SUBSECTION Standard> <SUBSECTION Standard>
GTlsCertificateClass GTlsCertificateClass
GTlsCertificatePrivate GTlsCertificatePrivate
@ -3058,19 +3041,20 @@ GTlsConnection
g_tls_connection_set_certificate g_tls_connection_set_certificate
g_tls_connection_get_certificate g_tls_connection_get_certificate
g_tls_connection_get_peer_certificate g_tls_connection_get_peer_certificate
g_tls_connection_get_peer_certificate_errors
g_tls_connection_set_require_close_notify g_tls_connection_set_require_close_notify
g_tls_connection_get_require_close_notify g_tls_connection_get_require_close_notify
GTlsRehandshakeMode GTlsRehandshakeMode
g_tls_connection_set_rehandshake_mode g_tls_connection_set_rehandshake_mode
g_tls_connection_get_rehandshake_mode g_tls_connection_get_rehandshake_mode
g_tls_connection_set_use_system_certdb
g_tls_connection_get_use_system_certdb
<SUBSECTION> <SUBSECTION>
g_tls_connection_handshake g_tls_connection_handshake
g_tls_connection_handshake_async g_tls_connection_handshake_async
g_tls_connection_handshake_finish g_tls_connection_handshake_finish
<SUBSECTION> <SUBSECTION>
g_tls_connection_set_peer_certificate
g_tls_connection_emit_accept_certificate g_tls_connection_emit_accept_certificate
g_tls_connection_emit_need_certificate
<SUBSECTION Standard> <SUBSECTION Standard>
GTlsConnectionClass GTlsConnectionClass
GTlsConnectionPrivate GTlsConnectionPrivate

View File

@ -74,7 +74,6 @@ g_network_service_get_type
g_output_stream_get_type g_output_stream_get_type
g_output_stream_splice_flags_get_type g_output_stream_splice_flags_get_type
g_password_save_get_type g_password_save_get_type
g_periodic_get_type
g_permission_get_type g_permission_get_type
g_pollable_input_stream_get_type g_pollable_input_stream_get_type
g_pollable_output_stream_get_type g_pollable_output_stream_get_type

View File

@ -247,14 +247,13 @@
</formalpara> </formalpara>
<formalpara> <formalpara>
<title><envar>GIO_USE_URI_ASSOCIATION</envar></title> <title><envar>GIO_USE_TLS</envar></title>
<para> <para>
This variable can be set to the name of a #GDesktopAppInfoLookup This variable can be set to the name of a #GTlsBackend
implementation to override the default for debugging purposes. implementation to override the default for debugging purposes.
GIO does not include a #GDesktopAppInfoLookup implementation, GIO does not include a #GTlsBackend implementation, the gnutls-based
the GConf-based implementation in the gvfs module has the name implementation in the glib-networking module has the name "gnutls".
"gconf".
</para> </para>
</formalpara> </formalpara>

View File

@ -232,8 +232,8 @@ How to compile GLib itself
<arg>--enable-included-printf</arg> <arg>--enable-included-printf</arg>
</group> </group>
<group> <group>
<arg>--disable-visibility</arg> <arg>--disable-Bsymbolic</arg>
<arg>--enable-visibility</arg> <arg>--enable-Bsymbolic</arg>
</group> </group>
<group> <group>
<arg>--disable-gtk-doc</arg> <arg>--disable-gtk-doc</arg>
@ -510,19 +510,18 @@ How to compile GLib itself
</formalpara> </formalpara>
<formalpara> <formalpara>
<title><systemitem>--disable-visibility</systemitem> and <title><systemitem>--disable-Bsymbolic</systemitem> and
<systemitem>--enable-visibility</systemitem></title> <systemitem>--enable-Bsymbolic</systemitem></title>
<para> <para>
By default, GLib uses ELF visibility attributes to optimize By default, GLib uses the -Bsymbolic-functions linker
PLT table entries if the compiler supports ELF visibility flag to avoid intra-library PLT jumps. A side-effect
attributes. A side-effect of the way in which this is currently of this is that it is no longer possible to override
implemented is that any header change forces a full internal uses of GLib functions with
recompilation, and missing includes may go unnoticed. <envvar>LD_PRELOAD</envvar>. Therefore, it may make
Therefore, it makes sense to turn this feature off while sense to turn this feature off in some situations.
doing GLib development, even if the compiler supports ELF The <option>--disable-Bsymbolic</option> option allows
visibility attributes. The <option>--disable-visibility</option> to do that.
option allows to do that.
</para> </para>
</formalpara> </formalpara>

View File

@ -2166,6 +2166,8 @@ g_sequence_remove_range
g_sequence_move_range g_sequence_move_range
g_sequence_search g_sequence_search
g_sequence_search_iter g_sequence_search_iter
g_sequence_lookup
g_sequence_lookup_iter
<SUBSECTION> <SUBSECTION>
g_sequence_get g_sequence_get
@ -2728,6 +2730,7 @@ g_dpgettext2
g_strip_context g_strip_context
<SUBSECTION> <SUBSECTION>
g_get_language_names g_get_language_names
g_get_locale_variants
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -116,9 +116,7 @@ settings_sources = \
gdelayedsettingsbackend.h \ gdelayedsettingsbackend.h \
gdelayedsettingsbackend.c \ gdelayedsettingsbackend.c \
gkeyfilesettingsbackend.c \ gkeyfilesettingsbackend.c \
gmemorysettingsbackend.h \
gmemorysettingsbackend.c \ gmemorysettingsbackend.c \
gnullsettingsbackend.h \
gnullsettingsbackend.c \ gnullsettingsbackend.c \
gsettingsbackendinternal.h \ gsettingsbackendinternal.h \
gsettingsbackend.c \ gsettingsbackend.c \
@ -348,7 +346,6 @@ libgio_2_0_la_SOURCES = \
gnetworkingprivate.h \ gnetworkingprivate.h \
gnetworkservice.c \ gnetworkservice.c \
goutputstream.c \ goutputstream.c \
gperiodic.c \
gpermission.c \ gpermission.c \
gpollableinputstream.c \ gpollableinputstream.c \
gpollableoutputstream.c \ gpollableoutputstream.c \
@ -510,7 +507,6 @@ gio_headers = \
gnetworkaddress.h \ gnetworkaddress.h \
gnetworkservice.h \ gnetworkservice.h \
goutputstream.h \ goutputstream.h \
gperiodic.h \
gpermission.h \ gpermission.h \
gpollableinputstream.h \ gpollableinputstream.h \
gpollableoutputstream.h \ gpollableoutputstream.h \

View File

@ -77,7 +77,8 @@ g_action_default_init (GActionInterface *iface)
P_("Action Name"), P_("Action Name"),
P_("The name used to invoke the action"), P_("The name used to invoke the action"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**
@ -93,7 +94,8 @@ g_action_default_init (GActionInterface *iface)
P_("Parameter Type"), P_("Parameter Type"),
P_("The type of GVariant passed to activate()"), P_("The type of GVariant passed to activate()"),
G_TYPE_VARIANT_TYPE, G_TYPE_VARIANT_TYPE,
G_PARAM_READABLE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**
@ -111,7 +113,8 @@ g_action_default_init (GActionInterface *iface)
P_("Enabled"), P_("Enabled"),
P_("If the action can be activated"), P_("If the action can be activated"),
TRUE, TRUE,
G_PARAM_READABLE | G_PARAM_CONSTRUCT |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**

View File

@ -308,6 +308,33 @@ g_app_info_set_as_default_for_type (GAppInfo *appinfo,
return (* iface->set_as_default_for_type) (appinfo, content_type, error); return (* iface->set_as_default_for_type) (appinfo, content_type, error);
} }
/**
* g_app_info_set_as_last_used_for_type:
* @appinfo: a #GAppInfo.
* @content_type: the content type.
* @error: a #GError.
*
* Sets the application as the last used application for a given type.
* This will make the application appear as first in the list returned by
* #g_app_info_get_recommended_for_type, regardless of the default application
* for that content type.
*
* Returns: %TRUE on success, %FALSE on error.
**/
gboolean
g_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
g_return_val_if_fail (content_type != NULL, FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->set_as_last_used_for_type) (appinfo, content_type, error);
}
/** /**
* g_app_info_set_as_default_for_extension: * g_app_info_set_as_default_for_extension:
@ -548,7 +575,7 @@ g_app_info_supports_files (GAppInfo *appinfo)
/** /**
* g_app_info_launch_uris: * g_app_info_launch_uris:
* @appinfo: a #GAppInfo * @appinfo: a #GAppInfo
* @uris: (element-type char*): a #GList containing URIs to launch. * @uris: (element-type utf8): a #GList containing URIs to launch.
* @launch_context: (allow-none): a #GAppLaunchContext or %NULL * @launch_context: (allow-none): a #GAppLaunchContext or %NULL
* @error: a #GError * @error: a #GError
* *
@ -605,7 +632,7 @@ g_app_info_should_show (GAppInfo *appinfo)
/** /**
* g_app_info_launch_default_for_uri: * g_app_info_launch_default_for_uri:
* @uri: the uri to show * @uri: the uri to show
* @launch_context: an optional #GAppLaunchContext. * @launch_context: (allow-none): an optional #GAppLaunchContext.
* @error: a #GError. * @error: a #GError.
* *
* Utility function that launches the default application * Utility function that launches the default application

View File

@ -99,7 +99,7 @@ struct _GAppInfoIface
const char * (* get_executable) (GAppInfo *appinfo); const char * (* get_executable) (GAppInfo *appinfo);
GIcon * (* get_icon) (GAppInfo *appinfo); GIcon * (* get_icon) (GAppInfo *appinfo);
gboolean (* launch) (GAppInfo *appinfo, gboolean (* launch) (GAppInfo *appinfo,
GList *filenames, GList *files,
GAppLaunchContext *launch_context, GAppLaunchContext *launch_context,
GError **error); GError **error);
gboolean (* supports_uris) (GAppInfo *appinfo); gboolean (* supports_uris) (GAppInfo *appinfo);
@ -128,6 +128,9 @@ struct _GAppInfoIface
gboolean (* do_delete) (GAppInfo *appinfo); gboolean (* do_delete) (GAppInfo *appinfo);
const char * (* get_commandline) (GAppInfo *appinfo); const char * (* get_commandline) (GAppInfo *appinfo);
const char * (* get_display_name) (GAppInfo *appinfo); const char * (* get_display_name) (GAppInfo *appinfo);
gboolean (* set_as_last_used_for_type) (GAppInfo *appinfo,
const char *content_type,
GError **error);
}; };
GType g_app_info_get_type (void) G_GNUC_CONST; GType g_app_info_get_type (void) G_GNUC_CONST;
@ -173,6 +176,10 @@ gboolean g_app_info_remove_supports_type (GAppInfo *appin
gboolean g_app_info_can_delete (GAppInfo *appinfo); gboolean g_app_info_can_delete (GAppInfo *appinfo);
gboolean g_app_info_delete (GAppInfo *appinfo); gboolean g_app_info_delete (GAppInfo *appinfo);
gboolean g_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
const char *content_type,
GError **error);
GList * g_app_info_get_all (void); GList * g_app_info_get_all (void);
GList * g_app_info_get_all_for_type (const char *content_type); GList * g_app_info_get_all_for_type (const char *content_type);
GList * g_app_info_get_recommended_for_type (const gchar *content_type); GList * g_app_info_get_recommended_for_type (const gchar *content_type);

View File

@ -357,7 +357,7 @@ g_application_set_property (GObject *object,
/** /**
* g_application_set_action_group: * g_application_set_action_group:
* @application: a #GApplication * @application: a #GApplication
* @action_group: a #GActionGroup, or %NULL * @action_group: (allow-none): a #GActionGroup, or %NULL
* *
* Sets or unsets the group of actions associated with the application. * Sets or unsets the group of actions associated with the application.
* *
@ -545,7 +545,7 @@ g_application_class_init (GApplicationClass *class)
/** /**
* GApplication::open: * GApplication::open:
* @application: the application * @application: the application
* @files: an array of #GFile objects * @files: (array length=n_files) (element-type GFile): an array of #GFiles
* @n_files: the length of @files * @n_files: the length of @files
* @hint: a hint provided by the calling instance * @hint: a hint provided by the calling instance
* *
@ -1047,7 +1047,7 @@ g_application_activate (GApplication *application)
/** /**
* g_application_open: * g_application_open:
* @application: a #GApplication * @application: a #GApplication
* @files: an array of #GFiles to open * @files: (array length=n_files): an array of #GFiles to open
* @n_files: the length of the @files array * @n_files: the length of the @files array
* @hint: a hint (or ""), but never %NULL * @hint: a hint (or ""), but never %NULL
* *
@ -1094,7 +1094,7 @@ g_application_open (GApplication *application,
* g_application_run: * g_application_run:
* @application: a #GApplication * @application: a #GApplication
* @argc: the argc from main() * @argc: the argc from main()
* @argv: the argv from main() * @argv: (array length=argc): the argv from main()
* @returns: the exit status * @returns: the exit status
* *
* Runs the application. * Runs the application.

View File

@ -249,7 +249,7 @@ g_application_command_line_class_init (GApplicationCommandLineClass *class)
/** /**
* g_application_command_line_get_arguments: * g_application_command_line_get_arguments:
* @cmdline: a #GApplicationCommandLine * @cmdline: a #GApplicationCommandLine
* @argc: the length of the arguments array, or %NULL * @argc: (out): the length of the arguments array, or %NULL
* *
* Gets the list of arguments that was passed on the command line. * Gets the list of arguments that was passed on the command line.
* *
@ -258,7 +258,8 @@ g_application_command_line_class_init (GApplicationCommandLineClass *class)
* The return value is %NULL-terminated and should be freed using * The return value is %NULL-terminated and should be freed using
* g_strfreev(). * g_strfreev().
* *
* Returns: the string array containing the arguments (the argv) * Returns: (array length=argc) (transfer full): the string array
* containing the arguments (the argv)
* *
* Since: 2.28 * Since: 2.28
**/ **/
@ -321,7 +322,8 @@ g_application_command_line_get_cwd (GApplicationCommandLine *cmdline)
* The return value should not be modified or freed and is valid for as * The return value should not be modified or freed and is valid for as
* long as @cmdline exists. * long as @cmdline exists.
* *
* Returns: the environment strings, or %NULL if they were not sent * Returns: (array zero-terminated=1) (transfer none): the environment
* strings, or %NULL if they were not sent
* *
* Since: 2.28 * Since: 2.28
**/ **/

View File

@ -328,6 +328,8 @@ g_application_impl_actions_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_value (invocation, g_dbus_method_invocation_return_value (invocation,
g_variant_builder_end (&builder)); g_variant_builder_end (&builder));
g_strfreev (actions);
} }
else if (strcmp (method_name, "SetState") == 0) else if (strcmp (method_name, "SetState") == 0)
@ -666,7 +668,7 @@ g_application_impl_register (GApplication *application,
g_free (impl->object_path); g_free (impl->object_path);
g_slice_free (GApplicationImpl, impl); g_slice_free (GApplicationImpl, impl);
impl = NULL; return NULL;
} }
} }

View File

@ -59,8 +59,8 @@ struct _GAsyncResultIface
/* Virtual Table */ /* Virtual Table */
gpointer (* get_user_data) (GAsyncResult *async_result); gpointer (* get_user_data) (GAsyncResult *res);
GObject * (* get_source_object) (GAsyncResult *async_result); GObject * (* get_source_object) (GAsyncResult *res);
}; };
GType g_async_result_get_type (void) G_GNUC_CONST; GType g_async_result_get_type (void) G_GNUC_CONST;

View File

@ -360,7 +360,7 @@ g_buffered_input_stream_new_sized (GInputStream *base_stream,
* g_buffered_input_stream_fill: * g_buffered_input_stream_fill:
* @stream: a #GBufferedInputStream * @stream: a #GBufferedInputStream
* @count: the number of bytes that will be read from the stream * @count: the number of bytes that will be read from the stream
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Tries to read @count bytes from the stream into the buffer. * Tries to read @count bytes from the stream into the buffer.
@ -447,9 +447,9 @@ async_fill_callback_wrapper (GObject *source_object,
* @count: the number of bytes that will be read from the stream * @count: the number of bytes that will be read from the stream
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request * of the request
* @cancellable: optional #GCancellable object * @cancellable: (allow-none): optional #GCancellable object
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: a #gpointer * @user_data: (closure): a #gpointer
* *
* Reads data into @stream's buffer asynchronously, up to @count size. * Reads data into @stream's buffer asynchronously, up to @count size.
* @io_priority can be used to prioritize reads. For the synchronous * @io_priority can be used to prioritize reads. For the synchronous
@ -602,13 +602,14 @@ g_buffered_input_stream_peek (GBufferedInputStream *stream,
/** /**
* g_buffered_input_stream_peek_buffer: * g_buffered_input_stream_peek_buffer:
* @stream: a #GBufferedInputStream * @stream: a #GBufferedInputStream
* @count: a #gsize to get the number of bytes available in the buffer * @count: (out): a #gsize to get the number of bytes available in the buffer
* *
* Returns the buffer with the currently available bytes. The returned * Returns the buffer with the currently available bytes. The returned
* buffer must not be modified and will become invalid when reading from * buffer must not be modified and will become invalid when reading from
* the stream or filling the buffer. * the stream or filling the buffer.
* *
* Returns: read-only buffer * Returns: (array length=count) (element-type guint8) (transfer none):
* read-only buffer
*/ */
const void* const void*
g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream, g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream,
@ -839,7 +840,7 @@ g_buffered_input_stream_read (GInputStream *stream,
/** /**
* g_buffered_input_stream_read_byte: * g_buffered_input_stream_read_byte:
* @stream: a #GBufferedInputStream * @stream: a #GBufferedInputStream
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Tries to read a single byte from the stream or the buffer. Will block * Tries to read a single byte from the stream or the buffer. Will block

View File

@ -288,7 +288,7 @@ g_cancellable_new (void)
* @cancellable: a #GCancellable object * @cancellable: a #GCancellable object
* *
* Pushes @cancellable onto the cancellable stack. The current * Pushes @cancellable onto the cancellable stack. The current
* cancllable can then be recieved using g_cancellable_get_current(). * cancellable can then be recieved using g_cancellable_get_current().
* *
* This is useful when implementing cancellable operations in * This is useful when implementing cancellable operations in
* code that does not allow you to pass down the cancellable object. * code that does not allow you to pass down the cancellable object.
@ -852,7 +852,7 @@ static GSourceFuncs cancellable_source_funcs =
}; };
/** /**
* g_cancellable_source_new: * g_cancellable_source_new: (skip)
* @cancellable: a #GCancellable, or %NULL * @cancellable: a #GCancellable, or %NULL
* *
* Creates a source that triggers if @cancellable is cancelled and * Creates a source that triggers if @cancellable is cancelled and
@ -863,7 +863,7 @@ static GSourceFuncs cancellable_source_funcs =
* For convenience, you can call this with a %NULL #GCancellable, * For convenience, you can call this with a %NULL #GCancellable,
* in which case the source will never trigger. * in which case the source will never trigger.
* *
* Return value: the new #GSource. * Return value: (transfer full): the new #GSource.
* *
* Since: 2.28 * Since: 2.28
*/ */

View File

@ -1651,8 +1651,8 @@ match_match (TreeMatch *match,
* This function is useful in the implementation of * This function is useful in the implementation of
* g_mount_guess_content_type(). * g_mount_guess_content_type().
* *
* Returns: (transfer full): an %NULL-terminated array of zero or more content types, * Returns: (transfer full) (array zero-terminated=1): an %NULL-terminated
* or %NULL. Free with g_strfreev() * array of zero or more content types, or %NULL. Free with g_strfreev()
* *
* Since: 2.18 * Since: 2.18
*/ */

View File

@ -54,13 +54,14 @@ g_converter_default_init (GConverterInterface *iface)
/** /**
* g_converter_convert: * g_converter_convert:
* @converter: a #GConverter. * @converter: a #GConverter.
* @inbuf: the buffer containing the data to convert. * @inbuf: (array length=inbuf_size) (element-type guint8): the buffer
* containing the data to convert.
* @inbuf_size: the number of bytes in @inbuf * @inbuf_size: the number of bytes in @inbuf
* @outbuf: a buffer to write converted data in. * @outbuf: a buffer to write converted data in.
* @outbuf_size: the number of bytes in @outbuf, must be at least one * @outbuf_size: the number of bytes in @outbuf, must be at least one
* @flags: a #GConvertFlags controlling the conversion details * @flags: a #GConvertFlags controlling the conversion details
* @bytes_read: will be set to the number of bytes read from @inbuf on success * @bytes_read: (out): will be set to the number of bytes read from @inbuf on success
* @bytes_written: will be set to the number of bytes written to @outbuf on success * @bytes_written: (out): will be set to the number of bytes written to @outbuf on success
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* This is the main operation used when converting data. It is to be called * This is the main operation used when converting data. It is to be called

View File

@ -325,7 +325,7 @@ read_data (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_byte: * g_data_input_stream_read_byte:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads an unsigned 8-bit/1-byte value from @stream. * Reads an unsigned 8-bit/1-byte value from @stream.
@ -352,7 +352,7 @@ g_data_input_stream_read_byte (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_int16: * g_data_input_stream_read_int16:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads a 16-bit/2-byte value from @stream. * Reads a 16-bit/2-byte value from @stream.
@ -396,7 +396,7 @@ g_data_input_stream_read_int16 (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_uint16: * g_data_input_stream_read_uint16:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads an unsigned 16-bit/2-byte value from @stream. * Reads an unsigned 16-bit/2-byte value from @stream.
@ -440,7 +440,7 @@ g_data_input_stream_read_uint16 (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_int32: * g_data_input_stream_read_int32:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads a signed 32-bit/4-byte value from @stream. * Reads a signed 32-bit/4-byte value from @stream.
@ -488,7 +488,7 @@ g_data_input_stream_read_int32 (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_uint32: * g_data_input_stream_read_uint32:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads an unsigned 32-bit/4-byte value from @stream. * Reads an unsigned 32-bit/4-byte value from @stream.
@ -536,7 +536,7 @@ g_data_input_stream_read_uint32 (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_int64: * g_data_input_stream_read_int64:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads a 64-bit/8-byte value from @stream. * Reads a 64-bit/8-byte value from @stream.
@ -584,7 +584,7 @@ g_data_input_stream_read_int64 (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_uint64: * g_data_input_stream_read_uint64:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads an unsigned 64-bit/8-byte value from @stream. * Reads an unsigned 64-bit/8-byte value from @stream.
@ -730,8 +730,8 @@ scan_for_newline (GDataInputStream *stream,
/** /**
* g_data_input_stream_read_line: * g_data_input_stream_read_line:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @length: a #gsize to get the length of the data read in. * @length: (out): a #gsize to get the length of the data read in.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads a line from the data input stream. * Reads a line from the data input stream.
@ -740,10 +740,11 @@ scan_for_newline (GDataInputStream *stream,
* triggering the cancellable object from another thread. If the operation * triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* *
* Returns: a string with the line that was read in (without the newlines). * Returns: (transfer full): a string with the line that was read in
* Set @length to a #gsize to get the length of the read line. * (without the newlines). Set @length to a #gsize to get the
* On an error, it will return %NULL and @error will be set. If there's no * length of the read line. On an error, it will return %NULL and
* content to read, it will still return %NULL, but @error won't be set. * @error will be set. If there's no content to read, it will
* still return %NULL, but @error won't be set.
**/ **/
char * char *
g_data_input_stream_read_line (GDataInputStream *stream, g_data_input_stream_read_line (GDataInputStream *stream,
@ -852,8 +853,8 @@ scan_for_chars (GDataInputStream *stream,
* g_data_input_stream_read_until: * g_data_input_stream_read_until:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @stop_chars: characters to terminate the read. * @stop_chars: characters to terminate the read.
* @length: a #gsize to get the length of the data read in. * @length: (out): a #gsize to get the length of the data read in.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Reads a string from the data input stream, up to the first * Reads a string from the data input stream, up to the first
@ -868,9 +869,10 @@ scan_for_chars (GDataInputStream *stream,
* g_data_input_stream_read_upto() instead, but note that that function * g_data_input_stream_read_upto() instead, but note that that function
* does not consume the stop character. * does not consume the stop character.
* *
* Returns: a string with the data that was read before encountering * Returns: (transfer full): a string with the data that was read
* any of the stop characters. Set @length to a #gsize to get the length * before encountering any of the stop characters. Set @length to
* of the string. This function will return %NULL on an error. * a #gsize to get the length of the string. This function will
* return %NULL on an error.
*/ */
char * char *
g_data_input_stream_read_until (GDataInputStream *stream, g_data_input_stream_read_until (GDataInputStream *stream,
@ -1099,9 +1101,9 @@ g_data_input_stream_read_finish (GDataInputStream *stream,
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied. * @callback: (scope async): callback to call when the request is satisfied.
* @user_data: the data to pass to callback function. * @user_data: (closure): the data to pass to callback function.
* *
* The asynchronous version of g_data_input_stream_read_line(). It is * The asynchronous version of g_data_input_stream_read_line(). It is
* an error to have two outstanding calls to this function. * an error to have two outstanding calls to this function.
@ -1133,9 +1135,9 @@ g_data_input_stream_read_line_async (GDataInputStream *stream,
* @stop_chars: characters to terminate the read. * @stop_chars: characters to terminate the read.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied. * @callback: (scope async): callback to call when the request is satisfied.
* @user_data: the data to pass to callback function. * @user_data: (closure): the data to pass to callback function.
* *
* The asynchronous version of g_data_input_stream_read_until(). * The asynchronous version of g_data_input_stream_read_until().
* It is an error to have two outstanding calls to this function. * It is an error to have two outstanding calls to this function.
@ -1176,16 +1178,17 @@ g_data_input_stream_read_until_async (GDataInputStream *stream,
* g_data_input_stream_read_line_finish: * g_data_input_stream_read_line_finish:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @result: the #GAsyncResult that was provided to the callback. * @result: the #GAsyncResult that was provided to the callback.
* @length: a #gsize to get the length of the data read in. * @length: (out): a #gsize to get the length of the data read in.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Finish an asynchronous call started by * Finish an asynchronous call started by
* g_data_input_stream_read_line_async(). * g_data_input_stream_read_line_async().
* *
* Returns: a string with the line that was read in (without the newlines). * Returns: (transfer full): a string with the line that was read in
* Set @length to a #gsize to get the length of the read line. * (without the newlines). Set @length to a #gsize to get the
* On an error, it will return %NULL and @error will be set. If there's no * length of the read line. On an error, it will return %NULL and
* content to read, it will still return %NULL, but @error won't be set. * @error will be set. If there's no content to read, it will
* still return %NULL, but @error won't be set.
* *
* Since: 2.20 * Since: 2.20
*/ */
@ -1206,7 +1209,7 @@ g_data_input_stream_read_line_finish (GDataInputStream *stream,
* g_data_input_stream_read_until_finish: * g_data_input_stream_read_until_finish:
* @stream: a given #GDataInputStream. * @stream: a given #GDataInputStream.
* @result: the #GAsyncResult that was provided to the callback. * @result: the #GAsyncResult that was provided to the callback.
* @length: a #gsize to get the length of the data read in. * @length: (out): a #gsize to get the length of the data read in.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Finish an asynchronous call started by * Finish an asynchronous call started by
@ -1214,9 +1217,10 @@ g_data_input_stream_read_line_finish (GDataInputStream *stream,
* *
* Since: 2.20 * Since: 2.20
* *
* Returns: a string with the data that was read before encountering * Returns: (transfer full): a string with the data that was read
* any of the stop characters. Set @length to a #gsize to get the length * before encountering any of the stop characters. Set @length to
* of the string. This function will return %NULL on an error. * a #gsize to get the length of the string. This function will
* return %NULL on an error.
*/ */
gchar * gchar *
g_data_input_stream_read_until_finish (GDataInputStream *stream, g_data_input_stream_read_until_finish (GDataInputStream *stream,
@ -1237,8 +1241,8 @@ g_data_input_stream_read_until_finish (GDataInputStream *stream,
* @stop_chars: characters to terminate the read * @stop_chars: characters to terminate the read
* @stop_chars_len: length of @stop_chars. May be -1 if @stop_chars is * @stop_chars_len: length of @stop_chars. May be -1 if @stop_chars is
* nul-terminated * nul-terminated
* @length: a #gsize to get the length of the data read in * @length: (out): a #gsize to get the length of the data read in
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: #GError for error reporting * @error: #GError for error reporting
* *
* Reads a string from the data input stream, up to the first * Reads a string from the data input stream, up to the first
@ -1252,9 +1256,10 @@ g_data_input_stream_read_until_finish (GDataInputStream *stream,
* Note that @stop_chars may contain '\0' if @stop_chars_len is * Note that @stop_chars may contain '\0' if @stop_chars_len is
* specified. * specified.
* *
* Returns: a string with the data that was read before encountering * Returns: (transfer full): a string with the data that was read
* any of the stop characters. Set @length to a #gsize to get the length * before encountering any of the stop characters. Set @length to
* of the string. This function will return %NULL on an error * a #gsize to get the length of the string. This function will
* return %NULL on an error
* *
* Since: 2.24 * Since: 2.24
*/ */
@ -1330,9 +1335,9 @@ g_data_input_stream_read_upto (GDataInputStream *stream,
* nul-terminated * nul-terminated
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @callback: callback to call when the request is satisfied * @callback: (scope async): callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* The asynchronous version of g_data_input_stream_read_upto(). * The asynchronous version of g_data_input_stream_read_upto().
* It is an error to have two outstanding calls to this function. * It is an error to have two outstanding calls to this function.
@ -1373,7 +1378,7 @@ g_data_input_stream_read_upto_async (GDataInputStream *stream,
* g_data_input_stream_read_upto_finish: * g_data_input_stream_read_upto_finish:
* @stream: a #GDataInputStream * @stream: a #GDataInputStream
* @result: the #GAsyncResult that was provided to the callback * @result: the #GAsyncResult that was provided to the callback
* @length: a #gsize to get the length of the data read in * @length: (out): a #gsize to get the length of the data read in
* @error: #GError for error reporting * @error: #GError for error reporting
* *
* Finish an asynchronous call started by * Finish an asynchronous call started by
@ -1383,9 +1388,10 @@ g_data_input_stream_read_upto_async (GDataInputStream *stream,
* stop character. You have to use g_data_input_stream_read_byte() to * 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. * get it before calling g_data_input_stream_read_upto_async() again.
* *
* Returns: a string with the data that was read before encountering * Returns: (transfer full): a string with the data that was read
* any of the stop characters. Set @length to a #gsize to get the length * before encountering any of the stop characters. Set @length to
* of the string. This function will return %NULL on an error. * a #gsize to get the length of the string. This function will
* return %NULL on an error.
* *
* Since: 2.24 * Since: 2.24
*/ */

View File

@ -210,7 +210,7 @@ g_data_output_stream_get_byte_order (GDataOutputStream *stream)
* g_data_output_stream_put_byte: * g_data_output_stream_put_byte:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @data: a #guchar. * @data: a #guchar.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts a byte into the output stream. * Puts a byte into the output stream.
@ -237,7 +237,7 @@ g_data_output_stream_put_byte (GDataOutputStream *stream,
* g_data_output_stream_put_int16: * g_data_output_stream_put_int16:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @data: a #gint16. * @data: a #gint16.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts a signed 16-bit integer into the output stream. * Puts a signed 16-bit integer into the output stream.
@ -277,7 +277,7 @@ g_data_output_stream_put_int16 (GDataOutputStream *stream,
* g_data_output_stream_put_uint16: * g_data_output_stream_put_uint16:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @data: a #guint16. * @data: a #guint16.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts an unsigned 16-bit integer into the output stream. * Puts an unsigned 16-bit integer into the output stream.
@ -317,7 +317,7 @@ g_data_output_stream_put_uint16 (GDataOutputStream *stream,
* g_data_output_stream_put_int32: * g_data_output_stream_put_int32:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @data: a #gint32. * @data: a #gint32.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts a signed 32-bit integer into the output stream. * Puts a signed 32-bit integer into the output stream.
@ -357,7 +357,7 @@ g_data_output_stream_put_int32 (GDataOutputStream *stream,
* g_data_output_stream_put_uint32: * g_data_output_stream_put_uint32:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @data: a #guint32. * @data: a #guint32.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts an unsigned 32-bit integer into the stream. * Puts an unsigned 32-bit integer into the stream.
@ -397,7 +397,7 @@ g_data_output_stream_put_uint32 (GDataOutputStream *stream,
* g_data_output_stream_put_int64: * g_data_output_stream_put_int64:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @data: a #gint64. * @data: a #gint64.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts a signed 64-bit integer into the stream. * Puts a signed 64-bit integer into the stream.
@ -437,7 +437,7 @@ g_data_output_stream_put_int64 (GDataOutputStream *stream,
* g_data_output_stream_put_uint64: * g_data_output_stream_put_uint64:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @data: a #guint64. * @data: a #guint64.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts an unsigned 64-bit integer into the stream. * Puts an unsigned 64-bit integer into the stream.
@ -477,7 +477,7 @@ g_data_output_stream_put_uint64 (GDataOutputStream *stream,
* g_data_output_stream_put_string: * g_data_output_stream_put_string:
* @stream: a #GDataOutputStream. * @stream: a #GDataOutputStream.
* @str: a string. * @str: a string.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Puts a string into the output stream. * Puts a string into the output stream.

View File

@ -1452,6 +1452,7 @@ g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
if (out_serial != NULL) if (out_serial != NULL)
*out_serial = serial_to_use; *out_serial = serial_to_use;
if (!(flags & G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL))
g_dbus_message_set_serial (message, serial_to_use); g_dbus_message_set_serial (message, serial_to_use);
g_dbus_message_lock (message); g_dbus_message_lock (message);

View File

@ -430,6 +430,7 @@ struct GDBusWorker
gint num_writes_pending; gint num_writes_pending;
guint64 write_num_messages_written; guint64 write_num_messages_written;
GList *write_pending_flushes; GList *write_pending_flushes;
gboolean flush_pending;
}; };
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -1155,6 +1156,12 @@ ostream_flush_cb (GObject *source_object,
if (error != NULL) if (error != NULL)
g_error_free (error); g_error_free (error);
/* Make sure we tell folks that we don't have additional
flushes pending */
g_mutex_lock (data->worker->write_lock);
data->worker->flush_pending = FALSE;
g_mutex_unlock (data->worker->write_lock);
/* OK, cool, finally kick off the next write */ /* OK, cool, finally kick off the next write */
maybe_write_next_message (data->worker); maybe_write_next_message (data->worker);
@ -1207,6 +1214,10 @@ message_written (GDBusWorker *worker,
worker->write_pending_flushes = g_list_delete_link (worker->write_pending_flushes, l); worker->write_pending_flushes = g_list_delete_link (worker->write_pending_flushes, l);
} }
} }
if (flushers != NULL)
{
worker->flush_pending = TRUE;
}
g_mutex_unlock (worker->write_lock); g_mutex_unlock (worker->write_lock);
if (flushers != NULL) if (flushers != NULL)
@ -1341,7 +1352,7 @@ static gboolean
write_message_in_idle_cb (gpointer user_data) write_message_in_idle_cb (gpointer user_data)
{ {
GDBusWorker *worker = user_data; GDBusWorker *worker = user_data;
if (worker->num_writes_pending == 0) if (worker->num_writes_pending == 0 && !worker->flush_pending)
maybe_write_next_message (worker); maybe_write_next_message (worker);
return FALSE; return FALSE;
} }
@ -1424,6 +1435,7 @@ _g_dbus_worker_new (GIOStream *stream,
worker->stream = g_object_ref (stream); worker->stream = g_object_ref (stream);
worker->capabilities = capabilities; worker->capabilities = capabilities;
worker->cancellable = g_cancellable_new (); worker->cancellable = g_cancellable_new ();
worker->flush_pending = FALSE;
worker->frozen = initially_frozen; worker->frozen = initially_frozen;
worker->received_messages_while_frozen = g_queue_new (); worker->received_messages_while_frozen = g_queue_new ();

View File

@ -69,7 +69,8 @@
static void g_desktop_app_info_iface_init (GAppInfoIface *iface); static void g_desktop_app_info_iface_init (GAppInfoIface *iface);
static GList * get_all_desktop_entries_for_mime_type (const char *base_mime_type, static GList * get_all_desktop_entries_for_mime_type (const char *base_mime_type,
const char **except, const char **except,
gboolean include_fallback); gboolean include_fallback,
char **explicit_default);
static void mime_info_cache_reload (const char *dir); static void mime_info_cache_reload (const char *dir);
static gboolean g_desktop_app_info_ensure_saved (GDesktopAppInfo *info, static gboolean g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
GError **error); GError **error);
@ -107,6 +108,14 @@ struct _GDesktopAppInfo
/* FIXME: what about StartupWMClass ? */ /* FIXME: what about StartupWMClass ? */
}; };
typedef enum {
UPDATE_MIME_NONE = 1 << 0,
UPDATE_MIME_SET_DEFAULT = 1 << 1,
UPDATE_MIME_SET_NON_DEFAULT = 1 << 2,
UPDATE_MIME_REMOVE = 1 << 3,
UPDATE_MIME_SET_LAST_USED = 1 << 4,
} UpdateMimeFlags;
G_DEFINE_TYPE_WITH_CODE (GDesktopAppInfo, g_desktop_app_info, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GDesktopAppInfo, g_desktop_app_info, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO, G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO,
g_desktop_app_info_iface_init)) g_desktop_app_info_iface_init))
@ -871,18 +880,17 @@ prepend_terminal_to_vector (int *argc,
} }
static GList * static GList *
uri_list_segment_to_files (GList *start, create_files_for_uris (GList *uris)
GList *end)
{ {
GList *res; GList *res;
GFile *file; GList *iter;
res = NULL; res = NULL;
while (start != NULL && start != end)
for (iter = uris; iter; iter = iter->next)
{ {
file = g_file_new_for_uri ((char *)start->data); GFile *file = g_file_new_for_uri ((char *)iter->data);
res = g_list_prepend (res, file); res = g_list_prepend (res, file);
start = start->next;
} }
return g_list_reverse (res); return g_list_reverse (res);
@ -890,6 +898,8 @@ uri_list_segment_to_files (GList *start,
typedef struct typedef struct
{ {
GSpawnChildSetupFunc user_setup;
gpointer user_setup_data;
char *display; char *display;
char *sn_id; char *sn_id;
char *desktop_file; char *desktop_file;
@ -915,18 +925,79 @@ child_setup (gpointer user_data)
g_snprintf (pid, 20, "%ld", (long)getpid ()); g_snprintf (pid, 20, "%ld", (long)getpid ());
g_setenv ("GIO_LAUNCHED_DESKTOP_FILE_PID", pid, TRUE); g_setenv ("GIO_LAUNCHED_DESKTOP_FILE_PID", pid, TRUE);
} }
if (data->user_setup)
data->user_setup (data->user_setup_data);
} }
static void
notify_desktop_launch (GDBusConnection *session_bus,
GDesktopAppInfo *info,
long pid,
const char *display,
const char *sn_id,
GList *uris)
{
GDBusMessage *msg;
GVariantBuilder uri_variant;
GVariantBuilder extras_variant;
GList *iter;
const char *desktop_file_id;
if (session_bus == NULL)
return;
g_variant_builder_init (&uri_variant, G_VARIANT_TYPE ("as"));
for (iter = uris; iter; iter = iter->next)
g_variant_builder_add (&uri_variant, "s", iter->data);
g_variant_builder_init (&extras_variant, G_VARIANT_TYPE ("a{sv}"));
if (sn_id != NULL && g_utf8_validate (sn_id, -1, NULL))
g_variant_builder_add (&extras_variant, "{sv}",
"startup-id",
g_variant_new ("s",
sn_id));
if (info->filename)
desktop_file_id = info->filename;
else if (info->desktop_id)
desktop_file_id = info->desktop_id;
else
desktop_file_id = "";
msg = g_dbus_message_new_signal ("/org/gtk/gio/DesktopAppInfo",
"org.gtk.gio.DesktopAppInfo",
"Launched");
g_dbus_message_set_body (msg, g_variant_new ("(@aysxasa{sv})",
g_variant_new_bytestring (desktop_file_id),
display ? display : "",
(gint64)pid,
&uri_variant,
&extras_variant));
g_dbus_connection_send_message (session_bus,
msg, 0,
NULL,
NULL);
g_object_unref (msg);
}
#define _SPAWN_FLAGS_DEFAULT (G_SPAWN_SEARCH_PATH)
static gboolean static gboolean
g_desktop_app_info_launch_uris (GAppInfo *appinfo, _g_desktop_app_info_launch_uris_internal (GAppInfo *appinfo,
GList *uris, GList *uris,
GAppLaunchContext *launch_context, GAppLaunchContext *launch_context,
GSpawnFlags spawn_flags,
GSpawnChildSetupFunc user_setup,
gpointer user_setup_data,
GDesktopAppLaunchCallback pid_callback,
gpointer pid_callback_data,
GError **error) GError **error)
{ {
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo); GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
GDBusConnection *session_bus;
gboolean completed = FALSE; gboolean completed = FALSE;
GList *old_uris; GList *old_uris;
GList *launched_files;
char **argv; char **argv;
int argc; int argc;
ChildSetupData data; ChildSetupData data;
@ -935,13 +1006,25 @@ g_desktop_app_info_launch_uris (GAppInfo *appinfo,
argv = NULL; argv = NULL;
session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
do do
{ {
GPid pid;
GList *launched_uris;
GList *iter;
old_uris = uris; old_uris = uris;
if (!expand_application_parameters (info, &uris, if (!expand_application_parameters (info, &uris,
&argc, &argv, error)) &argc, &argv, error))
goto out; goto out;
/* Get the subset of URIs we're launching with this process */
launched_uris = NULL;
for (iter = old_uris; iter != NULL && iter != uris; iter = iter->next)
launched_uris = g_list_prepend (launched_uris, iter->data);
launched_uris = g_list_reverse (launched_uris);
if (info->terminal && !prepend_terminal_to_vector (&argc, &argv)) if (info->terminal && !prepend_terminal_to_vector (&argc, &argv))
{ {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@ -949,13 +1032,15 @@ g_desktop_app_info_launch_uris (GAppInfo *appinfo,
goto out; goto out;
} }
data.user_setup = user_setup;
data.user_setup_data = user_setup_data;
data.display = NULL; data.display = NULL;
data.sn_id = NULL; data.sn_id = NULL;
data.desktop_file = info->filename; data.desktop_file = info->filename;
if (launch_context) if (launch_context)
{ {
launched_files = uri_list_segment_to_files (old_uris, uris); GList *launched_files = create_files_for_uris (launched_uris);
data.display = g_app_launch_context_get_display (launch_context, data.display = g_app_launch_context_get_display (launch_context,
appinfo, appinfo,
@ -972,10 +1057,10 @@ g_desktop_app_info_launch_uris (GAppInfo *appinfo,
if (!g_spawn_async (info->path, if (!g_spawn_async (info->path,
argv, argv,
NULL, NULL,
G_SPAWN_SEARCH_PATH, spawn_flags,
child_setup, child_setup,
&data, &data,
NULL, &pid,
error)) error))
{ {
if (data.sn_id) if (data.sn_id)
@ -983,18 +1068,36 @@ g_desktop_app_info_launch_uris (GAppInfo *appinfo,
g_free (data.sn_id); g_free (data.sn_id);
g_free (data.display); g_free (data.display);
g_list_free (launched_uris);
goto out; goto out;
} }
if (pid_callback != NULL)
pid_callback (info, pid, pid_callback_data);
notify_desktop_launch (session_bus,
info,
pid,
data.display,
data.sn_id,
launched_uris);
g_free (data.sn_id); g_free (data.sn_id);
g_free (data.display); g_free (data.display);
g_list_free (launched_uris);
g_strfreev (argv); g_strfreev (argv);
argv = NULL; argv = NULL;
} }
while (uris != NULL); while (uris != NULL);
/* TODO - need to handle the process exiting immediately
* after launching an app. See http://bugzilla.gnome.org/606960
*/
if (session_bus != NULL)
g_object_unref (session_bus);
completed = TRUE; completed = TRUE;
out: out:
@ -1003,6 +1106,19 @@ g_desktop_app_info_launch_uris (GAppInfo *appinfo,
return completed; return completed;
} }
static gboolean
g_desktop_app_info_launch_uris (GAppInfo *appinfo,
GList *uris,
GAppLaunchContext *launch_context,
GError **error)
{
return _g_desktop_app_info_launch_uris_internal (appinfo, uris,
launch_context,
_SPAWN_FLAGS_DEFAULT,
NULL, NULL, NULL, NULL,
error);
}
static gboolean static gboolean
g_desktop_app_info_supports_uris (GAppInfo *appinfo) g_desktop_app_info_supports_uris (GAppInfo *appinfo)
{ {
@ -1051,6 +1167,56 @@ g_desktop_app_info_launch (GAppInfo *appinfo,
return res; return res;
} }
/**
* g_desktop_app_info_launch_uris_as_manager:
* @appinfo: a #GDesktopAppInfo
* @uris: (element-type utf8): List of URIs
* @launch_context: a #GAppLaunchContext
* @spawn_flags: #GSpawnFlags, used for each process
* @user_setup: (scope call): a #GSpawnChildSetupFunc, used once for
* each process.
* @user_setup_data: (closure user_setup): User data for @user_setup
* @pid_callback: (scope call): Callback for child processes
* @pid_callback_data: (closure pid_callback): User data for @callback
* @error: a #GError
*
* This function performs the equivalent of g_app_info_launch_uris(),
* but is intended primarily for operating system components that
* launch applications. Ordinary applications should use
* g_app_info_launch_uris().
*
* In contrast to g_app_info_launch_uris(), all processes created will
* always be run directly as children as if by the UNIX fork()/exec()
* calls.
*
* This guarantee allows additional control over the exact environment
* of the child processes, which is provided via a setup function
* @setup, as well as the process identifier of each child process via
* @pid_callback. See g_spawn_async() for more information about the
* semantics of the @setup function.
*/
gboolean
g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
GList *uris,
GAppLaunchContext *launch_context,
GSpawnFlags spawn_flags,
GSpawnChildSetupFunc user_setup,
gpointer user_setup_data,
GDesktopAppLaunchCallback pid_callback,
gpointer pid_callback_data,
GError **error)
{
return _g_desktop_app_info_launch_uris_internal ((GAppInfo*)appinfo,
uris,
launch_context,
spawn_flags,
user_setup,
user_setup_data,
pid_callback,
pid_callback_data,
error);
}
G_LOCK_DEFINE_STATIC (g_desktop_env); G_LOCK_DEFINE_STATIC (g_desktop_env);
static gchar *g_desktop_env = NULL; static gchar *g_desktop_env = NULL;
@ -1170,23 +1336,22 @@ ensure_dir (DirType type,
static gboolean static gboolean
update_mimeapps_list (const char *desktop_id, update_mimeapps_list (const char *desktop_id,
const char *content_type, const char *content_type,
gboolean add_as_default, UpdateMimeFlags flags,
gboolean add_non_default,
gboolean remove,
GError **error) GError **error)
{ {
char *dirname, *filename; char *dirname, *filename, *string;
GKeyFile *key_file; GKeyFile *key_file;
gboolean load_succeeded, res; gboolean load_succeeded, res, explicit_default;
char **old_list, **list; char **old_list, **list;
GList *system_list, *l; GList *system_list;
gsize length, data_size; gsize length, data_size;
char *data; char *data;
int i, j, k; int i, j, k;
char **content_types; char **content_types;
/* Don't add both at start and end */ /* Don't add both at start and end */
g_assert (!(add_as_default && add_non_default)); g_assert (!((flags & UPDATE_MIME_SET_DEFAULT) &&
(flags & UPDATE_MIME_SET_NON_DEFAULT)));
dirname = ensure_dir (APP_DIR, error); dirname = ensure_dir (APP_DIR, error);
if (!dirname) if (!dirname)
@ -1211,6 +1376,54 @@ update_mimeapps_list (const char *desktop_id,
} }
else else
{ {
content_types = g_key_file_get_keys (key_file, DEFAULT_APPLICATIONS_GROUP, NULL, NULL);
}
explicit_default = FALSE;
for (k = 0; content_types && content_types[k]; k++)
{
/* set as default, if requested so */
string = g_key_file_get_string (key_file,
DEFAULT_APPLICATIONS_GROUP,
content_types[k],
NULL);
if (g_strcmp0 (string, desktop_id) != 0 &&
(flags & UPDATE_MIME_SET_DEFAULT))
{
g_free (string);
string = g_strdup (desktop_id);
/* add in the non-default list too, if it's not already there */
flags |= UPDATE_MIME_SET_NON_DEFAULT;
}
if (string == NULL || desktop_id == NULL)
g_key_file_remove_key (key_file,
DEFAULT_APPLICATIONS_GROUP,
content_types[k],
NULL);
else
{
g_key_file_set_string (key_file,
DEFAULT_APPLICATIONS_GROUP,
content_types[k],
string);
explicit_default = TRUE;
}
g_free (string);
}
if (content_type)
{
/* reuse the list from above */
}
else
{
g_strfreev (content_types);
content_types = g_key_file_get_keys (key_file, ADDED_ASSOCIATIONS_GROUP, NULL, NULL); content_types = g_key_file_get_keys (key_file, ADDED_ASSOCIATIONS_GROUP, NULL, NULL);
} }
@ -1225,47 +1438,40 @@ update_mimeapps_list (const char *desktop_id,
list = g_new (char *, 1 + length + 1); list = g_new (char *, 1 + length + 1);
i = 0; i = 0;
if (add_as_default)
/* if we're adding a last-used hint, just put the application in front of the list */
if (flags & UPDATE_MIME_SET_LAST_USED)
{
/* avoid adding this again as non-default later */
if (flags & UPDATE_MIME_SET_NON_DEFAULT)
flags ^= UPDATE_MIME_SET_NON_DEFAULT;
list[i++] = g_strdup (desktop_id); list[i++] = g_strdup (desktop_id);
}
if (old_list) if (old_list)
{ {
for (j = 0; old_list[j] != NULL; j++) for (j = 0; old_list[j] != NULL; j++)
{ {
if (g_strcmp0 (old_list[j], desktop_id) != 0) if (g_strcmp0 (old_list[j], desktop_id) != 0)
list[i++] = g_strdup (old_list[j]);
else if (add_non_default)
{ {
/* If adding as non-default, and it's already in, /* rewrite other entries if they're different from the new one */
don't change order of desktop ids */ list[i++] = g_strdup (old_list[j]);
add_non_default = FALSE; }
else if (flags & UPDATE_MIME_SET_NON_DEFAULT)
{
/* we encountered an old entry which is equal to the one we're adding as non-default,
* don't change its position in the list.
*/
flags ^= UPDATE_MIME_SET_NON_DEFAULT;
list[i++] = g_strdup (old_list[j]); list[i++] = g_strdup (old_list[j]);
} }
} }
} }
if (add_non_default) /* add it at the end of the list */
{ if (flags & UPDATE_MIME_SET_NON_DEFAULT)
/* We're adding as non-default, and it wasn't already in the list,
so we add at the end. But to avoid listing the app before the
current system default (thus changing the default) we have to
add the current list of (not yet listed) apps before it. */
list[i] = NULL; /* Terminate current list so we can use it */
system_list = get_all_desktop_entries_for_mime_type (content_type, (const char **)list, FALSE);
list = g_renew (char *, list, 1 + length + g_list_length (system_list) + 1);
for (l = system_list; l != NULL; l = l->next)
{
list[i++] = l->data; /* no strdup, taking ownership */
if (g_strcmp0 (l->data, desktop_id) == 0)
add_non_default = FALSE;
}
g_list_free (system_list);
if (add_non_default)
list[i++] = g_strdup (desktop_id); list[i++] = g_strdup (desktop_id);
}
list[i] = NULL; list[i] = NULL;
@ -1277,11 +1483,33 @@ update_mimeapps_list (const char *desktop_id,
content_types[k], content_types[k],
NULL); NULL);
else else
{
g_key_file_set_string_list (key_file, g_key_file_set_string_list (key_file,
ADDED_ASSOCIATIONS_GROUP, ADDED_ASSOCIATIONS_GROUP,
content_types[k], content_types[k],
(const char * const *)list, i); (const char * const *)list, i);
/* if we had no explicit default set, we should add the system default to the
* list, to avoid overriding it with applications from this list.
*/
if (!explicit_default)
{
system_list = get_all_desktop_entries_for_mime_type (content_type, (const char **) list, FALSE, NULL);
if (system_list != NULL)
{
string = system_list->data;
g_key_file_set_string (key_file,
DEFAULT_APPLICATIONS_GROUP,
content_types[k],
string);
}
g_list_free_full (system_list, g_free);
}
}
g_strfreev (list); g_strfreev (list);
} }
@ -1306,7 +1534,7 @@ update_mimeapps_list (const char *desktop_id,
list = g_new (char *, 1 + length + 1); list = g_new (char *, 1 + length + 1);
i = 0; i = 0;
if (remove) if (flags & UPDATE_MIME_REMOVE)
list[i++] = g_strdup (desktop_id); list[i++] = g_strdup (desktop_id);
if (old_list) if (old_list)
{ {
@ -1349,6 +1577,23 @@ update_mimeapps_list (const char *desktop_id,
return res; return res;
} }
static gboolean
g_desktop_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
if (!g_desktop_app_info_ensure_saved (info, error))
return FALSE;
/* both add support for the content type and set as last used */
return update_mimeapps_list (info->desktop_id, content_type,
UPDATE_MIME_SET_NON_DEFAULT |
UPDATE_MIME_SET_LAST_USED,
error);
}
static gboolean static gboolean
g_desktop_app_info_set_as_default_for_type (GAppInfo *appinfo, g_desktop_app_info_set_as_default_for_type (GAppInfo *appinfo,
const char *content_type, const char *content_type,
@ -1359,7 +1604,9 @@ g_desktop_app_info_set_as_default_for_type (GAppInfo *appinfo,
if (!g_desktop_app_info_ensure_saved (info, error)) if (!g_desktop_app_info_ensure_saved (info, error))
return FALSE; return FALSE;
return update_mimeapps_list (info->desktop_id, content_type, TRUE, FALSE, FALSE, error); return update_mimeapps_list (info->desktop_id, content_type,
UPDATE_MIME_SET_DEFAULT,
error);
} }
static void static void
@ -1476,7 +1723,9 @@ g_desktop_app_info_add_supports_type (GAppInfo *appinfo,
if (!g_desktop_app_info_ensure_saved (G_DESKTOP_APP_INFO (info), error)) if (!g_desktop_app_info_ensure_saved (G_DESKTOP_APP_INFO (info), error))
return FALSE; return FALSE;
return update_mimeapps_list (info->desktop_id, content_type, FALSE, TRUE, FALSE, error); return update_mimeapps_list (info->desktop_id, content_type,
UPDATE_MIME_SET_NON_DEFAULT,
error);
} }
static gboolean static gboolean
@ -1495,7 +1744,9 @@ g_desktop_app_info_remove_supports_type (GAppInfo *appinfo,
if (!g_desktop_app_info_ensure_saved (G_DESKTOP_APP_INFO (info), error)) if (!g_desktop_app_info_ensure_saved (G_DESKTOP_APP_INFO (info), error))
return FALSE; return FALSE;
return update_mimeapps_list (info->desktop_id, content_type, FALSE, FALSE, TRUE, error); return update_mimeapps_list (info->desktop_id, content_type,
UPDATE_MIME_REMOVE,
error);
} }
static gboolean static gboolean
@ -1616,7 +1867,9 @@ g_desktop_app_info_delete (GAppInfo *appinfo)
{ {
if (g_remove (info->filename) == 0) if (g_remove (info->filename) == 0)
{ {
update_mimeapps_list (info->desktop_id, NULL, FALSE, FALSE, FALSE, NULL); update_mimeapps_list (info->desktop_id, NULL,
UPDATE_MIME_NONE,
NULL);
g_free (info->filename); g_free (info->filename);
info->filename = NULL; info->filename = NULL;
@ -1709,6 +1962,7 @@ g_desktop_app_info_iface_init (GAppInfoIface *iface)
iface->do_delete = g_desktop_app_info_delete; iface->do_delete = g_desktop_app_info_delete;
iface->get_commandline = g_desktop_app_info_get_commandline; iface->get_commandline = g_desktop_app_info_get_commandline;
iface->get_display_name = g_desktop_app_info_get_display_name; iface->get_display_name = g_desktop_app_info_get_display_name;
iface->set_as_last_used_for_type = g_desktop_app_info_set_as_last_used_for_type;
} }
static gboolean static gboolean
@ -1731,6 +1985,9 @@ app_info_in_list (GAppInfo *info,
* Gets a list of recommended #GAppInfos for a given content type, i.e. * Gets a list of recommended #GAppInfos for a given content type, i.e.
* those applications which claim to support the given content type exactly, * those applications which claim to support the given content type exactly,
* and not by MIME type subclassing. * and not by MIME type subclassing.
* Note that the first application of the list is the last used one, i.e.
* the last one for which #g_app_info_set_as_last_used_for_type has been
* called.
* *
* Returns: (element-type GAppInfo) (transfer full): #GList of #GAppInfos * Returns: (element-type GAppInfo) (transfer full): #GList of #GAppInfos
* for given @content_type or %NULL on error. * for given @content_type or %NULL on error.
@ -1746,7 +2003,7 @@ g_app_info_get_recommended_for_type (const gchar *content_type)
g_return_val_if_fail (content_type != NULL, NULL); g_return_val_if_fail (content_type != NULL, NULL);
desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, FALSE); desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, FALSE, NULL);
infos = NULL; infos = NULL;
for (l = desktop_entries; l != NULL; l = l->next) for (l = desktop_entries; l != NULL; l = l->next)
@ -1791,7 +2048,7 @@ g_app_info_get_fallback_for_type (const gchar *content_type)
g_return_val_if_fail (content_type != NULL, NULL); g_return_val_if_fail (content_type != NULL, NULL);
desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE); desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE, NULL);
recommended_infos = g_app_info_get_recommended_for_type (content_type); recommended_infos = g_app_info_get_recommended_for_type (content_type);
infos = NULL; infos = NULL;
@ -1831,13 +2088,25 @@ g_app_info_get_all_for_type (const char *content_type)
{ {
GList *desktop_entries, *l; GList *desktop_entries, *l;
GList *infos; GList *infos;
char *user_default = NULL;
GDesktopAppInfo *info; GDesktopAppInfo *info;
g_return_val_if_fail (content_type != NULL, NULL); g_return_val_if_fail (content_type != NULL, NULL);
desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE); desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE, &user_default);
infos = NULL; infos = NULL;
/* put the user default in front of the list, for compatibility */
if (user_default != NULL)
{
info = g_desktop_app_info_new (user_default);
if (info != NULL)
infos = g_list_prepend (infos, info);
}
g_free (user_default);
for (l = desktop_entries; l != NULL; l = l->next) for (l = desktop_entries; l != NULL; l = l->next)
{ {
char *desktop_entry = l->data; char *desktop_entry = l->data;
@ -1872,7 +2141,9 @@ g_app_info_get_all_for_type (const char *content_type)
void void
g_app_info_reset_type_associations (const char *content_type) g_app_info_reset_type_associations (const char *content_type)
{ {
update_mimeapps_list (NULL, content_type, FALSE, FALSE, FALSE, NULL); update_mimeapps_list (NULL, content_type,
UPDATE_MIME_NONE,
NULL);
} }
/** /**
@ -1883,20 +2154,48 @@ g_app_info_reset_type_associations (const char *content_type)
* *
* Gets the #GAppInfo that corresponds to a given content type. * Gets the #GAppInfo that corresponds to a given content type.
* *
* Returns: #GAppInfo for given @content_type or %NULL on error. * Returns: (transfer full): #GAppInfo for given @content_type or
* %NULL on error.
**/ **/
GAppInfo * GAppInfo *
g_app_info_get_default_for_type (const char *content_type, g_app_info_get_default_for_type (const char *content_type,
gboolean must_support_uris) gboolean must_support_uris)
{ {
GList *desktop_entries, *l; GList *desktop_entries, *l;
char *user_default = NULL;
GAppInfo *info; GAppInfo *info;
g_return_val_if_fail (content_type != NULL, NULL); g_return_val_if_fail (content_type != NULL, NULL);
desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE); desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE, &user_default);
info = NULL; info = NULL;
if (user_default != NULL)
{
info = (GAppInfo *) g_desktop_app_info_new (user_default);
if (info)
{
if (must_support_uris && !g_app_info_supports_uris (info))
{
g_object_unref (info);
info = NULL;
}
}
}
g_free (user_default);
if (info != NULL)
{
g_list_free_full (desktop_entries, g_free);
return info;
}
/* pick the first from the other list that matches our URI
* requirements.
*/
for (l = desktop_entries; l != NULL; l = l->next) for (l = desktop_entries; l != NULL; l = l->next)
{ {
char *desktop_entry = l->data; char *desktop_entry = l->data;
@ -1914,8 +2213,7 @@ g_app_info_get_default_for_type (const char *content_type,
} }
} }
g_list_foreach (desktop_entries, (GFunc)g_free, NULL); g_list_free_full (desktop_entries, g_free);
g_list_free (desktop_entries);
return info; return info;
} }
@ -1929,7 +2227,7 @@ g_app_info_get_default_for_type (const char *content_type,
* of the URI, up to but not including the ':', e.g. "http", * of the URI, up to but not including the ':', e.g. "http",
* "ftp" or "sip". * "ftp" or "sip".
* *
* Returns: #GAppInfo for given @uri_scheme or %NULL on error. * Returns: (transfer full): #GAppInfo for given @uri_scheme or %NULL on error.
**/ **/
GAppInfo * GAppInfo *
g_app_info_get_default_for_uri_scheme (const char *uri_scheme) g_app_info_get_default_for_uri_scheme (const char *uri_scheme)
@ -2066,6 +2364,7 @@ typedef struct {
GHashTable *defaults_list_map; GHashTable *defaults_list_map;
GHashTable *mimeapps_list_added_map; GHashTable *mimeapps_list_added_map;
GHashTable *mimeapps_list_removed_map; GHashTable *mimeapps_list_removed_map;
GHashTable *mimeapps_list_defaults_map;
time_t mime_info_cache_timestamp; time_t mime_info_cache_timestamp;
time_t defaults_list_timestamp; time_t defaults_list_timestamp;
time_t mimeapps_list_timestamp; time_t mimeapps_list_timestamp;
@ -2318,6 +2617,7 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
gchar *filename, **mime_types; gchar *filename, **mime_types;
char *unaliased_type; char *unaliased_type;
char **desktop_file_ids; char **desktop_file_ids;
char *desktop_id;
int i; int i;
struct stat buf; struct stat buf;
@ -2339,6 +2639,11 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
dir->mimeapps_list_removed_map = g_hash_table_new_full (g_str_hash, g_str_equal, dir->mimeapps_list_removed_map = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify)g_strfreev); g_free, (GDestroyNotify)g_strfreev);
if (dir->mimeapps_list_defaults_map != NULL)
g_hash_table_destroy (dir->mimeapps_list_defaults_map);
dir->mimeapps_list_defaults_map = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
key_file = g_key_file_new (); key_file = g_key_file_new ();
filename = g_build_filename (dir->path, "mimeapps.list", NULL); filename = g_build_filename (dir->path, "mimeapps.list", NULL);
@ -2403,6 +2708,28 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
g_strfreev (mime_types); g_strfreev (mime_types);
} }
mime_types = g_key_file_get_keys (key_file, DEFAULT_APPLICATIONS_GROUP,
NULL, NULL);
if (mime_types != NULL)
{
for (i = 0; mime_types[i] != NULL; i++)
{
desktop_id = g_key_file_get_string (key_file,
DEFAULT_APPLICATIONS_GROUP,
mime_types[i],
NULL);
if (desktop_id == NULL)
continue;
unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
g_hash_table_replace (dir->mimeapps_list_defaults_map,
unaliased_type,
desktop_id);
}
g_strfreev (mime_types);
}
g_key_file_free (key_file); g_key_file_free (key_file);
return; return;
@ -2459,6 +2786,12 @@ mime_info_cache_dir_free (MimeInfoCacheDir *dir)
dir->mimeapps_list_removed_map = NULL; dir->mimeapps_list_removed_map = NULL;
} }
if (dir->mimeapps_list_defaults_map != NULL)
{
g_hash_table_destroy (dir->mimeapps_list_defaults_map);
dir->mimeapps_list_defaults_map = NULL;
}
g_free (dir); g_free (dir);
} }
@ -2637,11 +2970,13 @@ append_desktop_entry (GList *list,
static GList * static GList *
get_all_desktop_entries_for_mime_type (const char *base_mime_type, get_all_desktop_entries_for_mime_type (const char *base_mime_type,
const char **except, const char **except,
gboolean include_fallback) gboolean include_fallback,
char **explicit_default)
{ {
GList *desktop_entries, *removed_entries, *list, *dir_list, *tmp; GList *desktop_entries, *removed_entries, *list, *dir_list, *tmp;
MimeInfoCacheDir *dir; MimeInfoCacheDir *dir;
char *mime_type; char *mime_type, *default_entry = NULL;
const char *entry;
char **mime_types; char **mime_types;
char **default_entries; char **default_entries;
char **removed_associations; char **removed_associations;
@ -2696,14 +3031,24 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
{ {
mime_type = mime_types[i]; mime_type = mime_types[i];
/* Go through all apps listed as defaults */ /* Go through all apps listed in user and system dirs */
for (dir_list = mime_info_cache->dirs; for (dir_list = mime_info_cache->dirs;
dir_list != NULL; dir_list != NULL;
dir_list = dir_list->next) dir_list = dir_list->next)
{ {
dir = dir_list->data; dir = dir_list->data;
/* First added associations from mimeapps.list */ /* Pick the explicit default application */
entry = g_hash_table_lookup (dir->mimeapps_list_defaults_map, mime_type);
if (entry != NULL)
{
/* Save the default entry if it's the first one we encounter */
if (default_entry == NULL)
default_entry = g_strdup (entry);
}
/* Then added associations from mimeapps.list */
default_entries = g_hash_table_lookup (dir->mimeapps_list_added_map, mime_type); default_entries = g_hash_table_lookup (dir->mimeapps_list_added_map, mime_type);
for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++) for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries); desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);
@ -2736,6 +3081,11 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
g_strfreev (mime_types); g_strfreev (mime_types);
if (explicit_default != NULL)
*explicit_default = default_entry;
else
g_free (default_entry);
g_list_foreach (removed_entries, (GFunc)g_free, NULL); g_list_foreach (removed_entries, (GFunc)g_free, NULL);
g_list_free (removed_entries); g_list_free (removed_entries);

View File

@ -93,6 +93,30 @@ 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, GAppInfo *g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
const char *uri_scheme); const char *uri_scheme);
/**
* GDesktopAppLaunchCallback:
* @appinfo: a #GDesktopAppInfo
* @pid: Process identifier
* @user_data: User data
*
* During invocation, g_desktop_app_info_launch_uris_as_manager() may
* create one or more child processes. This callback is invoked once
* for each, providing the process ID.
*/
typedef void (*GDesktopAppLaunchCallback) (GDesktopAppInfo *appinfo,
GPid pid,
gpointer user_data);
gboolean g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
GList *uris,
GAppLaunchContext *launch_context,
GSpawnFlags spawn_flags,
GSpawnChildSetupFunc user_setup,
gpointer user_setup_data,
GDesktopAppLaunchCallback pid_callback,
gpointer pid_callback_data,
GError **error);
#endif /* G_DISABLE_DEPRECATED */ #endif /* G_DISABLE_DEPRECATED */
G_END_DECLS G_END_DECLS

View File

@ -331,8 +331,8 @@ g_drive_can_poll_for_media (GDrive *drive)
* g_drive_eject: * g_drive_eject:
* @drive: a #GDrive. * @drive: a #GDrive.
* @flags: flags affecting the unmount if required for eject * @flags: flags affecting the unmount if required for eject
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback, or %NULL. * @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data to pass to @callback * @user_data: user data to pass to @callback
* *
* Asynchronously ejects a drive. * Asynchronously ejects a drive.
@ -407,9 +407,10 @@ g_drive_eject_finish (GDrive *drive,
* g_drive_eject_with_operation: * g_drive_eject_with_operation:
* @drive: a #GDrive. * @drive: a #GDrive.
* @flags: flags affecting the unmount if required for eject * @flags: flags affecting the unmount if required for eject
* @mount_operation: a #GMountOperation or %NULL to avoid user interaction. * @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* @cancellable: optional #GCancellable object, %NULL to ignore. * user interaction.
* @callback: a #GAsyncReadyCallback, or %NULL. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Ejects a drive. This is an asynchronous operation, and is * Ejects a drive. This is an asynchronous operation, and is
@ -491,8 +492,8 @@ g_drive_eject_with_operation_finish (GDrive *drive,
/** /**
* g_drive_poll_for_media: * g_drive_poll_for_media:
* @drive: a #GDrive. * @drive: a #GDrive.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback, or %NULL. * @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data to pass to @callback * @user_data: user data to pass to @callback
* *
* Asynchronously polls @drive to see if media has been inserted or removed. * Asynchronously polls @drive to see if media has been inserted or removed.
@ -594,8 +595,9 @@ g_drive_get_identifier (GDrive *drive,
* Use g_drive_get_identifer() to obtain the identifiers * Use g_drive_get_identifer() to obtain the identifiers
* themselves. * themselves.
* *
* Returns: (transfer full): a %NULL-terminated array of strings containing * Returns: (transfer full) (array zero-terminated=1): a %NULL-terminated
* kinds of identifiers. Use g_strfreev() to free. * array of strings containing kinds of identifiers. Use g_strfreev()
* to free.
*/ */
char ** char **
g_drive_enumerate_identifiers (GDrive *drive) g_drive_enumerate_identifiers (GDrive *drive)
@ -691,9 +693,10 @@ g_drive_can_start_degraded (GDrive *drive)
* g_drive_start: * g_drive_start:
* @drive: a #GDrive. * @drive: a #GDrive.
* @flags: flags affecting the start operation. * @flags: flags affecting the start operation.
* @mount_operation: a #GMountOperation or %NULL to avoid user interaction. * @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* @cancellable: optional #GCancellable object, %NULL to ignore. * user interaction.
* @callback: a #GAsyncReadyCallback, or %NULL. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data to pass to @callback * @user_data: user data to pass to @callback
* *
* Asynchronously starts a drive. * Asynchronously starts a drive.
@ -793,9 +796,10 @@ g_drive_can_stop (GDrive *drive)
* g_drive_stop: * g_drive_stop:
* @drive: a #GDrive. * @drive: a #GDrive.
* @flags: flags affecting the unmount if required for stopping. * @flags: flags affecting the unmount if required for stopping.
* @mount_operation: a #GMountOperation or %NULL to avoid user interaction. * @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* @cancellable: optional #GCancellable object, %NULL to ignore. * user interaction.
* @callback: a #GAsyncReadyCallback, or %NULL. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data to pass to @callback * @user_data: user data to pass to @callback
* *
* Asynchronously stops a drive. * Asynchronously stops a drive.

View File

@ -92,10 +92,11 @@ enum
{ {
PROP_CERTIFICATE_0, PROP_CERTIFICATE_0,
PROP_CERTIFICATE, PROP_CERT_CERTIFICATE,
PROP_CERTIFICATE_PEM, PROP_CERT_CERTIFICATE_PEM,
PROP_PRIVATE_KEY, PROP_CERT_PRIVATE_KEY,
PROP_PRIVATE_KEY_PEM PROP_CERT_PRIVATE_KEY_PEM,
PROP_CERT_ISSUER
}; };
static void g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface); static void g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface);
@ -134,10 +135,11 @@ g_dummy_tls_certificate_class_init (GDummyTlsCertificateClass *certificate_class
gobject_class->get_property = g_dummy_tls_certificate_get_property; gobject_class->get_property = g_dummy_tls_certificate_get_property;
gobject_class->set_property = g_dummy_tls_certificate_set_property; gobject_class->set_property = g_dummy_tls_certificate_set_property;
g_object_class_override_property (gobject_class, PROP_CERTIFICATE, "certificate"); g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE, "certificate");
g_object_class_override_property (gobject_class, PROP_CERTIFICATE_PEM, "certificate-pem"); g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_PEM, "certificate-pem");
g_object_class_override_property (gobject_class, PROP_PRIVATE_KEY, "private-key"); g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY, "private-key");
g_object_class_override_property (gobject_class, PROP_PRIVATE_KEY_PEM, "private-key-pem"); g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_PEM, "private-key-pem");
g_object_class_override_property (gobject_class, PROP_CERT_ISSUER, "issuer");
} }
static void static void
@ -150,7 +152,7 @@ g_dummy_tls_certificate_initable_init (GInitable *initable,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
g_set_error_literal (error, G_TLS_ERROR, G_TLS_ERROR_MISC, g_set_error_literal (error, G_TLS_ERROR, G_TLS_ERROR_UNAVAILABLE,
_("TLS support is not available")); _("TLS support is not available"));
return FALSE; return FALSE;
} }
@ -181,14 +183,18 @@ enum
{ {
PROP_CONNECTION_0, PROP_CONNECTION_0,
PROP_BASE_IO_STREAM, PROP_CONN_BASE_IO_STREAM,
PROP_REQUIRE_CLOSE_NOTIFY, PROP_CONN_USE_SYSTEM_CERTDB,
PROP_REHANDSHAKE_MODE, PROP_CONN_REQUIRE_CLOSE_NOTIFY,
PROP_VALIDATION_FLAGS, PROP_CONN_REHANDSHAKE_MODE,
PROP_SERVER_IDENTITY, PROP_CONN_CERTIFICATE,
PROP_USE_SSL3, PROP_CONN_PEER_CERTIFICATE,
PROP_ACCEPTED_CAS, PROP_CONN_PEER_CERTIFICATE_ERRORS,
PROP_AUTHENTICATION_MODE PROP_CONN_VALIDATION_FLAGS,
PROP_CONN_SERVER_IDENTITY,
PROP_CONN_USE_SSL3,
PROP_CONN_ACCEPTED_CAS,
PROP_CONN_AUTHENTICATION_MODE
}; };
static void g_dummy_tls_connection_initable_iface_init (GInitableIface *iface); static void g_dummy_tls_connection_initable_iface_init (GInitableIface *iface);
@ -240,15 +246,18 @@ g_dummy_tls_connection_class_init (GDummyTlsConnectionClass *connection_class)
*/ */
io_stream_class->close_fn = g_dummy_tls_connection_close; io_stream_class->close_fn = g_dummy_tls_connection_close;
g_object_class_override_property (gobject_class, PROP_BASE_IO_STREAM, "base-io-stream"); g_object_class_override_property (gobject_class, PROP_CONN_BASE_IO_STREAM, "base-io-stream");
g_object_class_override_property (gobject_class, PROP_REQUIRE_CLOSE_NOTIFY, "require-close-notify"); g_object_class_override_property (gobject_class, PROP_CONN_USE_SYSTEM_CERTDB, "use-system-certdb");
g_object_class_override_property (gobject_class, PROP_REHANDSHAKE_MODE, "rehandshake-mode"); g_object_class_override_property (gobject_class, PROP_CONN_REQUIRE_CLOSE_NOTIFY, "require-close-notify");
g_object_class_override_property (gobject_class, PROP_VALIDATION_FLAGS, "validation-flags"); g_object_class_override_property (gobject_class, PROP_CONN_REHANDSHAKE_MODE, "rehandshake-mode");
g_object_class_override_property (gobject_class, PROP_SERVER_IDENTITY, "server-identity"); g_object_class_override_property (gobject_class, PROP_CONN_CERTIFICATE, "certificate");
g_object_class_override_property (gobject_class, PROP_USE_SSL3, "use-ssl3"); g_object_class_override_property (gobject_class, PROP_CONN_PEER_CERTIFICATE, "peer-certificate");
g_object_class_override_property (gobject_class, PROP_ACCEPTED_CAS, "accepted-cas"); g_object_class_override_property (gobject_class, PROP_CONN_PEER_CERTIFICATE_ERRORS, "peer-certificate-errors");
g_object_class_override_property (gobject_class, PROP_AUTHENTICATION_MODE, "authentication-mode"); g_object_class_override_property (gobject_class, PROP_CONN_VALIDATION_FLAGS, "validation-flags");
g_object_class_override_property (gobject_class, PROP_CONN_SERVER_IDENTITY, "server-identity");
g_object_class_override_property (gobject_class, PROP_CONN_USE_SSL3, "use-ssl3");
g_object_class_override_property (gobject_class, PROP_CONN_ACCEPTED_CAS, "accepted-cas");
g_object_class_override_property (gobject_class, PROP_CONN_AUTHENTICATION_MODE, "authentication-mode");
} }
static void static void
@ -261,7 +270,7 @@ g_dummy_tls_connection_initable_init (GInitable *initable,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
g_set_error_literal (error, G_TLS_ERROR, G_TLS_ERROR_MISC, g_set_error_literal (error, G_TLS_ERROR, G_TLS_ERROR_UNAVAILABLE,
_("TLS support is not available")); _("TLS support is not available"));
return FALSE; return FALSE;
} }

View File

@ -220,8 +220,8 @@ g_emblem_new_with_origin (GIcon *icon,
* *
* Gives back the icon from @emblem. * Gives back the icon from @emblem.
* *
* Returns: (transfer full): a #GIcon. The returned object belongs to the emblem * Returns: (transfer none): a #GIcon. The returned object belongs to
* and should not be modified or freed. * the emblem and should not be modified or freed.
* *
* Since: 2.18 * Since: 2.18
*/ */
@ -240,7 +240,7 @@ g_emblem_get_icon (GEmblem *emblem)
* *
* Gets the origin of the emblem. * Gets the origin of the emblem.
* *
* Returns: the origin of the emblem * Returns: (transfer none): the origin of the emblem
* *
* Since: 2.18 * Since: 2.18
*/ */

View File

@ -46,20 +46,19 @@
* of the emblems. See also #GEmblem for more information. * of the emblems. See also #GEmblem for more information.
**/ **/
static void g_emblemed_icon_icon_iface_init (GIconIface *iface); enum {
PROP_GICON = 1,
struct _GEmblemedIcon NUM_PROPERTIES
{ };
GObject parent_instance;
struct _GEmblemedIconPrivate {
GIcon *icon; GIcon *icon;
GList *emblems; GList *emblems;
}; };
struct _GEmblemedIconClass static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
{
GObjectClass parent_class; static void g_emblemed_icon_icon_iface_init (GIconIface *iface);
};
G_DEFINE_TYPE_WITH_CODE (GEmblemedIcon, g_emblemed_icon, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GEmblemedIcon, g_emblemed_icon, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_ICON, G_IMPLEMENT_INTERFACE (G_TYPE_ICON,
@ -73,23 +72,78 @@ g_emblemed_icon_finalize (GObject *object)
emblemed = G_EMBLEMED_ICON (object); emblemed = G_EMBLEMED_ICON (object);
g_object_unref (emblemed->icon); g_object_unref (emblemed->priv->icon);
g_list_foreach (emblemed->emblems, (GFunc) g_object_unref, NULL); g_list_foreach (emblemed->priv->emblems, (GFunc) g_object_unref, NULL);
g_list_free (emblemed->emblems); g_list_free (emblemed->priv->emblems);
(*G_OBJECT_CLASS (g_emblemed_icon_parent_class)->finalize) (object); (*G_OBJECT_CLASS (g_emblemed_icon_parent_class)->finalize) (object);
} }
static void
g_emblemed_icon_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GEmblemedIcon *self = G_EMBLEMED_ICON (object);
switch (property_id)
{
case PROP_GICON:
self->priv->icon = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
g_emblemed_icon_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GEmblemedIcon *self = G_EMBLEMED_ICON (object);
switch (property_id)
{
case PROP_GICON:
g_value_set_object (value, self->priv->icon);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void static void
g_emblemed_icon_class_init (GEmblemedIconClass *klass) g_emblemed_icon_class_init (GEmblemedIconClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = g_emblemed_icon_finalize; gobject_class->finalize = g_emblemed_icon_finalize;
gobject_class->set_property = g_emblemed_icon_set_property;
gobject_class->get_property = g_emblemed_icon_get_property;
properties[PROP_GICON] =
g_param_spec_object ("gicon",
P_("The base GIcon"),
P_("The GIcon to attach emblems to"),
G_TYPE_ICON,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
g_type_class_add_private (klass, sizeof (GEmblemedIconPrivate));
} }
static void static void
g_emblemed_icon_init (GEmblemedIcon *emblemed) g_emblemed_icon_init (GEmblemedIcon *emblemed)
{ {
emblemed->priv =
G_TYPE_INSTANCE_GET_PRIVATE (emblemed, G_TYPE_EMBLEMED_ICON,
GEmblemedIconPrivate);
} }
/** /**
@ -112,8 +166,9 @@ g_emblemed_icon_new (GIcon *icon,
g_return_val_if_fail (G_IS_ICON (icon), NULL); 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 (icon), NULL);
emblemed = G_EMBLEMED_ICON (g_object_new (G_TYPE_EMBLEMED_ICON, NULL)); emblemed = G_EMBLEMED_ICON (g_object_new (G_TYPE_EMBLEMED_ICON,
emblemed->icon = g_object_ref (icon); "gicon", icon,
NULL));
if (emblem != NULL) if (emblem != NULL)
g_emblemed_icon_add_emblem (emblemed, emblem); g_emblemed_icon_add_emblem (emblemed, emblem);
@ -128,7 +183,7 @@ g_emblemed_icon_new (GIcon *icon,
* *
* Gets the main icon for @emblemed. * Gets the main icon for @emblemed.
* *
* Returns: (transfer full): a #GIcon that is owned by @emblemed * Returns: (transfer none): a #GIcon that is owned by @emblemed
* *
* Since: 2.18 * Since: 2.18
**/ **/
@ -137,7 +192,7 @@ g_emblemed_icon_get_icon (GEmblemedIcon *emblemed)
{ {
g_return_val_if_fail (G_IS_EMBLEMED_ICON (emblemed), NULL); g_return_val_if_fail (G_IS_EMBLEMED_ICON (emblemed), NULL);
return emblemed->icon; return emblemed->priv->icon;
} }
/** /**
@ -146,8 +201,8 @@ g_emblemed_icon_get_icon (GEmblemedIcon *emblemed)
* *
* Gets the list of emblems for the @icon. * Gets the list of emblems for the @icon.
* *
* Returns: (element-type utf8) (transfer none): a #GList of #GEmblem <!-- -->s that * Returns: (element-type Gio.Emblem) (transfer none): a #GList of
* is owned by @emblemed * #GEmblem <!-- -->s that is owned by @emblemed
* *
* Since: 2.18 * Since: 2.18
**/ **/
@ -157,7 +212,27 @@ g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed)
{ {
g_return_val_if_fail (G_IS_EMBLEMED_ICON (emblemed), NULL); g_return_val_if_fail (G_IS_EMBLEMED_ICON (emblemed), NULL);
return emblemed->emblems; return emblemed->priv->emblems;
}
/**
* g_emblemed_icon_clear_emblems:
* @emblemed: a #GEmblemedIcon
*
* Removes all the emblems from @icon.
*
* Since: 2.28
**/
void
g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed)
{
g_return_if_fail (G_IS_EMBLEMED_ICON (emblemed));
if (emblemed->priv->emblems == NULL)
return;
g_list_free_full (emblemed->priv->emblems, g_object_unref);
emblemed->priv->emblems = NULL;
} }
static gint static gint
@ -193,7 +268,7 @@ g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed,
g_return_if_fail (G_IS_EMBLEM (emblem)); g_return_if_fail (G_IS_EMBLEM (emblem));
g_object_ref (emblem); g_object_ref (emblem);
emblemed->emblems = g_list_insert_sorted (emblemed->emblems, emblem, emblemed->priv->emblems = g_list_insert_sorted (emblemed->priv->emblems, emblem,
(GCompareFunc) g_emblem_comp); (GCompareFunc) g_emblem_comp);
} }
@ -202,9 +277,9 @@ g_emblemed_icon_hash (GIcon *icon)
{ {
GEmblemedIcon *emblemed = G_EMBLEMED_ICON (icon); GEmblemedIcon *emblemed = G_EMBLEMED_ICON (icon);
GList *list; GList *list;
guint hash = g_icon_hash (emblemed->icon); guint hash = g_icon_hash (emblemed->priv->icon);
for (list = emblemed->emblems; list != NULL; list = list->next) for (list = emblemed->priv->emblems; list != NULL; list = list->next)
hash ^= g_icon_hash (G_ICON (list->data)); hash ^= g_icon_hash (G_ICON (list->data));
return hash; return hash;
@ -218,11 +293,11 @@ g_emblemed_icon_equal (GIcon *icon1,
GEmblemedIcon *emblemed2 = G_EMBLEMED_ICON (icon2); GEmblemedIcon *emblemed2 = G_EMBLEMED_ICON (icon2);
GList *list1, *list2; GList *list1, *list2;
if (!g_icon_equal (emblemed1->icon, emblemed2->icon)) if (!g_icon_equal (emblemed1->priv->icon, emblemed2->priv->icon))
return FALSE; return FALSE;
list1 = emblemed1->emblems; list1 = emblemed1->priv->emblems;
list2 = emblemed2->emblems; list2 = emblemed2->priv->emblems;
while (list1 && list2) while (list1 && list2)
{ {
@ -254,13 +329,13 @@ g_emblemed_icon_to_tokens (GIcon *icon,
*out_version = 0; *out_version = 0;
s = g_icon_to_string (emblemed_icon->icon); s = g_icon_to_string (emblemed_icon->priv->icon);
if (s == NULL) if (s == NULL)
return FALSE; return FALSE;
g_ptr_array_add (tokens, s); g_ptr_array_add (tokens, s);
for (l = emblemed_icon->emblems; l != NULL; l = l->next) for (l = emblemed_icon->priv->emblems; l != NULL; l = l->next)
{ {
GIcon *emblem_icon = G_ICON (l->data); GIcon *emblem_icon = G_ICON (l->data);
@ -306,8 +381,8 @@ g_emblemed_icon_from_tokens (gchar **tokens,
} }
emblemed_icon = g_object_new (G_TYPE_EMBLEMED_ICON, NULL); emblemed_icon = g_object_new (G_TYPE_EMBLEMED_ICON, NULL);
emblemed_icon->icon = g_icon_new_for_string (tokens[0], error); emblemed_icon->priv->icon = g_icon_new_for_string (tokens[0], error);
if (emblemed_icon->icon == NULL) if (emblemed_icon->priv->icon == NULL)
goto fail; goto fail;
for (n = 1; n < num_tokens; n++) for (n = 1; n < num_tokens; n++)
@ -328,7 +403,7 @@ g_emblemed_icon_from_tokens (gchar **tokens,
goto fail; goto fail;
} }
emblemed_icon->emblems = g_list_append (emblemed_icon->emblems, emblem); emblemed_icon->priv->emblems = g_list_append (emblemed_icon->priv->emblems, emblem);
} }
return G_ICON (emblemed_icon); return G_ICON (emblemed_icon);

View File

@ -47,6 +47,20 @@ G_BEGIN_DECLS
**/ **/
typedef struct _GEmblemedIcon GEmblemedIcon; typedef struct _GEmblemedIcon GEmblemedIcon;
typedef struct _GEmblemedIconClass GEmblemedIconClass; typedef struct _GEmblemedIconClass GEmblemedIconClass;
typedef struct _GEmblemedIconPrivate GEmblemedIconPrivate;
struct _GEmblemedIcon
{
GObject parent_instance;
/*< private >*/
GEmblemedIconPrivate *priv;
};
struct _GEmblemedIconClass
{
GObjectClass parent_class;
};
GType g_emblemed_icon_get_type (void) G_GNUC_CONST; GType g_emblemed_icon_get_type (void) G_GNUC_CONST;
@ -56,6 +70,7 @@ GIcon *g_emblemed_icon_get_icon (GEmblemedIcon *emblemed);
GList *g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed); GList *g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed);
void g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed, void g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed,
GEmblem *emblem); GEmblem *emblem);
void g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed);
G_END_DECLS G_END_DECLS

View File

@ -822,7 +822,7 @@ g_file_resolve_relative_path (GFile *file,
* @file: input #GFile. * @file: input #GFile.
* @attributes: an attribute query string. * @attributes: an attribute query string.
* @flags: a set of #GFileQueryInfoFlags. * @flags: a set of #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting. * @error: #GError for error reporting.
* *
* Gets the requested information about the files in a directory. The result * Gets the requested information about the files in a directory. The result
@ -884,9 +884,10 @@ g_file_enumerate_children (GFile *file,
* @flags: a set of #GFileQueryInfoFlags. * @flags: a set of #GFileQueryInfoFlags.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the
* @user_data: the data to pass to callback function * request is satisfied
* @user_data: (closure): the data to pass to callback function
* *
* Asynchronously gets the requested information about the files in a directory. The result * Asynchronously gets the requested information about the files in a directory. The result
* is a #GFileEnumerator object that will give out #GFileInfo objects for * is a #GFileEnumerator object that will give out #GFileInfo objects for
@ -957,7 +958,7 @@ g_file_enumerate_children_finish (GFile *file,
/** /**
* g_file_query_exists: * g_file_query_exists:
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* *
* Utility function to check if a particular file exists. This is * Utility function to check if a particular file exists. This is
* implemented using g_file_query_info() and as such does blocking I/O. * implemented using g_file_query_info() and as such does blocking I/O.
@ -1007,7 +1008,7 @@ g_file_query_exists (GFile *file,
* g_file_query_file_type: * g_file_query_file_type:
* @file: input #GFile. * @file: input #GFile.
* @flags: a set of #GFileQueryInfoFlags passed to g_file_query_info(). * @flags: a set of #GFileQueryInfoFlags passed to g_file_query_info().
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* *
* Utility function to inspect the #GFileType of a file. This is * Utility function to inspect the #GFileType of a file. This is
* implemented using g_file_query_info() and as such does blocking I/O. * implemented using g_file_query_info() and as such does blocking I/O.
@ -1047,7 +1048,7 @@ g_file_query_file_type (GFile *file,
* @file: input #GFile. * @file: input #GFile.
* @attributes: an attribute query string. * @attributes: an attribute query string.
* @flags: a set of #GFileQueryInfoFlags. * @flags: a set of #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError. * @error: a #GError.
* *
* Gets the requested information about specified @file. The result * Gets the requested information about specified @file. The result
@ -1113,9 +1114,9 @@ g_file_query_info (GFile *file,
* @flags: a set of #GFileQueryInfoFlags. * @flags: a set of #GFileQueryInfoFlags.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously gets the requested information about specified @file. The result * Asynchronously gets the requested information about specified @file. The result
* is a #GFileInfo object that contains key-value attributes (such as type or size * is a #GFileInfo object that contains key-value attributes (such as type or size
@ -1187,7 +1188,7 @@ g_file_query_info_finish (GFile *file,
* g_file_query_filesystem_info: * g_file_query_filesystem_info:
* @file: input #GFile. * @file: input #GFile.
* @attributes: an attribute query string. * @attributes: an attribute query string.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError. * @error: a #GError.
* *
* Similar to g_file_query_info(), but obtains information * Similar to g_file_query_info(), but obtains information
@ -1247,9 +1248,9 @@ g_file_query_filesystem_info (GFile *file,
* @attributes: an attribute query string. * @attributes: an attribute query string.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously gets the requested information about the filesystem * Asynchronously gets the requested information about the filesystem
* that the specified @file is on. The result is a #GFileInfo object * that the specified @file is on. The result is a #GFileInfo object
@ -1320,7 +1321,7 @@ g_file_query_filesystem_info_finish (GFile *file,
/** /**
* g_file_find_enclosing_mount: * g_file_find_enclosing_mount:
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError. * @error: a #GError.
* *
* Gets a #GMount for the #GFile. * Gets a #GMount for the #GFile.
@ -1367,9 +1368,9 @@ g_file_find_enclosing_mount (GFile *file,
* @file: a #GFile * @file: a #GFile
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously gets the mount for the file. * Asynchronously gets the mount for the file.
* *
@ -1435,7 +1436,7 @@ g_file_find_enclosing_mount_finish (GFile *file,
/** /**
* g_file_read: * g_file_read:
* @file: #GFile to read. * @file: #GFile to read.
* @cancellable: a #GCancellable * @cancellable: (allow-none): a #GCancellable
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Opens a file for reading. The result is a #GFileInputStream that * Opens a file for reading. The result is a #GFileInputStream that
@ -1482,7 +1483,7 @@ g_file_read (GFile *file,
* g_file_append_to: * g_file_append_to:
* @file: input #GFile. * @file: input #GFile.
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Gets an output stream for appending data to the file. If * Gets an output stream for appending data to the file. If
@ -1536,7 +1537,7 @@ g_file_append_to (GFile *file,
* g_file_create: * g_file_create:
* @file: input #GFile. * @file: input #GFile.
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Creates a new file and returns an output stream for writing to it. * Creates a new file and returns an output stream for writing to it.
@ -1596,7 +1597,7 @@ g_file_create (GFile *file,
* current #GFile, or #NULL to ignore. * current #GFile, or #NULL to ignore.
* @make_backup: %TRUE if a backup should be created. * @make_backup: %TRUE if a backup should be created.
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Returns an output stream for overwriting the file, possibly * Returns an output stream for overwriting the file, possibly
@ -1680,7 +1681,7 @@ g_file_replace (GFile *file,
/** /**
* g_file_open_readwrite: * g_file_open_readwrite:
* @file: #GFile to open * @file: #GFile to open
* @cancellable: a #GCancellable * @cancellable: (allow-none): a #GCancellable
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Opens an existing file for reading and writing. The result is * Opens an existing file for reading and writing. The result is
@ -1731,7 +1732,7 @@ g_file_open_readwrite (GFile *file,
* g_file_create_readwrite: * g_file_create_readwrite:
* @file: a #GFile * @file: a #GFile
* @flags: a set of #GFileCreateFlags * @flags: a set of #GFileCreateFlags
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Creates a new file and returns a stream for reading and writing to it. * Creates a new file and returns a stream for reading and writing to it.
@ -1794,7 +1795,7 @@ g_file_create_readwrite (GFile *file,
* current #GFile, or #NULL to ignore * current #GFile, or #NULL to ignore
* @make_backup: %TRUE if a backup should be created * @make_backup: %TRUE if a backup should be created
* @flags: a set of #GFileCreateFlags * @flags: a set of #GFileCreateFlags
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Returns an output stream for overwriting the file in readwrite mode, * Returns an output stream for overwriting the file in readwrite mode,
@ -1846,9 +1847,9 @@ g_file_replace_readwrite (GFile *file,
* @file: input #GFile * @file: input #GFile
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously opens @file for reading. * Asynchronously opens @file for reading.
* *
@ -1916,9 +1917,9 @@ g_file_read_finish (GFile *file,
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously opens @file for appending. * Asynchronously opens @file for appending.
* *
@ -1988,9 +1989,9 @@ g_file_append_to_finish (GFile *file,
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously creates a new file and returns an output stream for writing to it. * Asynchronously creates a new file and returns an output stream for writing to it.
* The file must not already exist. * The file must not already exist.
@ -2064,9 +2065,9 @@ g_file_create_finish (GFile *file,
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously overwrites the file, replacing the contents, possibly * Asynchronously overwrites the file, replacing the contents, possibly
* creating a backup copy of the file first. * creating a backup copy of the file first.
@ -2141,9 +2142,9 @@ g_file_replace_finish (GFile *file,
* @file: input #GFile. * @file: input #GFile.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously opens @file for reading and writing. * Asynchronously opens @file for reading and writing.
* *
@ -2216,9 +2217,9 @@ g_file_open_readwrite_finish (GFile *file,
* @flags: a set of #GFileCreateFlags * @flags: a set of #GFileCreateFlags
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request * of the request
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously creates a new file and returns a stream for reading and * Asynchronously creates a new file and returns a stream for reading and
* writing to it. The file must not already exist. * writing to it. The file must not already exist.
@ -2296,9 +2297,9 @@ g_file_create_readwrite_finish (GFile *file,
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously overwrites the file in read-write mode, replacing the * Asynchronously overwrites the file in read-write mode, replacing the
* contents, possibly creating a backup copy of the file first. * contents, possibly creating a backup copy of the file first.
@ -2570,7 +2571,7 @@ build_attribute_list_for_copy (GFileAttributeInfoList *attributes,
* @source: a #GFile with attributes. * @source: a #GFile with attributes.
* @destination: a #GFile to copy attributes to. * @destination: a #GFile to copy attributes to.
* @flags: a set of #GFileCopyFlags. * @flags: a set of #GFileCopyFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Copies the file attributes from @source to @destination. * Copies the file attributes from @source to @destination.
@ -2988,7 +2989,7 @@ file_copy_fallback (GFile *source,
* @source: input #GFile. * @source: input #GFile.
* @destination: destination #GFile * @destination: destination #GFile
* @flags: set of #GFileCopyFlags * @flags: set of #GFileCopyFlags
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @progress_callback: (scope call): function to callback with progress information * @progress_callback: (scope call): function to callback with progress information
* @progress_callback_data: (closure): user data to pass to @progress_callback * @progress_callback_data: (closure): user data to pass to @progress_callback
* @error: #GError to set on error, or %NULL * @error: #GError to set on error, or %NULL
@ -3105,7 +3106,7 @@ g_file_copy (GFile *source,
} }
/** /**
* g_file_copy_async: * g_file_copy_async: (skip)
* @source: input #GFile. * @source: input #GFile.
* @destination: destination #GFile * @destination: destination #GFile
* @flags: set of #GFileCopyFlags * @flags: set of #GFileCopyFlags
@ -3193,7 +3194,7 @@ g_file_copy_finish (GFile *file,
* @source: #GFile pointing to the source location. * @source: #GFile pointing to the source location.
* @destination: #GFile pointing to the destination location. * @destination: #GFile pointing to the destination location.
* @flags: set of #GFileCopyFlags. * @flags: set of #GFileCopyFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @progress_callback: (scope call): #GFileProgressCallback function for updates. * @progress_callback: (scope call): #GFileProgressCallback function for updates.
* @progress_callback_data: (closure): gpointer to user data for the callback function. * @progress_callback_data: (closure): gpointer to user data for the callback function.
* @error: #GError for returning error conditions, or %NULL * @error: #GError for returning error conditions, or %NULL
@ -3320,7 +3321,7 @@ g_file_move (GFile *source,
/** /**
* g_file_make_directory * g_file_make_directory
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Creates a directory. Note that this will only create a child directory of * Creates a directory. Note that this will only create a child directory of
@ -3368,7 +3369,7 @@ g_file_make_directory (GFile *file,
/** /**
* g_file_make_directory_with_parents: * g_file_make_directory_with_parents:
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Creates a directory and any parent directories that may not exist similar to * Creates a directory and any parent directories that may not exist similar to
@ -3450,7 +3451,7 @@ g_file_make_directory_with_parents (GFile *file,
* g_file_make_symbolic_link: * g_file_make_symbolic_link:
* @file: a #GFile with the name of the symlink to create * @file: a #GFile with the name of the symlink to create
* @symlink_value: a string with the path for the target of the new symlink * @symlink_value: a string with the path for the target of the new symlink
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError. * @error: a #GError.
* *
* Creates a symbolic link named @file which contains the string * Creates a symbolic link named @file which contains the string
@ -3500,7 +3501,7 @@ g_file_make_symbolic_link (GFile *file,
/** /**
* g_file_delete: * g_file_delete:
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Deletes a file. If the @file is a directory, it will only be deleted if it * Deletes a file. If the @file is a directory, it will only be deleted if it
@ -3541,7 +3542,7 @@ g_file_delete (GFile *file,
/** /**
* g_file_trash: * g_file_trash:
* @file: #GFile to send to trash. * @file: #GFile to send to trash.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sends @file to the "Trashcan", if possible. This is similar to * Sends @file to the "Trashcan", if possible. This is similar to
@ -3585,7 +3586,7 @@ g_file_trash (GFile *file,
* g_file_set_display_name: * g_file_set_display_name:
* @file: input #GFile. * @file: input #GFile.
* @display_name: a string. * @display_name: a string.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Renames @file to the specified display name. * Renames @file to the specified display name.
@ -3641,9 +3642,9 @@ g_file_set_display_name (GFile *file,
* @display_name: a string. * @display_name: a string.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously sets the display name for a given #GFile. * Asynchronously sets the display name for a given #GFile.
* *
@ -3711,7 +3712,7 @@ g_file_set_display_name_finish (GFile *file,
/** /**
* g_file_query_settable_attributes: * g_file_query_settable_attributes:
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Obtain the list of settable attributes for the file. * Obtain the list of settable attributes for the file.
@ -3767,7 +3768,7 @@ g_file_query_settable_attributes (GFile *file,
/** /**
* g_file_query_writable_namespaces: * g_file_query_writable_namespaces:
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Obtain the list of attribute namespaces where new attributes * Obtain the list of attribute namespaces where new attributes
@ -3824,7 +3825,7 @@ g_file_query_writable_namespaces (GFile *file,
* @type: The type of the attribute * @type: The type of the attribute
* @value_p: a pointer to the value (or the pointer itself if the type is a pointer type) * @value_p: a pointer to the value (or the pointer itself if the type is a pointer type)
* @flags: a set of #GFileQueryInfoFlags. * @flags: a set of #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sets an attribute in the file with attribute name @attribute to @value. * Sets an attribute in the file with attribute name @attribute to @value.
@ -3870,7 +3871,7 @@ g_file_set_attribute (GFile *file,
* @file: input #GFile. * @file: input #GFile.
* @info: a #GFileInfo. * @info: a #GFileInfo.
* @flags: #GFileQueryInfoFlags * @flags: #GFileQueryInfoFlags
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Tries to set all attributes in the #GFileInfo on the target values, * Tries to set all attributes in the #GFileInfo on the target values,
@ -3963,9 +3964,9 @@ g_file_real_set_attributes_from_info (GFile *file,
* @flags: a #GFileQueryInfoFlags. * @flags: a #GFileQueryInfoFlags.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback. * @callback: (scope async): a #GAsyncReadyCallback.
* @user_data: a #gpointer. * @user_data: (closure): a #gpointer.
* *
* Asynchronously sets the attributes of @file with @info. * Asynchronously sets the attributes of @file with @info.
* *
@ -4034,7 +4035,7 @@ g_file_set_attributes_finish (GFile *file,
* @attribute: a string containing the attribute's name. * @attribute: a string containing the attribute's name.
* @value: a string containing the attribute's value. * @value: a string containing the attribute's value.
* @flags: #GFileQueryInfoFlags. * @flags: #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_STRING to @value. * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_STRING to @value.
@ -4065,7 +4066,7 @@ g_file_set_attribute_string (GFile *file,
* @attribute: a string containing the attribute's name. * @attribute: a string containing the attribute's name.
* @value: a string containing the attribute's new value. * @value: a string containing the attribute's new value.
* @flags: a #GFileQueryInfoFlags. * @flags: a #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to @value. * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to @value.
@ -4098,7 +4099,7 @@ g_file_set_attribute_byte_string (GFile *file,
* @attribute: a string containing the attribute's name. * @attribute: a string containing the attribute's name.
* @value: a #guint32 containing the attribute's new value. * @value: a #guint32 containing the attribute's new value.
* @flags: a #GFileQueryInfoFlags. * @flags: a #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to @value. * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to @value.
@ -4130,7 +4131,7 @@ g_file_set_attribute_uint32 (GFile *file,
* @attribute: a string containing the attribute's name. * @attribute: a string containing the attribute's name.
* @value: a #gint32 containing the attribute's new value. * @value: a #gint32 containing the attribute's new value.
* @flags: a #GFileQueryInfoFlags. * @flags: a #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT32 to @value. * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT32 to @value.
@ -4162,7 +4163,7 @@ g_file_set_attribute_int32 (GFile *file,
* @attribute: a string containing the attribute's name. * @attribute: a string containing the attribute's name.
* @value: a #guint64 containing the attribute's new value. * @value: a #guint64 containing the attribute's new value.
* @flags: a #GFileQueryInfoFlags. * @flags: a #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to @value. * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to @value.
@ -4194,7 +4195,7 @@ g_file_set_attribute_uint64 (GFile *file,
* @attribute: a string containing the attribute's name. * @attribute: a string containing the attribute's name.
* @value: a #guint64 containing the attribute's new value. * @value: a #guint64 containing the attribute's new value.
* @flags: a #GFileQueryInfoFlags. * @flags: a #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT64 to @value. * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT64 to @value.
@ -4224,9 +4225,9 @@ g_file_set_attribute_int64 (GFile *file,
* @file: input #GFile. * @file: input #GFile.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @mount_operation: a #GMountOperation, or %NULL to avoid user interaction. * @mount_operation: a #GMountOperation, or %NULL to avoid user interaction.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Mounts a file of type G_FILE_TYPE_MOUNTABLE. * Mounts a file of type G_FILE_TYPE_MOUNTABLE.
* Using @mount_operation, you can request callbacks when, for instance, * Using @mount_operation, you can request callbacks when, for instance,
@ -4311,9 +4312,9 @@ g_file_mount_mountable_finish (GFile *file,
* g_file_unmount_mountable: * g_file_unmount_mountable:
* @file: input #GFile. * @file: input #GFile.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Unmounts a file of type G_FILE_TYPE_MOUNTABLE. * Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
* *
@ -4399,9 +4400,9 @@ g_file_unmount_mountable_finish (GFile *file,
* @file: input #GFile. * @file: input #GFile.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @mount_operation: a #GMountOperation, or %NULL to avoid user interaction. * @mount_operation: a #GMountOperation, or %NULL to avoid user interaction.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Unmounts a file of type G_FILE_TYPE_MOUNTABLE. * Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
* *
@ -4498,9 +4499,9 @@ g_file_unmount_mountable_with_operation_finish (GFile *file,
* g_file_eject_mountable: * g_file_eject_mountable:
* @file: input #GFile. * @file: input #GFile.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Starts an asynchronous eject on a mountable. * Starts an asynchronous eject on a mountable.
* When this operation has completed, @callback will be called with * When this operation has completed, @callback will be called with
@ -4584,9 +4585,9 @@ g_file_eject_mountable_finish (GFile *file,
* @file: input #GFile. * @file: input #GFile.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @mount_operation: a #GMountOperation, or %NULL to avoid user interaction. * @mount_operation: a #GMountOperation, or %NULL to avoid user interaction.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL. * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Starts an asynchronous eject on a mountable. * Starts an asynchronous eject on a mountable.
* When this operation has completed, @callback will be called with * When this operation has completed, @callback will be called with
@ -4681,7 +4682,7 @@ g_file_eject_mountable_with_operation_finish (GFile *file,
* g_file_monitor_directory: * g_file_monitor_directory:
* @file: input #GFile. * @file: input #GFile.
* @flags: a set of #GFileMonitorFlags. * @flags: a set of #GFileMonitorFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL. * @error: a #GError, or %NULL.
* *
* Obtains a directory monitor for the given file. * Obtains a directory monitor for the given file.
@ -4725,7 +4726,7 @@ g_file_monitor_directory (GFile *file,
* g_file_monitor_file: * g_file_monitor_file:
* @file: input #GFile. * @file: input #GFile.
* @flags: a set of #GFileMonitorFlags. * @flags: a set of #GFileMonitorFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL. * @error: a #GError, or %NULL.
* *
* Obtains a file monitor for the given file. If no file notification * Obtains a file monitor for the given file. If no file notification
@ -4770,7 +4771,7 @@ g_file_monitor_file (GFile *file,
* g_file_monitor: * g_file_monitor:
* @file: input #GFile * @file: input #GFile
* @flags: a set of #GFileMonitorFlags * @flags: a set of #GFileMonitorFlags
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Obtains a file or directory monitor for the given file, depending * Obtains a file or directory monitor for the given file, depending
@ -6379,7 +6380,7 @@ load_contents_open_callback (GObject *obj,
} }
/** /**
* g_file_load_partial_contents_async: * g_file_load_partial_contents_async: (skip)
* @file: input #GFile. * @file: input #GFile.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @read_more_callback: a #GFileReadMoreCallback to receive partial data and to specify whether further data should be read. * @read_more_callback: a #GFileReadMoreCallback to receive partial data and to specify whether further data should be read.

View File

@ -173,7 +173,7 @@ g_file_enumerator_init (GFileEnumerator *enumerator)
/** /**
* g_file_enumerator_next_file: * g_file_enumerator_next_file:
* @enumerator: a #GFileEnumerator. * @enumerator: a #GFileEnumerator.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Returns information for the next file in the enumerated object. * Returns information for the next file in the enumerated object.
@ -238,7 +238,7 @@ g_file_enumerator_next_file (GFileEnumerator *enumerator,
/** /**
* g_file_enumerator_close: * g_file_enumerator_close:
* @enumerator: a #GFileEnumerator. * @enumerator: a #GFileEnumerator.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Releases all resources used by this enumerator, making the * Releases all resources used by this enumerator, making the
@ -305,9 +305,9 @@ next_async_callback_wrapper (GObject *source_object,
* @num_files: the number of file info objects to request * @num_files: the number of file info objects to request
* @io_priority: the <link linkend="gioscheduler">io priority</link> * @io_priority: the <link linkend="gioscheduler">io priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Request information for a number of files from the enumerator asynchronously. * Request information for a number of files from the enumerator asynchronously.
* When all i/o for the operation is finished the @callback will be called with * When all i/o for the operation is finished the @callback will be called with
@ -439,9 +439,9 @@ close_async_callback_wrapper (GObject *source_object,
* @enumerator: a #GFileEnumerator. * @enumerator: a #GFileEnumerator.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously closes the file enumerator. * Asynchronously closes the file enumerator.
* *

View File

@ -74,7 +74,7 @@ struct _GFileEnumeratorClass
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
GList * (* next_files_finish) (GFileEnumerator *enumerator, GList * (* next_files_finish) (GFileEnumerator *enumerator,
GAsyncResult *res, GAsyncResult *result,
GError **error); GError **error);
void (* close_async) (GFileEnumerator *enumerator, void (* close_async) (GFileEnumerator *enumerator,
int io_priority, int io_priority,
@ -82,7 +82,7 @@ struct _GFileEnumeratorClass
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean (* close_finish) (GFileEnumerator *enumerator, gboolean (* close_finish) (GFileEnumerator *enumerator,
GAsyncResult *res, GAsyncResult *result,
GError **error); GError **error);
/*< private >*/ /*< private >*/

View File

@ -112,7 +112,7 @@ g_file_input_stream_init (GFileInputStream *stream)
* g_file_input_stream_query_info: * g_file_input_stream_query_info:
* @stream: a #GFileInputStream. * @stream: a #GFileInputStream.
* @attributes: a file attribute query string. * @attributes: a file attribute query string.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
@ -180,9 +180,9 @@ async_ready_callback_wrapper (GObject *source_object,
* @attributes: a file attribute query string. * @attributes: a file attribute query string.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied * @callback: (scope async): callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Queries the stream information asynchronously. * Queries the stream information asynchronously.
* When the operation is finished @callback will be called. * When the operation is finished @callback will be called.

View File

@ -79,7 +79,7 @@ struct _GFileInputStreamClass
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
GFileInfo * (* query_info_finish) (GFileInputStream *stream, GFileInfo * (* query_info_finish) (GFileInputStream *stream,
GAsyncResult *res, GAsyncResult *result,
GError **error); GError **error);
/*< private >*/ /*< private >*/

View File

@ -115,7 +115,7 @@ g_file_io_stream_init (GFileIOStream *stream)
* g_file_io_stream_query_info: * g_file_io_stream_query_info:
* @stream: a #GFileIOStream. * @stream: a #GFileIOStream.
* @attributes: a file attribute query string. * @attributes: a file attribute query string.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError, %NULL to ignore. * @error: a #GError, %NULL to ignore.
* *
* Queries a file io stream for the given @attributes. * Queries a file io stream for the given @attributes.
@ -196,9 +196,9 @@ async_ready_callback_wrapper (GObject *source_object,
* @attributes: a file attribute query string. * @attributes: a file attribute query string.
* @io_priority: the <link linkend="gio-GIOScheduler">I/O priority</link> * @io_priority: the <link linkend="gio-GIOScheduler">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied * @callback: (scope async): callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Asynchronously queries the @stream for a #GFileInfo. When completed, * Asynchronously queries the @stream for a #GFileInfo. When completed,
* @callback will be called with a #GAsyncResult which can be used to * @callback will be called with a #GAsyncResult which can be used to

View File

@ -84,7 +84,7 @@ struct _GFileIOStreamClass
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
GFileInfo * (* query_info_finish) (GFileIOStream *stream, GFileInfo * (* query_info_finish) (GFileIOStream *stream,
GAsyncResult *res, GAsyncResult *result,
GError **error); GError **error);
char * (* get_etag) (GFileIOStream *stream); char * (* get_etag) (GFileIOStream *stream);

View File

@ -84,7 +84,7 @@ struct _GFileOutputStreamClass
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
GFileInfo * (* query_info_finish) (GFileOutputStream *stream, GFileInfo * (* query_info_finish) (GFileOutputStream *stream,
GAsyncResult *res, GAsyncResult *result,
GError **error); GError **error);
char * (* get_etag) (GFileOutputStream *stream); char * (* get_etag) (GFileOutputStream *stream);

View File

@ -397,8 +397,8 @@ ensure_builtin_icon_types (void)
* implementations you need to ensure that each #GType is registered * implementations you need to ensure that each #GType is registered
* with the type system prior to calling g_icon_new_for_string(). * with the type system prior to calling g_icon_new_for_string().
* *
* Returns: An object implementing the #GIcon interface or %NULL if * Returns: (transfer full): An object implementing the #GIcon
* @error is set. * interface or %NULL if @error is set.
* *
* Since: 2.20 * Since: 2.20
**/ **/

View File

@ -570,7 +570,7 @@ g_inet_address_to_string (GInetAddress *address)
} }
/** /**
* g_inet_address_to_bytes: * g_inet_address_to_bytes: (skip)
* @address: a #GInetAddress * @address: a #GInetAddress
* *
* Gets the raw binary address data from @address. * Gets the raw binary address data from @address.

View File

@ -289,7 +289,7 @@ g_inet_socket_address_new (GInetAddress *address,
* *
* Gets @address's #GInetAddress. * Gets @address's #GInetAddress.
* *
* Returns: (transfer full): the #GInetAddress for @address, which must be * Returns: (transfer none): the #GInetAddress for @address, which must be
* g_object_ref()'d if it will be stored * g_object_ref()'d if it will be stored
* *
* Since: 2.22 * Since: 2.22

View File

@ -139,7 +139,7 @@ g_input_stream_init (GInputStream *stream)
* @stream: a #GInputStream. * @stream: a #GInputStream.
* @buffer: a buffer to read data into (which should be at least count bytes long). * @buffer: a buffer to read data into (which should be at least count bytes long).
* @count: the number of bytes that will be read from the stream * @count: the number of bytes that will be read from the stream
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Tries to read @count bytes from the stream into the buffer starting at * Tries to read @count bytes from the stream into the buffer starting at
@ -216,8 +216,8 @@ g_input_stream_read (GInputStream *stream,
* @stream: a #GInputStream. * @stream: a #GInputStream.
* @buffer: a buffer to read data into (which should be at least count bytes long). * @buffer: a buffer to read data into (which should be at least count bytes long).
* @count: the number of bytes that will be read from the stream * @count: the number of bytes that will be read from the stream
* @bytes_read: location to store the number of bytes that was read from the stream * @bytes_read: (out): location to store the number of bytes that was read from the stream
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Tries to read @count bytes from the stream into the buffer starting at * Tries to read @count bytes from the stream into the buffer starting at
@ -277,7 +277,7 @@ g_input_stream_read_all (GInputStream *stream,
* g_input_stream_skip: * g_input_stream_skip:
* @stream: a #GInputStream. * @stream: a #GInputStream.
* @count: the number of bytes that will be skipped from the stream * @count: the number of bytes that will be skipped from the stream
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Tries to skip @count bytes from the stream. Will block during the operation. * Tries to skip @count bytes from the stream. Will block during the operation.
@ -393,7 +393,7 @@ g_input_stream_real_skip (GInputStream *stream,
/** /**
* g_input_stream_close: * g_input_stream_close:
* @stream: A #GInputStream. * @stream: A #GInputStream.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Closes the stream, releasing resources related to it. * Closes the stream, releasing resources related to it.
@ -492,9 +492,9 @@ async_ready_close_callback_wrapper (GObject *source_object,
* @count: the number of bytes that will be read from the stream * @count: the number of bytes that will be read from the stream
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied * @callback: (scope async): callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Request an asynchronous read of @count bytes from the stream into the buffer * Request an asynchronous read of @count bytes from the stream into the buffer
* starting at @buffer. When the operation is finished @callback will be called. * starting at @buffer. When the operation is finished @callback will be called.
@ -617,9 +617,9 @@ g_input_stream_read_finish (GInputStream *stream,
* @count: the number of bytes that will be skipped from the stream * @count: the number of bytes that will be skipped from the stream
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied * @callback: (scope async): callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Request an asynchronous skip of @count bytes from the stream. * Request an asynchronous skip of @count bytes from the stream.
* When the operation is finished @callback will be called. * When the operation is finished @callback will be called.
@ -740,9 +740,9 @@ g_input_stream_skip_finish (GInputStream *stream,
* @stream: A #GInputStream. * @stream: A #GInputStream.
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional cancellable object * @cancellable: (allow-none): optional cancellable object
* @callback: callback to call when the request is satisfied * @callback: (scope async): callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Requests an asynchronous closes of the stream, releasing resources related to it. * Requests an asynchronous closes of the stream, releasing resources related to it.
* When the operation is finished @callback will be called. * When the operation is finished @callback will be called.

View File

@ -93,7 +93,6 @@
#include <gio/gnetworkaddress.h> #include <gio/gnetworkaddress.h>
#include <gio/gnetworkservice.h> #include <gio/gnetworkservice.h>
#include <gio/goutputstream.h> #include <gio/goutputstream.h>
#include <gio/gperiodic.h>
#include <gio/gpermission.h> #include <gio/gpermission.h>
#include <gio/gpollableinputstream.h> #include <gio/gpollableinputstream.h>
#include <gio/gpollableoutputstream.h> #include <gio/gpollableoutputstream.h>

View File

@ -84,6 +84,7 @@ g_app_info_launch_uris
g_app_info_should_show g_app_info_should_show
g_app_info_set_as_default_for_type g_app_info_set_as_default_for_type
g_app_info_set_as_default_for_extension g_app_info_set_as_default_for_extension
g_app_info_set_as_last_used_for_type
g_app_info_add_supports_type g_app_info_add_supports_type
g_app_info_can_remove_supports_type g_app_info_can_remove_supports_type
g_app_info_remove_supports_type g_app_info_remove_supports_type
@ -130,11 +131,12 @@ g_desktop_app_info_new_from_filename
g_desktop_app_info_new_from_keyfile g_desktop_app_info_new_from_keyfile
g_desktop_app_info_new g_desktop_app_info_new
g_desktop_app_info_get_filename g_desktop_app_info_get_filename
g_desktop_app_info_get_type G_GNUC_CONST
g_desktop_app_info_get_is_hidden g_desktop_app_info_get_is_hidden
g_desktop_app_info_set_desktop_env g_desktop_app_info_get_type G_GNUC_CONST
g_desktop_app_info_launch_uris_as_manager
g_desktop_app_info_lookup_get_type G_GNUC_CONST g_desktop_app_info_lookup_get_type G_GNUC_CONST
g_desktop_app_info_lookup_get_default_for_uri_scheme g_desktop_app_info_lookup_get_default_for_uri_scheme
g_desktop_app_info_set_desktop_env
#endif #endif
#endif #endif
#endif #endif
@ -663,6 +665,8 @@ g_io_stream_is_closed
g_io_stream_has_pending g_io_stream_has_pending
g_io_stream_set_pending g_io_stream_set_pending
g_io_stream_clear_pending g_io_stream_clear_pending
g_io_stream_splice_async
g_io_stream_splice_finish
#endif #endif
#endif #endif
@ -1033,6 +1037,7 @@ g_file_query_info_flags_get_type G_GNUC_CONST
g_file_type_get_type G_GNUC_CONST g_file_type_get_type G_GNUC_CONST
g_filesystem_preview_type_get_type G_GNUC_CONST g_filesystem_preview_type_get_type G_GNUC_CONST
g_io_error_enum_get_type G_GNUC_CONST g_io_error_enum_get_type G_GNUC_CONST
g_io_stream_splice_flags_get_type G_GNUC_CONST
g_mount_mount_flags_get_type G_GNUC_CONST g_mount_mount_flags_get_type G_GNUC_CONST
g_mount_operation_result_get_type G_GNUC_CONST g_mount_operation_result_get_type G_GNUC_CONST
g_drive_start_flags_get_type G_GNUC_CONST g_drive_start_flags_get_type G_GNUC_CONST
@ -1081,6 +1086,7 @@ g_emblemed_icon_new
g_emblemed_icon_get_icon g_emblemed_icon_get_icon
g_emblemed_icon_get_emblems g_emblemed_icon_get_emblems
g_emblemed_icon_add_emblem g_emblemed_icon_add_emblem
g_emblemed_icon_clear_emblems
#endif #endif
#endif #endif
@ -1539,13 +1545,20 @@ g_settings_backend_path_changed
g_settings_backend_path_writable_changed g_settings_backend_path_writable_changed
g_settings_backend_writable_changed g_settings_backend_writable_changed
g_settings_backend_changed_tree g_settings_backend_changed_tree
#endif g_settings_backend_get_default
#endif #endif
#if IN_HEADER(__G_SETTINGS_BACKEND_H__)
#if IN_FILE(__G_KEYFILE_SETTINGS_BACKEND_C__) #if IN_FILE(__G_KEYFILE_SETTINGS_BACKEND_C__)
g_keyfile_settings_backend_new g_keyfile_settings_backend_new
#endif #endif
#if IN_FILE(__G_MEMORY_SETTINGS_BACKEND_C__)
g_memory_settings_backend_new
#endif
#if IN_FILE(__G_NULL_SETTINGS_BACKEND_C__)
g_null_settings_backend_new
#endif
#endif #endif
#if IN_HEADER(__G_SETTINGS_H__) #if IN_HEADER(__G_SETTINGS_H__)
@ -1971,21 +1984,6 @@ g_simple_action_set_enabled
#endif #endif
#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
#if IN_HEADER(__G_POLLABLE_INPUT_STREAM_H__) #if IN_HEADER(__G_POLLABLE_INPUT_STREAM_H__)
#if IN_FILE(__G_POLLABLE_INPUT_STREAM_C__) #if IN_FILE(__G_POLLABLE_INPUT_STREAM_C__)
g_pollable_input_stream_get_type G_GNUC_CONST g_pollable_input_stream_get_type G_GNUC_CONST
@ -2036,25 +2034,27 @@ g_tls_certificate_list_new_from_file
g_tls_certificate_new_from_file g_tls_certificate_new_from_file
g_tls_certificate_new_from_files g_tls_certificate_new_from_files
g_tls_certificate_new_from_pem g_tls_certificate_new_from_pem
g_tls_certificate_verify
#endif #endif
#endif #endif
#if IN_HEADER(__G_TLS_CONNECTION_H__) #if IN_HEADER(__G_TLS_CONNECTION_H__)
#if IN_FILE(__G_TLS_CONNECTION_C__) #if IN_FILE(__G_TLS_CONNECTION_C__)
g_tls_connection_emit_accept_certificate g_tls_connection_emit_accept_certificate
g_tls_connection_emit_need_certificate
g_tls_connection_get_certificate g_tls_connection_get_certificate
g_tls_connection_get_peer_certificate g_tls_connection_get_peer_certificate
g_tls_connection_get_peer_certificate_errors
g_tls_connection_get_rehandshake_mode g_tls_connection_get_rehandshake_mode
g_tls_connection_get_require_close_notify g_tls_connection_get_require_close_notify
g_tls_connection_get_use_system_certdb
g_tls_connection_get_type G_GNUC_CONST g_tls_connection_get_type G_GNUC_CONST
g_tls_connection_handshake g_tls_connection_handshake
g_tls_connection_handshake_async g_tls_connection_handshake_async
g_tls_connection_handshake_finish g_tls_connection_handshake_finish
g_tls_connection_set_certificate g_tls_connection_set_certificate
g_tls_connection_set_peer_certificate
g_tls_connection_set_rehandshake_mode g_tls_connection_set_rehandshake_mode
g_tls_connection_set_require_close_notify g_tls_connection_set_require_close_notify
g_tls_connection_set_use_system_certdb
#endif #endif
#endif #endif

View File

@ -571,6 +571,27 @@ typedef enum {
} GOutputStreamSpliceFlags; } GOutputStreamSpliceFlags;
/**
* GIOStreamSpliceFlags:
* @G_IO_STREAM_SPLICE_NONE: Do not close either stream.
* @G_IO_STREAM_SPLICE_CLOSE_STREAM1: Close the first stream after
* the splice.
* @G_IO_STREAM_SPLICE_CLOSE_STREAM2: Close the second stream after
* the splice.
* @G_IO_STREAM_SPLICE_WAIT_FOR_BOTH: Wait for both splice operations to finish
* before calling the callback.
*
* GIOStreamSpliceFlags determine how streams should be spliced.
*
* Since: 2.28
**/
typedef enum {
G_IO_STREAM_SPLICE_NONE = 0,
G_IO_STREAM_SPLICE_CLOSE_STREAM1 = (1 << 0),
G_IO_STREAM_SPLICE_CLOSE_STREAM2 = (1 << 1),
G_IO_STREAM_SPLICE_WAIT_FOR_BOTH = (1 << 2)
} GIOStreamSpliceFlags;
/** /**
* GEmblemOrigin: * GEmblemOrigin:
* @G_EMBLEM_ORIGIN_UNKNOWN: Emblem of unknown origin * @G_EMBLEM_ORIGIN_UNKNOWN: Emblem of unknown origin
@ -1251,6 +1272,7 @@ typedef enum
/** /**
* GTlsError: * GTlsError:
* @G_TLS_ERROR_UNAVAILABLE: No TLS provider is available
* @G_TLS_ERROR_MISC: Miscellaneous TLS error * @G_TLS_ERROR_MISC: Miscellaneous TLS error
* @G_TLS_ERROR_BAD_CERTIFICATE: A certificate could not be parsed * @G_TLS_ERROR_BAD_CERTIFICATE: A certificate could not be parsed
* @G_TLS_ERROR_NOT_TLS: The TLS handshake failed because the * @G_TLS_ERROR_NOT_TLS: The TLS handshake failed because the
@ -1259,7 +1281,7 @@ typedef enum
* peer's certificate was not acceptable. * peer's certificate was not acceptable.
* @G_TLS_ERROR_CERTIFICATE_REQUIRED: The TLS handshake failed because * @G_TLS_ERROR_CERTIFICATE_REQUIRED: The TLS handshake failed because
* the server requested a client-side certificate, but none was * the server requested a client-side certificate, but none was
* provided. See #GTlsConnection::need-certificate. * provided. See g_tls_connection_set_certificate().
* @G_TLS_ERROR_EOF: The TLS connection was closed without proper * @G_TLS_ERROR_EOF: The TLS connection was closed without proper
* notice, which may indicate an attack. See * notice, which may indicate an attack. See
* g_tls_connection_set_require_close_notify(). * g_tls_connection_set_require_close_notify().
@ -1270,6 +1292,7 @@ typedef enum
* Since: 2.28 * Since: 2.28
*/ */
typedef enum { typedef enum {
G_TLS_ERROR_UNAVAILABLE,
G_TLS_ERROR_MISC, G_TLS_ERROR_MISC,
G_TLS_ERROR_BAD_CERTIFICATE, G_TLS_ERROR_BAD_CERTIFICATE,
G_TLS_ERROR_NOT_TLS, G_TLS_ERROR_NOT_TLS,

View File

@ -26,12 +26,12 @@
#include "giomodule.h" #include "giomodule.h"
#include "giomodule-priv.h" #include "giomodule-priv.h"
#include "gmemorysettingsbackend.h"
#include "glocalfilemonitor.h" #include "glocalfilemonitor.h"
#include "glocaldirectorymonitor.h" #include "glocaldirectorymonitor.h"
#include "gnativevolumemonitor.h" #include "gnativevolumemonitor.h"
#include "gproxyresolver.h" #include "gproxyresolver.h"
#include "gproxy.h" #include "gproxy.h"
#include "gsettingsbackendinternal.h"
#include "gsocks4proxy.h" #include "gsocks4proxy.h"
#include "gsocks4aproxy.h" #include "gsocks4aproxy.h"
#include "gsocks5proxy.h" #include "gsocks5proxy.h"
@ -598,6 +598,7 @@ _g_io_modules_ensure_loaded (void)
} }
/* Initialize types from built-in "modules" */ /* Initialize types from built-in "modules" */
g_null_settings_backend_get_type ();
g_memory_settings_backend_get_type (); g_memory_settings_backend_get_type ();
#if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_LINUX_INOTIFY_H) #if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_LINUX_INOTIFY_H)
_g_inotify_directory_monitor_get_type (); _g_inotify_directory_monitor_get_type ();

View File

@ -361,7 +361,7 @@ g_io_stream_real_close (GIOStream *stream,
/** /**
* g_io_stream_close: * g_io_stream_close:
* @stream: a #GIOStream * @stream: a #GIOStream
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Closes the stream, releasing resources related to it. This will also * Closes the stream, releasing resources related to it. This will also
@ -454,9 +454,9 @@ async_ready_close_callback_wrapper (GObject *source_object,
* g_io_stream_close_async: * g_io_stream_close_async:
* @stream: a #GIOStream * @stream: a #GIOStream
* @io_priority: the io priority of the request * @io_priority: the io priority of the request
* @callback: callback to call when the request is satisfied * @cancellable: (allow-none): optional cancellable object
* @user_data: the data to pass to callback function * @callback: (scope async): callback to call when the request is satisfied
* @cancellable: optional cancellable object * @user_data: (closure): the data to pass to callback function
* *
* Requests an asynchronous close of the stream, releasing resources * Requests an asynchronous close of the stream, releasing resources
* related to it. When the operation is finished @callback will be * related to it. When the operation is finished @callback will be
@ -606,3 +606,255 @@ g_io_stream_real_close_finish (GIOStream *stream,
g_io_stream_real_close_async); g_io_stream_real_close_async);
return TRUE; return TRUE;
} }
typedef struct
{
GIOStream *stream1;
GIOStream *stream2;
GIOStreamSpliceFlags flags;
gint io_priority;
GCancellable *cancellable;
gulong cancelled_id;
GCancellable *op1_cancellable;
GCancellable *op2_cancellable;
guint completed;
GError *error;
} SpliceContext;
static void
splice_context_free (SpliceContext *ctx)
{
g_object_unref (ctx->stream1);
g_object_unref (ctx->stream2);
if (ctx->cancellable != NULL)
g_object_unref (ctx->cancellable);
g_object_unref (ctx->op1_cancellable);
g_object_unref (ctx->op2_cancellable);
g_clear_error (&ctx->error);
g_slice_free (SpliceContext, ctx);
}
static void
splice_complete (GSimpleAsyncResult *simple,
SpliceContext *ctx)
{
if (ctx->cancelled_id != 0)
g_cancellable_disconnect (ctx->cancellable, ctx->cancelled_id);
ctx->cancelled_id = 0;
if (ctx->error != NULL)
g_simple_async_result_set_from_error (simple, ctx->error);
g_simple_async_result_complete (simple);
}
static void
splice_close_cb (GObject *iostream,
GAsyncResult *res,
gpointer user_data)
{
GSimpleAsyncResult *simple = user_data;
SpliceContext *ctx;
GError *error = NULL;
g_io_stream_close_finish (G_IO_STREAM (iostream), res, &error);
ctx = g_simple_async_result_get_op_res_gpointer (simple);
ctx->completed++;
/* Keep the first error that occured */
if (error != NULL && ctx->error == NULL)
ctx->error = error;
else
g_clear_error (&error);
/* If all operations are done, complete now */
if (ctx->completed == 4)
splice_complete (simple, ctx);
g_object_unref (simple);
}
static void
splice_cb (GObject *ostream,
GAsyncResult *res,
gpointer user_data)
{
GSimpleAsyncResult *simple = user_data;
SpliceContext *ctx;
GError *error = NULL;
g_output_stream_splice_finish (G_OUTPUT_STREAM (ostream), res, &error);
ctx = g_simple_async_result_get_op_res_gpointer (simple);
ctx->completed++;
/* ignore cancellation error if it was not requested by the user */
if (error != NULL &&
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
(ctx->cancellable == NULL ||
!g_cancellable_is_cancelled (ctx->cancellable)))
g_clear_error (&error);
/* Keep the first error that occured */
if (error != NULL && ctx->error == NULL)
ctx->error = error;
else
g_clear_error (&error);
if (ctx->completed == 1 &&
(ctx->flags & G_IO_STREAM_SPLICE_WAIT_FOR_BOTH) == 0)
{
/* We don't want to wait for the 2nd operation to finish, cancel it */
g_cancellable_cancel (ctx->op1_cancellable);
g_cancellable_cancel (ctx->op2_cancellable);
}
else if (ctx->completed == 2)
{
if (ctx->cancellable == NULL ||
!g_cancellable_is_cancelled (ctx->cancellable))
{
g_cancellable_reset (ctx->op1_cancellable);
g_cancellable_reset (ctx->op2_cancellable);
}
/* Close the IO streams if needed */
if ((ctx->flags & G_IO_STREAM_SPLICE_CLOSE_STREAM1) != 0)
g_io_stream_close_async (ctx->stream1, ctx->io_priority,
ctx->op1_cancellable, splice_close_cb, g_object_ref (simple));
else
ctx->completed++;
if ((ctx->flags & G_IO_STREAM_SPLICE_CLOSE_STREAM2) != 0)
g_io_stream_close_async (ctx->stream2, ctx->io_priority,
ctx->op2_cancellable, splice_close_cb, g_object_ref (simple));
else
ctx->completed++;
/* If all operations are done, complete now */
if (ctx->completed == 4)
splice_complete (simple, ctx);
}
g_object_unref (simple);
}
static void
splice_cancelled_cb (GCancellable *cancellable,
GSimpleAsyncResult *simple)
{
SpliceContext *ctx;
ctx = g_simple_async_result_get_op_res_gpointer (simple);
g_cancellable_cancel (ctx->op1_cancellable);
g_cancellable_cancel (ctx->op2_cancellable);
}
/**
* g_io_stream_splice_async:
* @stream1: a #GIOStream.
* @stream2: a #GIOStream.
* @flags: a set of #GIOStreamSpliceFlags.
* @io_priority: the io priority of the request.
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (scope async): a #GAsyncReadyCallback.
* @user_data: (closure): user data passed to @callback.
*
* Asyncronously splice the output stream of @stream1 to the input stream of
* @stream2, and splice the output stream of @stream2 to the input stream of
* @stream1.
*
* When the operation is finished @callback will be called.
* You can then call g_io_stream_splice_finish() to get the
* result of the operation.
*
* Since: 2.28
**/
void
g_io_stream_splice_async (GIOStream *stream1,
GIOStream *stream2,
GIOStreamSpliceFlags flags,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *simple;
SpliceContext *ctx;
GInputStream *istream;
GOutputStream *ostream;
if (cancellable != NULL && g_cancellable_is_cancelled (cancellable))
{
g_simple_async_report_error_in_idle (NULL, callback,
user_data, G_IO_ERROR, G_IO_ERROR_CANCELLED,
"Operation has been cancelled");
return;
}
ctx = g_slice_new0 (SpliceContext);
ctx->stream1 = g_object_ref (stream1);
ctx->stream2 = g_object_ref (stream2);
ctx->flags = flags;
ctx->io_priority = io_priority;
ctx->op1_cancellable = g_cancellable_new ();
ctx->op2_cancellable = g_cancellable_new ();
ctx->completed = 0;
simple = g_simple_async_result_new (NULL, callback, user_data,
g_io_stream_splice_finish);
g_simple_async_result_set_op_res_gpointer (simple, ctx,
(GDestroyNotify) splice_context_free);
if (cancellable != NULL)
{
ctx->cancellable = g_object_ref (cancellable);
ctx->cancelled_id = g_cancellable_connect (cancellable,
G_CALLBACK (splice_cancelled_cb), g_object_ref (simple),
g_object_unref);
}
istream = g_io_stream_get_input_stream (stream1);
ostream = g_io_stream_get_output_stream (stream2);
g_output_stream_splice_async (ostream, istream, G_OUTPUT_STREAM_SPLICE_NONE,
io_priority, ctx->op1_cancellable, splice_cb,
g_object_ref (simple));
istream = g_io_stream_get_input_stream (stream2);
ostream = g_io_stream_get_output_stream (stream1);
g_output_stream_splice_async (ostream, istream, G_OUTPUT_STREAM_SPLICE_NONE,
io_priority, ctx->op2_cancellable, splice_cb,
g_object_ref (simple));
g_object_unref (simple);
}
/**
* g_io_stream_splice_finish:
* @result: a #GAsyncResult.
* @error: a #GError location to store the error occuring, or %NULL to
* ignore.
*
* Finishes an asynchronous io stream splice operation.
*
* Returns: %TRUE on success, %FALSE otherwise.
*
* Since: 2.28
**/
gboolean
g_io_stream_splice_finish (GAsyncResult *result,
GError **error)
{
GSimpleAsyncResult *simple;
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
simple = G_SIMPLE_ASYNC_RESULT (result);
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL,
g_io_stream_splice_finish), FALSE);
return TRUE;
}

View File

@ -88,6 +88,17 @@ GType g_io_stream_get_type (void) G_GNUC_CONST;
GInputStream * g_io_stream_get_input_stream (GIOStream *stream); GInputStream * g_io_stream_get_input_stream (GIOStream *stream);
GOutputStream *g_io_stream_get_output_stream (GIOStream *stream); GOutputStream *g_io_stream_get_output_stream (GIOStream *stream);
void g_io_stream_splice_async (GIOStream *stream1,
GIOStream *stream2,
GIOStreamSpliceFlags flags,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_io_stream_splice_finish (GAsyncResult *result,
GError **error);
gboolean g_io_stream_close (GIOStream *stream, gboolean g_io_stream_close (GIOStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);

View File

@ -62,8 +62,9 @@ g_loadable_icon_default_init (GLoadableIconIface *iface)
* g_loadable_icon_load: * g_loadable_icon_load:
* @icon: a #GLoadableIcon. * @icon: a #GLoadableIcon.
* @size: an integer. * @size: an integer.
* @type: a location to store the type of the loaded icon, %NULL to ignore. * @type: (out) (allow-none): a location to store the type of the
* @cancellable: optional #GCancellable object, %NULL to ignore. * loaded icon, %NULL to ignore.
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
@ -92,9 +93,10 @@ g_loadable_icon_load (GLoadableIcon *icon,
* g_loadable_icon_load_async: * g_loadable_icon_load_async:
* @icon: a #GLoadableIcon. * @icon: a #GLoadableIcon.
* @size: an integer. * @size: an integer.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the
* @user_data: the data to pass to callback function * request is satisfied
* @user_data: (closure): the data to pass to callback function
* *
* Loads an icon asynchronously. To finish this function, see * Loads an icon asynchronously. To finish this function, see
* g_loadable_icon_load_finish(). For the synchronous, blocking * g_loadable_icon_load_finish(). For the synchronous, blocking

View File

@ -701,6 +701,8 @@ get_fs_type (long f_type)
return "xfs"; return "xfs";
case 0x012FD16D: case 0x012FD16D:
return "xiafs"; return "xiafs";
case 0x52345362:
return "reiser4";
default: default:
return NULL; return NULL;
} }

View File

@ -203,9 +203,9 @@ g_memory_input_stream_new (void)
/** /**
* g_memory_input_stream_new_from_data: * g_memory_input_stream_new_from_data:
* @data: input data * @data: (array length=len) (element-type guint8): input data
* @len: length of the data, may be -1 if @data is a nul-terminated string * @len: length of the data, may be -1 if @data is a nul-terminated string
* @destroy: function that is called to free @data, or %NULL * @destroy: (allow-none): function that is called to free @data, or %NULL
* *
* Creates a new #GMemoryInputStream with data in memory of a given size. * Creates a new #GMemoryInputStream with data in memory of a given size.
* *
@ -229,9 +229,9 @@ g_memory_input_stream_new_from_data (const void *data,
/** /**
* g_memory_input_stream_add_data: * g_memory_input_stream_add_data:
* @stream: a #GMemoryInputStream * @stream: a #GMemoryInputStream
* @data: input data * @data: (array length=len) (element-type guint8): input data
* @len: length of the data, may be -1 if @data is a nul-terminated string * @len: length of the data, may be -1 if @data is a nul-terminated string
* @destroy: function that is called to free @data, or %NULL * @destroy: (allow-none): function that is called to free @data, or %NULL
* *
* Appends @data to data that can be read from the input stream * Appends @data to data that can be read from the input stream
*/ */

View File

@ -194,7 +194,7 @@ g_memory_output_stream_class_init (GMemoryOutputStreamClass *klass)
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**
* GMemoryOutputStream:realloc-function: * GMemoryOutputStream:realloc-function: (skip)
* *
* Function with realloc semantics called to enlarge the buffer. * Function with realloc semantics called to enlarge the buffer.
* *
@ -209,7 +209,7 @@ g_memory_output_stream_class_init (GMemoryOutputStreamClass *klass)
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**
* GMemoryOutputStream:destroy-function: * GMemoryOutputStream:destroy-function: (skip)
* *
* Function called with the buffer as argument when the stream is destroyed. * Function called with the buffer as argument when the stream is destroyed.
* *
@ -328,7 +328,7 @@ g_memory_output_stream_init (GMemoryOutputStream *stream)
} }
/** /**
* g_memory_output_stream_new: * g_memory_output_stream_new: (skip)
* @data: pointer to a chunk of memory to use, or %NULL * @data: pointer to a chunk of memory to use, or %NULL
* @size: the size of @data * @size: the size of @data
* @realloc_function: a function with realloc() semantics (like g_realloc()) * @realloc_function: a function with realloc() semantics (like g_realloc())
@ -376,7 +376,7 @@ g_memory_output_stream_new (gpointer data,
} }
/** /**
* g_memory_output_stream_get_data: (skip) * g_memory_output_stream_get_data:
* @ostream: a #GMemoryOutputStream * @ostream: a #GMemoryOutputStream
* *
* Gets any loaded data from the @ostream. * Gets any loaded data from the @ostream.
@ -384,7 +384,7 @@ g_memory_output_stream_new (gpointer data,
* Note that the returned pointer may become invalid on the next * Note that the returned pointer may become invalid on the next
* write or truncate operation on the stream. * write or truncate operation on the stream.
* *
* Returns: pointer to the stream's data * Returns: (transfer none): pointer to the stream's data
**/ **/
gpointer gpointer
g_memory_output_stream_get_data (GMemoryOutputStream *ostream) g_memory_output_stream_get_data (GMemoryOutputStream *ostream)
@ -398,7 +398,7 @@ g_memory_output_stream_get_data (GMemoryOutputStream *ostream)
* g_memory_output_stream_get_size: * g_memory_output_stream_get_size:
* @ostream: a #GMemoryOutputStream * @ostream: a #GMemoryOutputStream
* *
* Gets the size of the currently allocated data area (availible from * Gets the size of the currently allocated data area (available from
* g_memory_output_stream_get_data()). If the stream isn't * g_memory_output_stream_get_data()). If the stream isn't
* growable (no realloc was passed to g_memory_output_stream_new()) then * growable (no realloc was passed to g_memory_output_stream_new()) then
* this is the maximum size of the stream and further writes * this is the maximum size of the stream and further writes

View File

@ -22,9 +22,8 @@
#include "config.h" #include "config.h"
#include "gmemorysettingsbackend.h"
#include "gsimplepermission.h" #include "gsimplepermission.h"
#include "gsettingsbackend.h" #include "gsettingsbackendinternal.h"
#include "giomodule.h" #include "giomodule.h"
@ -370,3 +369,9 @@ g_memory_settings_backend_class_init (GMemorySettingsBackendClass *class)
backend_class->remove = g_memory_settings_backend_remove; backend_class->remove = g_memory_settings_backend_remove;
object_class->finalize = g_memory_settings_backend_finalize; object_class->finalize = g_memory_settings_backend_finalize;
} }
GSettingsBackend *
g_memory_settings_backend_new (void)
{
return g_object_new (G_TYPE_MEMORY_SETTINGS_BACKEND, NULL);
}

View File

@ -1,30 +0,0 @@
/*
* 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>
*/
#ifndef __GMEMORY_SETTINGS_BACKEND_H__
#define __GMEMORY_SETTINGS_BACKEND_H__
#include <glib-object.h>
G_GNUC_INTERNAL
GType g_memory_settings_backend_get_type (void);
#endif /* __G_MEMORY_SETTINGS_BACKEND_H__ */

View File

@ -329,8 +329,8 @@ g_mount_can_eject (GMount *mount)
* g_mount_unmount: * g_mount_unmount:
* @mount: a #GMount. * @mount: a #GMount.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback, or %NULL. * @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Unmounts a mount. This is an asynchronous operation, and is * Unmounts a mount. This is an asynchronous operation, and is
@ -408,8 +408,8 @@ g_mount_unmount_finish (GMount *mount,
* g_mount_eject: * g_mount_eject:
* @mount: a #GMount. * @mount: a #GMount.
* @flags: flags affecting the unmount if required for eject * @flags: flags affecting the unmount if required for eject
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback, or %NULL. * @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Ejects a mount. This is an asynchronous operation, and is * Ejects a mount. This is an asynchronous operation, and is
@ -486,9 +486,10 @@ g_mount_eject_finish (GMount *mount,
* g_mount_unmount_with_operation: * g_mount_unmount_with_operation:
* @mount: a #GMount. * @mount: a #GMount.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @mount_operation: a #GMountOperation or %NULL to avoid user interaction. * @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* @cancellable: optional #GCancellable object, %NULL to ignore. * user interaction.
* @callback: a #GAsyncReadyCallback, or %NULL. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Unmounts a mount. This is an asynchronous operation, and is * Unmounts a mount. This is an asynchronous operation, and is
@ -573,9 +574,10 @@ g_mount_unmount_with_operation_finish (GMount *mount,
* g_mount_eject_with_operation: * g_mount_eject_with_operation:
* @mount: a #GMount. * @mount: a #GMount.
* @flags: flags affecting the unmount if required for eject * @flags: flags affecting the unmount if required for eject
* @mount_operation: a #GMountOperation or %NULL to avoid user interaction. * @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* @cancellable: optional #GCancellable object, %NULL to ignore. * user interaction.
* @callback: a #GAsyncReadyCallback, or %NULL. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Ejects a mount. This is an asynchronous operation, and is * Ejects a mount. This is an asynchronous operation, and is
@ -658,9 +660,10 @@ g_mount_eject_with_operation_finish (GMount *mount,
* g_mount_remount: * g_mount_remount:
* @mount: a #GMount. * @mount: a #GMount.
* @flags: flags affecting the operation * @flags: flags affecting the operation
* @mount_operation: a #GMountOperation or %NULL to avoid user interaction. * @mount_operation: (allow-none): a #GMountOperation or %NULL to avoid
* @cancellable: optional #GCancellable object, %NULL to ignore. * user interaction.
* @callback: a #GAsyncReadyCallback, or %NULL. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Remounts a mount. This is an asynchronous operation, and is * Remounts a mount. This is an asynchronous operation, and is
@ -741,7 +744,7 @@ g_mount_remount_finish (GMount *mount,
* @mount: a #GMount * @mount: a #GMount
* @force_rescan: Whether to force a rescan of the content. * @force_rescan: Whether to force a rescan of the content.
* Otherwise a cached result will be used if available * Otherwise a cached result will be used if available
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @callback: a #GAsyncReadyCallback * @callback: a #GAsyncReadyCallback
* @user_data: user data passed to @callback * @user_data: user data passed to @callback
* *
@ -831,7 +834,7 @@ g_mount_guess_content_type_finish (GMount *mount,
* @mount: a #GMount * @mount: a #GMount
* @force_rescan: Whether to force a rescan of the content. * @force_rescan: Whether to force a rescan of the content.
* Otherwise a cached result will be used if available * Otherwise a cached result will be used if available
* @cancellable: optional #GCancellable object, %NULL to ignore * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore * ignore
* *

View File

@ -781,7 +781,8 @@ typedef struct {
GSocketAddressEnumerator parent_instance; GSocketAddressEnumerator parent_instance;
GNetworkAddress *addr; GNetworkAddress *addr;
GList *a; GList *addresses;
GList *next;
} GNetworkAddressAddressEnumerator; } GNetworkAddressAddressEnumerator;
typedef struct { typedef struct {
@ -811,6 +812,8 @@ g_network_address_address_enumerator_next (GSocketAddressEnumerator *enumerator
G_NETWORK_ADDRESS_ADDRESS_ENUMERATOR (enumerator); G_NETWORK_ADDRESS_ADDRESS_ENUMERATOR (enumerator);
GSocketAddress *sockaddr; GSocketAddress *sockaddr;
if (addr_enum->addresses == NULL)
{
if (!addr_enum->addr->priv->sockaddrs) if (!addr_enum->addr->priv->sockaddrs)
{ {
GResolver *resolver = g_resolver_get_default (); GResolver *resolver = g_resolver_get_default ();
@ -825,17 +828,18 @@ g_network_address_address_enumerator_next (GSocketAddressEnumerator *enumerator
return NULL; return NULL;
g_network_address_set_addresses (addr_enum->addr, addresses); g_network_address_set_addresses (addr_enum->addr, addresses);
addr_enum->a = addr_enum->addr->priv->sockaddrs;
} }
if (!addr_enum->a) addr_enum->addresses = addr_enum->addr->priv->sockaddrs;
return NULL; addr_enum->next = addr_enum->addresses;
else
{
sockaddr = addr_enum->a->data;
addr_enum->a = addr_enum->a->next;
return g_object_ref (sockaddr);
} }
if (addr_enum->next == NULL)
return NULL;
sockaddr = addr_enum->next->data;
addr_enum->next = addr_enum->next->next;
return g_object_ref (sockaddr);
} }
static void static void
@ -850,24 +854,21 @@ got_addresses (GObject *source_object,
GList *addresses; GList *addresses;
GError *error = NULL; GError *error = NULL;
addresses = g_resolver_lookup_by_name_finish (resolver, result, &error);
if (!addr_enum->addr->priv->sockaddrs) if (!addr_enum->addr->priv->sockaddrs)
{ {
addresses = g_resolver_lookup_by_name_finish (resolver, result, &error);
if (error) if (error)
{
g_simple_async_result_take_error (simple, error); g_simple_async_result_take_error (simple, error);
}
else else
{
g_network_address_set_addresses (addr_enum->addr, addresses); g_network_address_set_addresses (addr_enum->addr, addresses);
addr_enum->a = addr_enum->addr->priv->sockaddrs;
} }
}
else if (error)
g_error_free (error);
g_object_unref (resolver); g_object_unref (resolver);
addr_enum->addresses = addr_enum->addr->priv->sockaddrs;
addr_enum->next = addr_enum->addresses;
g_simple_async_result_complete (simple); g_simple_async_result_complete (simple);
g_object_unref (simple); g_object_unref (simple);
} }
@ -886,6 +887,8 @@ g_network_address_address_enumerator_next_async (GSocketAddressEnumerator *enum
callback, user_data, callback, user_data,
g_network_address_address_enumerator_next_async); g_network_address_address_enumerator_next_async);
if (addr_enum->addresses == NULL)
{
if (!addr_enum->addr->priv->sockaddrs) if (!addr_enum->addr->priv->sockaddrs)
{ {
GResolver *resolver = g_resolver_get_default (); GResolver *resolver = g_resolver_get_default ();
@ -895,12 +898,15 @@ g_network_address_address_enumerator_next_async (GSocketAddressEnumerator *enum
addr_enum->addr->priv->hostname, addr_enum->addr->priv->hostname,
cancellable, cancellable,
got_addresses, simple); got_addresses, simple);
return;
} }
else
{ addr_enum->addresses = addr_enum->addr->priv->sockaddrs;
addr_enum->next = addr_enum->addresses;
}
g_simple_async_result_complete_in_idle (simple); g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple); g_object_unref (simple);
}
} }
static GSocketAddress * static GSocketAddress *
@ -915,12 +921,12 @@ g_network_address_address_enumerator_next_finish (GSocketAddressEnumerator *enu
if (g_simple_async_result_propagate_error (simple, error)) if (g_simple_async_result_propagate_error (simple, error))
return NULL; return NULL;
else if (!addr_enum->a) else if (!addr_enum->next)
return NULL; return NULL;
else else
{ {
sockaddr = addr_enum->a->data; sockaddr = addr_enum->next->data;
addr_enum->a = addr_enum->a->next; addr_enum->next = addr_enum->next->next;
return g_object_ref (sockaddr); return g_object_ref (sockaddr);
} }
} }

View File

@ -21,7 +21,8 @@
#include "config.h" #include "config.h"
#include "gnullsettingsbackend.h" #include "gsettingsbackendinternal.h"
#include "giomodule.h"
#include "gsimplepermission.h" #include "gsimplepermission.h"
@ -34,10 +35,11 @@
typedef GSettingsBackendClass GNullSettingsBackendClass; typedef GSettingsBackendClass GNullSettingsBackendClass;
typedef GSettingsBackend GNullSettingsBackend; typedef GSettingsBackend GNullSettingsBackend;
static GType g_null_settings_backend_get_type (void); G_DEFINE_TYPE_WITH_CODE (GNullSettingsBackend,
G_DEFINE_TYPE (GNullSettingsBackend,
g_null_settings_backend, g_null_settings_backend,
G_TYPE_SETTINGS_BACKEND) G_TYPE_SETTINGS_BACKEND,
g_io_extension_point_implement (G_SETTINGS_BACKEND_EXTENSION_POINT_NAME,
g_define_type_id, "null", 10))
static GVariant * static GVariant *
g_null_settings_backend_read (GSettingsBackend *backend, g_null_settings_backend_read (GSettingsBackend *backend,

View File

@ -1,30 +0,0 @@
/*
* 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>
*/
#ifndef __G_NULL_SETTINGS_BACKEND_H__
#define __G_NULL_SETTINGS_BACKEND_H__
#include <gio/gsettingsbackend.h>
G_GNUC_INTERNAL
GSettingsBackend * g_null_settings_backend_new (void);
#endif /* __G_NULL_SETTINGS_BACKEND_H__ */

View File

@ -150,7 +150,7 @@ g_output_stream_init (GOutputStream *stream)
* @stream: a #GOutputStream. * @stream: a #GOutputStream.
* @buffer: (array length=count) (element-type guint8): 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 * @count: the number of bytes to write
* @cancellable: optional cancellable object * @cancellable: (allow-none): optional cancellable object
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Tries to write @count bytes from @buffer into the stream. Will block * Tries to write @count bytes from @buffer into the stream. Will block
@ -229,9 +229,9 @@ g_output_stream_write (GOutputStream *stream,
* @stream: a #GOutputStream. * @stream: a #GOutputStream.
* @buffer: (array length=count) (element-type guint8): 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 * @count: the number of bytes to write
* @bytes_written: location to store the number of bytes that was * @bytes_written: (out): location to store the number of bytes that was
* written to the stream * written to the stream
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Tries to write @count bytes from @buffer into the stream. Will block * Tries to write @count bytes from @buffer into the stream. Will block
@ -290,7 +290,7 @@ g_output_stream_write_all (GOutputStream *stream,
/** /**
* g_output_stream_flush: * g_output_stream_flush:
* @stream: a #GOutputStream. * @stream: a #GOutputStream.
* @cancellable: optional cancellable object * @cancellable: (allow-none): optional cancellable object
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Flushed any outstanding buffers in the stream. Will block during * Flushed any outstanding buffers in the stream. Will block during
@ -341,7 +341,7 @@ g_output_stream_flush (GOutputStream *stream,
* @stream: a #GOutputStream. * @stream: a #GOutputStream.
* @source: a #GInputStream. * @source: a #GInputStream.
* @flags: a set of #GOutputStreamSpliceFlags. * @flags: a set of #GOutputStreamSpliceFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
@ -468,7 +468,7 @@ g_output_stream_real_splice (GOutputStream *stream,
/** /**
* g_output_stream_close: * g_output_stream_close:
* @stream: A #GOutputStream. * @stream: A #GOutputStream.
* @cancellable: optional cancellable object * @cancellable: (allow-none): optional cancellable object
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Closes the stream, releasing resources related to it. * Closes the stream, releasing resources related to it.
@ -655,9 +655,9 @@ async_ready_close_flushed_callback_wrapper (GObject *source_object,
* @buffer: (array length=count) (element-type guint8): 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 * @count: the number of bytes to write
* @io_priority: the io priority of the request. * @io_priority: the io priority of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied * @callback: (scope async): callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Request an asynchronous write of @count bytes from @buffer into * Request an asynchronous write of @count bytes from @buffer into
* the stream. When the operation is finished @callback will be called. * the stream. When the operation is finished @callback will be called.
@ -812,9 +812,9 @@ async_ready_splice_callback_wrapper (GObject *source_object,
* @source: a #GInputStream. * @source: a #GInputStream.
* @flags: a set of #GOutputStreamSpliceFlags. * @flags: a set of #GOutputStreamSpliceFlags.
* @io_priority: the io priority of the request. * @io_priority: the io priority of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback. * @callback: (scope async): a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: (closure): user data passed to @callback.
* *
* Splices a stream asynchronously. * Splices a stream asynchronously.
* When the operation is finished @callback will be called. * When the operation is finished @callback will be called.
@ -908,9 +908,9 @@ g_output_stream_splice_finish (GOutputStream *stream,
* g_output_stream_flush_async: * g_output_stream_flush_async:
* @stream: a #GOutputStream. * @stream: a #GOutputStream.
* @io_priority: the io priority of the request. * @io_priority: the io priority of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: (closure): the data to pass to callback function
* *
* Flushes a stream asynchronously. * Flushes a stream asynchronously.
* For behaviour details see g_output_stream_flush(). * For behaviour details see g_output_stream_flush().
@ -1003,9 +1003,9 @@ g_output_stream_flush_finish (GOutputStream *stream,
* g_output_stream_close_async: * g_output_stream_close_async:
* @stream: A #GOutputStream. * @stream: A #GOutputStream.
* @io_priority: the io priority of the request. * @io_priority: the io priority of the request.
* @callback: callback to call when the request is satisfied * @cancellable: (allow-none): optional cancellable object
* @user_data: the data to pass to callback function * @callback: (scope async): callback to call when the request is satisfied
* @cancellable: optional cancellable object * @user_data: (closure): the data to pass to callback function
* *
* Requests an asynchronous close of the stream, releasing resources * Requests an asynchronous close of the stream, releasing resources
* related to it. When the operation is finished @callback will be * related to it. When the operation is finished @callback will be

View File

@ -100,7 +100,7 @@ struct _GOutputStreamClass
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer data); gpointer user_data);
gssize (* splice_finish) (GOutputStream *stream, gssize (* splice_finish) (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);

View File

@ -1,765 +0,0 @@
/*
* 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 #GPeriodicTickFuncs 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;
/**
* GPeriodic::tick
* @periodic: the #GPeriodic on which the signal was emitted
* @timestamp: the timestamp at the time of the tick
*
* The ::tick signal gets emitted whenever the clock "fires".
*/
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);
/**
* GPeriodic::repair:
* @periodic: the #GPeriodic on which the signal was emitted
*
* The ::repair signal gets emitted to start the "repair" phase.
*/
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 #GPeriodic::repair
* signal.
*
* If this function is called, emission of the #GPeriodic::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 #GPeriodic: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, in case 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 frequency 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)
* @high_priority: the #GSource priority to run at
* @low_priority: ignore tasks below this priority
*
* 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);
}

View File

@ -1,88 +0,0 @@
/*
* 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__ */

View File

@ -115,9 +115,9 @@ g_pollable_input_stream_is_readable (GPollableInputStream *stream)
} }
/** /**
* g_pollable_input_stream_create_source: * g_pollable_input_stream_create_source: (skip)
* @stream: a #GPollableInputStream. * @stream: a #GPollableInputStream.
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* *
* Creates a #GSource that triggers when @stream can be read, or * Creates a #GSource that triggers when @stream can be read, or
* @cancellable is triggered or an error occurs. The callback on the * @cancellable is triggered or an error occurs. The callback on the
@ -128,7 +128,7 @@ g_pollable_input_stream_is_readable (GPollableInputStream *stream)
* triggers, so you should use g_pollable_input_stream_read_nonblocking() * triggers, so you should use g_pollable_input_stream_read_nonblocking()
* rather than g_input_stream_read() from the callback. * rather than g_input_stream_read() from the callback.
* *
* Returns: a new #GSource * Returns: (transfer full): a new #GSource
* *
* Since: 2.28 * Since: 2.28
*/ */
@ -165,7 +165,7 @@ g_pollable_input_stream_default_read_nonblocking (GPollableInputStream *stream,
* @buffer: a buffer to read data into (which should be at least @size * @buffer: a buffer to read data into (which should be at least @size
* bytes long). * bytes long).
* @size: the number of bytes you want to read * @size: the number of bytes you want to read
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Attempts to read up to @size bytes from @stream into @buffer, as * Attempts to read up to @size bytes from @stream into @buffer, as
@ -180,6 +180,7 @@ g_pollable_input_stream_default_read_nonblocking (GPollableInputStream *stream,
* may happen if you call this method after a source triggers due * may happen if you call this method after a source triggers due
* to having been cancelled. * to having been cancelled.
* *
* Virtual: read_nonblocking
* Return value: the number of bytes read, or -1 on error (including * Return value: the number of bytes read, or -1 on error (including
* %G_IO_ERROR_WOULD_BLOCK). * %G_IO_ERROR_WOULD_BLOCK).
*/ */
@ -275,7 +276,7 @@ static GSourceFuncs pollable_source_funcs =
}; };
/** /**
* g_pollable_source_new: * g_pollable_source_new: (skip)
* @pollable_stream: the stream associated with the new source * @pollable_stream: the stream associated with the new source
* *
* Utility method for #GPollableInputStream and #GPollableOutputStream * Utility method for #GPollableInputStream and #GPollableOutputStream
@ -284,7 +285,7 @@ static GSourceFuncs pollable_source_funcs =
* anything on its own; use g_source_add_child_source() to add other * anything on its own; use g_source_add_child_source() to add other
* sources to it to cause it to trigger. * sources to it to cause it to trigger.
* *
* Return value: the new #GSource. * Return value: (transfer full): the new #GSource.
* *
* Since: 2.28 * Since: 2.28
*/ */

View File

@ -116,9 +116,9 @@ g_pollable_output_stream_is_writable (GPollableOutputStream *stream)
} }
/** /**
* g_pollable_output_stream_create_source: * g_pollable_output_stream_create_source: (skip)
* @stream: a #GPollableOutputStream. * @stream: a #GPollableOutputStream.
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* *
* Creates a #GSource that triggers when @stream can be written, or * Creates a #GSource that triggers when @stream can be written, or
* @cancellable is triggered or an error occurs. The callback on the * @cancellable is triggered or an error occurs. The callback on the
@ -129,7 +129,7 @@ g_pollable_output_stream_is_writable (GPollableOutputStream *stream)
* triggers, so you should use g_pollable_output_stream_write_nonblocking() * triggers, so you should use g_pollable_output_stream_write_nonblocking()
* rather than g_output_stream_write() from the callback. * rather than g_output_stream_write() from the callback.
* *
* Returns: a new #GSource * Returns: (transfer full): a new #GSource
* *
* Since: 2.28 * Since: 2.28
*/ */
@ -163,9 +163,10 @@ g_pollable_output_stream_default_write_nonblocking (GPollableOutputStream *stre
/** /**
* g_pollable_output_stream_write_nonblocking: * g_pollable_output_stream_write_nonblocking:
* @stream: a #GPollableOutputStream * @stream: a #GPollableOutputStream
* @buffer: a buffer to write data from * @buffer: (array length=size) (element-type guint8): a buffer to write
* data from
* @size: the number of bytes you want to write * @size: the number of bytes you want to write
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Attempts to write up to @size bytes from @buffer to @stream, as * Attempts to write up to @size bytes from @buffer to @stream, as
@ -180,6 +181,7 @@ g_pollable_output_stream_default_write_nonblocking (GPollableOutputStream *stre
* may happen if you call this method after a source triggers due * may happen if you call this method after a source triggers due
* to having been cancelled. * to having been cancelled.
* *
* Virtual: write_nonblocking
* Return value: the number of bytes written, or -1 on error (including * Return value: the number of bytes written, or -1 on error (including
* %G_IO_ERROR_WOULD_BLOCK). * %G_IO_ERROR_WOULD_BLOCK).
*/ */

View File

@ -56,7 +56,8 @@ g_proxy_default_init (GProxyInterface *iface)
* Lookup "gio-proxy" extension point for a proxy implementation that supports * Lookup "gio-proxy" extension point for a proxy implementation that supports
* specified protocol. * specified protocol.
* *
* Return value: return a #GProxy or NULL if protocol is not supported. * Return value: (transfer full): return a #GProxy or NULL if protocol
* is not supported.
* *
* Since: 2.26 * Since: 2.26
**/ **/
@ -84,7 +85,7 @@ g_proxy_get_default_for_protocol (const gchar *protocol)
* @proxy: a #GProxy * @proxy: a #GProxy
* @connection: a #GIOStream * @connection: a #GIOStream
* @proxy_address: a #GProxyAddress * @proxy_address: a #GProxyAddress
* @cancellable: a #GCancellable * @cancellable: (allow-none): a #GCancellable
* @error: return #GError * @error: return #GError
* *
* Given @connection to communicate with a proxy (eg, a * Given @connection to communicate with a proxy (eg, a
@ -123,9 +124,9 @@ g_proxy_connect (GProxy *proxy,
* @proxy: a #GProxy * @proxy: a #GProxy
* @connection: a #GIOStream * @connection: a #GIOStream
* @proxy_address: a #GProxyAddress * @proxy_address: a #GProxyAddress
* @cancellable: a #GCancellable * @cancellable: (allow-none): a #GCancellable
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: callback data * @user_data: (closure): callback data
* *
* Asynchronous version of g_proxy_connect(). * Asynchronous version of g_proxy_connect().
* *

View File

@ -233,8 +233,10 @@ g_proxy_address_init (GProxyAddress *proxy)
* @protocol: The proxy protocol to support, in lower case (e.g. socks, http). * @protocol: The proxy protocol to support, in lower case (e.g. socks, http).
* @dest_hostname: The destination hostname the the proxy should tunnel to. * @dest_hostname: The destination hostname the the proxy should tunnel to.
* @dest_port: The destination port to tunnel to. * @dest_port: The destination port to tunnel to.
* @username: The username to authenticate to the proxy server (or %NULL). * @username: (allow-none): The username to authenticate to the proxy server
* @password: The password to authenticate to the proxy server (or %NULL). * (or %NULL).
* @password: (allow-none): The password to authenticate to the proxy server
* (or %NULL).
* *
* Creates a new #GProxyAddress for @inetaddr with @protocol that should * Creates a new #GProxyAddress for @inetaddr with @protocol that should
* tunnel through @dest_hostname and @dest_port. * tunnel through @dest_hostname and @dest_port.

View File

@ -141,7 +141,7 @@ g_proxy_resolver_is_supported (GProxyResolver *resolver)
* g_proxy_resolver_lookup: * g_proxy_resolver_lookup:
* @resolver: a #GProxyResolver * @resolver: a #GProxyResolver
* @uri: a URI representing the destination to connect to * @uri: a URI representing the destination to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Looks into the system proxy configuration to determine what proxy, * Looks into the system proxy configuration to determine what proxy,
@ -160,8 +160,9 @@ g_proxy_resolver_is_supported (GProxyResolver *resolver)
* Direct connection should not be attempted unless it is part of the * Direct connection should not be attempted unless it is part of the
* returned array of proxies. * returned array of proxies.
* *
* Return value: (transfer full) (element-type utf8): A NULL-terminated array of proxy URIs. Must be freed with * Return value: (transfer full) (array zero-terminated=1): A
* g_strfreev(). * NULL-terminated array of proxy URIs. Must be freed
* with g_strfreev().
* *
* Since: 2.26 * Since: 2.26
*/ */
@ -185,9 +186,9 @@ g_proxy_resolver_lookup (GProxyResolver *resolver,
* g_proxy_resolver_lookup_async: * g_proxy_resolver_lookup_async:
* @resolver: a #GProxyResolver * @resolver: a #GProxyResolver
* @uri: a URI representing the destination to connect to * @uri: a URI representing the destination to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: callback to call after resolution completes * @callback: (scope async): callback to call after resolution completes
* @user_data: data for @callback * @user_data: (closure): data for @callback
* *
* Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more * Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
* details. * details.
@ -221,8 +222,9 @@ g_proxy_resolver_lookup_async (GProxyResolver *resolver,
* g_proxy_resolver_lookup_async() is complete. See * g_proxy_resolver_lookup_async() is complete. See
* g_proxy_resolver_lookup() for more details. * g_proxy_resolver_lookup() for more details.
* *
* Return value: (transfer full) (element-type utf8): A NULL-terminated array of proxy URIs. Must be freed with * Return value: (transfer full) (array zero-terminated=1): A
* g_strfreev(). * NULL-terminated array of proxy URIs. Must be freed
* with g_strfreev().
* *
* Since: 2.26 * Since: 2.26
*/ */

View File

@ -215,7 +215,7 @@ g_resolver_maybe_reload (GResolver *resolver)
* g_resolver_lookup_by_name: * g_resolver_lookup_by_name:
* @resolver: a #GResolver * @resolver: a #GResolver
* @hostname: the hostname to look up * @hostname: the hostname to look up
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Synchronously resolves @hostname to determine its associated IP * Synchronously resolves @hostname to determine its associated IP
@ -279,9 +279,9 @@ g_resolver_lookup_by_name (GResolver *resolver,
* g_resolver_lookup_by_name_async: * g_resolver_lookup_by_name_async:
* @resolver: a #GResolver * @resolver: a #GResolver
* @hostname: the hostname to look up the address of * @hostname: the hostname to look up the address of
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: callback to call after resolution completes * @callback: (scope async): callback to call after resolution completes
* @user_data: data for @callback * @user_data: (closure): data for @callback
* *
* Begins asynchronously resolving @hostname to determine its * Begins asynchronously resolving @hostname to determine its
* associated IP address(es), and eventually calls @callback, which * associated IP address(es), and eventually calls @callback, which
@ -401,7 +401,7 @@ g_resolver_free_addresses (GList *addresses)
* g_resolver_lookup_by_address: * g_resolver_lookup_by_address:
* @resolver: a #GResolver * @resolver: a #GResolver
* @address: the address to reverse-resolve * @address: the address to reverse-resolve
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Synchronously reverse-resolves @address to determine its * Synchronously reverse-resolves @address to determine its
@ -437,9 +437,9 @@ g_resolver_lookup_by_address (GResolver *resolver,
* g_resolver_lookup_by_address_async: * g_resolver_lookup_by_address_async:
* @resolver: a #GResolver * @resolver: a #GResolver
* @address: the address to reverse-resolve * @address: the address to reverse-resolve
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: callback to call after resolution completes * @callback: (scope async): callback to call after resolution completes
* @user_data: data for @callback * @user_data: (closure): data for @callback
* *
* Begins asynchronously reverse-resolving @address to determine its * Begins asynchronously reverse-resolving @address to determine its
* associated hostname, and eventually calls @callback, which must * associated hostname, and eventually calls @callback, which must
@ -521,7 +521,7 @@ g_resolver_get_service_rrname (const char *service,
* @service: the service type to look up (eg, "ldap") * @service: the service type to look up (eg, "ldap")
* @protocol: the networking protocol to use for @service (eg, "tcp") * @protocol: the networking protocol to use for @service (eg, "tcp")
* @domain: the DNS domain to look up the service in * @domain: the DNS domain to look up the service in
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Synchronously performs a DNS SRV lookup for the given @service and * Synchronously performs a DNS SRV lookup for the given @service and
@ -585,9 +585,9 @@ g_resolver_lookup_service (GResolver *resolver,
* @service: the service type to look up (eg, "ldap") * @service: the service type to look up (eg, "ldap")
* @protocol: the networking protocol to use for @service (eg, "tcp") * @protocol: the networking protocol to use for @service (eg, "tcp")
* @domain: the DNS domain to look up the service in * @domain: the DNS domain to look up the service in
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: callback to call after resolution completes * @callback: (scope async): callback to call after resolution completes
* @user_data: data for @callback * @user_data: (closure): data for @callback
* *
* Begins asynchronously performing a DNS SRV lookup for the given * Begins asynchronously performing a DNS SRV lookup for the given
* @service and @protocol in the given @domain, and eventually calls * @service and @protocol in the given @domain, and eventually calls

View File

@ -1,10 +1,12 @@
<!ELEMENT schemalist (schema|enum)* > <!ELEMENT schemalist (schema|enum)* >
<!ATTLIST schemalist gettext-domain #IMPLIED > <!ATTLIST schemalist gettext-domain #IMPLIED >
<!ELEMENT schema (key|child)* > <!ELEMENT schema (key|child|override)* >
<!ATTLIST schema id CDATA #REQUIRED <!ATTLIST schema id CDATA #REQUIRED
path CDATA #IMPLIED path CDATA #IMPLIED
gettext-domain CDATA #IMPLIED > gettext-domain CDATA #IMPLIED
extends CDATA #IMPLIED
list-of CDATA #IMPLIED >
<!-- enumerated and flags types --> <!-- enumerated and flags types -->
<!-- each value element maps a nick to a numeric value --> <!-- each value element maps a nick to a numeric value -->
@ -64,3 +66,8 @@
<!ELEMENT child EMPTY > <!ELEMENT child EMPTY >
<!ATTLIST child name CDATA #REQUIRED <!ATTLIST child name CDATA #REQUIRED
schema CDATA #REQUIRED > schema CDATA #REQUIRED >
<!ELEMENT override (#PCDATA) >
<!ATTLIST override name CDATA #REQUIRED
l10n CDATA #IMPLIED
context CDATA #IMPLIED >

View File

@ -89,7 +89,7 @@ g_seekable_can_seek (GSeekable *seekable)
* @seekable: a #GSeekable. * @seekable: a #GSeekable.
* @offset: a #goffset. * @offset: a #goffset.
* @type: a #GSeekType. * @type: a #GSeekType.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
@ -143,7 +143,7 @@ g_seekable_can_truncate (GSeekable *seekable)
* g_seekable_truncate: * g_seekable_truncate:
* @seekable: a #GSeekable. * @seekable: a #GSeekable.
* @offset: a #goffset. * @offset: a #goffset.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *

View File

@ -408,7 +408,9 @@ gsettings_set (GSettings *settings,
* To handle this case, try to parse again with an extra level * To handle this case, try to parse again with an extra level
* of quotes. * of quotes.
*/ */
if (new == NULL && strstr (error->message, "unknown keyword")) if (new == NULL &&
g_error_matches (error, G_VARIANT_PARSE_ERROR,
G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD))
{ {
value = freeme = g_strdup_printf ("\"%s\"", value); value = freeme = g_strdup_printf ("\"%s\"", value);
new = g_variant_parse (type, value, NULL, NULL, NULL); new = g_variant_parse (type, value, NULL, NULL, NULL);

View File

@ -223,6 +223,7 @@ enum
PROP_BACKEND, PROP_BACKEND,
PROP_PATH, PROP_PATH,
PROP_HAS_UNAPPLIED, PROP_HAS_UNAPPLIED,
PROP_DELAY_APPLY
}; };
enum enum
@ -448,6 +449,10 @@ g_settings_get_property (GObject *object,
g_value_set_boolean (value, g_settings_get_has_unapplied (settings)); g_value_set_boolean (value, g_settings_get_has_unapplied (settings));
break; break;
case PROP_DELAY_APPLY:
g_value_set_boolean (value, settings->priv->delayed != NULL);
break;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
} }
@ -567,7 +572,8 @@ g_settings_class_init (GSettingsClass *class)
/** /**
* GSettings::change-event: * GSettings::change-event:
* @settings: the object on which the signal was emitted * @settings: the object on which the signal was emitted
* @keys: an array of #GQuark<!-- -->s for the changed keys, or %NULL * @keys: (array length=n_keys) (element-type GQuark) (allow-none):
* an array of #GQuark<!-- -->s for the changed keys, or %NULL
* @n_keys: the length of the @keys array, or 0 * @n_keys: the length of the @keys array, or 0
* @returns: %TRUE to stop other handlers from being invoked for the * @returns: %TRUE to stop other handlers from being invoked for the
* event. FALSE to propagate the event further. * event. FALSE to propagate the event further.
@ -612,7 +618,7 @@ g_settings_class_init (GSettingsClass *class)
g_settings_signals[SIGNAL_WRITABLE_CHANGED] = g_settings_signals[SIGNAL_WRITABLE_CHANGED] =
g_signal_new ("writable-changed", G_TYPE_SETTINGS, g_signal_new ("writable-changed", G_TYPE_SETTINGS,
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
G_STRUCT_OFFSET (GSettingsClass, changed), G_STRUCT_OFFSET (GSettingsClass, writable_changed),
NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE,
1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE); 1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
@ -701,6 +707,20 @@ g_settings_class_init (GSettingsClass *class)
FALSE, FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* GSettings:delay-apply:
*
* Whether the #GSettings object is in 'delay-apply' mode. See
* g_settings_delay() for details.
*
* Since: 2.28
*/
g_object_class_install_property (object_class, PROP_DELAY_APPLY,
g_param_spec_boolean ("delay-apply",
P_("Delay-apply mode"),
P_("Whether this settings object is in 'delay-apply' mode"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
} }
/* Construction (new, new_with_path, etc.) {{{1 */ /* Construction (new, new_with_path, etc.) {{{1 */
@ -1588,8 +1608,8 @@ g_settings_set (GSettings *settings,
* g_settings_get_mapped: * g_settings_get_mapped:
* @settings: a #GSettings object * @settings: a #GSettings object
* @key: the key to get the value for * @key: the key to get the value for
* @mapping: the function to map the value in the settings database to * @mapping: (scope call): the function to map the value in the
* the value used by the application * settings database to the value used by the application
* @user_data: user data for @mapping * @user_data: user data for @mapping
* @returns: (transfer full): the result, which may be %NULL * @returns: (transfer full): the result, which may be %NULL
* *
@ -1887,16 +1907,15 @@ g_settings_set_boolean (GSettings *settings,
* g_settings_get_strv: * g_settings_get_strv:
* @settings: a #GSettings object * @settings: a #GSettings object
* @key: the key to get the value for * @key: the key to get the value for
* @returns: a newly-allocated, %NULL-terminated array of strings * @returns: (array zero-terminated=1) (transfer full): a
* newly-allocated, %NULL-terminated array of strings, the value that
* is stored at @key in @settings.
* *
* A convenience variant of g_settings_get() for string arrays. * A convenience variant of g_settings_get() for string arrays.
* *
* It is a programmer error to give a @key that isn't specified as * It is a programmer error to give a @key that isn't specified as
* having an array of strings type in the schema for @settings. * having an array of strings type in the schema for @settings.
* *
* Returns: (array zero-terminated=1) (transfer full): the value that is
* stored at @key in @settings.
*
* Since: 2.26 * Since: 2.26
*/ */
gchar ** gchar **
@ -1976,6 +1995,8 @@ g_settings_delay (GSettings *settings)
g_settings_backend_watch (settings->priv->backend, g_settings_backend_watch (settings->priv->backend,
&listener_vtable, G_OBJECT (settings), &listener_vtable, G_OBJECT (settings),
settings->priv->main_context); settings->priv->main_context);
g_object_notify (G_OBJECT (settings), "delay-apply");
} }
/** /**
@ -2119,7 +2140,7 @@ g_settings_is_writable (GSettings *settings,
* @returns: (transfer full): a 'child' settings object * @returns: (transfer full): a 'child' settings object
* *
* Creates a 'child' settings object which has a base path of * Creates a 'child' settings object which has a base path of
* <replaceable>base-path</replaceable>/@name", where * <replaceable>base-path</replaceable>/@name, where
* <replaceable>base-path</replaceable> is the base path of @settings. * <replaceable>base-path</replaceable> is the base path of @settings.
* *
* The schema for the child settings object must have been declared * The schema for the child settings object must have been declared
@ -2558,7 +2579,7 @@ g_settings_bind_invert_boolean_set_mapping (const GValue *value,
* g_settings_bind: * g_settings_bind:
* @settings: a #GSettings object * @settings: a #GSettings object
* @key: the key to bind * @key: the key to bind
* @object: a #GObject * @object: (type GObject.Object): a #GObject
* @property: the name of the property to bind * @property: the name of the property to bind
* @flags: flags for the binding * @flags: flags for the binding
* *
@ -2609,10 +2630,10 @@ g_settings_bind (GSettings *settings,
} }
/** /**
* g_settings_bind_with_mapping: * g_settings_bind_with_mapping: (skip)
* @settings: a #GSettings object * @settings: a #GSettings object
* @key: the key to bind * @key: the key to bind
* @object: a #GObject * @object: (type GObject.Object): a #GObject
* @property: the name of the property to bind * @property: the name of the property to bind
* @flags: flags for the binding * @flags: flags for the binding
* @get_mapping: a function that gets called to convert values * @get_mapping: a function that gets called to convert values
@ -2825,7 +2846,7 @@ g_settings_binding_writable_changed (GSettings *settings,
* g_settings_bind_writable: * g_settings_bind_writable:
* @settings: a #GSettings object * @settings: a #GSettings object
* @key: the key to bind * @key: the key to bind
* @object: a #GObject * @object: (type GObject.Object):a #GObject
* @property: the name of a boolean property to bind * @property: the name of a boolean property to bind
* @inverted: whether to 'invert' the value * @inverted: whether to 'invert' the value
* *

View File

@ -188,8 +188,9 @@ typedef gboolean (*GSettingsBindGetMapping) (GValue
/** /**
* GSettingsGetMapping: * GSettingsGetMapping:
* @value: the #GVariant to map, or %NULL * @value: the #GVariant to map, or %NULL
* @result: the result of the mapping * @result: (out): the result of the mapping
* @user_data: the user data that was passed to g_settings_get_mapped() * @user_data: (closure): the user data that was passed to
* g_settings_get_mapped()
* @returns: %TRUE if the conversion succeeded, %FALSE in case of an error * @returns: %TRUE if the conversion succeeded, %FALSE in case of an error
* *
* The type of the function that is used to convert from a value stored * The type of the function that is used to convert from a value stored

View File

@ -24,7 +24,6 @@
#include "config.h" #include "config.h"
#include "gsettingsbackendinternal.h" #include "gsettingsbackendinternal.h"
#include "gnullsettingsbackend.h"
#include "gsimplepermission.h" #include "gsimplepermission.h"
#include "giomodule-priv.h" #include "giomodule-priv.h"
#include "gio-marshal.h" #include "gio-marshal.h"
@ -402,7 +401,7 @@ g_settings_backend_changed (GSettingsBackend *backend,
* g_settings_backend_keys_changed: * g_settings_backend_keys_changed:
* @backend: a #GSettingsBackend implementation * @backend: a #GSettingsBackend implementation
* @path: the path containing the changes * @path: the path containing the changes
* @items: the %NULL-terminated list of changed keys * @items: (array zero-terminated=1): the %NULL-terminated list of changed keys
* @origin_tag: the origin tag * @origin_tag: the origin tag
* *
* Signals that a list of keys have possibly changed. Backend * Signals that a list of keys have possibly changed. Backend
@ -610,9 +609,11 @@ g_settings_backend_flatten_one (gpointer key,
/** /**
* g_settings_backend_flatten_tree: * g_settings_backend_flatten_tree:
* @tree: a #GTree containing the changes * @tree: a #GTree containing the changes
* @path: the location to save the path * @path: (out): the location to save the path
* @keys: the location to save the relative keys * @keys: (out) (transfer container) (array zero-terminated=1): the
* @values: the location to save the values, or %NULL * location to save the relative keys
* @values: (out) (allow-none) (transfer container) (array zero-terminated=1):
* the location to save the values, or %NULL
* *
* Calculate the longest common prefix of all keys in a tree and write * Calculate the longest common prefix of all keys in a tree and write
* out an array of the key names relative to that prefix and, * out an array of the key names relative to that prefix and,
@ -925,15 +926,17 @@ g_settings_backend_create_tree (void)
g_free, (GDestroyNotify) g_variant_unref); g_free, (GDestroyNotify) g_variant_unref);
} }
/*< private > /**
* g_settings_backend_get_default: * g_settings_backend_get_default:
* @returns: the default #GSettingsBackend * @returns: (transfer full): the default #GSettingsBackend
* *
* Returns the default #GSettingsBackend. It is possible to override * Returns the default #GSettingsBackend. It is possible to override
* the default by setting the <envar>GSETTINGS_BACKEND</envar> * the default by setting the <envar>GSETTINGS_BACKEND</envar>
* environment variable to the name of a settings backend. * environment variable to the name of a settings backend.
* *
* The user gets a reference to the backend. * The user gets a reference to the backend.
*
* Since: 2.28
*/ */
GSettingsBackend * GSettingsBackend *
g_settings_backend_get_default (void) g_settings_backend_get_default (void)

View File

@ -148,10 +148,16 @@ void g_settings_backend_changed_tree (GSettin
GTree *tree, GTree *tree,
gpointer origin_tag); gpointer origin_tag);
GSettingsBackend * g_settings_backend_get_default (void);
GSettingsBackend * g_keyfile_settings_backend_new (const gchar *filename, GSettingsBackend * g_keyfile_settings_backend_new (const gchar *filename,
const gchar *root_path, const gchar *root_path,
const gchar *root_group); const gchar *root_group);
GSettingsBackend * g_null_settings_backend_new (void);
GSettingsBackend * g_memory_settings_backend_new (void);
G_END_DECLS G_END_DECLS
#endif /* __G_SETTINGS_BACKEND_H__ */ #endif /* __G_SETTINGS_BACKEND_H__ */

View File

@ -125,9 +125,13 @@ gboolean g_settings_backend_can_remove (GSettin
const gchar *path, const gchar *path,
const gchar *id); const gchar *id);
G_GNUC_INTERNAL
GSettingsBackend * g_settings_backend_get_default (void);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void g_settings_backend_sync_default (void); void g_settings_backend_sync_default (void);
G_GNUC_INTERNAL
GType g_null_settings_backend_get_type (void);
G_GNUC_INTERNAL
GType g_memory_settings_backend_get_type (void);
#endif /* __G_SETTINGS_BACKEND_INTERNAL_H__ */ #endif /* __G_SETTINGS_BACKEND_INTERNAL_H__ */

View File

@ -160,7 +160,7 @@ g_simple_action_group_set_state (GActionGroup *group,
if (action == NULL) if (action == NULL)
return; return;
return g_action_set_state (action, value); g_action_set_state (action, value);
} }
static void static void
@ -176,7 +176,7 @@ g_simple_action_group_activate (GActionGroup *group,
if (action == NULL) if (action == NULL)
return; return;
return g_action_activate (action, parameter); g_action_activate (action, parameter);
} }
static void static void

View File

@ -187,7 +187,7 @@
* return; * return;
* } * }
* *
* _baker_prepare_cake (self, radius, baked_cb, user_data); * _baker_prepare_cake (self, radius, baked_cb, simple);
* } * }
* *
* Cake * * Cake *
@ -299,10 +299,9 @@ g_simple_async_result_init (GSimpleAsyncResult *simple)
/** /**
* g_simple_async_result_new: * g_simple_async_result_new:
* @source_object: a #GObject the asynchronous function was called with, * @source_object: (allow-none): a #GObject, or %NULL.
* or %NULL. * @callback: (scope async): a #GAsyncReadyCallback.
* @callback: a #GAsyncReadyCallback. * @user_data: (closure): user data passed to @callback.
* @user_data: user data passed to @callback.
* @source_tag: the asynchronous function. * @source_tag: the asynchronous function.
* *
* Creates a #GSimpleAsyncResult. * Creates a #GSimpleAsyncResult.
@ -333,9 +332,9 @@ g_simple_async_result_new (GObject *source_object,
/** /**
* g_simple_async_result_new_from_error: * g_simple_async_result_new_from_error:
* @source_object: a #GObject, or %NULL. * @source_object: (allow-none): a #GObject, or %NULL.
* @callback: a #GAsyncReadyCallback. * @callback: (scope async): a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: (closure): user data passed to @callback.
* @error: a #GError * @error: a #GError
* *
* Creates a #GSimpleAsyncResult from an error condition. * Creates a #GSimpleAsyncResult from an error condition.
@ -361,10 +360,10 @@ g_simple_async_result_new_from_error (GObject *source_object,
} }
/** /**
* g_simple_async_result_new_take_error: * g_simple_async_result_new_take_error: (skip)
* @source_object: (allow-none): a #GObject, or %NULL * @source_object: (allow-none): a #GObject, or %NULL
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: (allow-none): user data passed to @callback * @user_data: (closure): user data passed to @callback
* @error: a #GError * @error: a #GError
* *
* Creates a #GSimpleAsyncResult from an error condition, and takes over the * Creates a #GSimpleAsyncResult from an error condition, and takes over the
@ -394,9 +393,9 @@ g_simple_async_result_new_take_error (GObject *source_object,
/** /**
* g_simple_async_result_new_error: * g_simple_async_result_new_error:
* @source_object: a #GObject, or %NULL. * @source_object: (allow-none): a #GObject, or %NULL.
* @callback: a #GAsyncReadyCallback. * @callback: (scope async): a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: (closure): user data passed to @callback.
* @domain: a #GQuark. * @domain: a #GQuark.
* @code: an error code. * @code: an error code.
* @format: a string with format characters. * @format: a string with format characters.
@ -489,7 +488,7 @@ g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple)
/** /**
* g_simple_async_result_propagate_error: * g_simple_async_result_propagate_error:
* @simple: a #GSimpleAsyncResult. * @simple: a #GSimpleAsyncResult.
* @dest: a location to propegate the error to. * @dest: (out): a location to propagate the error to.
* *
* Propagates an error from within the simple asynchronous result to * Propagates an error from within the simple asynchronous result to
* a given destination. * a given destination.
@ -513,7 +512,7 @@ g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
} }
/** /**
* g_simple_async_result_set_op_res_gpointer: * g_simple_async_result_set_op_res_gpointer: (skip)
* @simple: a #GSimpleAsyncResult. * @simple: a #GSimpleAsyncResult.
* @op_res: a pointer result from an asynchronous function. * @op_res: a pointer result from an asynchronous function.
* @destroy_op_res: a #GDestroyNotify function. * @destroy_op_res: a #GDestroyNotify function.
@ -632,7 +631,7 @@ g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
} }
/** /**
* g_simple_async_result_take_error: * g_simple_async_result_take_error: (skip)
* @simple: a #GSimpleAsyncResult * @simple: a #GSimpleAsyncResult
* @error: a #GError * @error: a #GError
* *
@ -655,7 +654,7 @@ g_simple_async_result_take_error (GSimpleAsyncResult *simple,
} }
/** /**
* g_simple_async_result_set_error_va: * g_simple_async_result_set_error_va: (skip)
* @simple: a #GSimpleAsyncResult. * @simple: a #GSimpleAsyncResult.
* @domain: a #GQuark (usually #G_IO_ERROR). * @domain: a #GQuark (usually #G_IO_ERROR).
* @code: an error code. * @code: an error code.
@ -683,7 +682,7 @@ g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
} }
/** /**
* g_simple_async_result_set_error: * g_simple_async_result_set_error: (skip)
* @simple: a #GSimpleAsyncResult. * @simple: a #GSimpleAsyncResult.
* @domain: a #GQuark (usually #G_IO_ERROR). * @domain: a #GQuark (usually #G_IO_ERROR).
* @code: an error code. * @code: an error code.
@ -851,11 +850,11 @@ run_in_thread (GIOSchedulerJob *job,
} }
/** /**
* g_simple_async_result_run_in_thread: * g_simple_async_result_run_in_thread: (skip)
* @simple: a #GSimpleAsyncResult. * @simple: a #GSimpleAsyncResult.
* @func: a #GSimpleAsyncThreadFunc. * @func: a #GSimpleAsyncThreadFunc.
* @io_priority: the io priority of the request. * @io_priority: the io priority of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* *
* Runs the asynchronous job in a separate thread and then calls * Runs the asynchronous job in a separate thread and then calls
* g_simple_async_result_complete_in_idle() on @simple to return * g_simple_async_result_complete_in_idle() on @simple to return
@ -934,8 +933,8 @@ g_simple_async_result_is_valid (GAsyncResult *result,
} }
/** /**
* g_simple_async_report_error_in_idle: * g_simple_async_report_error_in_idle: (skip)
* @object: a #GObject. * @object: (allow-none): a #GObject, or %NULL.
* @callback: a #GAsyncReadyCallback. * @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* @domain: a #GQuark containing the error domain (usually #G_IO_ERROR). * @domain: a #GQuark containing the error domain (usually #G_IO_ERROR).
@ -959,7 +958,7 @@ g_simple_async_report_error_in_idle (GObject *object,
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
va_list args; va_list args;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (!object || G_IS_OBJECT (object));
g_return_if_fail (domain != 0); g_return_if_fail (domain != 0);
g_return_if_fail (format != NULL); g_return_if_fail (format != NULL);
@ -976,9 +975,9 @@ g_simple_async_report_error_in_idle (GObject *object,
/** /**
* g_simple_async_report_gerror_in_idle: * g_simple_async_report_gerror_in_idle:
* @object: a #GObject. * @object: (allow-none): a #GObject, or %NULL
* @callback: a #GAsyncReadyCallback. * @callback: (scope async): a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: (closure): user data passed to @callback.
* @error: the #GError to report * @error: the #GError to report
* *
* Reports an error in an idle function. Similar to * Reports an error in an idle function. Similar to
@ -993,7 +992,7 @@ g_simple_async_report_gerror_in_idle (GObject *object,
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (!object || G_IS_OBJECT (object));
g_return_if_fail (error != NULL); g_return_if_fail (error != NULL);
simple = g_simple_async_result_new_from_error (object, simple = g_simple_async_result_new_from_error (object,
@ -1005,8 +1004,8 @@ g_simple_async_report_gerror_in_idle (GObject *object,
} }
/** /**
* g_simple_async_report_take_gerror_in_idle: * g_simple_async_report_take_gerror_in_idle: (skip)
* @object: a #GObject. * @object: (allow-none): a #GObject, or %NULL
* @callback: a #GAsyncReadyCallback. * @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* @error: the #GError to report * @error: the #GError to report
@ -1025,7 +1024,7 @@ g_simple_async_report_take_gerror_in_idle (GObject *object,
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (!object || G_IS_OBJECT (object));
g_return_if_fail (error != NULL); g_return_if_fail (error != NULL);
simple = g_simple_async_result_new_take_error (object, simple = g_simple_async_result_new_take_error (object,

View File

@ -1479,7 +1479,7 @@ g_socket_speaks_ipv4 (GSocket *socket)
/** /**
* g_socket_accept: * g_socket_accept:
* @socket: a #GSocket. * @socket: a #GSocket.
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Accept incoming connections on a connection-based socket. This removes * Accept incoming connections on a connection-based socket. This removes
@ -1591,7 +1591,7 @@ g_socket_accept (GSocket *socket,
* g_socket_connect: * g_socket_connect:
* @socket: a #GSocket. * @socket: a #GSocket.
* @address: a #GSocketAddress specifying the remote address. * @address: a #GSocketAddress specifying the remote address.
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Connect the socket to the specified remote address. * Connect the socket to the specified remote address.
@ -1737,7 +1737,7 @@ g_socket_check_connect_result (GSocket *socket,
* @buffer: a buffer to read data into (which should be at least @size * @buffer: a buffer to read data into (which should be at least @size
* bytes long). * bytes long).
* @size: the number of bytes you want to read from the socket * @size: the number of bytes you want to read from the socket
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Receive data (up to @size bytes) from a socket. This is mainly used by * Receive data (up to @size bytes) from a socket. This is mainly used by
@ -1786,7 +1786,7 @@ g_socket_receive (GSocket *socket,
* bytes long). * bytes long).
* @size: the number of bytes you want to read from the socket * @size: the number of bytes you want to read from the socket
* @blocking: whether to do blocking or non-blocking I/O * @blocking: whether to do blocking or non-blocking I/O
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* This behaves exactly the same as g_socket_receive(), except that * This behaves exactly the same as g_socket_receive(), except that
@ -1864,7 +1864,7 @@ g_socket_receive_with_blocking (GSocket *socket,
* @buffer: a buffer to read data into (which should be at least @size * @buffer: a buffer to read data into (which should be at least @size
* bytes long). * bytes long).
* @size: the number of bytes you want to read from the socket * @size: the number of bytes you want to read from the socket
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Receive data (up to @size bytes) from a socket. * Receive data (up to @size bytes) from a socket.
@ -1913,9 +1913,9 @@ g_socket_receive_from (GSocket *socket,
/** /**
* g_socket_send: * g_socket_send:
* @socket: a #GSocket * @socket: a #GSocket
* @buffer: the buffer containing the data to send. * @buffer: (array length=size): the buffer containing the data to send.
* @size: the number of bytes to send * @size: the number of bytes to send
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Tries to send @size bytes from @buffer on the socket. This is * Tries to send @size bytes from @buffer on the socket. This is
@ -1953,10 +1953,10 @@ g_socket_send (GSocket *socket,
/** /**
* g_socket_send_with_blocking: * g_socket_send_with_blocking:
* @socket: a #GSocket * @socket: a #GSocket
* @buffer: the buffer containing the data to send. * @buffer: (array length=size): the buffer containing the data to send.
* @size: the number of bytes to send * @size: the number of bytes to send
* @blocking: whether to do blocking or non-blocking I/O * @blocking: whether to do blocking or non-blocking I/O
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* This behaves exactly the same as g_socket_send(), except that * This behaves exactly the same as g_socket_send(), except that
@ -2032,9 +2032,9 @@ g_socket_send_with_blocking (GSocket *socket,
* g_socket_send_to: * g_socket_send_to:
* @socket: a #GSocket * @socket: a #GSocket
* @address: a #GSocketAddress, or %NULL * @address: a #GSocketAddress, or %NULL
* @buffer: the buffer containing the data to send. * @buffer: (array length=size): the buffer containing the data to send.
* @size: the number of bytes to send * @size: the number of bytes to send
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Tries to send @size bytes from @buffer to @address. If @address is * Tries to send @size bytes from @buffer to @address. If @address is
@ -2468,6 +2468,10 @@ socket_source_dispatch (GSource *source,
GSocketSourceFunc func = (GSocketSourceFunc)callback; GSocketSourceFunc func = (GSocketSourceFunc)callback;
GSocketSource *socket_source = (GSocketSource *)source; GSocketSource *socket_source = (GSocketSource *)source;
#ifdef G_OS_WIN32
socket_source->pollfd.revents = update_condition (socket_source->socket);
#endif
return (*func) (socket_source->socket, return (*func) (socket_source->socket,
socket_source->pollfd.revents & socket_source->condition, socket_source->pollfd.revents & socket_source->condition,
user_data); user_data);
@ -2588,10 +2592,10 @@ socket_source_new (GSocket *socket,
} }
/** /**
* g_socket_create_source: * g_socket_create_source: (skip)
* @socket: a #GSocket * @socket: a #GSocket
* @condition: a #GIOCondition mask to monitor * @condition: a #GIOCondition mask to monitor
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* *
* Creates a %GSource that can be attached to a %GMainContext to monitor * Creates a %GSource that can be attached to a %GMainContext to monitor
* for the availibility of the specified @condition on the socket. * for the availibility of the specified @condition on the socket.
@ -2692,7 +2696,7 @@ g_socket_condition_check (GSocket *socket,
* g_socket_condition_wait: * g_socket_condition_wait:
* @socket: a #GSocket * @socket: a #GSocket
* @condition: a #GIOCondition mask to wait for * @condition: a #GIOCondition mask to wait for
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: a #GError pointer, or %NULL * @error: a #GError pointer, or %NULL
* *
* Waits for @condition to become true on @socket. When the condition * Waits for @condition to become true on @socket. When the condition
@ -2819,13 +2823,13 @@ g_socket_condition_wait (GSocket *socket,
* g_socket_send_message: * g_socket_send_message:
* @socket: a #GSocket * @socket: a #GSocket
* @address: a #GSocketAddress, or %NULL * @address: a #GSocketAddress, or %NULL
* @vectors: an array of #GOutputVector structs * @vectors: (array length=num_vectors): an array of #GOutputVector structs
* @num_vectors: the number of elements in @vectors, or -1 * @num_vectors: the number of elements in @vectors, or -1
* @messages: a pointer to an array of #GSocketControlMessages, or * @messages: (array length=num_messages) (allow-none): a pointer to an
* %NULL. * array of #GSocketControlMessages, or %NULL.
* @num_messages: number of elements in @messages, or -1. * @num_messages: number of elements in @messages, or -1.
* @flags: an int containing #GSocketMsgFlags flags * @flags: an int containing #GSocketMsgFlags flags
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Send data to @address on @socket. This is the most complicated and * Send data to @address on @socket. This is the most complicated and
@ -3117,14 +3121,14 @@ g_socket_send_message (GSocket *socket,
* g_socket_receive_message: * g_socket_receive_message:
* @socket: a #GSocket * @socket: a #GSocket
* @address: a pointer to a #GSocketAddress pointer, or %NULL * @address: a pointer to a #GSocketAddress pointer, or %NULL
* @vectors: an array of #GInputVector structs * @vectors: (array length=num_vectors): an array of #GInputVector structs
* @num_vectors: the number of elements in @vectors, or -1 * @num_vectors: the number of elements in @vectors, or -1
* @messages: a pointer which may be filled with an array of * @messages: (array length=num_messages) (allow-none): a pointer which
* #GSocketControlMessages, or %NULL * may be filled with an array of #GSocketControlMessages, or %NULL
* @num_messages: a pointer which will be filled with the number of * @num_messages: a pointer which will be filled with the number of
* elements in @messages, or %NULL * elements in @messages, or %NULL
* @flags: a pointer to an int containing #GSocketMsgFlags flags * @flags: a pointer to an int containing #GSocketMsgFlags flags
* @cancellable: a %GCancellable or %NULL * @cancellable: (allow-none): a %GCancellable or %NULL
* @error: a #GError pointer, or %NULL * @error: a #GError pointer, or %NULL
* *
* Receive data from a socket. This is the most complicated and * Receive data from a socket. This is the most complicated and

View File

@ -50,7 +50,7 @@ g_socket_address_enumerator_class_init (GSocketAddressEnumeratorClass *enumerato
/** /**
* g_socket_address_enumerator_next: * g_socket_address_enumerator_next:
* @enumerator: a #GSocketAddressEnumerator * @enumerator: a #GSocketAddressEnumerator
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: a #GError. * @error: a #GError.
* *
* Retrieves the next #GSocketAddress from @enumerator. Note that this * Retrieves the next #GSocketAddress from @enumerator. Note that this
@ -115,9 +115,10 @@ g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerato
/** /**
* g_socket_address_enumerator_next_async: * g_socket_address_enumerator_next_async:
* @enumerator: a #GSocketAddressEnumerator * @enumerator: a #GSocketAddressEnumerator
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: (scope async): a #GAsyncReadyCallback to call when the request
* @user_data: the data to pass to callback function * is satisfied
* @user_data: (closure): the data to pass to callback function
* *
* Asynchronously retrieves the next #GSocketAddress from @enumerator * Asynchronously retrieves the next #GSocketAddress from @enumerator
* and then calls @callback, which must call * and then calls @callback, which must call

View File

@ -723,7 +723,7 @@ g_socket_client_class_init (GSocketClientClass *class)
* g_socket_client_connect: * g_socket_client_connect:
* @client: a #GSocketClient. * @client: a #GSocketClient.
* @connectable: a #GSocketConnectable specifying the remote address. * @connectable: a #GSocketConnectable specifying the remote address.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Tries to resolve the @connectable and make a network connection to it.. * Tries to resolve the @connectable and make a network connection to it..
@ -864,15 +864,16 @@ g_socket_client_connect (GSocketClient *client,
if (connection && client->priv->tls) if (connection && client->priv->tls)
{ {
GTlsClientConnection *tlsconn; GIOStream *tlsconn;
tlsconn = g_tls_client_connection_new (connection, connectable, &last_error); tlsconn = g_tls_client_connection_new (connection, connectable, &last_error);
g_object_unref (connection); g_object_unref (connection);
connection = (GIOStream *)tlsconn; connection = tlsconn;
if (tlsconn) if (tlsconn)
{ {
g_tls_client_connection_set_validation_flags (tlsconn, client->priv->tls_validation_flags); g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn),
client->priv->tls_validation_flags);
if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn),
cancellable, &last_error)) cancellable, &last_error))
{ {
@ -904,7 +905,7 @@ g_socket_client_connect (GSocketClient *client,
* @client: a #GSocketClient * @client: a #GSocketClient
* @host_and_port: the name and optionally port of the host to connect to * @host_and_port: the name and optionally port of the host to connect to
* @default_port: the default port to connect to * @default_port: the default port to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: a pointer to a #GError, or %NULL * @error: a pointer to a #GError, or %NULL
* *
* This is a helper function for g_socket_client_connect(). * This is a helper function for g_socket_client_connect().
@ -968,7 +969,7 @@ g_socket_client_connect_to_host (GSocketClient *client,
* @client: a #GSocketConnection * @client: a #GSocketConnection
* @domain: a domain name * @domain: a domain name
* @service: the name of the service to connect to * @service: the name of the service to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: a pointer to a #GError, or %NULL * @error: a pointer to a #GError, or %NULL
* @returns: (transfer full): a #GSocketConnection if successful, or %NULL on error * @returns: (transfer full): a #GSocketConnection if successful, or %NULL on error
* *
@ -1010,7 +1011,7 @@ g_socket_client_connect_to_service (GSocketClient *client,
* @client: a #GSocketClient * @client: a #GSocketClient
* @uri: A network URI * @uri: A network URI
* @default_port: the default port to connect to * @default_port: the default port to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: a pointer to a #GError, or %NULL * @error: a pointer to a #GError, or %NULL
* *
* This is a helper function for g_socket_client_connect(). * This is a helper function for g_socket_client_connect().
@ -1019,7 +1020,9 @@ g_socket_client_connect_to_service (GSocketClient *client,
* *
* @uri may be any valid URI containing an "authority" (hostname/port) * @uri may be any valid URI containing an "authority" (hostname/port)
* component. If a port is not specified in the URI, @default_port * component. If a port is not specified in the URI, @default_port
* will be used. * will be used. TLS will be negotiated if #GSocketClient:tls is %TRUE.
* (#GSocketClient does not know to automatically assume TLS for
* certain URI schemes.)
* *
* Using this rather than g_socket_client_connect() or * Using this rather than g_socket_client_connect() or
* g_socket_client_connect_to_host() allows #GSocketClient to * g_socket_client_connect_to_host() allows #GSocketClient to
@ -1166,7 +1169,7 @@ g_socket_client_tls_handshake_callback (GObject *object,
static void static void
g_socket_client_tls_handshake (GSocketClientAsyncConnectData *data) g_socket_client_tls_handshake (GSocketClientAsyncConnectData *data)
{ {
GTlsClientConnection *tlsconn; GIOStream *tlsconn;
if (!data->client->priv->tls) if (!data->client->priv->tls)
{ {
@ -1179,7 +1182,8 @@ g_socket_client_tls_handshake (GSocketClientAsyncConnectData *data)
&data->last_error); &data->last_error);
if (tlsconn) if (tlsconn)
{ {
g_tls_client_connection_set_validation_flags (tlsconn, data->client->priv->tls_validation_flags); g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn),
data->client->priv->tls_validation_flags);
g_tls_connection_handshake_async (G_TLS_CONNECTION (tlsconn), g_tls_connection_handshake_async (G_TLS_CONNECTION (tlsconn),
G_PRIORITY_DEFAULT, G_PRIORITY_DEFAULT,
data->cancellable, data->cancellable,
@ -1418,9 +1422,9 @@ g_socket_client_enumerator_callback (GObject *object,
* g_socket_client_connect_async: * g_socket_client_connect_async:
* @client: a #GTcpClient * @client: a #GTcpClient
* @connectable: a #GSocketConnectable specifying the remote address. * @connectable: a #GSocketConnectable specifying the remote address.
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: user data for the callback * @user_data: (closure): user data for the callback
* *
* This is the asynchronous version of g_socket_client_connect(). * This is the asynchronous version of g_socket_client_connect().
* *
@ -1467,9 +1471,9 @@ g_socket_client_connect_async (GSocketClient *client,
* @client: a #GTcpClient * @client: a #GTcpClient
* @host_and_port: the name and optionally the port of the host to connect to * @host_and_port: the name and optionally the port of the host to connect to
* @default_port: the default port to connect to * @default_port: the default port to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: user data for the callback * @user_data: (closure): user data for the callback
* *
* This is the asynchronous version of g_socket_client_connect_to_host(). * This is the asynchronous version of g_socket_client_connect_to_host().
* *
@ -1512,9 +1516,9 @@ g_socket_client_connect_to_host_async (GSocketClient *client,
* @client: a #GSocketClient * @client: a #GSocketClient
* @domain: a domain name * @domain: a domain name
* @service: the name of the service to connect to * @service: the name of the service to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: user data for the callback * @user_data: (closure): user data for the callback
* *
* This is the asynchronous version of * This is the asynchronous version of
* g_socket_client_connect_to_service(). * g_socket_client_connect_to_service().
@ -1543,9 +1547,9 @@ g_socket_client_connect_to_service_async (GSocketClient *client,
* @client: a #GSocketClient * @client: a #GSocketClient
* @uri: a network uri * @uri: a network uri
* @default_port: the default port to connect to * @default_port: the default port to connect to
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: user data for the callback * @user_data: (closure): user data for the callback
* *
* This is the asynchronous version of g_socket_client_connect_to_uri(). * This is the asynchronous version of g_socket_client_connect_to_uri().
* *

View File

@ -153,7 +153,7 @@ g_socket_control_message_class_init (GSocketControlMessageClass *class)
* @level: a socket level * @level: a socket level
* @type: a socket control message type for the given @level * @type: a socket control message type for the given @level
* @size: the size of the data in bytes * @size: the size of the data in bytes
* @data: pointer to the message data * @data: (array length=size) (element-type guint8): pointer to the message data
* *
* Tries to deserialize a socket control message of a given * Tries to deserialize a socket control message of a given
* @level and @type. This will ask all known (to GType) subclasses * @level and @type. This will ask all known (to GType) subclasses

View File

@ -199,7 +199,7 @@ check_listener (GSocketListener *listener,
* g_socket_listener_add_socket: * g_socket_listener_add_socket:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @socket: a listening #GSocket * @socket: a listening #GSocket
* @source_object: Optional #GObject identifying this source * @source_object: (allow-none): Optional #GObject identifying this source
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Adds @socket to the set of sockets that we try to accept * Adds @socket to the set of sockets that we try to accept
@ -253,7 +253,7 @@ g_socket_listener_add_socket (GSocketListener *listener,
* @address: a #GSocketAddress * @address: a #GSocketAddress
* @type: a #GSocketType * @type: a #GSocketType
* @protocol: a #GSocketProtocol * @protocol: a #GSocketProtocol
* @source_object: Optional #GObject identifying this source * @source_object: (allow-none): Optional #GObject identifying this source
* @effective_address: (out) (allow-none): location to store the address that was bound to, or %NULL. * @effective_address: (out) (allow-none): location to store the address that was bound to, or %NULL.
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
@ -344,7 +344,7 @@ g_socket_listener_add_address (GSocketListener *listener,
* g_socket_listener_add_inet_port: * g_socket_listener_add_inet_port:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @port: an IP port number (non-zero) * @port: an IP port number (non-zero)
* @source_object: Optional #GObject identifying this source * @source_object: (allow-none): Optional #GObject identifying this source
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Helper function for g_socket_listener_add_address() that * Helper function for g_socket_listener_add_address() that
@ -563,7 +563,7 @@ accept_callback (GSocket *socket,
* g_socket_listener_accept_socket: * g_socket_listener_accept_socket:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @source_object: (out) (transfer none) (allow-none): location where #GObject pointer will be stored, or %NULL. * @source_object: (out) (transfer none) (allow-none): location where #GObject pointer will be stored, or %NULL.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Blocks waiting for a client to connect to any of the sockets added * Blocks waiting for a client to connect to any of the sockets added
@ -640,7 +640,7 @@ g_socket_listener_accept_socket (GSocketListener *listener,
* g_socket_listener_accept: * g_socket_listener_accept:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @source_object: (out) (transfer none) (allow-none): location where #GObject pointer will be stored, or %NULL * @source_object: (out) (transfer none) (allow-none): location where #GObject pointer will be stored, or %NULL
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Blocks waiting for a client to connect to any of the sockets added * Blocks waiting for a client to connect to any of the sockets added
@ -724,9 +724,9 @@ accept_ready (GSocket *accept_socket,
/** /**
* g_socket_listener_accept_socket_async: * g_socket_listener_accept_socket_async:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: user data for the callback * @user_data: (closure): user data for the callback
* *
* This is the asynchronous version of g_socket_listener_accept_socket(). * This is the asynchronous version of g_socket_listener_accept_socket().
* *
@ -769,7 +769,7 @@ g_socket_listener_accept_socket_async (GSocketListener *listener,
* g_socket_listener_accept_socket_finish: * g_socket_listener_accept_socket_finish:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @result: a #GAsyncResult. * @result: a #GAsyncResult.
* @source_object: Optional #GObject identifying this source * @source_object: (out) (transfer none) (allow-none): Optional #GObject identifying this source
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
@ -808,9 +808,9 @@ g_socket_listener_accept_socket_finish (GSocketListener *listener,
/** /**
* g_socket_listener_accept_async: * g_socket_listener_accept_async:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @cancellable: a #GCancellable, or %NULL * @cancellable: (allow-none): a #GCancellable, or %NULL
* @callback: a #GAsyncReadyCallback * @callback: (scope async): a #GAsyncReadyCallback
* @user_data: user data for the callback * @user_data: (closure): user data for the callback
* *
* This is the asynchronous version of g_socket_listener_accept(). * This is the asynchronous version of g_socket_listener_accept().
* *
@ -836,7 +836,7 @@ g_socket_listener_accept_async (GSocketListener *listener,
* g_socket_listener_accept_finish: * g_socket_listener_accept_finish:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @result: a #GAsyncResult. * @result: a #GAsyncResult.
* @source_object: Optional #GObject identifying this source * @source_object: (out) (transfer none) (allow-none): Optional #GObject identifying this source
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
@ -927,7 +927,7 @@ g_socket_listener_close (GSocketListener *listener)
/** /**
* g_socket_listener_add_any_inet_port: * g_socket_listener_add_any_inet_port:
* @listener: a #GSocketListener * @listener: a #GSocketListener
* @source_object: Optional #GObject identifying this source * @source_object: (allow-none): Optional #GObject identifying this source
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *

View File

@ -399,7 +399,7 @@ parse_connect_reply (const guint8 *data, gint *atype, GError **error)
default: /* Unknown error */ default: /* Unknown error */
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED,
_("Unkown SOCKSv5 proxy error.")); _("Unknown SOCKSv5 proxy error."));
return FALSE; return FALSE;
break; break;
} }

View File

@ -275,7 +275,7 @@ g_themed_icon_new (const char *iconname)
/** /**
* g_themed_icon_new_from_names: * g_themed_icon_new_from_names:
* @iconnames: an array of strings containing icon names. * @iconnames: (array length=len): an array of strings containing icon names.
* @len: the length of the @iconnames array, or -1 if @iconnames is * @len: the length of the @iconnames array, or -1 if @iconnames is
* %NULL-terminated * %NULL-terminated
* *

View File

@ -53,11 +53,6 @@
G_DEFINE_ABSTRACT_TYPE (GTlsCertificate, g_tls_certificate, G_TYPE_OBJECT); G_DEFINE_ABSTRACT_TYPE (GTlsCertificate, g_tls_certificate, G_TYPE_OBJECT);
struct _GTlsCertificatePrivate
{
GTlsCertificate *issuer;
};
enum enum
{ {
PROP_0, PROP_0,
@ -72,9 +67,6 @@ enum
static void static void
g_tls_certificate_init (GTlsCertificate *cert) g_tls_certificate_init (GTlsCertificate *cert)
{ {
cert->priv = G_TYPE_INSTANCE_GET_PRIVATE (cert,
G_TYPE_TLS_CERTIFICATE,
GTlsCertificatePrivate);
} }
static void static void
@ -83,17 +75,7 @@ g_tls_certificate_get_property (GObject *object,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GTlsCertificate *cert = G_TLS_CERTIFICATE (object);
switch (prop_id)
{
case PROP_ISSUER:
g_value_set_object (value, cert->priv->issuer);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
} }
static void static void
@ -102,28 +84,7 @@ g_tls_certificate_set_property (GObject *object,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GTlsCertificate *cert = G_TLS_CERTIFICATE (object);
switch (prop_id)
{
case PROP_ISSUER:
cert->priv->issuer = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
g_tls_certificate_finalize (GObject *object)
{
GTlsCertificate *cert = G_TLS_CERTIFICATE (object);
if (cert->priv->issuer)
g_object_unref (cert->priv->issuer);
G_OBJECT_CLASS (g_tls_certificate_parent_class)->finalize (object);
} }
static void static void
@ -131,11 +92,8 @@ g_tls_certificate_class_init (GTlsCertificateClass *class)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
g_type_class_add_private (class, sizeof (GTlsCertificatePrivate));
gobject_class->set_property = g_tls_certificate_set_property; gobject_class->set_property = g_tls_certificate_set_property;
gobject_class->get_property = g_tls_certificate_get_property; gobject_class->get_property = g_tls_certificate_get_property;
gobject_class->finalize = g_tls_certificate_finalize;
/** /**
* GTlsCertificate:certificate: * GTlsCertificate:certificate:
@ -482,5 +440,49 @@ g_tls_certificate_list_new_from_file (const gchar *file,
GTlsCertificate * GTlsCertificate *
g_tls_certificate_get_issuer (GTlsCertificate *cert) g_tls_certificate_get_issuer (GTlsCertificate *cert)
{ {
return cert->priv->issuer; GTlsCertificate *issuer;
g_object_get (G_OBJECT (cert), "issuer", &issuer, NULL);
if (issuer)
g_object_unref (issuer);
return issuer;
}
/**
* g_tls_certificate_verify:
* @cert: a #GTlsCertificate
* @identity: (allow-none): the expected peer identity
* @trusted_ca: (allow-none): the certificate of a trusted authority
*
* This verifies @cert and returns a set of #GTlsCertificateFlags
* indicating any problems found with it. This can be used to verify a
* certificate outside the context of making a connection, or to
* check a certificate against a CA that is not part of the system
* CA database.
*
* If @identity is not %NULL, @cert's name(s) will be compared against
* it, and %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return
* value if it does not match. If @identity is %NULL, that bit will
* never be set in the return value.
*
* If @trusted_ca is not %NULL, then @cert (or one of the certificates
* in its chain) must be signed by it, or else
* %G_TLS_CERTIFICATE_UNKNOWN_CA will be set in the return value. If
* @trusted_ca is %NULL, that bit will never be set in the return
* value.
*
* (All other #GTlsCertificateFlags values will always be set or unset
* as appropriate.)
*
* Return value: the appropriate #GTlsCertificateFlags
*
* Since: 2.28
*/
GTlsCertificateFlags
g_tls_certificate_verify (GTlsCertificate *cert,
GSocketConnectable *identity,
GTlsCertificate *trusted_ca)
{
return G_TLS_CERTIFICATE_GET_CLASS (cert)->verify (cert, identity, trusted_ca);
} }

View File

@ -49,6 +49,10 @@ struct _GTlsCertificateClass
{ {
GObjectClass parent_class; GObjectClass parent_class;
GTlsCertificateFlags (* verify) (GTlsCertificate *cert,
GSocketConnectable *identity,
GTlsCertificate *trusted_ca);
/*< private >*/ /*< private >*/
/* Padding for future expansion */ /* Padding for future expansion */
gpointer padding[8]; gpointer padding[8];
@ -70,6 +74,10 @@ GList *g_tls_certificate_list_new_from_file (const gchar *file,
GTlsCertificate *g_tls_certificate_get_issuer (GTlsCertificate *cert); GTlsCertificate *g_tls_certificate_get_issuer (GTlsCertificate *cert);
GTlsCertificateFlags g_tls_certificate_verify (GTlsCertificate *cert,
GSocketConnectable *identity,
GTlsCertificate *trusted_ca);
G_END_DECLS G_END_DECLS
#endif /* __G_TLS_CERTIFICATE_H__ */ #endif /* __G_TLS_CERTIFICATE_H__ */

View File

@ -38,8 +38,6 @@
* *
* #GTlsClientConnection is the client-side subclass of * #GTlsClientConnection is the client-side subclass of
* #GTlsConnection, representing a client-side TLS connection. * #GTlsConnection, representing a client-side TLS connection.
*
* Since: 2.28
*/ */
/** /**
@ -131,16 +129,17 @@ g_tls_client_connection_default_init (GTlsClientConnectionInterface *iface)
* A list of the distinguished names of the Certificate Authorities * A list of the distinguished names of the Certificate Authorities
* that the server will accept client certificates signed by. If the * that the server will accept client certificates signed by. If the
* server requests a client certificate during the handshake, then * server requests a client certificate during the handshake, then
* this property will be set by the time the * this property will be set after the handshake completes.
* #GTlsConnection::need-certificate signal is emitted. *
* Each item in the list is a #GByteArray which contains the complete
* subject DN of the certificate authority.
* *
* Since: 2.28 * Since: 2.28
*/ */
g_object_interface_install_property (iface, g_object_interface_install_property (iface,
g_param_spec_boxed ("accepted-cas", g_param_spec_pointer ("accepted-cas",
P_("Accepted CAs"), P_("Accepted CAs"),
P_("Distinguished names of the CAs the server accepts certificates from"), P_("Distinguished names of the CAs the server accepts certificates from"),
G_TYPE_STRV,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
} }
@ -159,7 +158,7 @@ g_tls_client_connection_default_init (GTlsClientConnectionInterface *iface)
* *
* Since: 2.28 * Since: 2.28
*/ */
GTlsClientConnection * GIOStream *
g_tls_client_connection_new (GIOStream *base_io_stream, g_tls_client_connection_new (GIOStream *base_io_stream,
GSocketConnectable *server_identity, GSocketConnectable *server_identity,
GError **error) GError **error)
@ -173,7 +172,7 @@ g_tls_client_connection_new (GIOStream *base_io_stream,
"base-io-stream", base_io_stream, "base-io-stream", base_io_stream,
"server-identity", server_identity, "server-identity", server_identity,
NULL); NULL);
return G_TLS_CLIENT_CONNECTION (conn); return G_IO_STREAM (conn);
} }
/** /**
@ -200,10 +199,11 @@ g_tls_client_connection_get_validation_flags (GTlsClientConnection *conn)
/** /**
* g_tls_client_connection_set_validation_flags: * g_tls_client_connection_set_validation_flags:
* @conn: the #GTlsClientConnection * @conn: the #GTlsClientConnection
* @flags: the #GTlsCertificatelags to use * @flags: the #GTlsCertificateFlags to use
* *
* Sets @conn's validation flags, to override the default set of * Sets @conn's validation flags, to override the default set of
* checks performed when validating a server certificate. * checks performed when validating a server certificate. By default,
* %G_TLS_CERTIFICATE_VALIDATE_ALL is used.
* *
* Since: 2.28 * Since: 2.28
*/ */
@ -316,15 +316,19 @@ g_tls_client_connection_set_use_ssl3 (GTlsClientConnection *conn,
* during the TLS handshake if the server requests a certificate. * during the TLS handshake if the server requests a certificate.
* Otherwise, it will be %NULL. * Otherwise, it will be %NULL.
* *
* Return value: (transfer full) (array zero-terminated=1): the list * Each item in the list is a #GByteArray which contains the complete
* of CA names, which you must free (eg, with g_strfreev()). * subject DN of the certificate authority.
*
* Return value: (element-type GByteArray) (transfer full): the list of
* CA DNs. You should unref each element with g_byte_array_unref() and then
* the free the list with g_list_free().
* *
* Since: 2.28 * Since: 2.28
*/ */
char ** GList *
g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn) g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn)
{ {
char **accepted_cas = NULL; GList *accepted_cas = NULL;
g_return_val_if_fail (G_IS_TLS_CLIENT_CONNECTION (conn), NULL); g_return_val_if_fail (G_IS_TLS_CLIENT_CONNECTION (conn), NULL);

View File

@ -52,7 +52,7 @@ struct _GTlsClientConnectionInterface
GType g_tls_client_connection_get_type (void) G_GNUC_CONST; GType g_tls_client_connection_get_type (void) G_GNUC_CONST;
GTlsClientConnection *g_tls_client_connection_new (GIOStream *base_io_stream, GIOStream * g_tls_client_connection_new (GIOStream *base_io_stream,
GSocketConnectable *server_identity, GSocketConnectable *server_identity,
GError **error); GError **error);
@ -65,7 +65,7 @@ void g_tls_client_connection_set_server_identity (GTlsClientCo
gboolean g_tls_client_connection_get_use_ssl3 (GTlsClientConnection *conn); gboolean g_tls_client_connection_get_use_ssl3 (GTlsClientConnection *conn);
void g_tls_client_connection_set_use_ssl3 (GTlsClientConnection *conn, void g_tls_client_connection_set_use_ssl3 (GTlsClientConnection *conn,
gboolean use_ssl3); gboolean use_ssl3);
char ** g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn); GList * g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn);
G_END_DECLS G_END_DECLS

View File

@ -63,15 +63,8 @@ static void g_tls_connection_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void g_tls_connection_finalize (GObject *object);
static gboolean g_tls_connection_certificate_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
enum { enum {
NEED_CERTIFICATE,
ACCEPT_CERTIFICATE, ACCEPT_CERTIFICATE,
LAST_SIGNAL LAST_SIGNAL
@ -84,12 +77,10 @@ enum {
PROP_BASE_IO_STREAM, PROP_BASE_IO_STREAM,
PROP_REQUIRE_CLOSE_NOTIFY, PROP_REQUIRE_CLOSE_NOTIFY,
PROP_REHANDSHAKE_MODE, PROP_REHANDSHAKE_MODE,
PROP_USE_SYSTEM_CERTDB,
PROP_CERTIFICATE, PROP_CERTIFICATE,
PROP_PEER_CERTIFICATE PROP_PEER_CERTIFICATE,
}; PROP_PEER_CERTIFICATE_ERRORS
struct _GTlsConnectionPrivate {
GTlsCertificate *certificate, *peer_certificate;
}; };
static void static void
@ -97,11 +88,8 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GTlsConnectionPrivate));
gobject_class->get_property = g_tls_connection_get_property; gobject_class->get_property = g_tls_connection_get_property;
gobject_class->set_property = g_tls_connection_set_property; gobject_class->set_property = g_tls_connection_set_property;
gobject_class->finalize = g_tls_connection_finalize;
/** /**
* GTlsConnection:base-io-stream: * GTlsConnection:base-io-stream:
@ -118,6 +106,23 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/**
* GTlsConnection:use-system-certdb:
*
* Whether or not the system certificate database will be used to
* verify peer certificates. See
* g_tls_connection_set_use_system_certdb().
*
* Since: 2.28
*/
g_object_class_install_property (gobject_class, PROP_USE_SYSTEM_CERTDB,
g_param_spec_boolean ("use-system-certdb",
P_("Use system certificate database"),
P_("Whether to verify peer certificates against the system certificate database"),
TRUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
/** /**
* GTlsConnection:require-close-notify: * GTlsConnection:require-close-notify:
* *
@ -132,6 +137,7 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
P_("Whether to require proper TLS close notification"), P_("Whether to require proper TLS close notification"),
TRUE, TRUE,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**
* GTlsConnection:rehandshake-mode: * GTlsConnection:rehandshake-mode:
@ -148,6 +154,7 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
G_TYPE_TLS_REHANDSHAKE_MODE, G_TYPE_TLS_REHANDSHAKE_MODE,
G_TLS_REHANDSHAKE_SAFELY, G_TLS_REHANDSHAKE_SAFELY,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**
* GTlsConnection:certificate: * GTlsConnection:certificate:
@ -167,8 +174,13 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
/** /**
* GTlsConnection:peer-certificate: * GTlsConnection:peer-certificate:
* *
* The connection's peer's certificate, after it has been set during * The connection's peer's certificate, after the TLS handshake has
* the TLS handshake. * completed and the certificate has been accepted. Note in
* particular that this is not yet set during the emission of
* #GTlsConnection::accept-certificate.
*
* (You can watch for a #GObject::notify signal on this property to
* detect when a handshake has occurred.)
* *
* Since: 2.28 * Since: 2.28
*/ */
@ -179,56 +191,26 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
G_TYPE_TLS_CERTIFICATE, G_TYPE_TLS_CERTIFICATE,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
/** /**
* GTlsConnection::need-certificate: * GTlsConnection:peer-certificate-errors:
* @conn: a #GTlsConnection
* *
* Emitted during the TLS handshake if a certificate is needed and * The errors noticed-and-ignored while verifying
* one has not been set via g_tls_connection_set_certificate(). * #GTlsConnection:peer-certificate. Normally this should be %0, but
* * it may not be if #GTlsClientConnection::validation-flags is not
* For server-side connections, a certificate is always needed, and * %G_TLS_CERTIFICATE_VALIDATE_ALL, or if
* the connection will fail if none is provided. * #GTlsConnection::accept-certificate overrode the default
* * behavior.
* For client-side connections, the signal will be emitted only if
* the server has requested a certificate; you can call
* g_tls_client_connection_get_accepted_cas() to get a list of
* Certificate Authorities that the server will accept certificates
* from. If you do not return a certificate (and have not provided
* one via g_tls_connection_set_certificate()) then the server may
* reject the handshake, in which case the operation will eventually
* fail with %G_TLS_ERROR_CERTIFICATE_REQUIRED.
*
* Note that if this signal is emitted as part of asynchronous I/O
* in the main thread, then you should not attempt to interact with
* the user before returning from the signal handler. If you want to
* let the user choose a certificate to return, you would have to
* return %NULL from the signal handler on the first attempt, and
* then after the connection attempt returns a
* %G_TLS_ERROR_CERTIFICATE_REQUIRED, you can interact with the
* user, create a new connection, and call
* g_tls_connection_set_certificate() on it before handshaking (or
* just connect to the signal again and return the certificate the
* next time).
*
* If you are doing I/O in another thread, you do not
* need to worry about this, and can simply block in the signal
* handler until the UI thread returns an answer.
*
* Return value: the certificate to send to the peer, or %NULL to
* send no certificate. If you return a certificate, the signal
* emission will be stopped and further handlers will not be called.
* *
* Since: 2.28 * Since: 2.28
*/ */
signals[NEED_CERTIFICATE] = g_object_class_install_property (gobject_class, PROP_PEER_CERTIFICATE_ERRORS,
g_signal_new (I_("need-certificate"), g_param_spec_flags ("peer-certificate-errors",
G_TYPE_TLS_CONNECTION, P_("Peer Certificate Errors"),
G_SIGNAL_RUN_LAST, P_("Errors found with the peer's certificate"),
G_STRUCT_OFFSET (GTlsConnectionClass, need_certificate), G_TYPE_TLS_CERTIFICATE_FLAGS,
g_tls_connection_certificate_accumulator, NULL, 0,
_gio_marshal_OBJECT__VOID, G_PARAM_READABLE |
G_TYPE_TLS_CERTIFICATE, 0); G_PARAM_STATIC_STRINGS));
/** /**
* GTlsConnection::accept-certificate: * GTlsConnection::accept-certificate:
@ -255,10 +237,20 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
* certificate, and the certificate will only be accepted if a * certificate, and the certificate will only be accepted if a
* handler returns %TRUE. * handler returns %TRUE.
* *
* As with #GTlsConnection::need_certificate, you should not * Note that if this signal is emitted as part of asynchronous I/O
* interact with the user during the signal emission if the signal * in the main thread, then you should not attempt to interact with
* was emitted as part of an asynchronous operation in the main * the user before returning from the signal handler. If you want to
* thread. * let the user decide whether or not to accept the certificate, you
* would have to return %FALSE from the signal handler on the first
* attempt, and then after the connection attempt returns a
* %G_TLS_ERROR_HANDSHAKE, you can interact with the user, and if
* the user decides to accept the certificate, remember that fact,
* create a new connection, and return %TRUE from the signal handler
* the next time.
*
* If you are doing I/O in another thread, you do not
* need to worry about this, and can simply block in the signal
* handler until the UI thread returns an answer.
* *
* Return value: %TRUE to accept @peer_cert (which will also * Return value: %TRUE to accept @peer_cert (which will also
* immediately end the signal emission). %FALSE to allow the signal * immediately end the signal emission). %FALSE to allow the signal
@ -282,20 +274,6 @@ g_tls_connection_class_init (GTlsConnectionClass *klass)
static void static void
g_tls_connection_init (GTlsConnection *conn) g_tls_connection_init (GTlsConnection *conn)
{ {
conn->priv = G_TYPE_INSTANCE_GET_PRIVATE (conn, G_TYPE_TLS_CONNECTION, GTlsConnectionPrivate);
}
static void
g_tls_connection_finalize (GObject *object)
{
GTlsConnection *conn = G_TLS_CONNECTION (object);
if (conn->priv->certificate)
g_object_unref (conn->priv->certificate);
if (conn->priv->peer_certificate)
g_object_unref (conn->priv->peer_certificate);
G_OBJECT_CLASS (g_tls_connection_parent_class)->finalize (object);
} }
static void static void
@ -304,22 +282,7 @@ g_tls_connection_get_property (GObject *object,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GTlsConnection *conn = G_TLS_CONNECTION (object);
switch (prop_id)
{
case PROP_CERTIFICATE:
g_value_set_object (value, conn->priv->certificate);
break;
case PROP_PEER_CERTIFICATE:
g_value_set_object (value, conn->priv->peer_certificate);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
} }
static void static void
@ -328,18 +291,57 @@ g_tls_connection_set_property (GObject *object,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GTlsConnection *conn = G_TLS_CONNECTION (object);
switch (prop_id)
{
case PROP_CERTIFICATE:
g_tls_connection_set_certificate (conn, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; }
}
/**
* g_tls_connection_set_use_system_certdb:
* @conn: a #GTlsConnection
* @use_system_certdb: whether to use the system certificate database
*
* Sets whether @conn uses the system certificate database to verify
* peer certificates. This is %TRUE by default. If set to %FALSE, then
* peer certificate validation will always set the
* %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
* #GTlsConnection::accept-certificate will always be emitted on
* client-side connections, unless that bit is not set in
* #GTlsClientConnection:validation-flags).
*
* Since: 2.28
*/
void
g_tls_connection_set_use_system_certdb (GTlsConnection *conn,
gboolean use_system_certdb)
{
g_return_if_fail (G_IS_TLS_CONNECTION (conn));
g_object_set (G_OBJECT (conn),
"use-system-certdb", use_system_certdb,
NULL);
}
/**
* g_tls_connection_get_use_system_certdb:
* @conn: a #GTlsConnection
*
* Gets whether @conn uses the system certificate database to verify
* peer certificates. See g_tls_connection_set_use_system_certdb().
*
* Return value: whether @conn uses the system certificate database
*
* Since: 2.28
*/
gboolean
g_tls_connection_get_use_system_certdb (GTlsConnection *conn)
{
gboolean use_system_certdb;
g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), TRUE);
g_object_get (G_OBJECT (conn),
"use-system-certdb", &use_system_certdb,
NULL);
return use_system_certdb;
} }
/** /**
@ -348,9 +350,23 @@ g_tls_connection_set_property (GObject *object,
* @certificate: the certificate to use for @conn * @certificate: the certificate to use for @conn
* *
* This sets the certificate that @conn will present to its peer * This sets the certificate that @conn will present to its peer
* during the TLS handshake. If this is not set, * during the TLS handshake. For a #GTlsServerConnection, it is
* #GTlsConnection::need-certificate will be emitted during the * mandatory to set this, and that will normally be done at construct
* handshake if needed. * time.
*
* For a #GTlsClientConnection, this is optional. If a handshake fails
* with %G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server
* requires a certificate, and if you try connecting again, you should
* call this method first. You can call
* g_tls_client_connection_get_accepted_cas() on the failed connection
* to get a list of Certificate Authorities that the server will
* accept certificates from.
*
* (It is also possible that a server will allow the connection with
* or without a certificate; in that case, if you don't provide a
* certificate, you can tell that the server requested one by the fact
* that g_tls_client_connection_get_accepted_cas() will return
* non-%NULL.)
* *
* Since: 2.28 * Since: 2.28
*/ */
@ -361,10 +377,7 @@ g_tls_connection_set_certificate (GTlsConnection *conn,
g_return_if_fail (G_IS_TLS_CONNECTION (conn)); g_return_if_fail (G_IS_TLS_CONNECTION (conn));
g_return_if_fail (G_IS_TLS_CERTIFICATE (certificate)); g_return_if_fail (G_IS_TLS_CERTIFICATE (certificate));
if (conn->priv->certificate) g_object_set (G_OBJECT (conn), "certificate", certificate, NULL);
g_object_unref (conn->priv->certificate);
conn->priv->certificate = certificate ? g_object_ref (certificate) : NULL;
g_object_notify (G_OBJECT (conn), "certificate");
} }
/** /**
@ -372,38 +385,73 @@ g_tls_connection_set_certificate (GTlsConnection *conn,
* @conn: a #GTlsConnection * @conn: a #GTlsConnection
* *
* Gets @conn's certificate, as set by * Gets @conn's certificate, as set by
* g_tls_connection_set_certificate() or returned from one of the * g_tls_connection_set_certificate().
* signals.
* *
* Return value: @conn's certificate, or %NULL * Return value: (transfer none): @conn's certificate, or %NULL
* *
* Since: 2.28 * Since: 2.28
*/ */
GTlsCertificate * GTlsCertificate *
g_tls_connection_get_certificate (GTlsConnection *conn) g_tls_connection_get_certificate (GTlsConnection *conn)
{ {
GTlsCertificate *certificate;
g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL); g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
return conn->priv->certificate; g_object_get (G_OBJECT (conn), "certificate", &certificate, NULL);
if (certificate)
g_object_unref (certificate);
return certificate;
} }
/** /**
* g_tls_connection_get_peer_certificate: * g_tls_connection_get_peer_certificate:
* @conn: a #GTlsConnection * @conn: a #GTlsConnection
* *
* Gets @conn's peer's certificate after it has been set during the * Gets @conn's peer's certificate after the handshake has completed.
* handshake. * (It is not set during the emission of
* #GTlsConnection::accept-certificate.)
* *
* Return value: @conn's peer's certificate, or %NULL * Return value: (transfer none): @conn's peer's certificate, or %NULL
* *
* Since: 2.28 * Since: 2.28
*/ */
GTlsCertificate * GTlsCertificate *
g_tls_connection_get_peer_certificate (GTlsConnection *conn) g_tls_connection_get_peer_certificate (GTlsConnection *conn)
{ {
GTlsCertificate *peer_certificate;
g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL); g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
return conn->priv->peer_certificate; g_object_get (G_OBJECT (conn), "peer-certificate", &peer_certificate, NULL);
if (peer_certificate)
g_object_unref (peer_certificate);
return peer_certificate;
}
/**
* g_tls_connection_get_peer_certificate_errors:
* @conn: a #GTlsConnection
*
* Gets the errors associated with validating @conn's peer's
* certificate, after the handshake has completed. (It is not set
* during the emission of #GTlsConnection::accept-certificate.)
*
* Return value: @conn's peer's certificate errors
*
* Since: 2.28
*/
GTlsCertificateFlags
g_tls_connection_get_peer_certificate_errors (GTlsConnection *conn)
{
GTlsCertificateFlags errors;
g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), 0);
g_object_get (G_OBJECT (conn), "peer-certificate-errors", &errors, NULL);
return errors;
} }
/** /**
@ -411,13 +459,12 @@ g_tls_connection_get_peer_certificate (GTlsConnection *conn)
* @conn: a #GTlsConnection * @conn: a #GTlsConnection
* @require_close_notify: whether or not to require close notification * @require_close_notify: whether or not to require close notification
* *
* Sets whether or not @conn requires a proper TLS close notification * Sets whether or not @conn expects a proper TLS close notification
* before closing the connection. If this is %TRUE (the default), then * before the connection is closed. If this is %TRUE (the default),
* calling g_io_stream_close() on @conn will send a TLS close * then @conn will expect to receive a TLS close notification from its
* notification, and likewise it will expect to receive a close * peer before the connection is closed, and will return a
* notification before the connection is closed when reading, and will * %G_TLS_ERROR_EOF error if the connection is closed without proper
* return a %G_TLS_ERROR_EOF error if the connection is closed without * notification (since this may indicate a network error, or
* proper notification (since this may indicate a network error, or
* man-in-the-middle attack). * man-in-the-middle attack).
* *
* In some protocols, the application will know whether or not the * In some protocols, the application will know whether or not the
@ -426,9 +473,18 @@ g_tls_connection_get_peer_certificate (GTlsConnection *conn)
* somehow self-delimiting); in this case, the close notify is * somehow self-delimiting); in this case, the close notify is
* redundant and sometimes omitted. (TLS 1.1 explicitly allows this; * redundant and sometimes omitted. (TLS 1.1 explicitly allows this;
* in TLS 1.0 it is technically an error, but often done anyway.) You * in TLS 1.0 it is technically an error, but often done anyway.) You
* can use g_tls_connection_set_require_close_notify() to tell @conn to * can use g_tls_connection_set_require_close_notify() to tell @conn
* allow an "unannounced" connection close, in which case it is up to * to allow an "unannounced" connection close, in which case the close
* the application to check that the data has been fully received. * will show up as a 0-length read, as in a non-TLS
* #GSocketConnection, and it is up to the application to check that
* the data has been fully received.
*
* Note that this only affects the behavior when the peer closes the
* connection; when the application calls g_io_stream_close() itself
* on @conn, this will send a close notification regardless of the
* setting of this property. If you explicitly want to do an unclean
* close, you can close @conn's #GTlsConnection:base-io-stream rather
* than closing @conn itself.
* *
* Since: 2.28 * Since: 2.28
*/ */
@ -447,8 +503,8 @@ g_tls_connection_set_require_close_notify (GTlsConnection *conn,
* g_tls_connection_get_require_close_notify: * g_tls_connection_get_require_close_notify:
* @conn: a #GTlsConnection * @conn: a #GTlsConnection
* *
* Tests whether or not @conn requires a proper TLS close notification * Tests whether or not @conn expects a proper TLS close notification
* before closing the connection. See * when the connection is closed. See
* g_tls_connection_set_require_close_notify() for details. * g_tls_connection_set_require_close_notify() for details.
* *
* Return value: %TRUE if @conn requires a proper TLS close * Return value: %TRUE if @conn requires a proper TLS close
@ -558,8 +614,7 @@ g_tls_connection_get_rehandshake_mode (GTlsConnection *conn)
* However, you may call g_tls_connection_handshake() later on to * However, you may call g_tls_connection_handshake() later on to
* renegotiate parameters (encryption methods, etc) with the client. * renegotiate parameters (encryption methods, etc) with the client.
* *
* #GTlsConnection::accept_certificate and * #GTlsConnection::accept_certificate may be emitted during the
* #GTlsConnection::need_certificate may be emitted during the
* handshake. * handshake.
* *
* Return value: success or failure * Return value: success or failure
@ -599,7 +654,7 @@ g_tls_connection_handshake_async (GTlsConnection *conn,
{ {
g_return_if_fail (G_IS_TLS_CONNECTION (conn)); g_return_if_fail (G_IS_TLS_CONNECTION (conn));
return G_TLS_CONNECTION_GET_CLASS (conn)->handshake_async (conn, io_priority, G_TLS_CONNECTION_GET_CLASS (conn)->handshake_async (conn, io_priority,
cancellable, cancellable,
callback, user_data); callback, user_data);
} }
@ -644,42 +699,6 @@ g_tls_error_quark (void)
} }
static gboolean
g_tls_connection_certificate_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy)
{
GTlsCertificate *cert;
cert = g_value_get_object (handler_return);
if (cert)
g_value_set_object (return_accu, cert);
return cert != NULL;
}
/**
* g_tls_connection_emit_need_certificate:
* @conn: a #GTlsConnection
*
* Used by #GTlsConnection implementations to emit the
* #GTlsConnection::need-certificate signal.
*
* Returns: a new #GTlsCertificate
*
* Since: 2.28
*/
GTlsCertificate *
g_tls_connection_emit_need_certificate (GTlsConnection *conn)
{
GTlsCertificate *cert = NULL;
g_signal_emit (conn, signals[NEED_CERTIFICATE], 0,
&cert);
return cert;
}
/** /**
* g_tls_connection_emit_accept_certificate: * g_tls_connection_emit_accept_certificate:
* @conn: a #GTlsConnection * @conn: a #GTlsConnection
@ -705,23 +724,3 @@ g_tls_connection_emit_accept_certificate (GTlsConnection *conn,
peer_cert, errors, &accept); peer_cert, errors, &accept);
return accept; return accept;
} }
/**
* g_tls_connection_set_peer_certificate:
* @conn: a #GTlsConnection
* @certificate: the peer certificate
*
* Used by #GTlsConnection implementations to set the connection's
* peer certificate.
*
* Since: 2.28
*/
void
g_tls_connection_set_peer_certificate (GTlsConnection *conn,
GTlsCertificate *certificate)
{
if (conn->priv->peer_certificate)
g_object_unref (conn->priv->peer_certificate);
conn->priv->peer_certificate = certificate ? g_object_ref (certificate) : NULL;
g_object_notify (G_OBJECT (conn), "peer-certificate");
}

View File

@ -58,8 +58,6 @@ struct _GTlsConnectionClass
GIOStreamClass parent_class; GIOStreamClass parent_class;
/* signals */ /* signals */
GTlsCertificate * ( *need_certificate) (GTlsConnection *connection);
gboolean ( *accept_certificate) (GTlsConnection *connection, gboolean ( *accept_certificate) (GTlsConnection *connection,
GTlsCertificate *peer_cert, GTlsCertificate *peer_cert,
GTlsCertificateFlags errors); GTlsCertificateFlags errors);
@ -85,11 +83,16 @@ struct _GTlsConnectionClass
GType g_tls_connection_get_type (void) G_GNUC_CONST; GType g_tls_connection_get_type (void) G_GNUC_CONST;
void g_tls_connection_set_use_system_certdb (GTlsConnection *conn,
gboolean use_system_certdb);
gboolean g_tls_connection_get_use_system_certdb (GTlsConnection *conn);
void g_tls_connection_set_certificate (GTlsConnection *conn, void g_tls_connection_set_certificate (GTlsConnection *conn,
GTlsCertificate *certificate); GTlsCertificate *certificate);
GTlsCertificate *g_tls_connection_get_certificate (GTlsConnection *conn); GTlsCertificate *g_tls_connection_get_certificate (GTlsConnection *conn);
GTlsCertificate *g_tls_connection_get_peer_certificate (GTlsConnection *conn); GTlsCertificate *g_tls_connection_get_peer_certificate (GTlsConnection *conn);
GTlsCertificateFlags g_tls_connection_get_peer_certificate_errors (GTlsConnection *conn);
void g_tls_connection_set_require_close_notify (GTlsConnection *conn, void g_tls_connection_set_require_close_notify (GTlsConnection *conn,
gboolean require_close_notify); gboolean require_close_notify);
@ -124,14 +127,10 @@ GQuark g_tls_error_quark (void);
/*< protected >*/ /*< protected >*/
GTlsCertificate *g_tls_connection_emit_need_certificate (GTlsConnection *conn);
gboolean g_tls_connection_emit_accept_certificate (GTlsConnection *conn, gboolean g_tls_connection_emit_accept_certificate (GTlsConnection *conn,
GTlsCertificate *peer_cert, GTlsCertificate *peer_cert,
GTlsCertificateFlags errors); GTlsCertificateFlags errors);
void g_tls_connection_set_peer_certificate (GTlsConnection *conn,
GTlsCertificate *certificate);
G_END_DECLS G_END_DECLS
#endif /* __G_TLS_CONNECTION_H__ */ #endif /* __G_TLS_CONNECTION_H__ */

View File

@ -78,7 +78,7 @@ g_tls_server_connection_default_init (GTlsServerConnectionInterface *iface)
* *
* Since: 2.28 * Since: 2.28
*/ */
GTlsServerConnection * GIOStream *
g_tls_server_connection_new (GIOStream *base_io_stream, g_tls_server_connection_new (GIOStream *base_io_stream,
GTlsCertificate *certificate, GTlsCertificate *certificate,
GError **error) GError **error)
@ -92,5 +92,5 @@ g_tls_server_connection_new (GIOStream *base_io_stream,
"base-io-stream", base_io_stream, "base-io-stream", base_io_stream,
"certificate", certificate, "certificate", certificate,
NULL); NULL);
return G_TLS_SERVER_CONNECTION (conn); return G_IO_STREAM (conn);
} }

View File

@ -52,7 +52,7 @@ struct _GTlsServerConnectionInterface
GType g_tls_server_connection_get_type (void) G_GNUC_CONST; GType g_tls_server_connection_get_type (void) G_GNUC_CONST;
GTlsServerConnection *g_tls_server_connection_new (GIOStream *base_io_stream, GIOStream * g_tls_server_connection_new (GIOStream *base_io_stream,
GTlsCertificate *certificate, GTlsCertificate *certificate,
GError **error); GError **error);

View File

@ -304,7 +304,7 @@ gboolean g_unix_connection_create_pair (GUnixCo
/** /**
* g_unix_connection_send_credentials: * g_unix_connection_send_credentials:
* @connection: A #GUnixConnection. * @connection: A #GUnixConnection.
* @cancellable: A #GCancellable or %NULL. * @cancellable: (allow-none): A #GCancellable or %NULL.
* @error: Return location for error or %NULL. * @error: Return location for error or %NULL.
* *
* Passes the credentials of the current user the receiving side * Passes the credentials of the current user the receiving side
@ -372,7 +372,7 @@ g_unix_connection_send_credentials (GUnixConnection *connection,
/** /**
* g_unix_connection_receive_credentials: * g_unix_connection_receive_credentials:
* @connection: A #GUnixConnection. * @connection: A #GUnixConnection.
* @cancellable: A #GCancellable or %NULL. * @cancellable: (allow-none): A #GCancellable or %NULL.
* @error: Return location for error or %NULL. * @error: Return location for error or %NULL.
* *
* Receives credentials from the sending end of the connection. The * Receives credentials from the sending end of the connection. The

View File

@ -161,7 +161,7 @@ g_unix_fd_list_new (void)
/** /**
* g_unix_fd_list_new_from_array: * g_unix_fd_list_new_from_array:
* @fds: the initial list of file descriptors * @fds: (array length=n_fds): the initial list of file descriptors
* @n_fds: the length of #fds, or -1 * @n_fds: the length of #fds, or -1
* *
* Creates a new #GUnixFDList containing the file descriptors given in * Creates a new #GUnixFDList containing the file descriptors given in
@ -201,7 +201,8 @@ g_unix_fd_list_new_from_array (const gint *fds,
/** /**
* g_unix_fd_list_steal_fds: * g_unix_fd_list_steal_fds:
* @list: a #GUnixFDList * @list: a #GUnixFDList
* @length: pointer to the length of the returned array, or %NULL * @length: (out) (allow-none): pointer to the length of the returned
* array, or %NULL
* *
* Returns the array of file descriptors that is contained in this * Returns the array of file descriptors that is contained in this
* object. * object.
@ -222,7 +223,8 @@ g_unix_fd_list_new_from_array (const gint *fds,
* This function never returns %NULL. In case there are no file * This function never returns %NULL. In case there are no file
* descriptors contained in @list, an empty array is returned. * descriptors contained in @list, an empty array is returned.
* *
* Returns: an array of file descriptors * Returns: (array length=length) (transfer full): an array of file
* descriptors
* *
* Since: 2.24 * Since: 2.24
*/ */
@ -255,7 +257,8 @@ g_unix_fd_list_steal_fds (GUnixFDList *list,
/** /**
* g_unix_fd_list_peek_fds: * g_unix_fd_list_peek_fds:
* @list: a #GUnixFDList * @list: a #GUnixFDList
* @length: pointer to the length of the returned array, or %NULL * @length: (out) (allow-none): pointer to the length of the returned
* array, or %NULL
* *
* Returns the array of file descriptors that is contained in this * Returns the array of file descriptors that is contained in this
* object. * object.
@ -271,7 +274,8 @@ g_unix_fd_list_steal_fds (GUnixFDList *list,
* This function never returns %NULL. In case there are no file * This function never returns %NULL. In case there are no file
* descriptors contained in @list, an empty array is returned. * descriptors contained in @list, an empty array is returned.
* *
* Returns: an array of file descriptors * Returns: (array length=length) (transfer none): an array of file
* descriptors
* *
* Since: 2.24 * Since: 2.24
*/ */

View File

@ -257,7 +257,8 @@ g_unix_fd_message_new_with_fd_list (GUnixFDList *fd_list)
/** /**
* g_unix_fd_message_steal_fds: * g_unix_fd_message_steal_fds:
* @message: a #GUnixFDMessage * @message: a #GUnixFDMessage
* @length: pointer to the length of the returned array, or %NULL * @length: (out) (allow-none): pointer to the length of the returned
* array, or %NULL
* *
* Returns the array of file descriptors that is contained in this * Returns the array of file descriptors that is contained in this
* object. * object.
@ -277,7 +278,8 @@ g_unix_fd_message_new_with_fd_list (GUnixFDList *fd_list)
* This function never returns %NULL. In case there are no file * This function never returns %NULL. In case there are no file
* descriptors contained in @message, an empty array is returned. * descriptors contained in @message, an empty array is returned.
* *
* Returns: an array of file descriptors * Returns: (array length=length) (transfer full): an array of file
* descriptors
* *
* Since: 2.22 * Since: 2.22
**/ **/

View File

@ -1075,15 +1075,16 @@ get_mount_points_timestamp (void)
} }
/** /**
* g_unix_mounts_get: * g_unix_mounts_get: (skip)
* @time_read: (allow-none): guint64 to contain a timestamp, or %NULL * @time_read: (out) (allow-none): guint64 to contain a timestamp, or %NULL
* *
* Gets a #GList of #GUnixMountEntry containing the unix mounts. * Gets a #GList of #GUnixMountEntry containing the unix mounts.
* If @time_read is set, it will be filled with the mount * If @time_read is set, it will be filled with the mount
* timestamp, allowing for checking if the mounts have changed * timestamp, allowing for checking if the mounts have changed
* with g_unix_mounts_changed_since(). * with g_unix_mounts_changed_since().
* *
* Returns: (element-type utf8) (transfer full): a #GList of the UNIX mounts. * Returns: (element-type GUnixMountEntry) (transfer full):
* a #GList of the UNIX mounts.
**/ **/
GList * GList *
g_unix_mounts_get (guint64 *time_read) g_unix_mounts_get (guint64 *time_read)
@ -1095,15 +1096,15 @@ g_unix_mounts_get (guint64 *time_read)
} }
/** /**
* g_unix_mount_at: * g_unix_mount_at: (skip)
* @mount_path: path for a possible unix mount. * @mount_path: path for a possible unix mount.
* @time_read: guint64 to contain a timestamp. * @time_read: (out) (allow-none): guint64 to contain a timestamp.
* *
* Gets a #GUnixMountEntry for a given mount path. If @time_read * Gets a #GUnixMountEntry for a given mount path. If @time_read
* is set, it will be filled with a unix timestamp for checking * is set, it will be filled with a unix timestamp for checking
* if the mounts have changed since with g_unix_mounts_changed_since(). * if the mounts have changed since with g_unix_mounts_changed_since().
* *
* Returns: (transfer full): a #GUnixMount. * Returns: (transfer full): a #GUnixMountEntry.
**/ **/
GUnixMountEntry * GUnixMountEntry *
g_unix_mount_at (const char *mount_path, g_unix_mount_at (const char *mount_path,
@ -1130,15 +1131,16 @@ g_unix_mount_at (const char *mount_path,
} }
/** /**
* g_unix_mount_points_get: * g_unix_mount_points_get: (skip)
* @time_read: (allow-none): guint64 to contain a timestamp. * @time_read: (out) (allow-none): guint64 to contain a timestamp.
* *
* Gets a #GList of #GUnixMountPoint containing the unix mount points. * Gets a #GList of #GUnixMountPoint containing the unix mount points.
* If @time_read is set, it will be filled with the mount timestamp, * If @time_read is set, it will be filled with the mount timestamp,
* allowing for checking if the mounts have changed with * allowing for checking if the mounts have changed with
* g_unix_mounts_points_changed_since(). * g_unix_mounts_points_changed_since().
* *
* Returns: (element-type utf8) (transfer full): a #GList of the UNIX mountpoints. * Returns: (element-type GUnixMountPoint) (transfer full):
* a #GList of the UNIX mountpoints.
**/ **/
GList * GList *
g_unix_mount_points_get (guint64 *time_read) g_unix_mount_points_get (guint64 *time_read)

Some files were not shown because too many files have changed in this diff Show More