platform/upstream/glib.git
10 years agoDrop use of the command tag
Matthias Clasen [Sat, 1 Feb 2014 20:26:38 +0000 (15:26 -0500)]
Drop use of the command tag

It is more useful to link to the included man page, anyway.

10 years agoDocs: Drop use of indexterm tags
Matthias Clasen [Sat, 1 Feb 2014 20:25:43 +0000 (15:25 -0500)]
Docs: Drop use of indexterm tags

These have not been making it into the index, anyway.

10 years agoAnnotate all examples with their language
Matthias Clasen [Sat, 1 Feb 2014 20:11:49 +0000 (15:11 -0500)]
Annotate all examples with their language

The C ones, at least.

10 years agoGApplicationCommandline: Shorten embedded examples
Matthias Clasen [Sat, 1 Feb 2014 20:11:00 +0000 (15:11 -0500)]
GApplicationCommandline: Shorten embedded examples

Just show relevant fragments of the three examples inline,
and link to the full sources. This lets us get rid of
xinclude markup.

10 years agodocs: Stop using the function tag
Matthias Clasen [Sat, 1 Feb 2014 17:19:04 +0000 (12:19 -0500)]
docs: Stop using the function tag

10 years agoDon't use computeroutput tag
Matthias Clasen [Sat, 1 Feb 2014 17:09:14 +0000 (12:09 -0500)]
Don't use computeroutput tag

There was one occurrence of this.

10 years agoDocs: Big entity cleanup
Matthias Clasen [Sat, 1 Feb 2014 16:57:13 +0000 (11:57 -0500)]
Docs: Big entity cleanup

Strip lots of entity use from |[ ]| examples (which are now
implicit CDATA). Also remove many redundant uses of <!-- -->.

10 years agoGModule: Move docs away from markup
Matthias Clasen [Sat, 1 Feb 2014 16:08:23 +0000 (11:08 -0500)]
GModule: Move docs away from markup

10 years agogtestdbus: Use markdown for sections
Matthias Clasen [Sat, 1 Feb 2014 15:48:36 +0000 (10:48 -0500)]
gtestdbus: Use markdown for sections

10 years agoGSettings: use markdown for sections
Matthias Clasen [Sat, 1 Feb 2014 15:48:02 +0000 (10:48 -0500)]
GSettings: use markdown for sections

10 years agogconvert: Stop using footnotes
Matthias Clasen [Sat, 1 Feb 2014 15:47:09 +0000 (10:47 -0500)]
gconvert: Stop using footnotes

These don't really work in the generated docs, so just copy
the content in the few places.

10 years agoGObject: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:19:07 +0000 (10:19 -0500)]
GObject: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agogregex: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:18:07 +0000 (10:18 -0500)]
gregex: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agogoption: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:17:28 +0000 (10:17 -0500)]
goption: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agogmessages: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:17:04 +0000 (10:17 -0500)]
gmessages: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agogmarkup: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:15:52 +0000 (10:15 -0500)]
gmarkup: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agogmain: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:15:20 +0000 (10:15 -0500)]
gmain: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agoGKeyFile: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:14:59 +0000 (10:14 -0500)]
GKeyFile: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agoGIOChannel: remove unneeded markup from the docs
Matthias Clasen [Sat, 1 Feb 2014 15:14:41 +0000 (10:14 -0500)]
GIOChannel: remove unneeded markup from the docs

10 years agoggettext: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:14:08 +0000 (10:14 -0500)]
ggettext: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agofileutils: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:13:41 +0000 (10:13 -0500)]
fileutils: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agoGError: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:13:17 +0000 (10:13 -0500)]
GError: Convert docs to markdown

In particular, convert lists to markdown syntax.

10 years agoGDateTime: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:11:38 +0000 (10:11 -0500)]
GDateTime: Convert docs to markdown

In particular convert sections and lists to markdown syntax.

