Commit Graph

2532 Commits

Author SHA1 Message Date
Emmanuele Bassi
b96e318f3a docs: Remove priv pointers from the tutorial example
We define `ViewerFile` as a final type with fields directly in the
instance structure. This means we don't have a `priv` pointer to
dereference.
2019-09-20 11:38:47 +02:00
Todd Goyen
3636bb5fe1 Add a wrapper for fsync() function
Closes issue #35
2019-09-18 10:47:23 +02:00
Philip Withnall
3b1e301ab5 gversionmacros: Add version macros for GLib 2.64
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-17 12:24:16 +01:00
Xavier Claessens
65f64f0988 Fix doc build on Windows
This is a work around for this Meson bug:
https://github.com/mesonbuild/meson/issues/5893

Closes: #1888
2019-09-09 08:51:46 -04:00
Philip Withnall
ca60cd3314 tutorial: Add private members to example code in tutorial
Add the private members referred to in the property setting/getting
example, and a finalize function for them, to make the tutorial code
more self-contained.

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

Helps: #1858
2019-08-29 09:20:01 +01:00
Philip Withnall
22b59c91ad tutorial: Stop referring to ->priv for example class
The class has used `G_DECLARE_FINAL_TYPE` for a while now, so doesn’t
have a `priv` struct. Private members are declared inline.

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

Fixes: #1858
2019-08-29 09:19:03 +01:00
Philip Withnall
61912bffb5 tutorial: Improve type safety of property usage in GObject tutorial
This means that if you compile with `-Wswitch-enum`, the compiler will
warn you about properties which you’ve forgotten to handle in
`set_property()` or `get_property()`.

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

Helps: #1858
2019-08-29 09:12:18 +01:00
Nirbheek Chauhan
4387f7b7b6 Merge branch '1803-gio-open-docs' into 'master'
docs: Mention environment variables in `gio open` documentation

Closes #1803

See merge request GNOME/glib!1051
2019-08-26 12:22:06 +00:00
Philip Withnall
b2eb0a6f15 docs: Mention environment variables in gio open documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1803
2019-08-25 11:05:07 +03:00
Дилян Палаузов
512655aa12 minor typos in the documentation (a/an) 2019-08-24 19:14:05 +00:00
Philip Withnall
37b2093f28 Merge branch 'contributing-fixes' into 'master'
Remove mentions of mailing lists from the documentation

See merge request GNOME/glib!1002
2019-08-05 10:20:40 +00:00
Philip Withnall
d166a55c64 gfileinfo: Add g_file_info_{get,set}_modification_date_time() APIs
These are alternatives to g_file_info_{get,set}_modification_time(),
which will soon be deprecated due to using the deprecated GTimeVal
type, which is not year 2038 safe.

The new APIs take a GDateTime instead.

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

Helps: #1438
2019-07-29 12:27:29 +01:00
Philip Withnall
dbabd2b8a7 gdatetime: Add g_date_time_format_iso8601() convenience function
This is a simple wrapper around g_date_time_format_iso8601() which
always produces ISO 8601 dates, without people having to remember the
format string for them (and with the convenience of terminating UTC
dates with ‘Z’ rather than ‘+00’).

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

Helps: #1438
2019-07-29 12:27:29 +01:00
Simon McVittie
b76bf3ca72 gobject: Add a g_assert_finalize_object() macro
With modifications by Philip Withnall.

Fixes: #488
2019-07-25 15:23:21 +01:00
Emmanuele Bassi
dd42b8f01f docs: Remove mentions of mailing lists
We use a tag on Discourse, now.
2019-07-23 11:27:30 +01:00
Philip Withnall
249299a76f Merge branch 'doc-fixes' into 'master'
Various doc fixes

See merge request GNOME/glib!982
2019-07-17 10:58:21 +00:00
Emmanuel Fleury
628e448e02 Fixing a small typo in docs/references/gio/gio.xml
Fix issue #1828
2019-07-12 17:49:51 +02:00
Xavier Claessens
61872d60b5 doc: Add gobject 2.62 API 2019-07-10 10:29:04 -04:00
Xavier Claessens
e528577202 doc: Add missing GNativeSocketAddress 2019-07-10 10:29:04 -04:00
Xavier Claessens
255f64cad8 doc: Split API reference per platform
We can only include win32 APIs when building for Windows because gtkdoc
needs to compile the GObject classes for introspection.
2019-07-10 10:29:04 -04:00
Xavier Claessens
e8a123059f doc: Add some missing symbols 2019-07-10 10:11:15 -04:00
Xavier Claessens
a955aacaee doc: Ignore dirent.h which is not part of our API 2019-07-10 10:11:03 -04:00
Xavier Claessens
141a440d0c doc: Add missing GLIB_DEPRECATED_TYPE and friends
They are private but still must be put into sections.txt otherwise
gtkdoc-check complains.
2019-07-10 10:10:25 -04:00
Emmanuele Bassi
c23ee5fabf Merge branch 'garray_binary_search' into 'master'
Add g_array_binary_search() to garray API

