Commit Graph

15952 Commits

Author SHA1 Message Date
David King
d36f6a9633 gobject.h: Use correct format specifier for __LINE__
GCC 5.0, with its new -Wformat-signedness, warns about the sign being
different between a type and the format string in printf-format
messages, leading to compiler warnings with G_OBJECT_WARN_INVALID_PSPEC.
In other uses of __LINE__ inside GLib, %d is used, and GCC seems to
expect a format specifier of %d as well:
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

https://bugzilla.gnome.org/show_bug.cgi?id=744263
2015-02-26 12:32:43 +01:00
Philip Withnall
e966cc51de gcancellable: Mention nullability in g_cancellable_cancel() docs
Calling g_cancellable_cancel(NULL) is an explicitly allowed no-op, for
convenience. Document and annotate that.
2015-02-24 10:57:14 +00:00
Alexandre Franke
99232046d6 Updated French translation 2015-02-24 00:42:43 +00:00
Colin Walters
0550708ca7 tests: Add many autoptr tests
I love Emacs keyboard macros, used them to convert the list of
defines cleverly into a list of tests, then iterated and filled in
the necessary constructor arguments.
2015-02-23 10:40:40 -05:00
Colin Walters
1b348a876f autocleanups: Remove g_autoptr(gchar)
- It's not sufficient, there are other bare array types
  like guint8, gdouble, etc.

- Other types like GVariant* always come as pointers, whereas
  there's a rather fundamental distinction between "gchar" and
  "gchar*" that has been signified to C programmers for 30+ years via
  the '*' character, and we're hiding that.

https://bugzilla.gnome.org/show_bug.cgi?id=744747
2015-02-23 07:56:34 -05:00
Colin Walters
d0105f1c08 Add g_autofree
The g_autoptr() being associated with the type name works out really
well for things like GHashTable.  However, it's a bit more awkward to
associate with "gchar".  Also because one can't use "char".
Similarly, there are a lot of other "bare primitive array" types that
one might reasonably use.

This patch does not remove the autoptr for "gchar", even though I
think it's rather awkward and strange.

Also while we're here, add a test case for the cleanup bits.

https://bugzilla.gnome.org/show_bug.cgi?id=744747
2015-02-22 22:18:07 -05:00
Ryan Lortie
2844f239f6 GApplication: let the main loop drain on shutdown
After ::shutdown, run the mainloop until all pending activity is
handled, before returning from run().

Among other things, this gives a chance for destroyed windows to be
properly withdrawn from the windowing system.

https://bugzilla.gnome.org/show_bug.cgi?id=744876
2015-02-22 19:14:03 -05:00
Chao-Hsiung Liao
9cee2e6a72 Updated Chinese (Taiwan) translation 2015-02-21 11:09:48 +00:00
Emmanuele Bassi
5e994b1e9b gobject: Add missing autocleanup for GInitiallyUnowned
We are missing the auto cleanup function for this type, which means
G_DECLARE_* macros won't work with classes inheriting from
GInitiallyUnowned.
2015-02-20 19:54:07 +00:00
Colin Walters
f141607eec gfileenumerator: Convert docbook tag -> markdown
This code predated the markdown conversion.  Pointed out by mclasen.
2015-02-20 14:37:39 -05:00
Colin Walters
52cd62d946 filenumerator: Add g_file_enumerator_iterate()
This is *significantly* more pleasant to use from C (while handling
errors and memory cleanup).

While we're here, change some ugly, leaky code in
tests/desktop-app-info.c to use it, in addition to a test case
in tests/file.c.

https://bugzilla.gnome.org/show_bug.cgi?id=661554
2015-02-20 14:02:05 -05:00
Colin Walters
9d6d30475b autocleanups: Add G*Array types
Not sure how these were omitted.  Probably few people are really using
this yet...and we don't have test cases (that's in the other patch).

https://bugzilla.gnome.org/show_bug.cgi?id=744830
2015-02-20 07:08:50 -05:00
Philip Withnall
9b03587707 gliststore: Add missing parameter documentation 2015-02-19 14:04:05 +00:00
Fran Dieguez
0d27b2e4e2 Updated Galician translations 2015-02-19 11:00:05 +01:00
Lars Uebernickel
2b27382596 gapplication: test setting and binding busy state
https://bugzilla.gnome.org/show_bug.cgi?id=744756
2015-02-19 08:39:55 +01:00
Lars Uebernickel
b4ef6d957f gapplication: add "is-busy"
A property to query the current busy state of an application.