10 years agogconvert: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 15:10:19 +0000 (10:10 -0500)]
gconvert: Convert docs to markdown

In particular, we convert sections and lists to markdown syntax
here.

10 years agokqueue: Don't use doc comments
Matthias Clasen [Sat, 1 Feb 2014 14:50:23 +0000 (09:50 -0500)]
kqueue: Don't use doc comments

This is not public API, so no need to confuse gtk-doc by
documentation that it needs to ignore. Also, no need for
markup in here.

10 years agoGVariantType: convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 05:27:22 +0000 (00:27 -0500)]
GVariantType: convert docs to markdown

Convert lists to markdown syntax, and remove lots of <literal>.

10 years agoGVariant: convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 05:26:58 +0000 (00:26 -0500)]
GVariant: convert docs to markdown

Convert lists to markdown syntax, and remove a lot of <literal>.

10 years agogthread: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 05:26:38 +0000 (00:26 -0500)]
gthread: Convert docs to markdown

Convert lists to markdown syntax.

10 years agotestutils: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 05:26:05 +0000 (00:26 -0500)]
testutils: Convert docs to markdown

Convert lists to markdown.

10 years agoGApplication: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 04:47:57 +0000 (23:47 -0500)]
GApplication: Convert docs to markdown

10 years agogdbusnameowning: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 04:47:42 +0000 (23:47 -0500)]
gdbusnameowning: Convert docs to markdown

10 years agoGDBusConnection: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 04:42:40 +0000 (23:42 -0500)]
GDBusConnection: Convert docs to markdown

And straighten out capitalization across the file.

10 years agoGIcon: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 04:01:30 +0000 (23:01 -0500)]
GIcon: Convert docs to markdown

10 years agoGDBusProxy: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 04:01:13 +0000 (23:01 -0500)]
GDBusProxy: Convert docs to markdown

10 years agoGMenuModel: Convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 04:00:58 +0000 (23:00 -0500)]
GMenuModel: Convert docs to markdown

10 years agoGSimpleProxyResolver: convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 03:49:44 +0000 (22:49 -0500)]
GSimpleProxyResolver: convert docs to markdown

10 years agoGSocketClient: convert docs to markdown
Matthias Clasen [Sat, 1 Feb 2014 03:42:21 +0000 (22:42 -0500)]
GSocketClient: convert docs to markdown

10 years agoGTask: convert long desc to markdown
Matthias Clasen [Sat, 1 Feb 2014 03:29:13 +0000 (22:29 -0500)]
GTask: convert long desc to markdown

Use markdown sections and lists here.

10 years agogio/tests/network-address: fix for systems with large ifindexes
Dan Winship [Sat, 1 Feb 2014 12:37:07 +0000 (13:37 +0100)]
gio/tests/network-address: fix for systems with large ifindexes

In some virtualization setups, ifindexes can end up becoming very
large, and so the existing code that assumes that *some* interface
must have an index less than 255 fails.

Fix this by explicitly looking for "lo" first. And then if that fails
(on Windows, or other systems where the loopback interface is not
called "lo"), try indexes up to 1024 rather than 255.

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

10 years agoUnbreak glib/tests/markup-parse after FSF address change patch
Dan Winship [Sat, 1 Feb 2014 12:27:19 +0000 (13:27 +0100)]
Unbreak glib/tests/markup-parse after FSF address change patch

10 years agognetworkmonitornetlink: filter out IPv6 LL MC changes
Dan Winship [Tue, 28 Jan 2014 19:46:37 +0000 (14:46 -0500)]
gnetworkmonitornetlink: filter out IPv6 LL MC changes

For some reason, IPv6 link-local multicast routing changes all the
time. GNetworkMonitorBase was already ignoring them for purposes of
emitting network-changed, but GNetworkMonitorNetlink would still
trigger a re-dump after getting one, so network-changed would end up
getting emitted anyway.

