Commit Graph

4771 Commits

Author SHA1 Message Date
Stephan Bergmann
e7478ec967 Swallow -- argument when necessary
https://bugzilla.gnome.org/show_bug.cgi?id=768806
2016-07-16 20:34:51 -04:00
Simon McVittie
0f2e4fd01c Do not attempt to autolaunch a session dbus-daemon with no DISPLAY
The two known use-cases for autolaunching are:

* X-forwarding: "ssh -Y myhost myapp" resulting in a
  session bus on myhost but an X server on the original host

* Legacy desktop environments on OSs without D-Bus integration:
  e.g. running a single GNOME or KDE app under fvwm or something,
  without a session dbus-daemon being started by either systemd,
  gnome-session, or OS integration scripts analogous to Debian's
  /etc/X11/Xsession.d/75dbus_dbus-launch

In either case, an X11 DISPLAY is also needed.

"dbus-launch --autolaunch" doesn't do anything useful when unable
to connect to an X11 display; this has been the case since the feature
was added in 2006, and is useful to avoid "split brain" situations in
which two processes that ought to be part of the same session end up
on separate session buses. Since dbus commit 407c111 in 2011,
libdbus hasn't even attempted to run "dbus-launch --autolaunch"
unless getenv("DISPLAY") returns non-null in the parent: this avoids
doing a relatively complicated fork-and-exec that is clearly not
going to lead to success. This commit gives GDBus the same policy.

