/docs/doc-install.pl
/docs/doc-postprocess.pl
/docs/doxygen.css
+/docs/doxygen-extra.css
/docs/tagfile-to-devhelp2.xsl
/docs/reference/Doxyfile
/docs/reference/doxygen.log
/glib/glibmm-*.pc
/glib/glibmm/balancedtree.cc
/glib/glibmm/balancedtree.h
+/glib/glibmm/binding.cc
+/glib/glibmm/binding.h
/glib/glibmm/bytearray.cc
/glib/glibmm/bytearray.h
/glib/glibmm/bytes.cc
+2.43.1 (unstable):
+
+gmmproc:
+* Tidy up the generation of enum docs
+ (Kjell Ahlstedt)
+* _WRAP_GERROR: Add documentation to the generated enum Code.
+ (Kjell Ahlstedt)
+* Change messages that MS Visual Studio can misunderstand.
+ (Kjell Ahlstedt)
+* Warn when an ignored method or signal doesn't exist.
+ (Marcin Kolny) Bug #737212.
+
+Glib:
+* Add Binding.
+ (Kjell Ahlstedt) Bug #738663.
+* Checksum::ChecksumType: Remove erroneous documentation
+ (Kjell Ahlstedt)
+* Property: Add some documentation.
+ (Kjell Ahlstedt) Bug #523043.
+
+Gio:
+ Add Resource.
+ (Kjell Ahlstedt)
+
+
2.42:
API additions since 2.40:
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([glibmm], [2.42.0],
+AC_INIT([glibmm], [2.43.1],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
AM_MAINTAINER_MODE
AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
-MM_PREREQ([0.9.6])
+MM_PREREQ([0.9.7])
MM_INIT_MODULE([glibmm-2.4])
MM_INIT_MODULE([giomm-2.4])
AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library])
])
-glibreq='2.0 >= 2.42.0'
+glibreq='2.0 >= 2.43.1'
GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq"
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
-HTML_STYLESHEET = "@abs_top_srcdir@/docs/doxygen.css"
-HTML_EXTRA_STYLESHEET =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET = "$(MMDOCTOOLDIR)/doxygen-extra.css"
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
<parameter_description> The native credentials type is a <type>struct cmsgcred</type>.
</parameter_description>
</parameter>
-<parameter name="G_CREDENTIALS_TYPE_NETBSD_UNPCBID">
-<parameter_description> The native credentials type is a <type>struct unpcbid</type>.
-</parameter_description>
-</parameter>
<parameter name="G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED">
<parameter_description> The native credentials type is a <type>struct sockpeercred</type>. Added in 2.30.
</parameter_description>
<parameter_description> The native credentials type is a <type>ucred_t</type>. Added in 2.40.
</parameter_description>
</parameter>
+<parameter name="G_CREDENTIALS_TYPE_NETBSD_UNPCBID">
+<parameter_description> The native credentials type is a <type>struct unpcbid</type>.
+</parameter_description>
+</parameter>
</parameters>
</enum>
Note that this domain may be extended in future GLib releases. In
general, new error codes either only apply to new APIs, or else
-replace #G_IO_ERROR_FAILED in cases that were not explicitly
+replace %G_IO_ERROR_FAILED in cases that were not explicitly
distinguished before. You should therefore avoid writing code like
|[<!-- language="C" -->
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED))
<parameter_description> Broken pipe. Since 2.36
</parameter_description>
</parameter>
+<parameter name="G_IO_ERROR_CONNECTION_CLOSED">
+<parameter_description> Connection closed by peer. Note that this
+is the same code as %G_IO_ERROR_BROKEN_PIPE; before 2.44 some
+"connection closed" errors returned %G_IO_ERROR_BROKEN_PIPE, but others
+returned %G_IO_ERROR_FAILED. Now they should all return the same
+value, which has this more logical name. Since 2.44.
+</parameter_description>
+</parameter>
+<parameter name="G_IO_ERROR_NOT_CONNECTED">
+<parameter_description> Transport endpoint is not connected. Since 2.44
+</parameter_description>
+</parameter>
</parameters>
</enum>
If cancellable is currently in use by any cancellable operation
then the behavior of this function is undefined.
+Note that it is generally not a good idea to reuse an existing
+cancellable for more operations after it has been cancelled once,
+as this function might tempt you to do. The recommended practice
+is to drop the reference to a cancellable after cancelling it,
+and let it die with the outstanding async operations. You should
+create a fresh cancellable for further async operations.
+
</description>
<parameters>
<parameter name="cancellable">
For convenience, you can call this with a %NULL #GCancellable,
in which case the source will never trigger.
+The new #GSource will hold a reference to the #GCancellable.
+
Since: 2.28
</description>
<function name="g_file_equal">
<description>
-Checks equality of two given #GFiles.
+Checks if the two given #GFiles refer to the same file.
Note that two #GFiles that differ can still refer to the same
file on the filesystem due to various forms of filename
so a path like /foo is not considered a prefix of /foobar, only
of /foo/bar.
+A #GFile is not a prefix of itself. If you want to check for
+equality, use g_file_equal().
+
This call does no I/O, as it works purely on names. As such it can
sometimes return %FALSE even if @file is inside a @prefix (from a
filesystem point of view), because the prefix of @file is an alias
operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
returned.
-If you pass in a non-%NULL @etag value, then this value is
-compared to the current entity tag of the file, and if they differ
-an %G_IO_ERROR_WRONG_ETAG error is returned. This generally means
-that the file has been changed since you last read it. You can get
-the new etag from g_file_output_stream_get_etag() after you've
-finished writing and closed the #GFileOutputStream. When you load
-a new file you can use g_file_input_stream_query_info() to get
-the etag of the file.
+If you pass in a non-%NULL @etag value and @file already exists, then
+this value is compared to the current entity tag of the file, and if
+they differ an %G_IO_ERROR_WRONG_ETAG error is returned. This
+generally means that the file has been changed since you last read
+it. You can get the new etag from g_file_output_stream_get_etag()
+after you've finished writing and closed the #GFileOutputStream. When
+you load a new file you can use g_file_input_stream_query_info() to
+get the etag of the file.
If @make_backup is %TRUE, this function will attempt to make a
backup of the current file before overwriting it. If this fails
read into @buffer.
If there is an error during the operation %FALSE is returned and @error
-is set to indicate the error status, @bytes_read is updated to contain
-the number of bytes read into @buffer before the error occurred.
+is set to indicate the error status.
+
+As a special exception to the normal conventions for functions that
+use #GError, if this function returns %FALSE (and sets @error) then
+@bytes_read will be set to the number of bytes that were successfully
+read before the error was encountered. This functionality is only
+available from C. If you need it from another language then you must
+write your own loop around g_input_stream_read().
</description>
</return>
</function>
+<function name="g_input_stream_read_all_async">
+<description>
+Request an asynchronous read of @count bytes from the stream into the
+buffer starting at @buffer.
+
+This is the asynchronous equivalent of g_input_stream_read_all().
+
+Call g_input_stream_read_all_finish() to collect the result.
+
+Any outstanding I/O request with higher priority (lower numerical
+value) will be executed before an outstanding request with lower
+priority. Default priority is %G_PRIORITY_DEFAULT.
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="stream">
+<parameter_description> A #GInputStream
+</parameter_description>
+</parameter>
+<parameter name="buffer">
+<parameter_description> a buffer to
+read data into (which should be at least count bytes long)
+</parameter_description>
+</parameter>
+<parameter name="count">
+<parameter_description> the number of bytes that will be read from the stream
+</parameter_description>
+</parameter>
+<parameter name="io_priority">
+<parameter_description> the [I/O priority][io-priority] of the request
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> optional #GCancellable object, %NULL to ignore
+</parameter_description>
+</parameter>
+<parameter name="callback">
+<parameter_description> callback to call when the request is satisfied
+</parameter_description>
+</parameter>
+<parameter name="user_data">
+<parameter_description> the data to pass to callback function
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_input_stream_read_all_finish">
+<description>
+Finishes an asynchronous stream read operation started with
+g_input_stream_read_all_async().
+
+As a special exception to the normal conventions for functions that
+use #GError, if this function returns %FALSE (and sets @error) then
+@bytes_read will be set to the number of bytes that were successfully
+read before the error was encountered. This functionality is only
+available from C. If you need it from another language then you must
+write your own loop around g_input_stream_read_async().
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="stream">
+<parameter_description> a #GInputStream
+</parameter_description>
+</parameter>
+<parameter name="result">
+<parameter_description> a #GAsyncResult
+</parameter_description>
+</parameter>
+<parameter name="bytes_read">
+<parameter_description> location to store the number of bytes that was read from the stream
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a #GError location to store the error occurring, or %NULL to ignore
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE on success, %FALSE if there was an error
+
+</return>
+</function>
+
<function name="g_input_stream_read_async">
<description>
Request an asynchronous read of @count bytes from the stream into the buffer
Creates a new #GSocketConnectable for connecting to the given
@hostname and @port.
+Note that depending on the configuration of the machine, a
+@hostname of `localhost` may refer to the IPv4 loopback address
+only, or to both IPv4 and IPv6; use
+g_network_address_new_loopback() to create a #GNetworkAddress that
+is guaranteed to resolve to both addresses.
+
Since: 2.22
</description>
</return>
</function>
+<function name="g_network_address_new_loopback">
+<description>
+Creates a new #GSocketConnectable for connecting to the local host
+over a loopback connection to the given @port. This is intended for
+use in connecting to local services which may be running on IPv4 or
+IPv6.
+
+The connectable will return IPv4 and IPv6 loopback addresses,
+regardless of how the host resolves `localhost`. By contrast,
+g_network_address_new() will often only return an IPv4 address when
+resolving `localhost`, and an IPv6 address for `localhost6`.
+
+g_network_address_get_hostname() will always return `localhost` for
+#GNetworkAddresses created with this constructor.
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="port">
+<parameter_description> the port
+</parameter_description>
+</parameter>
+</parameters>
+<return> the new #GNetworkAddress
+
+</return>
+</function>
+
<function name="g_network_address_parse">
<description>
Creates a new #GSocketConnectable for connecting to the given
is set to @count.
If there is an error during the operation %FALSE is returned and @error
-is set to indicate the error status, @bytes_written is updated to contain
-the number of bytes written into the stream before the error occurred.
+is set to indicate the error status.
+
+As a special exception to the normal conventions for functions that
+use #GError, if this function returns %FALSE (and sets @error) then
+@bytes_written will be set to the number of bytes that were
+successfully written before the error was encountered. This
+functionality is only available from C. If you need it from another
+language then you must write your own loop around
+g_output_stream_write().
</description>
</return>
</function>
+<function name="g_output_stream_write_all_async">
+<description>
+Request an asynchronous write of @count bytes from @buffer into
+the stream. When the operation is finished @callback will be called.
+You can then call g_output_stream_write_all_finish() to get the result of the
+operation.
+
+This is the asynchronous version of g_output_stream_write_all().
+
+Call g_output_stream_write_all_finish() to collect the result.
+
+Any outstanding I/O request with higher priority (lower numerical
+value) will be executed before an outstanding request with lower
+priority. Default priority is %G_PRIORITY_DEFAULT.
+
+Note that no copy of @buffer will be made, so it must stay valid
+until @callback is called.
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="stream">
+<parameter_description> A #GOutputStream
+</parameter_description>
+</parameter>
+<parameter name="buffer">
+<parameter_description> the buffer containing the data to write
+</parameter_description>
+</parameter>
+<parameter name="count">
+<parameter_description> the number of bytes to write
+</parameter_description>
+</parameter>
+<parameter name="io_priority">
+<parameter_description> the io priority of the request
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> optional #GCancellable object, %NULL to ignore
+</parameter_description>
+</parameter>
+<parameter name="callback">
+<parameter_description> callback to call when the request is satisfied
+</parameter_description>
+</parameter>
+<parameter name="user_data">
+<parameter_description> the data to pass to callback function
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_output_stream_write_all_finish">
+<description>
+Finishes an asynchronous stream write operation started with
+g_output_stream_write_all_async().
+
+As a special exception to the normal conventions for functions that
+use #GError, if this function returns %FALSE (and sets @error) then
+@bytes_written will be set to the number of bytes that were
+successfully written before the error was encountered. This
+functionality is only available from C. If you need it from another
+language then you must write your own loop around
+g_output_stream_write_async().
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="stream">
+<parameter_description> a #GOutputStream
+</parameter_description>
+</parameter>
+<parameter name="result">
+<parameter_description> a #GAsyncResult
+</parameter_description>
+</parameter>
+<parameter name="bytes_written">
+<parameter_description> location to store the number of bytes that was written to the stream
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a #GError location to store the error occurring, or %NULL to ignore.
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE on success, %FALSE if there was an error
+
+</return>
+</function>
+
<function name="g_output_stream_write_async">
<description>
Request an asynchronous write of @count bytes from @buffer into
<function name="g_tcp_connection_set_graceful_disconnect">
<description>
-This enabled graceful disconnects on close. A graceful disconnect
+This enables graceful disconnects on close. A graceful disconnect
means that we signal the receiving end that the connection is terminated
and wait for it to close the connection before closing the connection.
<function name="g_tls_certificate_new_from_file">
<description>
-Creates a #GTlsCertificate from the PEM-encoded data in @file. If
-@file cannot be read or parsed, the function will return %NULL and
+Creates a #GTlsCertificate from the PEM-encoded data in @file. The
+returned certificate will be the first certificate found in @file. As
+of GLib 2.44, if @file contains more certificates it will try to load
+a certificate chain. All certificates will be verified in the order
+found (top-level certificate should be the last one in the file) and
+the #GTlsCertificate:issuer property of each certificate will be set
+accordingly if the verification succeeds. If any certificate in the
+chain cannot be verified, the first certificate in the file will
+still be returned.
+
+If @file cannot be read or parsed, the function will return %NULL and
set @error. Otherwise, this behaves like
g_tls_certificate_new_from_pem().
<function name="g_tls_certificate_new_from_files">
<description>
Creates a #GTlsCertificate from the PEM-encoded data in @cert_file
-and @key_file. If either file cannot be read or parsed, the
-function will return %NULL and set @error. Otherwise, this behaves
-like g_tls_certificate_new_from_pem().
+and @key_file. The returned certificate will be the first certificate
+found in @cert_file. As of GLib 2.44, if @cert_file contains more
+certificates it will try to load a certificate chain. All
+certificates will be verified in the order found (top-level
+certificate should be the last one in the file) and the
+#GTlsCertificate:issuer property of each certificate will be set
+accordingly if the verification succeeds. If any certificate in the
+chain cannot be verified, the first certificate in the file will
+still be returned.
+
+If either file cannot be read or parsed, the function will return
+%NULL and set @error. Otherwise, this behaves like
+g_tls_certificate_new_from_pem().
Since: 2.28
</description>
<parameters>
<parameter name="cert_file">
-<parameter_description> file containing a PEM-encoded certificate to import
+<parameter_description> file containing one or more PEM-encoded certificates to
+import
</parameter_description>
</parameter>
<parameter name="key_file">
<function name="g_tls_certificate_new_from_pem">
<description>
-Creates a new #GTlsCertificate from the PEM-encoded data in @data.
-If @data includes both a certificate and a private key, then the
+Creates a #GTlsCertificate from the PEM-encoded data in @data. If
+@data includes both a certificate and a private key, then the
returned certificate will include the private key data as well. (See
the #GTlsCertificate:private-key-pem property for information about
supported formats.)
-If @data includes multiple certificates, only the first one will be
-parsed.
+The returned certificate will be the first certificate found in
+@data. As of GLib 2.44, if @data contains more certificates it will
+try to load a certificate chain. All certificates will be verified in
+the order found (top-level certificate should be the last one in the
+file) and the #GTlsCertificate:issuer property of each certificate
+will be set accordingly if the verification succeeds. If any
+certificate in the chain cannot be verified, the first certificate in
+the file will still be returned.
Since: 2.28
;; G_IO_ERROR_PROXY_AUTH_FAILED,
;; G_IO_ERROR_PROXY_NEED_AUTH,
;; G_IO_ERROR_PROXY_NOT_ALLOWED,
-;; G_IO_ERROR_BROKEN_PIPE
+;; G_IO_ERROR_BROKEN_PIPE,
+;; G_IO_ERROR_CONNECTION_CLOSED = G_IO_ERROR_BROKEN_PIPE,
+;; G_IO_ERROR_NOT_CONNECTED
;; } GIOErrorEnum;
(define-enum-extended IOErrorEnum
'("proxy-need-auth" "G_IO_ERROR_PROXY_NEED_AUTH" "42")
'("proxy-not-allowed" "G_IO_ERROR_PROXY_NOT_ALLOWED" "43")
'("broken-pipe" "G_IO_ERROR_BROKEN_PIPE" "44")
+ '("connection-closed" "G_IO_ERROR_CONNECTION_CLOSED" "44")
+ '("not-connected" "G_IO_ERROR_NOT_CONNECTED" "45")
)
)
;; G_CREDENTIALS_TYPE_INVALID,
;; G_CREDENTIALS_TYPE_LINUX_UCRED,
;; G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED,
-;; G_CREDENTIALS_TYPE_NETBSD_UNPCBID,
;; G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED,
-;; G_CREDENTIALS_TYPE_SOLARIS_UCRED
+;; G_CREDENTIALS_TYPE_SOLARIS_UCRED,
+;; G_CREDENTIALS_TYPE_NETBSD_UNPCBID
;; } GCredentialsType;
(define-enum-extended CredentialsType
'("invalid" "G_CREDENTIALS_TYPE_INVALID" "0")
'("linux-ucred" "G_CREDENTIALS_TYPE_LINUX_UCRED" "1")
'("freebsd-cmsgcred" "G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED" "2")
- '("netbsd-unpcbid" "G_CREDENTIALS_TYPE_NETBSD_UNPCBID" "3")
- '("openbsd-sockpeercred" "G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED" "4")
- '("solaris-ucred" "G_CREDENTIALS_TYPE_SOLARIS_UCRED" "5")
+ '("openbsd-sockpeercred" "G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED" "3")
+ '("solaris-ucred" "G_CREDENTIALS_TYPE_SOLARIS_UCRED" "4")
+ '("netbsd-unpcbid" "G_CREDENTIALS_TYPE_NETBSD_UNPCBID" "5")
)
)
'("proxy-need-auth" "G_IO_ERROR_PROXY_NEED_AUTH")
'("proxy-not-allowed" "G_IO_ERROR_PROXY_NOT_ALLOWED")
'("broken-pipe" "G_IO_ERROR_BROKEN_PIPE")
+ '("connection-closed" "G_IO_ERROR_CONNECTION_CLOSED")
+ '("not-connected" "G_IO_ERROR_NOT_CONNECTED")
)
)
'("invalid" "G_CREDENTIALS_TYPE_INVALID")
'("linux-ucred" "G_CREDENTIALS_TYPE_LINUX_UCRED")
'("freebsd-cmsgcred" "G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED")
- '("netbsd-unpcbid" "G_CREDENTIALS_TYPE_NETBSD_UNPCBID")
'("openbsd-sockpeercred" "G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED")
'("solaris-ucred" "G_CREDENTIALS_TYPE_SOLARIS_UCRED")
+ '("netbsd-unpcbid" "G_CREDENTIALS_TYPE_NETBSD_UNPCBID")
)
)
)
)
+(define-method read_all_async
+ (of-object "GInputStream")
+ (c-name "g_input_stream_read_all_async")
+ (return-type "none")
+ (parameters
+ '("void*" "buffer")
+ '("gsize" "count")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method read_all_finish
+ (of-object "GInputStream")
+ (c-name "g_input_stream_read_all_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("gsize*" "bytes_read")
+ '("GError**" "error")
+ )
+)
+
(define-method read_bytes_async
(of-object "GInputStream")
(c-name "g_input_stream_read_bytes_async")
)
)
+(define-function g_network_address_new_loopback
+ (c-name "g_network_address_new_loopback")
+ (return-type "GSocketConnectable*")
+ (parameters
+ '("guint16" "port")
+ )
+)
+
(define-function g_network_address_parse
(c-name "g_network_address_parse")
(return-type "GSocketConnectable*")
)
)
+(define-method write_all_async
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_write_all_async")
+ (return-type "none")
+ (parameters
+ '("const-void*" "buffer")
+ '("gsize" "count")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method write_all_finish
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_write_all_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("gsize*" "bytes_written")
+ '("GError**" "error")
+ )
+)
+
(define-method write_bytes_async
(of-object "GOutputStream")
(c-name "g_output_stream_write_bytes_async")
(define-property use-ssl3
(of-object "GTlsClientConnection")
(prop-type "GParamBoolean")
- (docs "Use SSL 3.0 rather than trying to use TLS 1.x")
+ (docs "Use fallback version of SSL/TLS rather than most recent version")
(readable #t)
(writable #t)
(construct-only #f)
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-
/* Copyright (C) 2012 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
namespace Gio
{
+// Hand-coded because we want ResourceFlags& instead of guint32&.
+void Resource::get_info(const std::string& path, gsize& size,
+ ResourceFlags& flags, ResourceLookupFlags lookup_flags) const
+{
+ guint32 file_flags = 0;
+ GError* gerror = 0;
+ // Ignore the gboolean return value from g_resource_get_info().
+ // gerror is set if and only if the return value is FALSE.
+ g_resource_get_info(const_cast<GResource*>(gobj()), path.c_str(),
+ (GResourceLookupFlags)lookup_flags, &size, &file_flags, &gerror);
+ if (gerror)
+ ::Glib::Error::throw_exception(gerror);
+ flags = static_cast<ResourceFlags>(file_flags);
+}
+
+void Resource::get_file_exists(const std::string& path, ResourceLookupFlags lookup_flags) const
+{
+ GError* gerror = 0;
+ g_resource_get_info(const_cast<GResource*>(gobj()), path.c_str(),
+ (GResourceLookupFlags)lookup_flags, 0, 0, &gerror);
+ if (gerror)
+ ::Glib::Error::throw_exception(gerror);
+}
+
+bool Resource::get_file_exists_nothrow(const std::string& path, ResourceLookupFlags lookup_flags) const
+{
+ return g_resource_get_info(const_cast<GResource*>(gobj()), path.c_str(),
+ (GResourceLookupFlags)lookup_flags, 0, 0, 0);
+}
+
+// Hand-coded because we want ResourceFlags& instead of guint32&.
+//static
+void Resource::get_info_global(const std::string& path, gsize& size,
+ ResourceFlags& flags, ResourceLookupFlags lookup_flags)
+{
+ guint32 file_flags = 0;
+ GError* gerror = 0;
+ // Ignore the gboolean return value from g_resources_get_info().
+ // gerror is set if and only if the return value is FALSE.
+ g_resources_get_info(path.c_str(),
+ (GResourceLookupFlags)lookup_flags, &size, &file_flags, &gerror);
+ if (gerror)
+ ::Glib::Error::throw_exception(gerror);
+ flags = static_cast<ResourceFlags>(file_flags);
+}
+
+//static
+void Resource::get_file_exists_global(const std::string& path, ResourceLookupFlags lookup_flags)
+{
+ GError* gerror = 0;
+ g_resources_get_info(path.c_str(),
+ (GResourceLookupFlags)lookup_flags, 0, 0, &gerror);
+ if (gerror)
+ ::Glib::Error::throw_exception(gerror);
+}
+
+//static
+bool Resource::get_file_exists_global_nothrow(const std::string& path, ResourceLookupFlags lookup_flags)
+{
+ return g_resources_get_info(path.c_str(), (GResourceLookupFlags)lookup_flags, 0, 0, 0);
+}
} // namespace Gio
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-
/* Copyright (C) 2012 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
*/
#include <glibmm/error.h>
+#include <glibmm/refptr.h>
+#include <glibmm/bytes.h>
+#include <giomm/inputstream.h>
+#include <vector>
+#include <string>
_DEFS(giomm,gio)
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GResource GResource;
+#endif
+
namespace Gio
{
*/
_WRAP_GERROR(ResourceError, GResourceError, G_RESOURCE_ERROR, NO_GTYPE)
+_WRAP_ENUM(ResourceFlags, GResourceFlags)
+_WRAP_ENUM(ResourceLookupFlags, GResourceLookupFlags)
+
+/** Resource framework.
+ *
+ * Applications and libraries often contain binary or textual data that is
+ * really part of the application, rather than user data. For instance
+ * Gtk::Builder .ui files, splashscreen images, Gio::Menu markup xml, CSS files,
+ * icons, etc. These are often shipped as files in `$datadir/appname`, or
+ * manually included as literal strings in the code.
+ *
+ * The Gio::Resource API and the <tt>glib-compile-resources</tt> program
+ * provide a convenient and efficient alternative to this which has some nice properties. You
+ * maintain the files as normal files, so its easy to edit them, but during the build the files
+ * are combined into a binary bundle that is linked into the executable. This means that loading
+ * the resource files is efficient (as they are already in memory, shared with other instances) and
+ * simple (no need to check for things like I/O errors or locate the files in the filesystem). It
+ * also makes it easier to create relocatable applications.
+ *
+ * Resource files can also be marked as compressed. Such files will be included in the resource bundle
+ * in a compressed form, but will be automatically uncompressed when the resource is used. This
+ * is very useful e.g. for larger text files that are parsed once (or rarely) and then thrown away.
+ *
+ * Resource files can also be marked to be preprocessed, by setting the value of the
+ * `preprocess` attribute to a comma-separated list of preprocessing options.
+ * The only options currently supported are:
+ *
+ * <dl>
+ * <dt>xml-stripblanks</dt>
+ * <dd>which will use the <tt>xmllint</tt> command
+ * to strip ignorable whitespace from the xml file. For this to work,
+ * the `XMLLINT` environment variable must be set to the full path to
+ * the <tt>xmllint</tt> executable, or <tt>xmllint</tt> must be in the `PATH`; otherwise
+ * the preprocessing step is skipped.</dd>
+ *
+ * <dt>to-pixdata</dt>
+ * <dd>which will use the <tt>gdk-pixbuf-pixdata</tt> command to convert
+ * images to the GdkPixdata format, which allows you to create pixbufs directly using the data inside
+ * the resource file, rather than an (uncompressed) copy of it. For this, the <tt>gdk-pixbuf-pixdata</tt>
+ * program must be in the PATH, or the `GDK_PIXBUF_PIXDATA` environment variable must be
+ * set to the full path to the <tt>gdk-pixbuf-pixdata</tt> executable; otherwise the resource compiler will
+ * abort.</dd>
+ * </dl>
+ *
+ * Resource bundles are created by the <tt>glib-compile-resources</tt> program
+ * which takes an xml file that describes the bundle, and a set of files that the xml references. These
+ * are combined into a binary resource bundle.
+ *
+ * An example resource description:
+ * @code
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * <gresources>
+ * <gresource prefix="/org/gtk/Example">
+ * <file>data/splashscreen.png</file>
+ * <file compressed="true">dialog.ui</file>
+ * <file preprocess="xml-stripblanks">menumarkup.xml</file>
+ * </gresource>
+ * </gresources>
+ * @endcode
+ *
+ * This will create a resource bundle with the following files:
+ * @code
+ * /org/gtk/Example/data/splashscreen.png
+ * /org/gtk/Example/dialog.ui
+ * /org/gtk/Example/menumarkup.xml
+ * @endcode
+ *
+ * Note that all resources in the process share the same namespace, so use java-style
+ * path prefixes (like in the above example) to avoid conflicts.
+ *
+ * You can then use <tt>glib-compile-resources</tt> to compile the xml to a binary bundle
+ * that you can load with Gio::Resource::create_from_file(). However, its more common to use the --generate-source and
+ * --generate-header arguments to create a source file and header to link directly into your application.
+ *
+ * Once a Gio::Resource has been created and registered all the data in it can be accessed globally in the process by
+ * using API calls like Gio::Resource::open_stream_from_global_resources() to stream the data
+ * or Gio::Resource::lookup_data_in_global_resources() to get a direct pointer
+ * to the data. You can also use uris like "resource:///org/gtk/Example/data/splashscreen.png" with Gio::File to access
+ * the resource data.
+ *
+ * There are two forms of the generated source, the default version uses the compiler support for constructor
+ * and destructor functions (where available) to automatically create and register the Gio::Resource on startup
+ * or library load time. If you pass --manual-register, two functions to register/unregister the resource is instead
+ * created. This requires an explicit initialization call in your application/library, but it works on all platforms,
+ * even on the minor ones where this is not available. (Constructor support is available for at least Win32, MacOS and Linux.)
+ *
+ * Note that resource data can point directly into the data segment of e.g. a library, so if you are unloading libraries
+ * during runtime you need to be very careful with keeping around pointers to data from a resource, as this goes away
+ * when the library is unloaded. However, in practice this is not generally a problem, since most resource accesses
+ * is for your own resources, and resource data is often used once, during parsing, and then released.
+ *
+ * @newin{2,44}
+ */
+class Resource
+{
+ _CLASS_OPAQUE_REFCOUNTED(Resource, GResource, NONE, g_resource_ref, g_resource_unref)
+ _IGNORE(g_resource_ref, g_resource_unref)
+
+public:
+ _WRAP_METHOD(static Glib::RefPtr<Resource> create_from_data(const Glib::RefPtr<const Glib::Bytes>& data), g_resource_new_from_data, errthrow)
+ _WRAP_METHOD(static Glib::RefPtr<Resource> create_from_file(const std::string& filename), g_resource_load, errthrow)
+ _WRAP_METHOD(Glib::RefPtr<InputStream> open_stream(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const, g_resource_open_stream, errthrow)
+ _WRAP_METHOD(Glib::RefPtr<const Glib::Bytes> lookup_data(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const, g_resource_lookup_data, errthrow)
+
+#m4 _CONVERSION(`char**',`std::vector<std::string>',`Glib::ArrayHandler<std::string>::array_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<std::string> enumerate_children(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const, g_resource_enumerate_children, errthrow)
+
+ /** Looks for a file at the specified @a path in the resource and
+ * if found returns information about it.
+ *
+ * @a lookup_flags controls the behaviour of the lookup.
+ *
+ * @newin{2,44}
+ *
+ * @param path A pathname inside the resource.
+ * @param[out] size A location to place the length of the contents of the file.
+ * @param[out] flags A location to place the flags about the file.
+ * @param lookup_flags A ResourceLookupFlags.
+ * @throw Gio::ResourceError if the file was not found.
+ */
+ void get_info(const std::string& path, gsize& size, ResourceFlags& flags, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const;
+ _IGNORE(g_resource_get_info)
+
+ /** Looks for a file at the specified @a path in the resource.
+ *
+ * @a lookup_flags controls the behaviour of the lookup.
+ *
+ * @newin{2,44}
+ *
+ * @param path A pathname inside the resource.
+ * @param lookup_flags A ResourceLookupFlags.
+ * @throw Gio::ResourceError if the file was not found.
+ */
+ void get_file_exists(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const;
+
+ /** Looks for a file at the specified @a path in the resource.
+ *
+ * @a lookup_flags controls the behaviour of the lookup.
+ * This method returns a <tt>bool</tt> instead of throwing in exception in case of errors.
+ *
+ * @newin{2,44}
+ *
+ * @param path A pathname inside the resource.
+ * @param lookup_flags A ResourceLookupFlags.
+ * @return <tt>true</tt> if the file was found, <tt>false</tt> if there were errors.
+ */
+ bool get_file_exists_nothrow(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const;
+
+ // 'register' is a keyword. Can't be the name of a method.
+ _WRAP_METHOD(void register_global(), g_resources_register)
+ _WRAP_METHOD(void unregister_global(), g_resources_unregister)
+ _WRAP_METHOD(static Glib::RefPtr<InputStream> open_stream_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE), g_resources_open_stream, errthrow)
+ _WRAP_METHOD(static Glib::RefPtr<const Glib::Bytes> lookup_data_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE), g_resources_lookup_data, errthrow)
+ _WRAP_METHOD(static std::vector<std::string> enumerate_children_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE), g_resources_enumerate_children, errthrow)
+
+ /** Looks for a file at the specified @a path in the set of
+ * globally registered resources and if found returns information about it.
+ *
+ * @a lookup_flags controls the behaviour of the lookup.
+ *
+ * @newin{2,44}
+ *
+ * @param path A pathname inside the resource.
+ * @param[out] size A location to place the length of the contents of the file.
+ * @param[out] flags A location to place the flags about the file.
+ * @param lookup_flags A ResourceLookupFlags.
+ * @throw Gio::ResourceError if the file was not found.
+ */
+ static void get_info_global(const std::string& path, gsize& size, ResourceFlags& flags, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE);
+ _IGNORE(g_resources_get_info)
+
+ /** Looks for a file at the specified @a path in the set of
+ * globally registered resources.
+ *
+ * @a lookup_flags controls the behaviour of the lookup.
+ *
+ * @newin{2,44}
+ *
+ * @param path A pathname inside the resource.
+ * @param lookup_flags A ResourceLookupFlags.
+ * @throw Gio::ResourceError if the file was not found.
+ */
+ static void get_file_exists_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE);
+
+ /** Looks for a file at the specified @a path in the set of
+ * globally registered resources.
+ *
+ * @a lookup_flags controls the behaviour of the lookup.
+ * This method returns a <tt>bool</tt> instead of throwing in exception in case of errors.
+ *
+ * @newin{2,44}
+ *
+ * @param path A pathname inside the resource.
+ * @param lookup_flags A ResourceLookupFlags.
+ * @return <tt>true</tt> if the file was found, <tt>false</tt> if there were errors.
+ */
+ static bool get_file_exists_global_nothrow(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE);
+
+ _IGNORE(g_static_resource_init, g_static_resource_fini, g_static_resource_get_resource)dnl//Used only by the glib-compile-resources command
+};
+
} // namespace Gio
#include <glibmmconfig.h>
//#include <glibmm/i18n.h> //This must be included by the application, after system headers such as <iostream>.
-//Include this first because we need it to be the first thing to include <glib.h>,
-//so we can do an undef trick to still use deprecated API in the header:
+//Include this first because we need it to be the first thing to include <glib.h>,
+//so we can do an undef trick to still use deprecated API in the header:
#include <glibmm/thread.h>
#include <glibmm/threads.h>
#include <glibmm/arrayhandle.h>
#include <glibmm/balancedtree.h>
#include <glibmm/base64.h>
+#ifndef GLIBMM_INCLUDED_FROM_WRAP_INIT_CC
+// wrap_init.cc includes this file after it has cleared G_GNUC_CONST.
+#include <glibmm/binding.h>
+#endif
#include <glibmm/bytearray.h>
#include <glibmm/bytes.h>
#include <glibmm/checksum.h>
-// -*- c++ -*-
#ifndef _GLIBMM_OBJECTBASE_H
#define _GLIBMM_OBJECTBASE_H
*/
void thaw_notify();
- //TODO: Why are these virtual?
+ // Why are these virtual?
+ // Don't know why they were originally made virtual, but it came in handy when
+ // I wrapped GBinding in Glib::Binding. /Kjell
/** Increment the reference count for this object.
* You should never need to do this manually - use the object via a RefPtr instead.
*/
* A property can be used only as direct data member of a type, inheriting from
* Glib::Object. A reference to the object must be passed to the constructor of
* the property.
+ *
+ * You may register new properties for your class (actually for the underlying GType)
+ * simply by adding a Property instance as a class member.
+ * However, your constructor must call the Glib::ObjectBase constructor with a new GType name,
+ * in order to register a new GType.
+ *
+ * Example:
+ * @code
+ * class MyCellRenderer : public Gtk::CellRenderer
+ * {
+ * public:
+ * MyCellRenderer()
+ * :
+ * Glib::ObjectBase (typeid(MyCellRenderer)),
+ * Gtk::CellRenderer(),
+ * property_mybool (*this, "mybool", true),
+ * property_myint_ (*this, "myint", 42)
+ * {}
+ *
+ * virtual ~MyCellRenderer() {}
+ *
+ * // Glib::Property<> can be public,
+ * Glib::Property<bool> property_mybool;
+ * // or private, and combined with Glib::PropertyProxy<>.
+ * Glib::PropertyProxy<int> property_myint() { return property_myint_.get_proxy(); }
+ *
+ * private:
+ * Glib::Property<int> property_myint_;
+ * };
+ * @endcode
*/
template <class T>
class Property : public PropertyBase
typedef Glib::Value<T> ValueType;
/** Constructs a property of the @a object with the specified @a name.
- * For each instance of the object, the same property must be constructed with the same name
+ * For each instance of the object, the same property must be constructed with the same name.
*/
Property(Glib::Object& object, const Glib::ustring& name);
* @endcode
*
* You may also receive notification when a property's value changes, by connecting to signal_changed().
- *
- * You may register new properties for your class (actually for the underlying GType)
- * simply by adding a PropertyProxy instance as a class member.
- * However, your constructor must call the Glib::ObjectBase constructor with a new GType name,
- * in order to register a new GType.
*/
template <class T>
class PropertyProxy : public PropertyProxy_Base
--- /dev/null
+/* Copyright (C) 2014 The glibmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/binding.h>
+#include <glib.h>
+
+namespace
+{
+struct BindingTransformSlots
+{
+ BindingTransformSlots(
+ const Glib::Binding::BindingTransformSlot& transform_to,
+ const Glib::Binding::BindingTransformSlot& transform_from)
+ :
+ from_source_to_target(transform_to), from_target_to_source(transform_from)
+ {}
+
+ Glib::Binding::BindingTransformSlot from_source_to_target;
+ Glib::Binding::BindingTransformSlot from_target_to_source;
+};
+
+gboolean Binding_transform_callback_common(GBinding* binding,
+ const GValue* from_value, GValue* to_value,
+ Glib::Binding::BindingTransformSlot& the_slot)
+{
+ bool result = false;
+ try
+ {
+ Glib::RefPtr<Glib::Binding> cpp_binding = Glib::wrap(binding, true);
+ result = the_slot(cpp_binding, from_value, to_value);
+ }
+ catch (...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ return result;
+}
+
+gboolean Binding_transform_to_callback(GBinding* binding,
+ const GValue* from_value, GValue* to_value, gpointer user_data)
+{
+ Glib::Binding::BindingTransformSlot& the_slot =
+ static_cast<BindingTransformSlots*>(user_data)->from_source_to_target;
+
+ return Binding_transform_callback_common(binding, from_value, to_value, the_slot);
+}
+
+gboolean Binding_transform_from_callback(GBinding* binding,
+ const GValue* from_value, GValue* to_value, gpointer user_data)
+{
+ Glib::Binding::BindingTransformSlot& the_slot =
+ static_cast<BindingTransformSlots*>(user_data)->from_target_to_source;
+
+ return Binding_transform_callback_common(binding, from_value, to_value, the_slot);
+}
+
+void Binding_transform_callback_destroy(gpointer user_data)
+{
+ delete static_cast<BindingTransformSlots*>(user_data);
+}
+
+} // anonymous namespace
+
+namespace Glib
+{
+//static
+Glib::RefPtr<Binding> Binding::bind_property_value(
+ const PropertyProxy_Base& source_property,
+ const PropertyProxy_Base& target_property,
+ BindingFlags flags,
+ const BindingTransformSlot& transform_to,
+ const BindingTransformSlot& transform_from)
+{
+ GBinding* binding = 0;
+ if (transform_to.empty() && transform_from.empty())
+ {
+ // No user-supplied transformations.
+ binding = g_object_bind_property(
+ source_property.get_object()->gobj(), source_property.get_name(),
+ target_property.get_object()->gobj(), target_property.get_name(),
+ (GBindingFlags)flags);
+ }
+ else
+ {
+ // Create copies of the slots. A pointer to this will be passed
+ // through the callback's data parameter. It will be deleted
+ // when Binding_transform_callback_destroy() is called.
+ BindingTransformSlots* slots_copy = new BindingTransformSlots(transform_to, transform_from);
+
+ binding = g_object_bind_property_full(
+ source_property.get_object()->gobj(), source_property.get_name(),
+ target_property.get_object()->gobj(), target_property.get_name(),
+ (GBindingFlags)flags,
+ transform_to.empty() ? 0 : &Binding_transform_to_callback,
+ transform_from.empty() ? 0 : &Binding_transform_from_callback,
+ slots_copy, &Binding_transform_callback_destroy);
+ }
+
+ if (!binding)
+ return Glib::RefPtr<Binding>();
+
+ // Take an extra ref. GBinding uses one ref itself, and drops it if
+ // either the source object or the target object is finalized.
+ // The GBinding object must not be destroyed while there are RefPtrs around.
+ g_object_ref(binding);
+ return Glib::RefPtr<Binding>(new Binding(binding));
+}
+
+void Binding::unbind()
+{
+ // Call g_binding_unbind() only once. It always calls g_object_unref().
+ if (g_binding_get_source(gobj()))
+ g_binding_unbind(gobj());
+}
+
+// Override unreference() from ObjectBase.
+//
+// Why is this necessary? Because GBinding is an unusual kind of GObject.
+// It calls g_object_unref() itself, if either the source object or the
+// target object is finalized, almost like g_binding_unbind().
+// But the GBinding object shall be destroyed when and only when the last
+// reference from a Glib::RefPtr is dropped.
+void Binding::unreference() const
+{
+ GBinding* const binding = const_cast<GBinding*>(gobj());
+
+ // If the last Glib::RefPtr is being deleted, and the binding has not been unbound,
+ // then drop the extra reference that was added by bind_property_value().
+ if (gobject_->ref_count == 2 && g_binding_get_source(binding))
+ g_object_unref(binding);
+
+ Object::unreference();
+}
+
+} // namespace Glib
--- /dev/null
+/* Copyright (C) 2014 The glibmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
+#include <glibmm/value.h>
+
+_DEFS(glibmm,glib)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Glib
+{
+_WRAP_ENUM(BindingFlags, GBindingFlags)
+
+/** Bind two object properties.
+ *
+ * Glib::Binding is the representation of a binding between a property on a
+ * Glib::ObjectBase instance (or source) and another property on another Glib::ObjectBase
+ * instance (or target). Whenever the source property changes, the same
+ * value is applied to the target property; for instance, the following binding:
+ *
+ * @code
+ * Glib::Binding::bind_property(object1->property_a(), object2->property_b());
+ * @endcode
+ *
+ * will cause property_b() of @a object2 to be updated
+ * every time the value of property_a() of @a object1 changes.
+ *
+ * It is possible to create a bidirectional binding between two properties
+ * of two Glib::ObjectBase instances, so that if either property changes, the
+ * other is updated as well, for instance:
+ *
+ * @code
+ * Glib::Binding::bind_property(object1->property_a(), object2->property_b(),
+ * Glib::BINDING_BIDIRECTIONAL);
+ * @endcode
+ *
+ * will keep the two properties in sync.
+ *
+ * It is also possible to set a custom transformation function (in both
+ * directions, in case of a bidirectional binding) to apply a custom
+ * transformation from the source value to the target value before
+ * applying it; for instance, the following binding:
+ *
+ * @code
+ * bool celsius_to_fahrenheit(const Glib::RefPtr<Glib::Binding>& binding,
+ * const double& celsius, double& fahrenheit);
+ * bool fahrenheit_to_celsius(const Glib::RefPtr<Glib::Binding>& binding,
+ * const double& fahrenheit, double& celsius);
+ * Glib::Binding::bind_property(adjustment1->property_value(),
+ * adjustment2->property_value(), Glib::BINDING_BIDIRECTIONAL,
+ * sigc::ptr_fun(celsius_to_fahrenheit), sigc::ptr_fun(fahrenheit_to_celsius));
+ * @endcode
+ *
+ * will keep property_value() of the two adjustments in sync; the
+ * celsius_to_fahrenheit() function will be called whenever
+ * property_value() of @a adjustment1 changes and will transform the current value
+ * of the property before applying it to property_value() of @a adjustment2.
+ *
+ * Vice versa, the fahrenheit_to_celsius() function will be called whenever
+ * property_value() of @a adjustment2 changes, and will transform the
+ * current value of the property before applying it to property_value()
+ * of @a adjustment1.
+ *
+ * Note that Glib::Binding does not resolve cycles by itself; a cycle like
+ *
+ * @code
+ * object1->property_A() -> object2->property_B()
+ * object2->property_B() -> object3->property_C()
+ * object3->property_C() -> object1->property_A()
+ * @endcode
+ *
+ * might lead to an infinite loop. The loop, in this particular case,
+ * can be avoided if the objects emit the GObject::notify signal only
+ * if the value has effectively been changed. A binding is implemented
+ * using the GObject::notify signal, so it is susceptible to all the
+ * various ways of blocking a signal emission, like Glib::SignalProxyNormal::emission_stop()
+ * or g_signal_handler_block().
+ *
+ * A binding will be severed, and the resources it allocates freed, whenever
+ * either one of the Glib::ObjectBase instances it refers to is deleted,
+ * when unbind() is called, or when the Glib::Binding instance loses
+ * its last reference.
+ *
+ * @newin{2,44}
+ */
+class Binding : public Glib::Object
+{
+ _CLASS_GOBJECT(Binding, GBinding, G_BINDING, Glib::Object, GObject)
+
+public:
+ /** For instance,<br>
+ * bool on_transform_to(const Glib::RefPtr<Binding>& binding, const GValue* from_value, GValue* to_value);
+ *
+ * @return <tt>true</tt> if the transformation was successful, and <tt>false</tt> otherwise.
+ */
+ typedef sigc::slot<bool, const Glib::RefPtr<Binding>&, const GValue*, GValue*> BindingTransformSlot;
+
+ /** Creates a binding between @a source_property and @a target_property,
+ * allowing you to set the transformation functions to be used by the binding.
+ *
+ * If @a flags contains Glib::BINDING_BIDIRECTIONAL then the binding will be mutual:
+ * if @a target_property changes then the @a source_property
+ * will be updated as well. The @a transform_from function is only used in case
+ * of bidirectional bindings, otherwise it will be ignored.
+ *
+ * The binding will automatically be removed when either the source or the
+ * target instance is deleted. To remove the binding without affecting the
+ * source and the target you can call unbind() on the returned Binding instance.
+ *
+ * A Glib::ObjectBase instance can have multiple bindings.
+ *
+ * If you supply transformation functions, it is usually easier to use one of the
+ * bind_property() overloads, to avoid the use of GValue in the transformation functions.
+ *
+ * @param source_property The source property to bind.
+ * @param target_property The target property to bind.
+ * @param flags Flags to pass to Binding.
+ * @param transform_to The transformation function from the source to the target,
+ * or an empty slot to use the default.
+ * @param transform_from The transformation function from the target to the source,
+ * or an empty slot to use the default.
+ * @return The Binding instance representing the binding between the two
+ * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ *
+ * @newin{2,44}
+ */
+ static Glib::RefPtr<Binding> bind_property_value(
+ const PropertyProxy_Base& source_property,
+ const PropertyProxy_Base& target_property,
+ BindingFlags flags = BINDING_DEFAULT,
+ const BindingTransformSlot& transform_to = BindingTransformSlot(),
+ const BindingTransformSlot& transform_from = BindingTransformSlot());
+
+ _IGNORE(g_object_bind_property, g_object_bind_property_full, g_object_bind_property_with_closures)
+
+ /** Creates a binding between @a source_property and @a target_property.
+ *
+ * @param source_property The source property to bind.
+ * @param target_property The target property to bind.
+ * @param flags Flags to pass to Binding.
+ * @return The Binding instance representing the binding between the two
+ * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ *
+ * @see bind_property_value()
+ *
+ * @newin{2,44}
+ */
+ static Glib::RefPtr<Binding> bind_property(
+ const PropertyProxy_Base& source_property,
+ const PropertyProxy_Base& target_property,
+ BindingFlags flags = BINDING_DEFAULT)
+ {
+ return bind_property_value(source_property, target_property, flags);
+ }
+
+ /** Creates a binding between @a source_property and @a target_property,
+ * allowing you to set a transformation function to be used by the binding.
+ *
+ * @param source_property The source property to bind.
+ * @param target_property The target property to bind.
+ * @param flags Flags to pass to Binding.
+ * @param transform_to The transformation function from the source to the target,
+ * or an empty slot to use the default.
+ * @return The Binding instance representing the binding between the two
+ * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ *
+ * @tparam T_source Type of the source property. Must be a type that can be
+ * stored in a Glib::Value<T_source> object.
+ * @tparam T_target Type of the target property. Must be a type that can be
+ * stored in a Glib::Value<T_target> object.
+ * @tparam T_functor_to Type of functor that translates from the source to the target.
+ * Must be convertible to<br>
+ * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>.
+ *
+ * @see bind_property_value()
+ *
+ * @newin{2,44}
+ */
+ template <typename T_source, typename T_target, typename T_functor_to>
+ static Glib::RefPtr<Binding> bind_property(
+ const PropertyProxy<T_source>& source_property,
+ const PropertyProxy<T_target>& target_property,
+ BindingFlags flags,
+ const T_functor_to& transform_to)
+ {
+ sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to;
+
+ return bind_property_value(source_property, target_property, flags,
+ slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to));
+ }
+
+ /** Creates a binding between @a source_property and @a target_property,
+ * allowing you to set a transformation function to be used by the binding.
+ *
+ * @param source_property The source property to bind.
+ * @param target_property The target property to bind.
+ * @param flags Flags to pass to Binding.
+ * @param transform_to The transformation function from the source to the target,
+ * or an empty slot to use the default.
+ * @return The Binding instance representing the binding between the two
+ * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ *
+ * @tparam T_source Type of the source property. Must be a type that can be
+ * stored in a Glib::Value<T_source> object.
+ * @tparam T_target Type of the target property. Must be a type that can be
+ * stored in a Glib::Value<T_target> object.
+ * @tparam T_functor_to Type of functor that translates from the source to the target.
+ * Must be convertible to<br>
+ * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>.
+ *
+ * @see bind_property_value()
+ *
+ * @newin{2,44}
+ */
+ template <typename T_source, typename T_target, typename T_functor_to>
+ static Glib::RefPtr<Binding> bind_property(
+ const PropertyProxy<T_source>& source_property,
+ const PropertyProxy_WriteOnly<T_target>& target_property,
+ BindingFlags flags,
+ const T_functor_to& transform_to)
+ {
+ sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to;
+
+ return bind_property_value(source_property, target_property, flags,
+ slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to));
+ }
+
+ /** Creates a binding between @a source_property and @a target_property,
+ * allowing you to set a transformation function to be used by the binding.
+ *
+ * @param source_property The source property to bind.
+ * @param target_property The target property to bind.
+ * @param flags Flags to pass to Binding.
+ * @param transform_to The transformation function from the source to the target,
+ * or an empty slot to use the default.
+ * @return The Binding instance representing the binding between the two
+ * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ *
+ * @tparam T_source Type of the source property. Must be a type that can be
+ * stored in a Glib::Value<T_source> object.
+ * @tparam T_target Type of the target property. Must be a type that can be
+ * stored in a Glib::Value<T_target> object.
+ * @tparam T_functor_to Type of functor that translates from the source to the target.
+ * Must be convertible to<br>
+ * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>.
+ *
+ * @see bind_property_value()
+ *
+ * @newin{2,44}
+ */
+ template <typename T_source, typename T_target, typename T_functor_to>
+ static Glib::RefPtr<Binding> bind_property(
+ const PropertyProxy_ReadOnly<T_source>& source_property,
+ const PropertyProxy<T_target>& target_property,
+ BindingFlags flags,
+ const T_functor_to& transform_to)
+ {
+ sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to;
+
+ return bind_property_value(source_property, target_property, flags,
+ slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to));
+ }
+
+ /** Creates a binding between @a source_property and @a target_property,
+ * allowing you to set a transformation function to be used by the binding.
+ *
+ * @param source_property The source property to bind.
+ * @param target_property The target property to bind.
+ * @param flags Flags to pass to Binding.
+ * @param transform_to The transformation function from the source to the target,
+ * or an empty slot to use the default.
+ * @return The Binding instance representing the binding between the two
+ * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ *
+ * @tparam T_source Type of the source property. Must be a type that can be
+ * stored in a Glib::Value<T_source> object.
+ * @tparam T_target Type of the target property. Must be a type that can be
+ * stored in a Glib::Value<T_target> object.
+ * @tparam T_functor_to Type of functor that translates from the source to the target.
+ * Must be convertible to<br>
+ * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>.
+ *
+ * @see bind_property_value()
+ *
+ * @newin{2,44}
+ */
+ template <typename T_source, typename T_target, typename T_functor_to>
+ static Glib::RefPtr<Binding> bind_property(
+ const PropertyProxy_ReadOnly<T_source>& source_property,
+ const PropertyProxy_WriteOnly<T_target>& target_property,
+ BindingFlags flags,
+ const T_functor_to& transform_to)
+ {
+ sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to;
+
+ return bind_property_value(source_property, target_property, flags,
+ slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to));
+ }
+
+ /** Creates a binding between @a source_property and @a target_property,
+ * allowing you to set the transformation functions to be used by the binding.
+ *
+ * @param source_property The source property to bind.
+ * @param target_property The target property to bind.
+ * @param flags Flags to pass to Binding.
+ * @param transform_to The transformation function from the source to the target,
+ * or an empty slot to use the default.
+ * @param transform_from The transformation function from the target to the source,
+ * or an empty slot to use the default.
+ * @return The Binding instance representing the binding between the two
+ * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ *
+ * @tparam T_source Type of the source property. Must be a type that can be
+ * stored in a Glib::Value<T_source> object.
+ * @tparam T_target Type of the target property. Must be a type that can be
+ * stored in a Glib::Value<T_target> object.
+ * @tparam T_functor_to Type of functor that translates from the source to the target.
+ * Must be convertible to<br>
+ * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>.
+ * @tparam T_functor_from Type of functor that translates from the target to the source.
+ * Must be convertible to<br>
+ * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_target&, T_source&>.
+ *
+ * @see bind_property_value()
+ *
+ * @newin{2,44}
+ */
+ template <typename T_source, typename T_target, typename T_functor_to, typename T_functor_from>
+ static Glib::RefPtr<Binding> bind_property(
+ const PropertyProxy<T_source>& source_property,
+ const PropertyProxy<T_target>& target_property,
+ BindingFlags flags,
+ const T_functor_to& transform_to,
+ const T_functor_from& transform_from)
+ {
+ sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to;
+ sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_target&, T_source&> slot_transform_from = transform_from;
+
+ return bind_property_value(source_property, target_property, flags,
+ slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to),
+ slot_transform_from.empty() ? BindingTransformSlot() : TransformProp<T_target, T_source>(slot_transform_from));
+ }
+
+ _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_source(), g_binding_get_source, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_source() const, g_binding_get_source, refreturn, constversion)
+ _WRAP_METHOD(Glib::ustring get_source_property() const, g_binding_get_source_property)
+ _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_target(), g_binding_get_target, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_target() const, g_binding_get_target, refreturn, constversion)
+ _WRAP_METHOD(Glib::ustring get_target_property() const, g_binding_get_target_property)
+ _WRAP_METHOD(BindingFlags get_flags() const, g_binding_get_flags)
+
+ /** Explicitly releases the binding between the source and the target
+ * property expressed by this Binding instance.
+ *
+ * The binding is also released if either the source object or the target
+ * object is deleted, or this Binding instance loses its last reference,
+ * i.e. there is no more Glib::RefPtr that holds a pointer to it.
+ *
+ * @newin{2,44}
+ */
+ void unbind();
+ _IGNORE(g_binding_unbind)
+
+ _WRAP_PROPERTY("flags", Glib::BindingFlags)
+ _WRAP_PROPERTY("source", Glib::RefPtr<Glib::ObjectBase>)
+ _WRAP_PROPERTY("source-property", Glib::ustring)
+ _WRAP_PROPERTY("target", Glib::RefPtr<Glib::ObjectBase>)
+ _WRAP_PROPERTY("target-property", Glib::ustring)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ /** Decrement the reference count for this object.
+ * You should never need to do this manually - use the object via a RefPtr instead.
+ */
+ virtual void unreference() const;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+private:
+ // The functor TransformProp can be implicitly converted to a BindingTransformSlot
+ // and used in a call to bind_property_value().
+ template <typename T_from, typename T_to>
+ class TransformProp : public sigc::functor_base
+ {
+ public:
+ typedef bool result_type;
+ typedef sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_from&, T_to&> TypedBindingTransformSlot;
+
+ TransformProp(const TypedBindingTransformSlot& slot) : typed_transform(slot) {}
+
+ bool operator()(const Glib::RefPtr<Binding>& binding, const GValue* from_value, GValue* to_value)
+ {
+ Glib::Value<T_from> from_glib_value;
+ from_glib_value.init(from_value);
+ Glib::Value<T_to> to_glib_value;
+ to_glib_value.init(to_value);
+ T_to to = to_glib_value.get();
+
+ const bool result = typed_transform(binding, from_glib_value.get(), to);
+ to_glib_value.set(to);
+ g_value_copy(to_glib_value.gobj(), to_value);
+ return result;
+ }
+
+ private:
+ TypedBindingTransformSlot typed_transform;
+ };
+};
+
+} // namespace Glib
namespace Glib
{
-
-
//Note: The documentation is a reduced version of the C documentation,
//because this class is only really useful with other C types that we don't bother to wrap.
-//We only wrap it because it is used in the InputStream API.
+//We only wrap it because it is used in the InputStream, OutputStream and Resource APIs.
/** A simple refcounted data type representing an immutable byte sequence
* from an unspecified origin.
{
_CLASS_OPAQUE_COPYABLE(Checksum, GChecksum, NONE, g_checksum_copy, g_checksum_free)
_IGNORE(g_checksum_copy, g_checksum_free)
-public:
- /**
- * @class ChecksumType:
- * @a CHECKSUM_MD5: Use the MD5 hashing algorithm
- * @a CHECKSUM_SHA1: Use the SHA-1 hashing algorithm
- * @a CHECKSUM_SHA256: Use the SHA-256 hashing algorithm
- *
- * The hashing algorithm to be used by Checksum when performing the
- * digest of some data.
- *
- * Note that the ChecksumType enumeration may be extended at a later
- * date to include new hashing algorithm types.
- *
- * @newin{2,16}
- */
+public:
_WRAP_ENUM(ChecksumType, GChecksumType, NO_GTYPE)
#m4 _CONVERSION(`ChecksumType', `GChecksumType', `(($2)$3)')
glib_deprecated_enums.defs \
glib_functions.defs \
glib_extra_objects.defs \
+ glib_signals.defs \
gmodule_enums.defs \
gmodule_functions.defs \
gobject.defs \
glibmm_files_any_hg = \
balancedtree.hg \
+ binding.hg \
bytes.hg \
bytearray.hg \
checksum.hg \
(include glib_enums.defs)
(include glib_deprecated_enums.defs)
(include glib_extra_objects.defs)
+(include glib_signals.defs)
(include gobject_enums.defs)
(include gobject_functions.defs)
(include gmodule_functions.defs)
<enum name="GParamFlags">
<description>
Through the #GParamFlags flag values, certain aspects of parameters
-can be configured. See also #G_PARAM_READWRITE and #G_PARAM_STATIC_STRINGS.
+can be configured. See also #G_PARAM_STATIC_STRINGS.
</description>
<parameters>
</parameter_description>
</parameter>
<parameter name="G_PARAM_CONSTRUCT_ONLY">
-<parameter_description> the parameter will only be set upon object construction
+<parameter_description> the parameter can only be set upon object construction
</parameter_description>
</parameter>
<parameter name="G_PARAM_LAX_VALIDATION">
<parameter_description> Mask covering all debug flags
</parameter_description>
</parameter>
+<parameter name="G_TYPE_DEBUG_INSTANCE_COUNT">
+<parameter_description> Keep a count of instances of each type
+</parameter_description>
+</parameter>
</parameters>
</enum>
allocated for the key and value that get called when removing the
entry from the #GHashTable.
+Since version 2.42 it is permissible for destroy notify functions to
+recursively remove further items from the hash table. This is only
+permissible if the application still holds a reference to the hash table.
+This means that you may need to ensure that the hash table is empty by
+calling g_hash_table_remove_all before releasing the last reference using
+g_hash_table_unref().
+
</description>
<parameters>
</return>
</function>
+<function name="g_option_context_get_strict_posix">
+<description>
+Returns whether strict POSIX code is enabled.
+
+See g_option_context_set_strict_posix() for more information.
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="context">
+<parameter_description> a #GoptionContext
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_option_context_get_summary">
<description>
Returns the summary. See g_option_context_set_summary().
<return></return>
</function>
+<function name="g_option_context_set_strict_posix">
+<description>
+Sets strict POSIX mode.
+
+By default, this mode is disabled.
+
+In strict POSIX mode, the first non-argument parameter encountered
+(eg: filename) terminates argument processing. Remaining arguments
+are treated as non-options and are not attempted to be parsed.
+
+If strict POSIX mode is disabled then parsing is done in the GNU way
+where option arguments can be freely mixed with non-options.
+
+As an example, consider "ls foo -l". With GNU style parsing, this
+will list "foo" in long mode. In strict POSIX style, this will list
+the files named "foo" and "-l".
+
+It may be useful to force strict POSIX mode when creating "verb
+style" command line tools. For example, the "gsettings" command line
+tool supports the global option "--schemadir" as well as many
+subcommands ("get", "set", etc.) which each have their own set of
+arguments. Using strict POSIX mode will allow parsing the global
+options up to the verb name while leaving the remaining options to be
+parsed by the relevant subcommand (which can be determined by
+examining the verb name, which should be present in argv[1] after
+parsing).
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="context">
+<parameter_description> a #GoptionContext
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_option_context_set_summary">
<description>
Adds a string to be displayed in `--help` output before the list
If @dest is %NULL, free @src; otherwise, moves @src into *@dest.
The error variable @dest points to must be %NULL.
+Note that @src is no longer valid after this call. If you want
+to keep using the same GError*, you need to set it to %NULL
+after calling this function on it.
+
</description>
<parameters>
<parameter name="dest">
<function name="g_queue_insert_after">
<description>
-Inserts @data into @queue after @sibling
+Inserts @data into @queue after @sibling.
-@sibling must be part of @queue
+@sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the
+data at the head of the queue.
Since: 2.4
</parameter_description>
</parameter>
<parameter name="sibling">
-<parameter_description> a #GList link that must be part of @queue
+<parameter_description> a #GList link that must be part of @queue, or %NULL to
+push at the head of the queue.
</parameter_description>
</parameter>
<parameter name="data">
<description>
Inserts @data into @queue before @sibling.
-@sibling must be part of @queue.
+@sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the
+data at the tail of the queue.
Since: 2.4
</parameter_description>
</parameter>
<parameter name="sibling">
-<parameter_description> a #GList link that must be part of @queue
+<parameter_description> a #GList link that must be part of @queue, or %NULL to
+push at the tail of the queue.
</parameter_description>
</parameter>
<parameter name="data">
Returns whether there are any handlers connected to @instance for the
given signal id and detail.
+If @detail is 0 then it will only match handlers that were connected
+without detail. If @detail is non-zero then it will match handlers
+connected both without detail and with the given detail. This is
+consistent with how a signal emitted with @detail would be delivered
+to those handlers.
+
One example of when you might use this is when the arguments to the
signal are difficult to compute. A class implementor may opt to not
emit the signal if no one is attached anyway, thus saving the cost
<function name="g_strfreev">
<description>
-Frees a %NULL-terminated array of strings, and the array itself.
-If called on a %NULL value, g_strfreev() simply returns.
+Frees a %NULL-terminated array of strings, as well as each
+string it contains.
+
+If @str_array is %NULL, this function simply returns.
</description>
<parameters>
</return>
</function>
+<function name="g_strv_contains">
+<description>
+Checks if @strv contains @str. @strv must not be %NULL.
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="strv">
+<parameter_description> a %NULL-terminated array of strings
+</parameter_description>
+</parameter>
+<parameter name="str">
+<parameter_description> a string
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if @str is an element of @strv, according to g_str_equal().
+
+</return>
+</function>
+
<function name="g_strv_length">
<description>
Returns the length of the given %NULL-terminated
@error can be %NULL to ignore errors, or non-%NULL to report
errors. An error can only occur when @exclusive is set to %TRUE
and not all @max_threads threads could be created.
-See #GThreadError for possible errors that may occurr.
+See #GThreadError for possible errors that may occur.
Note, even in case of error a valid #GThreadPool is returned.
</return>
</function>
+<function name="g_type_get_instance_count">
+<description>
+Returns the number of instances allocated of the particular type;
+this is only available if GLib is built with debugging support and
+the instance_count debug flag is set (by setting the GOBJECT_DEBUG
+variable to include instance-count).
+
+Since: 2.44
+
+</description>
+<parameters>
+<parameter name="type">
+<parameter_description> a #GType
+</parameter_description>
+</parameter>
+</parameters>
+<return> the number of instances allocated of the given type;
+if instance counts are not available, returns 0.
+
+</return>
+</function>
+
<function name="g_type_get_plugin">
<description>
Returns the #GTypePlugin structure for @type.
(return-type "gboolean")
)
+(define-method set_strict_posix
+ (of-object "GOptionContext")
+ (c-name "g_option_context_set_strict_posix")
+ (return-type "none")
+ (parameters
+ '("gboolean" "strict_posix")
+ )
+)
+
+(define-method get_strict_posix
+ (of-object "GOptionContext")
+ (c-name "g_option_context_get_strict_posix")
+ (return-type "gboolean")
+)
+
(define-method add_main_entries
(of-object "GOptionContext")
(c-name "g_option_context_add_main_entries")
)
)
+(define-function g_strv_contains
+ (c-name "g_strv_contains")
+ (return-type "gboolean")
+ (parameters
+ '("const-gchar*-const*" "strv")
+ '("const-gchar*" "str")
+ )
+)
+
;; From gstringchunk.h
--- /dev/null
+;; From GBinding
+
+(define-property source
+ (of-object "GBinding")
+ (prop-type "GParamObject")
+ (docs "The source of the binding")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+(define-property target
+ (of-object "GBinding")
+ (prop-type "GParamObject")
+ (docs "The target of the binding")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+(define-property source-property
+ (of-object "GBinding")
+ (prop-type "GParamString")
+ (docs "The property on the source to bind")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+(define-property target-property
+ (of-object "GBinding")
+ (prop-type "GParamString")
+ (docs "The property on the target to bind")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+(define-property flags
+ (of-object "GBinding")
+ (prop-type "GParamFlags")
+ (docs "The binding flags")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+;; GBytes is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GChecksum is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GDate is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GDateTime is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GIOChannel is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GKeyFile is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GMainContext is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GMainLoop is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GMatchInfo is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GRegex is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GSource is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GThread is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GVariant is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GVariantBuilder is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+;; GVariantDict is neither a GObject nor a GInterface. Not checked for signals and properties.
+
+
;; G_TYPE_DEBUG_NONE = 0,
;; G_TYPE_DEBUG_OBJECTS = 1 << 0,
;; G_TYPE_DEBUG_SIGNALS = 1 << 1,
-;; G_TYPE_DEBUG_MASK = 0x03
+;; G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2,
+;; G_TYPE_DEBUG_MASK = 0x07
;; } GTypeDebugFlags;
(define-flags-extended TypeDebugFlags
'("none" "G_TYPE_DEBUG_NONE" "0x0")
'("objects" "G_TYPE_DEBUG_OBJECTS" "1 << 0")
'("signals" "G_TYPE_DEBUG_SIGNALS" "1 << 1")
- '("mask" "G_TYPE_DEBUG_MASK" "0x03")
+ '("instance-count" "G_TYPE_DEBUG_INSTANCE_COUNT" "1 << 2")
+ '("mask" "G_TYPE_DEBUG_MASK" "0x07")
)
)
'("none" "G_TYPE_DEBUG_NONE")
'("objects" "G_TYPE_DEBUG_OBJECTS")
'("signals" "G_TYPE_DEBUG_SIGNALS")
+ '("instance-count" "G_TYPE_DEBUG_INSTANCE_COUNT")
'("mask" "G_TYPE_DEBUG_MASK")
)
)
)
)
+(define-method get_instance_count
+ (of-object "GType")
+ (c-name "g_type_get_instance_count")
+ (return-type "int")
+)
+
(define-method register_static
(of-object "GType")
(c-name "g_type_register_static")
Glib::RefPtr<Gio::InetSocketAddress> address =
Gio::InetSocketAddress::create(first_inet_address, 443);
- socket->connect(address);
+ try
+ {
+ socket->connect(address);
+ }
+ catch(const Gio::Error& ex)
+ {
+ std::cout << "Could not connect socket to " <<
+ address->get_address()->to_string() << ":" << address->get_port() <<
+ ". Exception: " << ex.what() << std::endl;
+ return EXIT_FAILURE;
+ }
if(!socket->is_connected())
{
-/* $Id$ */
-
/* generate_defs_gtk.cc
*
* Copyright (C) 2001 The Free Software Foundation
// g_type_init() is deprecated as of 2.36.
// g_type_init();
- std::cout << get_defs( G_TYPE_BYTES )
+ std::cout << get_defs( G_TYPE_BINDING )
+ << get_defs( G_TYPE_BYTES )
<< get_defs( G_TYPE_CHECKSUM )
<< get_defs( G_TYPE_DATE )
<< get_defs( G_TYPE_DATE_TIME )
elsif (/\b_NO_WRAP_INIT_REGISTRATION\b/)
{
$exclude_from_wrap_init{$filename_header} = 1;
- }
+ }
}
shift @ARGV;
print << "EOF";
// Generated by generate_wrap_init.pl -- DO NOT MODIFY!
+#define GLIBMM_INCLUDED_FROM_WRAP_INIT_CC
#include <glibmm.h>
// Disable the 'const' function attribute of the get_type() functions.
# Don't take non-readable construct-only properties into account.
my @properties = grep { $$_{entity_type} eq 'property' and ( $$_{readable} or not $$_{construct_only} ) } @unwrapped;
+ # Don't print a name of any kind between the first and second colon on a line,
+ # if there is any chance that "error" is (part of) the name.
+ # MS Visual Studio will misunderstand.
+ # See https://mail.gnome.org/archives/gtkmm-list/2014-November/msg00044.html
+
local $, = "\ngmmproc: ";
local $\ = "\n";
if (@methods)
{
- print STDERR ("gmmproc: $main::source: Unwrapped functions:",
+ print STDERR ("gmmproc, $main::source: Unwrapped functions:",
map($$_{c_name}, @methods));
}
if (@properties)
{
- print STDERR ("gmmproc: $main::source: Unwrapped properties:",
+ print STDERR ("gmmproc, $main::source: Unwrapped properties:",
map($$_{class} . '::' . $$_{name}, @properties));
}
if (@signals)
{
- print STDERR ("gmmproc: $main::source: Unwrapped signals:",
+ print STDERR ("gmmproc, $main::source: Unwrapped signals:",
map($$_{class} . '::' . $$_{name}, @signals));
}
}
_CONV_ENUM(G,OutputStreamSpliceFlags)
_CONV_ENUM(G,PasswordSave)
_CONV_ENUM(G,ResolverRecordType)
+_CONV_ENUM(G,ResourceFlags)
+_CONV_ENUM(G,ResourceLookupFlags)
_CONV_ENUM(G,SettingsBindFlags)
_CONV_ENUM(G,SocketClientEvent)
_CONV_ENUM(G,SocketFamily)
_CONVERSION(`const Glib::RefPtr<const ProxyAddress>&',`GProxyAddress*',__CONVERT_CONST_REFPTR_TO_P)
+#Resource
+_CONVERSION(`GResource*',`Glib::RefPtr<Resource>',`Glib::wrap($3)')
+
#Settings
_CONVERSION(`GSettings*',`Glib::RefPtr<Settings>',`Glib::wrap($3)')
_CONVERSION(`const Glib::StringArrayHandle&',`const gchar*-const*',`($3).data()')
dnl # These are for fixmegtkconst
_CONVERSION(`const guchar*',`guchar*',`const_cast<guchar*>($3)',`$3')
+_CONV_GLIB_ENUM(BindingFlags)
_CONV_GLIB_ENUM(IOCondition)
_CONV_GLIB_ENUM(IOFlags)
_CONV_GLIB_ENUM(IOStatus)
-dnl $Id$
-
dnl
-dnl _GERROR(PixbufError,GdkPixbufError,GDK_PIXBUF_ERROR,`<enum_value_list>',[NO_GTYPE])
+dnl _GERROR(PixbufError,GdkPixbufError,GDK_PIXBUF_ERROR,`<enum_value_list>',[NO_GTYPE], `<enum_docs>')
+dnl $1 $2 $3 $4 $5 $6
dnl
m4_define(`_GERROR',`dnl
class __CPPNAME__ : public Glib::Error
{
public:
+ /** $6
+ */
enum Code
{
$4
}
}
-sub lookup_enum_documentation($$$)
+sub lookup_enum_documentation($$$$)
{
- my ($c_enum_name, $cpp_enum_name, $ref_flags) = @_;
+ my ($c_enum_name, $cpp_enum_name, $indent, $ref_flags) = @_;
my @subst_in = [];
my @subst_out = [];
remove_example_code($c_enum_name, \$docs);
- # Convert to Doxygen-style comment.
- $docs =~ s/\n/\n \* /g;
- $docs = "\/\*\* " . $docs;
+ # Add indentation and an asterisk on all lines except the first.
+ # $docs does not contain leading "/**" and trailing "*/".
+ $docs =~ s/\n/\n${indent}\* /g;
return $docs;
}
($$text =~ s"<programlisting>.*?</programlisting>"\n[C example ellipted]"sg);
$example_removals += ($$text =~ s"\|\[.*?]\|"\n[C example ellipted]"sg);
- print STDERR "gmmproc: $main::source: $obj_name: Example code discarded.\n"
+ # See "MS Visual Studio" comment in gmmproc.in.
+ print STDERR "gmmproc, $main::source, $obj_name: Example code discarded.\n"
if ($example_removals);
}
}
else
{
- print "DocsParser.pm:lookup_object_of_method(): Warning: GtkDefs::lookup_object() failed for object name=" . $object . ", function name=" . $name . "\n";
+ print "DocsParser.pm: lookup_object_of_method(): Warning: GtkDefs::lookup_object() failed for object name=" . $object . ", function name=" . $name . "\n";
print " This may be a missing define-object in a *.defs file.\n"
}
}
{
my ($self, $cname, $error) = @_;
+ # See "MS Visual Studio" comment in gmmproc.in.
my $str = sprintf("//gtkmmproc error: %s : %s", $cname, $error);
- print STDERR "Output.pm: $main::source: $cname : $error\n";
+ print STDERR "Output.pm, $main::source, $cname : $error\n";
$self->append($str);
}
sub error
{
my $format=shift @_;
- printf STDERR "Output.pm: $main::source: $format",@_;
+ printf STDERR "Output.pm, $main::source: $format",@_;
}
sub ifdef($$)
# Get the enum documentation from the parsed docs.
my $enum_docs =
- DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", \@flags);
-
- # Remove initial Doxygen comment block start ('/**') from the enum docs
- # to merge the passed in Doxygen comment block.
- $enum_docs =~ s/\/\*\*\s+//g;
-
- # Make sure indentation of passed in comment is correct.
- $comment =~ s/\n\s*\*/\n */g;
+ DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", " ", \@flags);
# Merge the passed in comment to the existing enum documentation.
$comment = $comment . "\n * " . $enum_docs;
# Get the existing enum description from the parsed docs.
my $enum_docs =
- DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", \@flags);
+ DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", " ", \@flags);
if($enum_docs eq "")
{
# Include the enum docs in the module's enum docs group.
$enum_docs .= "\n * \@ingroup ${module_canonical}Enums\n";
- # Remove initial Doxygen comment block start ('/**') from the enum docs
- # to merge the passed in Doxygen comment block.
- $enum_docs =~ s/\/\*\*\s+//g;
-
# Merge the passed in comment to the existing enum documentation.
- $comment = "\/\*\* " . $comment . "\n * " . $enum_docs . "\n */\n";
-
- # Make sure indentation of passed in comment is correct.
- $comment =~ s/\n\s*\*/\n */g;
+ $comment = "/** " . $comment . "\n * " . $enum_docs . "\n */\n";
$self->append($comment);
}
my $no_gtype = "";
my $elements = $objEnum->build_element_list(\@flags, \$no_gtype, " ");
- my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',%s)dnl\n",
+ # Get the enum documentation from the parsed docs.
+ my $enum_docs =
+ DocsParser::lookup_enum_documentation("$c_enum", "Code", " ", \@flags);
+
+ # Prevent Doxygen from auto-linking to a class called Error.
+ $enum_docs =~ s/([^%])(Error code)/$1%$2/g;
+
+ my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',%s,\`%s\')dnl\n",
$cpp_type,
$c_enum,
$domain,
$elements,
- $no_gtype
+ $no_gtype,
+ $enum_docs
);
$self->append($str);
sub on_ignore($)
{
my ($self) = @_;
+ my $objOutputter = $$self{objOutputter};
my $str = $self->extract_bracketed_text();
my @args = split(/\s+|,/,$str);
foreach (@args)
{
next if ($_ eq "");
- GtkDefs::lookup_function($_); #Pretend that we've used it.
+ my $objCfunc = GtkDefs::lookup_function($_); #Pretend that we've used it.
+ if(!$objCfunc)
+ {
+ $objOutputter->output_wrap_failed($_, "ignored method defs lookup failed");
+ }
}
}
sub on_ignore_signal($)
{
my ($self) = @_;
+ my $objOutputter = $$self{objOutputter};
my $str = $self->extract_bracketed_text();
$str = string_trim($str);
$str = string_unquote($str);
foreach (@args)
{
next if ($_ eq "");
- GtkDefs::lookup_signal($$self{c_class}, $_); #Pretend that we've used it.
+ my $objCsignal = GtkDefs::lookup_signal($$self{c_class}, $_); #Pretend that we've used it.
+ if(!$objCsignal)
+ {
+ $objOutputter->output_wrap_failed($_, "ignored signal defs lookup failed");
+ }
}
}