https://bugzilla.gnome.org/show_bug.cgi?id=744756
2015-02-19 08:39:55 +01:00
Ryan Lortie
6ef0664017 gapplication: stop using deprecated API
More fallout from the GOptionGroup binding patch.
2015-02-18 16:45:59 -05:00
Lars Uebernickel
2d3d8cdce2 gapplication: tune busy-binding
g_application_bind_busy_property() had the restriction that only one
property can be bound per object, so that NULL could be used to unbind.
Even though this is enough for most uses, it is a weird API.

Lift that restriction and add an explicit unbind function.

https://bugzilla.gnome.org/show_bug.cgi?id=744565
2015-02-18 20:17:03 +01:00
Ryan Lortie
a2172ee247 GLib 2.43.90 2015-02-18 11:26:25 -05:00
Piotr Drąg
03de825c7e Updated POTFILES.in 2015-02-18 13:43:12 +01:00
Milo Casagrande
6b33ec39ad Updated Italian translation 2015-02-18 08:12:00 +00:00
Ryan Lortie
07ae2e1278 tests: add GSimpleIOStream async close tests
Just a couple of tests to make sure the two paths are working properly,
without crashes or leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=741630
2015-02-17 16:27:46 -05:00
Ignacio Casal Quinteiro
d4e3b82a93 Add GSimpleIOStream class
GSimpleIOStream represents an object that wraps an input and an output
stream making easy to use them by calling the #GIOStream methods.

https://bugzilla.gnome.org/show_bug.cgi?id=741630
2015-02-17 16:27:46 -05:00
Ryan Lortie
c2c0a6ae5c GIOStream: support for unemulated async close()
Add an implementation of non-thread-emulated async close of a GIOStream
if either of the underlying stream objects support it.

This prevents us from calling close() functions from another thread on
an object that may not be expecting that.  It also allows us to skip the
thread entirely in case our objects support a pure async close.

https://bugzilla.gnome.org/show_bug.cgi?id=741630
2015-02-17 16:17:01 -05:00
Ryan Lortie
cb40c553ae streams: add private 'async close via threads' API
Add an internal helper to find out if close_async() is implemented via
threads using the default implementation in the base class.

We will use this to decide if we should do a 'pure async' close of a
GIOStream or not.

https://bugzilla.gnome.org/show_bug.cgi?id=741630
2015-02-17 16:17:01 -05:00
Ryan Lortie
f56f1ef074 streams: de-gtkdocify internal API
Remove the /** **/-style block from two internal helpers to prevent
gtk-doc from picking them up.

https://bugzilla.gnome.org/show_bug.cgi?id=741630
2015-02-17 16:17:01 -05:00
Marc-André Lureau
512e9b3b34 gdbus: delay closing stream after read finish
Closing the stream on the writing side my race with a pending read. This
patch ensures that closing is delayed after reading is finished.

https://bugzilla.gnome.org/show_bug.cgi?id=743990
2015-02-17 16:16:52 -05:00
Ryan Lortie
c7f0ea4354 tests: check for NULL before g_object_unref()
delayed_close_free() calls g_object_unref() on a variable that is
expected to possibly contain NULL (as indicated by the fact that the
NULL case is handled in my_slow_close_output_stream_close_async()).

This is dead code right now (due to a bug in GDBus), which is why it
isn't actually causing a failure.  It should still be fixed, however.

https://bugzilla.gnome.org/show_bug.cgi?id=743990
2015-02-17 16:16:52 -05:00
Colin Walters
619832f729 autocleanups: Use g_option_context_unref()
This fixes a use of a deprecated API.
2015-02-17 13:37:03 -05:00
Lars Uebernickel
fcb30409ec gapplication: never set the prgname to the app id
GApplication set the prgname to the application's id when it was running
in service mode. This broke with the addition of new --app-id option,
because g_set_prgname() was called before parsing the options. Calling
it after option parsing doesn't work, because GOptionContext sets
prgname to argv[0] unconditionally.

Instead of changing the semantics of GOptionContext, simply remove this
functionality from GApplication. It is very unusual to have the prgname
set to the app id instead of the binary's name and might confuse people
when looking at logs etc.

When overriding local_command_line() from a subclass,
g_option_context_parse() might never be invokded. Thus, continue setting
the prgname to argv[0] in GApplication.

https://bugzilla.gnome.org/show_bug.cgi?id=743933
2015-02-17 19:09:47 +01:00
Milo Casagrande
62f7ea8191 Updated Italian translation 2015-02-17 13:32:06 +00:00
Lars Uebernickel
0f2b54142a gapplication: add bind_busy_property()
Balancing g_application_{un,}mark_busy() is non-trivial in some cases.