This change was originally made to work around a race condition in
subprocess spawning (Debian bug #737380, GNOME bug #711090) but
it seems valid in its own right.

In my opinion as D-Bus maintainer, "dbus-launch --autolaunch" should
be considered to be an X11 feature, and any future D-Bus enhancements
(e.g. kdbus) or successors for X11 (e.g. Wayland, Mir) should obtain
a session bus address by other means - either a session manager
such as "systemd --user", gnome-session or Upstart, or a wrapper
for the user session like dbus-run-session(1).

Related to dbus bug <https://bugs.freedesktop.org/show_bug.cgi?id=19997>.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=723506
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737380
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-07-16 20:33:34 -04:00
Ting-Wei Lan
cef799377e gio-querymodules: Call setlocale in main function
It is required to correctly show translated messages on some locales.

https://bugzilla.gnome.org/show_bug.cgi?id=760423
2016-07-14 11:25:42 +08:00
Matthias Clasen
63654183a8 documents portal: Make sure O_PATH is defined
FreeBSD doesn't have it.

https://bugzilla.gnome.org/show_bug.cgi?id=768780
2016-07-13 12:38:22 -04:00
Chun-wei Fan
b5258d9d76 gio: Build the portal code only on *NIX
xdg-desktop-portal support is only usable on *NIX platforms, so don't build
them on non-*NIX platforms.  Also clean up gio/Makefile.am a bit to split out
the listings for the platform-specific sources from the platform-neutral
sources, and assemble them for the final list of sources required for libgio.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-13 10:43:05 +08:00
Chun-wei Fan
bb5707d6cb gio/Makefile.am: Rearrange things a bit
Move the gio tool build items up, so that the MSVC items do not get split
by it.
2016-07-13 10:41:16 +08:00
Cosimo Cecchi
bc7c030480 documentportal: print warnings when document portal fails to initialize
Instead of siletly failing or calling a method on a NULL instance.
2016-07-12 15:12:35 -07:00
Philip Withnall
e694d1b673 gio: Fix a memory leak in gportalsupport.c
Coverity CID: 1357527
2016-07-12 23:08:27 +01:00
Dan Winship
e0bb25c214 Remove an erroneous check in the non-sendmmsg() version of g_socket_send_messages()
The docs specify that *all* errors are ignored if we managed to send
any data successfully, not just timeout/wouldblock.

https://bugzilla.gnome.org/show_bug.cgi?id=768549
2016-07-12 09:14:09 -04:00
Cosimo Cecchi
62bd8f54bb appinfo: support opening files through document portal
In addition to URIs, we now also support opening files internal to the
sandboxed application through the document portal.
2016-07-11 18:20:48 -07:00
Cosimo Cecchi
f4e2047f20 build: don't forget to clean generated portal files 2016-07-11 18:20:48 -07:00
Dan Winship
79b7efada3 Fix gio/tests/inet-address on OS X
OS X apparently stringifies the IPv6 address "::80" as "::0.0.0.128",
which is bizarre, but that address *is* in a "reserved for future use"
range, so it's not unambiguously wrong I guess. Anyway, fix the text
to use an address everyone can agree on.

https://bugzilla.gnome.org/show_bug.cgi?id=768551
2016-07-11 17:42:41 -04:00
Philip Withnall
a9172c6d03 gio-tool: Fix memory leaks on error paths in mount command
Various GErrors were being leaked.

Coverity CID: 1357351 (amongst others)
2016-07-11 21:56:04 +01:00
Philip Withnall
996bb34986 gio-tool: Remove a stray semicolon
This meant the help text would always be outputted, rendering
the same mode useless and the code below it dead.

Coverity CID: 1357352
2016-07-11 21:47:49 +01:00
Chun-wei Fan
d896ad269e gio/gappinfo.c: Don't include unistd.h
Functions from unistd.h seems not to be used in commit 5b77a19, and
unistd.h is not universally available, so don't include it.
2016-07-11 15:18:09 +08:00
Matthias Clasen
bd3fb2a15f Add a portal backend for GNotification
This talks to the org.freedesktop.portal.Notification portal
instead of directly to gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:48:34 -04:00
Matthias Clasen
e362a01446 Add a portalized proxy resolver implementation
The backend for this lives in xdg-desktop-portal,
and is in turn using GProxyResolver.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:48:34 -04:00
Matthias Clasen
cea5626c49 Add a portalized network monitor implementation
The backend for this lives in xdg-desktop-portal,
and is in turn using GNetworkMonitor.

When network is not available in the sandbox, there is
no point in reporting accurately about the network
status outside the sandbox. Just return 'no connection'
in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:48:34 -04:00
Matthias Clasen
5b77a19fe1 Add portal support to g_app_info_launch_default_for_uri
We need to patch in the portal support at a high enough
level that GAppInfo is not involved - a sandboxed app may
not be able to see any applications, so it can only launch
the defaults.

Note that even though the API is called launch_default...,
the portal may still offer the user to choose the application
to launch.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:47:36 -04:00
Matthias Clasen
78ef32110a Add portal helpers
These are private helper functions that will be used in
the following commits to get information about whether
we are running in a flatpak sandbox, etc.

We allow the use of GTK_USE_PORTAL=1 in the environment
to force the use of portals. This can be useful for
testing and debugging portal interaction.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:44:43 -04:00
Kalev Lember
4586434346 GFileMonitor: Fix doc typos 2016-07-06 14:37:12 +02:00
Matthias Clasen
9edba4e49c Add a new gio commandline tool
This command collects the various commandline utilities that
are currently shipped in gvfs, and unifies them under a single,
command-style binary.

The tools just use GIO APIs, so it makes sense for them to live here.
2016-07-01 16:01:34 -04:00
Philip Withnall
3613b7a366 gio: Add source tags to various GTasks constructed in GLib
This makes them easier to identify when debugging and profiling.

This patch was somewhat less than interesting to write.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
2016-06-29 15:16:52 +01:00
Philip Withnall
8c6d08ab1b build: Simplify dtrace configuration
Apply the same changes as in commit
7563ab4734 to gio/Makefile.am.

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

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2016-06-29 14:43:52 +01:00
Philip Withnall
c9d661b431 build: Ensure gio.stp.in is always distributed
Even if systemtap is not enabled in configure when running distcheck.

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2016-06-29 14:43:51 +01:00
Florian Müllner
61c1e2db99 vfs: Fix copying default schemes list
The list of supported schemes is not known at compile-time, so it is
wrong to iterate the list with G_N_ELEMENTS() and we miss all but the
first scheme. Fix by checking for the %NULL sentinel instead.

https://bugzilla.gnome.org/show_bug.cgi?id=768119
2016-06-28 15:57:49 +02:00
Florian Müllner
a42bdecf5c vfs: Fix return value of get_supported_uri_schemes()
The function is expected to return a %NULL-terminated array, but
commit 375b4ca65c dropped the sentinel when adding support for
additional custom schemes. Add it back.

https://bugzilla.gnome.org/show_bug.cgi?id=768119
2016-06-28 15:57:49 +02:00
Ondrej Holy
e57355b055 fileinfo: Add G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attribute
Add filesystem attribute to detect remote filesystems in order to
replace hardcoded filesystem types in GtkFileSystem. Set this attribute
also for GLocalFile appropriately.

Bump version to 2.49.3, so that early adopters of new API have a version
number to target.
2016-06-28 10:28:51 +02:00
Ernestas Kulik
f4b5dc30a7 gvfs: fix possible infinite loop in parse_name_internal()
If none of the closures in the hash table return a non-null value, the
loop never ends. Since the end of the hash table has been reached at
that point, g_hash_table_iter_next() starts asserting.

The possible fix is making the return value of g_hash_table_iter_next()
the condition in the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=768029
2016-06-25 08:44:52 -04:00
Cosimo Cecchi
375b4ca65c vfs: add g_vfs_register_uri_scheme()
Add a new API to allow clients to register a custom GFile implementation
handling a particular URI scheme.
This can be useful for tests, but also for cases where a different URI
scheme is desired to be used with another custom GFile backend.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=767887
2016-06-25 06:58:19 +08:00
Allison Lortie
9bb2499c9c tests: fix uint64 argument to g_object_set() call
5cea1c861d introduced accessors for 64bit
ints to gsettings, at which point the testcases were expanded.

Unfortunately, the expanded tests contained a bug: integer constants
passed to g_object_set() for a 64-bit property need an up-cast.  Add
that now.

Problem found by Iain Lane.
2016-06-23 11:49:39 -04:00
Philip Withnall
8e21b9e966 build: Add gio_probes.d to sources list so it ends up in the tarball
The probes.d file should be distributed even if GLib is build with
dtrace disabled. This is what’s done in the glib and gobject
directories.
2016-06-22 12:41:34 +01:00
Philip Withnall
fadd00c708 glocalfileoutputstream: Drop unnecessary (void) return value casts
g_close() does not have G_GNUC_WARN_UNUSED_RESULT, so these casts are
unnecessary.
2016-06-16 14:45:21 -04:00
Philip Withnall
16d674411f glocalfileoutputstream: Fix an FD leak in an error path
If a backup file is created, opened successfully, then fstat() on it
fails (perhaps due to another process deleting it in the mean time?),
the FD will be leaked.

Coverity issue: #1159485

https://bugzilla.gnome.org/show_bug.cgi?id=730187
2016-06-16 14:39:05 -04:00
Philip Withnall
195a0cb6bb gio: Add SystemTap and DTrace probes for GTask
This adds a basic tapset for GIO, covering various interesting parts of
GTask.

https://bugzilla.gnome.org/show_bug.cgi?id=759813
2016-06-15 16:15:12 -04:00
Philip Withnall
b26b083aa2 gio: Support using GDBusObjectManagerServer at path ‘/’
Previously this would cause an assertion failure when checking the paths
of exported objects, as it would try to check that their paths started
with ‘//’ due to mishandling the root object case.

Includes a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=761810
2016-06-15 13:27:19 -04:00
Philip Withnall
ac1166626c gio: Add missing (type filename) annotations
These differentiate between strings in the GLib filename encoding, and
strings in UTF-8.

https://bugzilla.gnome.org/show_bug.cgi?id=700756
2016-06-15 11:04:18 -04:00
Philip Withnall
f8ff1049d3 gio: Add missing (nullable) annotation
Add it to g_application_command_line_get_cwd(). Also add a clarifying
internal comment about the cwd private member.

https://bugzilla.gnome.org/show_bug.cgi?id=700756
2016-06-15 11:03:55 -04:00
Hans Petter Jansson
ae048625fe GDbusProxy: Plug memory leak.
proxy->priv->name_owner gets overwritten in async_init_data_set_name_owner() on the
assumption that it will always be NULL when we get there. However,
on_name_owner_changed() can run first, and it does set name_owner.

==20126== 42 bytes in 6 blocks are definitely lost in loss record 15,174 of 48,256
==20126==    at 0x4C280F3: malloc (vg_replace_malloc.c:299)
==20126==    by 0x7541D00: g_malloc (gmem.c:104)
==20126==    by 0x7558FEE: g_strdup (gstrfuncs.c:364)
==20126==    by 0x6DF8E4F: on_name_owner_changed (gdbusproxy.c:1399)
==20126==    by 0x6DE94C4: emit_signal_instance_in_idle_cb (gdbusconnection.c:3743)
==20126==    by 0x753C315: g_main_dispatch (gmain.c:3066)
==20126==    by 0x753C315: g_main_context_dispatch (gmain.c:3642)
==20126==    by 0x753C667: g_main_context_iterate.isra.24 (gmain.c:3713)
==20126==    by 0x753CA69: g_main_loop_run (gmain.c:3907)
==20126==    by 0x5E38000: meta_run (main.c:556)
==20126==    by 0x401EC0: main (main.c:441)

https://bugzilla.gnome.org/show_bug.cgi?id=755439
2016-06-15 16:39:00 +02:00
Christoph Reiter
9ec74d20a7 Partly revert "gio: Add filename type annotations"
Revert all annotation changes for environment variables and command line
arguments.

See commit f8189ddf98.
2016-06-07 19:50:03 +02:00
Christoph Reiter
f8189ddf98 gio: Add filename type annotations
https://bugzilla.gnome.org/show_bug.cgi?id=767245
2016-06-04 20:38:42 +02:00
Emmanuele Bassi
7d8e98ee09 Fix paths for non-srcdir builds
This fixes a build failure in Continuous that resulted in the error:

../../../gio/tests/test.gresource.xml: Failed to locate
'test-generated.txt' in any source directory.
Makefile:4676: recipe for target 'test.gresource' failed
make[6]: *** [test.gresource] Error 1
2016-06-04 13:49:46 +01:00
Georges Basile Stavracas Neto
5411a187a3 glib-compile-resources: correct resource compiler dependency for generated files
Don't require that files can be resolved when generating dependencies.

Original patch by Garret Regier.

https://bugzilla.gnome.org/show_bug.cgi?id=673101
2016-06-04 08:24:22 -04:00
Krzesimir Nowak
f5e875b2f8 gio: Add a missing autocleanup for GFileAttributeInfoList 2016-06-03 12:36:39 +02:00
Matthias Clasen
15a85f2095 GCredentialsType: Remove XML markup from docs
We now use markdown.
2016-06-02 13:26:07 -04:00
Krzesimir Nowak
504f189e59 gfileenumerator: Fix typo in docs
This probably used to be a part of libgsystem.
2016-06-02 11:29:55 +02:00
Ondrej Holy
17e5281ca9 Fix ABI compatibility
Commit 7b3f6da broke ABI compatibility, because of newly added vfunc.
Move the vfunc to the end to ensure ABI compatibility.

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

https://bugzilla.gnome.org/show_bug.cgi?id=765900
2016-05-20 10:31:22 +02:00
Руслан Ижбулатов
2aa7338875 testsuite: override check-TESTS target in gio tests subdir
This prevents testsuite from trying to build any TESTS in that
subdirectory, which will fail, because there are no TESTS defined
in that Makefile.am.

This happens when user runs make check TESTS=...

https://bugzilla.gnome.org/show_bug.cgi?id=766407
2016-05-14 04:59:40 +00:00
Matthias Clasen
98f86beed6 gdbus-codegen: Only generate autocleanup when instructed to
This adds a new --c-generate-autocleanup option to gdbus-codegen
which can be used to instruct gdbus-codegen about what autocleanup
definitions to emit.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=763379
2016-05-05 06:13:16 -04:00
Chun-wei Fan
217b620a7b gresource.c: Use g_file_test()
Use the g_file_test() API instead of the g_stat() + S_ISDIR combo to fix
builds on compilers that do not support S_ISDIR.

https://bugzilla.gnome.org/show_bug.cgi?id=765991
2016-05-04 23:50:18 +08:00
Christian Hergert
c16a0b53fe socket: set fd field to -1 after closing socket
This ensures that g_socket_get_fd() will return -1 after the socket has
been closed.

https://bugzilla.gnome.org/show_bug.cgi?id=765959
2016-05-04 16:47:54 +03:00
Debarshi Ray
0cd3d5741b gio/tests/task: Ensure that g_task_had_error doesn't forget the error
https://bugzilla.gnome.org/show_bug.cgi?id=764163
2016-05-04 09:34:05 +02:00
Debarshi Ray
a17e1e6d19 gtask: Don't forget about the error after g_task_propagate_*
The use of past tense in g_task_had_error makes one assume that it
won't forget about any errors that might have occurred. Except, in
reality, it would.

Let's use a boolean flag to remember the error once it's been
propagated, as opposed to keeping the error around. This ensures that
the g_task_propagate_* methods continue to give invalid results when
called more than once, as mentioned in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=764163
2016-05-04 09:33:49 +02:00
Simon McVittie
1c6cd5f0a3 codegen: make g_autoptr for the GInterface conditional
Some GNOME projects unconditionally work around the generated code's
lack of g_autoptr support by defining the autoptr cleanup function
themselves, which is not forward-compatible; as a result, commit
cbbcaa4 broke them. Do not define the cleanup function unless the
including app "opts in" to newer APIs via GLIB_VERSION_MAX_ALLOWED.

Projects requiring compatibility with GLib < 2.49 can get a
forward-compatible g_autoptr for a generated GInterface type found in
a library, for example ExampleAnimal in the GIO tests, by declaring
and using a typedef with a distinct name outside the library's
namespace:

    typedef AutoExampleAnimal ExampleAnimal;
    G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoExampleAnimal, g_object_unref)

    ...

    g_autoptr (AutoExampleAnimal) animal = NULL;

    /* returns ExampleAnimal * */
    animal = example_animal_proxy_new_sync (...);
    /* takes ExampleAnimal * first argument */
    example_animal_call_poke_sync (animal, ...);

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=763379
Reviewed-by: Colin Walters <walters@verbum.org>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
2016-05-03 15:48:55 +01:00
Simon McVittie
cbbcaa4dd7 codegen: Add g_autoptr support for the shared GInterface
The rest of the generated classes gained g_autoptr support in fd6ca66,
but this one is still missing. Because whatever_proxy_new_finish() and
whatever_proxy_new_sync() are declared as returning a Whatever *
instead of a WhateverProxy *, and the generated method-call stubs
act on a Whatever *, it's reasonably common to want to declare a
g_autoptr (Whatever).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/review?bug=763379
Reviewed-by: Colin Walters <walters@verbum.org>
2016-05-02 19:59:09 +01:00
Christian Hergert
d95030a2fd task: avoid context lock when setting source name
If you set the source name after attaching to the context, you have to
lock the context to free/assign the new source name.