Closes #373

See merge request GNOME/glib!850
2019-07-09 10:39:34 +00:00
Emmanuel Fleury
104fca78cd Add g_array_binary_search() to garray API
Original code written by Christian Hergert

Fix issue #373
2019-07-09 12:12:18 +02:00
Chris Packham
3f51694185 docs: update build instructions for selinux
Commit 8cc92bcca ("meson: Turn selinux into a meson feature and make it
auto by default") update the selinux option to be a feature with
instead of a boolean. Update the documentation to reflect this.

Closes: #1823
2019-07-09 17:34:16 +12:00
Emmanuel Fleury
46f70e9901 Adding a function g_array_copy() to glib/garray.c
Original code from Simon van der Linden

Close issue #236
2019-06-27 13:40:26 +02:00
Emmanuel Fleury
0675703af0 Adding g_ptr_array_extend_and_steal() function to glib/garray.c 2019-06-27 12:28:32 +02:00
Emmanuel Fleury
43ad244df2 Adding g_ptr_array_extend() function to glib/garray.c
Related to issue #269
2019-06-26 15:35:28 +02:00
Emmanuel Fleury
86bcc5c942 Adding g_ptr_array_copy() function to glib/garray.c
Related to issue #269
2019-06-26 15:34:47 +02:00
Tristan Partin
b9988e5fc9 Add g_timer_is_active
Helper function for exposing the internal state of a GTimer.
2019-06-21 10:22:41 +00:00
Philip Withnall
fa5996927f Merge branch 'drop-g-disable-deprecated' into 'master'
Drop G_DISABLE_DEPRECATED

Closes #1060 and #638

See merge request GNOME/glib!871
2019-06-14 11:24:25 +00:00
Simental Magana, Marcos
51e7ce2c20 docs: fix typo on arrays examples in gvariant-text
example lists [(1, 2), (3, 4.0)], but mentions numbers
1 and 4 being parsed as integrers, this seems wrong as
4.0 its explicitly parsed as double.

Signed-off-by: Simental Magana, Marcos <marcos.simental.magana@intel.com>
2019-06-12 10:56:07 -05:00
Ondrej Holy
2b5daec05c docs: Add missing gio move options
The `gio move` tool has plenty of options, which are listed by
`gio help move`, however, the `man gio` page doesn't mention them.
Let's add these missing options to the man page as well.
2019-06-07 09:22:04 +02:00
Philip Withnall
1741fc2c6e build: Drop use of G_DISABLE_DEPRECATED from the build system
It’s no longer used in any of the headers. See preceding commits.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Patrick Storz
56149722ae Add g_get_console_charset
Queries the charset used by the associated console, which does not
necessarily match the charset of the current locale as returned by
g_get_charset.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1270
2019-05-27 17:51:40 +00:00
Philip Withnall
4da8b7b35a gtestutils: Add g_test_summary() to add summary metadata to unit tests
This is a new function along the same lines as g_test_bug(): to allow
developers to annotate unit tests with information about the test (what
it tests, how it tests it) for future developers to read and learn from.

It will also output this summary as a comment in the test’s TAP output,
which might clarify test results.

Includes a unit test.

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

Fixes: #1450
2019-05-21 12:33:15 +01:00
Marco Trevisan (Treviño)
409c1522bc gisgnal: Add g_clear_signal_handler
It allows to disconnect a signal handler from GObject instance and at the same
time to nullify the signal handler.

Provided also a macro for handler type conversion.
2019-05-20 13:33:41 -05:00
Philip Withnall
0470cccec8 docs: Fix typo in Meson cross-compilation instructions
Meson accepts `--cross-file`, but not `--cross_file`.

Spotted by Carlo Bramini.

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

Fixes: #1782
2019-05-20 12:11:24 +01:00
Philip Withnall
662cddcb4b glib: Deprecate gtester and gtester-report
Add warnings about their deprecation everywhere. The tools will continue
to work until we break API, but will be less well maintained. You should
use TAP for communicating test results to the test harness provided by
your build system or CI system instead.

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

Fixes: #1441
2019-05-14 12:14:54 +01:00
Kalev Lember
e4bd6dd515 Add autoptr support for GRWLock 2019-05-10 12:48:20 +02:00
Marco Trevisan (Treviño)
1d96e94070 gmacros: Add g_autoqueue to automatically free queues
This works as g_auto(s)list already does, and allows to create queues that are
fully auto free'd on destruction.
2019-05-08 14:25:24 -05:00
Christian Hergert
a4c3feb835 queue: add g_queue_insert_before_link() and g_queue_insert_after_link()
This adds two new helpers that allow for inserting pre-allocated GList
elements to the queue similar to existing helpers. This may be advantagous
in some situations such as statically allocated GList elements.
2019-05-01 13:01:14 -07:00
Christian Hergert
b0132bb64f list: add g_list_insert_before_link()
This adds a new insertion helper using a pre-allocated link which may be
advantagous in some situations such as statically linked GList elements.
2019-05-01 13:01:14 -07:00
Philip Withnall
192bf09529 general: Remove a few unhelpful references to ‘master’
Some of these have a negative master/slave connotation, and they add no
value. Change or drop them.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-25 09:25:49 +01:00
Philip Withnall
a00d6b08d0 docs: Add GLib 2.62 version macros to glib-sections.txt
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-15 12:09:33 +01:00
Philip Withnall
4ac7d2d8e3 docs: Add GLib 2.62 symbols to glib-docs.xml
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-15 12:09:16 +01:00
Philip Withnall
9e56d39bb4 docs: Ignore some generated source files
dep-list.c isn’t generated, but contains non-documentation gtk-doc-style
comments which are probably better left in place, since the code is
partially external to GLib.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 11:09:32 +00:00
Emmanuele Bassi
7644b6a368 Merge branch 'api-tags' into 'master'
Bump release version for 2.62 series

See merge request GNOME/glib!709
2019-03-06 12:30:12 +00:00
Philip Withnall
6761bb2f57 build: Factor out common gtkdoc flags
Those lists were getting very long. We can’t quite entirely automate the
list generation since Meson doesn’t have a range() function, but we can
at least combine three of them into one.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-06 11:59:03 +00:00
Руслан Ижбулатов
025a346728 W32: Add a simple exception handler
Install a Vectored Exception Handler[0]. Its sole purpose is to catch
some exceptions (access violations, stack overflows, illegal
instructions and debug breaks - by default, but it can be made to catch
any exception for which a code is known) and run a debugger in response.

This allows W32 glib applications to be run without a debugger,
but at the same time allows a debugger to be attached in case
something happens.

The debugger is run with a new console, unless an environment variable
is set to allow it to inherit the console of the crashing process.

The short list of handleable exceptions is there to ensure that
this handler won't run a debugger to "handle" utility exceptions,
such as the one that is used to communicate thread names to a debugger.

The handler is installed to be called last, and shouldn't interfere
with any user-installed handlers.

There's nothing fancy about the way it runs a debugger (it doesn't even
support unicode in paths), and it deliberately avoids using glib code.

