Commit Graph

2429 Commits

Author SHA1 Message Date
Olivier Crête
8e65417c6e docs: Change Bugzilla references to GitLab
Including modifications by Philip Withnall <withnall@endlessm.com>
2018-06-15 13:04:39 +01:00
Philip Withnall
8916874ee6 codegen: Add --interface-info-[body|header] modes
These generate basic .c and .h files containing the GDBusInterfaceInfo
for a D-Bus introspection XML file, but no other code (no skeletons,
proxies, GObjects, etc.).

This is useful for projects who want to describe their D-Bus interfaces
using introspection XML, but who wish to implement the interfaces
manually (for various reasons, typically because the skeletons generated
by gdbus-codegen are too simplistic and limiting). Previously, these
projects would have had to write the GDBusInterfaceInfo manually, which
is painstaking and error-prone.

The new --interface-info-[body|header] options are very similar to
--[body|header], but mutually exclusive with them.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
d8c003dea6 Merge branch 'G_SOURCE_FUNC-macro' into 'master'
Add G_SOURCE_FUNC cast macro which suppresses -Wcast-function-type

See merge request GNOME/glib!82
2018-06-14 09:34:12 +00:00
Will Thompson
039fa6897b
Add G_SOURCE_FUNC cast macro which suppresses -Wcast-function-type
This is the workaround suggested by
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type

This warning is not enabled by default during the GLib build, but
applications may want to opt into it.
2018-06-14 10:11:12 +01:00
Emmanuele Bassi
9e5a53d576 Add reference counting types
We have a common pattern for reference counting in GLib, but we always
implement it with ad hoc code. This is a good chance at trying to
standardise the implementation and make it public, so that other code
using GLib can take advantage of shared behaviour and semantics.

Instead of simply taking an integer variable, we should create type
aliases, to immediately distinguish the reference counting semantics of
the code; we can handle mixing atomic reference counting with a
non-atomic type (and vice versa) by using differently signed values for
the atomic and non-atomic cases.

The gatomicrefcount type is modelled on the Linux kernel refcount_t
type; the grefcount type is added to let single-threaded code bases to
avoid paying the price of atomic memory barriers on reference counting
operations.
2018-06-11 14:59:39 +01:00
Ondrej Holy
8df517b457 docs: Document g_unix_mount_for
g_unix_mount_for() has been added into GLib before some time,
however, it is missing in the docs.
2018-06-06 12:24:12 +02:00
Christoph Reiter
3aa23078ac build: Remove the --disable-mem-pools build option and the DISABLE_MEM_POOLS macro
It's mostly not used anymore and doesn't do what it says it does.

The docs state that it affects GList, GSList, GNode, GMemChunks, GSignal,
GType n_preallocs and GBSearchArray while:

* GList, GSList and GNode use GSlice and are not affected
* GMemChunks is gone
* GType npreallocs is ignored

It also states that it can be used to force the usage of g_malloc/g_free,
which is handled by G_SLICE=always-malloc now.

The only places where it's used is in signal handling through GBSearchArray
and in GValueArray (deprecated). Since it's unlikely that anyone wants to
reduce allocation sizes just for those cases remove the build option.
2018-06-02 09:45:55 +02:00
Christoph Reiter
118332dd5c Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option
ENABLE_GC_FRIENDLY_DEFAULT was supposed to set the default for the gc friendliness
while still allowing to force enable it at runtime with G_DEBUG=gc-friendly.

With commit 943a18b564 (6 years ago) things were changed to always set it
according to the content of G_DEBUG in glib_init(), making the default unused.

Since nobody complained since then just remove the macro and the build option.
2018-05-31 07:19:12 +02:00
Emmanuele Bassi
0b4c2eefce Add fuzzy floating point comparison macro
Add a test macro that allows comparing two floating point values for
equality within a certain tolerance.

This macro has been independently reimplemented by various projects:

 * Clutter
 * Graphene
 * colord

https://gitlab.gnome.org/GNOME/glib/issues/914
2018-05-29 10:02:47 +01:00
Emmanuele Bassi
24e98e38d6 Add a macro for checking approximate values
A macro like this is useful to avoid direct comparisons between floating
point values.

https://gitlab.gnome.org/GNOME/glib/issues/914
2018-05-29 09:55:47 +01:00
Philip Withnall
6730309826 Merge branch 'wip/hadess/g-drive-identifier' into 'master'
gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE

See merge request GNOME/glib!10
2018-05-28 16:31:42 +00:00
Bastien Nocera
4c84eac38e gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE
It's a synonym of G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE.
It doesn't change anything except not feeling dirty from using a wrongly
prefixed constant for the object type.

See: #182
2018-05-28 17:13:30 +02:00
Xavier Claessens
3145d88f4b Add mingw64 cross build CI
Fixes #1387.
2018-05-28 09:22:55 -04:00
Pavlo Solntsev
9e62a425bd doc: Interface for derivable object 2018-05-25 12:50:21 -05:00
Ondrej Holy
d0821da524 gio: Add g_unix_mount_get_options
GVfsUDisks2VolumeMonitor handles x-gvfs-hide/x-gvfs-show mount options
used to overwrite our heuristics whether the mount should be shown, or
hidden. Unfortunately, it works currently only for mounts with
corresponding fstab entries, because the options are read over
g_unix_mount_point_get_options. Let's introduce g_unix_mount_get_options
to allow reading of the options for all sort of mounts (e.g. created
over pam_mount, or manually mounted).

(Minor fixes to the documentation by Philip Withnall
<withnall@endlessm.com>.)

https://bugzilla.gnome.org/show_bug.cgi?id=668132
2018-05-16 11:31:42 +01:00
Christian Hergert
ede5c3f8d9 macros: add G_GNUC_NO_INLINE function attribute
https://bugzilla.gnome.org/show_bug.cgi?id=795180
2018-05-09 12:25:06 +01:00
Philip Withnall
6acece5074 ghash: Add g_hash_table_steal_extended()
This is a combination of g_hash_table_lookup_extended() and
g_hash_table_steal(), so that users can combine the two to reduce code
and eliminate a pointless second hash table lookup by
g_hash_table_steal().

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795302
2018-05-08 12:41:13 +01:00
Georges Basile Stavracas Neto
b9b642de06 fileutils: Add g_canonicalize_filename
Getting the canonical filename is a relatively common
operation when dealing with symbolic links.

This commit exposes GLocalFile's implementation of a
filename canonicalizer function, with a few additions
to make it more useful for consumers of it.

Instead of always assuming g_get_current_dir(), the
exposed function allows passing it as an additional
parameter.

This will be used to fix the GTimeZone code to retrieve
the local timezone from a zoneinfo symlink.

(Tweaked by Philip Withnall <withnall@endlessm.com> to drop g_autofree
usage and add some additional tests.)

https://bugzilla.gnome.org/show_bug.cgi?id=111848
2018-04-30 21:54:31 +01:00
Allison Lortie
ad3b2f2387 gmessages: clarify what log levels are for
For a long time we've had it as 'common knowledge' that criticals are
for programmer errors and warnings are for external errors, but we've
never documented that.  Do so.

(Modified by Philip Withnall <withnall@endlessm.com> to apply cleanly to
master; rearranged to fit in with current master documentation.)