https://bugzilla.gnome.org/show_bug.cgi?id=765861
2016-04-30 15:18:31 -07:00
Allison Ryan Lortie
05060b6194 gdbus-tool: avoid irrelevant note about arg types
gdbus-tool prints a hint about the expected arguments to a function call
in case of errors.  Unfortunately, it prints this message on all errors.
I've seen this confuse users several times -- they go on tweaking the
arguments trying to get the correct type, even though they had it
correct in the first place.

Let's limit the hint to the case where it was actually invalid arguments
that triggered the problem.  Also, adjust the code that prints the
message so that it will also report on the case that no arguments were
expected.

We could possibly get closer to what we want by comparing the list of
expected arguments with the parameter list, as it was parsed from the
user, but that would involve composing the expected type.  Let's keep
this simple for now.

https://bugzilla.gnome.org/show_bug.cgi?id=765710
2016-04-29 10:36:53 +02:00
Marc-Antoine Perennou
5cea1c861d gsettings: add get/set_{,u}int64
https://bugzilla.gnome.org/show_bug.cgi?id=755898

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-04-28 17:28:44 +02:00
Allison Ryan Lortie
55ab3af098 GResources: add support for resource overlays
When debugging a program or testing a change to an installed version, it
is often useful to be able to replace resources in the program or a
library, without recompiling.