10 years agoFix the docs build
Matthias Clasen [Sat, 1 Feb 2014 03:14:01 +0000 (22:14 -0500)]
Fix the docs build

10 years agoDocs: Don't use the code tag
Matthias Clasen [Sat, 1 Feb 2014 03:05:04 +0000 (22:05 -0500)]
Docs: Don't use the code tag

10 years agoDocs: Convert examples to |[ ]|
Matthias Clasen [Sat, 1 Feb 2014 02:56:33 +0000 (21:56 -0500)]
Docs: Convert examples to |[ ]|

10 years agoDocs: Don't use the emphasis tag
Matthias Clasen [Sat, 1 Feb 2014 01:34:33 +0000 (20:34 -0500)]
Docs: Don't use the emphasis tag

Most of the time, the text read just as well without the extra
boldness.

10 years agoDocs: don't use the warning tag
Matthias Clasen [Fri, 31 Jan 2014 22:38:27 +0000 (17:38 -0500)]
Docs: don't use the warning tag

More markup removal

10 years agoDocs: Don't use the note tag
Matthias Clasen [Fri, 31 Jan 2014 19:56:10 +0000 (14:56 -0500)]
Docs: Don't use the note tag

More markup avoidance.

10 years agoRestore executability for other files
Colin Walters [Fri, 31 Jan 2014 14:36:52 +0000 (09:36 -0500)]
Restore executability for other files

10 years agoRestore executability on data-to-c.pl
Colin Walters [Fri, 31 Jan 2014 14:23:45 +0000 (09:23 -0500)]
Restore executability on data-to-c.pl

10 years agoUpdated FSF's address
Daniel Mustieles [Thu, 23 Jan 2014 11:58:29 +0000 (12:58 +0100)]
Updated FSF's address

10 years agoDocs: don't use the type tag
Matthias Clasen [Fri, 31 Jan 2014 10:58:17 +0000 (05:58 -0500)]
Docs: don't use the type tag

Just avoid explicit docbook markup.

10 years agoDocs: don't use the structname tag
Matthias Clasen [Fri, 31 Jan 2014 05:29:14 +0000 (00:29 -0500)]
Docs: don't use the structname tag

Just avoid explicit docbook markup.

10 years agoDocs: don't use structfield tags
Matthias Clasen [Fri, 31 Jan 2014 04:59:06 +0000 (23:59 -0500)]
Docs: don't use structfield tags

They don't add anything over @foo, and we want to avoid explicit
docbook markup as far as possible.

10 years agoDocs: don't use <footnote>
Matthias Clasen [Fri, 31 Jan 2014 04:52:58 +0000 (23:52 -0500)]
Docs: don't use <footnote>

It basically does not work in the HTML output.

10 years agoTamil Translations Updated
Shantha kumar [Thu, 30 Jan 2014 09:33:08 +0000 (15:03 +0530)]
Tamil Translations Updated

10 years agoDrop a no-longer-existing example from the docs
Matthias Clasen [Sat, 25 Jan 2014 23:18:42 +0000 (18:18 -0500)]
Drop a no-longer-existing example from the docs

gapplication-example-menu.c was dropped in
0c094d660769a00564ef33a775a387f62cf2ff41, two years ago.
Time to remove its inclusion in the docs too.

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

10 years agogobject: Add missing transfer annotation to g_boxed_copy
Rico Tzschichholz [Thu, 23 Jan 2014 16:22:19 +0000 (17:22 +0100)]
gobject: Add missing transfer annotation to g_boxed_copy

10 years agogio: Add missing transfer annotation to g_simple_proxy_resolver_new
Rico Tzschichholz [Thu, 23 Jan 2014 16:21:32 +0000 (17:21 +0100)]
gio: Add missing transfer annotation to g_simple_proxy_resolver_new

10 years agoglib/goption.c: Fix build on MSVC
Chun-wei Fan [Thu, 23 Jan 2014 09:32:50 +0000 (17:32 +0800)]
glib/goption.c: Fix build on MSVC