The handler will also print a bit of information about the exception
that it caught, and even more information for well-known exceptions,
such as access violation.

The whole scheme is similar to AeDebug[1] and, in fact, the signal-event
gdb command was originally implemented for this very purpose.

[0]: https://docs.microsoft.com/en-us/windows/desktop/debug/vectored-exception-handling
[1]: https://docs.microsoft.com/en-us/windows/desktop/debug/configuring-automatic-debugging
2019-03-06 11:41:56 +00:00
Philip Withnall
e7d091dec1 gversionmacros: add version macros for GLib 2.62
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-06 11:26:28 +00:00
Philip Withnall
95e00c7581 docs: Various markup improvements to glib-mkenums man page
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-04 11:14:22 +00:00
Philip Withnall
c3ac761a18 build: Rename gobjectenumtypes.[ch] to glib-enumtypes.[ch]
To reflect the fact that they contain the GObject types for various
enums defined in libglib.

See https://gitlab.gnome.org/GNOME/glib/merge_requests/481#note_451086.

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

Helps: GNOME/gobject-introspection#267
2019-03-04 11:12:59 +00:00
Philip Withnall
1f7d5b85d7 Merge branch 'trash-portal' into 'master'
Support the trash portal

See merge request GNOME/glib!276
2019-02-04 13:38:03 +00:00
Philip Withnall
5d719c782c Merge branch 'script-enum' into 'master'
Define enum types for Unicode enums

See merge request GNOME/glib!481
2019-02-04 12:28:02 +00:00
Matthias Clasen
fc6044a4b1 Define enum types for Unicode enums
We want to stop shipping PangoScript in pango, so
we need a replacement for the type that used to
be provided by pango.
2019-01-31 19:38:26 -05:00
Matthias Clasen
bca4ff7c5e Support the trash portal
When we are in a sandbox, try to trash files via a portal.
It works.
2019-01-31 19:00:19 -05:00
Krzesimir Nowak
9babfecba8 docs: Ignore more version macros
Looks like we tend to forget to update the list of ignored decorators
when adding new version macros.
2019-01-31 21:52:40 +01:00
Ondrej Holy
cec5778cad gappinfo: Add launch_uris_async() and launch_uris_finish() vfuncs
The g_app_info_launch_uris_async() and g_app_info_launch_uris_finish()
functions are crucial to fix g_app_info_launch_default_for_uri_async()
to be really asynchronous.