To support this, for debugging and hacking purposes, it's now possible
to define a G_RESOURCE_OVERLAYS environment variable as a
colon-separated list of substitutions to perform when looking up
GResources.

A substitution has the form

  "/org/gtk/libgtk=/home/desrt/gtk-overlay"

The part before the '=' is the resource subpath for which the overlay
applies.  The part after is a filesystem path which contains files and
subdirectories as you would like to be loaded as resources with the
equivalent names.

In the example above, if an application tried to load a resource with
the resource path '/org/gtk/libgtk/ui/gtkdialog.ui' then GResource would
check the filesystem path '/home/desrt/gtk-overlay/ui/gtkdialog.ui'.  If
a file was found there, it would be used instead.

Substitutions must start with a slash, and must not have a trailing
slash before the '='.  It is possible to overlay the location of a
single resource with an individual file.

https://bugzilla.gnome.org/show_bug.cgi?id=765668
2016-04-28 14:36:13 +02:00
Allison Ryan Lortie
3c7c0af1c9 GResources: use g_hash_table_get_keys_as_array()
Replace the hand-written equivalent of this with the call to the
GHashTable built-in version to save a few lines of code.

The GResource code was written a couple of years before this function
existed.

Similarly, replace a set-mode usage of g_hash_table_insert() with a call
to g_hash_table_add().