https://bugzilla.gnome.org/show_bug.cgi?id=741049
2018-04-23 13:01:17 +01:00
Philip Withnall
cf24867b93 gtimezone: Add g_time_zone_new_offset() convenience constructor
This includes tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=676923
2018-04-13 15:25:26 +01:00
Philip Withnall
8945227743 gtimezone: Add g_time_zone_get_identifier() accessor
This is a non-trivial accessor which gets the identifier string used to
create the GTimeZone — unless the string passed to g_time_zone_new() was
invalid, in which case the identifier will be `UTC`.

Implementing this required reworking how timezone information was loaded
so that the tz->name is always set at the same time as tz->t_info, so
they are in sync. Previously, the tz->name was unconditionally set to
whatever was passed to g_time_zone_new(), and then not updated if the
tz->t_info was eventually set to the default UTC information.

This includes tests for the new g_time_zone_get_identifier() API, and
for the g_date_time_get_timezone() API added in the previous commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795165
2018-04-12 13:25:16 +01:00
Philip Withnall
9ddd17d304 gdatetime: Add g_date_time_get_timezone() accessor
This is a trivial method to get the GTimeZone for the GDateTime.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795165
2018-04-12 13:25:16 +01:00
Mohammed Sadiq
abf28c71b0 docs: Fix typo in examples 2018-04-10 20:01:40 +05:30
Руслан Ижбулатов
6635922072 Platform-dependent header ignore list for gio docs
This is a bit awkward. A more elegant solution would have
ignored *all* headers and then *un-ignored* some of them
if some conditions were met.

Sadly, we cannot really ignore all headers and then "unignore"
them: that's not how arrays in Meson work.

https://bugzilla.gnome.org/show_bug.cgi?id=794557
2018-03-28 11:52:25 +00:00
Frank Dana
523c62aaa6 Remove duplicated option in gio.xml
The gio(1) man page entry for the tree subcommand lists '-h' twice under its Options, because that flag was duplicated in the source xml.

https://bugzilla.gnome.org/show_bug.cgi?id=794473
2018-03-21 14:35:02 +00:00
Emmanuele Bassi
c5c3fa83c9 docs: Use appropriate tags for commands
The glib-compile-resources documentation refers to various command line
tools, and those should be wrapped in the <command> DocBook tag.

https://bugzilla.gnome.org/show_bug.cgi?id=794284
2018-03-14 14:09:24 +00:00
Emmanuele Bassi
7fd17c4337 Support whitespace stripping for JSON resources
Similarly to how glib-compile-resources can call xmllint to eliminate
whitespace in XML files to reduce their size inside a GResource, we can
use json-glib-format to achieve the same result.

The mechanism for using json-glib-format is the same, with a separate
environment variable if we want to direct glib-compile-resources to a
version of json-glib-format that is not the one in the PATH.

https://bugzilla.gnome.org/show_bug.cgi?id=794284
2018-03-14 11:46:17 +00:00
Emmanuele Bassi
9453b97e09 docs: Add G_ENABLE_DIAGNOSTIC
We need to mention this environment variable, so that developers have a
fighting chance of actually using it.

https://bugzilla.gnome.org/show_bug.cgi?id=732184
2018-02-15 11:25:53 +00:00
Allison Lortie
1574321e51 GKeyFile: add API for getting locale of a string
g_key_file_get_locale_string() returns a translated string from the
keyfile.  In some cases, it may be useful to know the locale that that
string came from.

Add a new API, g_key_file_get_locale_for_key(), that returns the locale
of the string.

Include tests.

(Modified by Philip Withnall to rename the API and fix some minor review
issues. Squash in a separate test case commit.)

https://bugzilla.gnome.org/show_bug.cgi?id=605700
2018-02-06 15:51:33 +00:00
Iñigo Martínez
3ef83618d9 gdbus-codegen: Improve documentation
Recent changes has extended the functionality of `gdbus-codegen`
by implementing new options.

This patch extends the documentation including the behaviour of
the new options along the old ones.

(Wording tweaked by Philip Withnall before pushing.)

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-31 22:14:04 +00:00
Emmanuele Bassi
dcfa22549a docs: Small improvements to glib-mkenums man page
Clarify some typical usage of glib-mkenums and its substitutions.
2018-01-16 15:17:54 +00:00
Emmanuele Bassi
e6c3060144 docs: Drop references to Perl in glib-mkenums
The tool was ported to Python, but we should not mention the programming
language used, in case we port it to some other language in the distant
future.
2018-01-16 15:17:53 +00:00
Colin Walters
4808a957b5 GFile: Add g_file_peek_path()
This is a variant of g_file_get_path() which returns a const string to
the caller, rather than transferring ownership.

I've been carrying `gs_file_get_path_cached()` in libgsystem and it
has seen a lot of use in the ostree and flatpak codebases.  There are
probably others too.