This patch also adds GDesktopAppInfo implementation of that vfuncs.
The implementation may still use some synchronous calls to local MIME DB.

https://gitlab.gnome.org/GNOME/glib/issues/1347
https://gitlab.gnome.org/GNOME/glib/issues/1249
2019-01-28 16:42:34 +01:00
Ondrej Holy
f72a5d65e0 gfile: Add g_file_query_default_handler_async()
This is needed as a first step to fix the
g_app_info_launch_default_for_uri_async() function to be really
asynchronous.

It still uses the g_app_info_get_default_for_uri_scheme() and
g_app_info_get_default_for_type() functions, which may use synchronous
calls to local MIME DB.

https://gitlab.gnome.org/GNOME/glib/issues/1347
https://gitlab.gnome.org/GNOME/glib/issues/1249
2019-01-28 16:42:34 +01:00
Sebastian Dröge
0bcc177378 Add writev() / writev_all() API to GOutputStream and GPollableOutputStream
This comes with default implementations around the normal write
functions and async variants.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1431
2019-01-24 16:25:34 +02:00
Sebastian Dröge
042b8dc40d Introduce new GPollableReturn enum
This allows returning WOULD_BLOCK without allocating a GError, and
should later be used for various functions of GPollableOutputStream,
GPollableInputStream and anything else that can potentially block.
2019-01-24 16:25:31 +02:00
Matthias Clasen
8f71892862 Document "help" for extensions
Mention the special value "help" for the environment variables
that we document for picking extensions.
2019-01-22 13:18:50 -05:00
Philip Withnall
b3efef5b6f build: Drop autotools support
So long, and thanks for everything. We’re a Meson-only shop now.

glib-2-58 will remain the last stable GLib release series which is
buildable using autotools.

We continue to install autoconf macros for autotools-using projects
which depend on GLib; they are stable API.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-15 15:11:43 +00:00
Philip Withnall
d08e4661de docs: Update DocBook ‘build’ documentation to mention Meson
Drop mentions of autotools. In particular, update the list of configure
options to reflect what’s available in the Meson build.

Further work is needed as a follow-up to improve our handling of (what
was formerly) the --enable-debug option.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-15 15:11:43 +00:00
Philip Withnall
0d3fe5c350 Merge branch 'queue-clear' into 'master'
Add g_queue_clear_full API

Closes #1464

See merge request GNOME/glib!537
2019-01-08 16:01:09 +00:00
Philip Withnall
940537bec7 Merge branch '1623-gio-open-docs' into 'master'
docs: Mention handling of filenames containing colons in gio docs

Closes #1623

See merge request GNOME/glib!550
2018-12-23 22:09:22 +00:00
Tapasweni Pathak
2dc82840c8 Add g_queue_clear_full API
Closes https://gitlab.gnome.org/GNOME/glib/merge_requests/378.
2018-12-22 14:36:56 +05:30
Mart Raudsepp
2ab231f52a docs: Fix dconf GSETTINGS_BACKEND name in gio overview 2018-12-21 17:38:06 +02:00
Cosimo Cecchi
7d02e32644 gdbusconnection: add a getter for the flags property
Right now this can only be set at construction but not read back.
That seems unnecessarily restrictive, and we'll need to read these
flags from outside of gdbusconnection.c in the next commit, so let's
just make it public.

https://gitlab.gnome.org/GNOME/glib/issues/1620
2018-12-20 00:41:13 +00:00
Ninja-Koala
d04b9c371d glib-compile-resources: Add external data option
Add option to not encode resource data into the C source file
in order to embed the data using `ld -b binary`. This improves compilation
times, but can only be done on Linux or other platforms with a
supporting linker.

(Rebased by Philip Withnall, fixing minor rebase conflicts.)

Fixes #1489
2018-12-19 16:43:21 +00:00
Philip Withnall
499e08a462 Merge branch 'gtask-set-name' into 'master'
gtask: Add a g_task_set_name() method

See merge request GNOME/glib!384
2018-12-19 13:16:07 +00:00
Philip Withnall
ed007bb4cf docs: Mention handling of filenames containing colons in gio docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1623
2018-12-19 12:24:17 +00:00
Philip Withnall
88ceff934c docs: Use Unicode apostrophes in gio documentation
Let’s move into the 21st century.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:20:01 +00:00
Philip Withnall
3026efbc0f docs: Fix some minor wording problems in the gio documentation
And some missing apostrophes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:17:49 +00:00
Philip Withnall
30ed95216a docs: Fix capitalisation of ‘ETag’
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:17:32 +00:00
Philip Withnall
7bac53d41f docs: Improve formatting of literals in gio documentation
There was no distinction between literals which need to be typed, and
normal words in the prose.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:16:48 +00:00
Scott Hutton
9032e8897d Implement support for ALPN in GTlsConnection, GDtlsConnection 2018-12-18 16:32:55 -08:00
Philip Withnall
26f783576d Merge branch 'docs-fixes' into 'master'
Various minor docs fixes