https://bugzilla.gnome.org/show_bug.cgi?id=765668
2016-04-28 14:36:13 +02:00
Philip Chimento
f8f344923e tests: Fix appmonitor test
Commit f45ec47 fixed a race condition in this test, but one change was
omitted; maybe lost in a rebase.

https://bugzilla.gnome.org/show_bug.cgi?id=749606
2016-04-27 12:12:31 +08:00
Allison Ryan Lortie
75589956a4 GContextSpecificGroup: add testcase
Add a test case for unreffing an object from a GContextSpecificGroup
immediately after firing a signal, before allowing the mainloop to run.

https://bugzilla.gnome.org/show_bug.cgi?id=762994
2016-04-26 15:20:16 +02:00
Allison Ryan Lortie
62f320e6bb GContextSpecificGroup: detach sources
GContextSpecificGroup has been somewhat broken for a rather long time:
when we remove the last reference on an object held in the group, we try
to clean up the source, but fail to actually remove it from the
mainloop.

We will soon stop emitting signals on the source (due to it having been
removed from the hash table) but any "in flight" signals will still be
delivered on the source, which continues to exist.  This is a problem if
the event is being delivered just as the object is being destroyed.

This also means that we leave the source attached to the mainloop
forever (and next time will create a new one)...

This is demonstrated with the GtkAppChooser dialog which writes an
update to the mimeapps.list file just as it is closing, triggering the
app info monitor to fire just as it is being destroyed.

Karl Tomlinson correctly analysed the problem and proposed this fix.

https://bugzilla.gnome.org/show_bug.cgi?id=762994
2016-04-26 15:20:16 +02:00
Allison Ryan Lortie
3301b852a2 GDesktopAppInfo: support bus activation with '-'
GApplication has accepted any valid bus name as an application ID since
before the time of D-Bus activation.  This includes bus names with '-'.
Several applications have even attempted support bus activation with
these names, going as far as installing D-Bus service files, without
realising that they are silently falling back to fork()/exec() on
account of the name containing a dash.

The reason for the problem is that D-Bus object paths cannot contain
dashes.  We solved this problem privately in an unspecified way inside
of GApplication but substituting '_' in this case, but never made this
part of the Desktop Entry Specification.

The fact that these apps with '-' in the desktop file names aren't
actually using D-Bus activation is beside the point: their intent here
was clear.  Let's avoid forcing them to rename their desktop files again
by simply accepting '-' in desktop file names and munging the path in
the way that GApplication did so historically.

The new path escaping code here has been copied more or less verbatim
from GApplication's own code for the same purpose, with only the removal
of one irrelevant part.

An update to the desktop entry specification will follow.

https://bugzilla.gnome.org/show_bug.cgi?id=764754
2016-04-25 09:19:23 +02:00
Antoine Jacoutot
52f116e874 gioenums.h: Remove trailing comma.
This is helpful to people using the g++ --pedantic option.
2016-04-17 10:04:13 +02:00
Matthias Clasen
24b0781264 Improve GApplication docs
D-Bus activation is a thing now; bring the local_command_line
docs in sync with reality.
2016-04-13 12:01:49 -04:00
Debarshi Ray
fcaa3fb189 docs: Add Since for handle_local_options
https://bugzilla.gnome.org/show_bug.cgi?id=764685
2016-04-11 22:37:35 -04:00
Sébastien Wilmet
d16abd3df3 docs: fix function name
g_action_parse_detailed_action_name() doesn't exist, it's
g_action_parse_detailed_name() instead.
2016-04-09 13:01:53 +02:00
Cosimo Cecchi
f45ec47be1 tests: always remove app.desktop
https://bugzilla.gnome.org/show_bug.cgi?id=749606
2016-04-03 12:23:21 -07:00
Philip Withnall
d09c219696 glocalfile: Assert against a potential NULL pointer dereference
This was confusing some static analysis. Through canonicalize_filename()
at construction time, we guaranteed that ->filename is canonical and
absolute, so g_path_skip_root() should never fail.