Use #ifdef rather than #if, as MSVC does not like #if <macro> without
parens, and this is the normal usage in other cases like this.

10 years agoglib: annotate some memory functions with allow-none
William Jon McCann [Wed, 22 Jan 2014 22:51:12 +0000 (17:51 -0500)]
glib: annotate some memory functions with allow-none

10 years agoAssamese translation updated
Nilamdyuti Goswami [Wed, 22 Jan 2014 16:55:26 +0000 (22:25 +0530)]
Assamese translation updated

10 years agogio: Fix some header/source parameter-naming mismatches
Rico Tzschichholz [Wed, 22 Jan 2014 13:21:41 +0000 (14:21 +0100)]
gio: Fix some header/source parameter-naming mismatches

10 years agogsubprocess: Add missing transfer annotations to get_*_pipe()
Rico Tzschichholz [Wed, 22 Jan 2014 13:06:10 +0000 (14:06 +0100)]
gsubprocess: Add missing transfer annotations to get_*_pipe()

10 years agotest default GSimpleAction activation
Ryan Lortie [Sat, 18 Jan 2014 19:29:16 +0000 (14:29 -0500)]
test default GSimpleAction activation

Test the default handling of the "activate" signal on GSimpleAction.

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

10 years agostrfuncs: Make g_str_tokenize_and_fold introspectable
Jasper St. Pierre [Tue, 21 Jan 2014 17:08:03 +0000 (12:08 -0500)]
strfuncs: Make g_str_tokenize_and_fold introspectable

10 years agogsettings: Fix annotations
Jasper St. Pierre [Tue, 21 Jan 2014 17:00:35 +0000 (12:00 -0500)]
gsettings: Fix annotations

10 years agodocs: Add missing GTest functions
Emmanuele Bassi [Mon, 20 Jan 2014 20:03:40 +0000 (20:03 +0000)]
docs: Add missing GTest functions

The GTest message API is missing from the reference.

10 years agoglib/gtimezone.c: Check the size of tzi.DaylightName
Chun-wei Fan [Tue, 7 Jan 2014 05:34:09 +0000 (13:34 +0800)]
glib/gtimezone.c: Check the size of tzi.DaylightName

We need to re-get the size of tzi.DaylightName before we call
RegQueryValue() because the buffer might not have enough room to hold the
value for tzi.DaylightName that would be acquired by RegQueryValueExA(),
even though the size of tzi.DaylightName and tzi.StandardName is the same.

This is a pitfall of RegQueryValue()[1] as not doing this can result in an
ERROR_MORE_DATA (234) failure, causing the acquisition of tzi.DaylightName
to fail.

This will fix the gdatetime/equal test, amongst some other tests in
gdatetime, at least on certain non-English version of Windows.

[1]: http://social.msdn.microsoft.com/Forums/vstudio/en-US/84f90854-e90c-4b63-8fc1-655a0b4645fd/regqueryvalueex-returns-errormoredata

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

10 years agoUse __asm__ instead of asm
Matthias Clasen [Mon, 20 Jan 2014 13:43:02 +0000 (08:43 -0500)]
Use __asm__ instead of asm

This is a little more robust as various compiler flags make
gcc forget about asm.

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

10 years agoFix CFLAGS manipulation
Matthias Clasen [Mon, 20 Jan 2014 13:16:09 +0000 (08:16 -0500)]
Fix CFLAGS manipulation

The code for ensuring that CFLAGS contain -g if
--enable-debug has been specified did not work right.

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

10 years agoGAction: remove a lie
Matthias Clasen [Mon, 20 Jan 2014 12:37:42 +0000 (07:37 -0500)]
GAction: remove a lie

Not only was the link to GtkAction broken, it is not true.

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

10 years agoTry again to fix the freebsd build
Matthias Clasen [Mon, 20 Jan 2014 12:33:27 +0000 (07:33 -0500)]
Try again to fix the freebsd build

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