See merge request GNOME/glib!536
2018-12-18 15:35:07 +00:00
Kalev Lember
8c2e71bba0 Add GRecMutexLocker
This is the same as GMutexLocker, just for recursive mutexes.
2018-12-18 12:24:17 +01:00
Philip Withnall
2a64176b83 Merge branch 'g-alignof' into 'master'
gmacros: Add G_ALIGNOF superseding _g_alignof macro

Closes #1055

See merge request GNOME/glib!538
2018-12-18 10:29:22 +00:00
Tapasweni Pathak
58bbdcf6c0 gmacros: Add G_ALIGNOF superseding _g_alignof macro 2018-12-18 13:59:23 +05:30
Philip Withnall
13730c27c0 gtestutils: Add XDG directory isolation
Add a new G_TEST_OPTIONS_ISOLATE_XDG_DIRS option for g_test_init() which
automatically creates a temporary set of XDG directories, and a
temporary home directory, and overrides the g_get_user_data_dir() (etc.)
functions for the duration of the unit test with the temporary values.

This is intended to better isolate unit tests from the user’s actual
data and home directory. It works with g_test_subprocess(), but does not
work with subprocesses spawned manually by the test — each unit test’s
code will need to be amended to correctly set the XDG_* environment
variables in the environment of any spawned subprocess.

“Why not solve that by setting the XDG environment variables for the
whole unit test process tree?” I hear you say. Setting environment
variables is not thread safe and they would need to be re-set for each
unit test, once worker threads have potentially been spawned.

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

https://gitlab.gnome.org/GNOME/glib/issues/538
2018-12-17 17:16:03 +00:00
Philip Withnall
91defdb34e gutils: Add internal API to override XDG directories
Add a new internal function, g_set_user_dirs(), which will safely
override the values returned by g_get_user_data_dir() and friends, and
the value returned by g_get_home_dir().

This is intended to be used by unit tests, and will be hooked up to them
in a following commit.

This can be called as many times as needed by the current process. It’s
thread-safe. It does not modify the environment, so none of the changes
are propagated to any subsequently spawned subprocesses.

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

https://gitlab.gnome.org/GNOME/glib/issues/538
2018-12-17 17:16:03 +00:00
Philip Withnall
a67eadbdc3 gstrfuncs: Add g_strv_equal()
This is a utility function which I find myself writing in a number of
places. Mostly in unit tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:03 +00:00
Philip Withnall
993b113a63 docs: Fix a typo in the GVariant text format documentation
There were some quotes missing from an a{sv} key.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 13:53:34 +00:00
Philip Withnall
903ce7dc02 Merge branch '1191-g_assert_cmpvariant' into 'master'
gtestutils: Add g_assert_cmpvariant()

Closes #1191

See merge request GNOME/glib!529
2018-12-17 13:03:00 +00:00
Philip Withnall
ee364db967 gtestutils: Add g_assert_cmpvariant()
This is along the same lines as g_assert_cmpstr(), but for variants.

Based on a patch by Guillaume Desmottes.

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

https://gitlab.gnome.org/GNOME/glib/issues/1191
2018-12-12 11:27:25 +00:00
Patrick Griffis
d6afa6c988 gresolver: Add g_resolver_lookup_by_name_with_flags{_async,_finish,}
This allows higher levels to have more control over resolving
(ipv4 or ipv6 for now) which allows for optimizations such
as requesting both in parallel as RFC 8305 recommends.
2018-12-11 16:09:29 -05:00
Nirbheek Chauhan
17316b2c16 glib-mkenums: Support reading @rspfiles for arguments
This is needed on Windows where the argument list can exceed the
maximum command-line length when lots of sources are passed to
glib-mkenums.
2018-12-04 16:16:00 +05:30
Philip Withnall
a440152b2a docs: Ignore some generated header files
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:27:04 +00:00
Philip Withnall
82d28f07ed docs: Fix an invalid DocBook link in the GIO overview
<link> can only be used for links to DocBook IDs. <ulink> is for URI
links. (Why does it have to be this complex?)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:26:50 +00:00
Philip Withnall
384aea2489 docs: Add some missing new symbols to the GIO documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:25:48 +00:00
Philip Withnall
c20d9d0c84 docs: Ignore various GIO *_get_type() symbols
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:25:20 +00:00
Philip Withnall
2b15b436c7 docs: Ignore some private/uninstalled header files
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:24:24 +00:00
Philip Withnall
49fe320909 docs: Add indexes for symbols added in 2.60
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:23:40 +00:00
Philip Withnall
93f3202a61 docs: Add various missing symbols to glib-sections.txt
As listed in glib-unused.txt.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 12:37:27 +00:00
Philip Withnall
e51ed49ac3 docs: Ignore some private header files
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 12:37:09 +00:00
eyelash
fccce84d93 docs: add a missing semicolon 2018-11-18 08:05:28 +00:00
Corentin Noël
c7ac6f3ae0 docs: add index of new symbols for gio > 2.52 2018-11-13 08:08:14 +01:00
Christian Persch
d62a07831c gmacros: Add G_GNUC_STRFTIME macro
Analogous to G_GNUC_PRINTF and G_GNUC_SCANF, to annotate
functions similar to strftime.