https://bugzilla.gnome.org/show_bug.cgi?id=731988
2016-04-02 12:27:05 +01:00
Iain Lane
a668ee8fe9 giotypefuncs.c: Sort _get_type functions in the 'C' locale
This ensures that the generated file is always the same (not dependent
on the build machine's environment), making the build reproducible.

Thanks to Jérémy Bobbio <lunar@debian.org> for the Debian bug report and
patch.

https://bugzilla.gnome.org/show_bug.cgi?id=763617
2016-03-21 13:44:38 +00:00
Philip Withnall
c7763d0712 glib-compile-resources: Fix minor memory leak on error path
Spotted by Coverity (CID: #1353385).
2016-03-21 12:44:15 +00:00
Philip Withnall
db972a73ce gio: Fix a GError memory leak in GNetworkService
Spotted by Coverity (CID: #1325405).
2016-03-15 18:08:29 +00:00
Philip Withnall
27660b178e gio: Fix a GError memory leak in GDesktopAppInfo
Spotted by Coverity (CID: #1352961).
2016-03-15 18:03:00 +00:00
Philip Withnall
0a580fc79e gio: Fix minor typo in GActionGroup documentation 2016-03-14 12:57:20 +00:00
Philip Withnall
fd6ca66c16 codegen: Add support for g_autoptr to gdbus-codegen–generated objects
This means that any code generated by gdbus-codegen will now require
GLib 2.44 or newer.

https://bugzilla.gnome.org/show_bug.cgi?id=763379
2016-03-10 09:39:44 +00:00
Руслан Ижбулатов
74b1dd87b5 W32: eliminate busy cursor when a rundll32-hosted child runs
Even though GetStartupInfo() in g_win32_run_session_bus() would
tell us that STARTF_FORCEONFEEDBACK flag is not set, it still
affects the rundll32 process for some reason.

This means that Windows WM changes mouse cursor to IDC_APPSTARTING for
a few seconds when rundll32 runs g_win32_run_session_bus(). Since
g_win32_run_session_bus() never satisfies the conditions set by
STARTF_FORCEONFEEDBACK, the busy cursor only goes away after a
timeout.

Fix this by explicitly running GetMessage(). To ensure that GetMessage()
doesn't block, post a quit message immediately before calling it.

https://bugzilla.gnome.org/show_bug.cgi?id=760694
2016-03-03 07:26:04 +00:00
Jan Alexander Steffens (heftig)
5a894c3232 gsettings: Don't crash when no schemas are installed
Still doesn't behave well ("gsettings help" causes an error),
but at least there's no segfault anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=724847
2016-03-02 19:04:28 -05:00
Allison Ryan Lortie
b54acf513d GDBusConnection: use uint for bitshifts
"1 << 31" is not well-defined, do use "1u << 31" instead.

https://bugzilla.gnome.org/show_bug.cgi?id=762748
2016-03-01 10:34:07 -05:00
Ignacio Casal Quinteiro
96fb3b9c03 gwin32fsmonitorutils: avoid useless cast 2016-03-01 08:55:29 +01:00
Ignacio Casal Quinteiro
6e454a99ef gwin32fsmonitorutils: avoid a possible invalid memory access 2016-03-01 08:55:26 +01:00
Ignacio Casal Quinteiro
dedf65a5fd gwin32fsmonitorutils: no need to g_assert when using g_new 2016-03-01 08:40:48 +01:00
Ignacio Casal Quinteiro
922cd8424a gwin32fsmonitorutils: no need to check for NULL when using g_free 2016-03-01 08:37:51 +01:00
Ignacio Casal Quinteiro
007e3c5939 gwin32fsmonitorutils: coding style fixes 2016-03-01 08:37:14 +01:00
Sebastian Geiger
7f60cbb701 gio: fix documentation of GAction 2016-02-29 15:47:32 +01:00
Ignacio Casal Quinteiro
45ccd3f951 gwin32filemonitor: some cleanups
Make the code a bit more consistent and get it into preparation to
merge the fs monitor stuff that uses the private struct directly.
2016-02-28 15:05:18 +01:00
Ignacio Casal Quinteiro
bc5b7332b7 Improve error on win32input/output streams 2016-02-25 17:23:50 +01:00
Ignacio Casal Quinteiro
73192b84f8 gwin32outputstream: cleanups to make the code more consistent 2016-02-25 10:00:32 +01:00
Ignacio Casal Quinteiro
d5cb451c51 gwin32inputstream: some cleanups to make the code more consistent 2016-02-25 09:56:25 +01:00
Ignacio Casal Quinteiro
53a24814f6 gsettingschema: fix uninitialized value warning
This error could actually happen in case the assertions are off.
2016-02-24 17:20:57 +01:00
Ignacio Casal Quinteiro
f3334b47ec Revert "registrybackend: use G_DECLARE_FINAL_TYPE"
This reverts commit b0776ddd18.
mingw does not seem to like this patch so better go on the safe
way.
2016-02-24 09:33:22 +01:00
Ignacio Casal Quinteiro
13057bb73e registrybackend: fix warning about unused variable 2016-02-24 09:18:42 +01:00
Tobias Nygren
0d0db60959 gio/gtestdbus.c: don't use non-standard %m printf modifier
https://bugzilla.gnome.org/show_bug.cgi?id=756706
2016-02-19 11:29:32 +00:00
Lars Uebernickel
b32f8ba19b gapplication: add a way to override the app-id
Some applications support running in a mode where they present
themselves as a different application to the user (for example web
browsers or terminals).

To facilitate this, add an option --gapplication-app-id which allows
users to override an application's id from desktop files or similar.

Applications need to opt-in to this by setting the
G_APPLICATION_CAN_OVERRIDE_APP_ID flag.

https://bugzilla.gnome.org/show_bug.cgi?id=743933
2016-02-18 08:18:58 -05:00
Matthias Clasen
caf03300e5 Remove leftover markup 2016-02-17 20:10:43 -05:00
Cole Robinson
a3a97dca3a gsettings: schema_list should use the passed schema's source
currently schema_list will iterate over the default SchemaSource
list, and not the one associated with the passed in Schema. This
means schema_list can give incorrect results for a Schema fetched
from a non-default SchemaSource, like via new_from_directory.

https://bugzilla.gnome.org/show_bug.cgi?id=757506
2016-02-16 10:57:58 -05:00
Ignacio Casal Quinteiro
19fd89f8db registrybackend: avoid adding a new child when we return the root 2016-02-05 12:05:02 +01:00
Ignacio Casal Quinteiro
63b0f1087d registrybackend: another cleanup creating a registry cache item 2016-02-05 11:39:30 +01:00
Ignacio Casal Quinteiro
c73e9fc36a registrybackend: use registry_cache_add_item instead of creating manually 2016-02-05 11:14:24 +01:00
Ignacio Casal Quinteiro
bd3dd1cd48 registrybackend: get whether a key is writable or not 2016-02-05 10:44:45 +01:00
Руслан Ижбулатов
604ca89176 registrybackend: do convert values to UTF-16
Perform conversion before writing a value out of the cache into the registry,
and convert back when reading a value into the cache out of the registry.
The registry holds UTF-8 strings.
2016-02-05 09:40:30 +01:00
Руслан Ижбулатов
c4d943186e registrybackend: fix memory leak 2016-02-05 09:39:21 +01:00
Ignacio Casal Quinteiro
b8fc289e8f registrybackend: remove useless include 2016-02-04 12:44:11 +01:00
Ignacio Casal Quinteiro
74442a0b8c registrybackend: do not leak self if there are no items 2016-02-04 11:16:45 +01:00
Ignacio Casal Quinteiro
dc97bb9b9b registrybackend: handle readability of the keys
If a key is removed or it cannot be read anymore we should
notify the backend about it so it fallbacks to the default
value.
2016-02-04 11:02:46 +01:00
Ignacio Casal Quinteiro
05dd91a0b6 registrybackend: use unicode calls intead of the ansi ones
https://bugzilla.gnome.org/show_bug.cgi?id=761504
2016-02-04 08:59:59 +01:00
Ignacio Casal Quinteiro
7161d70955 registrybackend: remove useless get_permission override
The base class does the same
2016-02-04 07:55:25 +01:00
Ignacio Casal Quinteiro
259a61ed2d registrybackend: pass the event to the cache update
This way the registry cache has more control to specify what has
changed.
2016-02-03 19:19:50 +01:00
Rico Tzschichholz
e3189527dc gio/gobject: Various introspection fixes 2016-02-03 18:13:49 +01:00
Ignacio Casal Quinteiro
c7ea434e2c registrybackend: properly propagate the partial key name 2016-02-03 13:10:09 +01:00
Ignacio Casal Quinteiro
f1a5e394b0 registrybackend: rename touched flag to readable
This is a flag used to understand if a key exists on the registry
and if it is readable. It makes more sense to rename it as readable
since anyway a key that does not exists anymore is a key that is
not readable.
2016-02-02 14:48:22 +01:00
Ignacio Casal Quinteiro
5cc997f7c4 registrybackend: close the key only if successfully opened 2016-02-02 11:08:50 +01:00
Ignacio Casal Quinteiro
bf3f827ca1 registrybackend: use ptr_array_new_with_free_func 2016-02-02 11:08:42 +01:00
Ignacio Casal Quinteiro
9098a7f927 registrybackend: minor style cleanup 2016-02-02 11:04:56 +01:00
Rico Tzschichholz
d268d9f86a socket: Fix annotation of g_socket_receive_message
https://bugzilla.gnome.org/show_bug.cgi?id=761337
2016-02-02 10:15:04 +01:00
Rico Tzschichholz
ec173eb654 application: Fix annoation of g_application_add_option_group
https://bugzilla.gnome.org/show_bug.cgi?id=761337
2016-02-02 10:11:08 +01:00
Ignacio Casal Quinteiro
169cfb250f registrybackend: avoid signed/unsigned comparison warnings 2016-02-01 14:25:05 +01:00
Ignacio Casal Quinteiro
b0776ddd18 registrybackend: use G_DECLARE_FINAL_TYPE 2016-02-01 14:24:46 +01:00
Sébastien Wilmet
95dd373024 docs: better documentation for g_file_info_copy_into()
The documentation of g_file_info_copy_into() was misleading. The
attributes are not just copied, @dest_info is also cleared at the
beginning. So any previously set attributes in @dest_info are lost.

There was a bug in gedit about this function, where some metadata were
not saved. So it might make sense to change the implementation to not
clear @dest_info, and copy one by one the attributes from @src_info to
@dest_info.

https://bugzilla.gnome.org/show_bug.cgi?id=747927
2016-01-28 20:31:53 +01:00
Sébastien Wilmet
a4ed89bf75 docs: improve doc of g_file_info_list_attributes()
The name_space can be NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=747927
2016-01-28 18:49:28 +01:00
Matthias Clasen
42699e37be gio: Include filename in error message
I'm tired of seeing 'No such file or directory' in the logs without
a hint as to what is actually wrong. Including the filename here
may help me tracking down a bug in the continuous infrastructure.
2016-01-27 21:05:31 -05:00
Chun-wei Fan
d20e88fd11 gwinhttpfile.c: Fix build on Visual Studio
Visual Studio, at least the older versions, cannot use L on macros which
are defined as a constant string, plus the L must be applied to all string
literals here.  This does not look nice, but this is life...
2016-01-26 23:23:42 +08:00
Ignacio Casal Quinteiro
56b0454ba5 registrybackend: fix warning 2016-01-26 15:41:08 +01:00
Ignacio Casal Quinteiro
b57eac68e5 registrybackend: fix double-free error 2016-01-26 15:22:48 +01:00
Ignacio Casal Quinteiro
df1ffe7e27 registrybackend: remove :( from messages 2016-01-26 14:35:31 +01:00
Ignacio Casal Quinteiro
0200e4036c registrybackend: simplify g_message_win32_error 2016-01-26 13:26:41 +01:00
Ignacio Casal Quinteiro
bc85dee6b3 registrybackend: do not accept 0 as a windows error
We might end up removing from the error stack the wrong error
and this might be missleading
2016-01-26 13:19:56 +01:00
Ignacio Casal Quinteiro
bad7e4a114 registrybackend: do not leak the watch data in case of failure 2016-01-26 13:15:51 +01:00
Ignacio Casal Quinteiro
31aab1bd42 registrybackend: do not leak key and event if it cannot add the watch 2016-01-26 12:53:56 +01:00
Ignacio Casal Quinteiro
a92d97ff1f registrybackend: more style fixes
This is the never ending story
2016-01-26 12:21:48 +01:00
Ignacio Casal Quinteiro
1b5b0eff9a registrybackend: fix possible crash if cache_node is NULL 2016-01-26 12:02:18 +01:00
Ignacio Casal Quinteiro
67f6ede3e5 registrybackend: remove space before ++ 2016-01-26 11:46:51 +01:00
Ignacio Casal Quinteiro
8f7aa273de registrybackend: fix possible mem leak
If the parameters do not validate we would leak the memory.
2016-01-26 11:42:33 +01:00
Ignacio Casal Quinteiro
305a9b12c9 winhttpfile: use glib format string macro
Like this we avoid some downstream patching for msys2
2016-01-26 10:13:02 +01:00
Ignacio Casal Quinteiro
a89629db1d registrybackend: use the glib format string macro 2016-01-26 10:10:39 +01:00
Ignacio Casal Quinteiro
a159bc939d registrybackend: more cleanups 2016-01-26 09:00:35 +01:00
Ignacio Casal Quinteiro
7256f2289a registrybackend: more cleanups 2016-01-25 16:12:59 +01:00
Ignacio Casal Quinteiro
a5e819c4c3 registrybackend: style fixes 2016-01-25 16:02:03 +01:00
Philip Withnall
8c263008bb build: Calculate ABS_GLIB_RUNTIME_LIBDIR at build time
Rather than calculating it at configure time. This means it can expand
$libdir properly, and use the Make $(realpath) function rather than
invoking the non-portable `readlink -f`.

This fixes problems where `readlink` would be called on an invalid path
(due to a variable not being expanded) and would evaluate to "", which
would then cause things to be installed in the wrong place.

https://bugzilla.gnome.org/show_bug.cgi?id=744772
2016-01-24 14:44:44 +00:00
Philip Withnall
3c0cddfe80 gdbusobjectmanagerserver: Clarify recommended ObjectManager paths
Otherwise people might try to export the object manager at ‘/’, which
doesn’t work. And I have no intention of making it work.

https://bugzilla.gnome.org/show_bug.cgi?id=760852
2016-01-19 17:10:40 +00:00
Philip Withnall
1725580f26 gdbusobjectmanagerserver: Convert a DocBook link to Markdown 2016-01-19 17:01:14 +00:00
Philip Withnall
c3d6934f18 gio: Add DTLS interfaces
Add a new GDtlsConnection interface, plus derived GDtlsClientConnection
and GDtlsServerConnection interfaces, for implementing Datagram TLS
support in glib-networking.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=752240
2016-01-18 14:25:06 +00:00
Allison Ryan Lortie
86c5d8978d GDBusMethodInvocation: document behaviour change
We changed the behaviour of this API to adapt to a change in the D-Bus
specification.  Document the new behaviour, along with the time of the
change.

https://bugzilla.gnome.org/show_bug.cgi?id=755421
2016-01-13 10:51:44 -05:00
Lars Uebernickel
dbea81b02d gdbus: don't send unexpected replies
gdbus sets NO_REPLY_EXPECTED when no callback is given to
g_dbus_connection_call(). It makes sense that it also handles the server
side correctly by discarding replies to clients that don't want one.

https://bugzilla.gnome.org/show_bug.cgi?id=755421
2016-01-13 10:44:49 -05:00
Philip Withnall
3add5e2837 gio: Document thread safety of the streams API
Specifically, GIOStream and the TLS connection streams.

Includes wording adapted from suggestions by Dan Winship
<danw@gnome.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=735754
2016-01-11 15:58:42 +00:00
Javier Jardón
4e78a0a9df Revert "Use upstream gettext instead the glib one"
This causes several problems:
- Compilation in FreeBSD with --enable-gtk-doc broke
- Modules that still use the AM_GLIB_GNU_GETTEXT macro
  doesnt compile anymore because /usr/share/glib-2.0/gettext
  is not filled with the correct files, as this was done in
  the glib custom po/Makefile.in.in

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

This reverts commit e5c752371c.
2016-01-10 22:44:24 +00:00
Javier Jardón
e5c752371c Use upstream gettext instead the glib one
https://bugzilla.gnome.org/show_bug.cgi?id=622991
2016-01-09 18:49:22 +00:00
Matt Watson
c1e2a8d727 resource file: add cancel to dummy monitor
gfilemonitor has a cancel vfunc and will call into the in dispose.
If we don't stub it out we get a segfault.
2016-01-08 18:08:20 -08:00