10 years agoClarify g_strchomp and g_strchug docs
Matthias Clasen [Mon, 20 Jan 2014 05:34:29 +0000 (00:34 -0500)]
Clarify g_strchomp and g_strchug docs

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

10 years agoClarify type transformability and comparability
A. Walton [Fri, 30 Aug 2013 06:33:58 +0000 (23:33 -0700)]
Clarify type transformability and comparability

If two GValues are transformable, it implies they are compatible,
so you do not need to check for compatibility yourself. Bump the
documentation to reflect this fact.

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

10 years agoMore GTree and GNode formatting and documentation fixes
Matthias Clasen [Mon, 20 Jan 2014 04:49:12 +0000 (23:49 -0500)]
More GTree and GNode formatting and documentation fixes

Among other things, add images for tree traversal types,
taken from Wikimedia Commons.

10 years agoMove GTraverseType to gnode docs
Matthias Clasen [Mon, 20 Jan 2014 03:23:51 +0000 (22:23 -0500)]
Move GTraverseType to gnode docs

10 years agoGQueue: documentation and formatting fixes
Matthias Clasen [Mon, 20 Jan 2014 03:03:40 +0000 (22:03 -0500)]
GQueue: documentation and formatting fixes

10 years agoGList: Some further documentation and formatting tweaks
Matthias Clasen [Mon, 20 Jan 2014 02:10:25 +0000 (21:10 -0500)]
GList: Some further documentation and formatting tweaks

10 years agotag: documentation enhancement for novice application developers
Olivier Sessink [Wed, 5 Sep 2012 07:52:23 +0000 (09:52 +0200)]
tag: documentation enhancement for novice application developers

Adds some code examples how functions can be used. Adds a hint
to look at GQueue if access to the start and the end of the list
is required.

applying comments from Emmanuele Bassi and adds some more
improvements to clarify how functions should be used.

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

10 years agoglib-init: make static assertions about platform assumptions
Simon McVittie [Fri, 16 Nov 2012 12:53:39 +0000 (12:53 +0000)]
glib-init: make static assertions about platform assumptions

GLib has a pervasive assumption that function and data pointers are
basically interchangeable, which is true in all modern ABIs,
but not actually guaranteed by ISO C. If someone tries to use GLib on a
platform where function and data pointers are different sizes, fail early.

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

10 years agoGHashTable: statically assert that GHashTableIter works as intended
Simon McVittie [Fri, 16 Nov 2012 12:51:31 +0000 (12:51 +0000)]
GHashTable: statically assert that GHashTableIter works as intended

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

10 years agoglib-private.h: add _glib_alignof
Simon McVittie [Fri, 16 Nov 2012 12:49:15 +0000 (12:49 +0000)]
glib-private.h: add _glib_alignof

10 years agoGMainContext: unref pending sources on destroy
Ryan Lortie [Fri, 25 Oct 2013 05:47:37 +0000 (01:47 -0400)]
GMainContext: unref pending sources on destroy

It is possible (but unlikely) that there will be a non-empty list of
pending dispatches when we remove the last ref from a GMainContext.
Make sure we drop the refs on the sources appropriately.

Add a (now-working) testcase that demonstrates how to trigger the issue.

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

10 years agoWork around broken FreeBSD headers
Matthias Clasen [Sun, 19 Jan 2014 22:13:51 +0000 (17:13 -0500)]
Work around broken FreeBSD headers

It seems that including just pthread.h does not define
clockid_t on these systems.

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

10 years agoFix the build
Matthias Clasen [Sun, 19 Jan 2014 13:57:43 +0000 (08:57 -0500)]
Fix the build

The thumbnail-verification test (indirectly) includes individual
headers, so define GIO_COMPILATION to make it work.

10 years agowin32: silence build warning
Marc-André Lureau [Wed, 6 Nov 2013 13:02:26 +0000 (14:02 +0100)]
win32: silence build warning