https://gitlab.gnome.org/GNOME/glib/issues/1575
2018-10-31 11:50:07 +01:00
Philip Withnall
e89128a935 gtask: Add a g_task_set_name() method
Similarly to g_source_set_name(), this sets a name on a GTask for
debugging and profiling. Importantly, this name is propagated to the
GSource for idle callbacks for the GTask, ending the glorious reign of
`[gio] complete_in_idle_cb`.

The name can be queried using g_task_get_name(). Locking is avoided by
only allowing the name to be set before the GTask is used from another
thread.

Includes tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-30 11:51:50 +00:00
Ondrej Holy
39afe07e27 Merge branch 'wip/oholy/bind-mounts' into 'master'
gunixmounts: Mark mounts as system internal instead of filtering out

See merge request GNOME/glib!366
2018-10-23 07:32:32 +00:00
Ondrej Holy
e1fa5ffb91 gio: Add g_unix_mount_get_root_path
Currently, there isn't API to determine root path for mounts created
over bind operation (or btrfs subvolumes). This causes issues to our
volume monitors if there is multiple mounts for one device, which can
happen with libmount-based implementation currently. Let's propagate
root path from libmount over g_unix_mount_get_root_path, so we can
handle this somehow in our volume monitors.

https://gitlab.gnome.org/GNOME/glib/issues/1271
2018-10-23 09:01:04 +02:00
Philip Withnall
7a4025cac1 gutf8: Add a g_utf8_validate_len() function
This is a variant of g_utf8_validate() which requires the length to be
specified, thereby allowing string lengths up to G_MAXSIZE rather than
just G_MAXSSIZE.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
7c4e6e9fbe gvarianttype: Impose a recursion limit of 128 on variant types
Previously, GVariant has allowed ‘arbitrary’ recursion on GVariantTypes,
but this isn’t really feasible. We have to deal with GVariants from
untrusted sources, and the nature of GVariantType means that another
level of recursion (and hence, for example, another stack frame in your
application) can be added with a single byte in a variant type signature
in the input. This gives malicious input sources far too much leverage
to cause deep stack recursion or massive memory allocations which can
DoS an application.

Limit recursion to 128 levels (which should be more than enough for
anyone™), document it and add a test. This is, handily, also the limit
of 64 applied by the D-Bus specification (§(Valid Signatures)), plus a
bit to allow wrapping of D-Bus messages in additional layers of
variants.

oss-fuzz#9857

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
846a61457a Merge branch 'wjt/g_desktop_app_info_get_string_list' into 'master'
Add g_desktop_app_info_get_string_list(); fix g_key_file_free()

See merge request GNOME/glib!339
2018-10-01 19:21:05 +00:00
Will Thompson
5ca9eca632 gdesktopappinfo: add get_string_list() function
The X-Flatpak-RenamedFrom key is used in .desktop files to identify past
names for the desktop file. It is defined to be a list of strings.
However, there was previously no correct way to retrieve a list of
strings from the GKeyFile wrapped by GDesktopAppInfo, short of
re-parsing the file with GKeyFile.

Note that doing something like:

    g_strsplit (g_desktop_app_info_get_string (...), ";", -1)

is not correct: the raw value "a\;b;" represents the one-element list
["a;b"], but g_key_file_get_string() rejects the sequence "\;", and so
g_desktop_app_info_get_string() returns NULL in this case. (Of course, a
.desktop file with a semicolon in its name is a pathological case.)

Add g_desktop_app_info_get_string_list(), a trivial wrapper around
g_key_file_get_string_list(), similar to g_desktop_app_info_get_string()
and co.