I think language bindings like Python/Gjs could also use this to avoid
an extra malloc (i.e. we could transparently replace
`g_file_get_path()` with `g_file_peek_path()`.

(Originally by Colin Walters. Tweaked by Philip Withnall to update to
2.56, change the function name and drop the locking.)

https://bugzilla.gnome.org/show_bug.cgi?id=767976
2018-01-15 18:26:56 +00:00
Iñigo Martínez
e4d68c7b3e gdbus-codegen: Support for separate C header and code generation
gdbus-codegen's options only allow a simultaneous header and source
code generation.

A `--header` and `--body` options have been added along with the
`--output` option which allow separate C header and code
generation.

These options cannot be used in addition to the old options such
as `--generate-c-code`, `--generate-docbook` or
`--output-directory`.

These options have also been added to gdbus-codegen's documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:11:17 +01:00
Iñigo Martínez
c658d03b76 gdbus-codegen: Add support for pragma inclusion guard
The #pragma once is widely supported preprocessor directive that can
be used instead of include guards.

This adds support for using optionally this directive instead of
include guards.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:05:26 +01:00
Iñigo Martínez
e59bce3c74 gdbus-codegen: Move from optparse to argparse
The optparse module is deprecated since version 2.7 and the
development continues with the argparse.

The code has been moved from optparse to argparse when parsing
command-line options. This has also led to the deprecation of the
`--xml-files`, and positional arguments should be used instead.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:03:39 +01:00
Florian Müllner
a55bfeee41 gdesktopappinfo: Add g_desktop_app_info_get_locale_string()
Custom desktop file fields may be translated, but there is currently
no non-hacky way to look up the localized value; fill get gap with
a small wrapper around g_key_file_get_locale_string().

https://bugzilla.gnome.org/show_bug.cgi?id=779413
2018-01-08 16:28:34 +01:00
Philip Withnall
e42ff0105d docs: Mention that we build with strict-aliasing disabled
Hopefully discouraging people from overriding that and building with it
enabled.

Pro-tip: GLib will break.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791622
2018-01-08 12:00:39 +00:00
Arnaud Bonatti
6d009bc56a Add ‘gsettings list-schemas --print-paths’ option
Prints next to the name of non-relocatable schemas their paths.

https://bugzilla.gnome.org/show_bug.cgi?id=792064
2018-01-05 13:01:03 +00:00
howetuft
0e22d19a11 Bug-790839 GApplication command line --help enhancements
In order to enrich information displayed by GApplication command line
handling when --help is invoked, 3 new methods are proposed:
. g_application_set_option_context_parameter_string
. g_application_set_option_context_summary
. g_application_set_option_context_description
Those methods interact with the GApplication's internal GOptionContext
which is created for command line parsing in g_application_parse_command_line.
(please refer to the GOptionContext class for more information about option
context, parameter string, summary and description.)

To illustrate the 3 methods, an example is provided:
. gapplication-example-cmdline4.c
2018-01-03 11:08:37 +00:00
Emmanuele Bassi
8ade1af707 docs: Update the "building GLib" section
The content has slowly gone out of sync with the implementation, and
some of it is also showing its age.
2018-01-01 13:48:46 +00:00
Emmanuele Bassi
b1c7d2433f docs: Remove mention of disable-regex
The `--disable-regex` configuration option was removed with commit
d7063452 from 2012.
2018-01-01 13:16:24 +00:00
Alexander Larsson
f49a93b207 Add support for g_auto[s]list(Type)
This lets you do g_autoptr style cleanup of GList that does deep freeing.

https://bugzilla.gnome.org/show_bug.cgi?id=791342
2017-12-21 16:12:55 +01:00
Martin Blanchard
156d32cb80 gobject: new g_set_weak_pointer() & g_clear_weak_pointer() helpers
Weak-pointers are currently lacking g_set_object() & g_clear_object()
helpers equivalent. New functions (and macros, both are provided) are
convenient in many case, especially for the property's notify-on-set
pattern:

  if (g_set_weak_pointer (...))
    g_object_notify (...)

Inspired by Christian Hergert's original implementation for
gnome-builder.

https://bugzilla.gnome.org/show_bug.cgi?id=749527
2017-12-21 09:59:30 +00:00
Xavier Claessens
62c4768423 Meson: Add missing options and conform to naming guidelines
https://bugzilla.gnome.org/show_bug.cgi?id=790837
2017-12-19 14:56:11 -05:00
Philip Withnall
12fa92dcfa docs: Split GSocketConnectable/GProxyAddressEnumerator documentation
Putting them in the same section causes gtk-doc to mix their properties
together in a single listing, which is confusing.

Since having them in a single section doesn’t really add anything, split
them out to one class per section.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791334
2017-12-12 11:42:45 +00:00
Xavier Claessens
fa8d42de2e Meson: Fix build of gtkdoc
This requires change added in Meson 0.44.0

https://bugzilla.gnome.org/show_bug.cgi?id=786796
2017-12-11 10:25:21 -05:00
Emmanuele Bassi
7d3e6738c5 Remove outdated/obsolete README
The README for the API reference top-level is completely obsolete, so we
should just remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=790896
2017-11-27 12:55:34 +00:00
Ivar Trygve Jarlsby
f5dba7d43c docs: Correct inconsistency in GObject tutorial
The example code defines an interface with three methods. The preceding text
reads 'This interface defines two methods'. This appears to be because the
example code was changed without updating the surrounding text.

https://bugzilla.gnome.org/show_bug.cgi?id=790830
2017-11-26 21:21:34 +00:00
Emmanuele Bassi
bc277bfcef docs: Fix typo in the GObject tutorial
The description of the instance construction does not match the example.
2017-11-25 10:24:07 +00:00
Christian Hergert
2227918dfd file: add g_file_load_bytes()
This adds g_file_load_bytes() to make it more convenient to
load the contents of a GFile as GBytes.

It includes a special casing for gresources to increase the
chances that the GBytes directly references the embedded data
instead of copying to the heap.

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 03:52:41 -08:00
Cosimo Cecchi
5ebd8f6e88 gmain: add g_clear_handle_id API
It's a very common pattern to see code that looks like this in
dispose() or finalize() implementations:

if (priv->source_id > 0)
  {
    g_source_remove (priv->source_id);
    priv->source_id = 0;
  }

This API allows to accomplish the same goal with a single line:

g_clear_handle_id (&priv->source_id, (GClearHandleFunc) g_source_remove);

Thanks to Emmanuele Bassi <ebassi@gnome.org> for making the patch
generic.

https://bugzilla.gnome.org/show_bug.cgi?id=788489
2017-11-07 08:28:45 -08:00
Cosimo Cecchi
44d6052584 gfile: add g_file_new_build_filename()
This is a convenience C API that combines g_build_filename() with
g_file_new_for_path().

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Cosimo Cecchi
374ade1b68 glib: add g_build_filename_valist()
A new public API convenience to build a filename from a va_list.

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Philip Withnall
a12fbd227f docs: Add version and deprecation decorators to gtk-doc ignore list
This allows gtk-doc to recognise a whole lot more API than it could
before. Maintaining the lists between 6 build files is going to be a bit
of a pain, but they only need to be modified once a cycle.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=789087

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Philip Withnall
f33ca578b1 docs: Add 2.56 to the API version reference in glib-docs.xml
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Philip Withnall
6546d87e4a docs: Add recent version check macros to glib-sections.txt
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Stefan Sauer
5163805ec2 docs: fix bogus override for GIConv
GIConv is a typedef'ed pointer, don't claim it is a struct.
https://bugzilla.gnome.org/show_bug.cgi?id=779501
2017-10-27 12:06:41 +01:00
Philip Withnall
1e4221a3f7 gio: Add API for identifying system FS types and device paths
This is needed by gnome-control-center and gnome-settings-daemon; it
makes existing checks from gunixmounts.c public.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788927
2017-10-26 00:19:23 +01:00
Julien Isorce
ea725a6414 gio: add g_socket_join_multicast_group_ssm (IGMPv3 SSM)
It adds support for source-specific multicast IGMPv3.

Allow receiving data only from a specified source when joining
a multicast group.

g_socket_join_multicast_group_ssm can be called multiple times
to allow receiving data from more than one source.

Support IPv4 and IPv6.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740791
2017-10-16 11:14:57 +01:00
Kouhei Sutou
4bdb012aae docs: Fix XML syntax error
Introduced by the following commit:

    commit cd97f93bf7
    Author: Emmanuele Bassi <ebassi@gnome.org>
    Date:   Fri Oct 13 16:05:07 2017 +0100

        docs: Update glib-mkenums man page

        We should show how to properly use glib-mkenums with Autotools, in
        the hope that fewer people will be caught cargo-culting rules written
        in the late '90s.

        https://bugzilla.gnome.org/show_bug.cgi?id=788948

https://bugzilla.gnome.org/show_bug.cgi?id=788978
2017-10-14 09:15:59 +01:00
Emmanuele Bassi
cd97f93bf7 docs: Update glib-mkenums man page
We should show how to properly use glib-mkenums with Autotools, in
the hope that fewer people will be caught cargo-culting rules written
in the late '90s.

https://bugzilla.gnome.org/show_bug.cgi?id=788948
2017-10-13 18:14:57 +01:00
Emmanuele Bassi
bf4f825e84 docs: Update glib-genmarshal man page
We should show how to properly use glib-genmarshal with Autotools, in
the hope that fewer people will be caught cargo-culting rules written
in the late '90s.

https://bugzilla.gnome.org/show_bug.cgi?id=788948
2017-10-13 18:14:56 +01:00
Andrew Potter
5564ddef12 gdate: add g_date_copy()
This will allow passing invalid GDates through GValues.

https://bugzilla.gnome.org/show_bug.cgi?id=760109
2017-10-11 12:13:20 +01:00
Philip Withnall
121b1e5215 docs: Fix incorrect macro name in GType tutorial
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=770459
2017-10-05 15:40:14 +01:00
Colomban Wendling
b090a079f7 Fix documentation about stopping signal emission from inside a hook
Stopping signal emission from an emission hook is, and always has been,
actually forbidden.  Update the documentation not to lie to the reader.

https://bugzilla.gnome.org/show_bug.cgi?id=773355
2017-10-05 15:26:08 +01:00
Philip Withnall
1a5cebec39 docs: Discourage use of gstdio.h and clarify its header requirements
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=781598
2017-09-12 12:20:18 +01:00
Robert Ancell
491f835c17 GDateTime: Support parsing ISO 8601 strings
This supports a subset of ISO 8601 since that is a commonly used standard for
storing date and time information. We support only ISO 8601 strings that contain
full date and time information as this would otherwise not map to GDateTime.
This subset includes all of RFC 3339 which is commonly used on the Internet and
the week and ordinal day formats as these are supported in the GDateTime APIs.

(Minor modification by Philip Withnall to change API versions from 2.54
to 2.56.)

https://bugzilla.gnome.org/show_bug.cgi?id=753459
2017-09-11 19:29:34 +01:00
Carlo Caione
6503352be1 gvariant: Add g_variant_get() example for dicts
In the Dictionary section of the gvariant-format-strings documentation
only how to construct a dictionary is shown.

Add a small example showing how to extract data from a nested dictionary
and specifically from a GVariant of type "(oa{sa{sv})". Move also the
Dictionary section after the GVariant * section for the sake of clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=786737
2017-09-11 09:46:21 +01:00
Daniel Boles
830744b0f4 docs/running: Remove outdated refs, fix name caps
Drop references to old versions of Fedora pointed out by Mohammed Sadiq.

While here, fix the capitalisation of various names to official styles.
2017-08-23 12:21:58 +01:00
Patrick Welche
6fcdf90300 gresource: fix documentation typo 2017-08-22 08:58:56 +01:00
Tim-Philipp Müller
24ea260b4c meson: docs: make gtk-doc find the gobject.types file
Should really use files('gobject.types') instead, but that
seems to get expanded to the build path for some reason:
https://github.com/mesonbuild/meson/issues/1875
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
88e437873a meson: Detect with-docs and with-man automatically
By default, only build man pages and gtk-doc if the build-deps were
found. To force-enable, pass -Dwith-docs=yes and -Dwith-man=yes.

Also use a foreach loop for man pages instead of listing them all
manually
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
e2da3cb599 meson: Port to latest master (2.51.0)
Also remove headers from some gio sources. Headers do not need to be
added to the list of sources.

+ various smaller self-explanatory fixes.
2017-07-13 19:03:39 -04:00
Patrick Griffis
bc2bb5639b meson: Match upstream gtkdoc changes 2017-07-13 19:03:39 -04:00
Patrick Griffis
0df9aab053 meson: Build all docs 2017-07-13 19:03:39 -04:00
Daniel Boles
522ba7303e docs: tut_gsignal: Fix mismatched argument names
The names differed between the argument declaration and its description.
2017-07-11 12:52:23 +01:00
Emmanuele Bassi
93f16a45ab Rewrite glib-genmarshal in Python
We're in the process or rewriting other tools in Python to reduce the
number of dependencies of GLib.

Additionally, making glib-genmarshal a Python script reduces the
complexity when cross-compiling, as we don't need a native build to
generate the marshallers.

https://bugzilla.gnome.org/show_bug.cgi?id=784528
2017-07-10 16:47:47 +01:00
Sébastien Wilmet
cc8b3d6ee2 docs: LGPL: Library -> Lesser
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:35 +02:00
Emmanuele Bassi
0776e02be2 Remove unused ignore file
We're keeping the tmpl directory alive even if we don't need it.
2017-05-14 20:36:20 +01:00
Krzesimir Nowak
ce7e02193b docs: Add index for 2.54 api 2017-05-10 12:04:04 +02:00
Krzesimir Nowak
4fe89b0437 gstrfuncs: Add replacement for string-to-number functions
Very often when we want to convert a string to number, we assume that
the string contains only a number. We have g_ascii_strto* family of
functions to do the conversion but they are awkward to use - one has
to check if errno is zero, end_ptr is not NULL and *end_ptr points to
the terminating nul and then do the bounds checking. Many projects
need this kind of functionality, so it gets reimplemented all the
time.

This commit adds some replacement functions that convert a string to a
signed or unsigned number that also follows the usual way of error
reporting - returning FALSE on failure and filling an error output
parameter.
2017-05-10 12:04:03 +02:00
Philip Withnall
f6f6b3d83c garray: Add g_ptr_array_find[_with_equal_func]()
Partially based on telepathy-glib’s tp_g_ptr_array_contains(), and a
patch by Xavier Claessens <xavier.claessens@collabora.co.uk>.

Test cases included.

https://bugzilla.gnome.org/show_bug.cgi?id=698064
2017-05-02 16:54:41 +01:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Philip Withnall
4c91b7f935 docs: Add GParameter replacement API to gobject-sections.txt
This slipped through the review cracks.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:10:26 +01:00
Garrett Regier
6c95cd22e9 gobject: Add to_string() functions for Enum and Flags types
These are useful for debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=447907
2017-03-30 09:52:28 +01:00
Christoph Reiter
625936343d Make GUnixMountEntry and GUnixMountPoint boxed types
And unskip some functions using them.

https://bugzilla.gnome.org/show_bug.cgi?id=668962
2017-03-28 18:03:08 +02:00
Philip Withnall
7890573f6e gdbus-tool: Add a command to wait for a well-known name on the bus
This is effectively the mc-wait-for-name tool from
telepathy-mission-control; moving it in to gdbus-tool will make it more
widely useful without making people depend on telepathy-mission-control
for no other reason. The code here is reimplemented from scratch to use
GDBus.

It blocks until the specified well-known name is owned by some process
on the bus (which can be the session, system, or any other bus). By
passing --activate, the same (or a different) name can be auto-started
on the bus first.

A timeout can be specified to ensure the process doesn’t block forever.

https://bugzilla.gnome.org/show_bug.cgi?id=745971
2017-03-28 11:23:27 +01:00
Matthias Clasen
626e9e6b6e Add g_content_type_is_mime_type to the docs 2017-03-09 20:35:04 -05:00
Patrick Griffis
ee09bb704f gdbus-codegen: Add --output-directory flag
This is useful with Meson where files are generated in subdirs

https://bugzilla.gnome.org/show_bug.cgi?id=778801
2017-02-27 06:37:44 -05:00
Ondrej Holy
7dbc072c0e doc: Unify order of file attributes
Order of file attributes in docs is different than in source
codes. I don't really think it is intended. Let's unify it.

https://bugzilla.gnome.org/show_bug.cgi?id=777507
2017-02-13 08:12:48 -05:00
Ondrej Holy
006a7d082b fileinfo: Add G_FILE_ATTRIBUTE_RECENT_MODIFIED attribute
Add filesystem attribute to propagate time, when the metadata for the file
in "recent:///" was last changed. This attribute is needed for sorting
recent backend files in client applications.

https://bugzilla.gnome.org/show_bug.cgi?id=777507
2017-02-13 08:12:48 -05:00
Bastien Nocera
215c9b7951 guuid: Add UUID helper functions to GLib
Many UUID users will just need a random string, which can be generated
simply by calling the function g_uuid_string_random().

Based on original patch by
Marc-André Lureau <marcandre.lureau@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=639078
2017-02-06 14:40:38 +01:00
Rico Tzschichholz
cb26c677e6 docs: Add index for 2.52 api 2017-02-05 12:56:48 +01:00
Patrick Griffis
7a8cbc60a5 glib-compile-resources: Add --generate-phony-targets flag
This includes phony targets for each dependency in the the generated
dependency file which allows building with `ninja` which doesn't like
the phony targets[1] but also allows silencing `make` errors similar to
gcc's -MP option.

[1] - https://github.com/ninja-build/ninja/issues/1184

https://bugzilla.gnome.org/show_bug.cgi?id=774368
2016-11-20 13:33:21 -05:00
Patrick Griffis
d1763d899c Revert "glib-compile-resources: Output depfile in same directory as target"
This reverts commit 9006940de6.
2016-11-05 22:15:53 -04:00
Patrick Griffis
9006940de6 glib-compile-resources: Output depfile in same directory as target
https://bugzilla.gnome.org/show_bug.cgi?id=773437
2016-11-02 17:44:23 -04:00
Simon McVittie
c46dbd4752 Make g_utf8_make_valid public
Based on a patch by Simon van der Linden and rebased onto current GLib,
with improved documentation loosely based on Telepathy's
tp_utf8_make_valid().

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=591603
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=610969
Reviewed-by: Colin Walters <walters@verbum.org>
2016-10-13 21:52:42 +01:00
Matthias Clasen
540374c80e Document --output option of glib-mkenums 2016-10-12 18:01:37 -04:00
Matthias Clasen
c382da4819 Document new option of glib-genmarshal 2016-10-12 15:56:49 -04:00
Sam Thursfield
6338cde7ca glib-compile-schemas: Add a --version option
https://bugzilla.gnome.org/show_bug.cgi?id=772269
2016-10-06 21:08:25 +01:00
Sam Thursfield
bce8b6db8d glib-compile-resources: Add a --version option
There have been some improvements to the tool recently, but it's hard to
know if those are available on a given system unless the tool provides a
--version commandline option.

https://bugzilla.gnome.org/show_bug.cgi?id=772269
2016-10-06 21:08:25 +01:00
Jonh Wendell
e7bdd5d189 Add g_log_variant(): structured log that accepts a GVariant
This makes the structured logging available to other
languages via introspection.

https://bugzilla.gnome.org/show_bug.cgi?id=770971
2016-09-09 09:07:50 -03:00
Jeremy Whiting
8fd72838ce Added describe command to gsettings command-line tool.
describe command shows description of given gsettings key.
Added documentation of describe command to gsettings man page.
2016-08-25 12:40:27 -06:00
Matthias Clasen
87d76a5a9c glib-compile-resources: generate .d-file style dependency
Add --dependency-file=foo.d option to generate a gcc -M -MF style
dependency file for other build tools. The current output of
--generate-dependencies is only useful for use directly in Makefile
rules, but can't be used in other build systems like that.

The generated dependency file looks like this:
$ glib-compile-resources --sourcedir= test.gresource.xml --dependency-file=-
test.gresource.xml: test1.txt test2.txt test2.txt

test1.txt:

test2.txt:

test2.txt:

Unlike --generate-dependencies, the --dependency-file option can be
used together with other --generate options to create dependencies
as side-effect of generating sources.

Based on a patch by Tim-Philipp Müller in
https://bugzilla.gnome.org/show_bug.cgi?id=745754

The changes in this patch, compared to his are to always return
the hash table with file information from parse_resource_file, so
we can use it for dependency output, regardless if generate_dependencies
was TRUE or not.
2016-08-20 16:49:24 -04:00
Emmanuele Bassi
9afff5f05d Revert "glib-compile-resources: generate .d-file style dependency output for build tools"
This reverts commit e8c8395f0e.

Tim said that the patch isn't ready, yet, and the commit is breaking the
build in Continuous.
2016-08-20 17:16:31 +01:00
Tim-Philipp Müller
e8c8395f0e glib-compile-resources: generate .d-file style dependency output for build tools
Add --dependency-file=foo.d option to generate a gcc -M -MF style
dependency file for other build tools. The current output of
--generate-dependencies is only useful for use directly in Makefile
rules, but can't be used in other build systems like that.

The generated dependency file looks like this:
$ glib-compile-resources --sourcedir= test.gresource.xml --dependency-file=-
test.gresource.xml: test1.txt test2.txt test2.txt

test1.txt:

test2.txt:

test2.txt:

Unlike --generate-dependencies, the --dependency-file option can be
used together with other --generate options to create dependencies
as side-effect of generating sources.

Based on a patch by Tim-Philipp Müller.

https://bugzilla.gnome.org/show_bug.cgi?id=745754
2016-08-20 10:52:46 -04:00
Matthias Clasen
c1e8f705dd Add async variant of g_app_info_launch_default_for_uri
This is useful in the portalized case, when the portal may
present an app chooser dialog to the user.

https://bugzilla.gnome.org/show_bug.cgi?id=768752
2016-07-26 16:05:29 -04:00
Matthias Clasen
4643cadc17 Add structured logging to the docs 2016-07-20 20:42:09 -04:00
Emilio Pozuelo Monfort
5cede43df6 Ship gio.xml in tarballs
Fixes the documentation build.

https://bugzilla.gnome.org/show_bug.cgi?id=768936
2016-07-20 10:54:52 +02:00
Krzesimir Nowak
e1c640f819 GVariant: Add a G_VARIANT_BUILDER_INIT macro
The macro could be used at initialization time to avoid having an
unitialized builder, especially with g_auto variables.

The macro tries to be a bit more type-safe by making sure that the
variant_type parameter is actually "const GVariantType
*". Unfortunately I have no idea how to make it possible to also pass
a "const gchar *" parameter without warning.

https://bugzilla.gnome.org/show_bug.cgi?id=766370
2016-07-16 21:41:16 -04:00
Giovanni Campagna
183ed8a3f8 Add g_compute_hmac_for_bytes()
As an introspection-friendly GBytes variant of g_compute_hmac_for_data()

https://bugzilla.gnome.org/show_bug.cgi?id=765338
2016-07-16 20:48:41 -04:00
suhail
69a2c70174 docs: trivial typo fixes
https://bugzilla.gnome.org/show_bug.cgi?id=767949
2016-07-16 20:32:16 -04:00
Matthias Clasen
27fad7a6b1 Document the gio tool
Add a man page, and integrate it in the reference docs.
2016-07-01 16:01:34 -04:00
Matthias Clasen
669a0f72a1 Trivial: documentation wording fix
There was a stray 'of' here.
2016-06-30 08:58:41 -04:00
Philip Withnall
7ea4949cda gmain: Add G_PID_FORMAT
This will be useful for printing out GPids in printf()-style functions.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
2016-06-29 15:16:52 +01:00
Philip Withnall
c4695f192c build: Rename SystemTap scripts to include the LT version
In a vague attempt at ensuring the .stp scripts can be closely
associated with the .so files which they hard-code references to, rename
the scripts so they include the LT version — so that they are the .so
file name plus .stp.

This does not fix the fact that our .stp scripts will not work on
multiarch systems, as they are installed in an architecture-independent
directory (/usr/share/systemtap/tapset). At the moment, it is
recommended that any distribution who package the .stp files should
install them in the architecture-specific subdirectories of this (for
example, /usr/share/systemtap/tapset/x86-64).

A better long-term solution for this is under discussion upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=20264

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2016-06-29 14:43:52 +01:00
Ondrej Holy
e57355b055 fileinfo: Add G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attribute
Add filesystem attribute to detect remote filesystems in order to
replace hardcoded filesystem types in GtkFileSystem. Set this attribute
also for GLocalFile appropriately.

Bump version to 2.49.3, so that early adopters of new API have a version
number to target.
2016-06-28 10:28:51 +02:00
Cosimo Cecchi
375b4ca65c vfs: add g_vfs_register_uri_scheme()
Add a new API to allow clients to register a custom GFile implementation
handling a particular URI scheme.
This can be useful for tests, but also for cases where a different URI
scheme is desired to be used with another custom GFile backend.

As an additional cleanup, we can use this to register the "resource" URI
scheme too.

Based on a patch by Jasper St. Pierre <jstpierre@mecheye.net>.

https://bugzilla.gnome.org/show_bug.cgi?id=767887
2016-06-25 06:58:19 +08:00
Cosimo Cecchi
d07e166432 gkeyfile: add g_key_file_load_from_bytes() API
This makes it easier to use GKeyFile from language bindings, and makes
the API more consistent and modern with the new data type available in
GLib.

https://bugzilla.gnome.org/show_bug.cgi?id=767880
2016-06-20 17:53:00 -07:00
Philip Withnall
195a0cb6bb gio: Add SystemTap and DTrace probes for GTask
This adds a basic tapset for GIO, covering various interesting parts of
GTask.

https://bugzilla.gnome.org/show_bug.cgi?id=759813
2016-06-15 16:15:12 -04:00
Colin Walters
424b3b9c6c docs: Move GIO_USE_VFS to "okay for production" section
Lots of projects like NetworkManager, ostree, udisks, soon polkit,
etc.  do this or *should* do this.  And we need to support that
forever.

https://bugzilla.gnome.org/show_bug.cgi?id=767172
2016-06-02 14:11:17 -04:00
Ondrej Holy
7b3f6da307 gio: Add g_drive_is_removable() support
Nautilus wants to show entries in the sidebar only for removable devices.
It uses currently sort of conditions to determine which devices should be
shown. Those condition fails in some cases unfortunatelly. Lets provide
g_drive_is_removable() which uses udisks Removable property to determine
which devices should be shown. It should return true for all drives with
removable media, or flash media, or drives on usb and firewire buses.

https://bugzilla.gnome.org/show_bug.cgi?id=765900
2016-05-20 10:31:22 +02:00
Philip Withnall
098f19bced docs: Replace references to GVFS hal modules with udisks2
Since hal is dead and buried, and has been superseded by the udisks2
modules in GVFS.
2016-05-19 10:06:36 +01:00
Rico Tzschichholz
19689af091 docs: Add index for 2.50 api 2016-05-18 13:30:32 +02:00
Matthias Clasen
98f86beed6 gdbus-codegen: Only generate autocleanup when instructed to
This adds a new --c-generate-autocleanup option to gdbus-codegen
which can be used to instruct gdbus-codegen about what autocleanup
definitions to emit.

Doing this unconditionally was found to interfere with existing
code out in the wild.

The new option takes an argument that can be
none, objects or all; to indicate whether to generate no
autocleanup functions, only do it for object types, or do it
for interface types as well. The default is 'objects', which
matches the unconditional behavior of gdbus-codegen on the 2.48
branch.

https://bugzilla.gnome.org/show_bug.cgi?id=763379
2016-05-05 06:13:16 -04:00
Marc-Antoine Perennou
5cea1c861d gsettings: add get/set_{,u}int64
https://bugzilla.gnome.org/show_bug.cgi?id=755898

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-04-28 17:28:44 +02:00
Руслан Ижбулатов
e4aaae4ed6 glib: Add 2.50 availibity macros
https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 13:17:27 +00:00
Thomas Perl
59ec2912e4 Documentation fix: g_variant_get() returns void
https://bugzilla.gnome.org/show_bug.cgi?id=747107
2016-04-11 23:29:53 -04:00
Hashem Nasarat
c5931d1a16 docs: fix grammar in Writing GLib Applications/Threads 2016-01-31 12:54:28 -05:00
Philip Withnall
c3d6934f18 gio: Add DTLS interfaces
Add a new GDtlsConnection interface, plus derived GDtlsClientConnection
and GDtlsServerConnection interfaces, for implementing Datagram TLS
support in glib-networking.

A GDtlsConnection is a GDatagramBased, so may be used as a normal
datagram socket, wrapping all datagrams from a base GDatagramBased in
DTLS segments.

Test cases are included in the implementation in glib-networking.

https://bugzilla.gnome.org/show_bug.cgi?id=752240
2016-01-18 14:25:06 +00:00
Christian Hergert
3272267b99 macros: add G_GNUC_CHECK_VERSION() for compiler checks.
https://bugzilla.gnome.org/show_bug.cgi?id=728099
2015-12-16 07:47:53 -05:00
Allison Ryan Lortie
398c048c66 docs: remove GDBusObjectManager example
This example has been causing on-and-off build breaks for quite some
time.  In this case, the code for copying the generated content into the
main docs of GIO is causing problems with srcdir != destdir builds (due
to the files also being copied from the read-only srcdir during
distchecks).

We could probably work around this problem yet again, but since there is
no real benefit to having this content included, so let's remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-24 18:44:02 +00:00
Xavier Claessens
6f1b574cea Doc: Fix missing glibconfig.h when builddir!=srcdir
Currently the doc is incomplete when builddir!=srcdir
(e.g. debian package) because glibconfig.h is generared from
configure.ac and is thus missing from srcdir. This leads to
missing doc for symbols like G_GINT64_FORMAT.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-02 10:02:43 -05:00
Xavier Claessens
86a7c864b3 Doc: copy included example files
This fix missing files when src_dir != build_dir.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-02 09:26:58 -05:00
Xavier Claessens
2331437df3 Doc: fix some gtk-doc warnings
https://bugzilla.gnome.org/show_bug.cgi?id=755364
2015-10-30 10:30:55 -04:00
Allison Ryan Lortie
d0219f2597 GLib: add bounds-checked unsigned int arithmetic
Add some helpers for builds-checked unsigned integer arithmetic to GLib.
These will be based on compiler intrinsics where they are available,
falling back to standard manual checks otherwise.

The fallback case needs to be implemented as a function (which we do
inline) because we cannot rely on statement expressions.  We also
implement the intrinsics case as an inline in order to avoid people
accidentally writing non-portable code which depends on static
evaluation of the builtin.

For now there is only support for addition and multiplication for guint,
guint64 and gsize.  It may make sense to add support for subtraction or
for the signed equivalents of those types in the future if we find a use
for that.

https://bugzilla.gnome.org/show_bug.cgi?id=503096
2015-10-30 11:58:49 +01:00
Rico Tzschichholz
0d4f6afcdf docs: Add index for 2.48 api 2015-10-25 19:42:18 +01:00
Philip Withnall
bf33f1d98d docs: Replace Maman in the tutorial with a more meaningful example
Change it to a running example of a file viewer application with a file
class and various derived classes and related interfaces. Hopefully the
reader can relate to this a little better than to their maman.

https://bugzilla.gnome.org/show_bug.cgi?id=753935
2015-10-20 07:18:15 +09:00
Philip Withnall
128c413261 gsocketconnectable: Add a to_string() virtual method
Add string serialisation functions for GNetworkAddress, GSocketAddress,
GUnixSocketAddress, GInetSocketAddress, GNetworkService and
GSocketConnectable. These are intended for use in debug output, not for
serialisation in network or disc protocols.

They are implemented as a new virtual method on GSocketConnectable:
g_socket_connectable_to_string().

GInetSocketAddress and GUnixSocketAddress now implement
GSocketConnectable directly to implement to_string(). Previously they
implemented it via their abstract parent class, GSocketAddress.

https://bugzilla.gnome.org/show_bug.cgi?id=737116
2015-10-13 15:42:14 +01:00
Philip Withnall
4e631d2e5f gio: Add GDatagramBased interface and rebase GSocket on it
GDatagramBased is an interface abstracting datagram-based communications
in the style of the Berkeley sockets API. It may be contrasted to (for
example) GIOStream, which supports only streaming I/O.

GDatagramBased allows socket-like communications to be done through any
object, not just a concrete GSocket (which wraps socket()).

This adds the GDatagramBased interface, and implements it in GSocket.

https://bugzilla.gnome.org/show_bug.cgi?id=697907
2015-10-13 15:33:48 +01:00
Dan Winship
b4a3c1bb11 Revert "gvalue: Add g_value_clear method"
This reverts commit 1233962b54.
2015-10-02 10:07:53 -04:00
Philip Withnall
4a5a30f716 docs: Tidy up GObject construction discussion in the GObject tutorial
Remove some outdated references to an old example, and add a row in the
table of steps in object initialization for the GObjectClass.constructed
virtual method.

https://bugzilla.gnome.org/show_bug.cgi?id=754855
2015-10-01 15:27:21 +01:00
Philip Withnall
f62cbfc022 gsocket: Add g_socket_receive_messages()
Add support for receiving multiple messages with a single system call,
using recvmmsg() if available. Otherwise, fall back to looping over
g_socket_receive_message().

This adds new API, g_socket_receive_messages(), and corresponding unit
tests.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Philip Withnall
8c4c16ddf4 giotypes: Add GInputMessage struct
This complements the GOutputMessage struct. It will shortly be used for
adding a g_socket_receive_messages() function, but needs to be committed
first to allow some internal refactoring of GSocket.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:58:07 +01:00
Nicolas Dufresne
1233962b54 gvalue: Add g_value_clear method
This method is similar to g_value_unset() but will accept
an uninitialized (zero-filled) GValue structure.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:26:14 -04:00
Nicolas Dufresne
b36b4941a6 glib: Add 2.48 availibity macros
https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:26:13 -04:00
Xavier Claessens
b81f3ced71 Move GStrv typedef to glib.h instead of gobject.h
GStrv was historically only needed for the boxed G_TYPE_STRV,
but it is now useful for g_auto(GStrv) as well. This is not
an ABI change.

https://bugzilla.gnome.org/show_bug.cgi?id=755355
2015-09-22 11:18:30 -04:00
Matthias Clasen
2bc094264b Documentation fixups
Various parameter fixups and symbol list additions.
2015-09-21 06:44:58 -04:00
Rico Tzschichholz
925dca1746 docs: Add index for 2.46 api 2015-09-08 14:14:13 +02:00
Matthias Clasen
41c0d15a6d Add a method to get the pspec name quark
This lets us avoid the quark lookup in the hot
property change notification path.
2015-09-07 20:54:01 -04:00
Dan Winship
9f2e3f6b72 gtestutils: add g_assert_cmpmem()
Add a test macro to compare two buffers (which are not already known
to be the same length) for equality.

https://bugzilla.gnome.org/show_bug.cgi?id=754283
2015-08-31 13:59:48 -04:00
Matthias Clasen
e5734c37a6 Add g_list_store_sort
GListStore already has a g_list_store_insert_sorted function,
which can be used to keep the list sorted according to a fixed
sort function. But if the sort function changes (as e.g. with
sort columns in a list UI), the entire list needs to be
resorted. In that case, you want g_list_store_sort().

https://bugzilla.gnome.org/show_bug.cgi?id=754152
2015-08-31 10:40:45 -04:00
Philip Withnall
d33eae97c9 Revert "TODO ban maman"
I can’t work git-bz.

This reverts commit a228f0ac80.
2015-08-21 15:17:24 +01:00
Philip Withnall
a228f0ac80 TODO ban maman 2015-08-21 15:15:53 +01:00
Philip Withnall
57d0ec57e4 docs: Clarify costs of using the generic GObject C closure marshaller
The libffi one is slower than type-specific generated ones, but is
generally better to use.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
e57741791e docs: Port GObject concepts to use G_DECLARE_FINAL_TYPE
And G_DECLARE_INTERFACE.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
ab9b52e69c docs: General cleanups and rewording in the GObject concepts docs
• Remove copies of function declarations from the explanation — if
   people want those, they can follow links to the reference manual.
 • Add markup to make C code more defined.
 • Remove use of first person and irrelevant name dropping.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
a86ef242e4 docs: Link to the GObject how-to from the GType tutorial
So that first-time users don’t fall into the trap of reading about the
gory memory layout details of GType and GObject when all they wanted to
do was derive a class.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
cd0d605b23 docs: Mention g_clear_object() in the GObject tutorial
As an alternative to g_object_unref().

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
f9410b1647 docs: Remove pointless copy of GObject headers from tutorial
Remove a copy of the refcounting functions from gobject.h from the
GObject tutorial. It suffices to link to the functions in the API
reference.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
92f6325509 docs: Miscellaneous formatting and wording fixes to GObject tutorial
Convert a few sections to use the passive voice, and add some more
<function> elements.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
2aade94fcc docs: Update code examples in GObject tutorial
Use G_DECLARE_FINAL_TYPE, simplify property handling, and remove some
unnecessary braces.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
42baaa88cd docs: Use generic marshallers in GObject how-to examples
They’re the new vogue for handling signals.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:53 +01:00
Philip Withnall
01962b4dd1 docs: Rename a parameter in a GObject how-to example
Make it obvious the parameter is not related to AClass.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:52 +01:00
Philip Withnall
a76242b35a docs: Add vfunc NULL checks to GObject how-to examples
Not setting a pure vfunc is a programmer error, so can be handled with a
g_return_if_fail() rather than needing a g_warning().

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:52 +01:00
Philip Withnall
82abb80553 docs: Update interfaces in GObject how-to examples
Use G_DECLARE_INTERFACE and G_DEFINE_INTERFACE. Fix a couple of typos.
Add some comments to empty functions to make it obvious they’re
intentionally empty.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:52 +01:00
Philip Withnall
ffc248919b docs: Update instance private data in GObject how-to examples
Use get_instance_private().

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:52 +01:00
Philip Withnall
b88ac15e65 docs: Update property handling in GObject how-to examples
Be a bit more consistent about property enum numbering.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:19 +01:00
Philip Withnall
2e4700d52b docs: Various wording changes in the GObject how-to
• Consistently make all titles sentence case
 • Fix various typos
 • Remove an unnecessary footnote
 • Remove first person phrasing

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:19 +01:00
Philip Withnall
f1287a9b2f docs: Remove commented out sections from GObject how-to
Unused, outdated, and unsalvagable.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:19 +01:00
Philip Withnall
0344e6cb83 docs: Add missing <function> elements to GObject how-to
Break the text up a little with some formatting.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:19 +01:00
Philip Withnall
b6b0f5f305 docs: Update GObject how-to for G_DECLARE_*_TYPE macros
Restructure the section of the how-to which covers the header and source
code boilerplate for declaring and defining GObjects to use the new
G_DECLARE_*_TYPE macros. Present both final and derivable types.

Trim various supporting paragraphs.

Rename ‘class functions’ to ‘virtual functions’ to use consistent,
modern terminology.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-08-21 15:15:19 +01:00
Debarshi Ray
fa0f51ddf8 fileinfo: Add a G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE attribute
This is meant for opaque, non-POSIX-like backends to indicate that the
URI is not persistent. Applications should look at
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI.
Examples of such backends could be a portal for letting sandboxed
applications access the file-system, or a database-backed storage like
Google Drive.

In these cases, the user visible file and folder names are different
from the real identifiers, used by the backend. So, a request to
create google-drive://user@gmail.com/foo/New\ File, would actually
lead to google-drive://user@gmail.com/foo/bar on the server even though
the user visible name is still "New File". Since the server-defined URI
is persistent and sanity-checked by the backend, it is recommended that
applications switch to it as soon as possible. Backends will try to
keep a mapping from "fake" to "real" URIs, but those are only on a
best effort basis. They might not be persistent or have the same
guarantees as the "real" URIs.

https://bugzilla.gnome.org/show_bug.cgi?id=741602
2015-08-20 18:40:02 +02:00
Philip Withnall
9874fe3c40 gobject: Cross-link from GType reference docs to GType conventions page
Make it a little easier to find the GType conventions page, which I
guess should be the canonical guide to how to name things.

This adds a brief mention of the valid characters in a type name to the
conventions page.

https://bugzilla.gnome.org/show_bug.cgi?id=743018
2015-08-19 12:54:50 +01:00
Philip Withnall
8c858a018d gvariant: Clarify that nullable strings should use maybe types
Otherwise people might try to encode a NULL string as "NULL". I’m not
even kidding.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 11:36:43 +01:00
Janusz Lewandowski
5d014a802a Add a g_dbus_connection_register_object_with_closures function
This is a binding-friendly version of g_dbus_connection_register_object.
Based on a patch by Martin Pitt and the code of g_bus_watch_name_with_closures.

https://bugzilla.gnome.org/show_bug.cgi?id=656325
2015-08-18 16:41:12 -04:00
Richard Hughes
a80e7db1a8 gio: Add network metered information to GNetworkMonitor
Add a property to GNetworkMonitor indicating if the network
is metered, e.g. subject to limitations set by service providers.

The default value is FALSE

https://bugzilla.gnome.org/show_bug.cgi?id=750282
2015-07-27 06:44:52 -04:00
Matthias Clasen
9486f697bb GThreadPool: Add some queue manipulation api
GTask has a need for an api that boosts an unprocessed
item to the front of the queue, so add one.

https://bugzilla.gnome.org/show_bug.cgi?id=751160
2015-06-29 08:20:26 -07:00
Matthias Clasen
b662c6f09f GAsyncQueue: Add some useful api
The underlying queue supports removing and pushing items to
the front, and these operations can sometimes be useful.

https://bugzilla.gnome.org/show_bug.cgi?id=751160
2015-06-29 08:20:26 -07:00
Matthias Clasen
2471d9cf86 Add g_log_set_handler_full
This is a bindable version of g_log_set_handler that takes
a destroy notify for the user_data.

https://bugzilla.gnome.org/show_bug.cgi?id=740516
2015-06-10 22:03:19 -04:00
Xavier Claessens
73a71d6a43 doc: Add missing GTlsDatabaseClass
https://bugzilla.gnome.org/show_bug.cgi?id=750573
2015-06-08 16:04:53 -04:00
Matthias Clasen
1405eeeed7 Add registry helpers to the docs 2015-06-05 19:13:19 -04:00
Matthias Clasen
007f6684c5 Add index for new api 2015-06-05 15:27:59 -04:00
Matthias Clasen
01e9302673 Add new API to docs 2015-06-05 15:27:25 -04:00
Xavier Claessens
0d8dd2cf5c doc: add GTlsInteractionClass
https://bugzilla.gnome.org/show_bug.cgi?id=750344
2015-06-03 10:19:02 -04:00
Alexander Larsson
f8273f39a1 Add GNativeSocketAddress for handling "other" addresses
Instead of just dropping address types that we're not specifically
handling we return a GNativeSocketAddress which is just a dummy
container for the stuct sockaddr.

https://bugzilla.gnome.org/show_bug.cgi?id=750203
2015-06-03 08:52:54 +02:00
Matthias Clasen
89d46d1bdc docs: Document the --strict option of glib-compile-schemas
Curiously, this option has managed to remain undocumented for
5 years.
2015-04-08 06:38:16 -04:00
Ross Lagerwall
495d864e43 docs: Fix documentation for 95d300eac5 2015-04-07 18:23:39 +01:00
Paolo Borelli
b64e2956f6 Add an event signal to GSocketListener
This allows the caller to know when a socket has been bound so that
it can for instance set the SO_SENDBUF and SO_RECVBUF socket options
before listen is called

https://bugzilla.gnome.org/show_bug.cgi?id=738207
2015-04-04 21:26:15 +02:00
Dan Winship
15c5e643c6 gversionmacros: add 2.46 version macros 2015-03-21 09:50:29 -04:00
Ryan Lortie
6fffce2588 docs: clean up a few glib issues
Fix a few typical problems, and also stop wrapping the inline definition
of g_steal_pointer in parens, since it is not necessary and it confuses
gtk-doc.
2015-03-12 17:24:05 -04:00
Ryan Lortie
eff505ed3c docs: more cleanups for GIO 2015-03-12 16:43:02 -04:00
Xavier Claessens
497b294510 Doc: Fix missing API from GOptionGroup boxing 2015-03-12 16:09:14 -04:00
Xavier Claessens
15a4af545e Doc: Mark a few things as private 2015-03-12 16:09:14 -04:00
Philip Withnall
4f1f68e6be gtask: Add a GTask:completed property
This can be used to query whether the task has completed, in the sense
that it has had a result set on it, and has already – or will soon –
invoke its callback function.

Notifications for this property are emitted immediately after the task’s
main callback, in the same main context as that callback. This allows
for multiple bits of code to listen for completion of the GTask, which
opens the door for blocking on cancellation of the GTask and improved
handling of ‘pending’ behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=743636
2015-03-10 08:37:45 +00:00
Paolo Borelli
ed4a742946 HTTP proxy support
Based on code from "WockyHttpProxy" written by Nicolas Dufresne
and Marc-André Lureau. Initial glib patch by Brian J. Murrell.

https://bugzilla.gnome.org/show_bug.cgi?id=733876
2015-03-06 21:23:58 +01:00
Philip Withnall
430814992d docs: Expand introduction to mention using async calls over sync ones
As discussed on the mailing list (see the whole thread):
    https://mail.gnome.org/archives/desktop-devel-list/2015-February/msg00126.html

Expand the GIO documentation introduction to talk a little about when to
use async and sync functions, and how the former should almost always be
preferred over the latter.

Link to this from the GFile documentation, which is an entry point for a
lot of async calls.

https://bugzilla.gnome.org/show_bug.cgi?id=744722
2015-03-03 18:27:45 +00:00
Philip Withnall
32956587f3 docs: Remove redundant header examples from GObject tutorial
These are in the header boilerplate section, but are actually source
boilerplate which is covered in later sections.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-03-03 17:25:43 +00:00
Philip Withnall
88e011a7cf docs: Change tutorial encodings from ISO-8859-1 to UTF-8
ISO-8859-1 — that’s a blast from the past.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
2015-03-03 17:25:43 +00:00