glocalfile.c: In function 'g_local_file_measure_size_of_file':
glocalfile.c:2654:3: warning: passing argument 2 of 'g_lstat' from
incompatible pointer type [enabled by default]
   if (g_lstat (name->data, &buf) != 0)
   ^
In file included from glocalfile.c:68:0:
../glib/gstdio.h:135:5: note: expected 'struct GStatBuf *' but argument
is of type 'struct _stati64 *'

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

10 years agowin32: silence build warning
Marc-André Lureau [Wed, 6 Nov 2013 12:57:07 +0000 (13:57 +0100)]
win32: silence build warning

gdbusauthmechanismexternal.c: In function 'mechanism_client_initiate':
gdbusauthmechanismexternal.c:355:3: warning: 'initial_response' may be
used uninitialized in this function [-Wmaybe-uninitialized]
   return initial_response;
   ^
gdbusauthmechanismexternal.c:332:10: note: 'initial_response' was
declared here

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

10 years agowin32: silence build warning
Marc-André Lureau [Wed, 6 Nov 2013 12:54:34 +0000 (13:54 +0100)]
win32: silence build warning

glocalfileinfo.c: In function '_g_local_file_info_get':
glocalfileinfo.c:1955:11: warning: passing argument 3 of
'get_thumbnail_attributes' from incompatible pointer type [enabled by
default]
           get_thumbnail_attributes (path, info, &statbuf);
           ^