The change from g_key_file_free() to g_key_file_unref() in the test is
needed because g_key_file_free() clears the contents of the keyfile.
This is fine for all the fields which are eagerly loaded and copied into
GDesktopAppInfo, but not when we want to access arbitrary stuff from the
keyfile.
2018-10-01 20:03:55 +01:00
Simon McVittie
1830ebba91 Spelling: Fix spelling of "interpreted"
Detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 15:58:56 +01:00
Simon McVittie
ec951e9de8 Spelling: avoid the "allows to" pattern
This is detected by Debian's Lintian tool, which suggests
"allows one to" as a replacement. I've rephrased the documentation
in question to avoid both of those.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 15:57:49 +01:00
Simon McVittie
55cfbd3bc4 Spelling: Fix spelling of "constructed"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:35:13 +01:00
Simon McVittie
e0a8df12ef Spelling: Fix spelling of "similarly"
Detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:35:13 +01:00
Simon McVittie
214c991d5b Spelling: fix "every time"
Detected by Debian's Lintian tool.

Also fix the spelling of "linking" in one error message.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:34:48 +01:00
Xavier Claessens
780f7c64f9 Meson: doc: fix cross references 2018-09-23 16:09:34 -04:00
Philip Withnall
98f326a020 Merge branch 'wip/otte/fallthrough' into 'master'
Add G_GNUC_FALLTHROUGH for __attribute__(fallthrough))

See merge request GNOME/glib!296
2018-09-04 22:06:26 +00:00
Benjamin Otte
95477a4e35 macros: Add G_GNUC_FALLTHROUGH
Expands to the GNU C fallthrough statement attribute if the compiler is gcc.
This allows declaring case statement to explicitly fall through in switch
statements. To enable this feature, use -Wimplicit-fallthrough during
compilation.
2018-09-04 20:24:21 +02:00
Christoph Reiter
912581340e Remove all static ChangeLog files
They only contain old information which is also available in git
2018-09-04 15:56:54 +02:00
Matthew Waters
b84951eb6f gtlsbackend: add support for setting the default TLS database
There are many cases where a default TLS database is not able to be
defined within the constraints of a system.  For example glib-networking
(or glib-openssl) cannot retrieve the default certificate store on iOS
or Android and need to be initialized from a cert file of certificates
bundled with the application.

Previously GStreamer was relying on a custom patch to glib-networking to
populate the default database from the file pointed to by the
CA_CERTIFICATES environment variable however the mechanism that enabled
this was recently remove from glib-networking.

Adding a more generic g_tls_backend_set_default_database() API allows
application developers to override the default database using their own
certificates as well as allowing equivalent functionality on Android/iOS
(or others) as on the default database handling Linux.

Fixes https://gitlab.gnome.org/GNOME/glib-networking/issues/35
2018-09-03 13:55:57 +10:00
Christoph Reiter
11fcc2f1ac build: simplify alloca checks. See #1313
The goal of this commit is to reduce differences between the autotools and meson build.

With autotools AC_FUNC_ALLOCA was used which defines HAVE_ALLOCA_H, HAVE_ALLOCA,
C_ALLOCA. meson tried to replicate that with has_function() but alloca can be a macro
and and is named _alloca under Windows. Since we require a working alloca anyway
and only need to know if the header exists replace AC_FUNC_ALLOCA with a simple
AC_CHECK_HEADERS.

There is still one user of HAVE_ALLOCA in the embedded gnulib, but since alloca is
always provided through galloca.h just force define HAVE_ALLOCA there and add a comment.

The docs were mentioning alloca as an example for cross compiling. Since that variable no
longer exists now replace it with another one.
2018-08-24 10:57:10 +02:00
Xavier Claessens
f046801217 Meson: Update cross compilation doc
(Modified by Philip Withnall <withnall@endlessm.com> to improve
formatting on original.)

Closes #1363
2018-08-07 16:52:49 +01:00
Philip Withnall
c0f8792d6b docs: Add missing API indexes for old versions
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-30 21:13:48 +01:00
Philip Withnall
40fc18521b docs: Fix glib-sections.txt includes for g_atomic_rc_* API
These were not changed when g_arc_*() was renamed to g_atomic_rc_*().

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-30 21:12:43 +01:00
Philip Withnall
f9705f7a0c docs: Don’t distribute generated man pages
They should either be generated at build time, or ignored completely,
depending on the presence of --[enable|disable]-man.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-30 20:04:13 +01:00
Richard Hughes
dad58d7392 Add a g_ref_string_new_len() to allow creating from non-NUL byte arrays
A lot of GLib APIs provide a string length and explicitly say that the strings
are not NUL terminated. For instance, parsing XML using GMarkupParser or
reading packed binary strings from mmapped data files.
2018-07-09 15:59:39 +01:00
Emmanuele Bassi
32ecb86f5b Add length accessor for GRefString
Since we store the size of the allocation in the underlying ArcBox, we
can get a constant time getter for the length of the string.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
43b7a8f158 Add size accessor to RcBox and ArcBox
It may be useful to know how big a reference counted allocation is
outside of internal checks.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
00a723f597 Add reference counted strings
The last part of the reference counting saga.