Make it a bit more convenient by allowing to bind multiple boolean
properties (from different objects) to the busy state. As long as these
properties are true, the application is marked as busy.

https://bugzilla.gnome.org/show_bug.cgi?id=744565
2015-02-16 07:38:43 +01:00
Matej Urbančič
c59d195dd2 Updated Slovenian translation 2015-02-15 21:11:57 +01:00
Sebastian Rasmussen
f7d6c3ba90 Updated Swedish translation 2015-02-15 19:49:43 +00:00
Ivan Komaritsyn
0adb8e9da5 Updated Russian translation 2015-02-15 09:10:44 +03:00
Efstathios Iosifidis
ab8493fa90 Updated Greek translation 2015-02-14 17:09:14 +02:00
Phillip Wood
a074c7a6f2 Test functions should have async scope
The testing utilities execute fixture and test functions
asynchronously.

https://bugzilla.gnome.org/show_bug.cgi?id=739724
2015-02-13 16:16:06 -05:00
Kjartan Maraas
977be8c149 Updated Norwegian bokmål translation. 2015-02-12 01:27:02 +01:00
Bastien Nocera
43df97ab86 goption: Add boxed type for GOptionGroup
This would allow bindings to use _get_option_group() functions, which
would then allow them to use GOption parsing.

This also adds introspection annotations to
g_option_context_add_group(), g_option_context_set_main_group() and
g_option_context_get_main_group().

https://bugzilla.gnome.org/show_bug.cgi?id=743349
2015-02-11 15:32:00 +01:00
Philip Withnall
93f2998765 glist: Mention that g_list_length() is bad for checking list emptiness
Despite linked lists being a fairly fundamental computer science
concept, some developers insist on using:
    g_list_length (list) > 0
to determine whether a list is non-empty, rather than using:
    list != NULL

Add a comment to the documentation for g_list_length() and
g_slist_length() pointing out the better alternative in the hope that it
will prevent some of this abuse.

https://bugzilla.gnome.org/show_bug.cgi?id=741024
2015-02-11 09:17:33 +00:00
Matthias Clasen
926955f325 2.43.4 2015-02-10 19:49:10 -05:00
Jasper St. Pierre
56f0c637cf Update .gitignore 2015-02-10 11:50:59 -08:00
Chun-wei Fan
433fc9475d gmem.h, gthread.h: Include glib/gutils.h
gmem.h and gthread.h made use of the inline keyword, that is not available
on all compilers in C-mode, causing builds to break on such compilers.

Include glib/gutils.h which handles the inline issue, in place of
glib/gtypes.h if applicable, which is included quite early on by
glib/gutils.h.

https://bugzilla.gnome.org/show_bug.cgi?id=744190
2015-02-10 23:17:07 +08:00
Sébastien Wilmet
59c0ff4825 GI annotation for g_get_charset()
https://bugzilla.gnome.org/show_bug.cgi?id=736914
2015-02-08 16:06:17 +01:00
Sébastien Wilmet
3f6d233e87 docs: code example for enumeration types
I had to read the GTK+ code recently to have an example.

https://bugzilla.gnome.org/show_bug.cgi?id=736914
2015-02-08 16:06:17 +01:00
Ryan Lortie
0110f2a810 g_steal_pointer: make it C++ clean
We have a test that #includes our headers from a C++ program to make
sure we don't throw any errors or warnings as a result of that.

The new inline implementation of g_steal_pointer() does an implicit
conversion from (void *), which is not valid in C++.

Add a cast to avoid the problem.

Thanks to Ignacio Casal Quinteiro for the report.
2015-02-06 17:01:56 +01:00
Ryan Lortie
aa68b3d6d6 tests: add a test case for g_steal_pointer()
Just some basic checking to make sure it works as intended.

https://bugzilla.gnome.org/show_bug.cgi?id=742456
2015-02-06 15:17:27 +01:00
Ryan Lortie
e668796c5a Add new API g_steal_pointer()
This is particularly nice when used with g_autoptr().  See examples in
the docs.

This patch is based upon an idea (and original patch submission) from
Will Manley <will@williammanley.net>.

https://bugzilla.gnome.org/show_bug.cgi?id=742456
2015-02-06 15:14:57 +01:00
Xavier Claessens
b5538416c0 GListModel: Use G_DECLARE_INTERFACE
https://bugzilla.gnome.org/show_bug.cgi?id=743939
2015-02-06 12:18:44 +01:00
Xavier Claessens
3d39b8eb01 Add G_DECLARE_INTERFACE
https://bugzilla.gnome.org/show_bug.cgi?id=743939
2015-02-06 12:18:37 +01:00