glocalfileinfo.c:1285:1: note: expected 'const struct GStatBuf *' but
argument is of type 'struct _stati64 *'
 get_thumbnail_attributes (const char     *path,

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

10 years agoAvoid a deprecation warning
Matthias Clasen [Sun, 19 Jan 2014 13:21:50 +0000 (08:21 -0500)]
Avoid a deprecation warning

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

10 years agoAdjust doc to Makefile.decl renaming
Christophe Fergeau [Fri, 17 Jan 2014 17:42:36 +0000 (18:42 +0100)]
Adjust doc to Makefile.decl renaming

g_test_build_filename() API documentation still mentions Makefile.decl, but
it has been renamed to glib.mk in f9eb9eed

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

10 years agoGSimpleAction: fix mistake in last commit
Ryan Lortie [Sat, 18 Jan 2014 19:27:26 +0000 (14:27 -0500)]
GSimpleAction: fix mistake in last commit

Some bad copy-paste happening here...

10 years agoGSimpleAction: add default activate handler
Ryan Lortie [Sat, 18 Jan 2014 18:02:47 +0000 (13:02 -0500)]
GSimpleAction: add default activate handler

If the action is stateful and the user doesn't have their own activate handler
then do some reasonable things for ourselves.

After a lot of experience using stateful GSimpleAction it turns out that
people almost always end up using it in the same ways:

A boolean-typed stateful action with no parameter is most likely going
to want to be toggled.  Any other type of action that has the parameter
type equal to the state type probably intends for activation to
represent a request to change the state.

This patch implements those two cases.  This will let people stop
writing their own trivial handlers over and over.

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

10 years agoGOptionContext: add some notes about encodings
Ryan Lortie [Sun, 12 Jan 2014 17:47:43 +0000 (12:47 -0500)]
GOptionContext: add some notes about encodings

Add a note to the overview documentation for GOptionContext about why
you need to be careful about argv encoding on UNIX and about why you
should avoid argv entirely on Windows.  Mention some possible
alternative approaches, including a code example.

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

10 years agoGApplication: change commandline encoding policy
Ryan Lortie [Sun, 12 Jan 2014 17:31:38 +0000 (12:31 -0500)]
GApplication: change commandline encoding policy

Clarify in the documentation that the commandline arguments passed
around by GApplication (to local_command_line and returned via
g_application_command_line_get_arguments()) are in the GLib filename
encoding (ie: UTF-8) on Windows, not the system code page.

Fix the mismatch that would result from having argv passed to
g_application_run() in main() on Windows (where it is in the system
code page) by ignoring argc/argv on Windows and calling
g_win32_get_command_line() for ourselves.  Document this.

This might be a slight API break on Windows: we documented that it was
possible to call g_application_run() with arguments other than argc/argv
and now doing that will result in those arguments being ignored.  It has
always been recommended practice to only call g_application_run() from
main() directly, however, and all of our code examples have shown only
this.  We will see if this causes any issues and consider reevaluating
the situation if so.

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

10 years agog_file_new_for_commandline_arg: clarify encoding
Ryan Lortie [Fri, 17 Jan 2014 03:11:18 +0000 (22:11 -0500)]
g_file_new_for_commandline_arg: clarify encoding

Add a note to the documentation for g_file_new_for_commandline_arg()
that this function is intended to operate on strings already in the GLib
filename encoding on Windows.

This has been the case for a long time, but this documents the
requirement.

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

10 years agowin32: add g_win32_get_command_line()
Ryan Lortie [Sun, 12 Jan 2014 17:13:42 +0000 (12:13 -0500)]
win32: add g_win32_get_command_line()

This returns the command line in GLib filename encoding format (ie:
UTF-8) for use with g_option_context_parse_strv().

This will allow parsing of Unicode commandline arguments on Windows,
even if the characters in those arguments fall outside of the range of
the system codepage.

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

10 years agog_option_context_parse_strv: use UTF-8 on Windows
Ryan Lortie [Sun, 12 Jan 2014 17:10:19 +0000 (12:10 -0500)]
g_option_context_parse_strv: use UTF-8 on Windows

Add another difference to the freshly-added g_option_context_parse_strv:
now, on Windows, its arguments on to be in UTF-8 instead of the argv[]
encoding (from the system codepage).

The documentation teases g_win32_get_command_line() which is a new
GLib-filename-encoding-based function that will be added in a following
commit.

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

10 years agoGOption: don't use "rand" in code example
Ryan Lortie [Fri, 17 Jan 2014 02:47:09 +0000 (21:47 -0500)]
GOption: don't use "rand" in code example

rand() is a function defined in the libc, so our code example gives
warnings if you try to compile it.  Fix that.

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

10 years agogio: fix small memory leak on local xattr
Marc-André Lureau [Thu, 16 Jan 2014 17:02:18 +0000 (18:02 +0100)]
gio: fix small memory leak on local xattr

g_strconcat() allocates memory, it needs to be freed.

==10653== 1,400 bytes in 50 blocks are definitely lost in loss record
1,838 of 1,851
==10653==    at 0x4A0645D: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10653==    by 0x54ACB22: g_malloc (gmem.c:102)
==10653==    by 0x54ACE4D: g_malloc_n (gmem.c:343)
==10653==    by 0x54C8463: g_strconcat (gstrfuncs.c:589)
==10653==    by 0x4D6ED38: get_xattrs_from_fd (glocalfileinfo.c:660)
==10653==    by 0x4D71622:
_g_local_file_info_get_from_fd (glocalfileinfo.c:2028)
==10653==    by 0x4D731A0:
g_local_file_input_stream_query_info (glocalfileinputstream.c:356)
==10653==    by 0x4C996D8:
g_file_input_stream_query_info (gfileinputstream.c:148)
==10653==    by 0x4C863F6: file_copy_fallback (gfile.c:3120)
==10653==    by 0x4C86DD2: g_file_copy (gfile.c:3398)

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

10 years agogstringchunk: Use g_slist_free_full() where possible
Christian Schramm [Thu, 16 Jan 2014 11:36:09 +0000 (12:36 +0100)]
gstringchunk: Use g_slist_free_full() where possible

We have that function, let's use it - instead of manually
freeing the elements of the slist in a loop (and reduce
the line count a bit).

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