Now that we have:

 - reference counter types
 - reference counted allocations

we can finally add reference counted strings using reference counted
allocations to avoid creating a new String type, and reimplementing
every single string-based API.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
b607927a43 Add atomically refcounted data
GArcBox is the atomic reference counting version of GRcBox. Unlike
GRcBox, the reference acquisition and release on GArcBox are guaranteed
to be atomic, and thus they can be performed from different threads.

This is similar to Rust's Arc<Box<T>> combination of traits.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
c5d2417d07 Add refcounted data
It is useful to provide a "reference counted allocation" API that can
add reference counting semantics to any memory allocation. This allows
turning data structures that usually are placed on the stack into memory
that can be placed on the heap without:

 - adding a public reference count field
 - implementing copy/free semantics

This mechanism is similar to Rust's Rc<Box<T>> combination of traits,
and uses a Valgrind-friendly overallocation mechanism to store the
reference count into a private data segment, like we do with GObject's
private instance data.
2018-07-09 10:11:42 +01:00
Xavier Claessens
88d13b4d09 doc: Remove glib.types since glib has not GType 2018-06-28 09:55:56 -04:00
Xavier Claessens
124779be88 doc: Remove gobject.types since gtkdoc-scan rebuild it anyway
I'm not sure why gobject.cI was needed but that looks like hack around
old gtkdoc bug. Works fine without it.
2018-06-28 09:55:56 -04:00
Xavier Claessens
71bc8e797b doc: Remove gio.types since gtkdoc-scan rebuild it anyway
meson.build was already passing --rebuild-types option but not
Makefile.am. Copy the IGNORE_HFILES list from meson.build because it was
outdated in Makefile.am and it's causing build issues when using the
generated gio.types file because it would contain win32 types when
building on linux.
2018-06-28 09:55:56 -04:00
Will Thompson
2e7d22a3bd
gvariant-text: fix bytestring example
ord('a') == 97 == 0x61 != 0x97.

    >>> GLib.Variant.parse(None, "[byte 0x97, 0x98, 0x99, 0]", None, None)
    GLib.Variant('ay', b'\227\230\231')
    >>> GLib.Variant.parse(None, "[byte 0x61, 0x62, 0x63, 0]", None, None)
    GLib.Variant('ay', b'abc')
2018-06-22 10:01:58 +01:00
Philip Withnall
ca98ce4280 Merge branch 'master' into 'master'
Use posix_spawn for optimized process launching

See merge request GNOME/glib!95
2018-06-21 17:10:43 +00:00
Daniel Drake
156d009696 gdesktopappinfo: add g_desktop_app_info_launch_uris_as_manager_with_fds variant
Add an app-launching function which allows standard file descriptors
to be passed to the child process.

This will be used by gnome-shell to pass systemd journal descriptors
as stdout/stderr. gnome-shell's child_setup function can then be
eliminated, which will enable use of the posix_spawn optimized
gspawn codepath for desktop app launching.
2018-06-21 11:44:59 -05:00
Daniel Drake
3524de16e4 gspawn: Add g_spawn_async_with_fds variant
Add a new process spawning function variant which allows the caller
to pass specific file descriptors for stdin, stdout and stderr.
It is otherwise identical to g_spawn_async_with_pipes.

Allow the same fd to be passed in multiple parameters. To make this
workable, the child process logic that closes the fd after the first time
it has been dup2'ed needed tweaking; we now just set those fds to be
closed upon exec using the CLOEXEC flag. Add a test for this case.

This will be used by gnome-shell to avoid performing equivalent
dup2 actions in a child_setup function. Dropping use of child_setup will
enable use of an upcoming optimized process spawning codepath.
2018-06-21 11:43:32 -05:00
segfault
76b4d0ab3f Add support for TCRYPT volumes to GMountOperation
Add G_ASK_PASSWORD_TCRYPT flag to GAskPasswordFlags and add the
following properties to GMountOperation:

- hidden_volume [1]
- system_volume [2]
- pim [3]

[1] https://www.veracrypt.fr/en/Hidden%20Volume.html
[2] https://www.veracrypt.fr/en/System%20Encryption.html
[3] https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html
2018-06-21 15:32:04 +02:00
Emmanuele Bassi
df28cfe0b5 Merge branch '896-variant-type-docs' into 'master'
Documentation and typing improvements for GVariant bytes

Closes #896

See merge request GNOME/glib!117
2018-06-19 14:15:37 +00:00
Philip Withnall
5e46a97ac6 gvariant: Document differences between GVariant bytestrings and arrays
https://gitlab.gnome.org/GNOME/glib/issues/896
2018-06-15 13:17:25 +01:00
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