Commit Graph

3878 Commits

Author SHA1 Message Date
Xavier Claessens
c4e9135352 GFile: add GBytes version of _replace_contents_async()
https://bugzilla.gnome.org/show_bug.cgi?id=690525
2013-12-02 14:45:42 -05:00
Colin Walters
10d2a01c9a gsubprocess: Annotate g_subprocess_newv()
So that it can actually be invoked by bindings.
2013-12-01 22:00:27 -05:00
Matthias Clasen
a812e110bf Install all test data
The desktop-files directory contains a mimeapps.cache file
that was not installed as data for installed tests, causing
the file measure test to fail only in when installed.
2013-12-01 11:47:00 -05:00
Matthias Clasen
72eae6eddd Improve file measure testcase
Make the testcase compare the byte size to what is reported
by du. Also add a test for the async api, and mak eit test
the progress reporting callback.
2013-11-30 23:10:13 -05:00
Philip Withnall
9d4cd9c5ae gtestdbus: Minor documentation fixes
https://bugzilla.gnome.org/show_bug.cgi?id=712148
2013-11-29 08:11:13 +00:00
Philip Withnall
46c1aea0e7 gtestdbus: Fix non-const use of const variables
The argv array should be declared as const.

https://bugzilla.gnome.org/show_bug.cgi?id=712148
2013-11-29 08:11:13 +00:00
Philip Withnall
598a9c5028 gtestdbus: Fix variable shadowing
Shut up, GCC.

https://bugzilla.gnome.org/show_bug.cgi?id=712148
2013-11-29 08:11:13 +00:00
Matthias Clasen
b328cae6a9 Add a test for g_file_measure_disk_usage 2013-11-29 00:12:43 -05:00
Colin Walters
7a90c201f7 tests/gsubprocess: Only compare basename of /tmp
Otherwise, we break in Continuous where /tmp == /sysroot/tmp,
and something in the execve() or the kernel will do realpath()
for us.
2013-11-29 04:12:26 +00:00
Matthias Clasen
2cafe37e19 Improve GApplication test coverage
Exercise more of the GActionMap implementation.
2013-11-28 21:57:47 -05:00
Matthias Clasen
5528a0f408 Improve GNotification test coverage 2013-11-28 21:56:48 -05:00
Matthias Clasen
97a06b4252 Improve GSimpleActionGroup test coverage
Add a case that overwrites an existing action.
2013-11-28 21:53:53 -05:00
Matthias Clasen
dbe560ac01 Improve GSettings test coverage
This covers some more GSettingsSchemaKey api.
2013-11-28 16:01:23 -05:00
Matthias Clasen
00ab7790ce Improve GNotification test coverage 2013-11-28 16:01:23 -05:00
Matthias Clasen
a688b2a9c0 Improve test coverage for GSubprocess 2013-11-28 16:01:23 -05:00
Matthias Clasen
f18138a9cf Improve test coverage for gsettings 2013-11-28 16:01:23 -05:00
Matthias Clasen
9a02cfd914 Test new gsettings api
g_settings_get_user_value and g_settings_get_default_value
are now covered.
2013-11-28 16:01:23 -05:00
Philip Withnall
49ea52e6a6 gio: Replace g_clear_object() with if()…g_object_unref()
As per https://bugzilla.gnome.org/show_bug.cgi?id=113075#c39.
2013-11-28 20:41:49 +00:00
djcb
49fc6d5b7e gdbus-codegen: Fix leak in property setter
Comparing the code generated for the setter and other methods without
(real) return value, I noticed that the setter does not unref the
gvariant it gets.

https://bugzilla.gnome.org/show_bug.cgi?id=719472
2013-11-28 08:25:20 -05:00
Matthias Clasen
7d82d6dc5b Test g_subprocess_launcher_spawn
The spawnv variant of this function already had a test, but
spawn was not tested.
2013-11-28 01:36:29 -05:00
Matthias Clasen
7ef1eccd7e Fix g_subprocess_launcher_spawn
This function turns a varargs argument list into a string array,
but forgets to NULL-terminate it. This function was not covered
by unit tests...so it was broken.
2013-11-28 01:34:52 -05:00
Matthias Clasen
4a687ed723 Test some more GSubProcess api
This covers g_subprocess_set_environ, g_subprocess_setenv,
g_subprocess_getenv, and g_subprocess_set_flags.
2013-11-28 01:12:26 -05:00
Matthias Clasen
bd932aa9f8 Add a GAppInfoMonitor test
The test reveals that there's something fishy with this monitor.
One has to call g_app_info_get_all() for it to start working,
and then it only works once.
2013-11-28 00:19:19 -05:00
Matthias Clasen
36a42ab0a5 Add tests for new GAction api
g_action_name_is_valid and g_action_parse_detailed_name are
now covered.
2013-11-27 22:48:06 -05:00
Manuel Bachmann
1e3fe29fc3 Fix g_win32_run_session_bus hook for MinGW-w64
On win64, g_win32_run_session_bus gets exported with this
precise name, with MinGW as well as MSVC.

Fixes annoying "Entry not found" UI warning.
2013-11-27 23:18:54 +01:00
Ryan Lortie
43d19dae11 gsettings tool: stop using GMainLoop
Just iterate directly.
2013-11-27 12:42:32 -05:00
Ryan Lortie
f33a7f9ef2 gsettings tool: fix some sed damage
The previous patch to simplify the GSettings commandline tool by making
more use of global variables went a bit too far and broke 'gsettings
monitor' when used without a specific key.

Fix that up again.
2013-11-27 12:42:32 -05:00
Rui Matos
1300108e0c GDBusObjectManagerClient: keep the manager alive while firing signals
Handlers for the signals we emit might unref the object manager. Make
sure we keep it alive until we are done with it.

https://bugzilla.gnome.org/show_bug.cgi?id=719402
2013-11-27 16:18:19 +01:00
Philip Withnall
c9344fd513 gio/tests: Add a dynamic type check assertion
This shuts up a static analysis false positive, and adds some extra
checking.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:30 +00:00
Philip Withnall
32118951ea gio/tests: Add a non-NULL assertion to help static analysis
The static analyser (correctly) considers a type check to fail if the
variable is NULL. In this case, the address must be non-NULL as no error
was thrown by g_socket_connection_get_remote_address(), but the static
analyser doesn’t know this.

Add a non-NULL assertion anyway, both to shut the analyser up, and
because it’s good extra testing.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:30 +00:00
Philip Withnall
c9ccc2af91 gio/tests: Add non-NULL assertions to help static analysis
These prevent some false positives from the static analyser which are
caused by it not inspecting the invariants of
g_subprocess_communicate[_utf8]_finish() (i.e. that stdout and
stdout_str will always be set unless an error was returned).

They’re also good testing anyway.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
fe004445a4 gio/tests: Fix a g_return_val_if_fail() in a void function
Should be g_return_if_fail() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
73e6b900d4 gunixmounts: Fix a potential strcmp(NULL) call
mntent->mnt_fsname may be NULL at this point; if so, fall to the second
branch and set mount_entry->device_path = NULL.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
8b9e8dc53b gcontenttype: Fix a potential NULL pointer dereference
If the initial part of the header (‘MIME-TreeMagic’) is valid, but the
following line does not start with ‘[’ (i.e. is not a valid section
line), insert_matchlet() will be called with a NULL match pointer, and
will crash with a NULL pointer dereference.

Fix this by bailing out if a valid section line isn’t encountered before
the first insert_matchlet() call (i.e. between the header line and the
first data line).

Note that this has not been tested against a real treemagic file; the
fix is purely theoretical.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
aa28ced44e gunixfdlist: Fix a potential NULL pointer dereference
In the case that (n_fds == 0 && fds == NULL), memcpy() would be called
against a NULL src pointer. Even though the number of bytes to copy is
0, avoid the possibility of a crash by only calling if fds is non-NULL.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
956c58c7f2 gsocketaddress: Add an assertion to help static analysis
The static analyser will check dynamic type assertions and assume that
if they fail, the variable can either have the wrong type, or be NULL
(which is correct). The analyser doesn’t know that other constraints in
the API ensure the variable is non-NULL.

Add a non-null assertion to help the static analyser and shut it up in
this case.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
c729f416fb gdbusserver: Fix a potential g_object_unref(NULL) call
This can happen if the hash table lookup for ‘noncefile’ fails, and
hence the first ‘goto out’ is hit, at which point resolver is still
NULL.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
44af12aba1 gcontenttype: Fix a potential g_object_unref(NULL) call
This can happen if the g_file_query_info() call fails, returning NULL.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Chun-wei Fan
b9322bf9ab gio/tests/memory-output-stream.c: Avoid an uninitialized variable
Be a little bit more careful in regards to initializing a primitive type
variable before passing it by reference, as it could have random stuff
in the variable's address depending on the CRT, such as MSVCR110.DLL,
causing random, invalid stuff being written in that address.

This will fix this test when built with Visual Studio 2012.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-27 08:01:47 +08:00
Michael Natterer
32cfcc8740 gio: remove precondition checks from g_output_stream_printf()
because we call g_output_stream_vprintf() which does exactly the same
checks.
2013-11-26 23:00:52 +01:00
Michael Natterer
d86396f21f gio: add g_output_string_[v]printf()
which are useful for porting FILE* based output code.
2013-11-26 11:51:24 +01:00
Chun-wei Fan
a997cfe90f gio/gdbusauthmechanismsha1.c: Move G_OS_* checks down
The G_OS_* checks are only valid if the GLib headers have been previously
included, so that io.h can be included properly on Windows
2013-11-26 13:16:15 +08:00
Colin Walters
03bf43e14a gsubprocess: Document g_subprocess_get_identifier() 2013-11-25 18:39:46 -05:00
Philip Withnall
299bcbfa41 gsubprocess: Fix potential strlen(NULL) calls
Also clarify the nullability of stdin_buf arguments in GSubprocess
communication calls.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=715164
2013-11-25 15:46:51 +00:00
Manuel Bachmann
1fb4b3b2bf Fix G_OS #ifdefs in gbusserver.c
G_OS #ifdefs are only available once glibconfig.h has been
evaluated ; that is, after including glib headers.
Move this block down so it gets correctly evaluated.
2013-11-24 04:51:21 +01:00
Matthias Clasen
5efc038e0d Fix up appinfo test
Make it possible to skip the terminal-launching test simply
by setting DISPLAY= . Previously, you had to unset DISPLAY,
which is a little more cumbersome.

https://bugzilla.gnome.org/show_bug.cgi?id=711178
2013-11-23 22:24:51 -05:00
Matthias Clasen
0fc0754e65 Fix up the appinfo test
One testcase was launching appinfo-test from a GAppInfo that
does not have a filename. In this case, the G_LAUNCHED_DESKTOP_FILE
envvar is not exported. Make appinfo-test deal with that, without
spewing warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=711178
2013-11-23 22:21:29 -05:00
Matthias Clasen
0250d185b1 Fix warnings in a the actions test
The actions test tests the GSimpleActionGroup API. Maybe this
should be moved to use GActionMap, but for now, just disable
the deprecations.

There was also one test that wasn't actually hooked up, so
do that as well.
2013-11-23 21:28:40 -05:00
Christian Persch
bd8fb391aa application: Use printerr for runtime errors
g_critical can be fatal (with --g-fatal-warnings, or some env var set),
so don't use it to print out runtime errors.

Bug #676761.
2013-11-23 18:16:41 -05:00
Matthias Clasen
e45372895d Fix desktop-app-info test
The recent change to the search scoring algorithm made
nautilus and konqueror switch places in the search results.
Update the test to reflect that.
2013-11-23 18:15:04 -05:00
Stef Walter
baf92d09d6 gtestdbus: Properly close server connections
Otherwise g_test_dbus_down() following a g_test_dbus_stop()
will hang until it times out.

https://bugzilla.gnome.org/show_bug.cgi?id=711807
2013-11-23 17:37:58 -05:00
Stef Walter
5a5aaa203a gdbus-connection: Fix race condition in test
The test was expecting that the spawned process wouldn't start
up before the NameOwnerChanged signal was subscribed.

https://bugzilla.gnome.org/show_bug.cgi?id=711805
2013-11-23 15:20:51 -05:00
Lars Uebernickel
65da592249 Add basic test for the GNotification gtk backend
https://bugzilla.gnome.org/show_bug.cgi?id=711051
2013-11-23 15:11:09 -05:00
Stef Walter
797959f05a gtestdbus: Don't destroy GSource twice
https://bugzilla.gnome.org/show_bug.cgi?id=711806
2013-11-23 13:47:29 -05:00
Bastien Nocera
aef0adc0dd GSettings: More docs for deprecated _list_schemas()
Most _list_schemas() uses were to check for the availability
of a particular schema. g_settings_schema_source_lookup() is
a better way to do this.

https://bugzilla.gnome.org/show_bug.cgi?id=712315
2013-11-23 13:35:52 -05:00
Andrew Walton
4382e8b876 CLOEXEC fix for older FreeBSDs and OS X.
Some older POSIX-flavored operating systems may not have adopted
O_CLOEXEC yet.

See https://bugzilla.gnome.org/show_bug.cgi?id=712136.
2013-11-23 11:01:29 -05:00
Stef Walter
e3babb3687 giomodule: Allow overriding source directory gio modules are loaded from
When testing (and valgrinding) we need to have a known set of modules
loaded.

https://bugzilla.gnome.org/show_bug.cgi?id=711801
2013-11-23 01:17:03 -05:00
Dan Winship
8f5b40c046 gio/tests: fix output of gdbus-proxy-threads and gdbus-threading
Make gdbus-proxy-threads and gdbus-threading print a newline at the
end of their progress strings, to avoid messing up their TAP-format
output.

https://bugzilla.gnome.org/show_bug.cgi?id=711796
2013-11-23 00:43:54 -05:00
Dan Winship
c762a3a3f6 gio/tests: basic-application is a helper program, not a test
https://bugzilla.gnome.org/show_bug.cgi?id=711796
2013-11-23 00:43:53 -05:00
Dan Winship
158dde0507 Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.

Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:25:39 -05:00
Dan Winship
3981cddbf8 Require POSIX.1 (1990) compliance on unix
Assume unix platforms support the original POSIX.1 standard.
Specifically, assume that if G_OS_UNIX, then we have chown(),
getcwd(), getgrgid(), getpwuid(), link(), <grp.h>, <pwd.h>,
<sys/types.h>, <sys/uio.h>, <sys/wait.h>, and <unistd.h>.

Additionally, since all versions of Windows that we care about also
have <sys/types.h>, we can remove HAVE_SYS_TYPES_H checks everywhere.

Also remove one include of <sys/times.h>, and the corresponding
configure check, since the include is not currently needed (and may
always have just been a typo for <sys/time.h>).

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:17:42 -05:00
Dan Winship
6e4a7fca43 Require C90 compliance
Assume all supported platforms implement C90, and therefore they
(correctly) implement atexit(), memmove(), setlocale(), strerror(),
and vprintf(), and have <float.h> and <limits.h>.

(Also remove the configure check testing that "do ... while (0)" works
correctly; the non-do/while-based version of G_STMT_START and
G_STMT_END was removed years ago, but the check remained. Also, remove
some checks that configure.ac claimed were needed for libcharset, but
aren't actually used.)

Note that removing the g_memmove() function is not an ABI break even
on systems where g_memmove() was previously not a macro, because it
was never marked GLIB_AVAILABLE_IN_ALL or listed in glib.symbols, so
it would have been glib-internal since 2004.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:16:16 -05:00
Michael Haubenwallner
b1af471a3f build: Give internal libraries higher precedence
Linking local libraries too late may cause preinstalled libraries to
get found earlier, due to external library paths in .la files.

https://bugzilla.gnome.org/show_bug.cgi?id=712314
2013-11-19 08:11:35 -05:00
Colin Walters
a46459b000 GSocketClient: For _CONNECTING event, make remote address accessible
My application (hotssh) would like to get the resolved address from DNS,
before we start the connect().

We could add a new event, but it's easy enough to just cache it on the
GSocketConnection; this avoids any new API.

https://bugzilla.gnome.org/show_bug.cgi?id=712547
2013-11-18 17:13:34 -05:00
Michael Haubenwallner
efb1701bf3 Use AC_HEADER_MAJOR
Instead of checking for sys/mkdev.h headerfile, there is the
AC_HEADER_MAJOR helper for how to get major(), minor(), makedev().

https://bugzilla.gnome.org/show_bug.cgi?id=712314
2013-11-18 14:47:53 -05:00
Dan Winship
f79e39154d GDummyTlsBackend: cache the GDummyTlsDatabase
The default GTlsDatabase is supposed to be a singleton (and libsoup
has tests that will fail if it's not).
2013-11-17 09:45:20 -05:00
Ryan Lortie
ca830f2733 Fix GSettings testcase again
Hopefully this one will work for both srcdir == builddir and not.
2013-11-15 15:32:09 -05:00
Florian Müllner
2fb8901b64 gdesktopappinfo: Rank Keywords matches higher than GenericName
It makes sense to match on GenericName in case an application does
not provide any keywords, but the Keywords field has been added
to explicitly support the search case, while GenericName was used
to be displayed in menus, so it makes more sense to consider
Keywords more (or equally) relevant for search.

https://bugzilla.gnome.org/show_bug.cgi?id=711640
2013-11-13 16:54:02 +01:00
Ryan Lortie
ce35c08c57 Revert "gdbus-connection-loss: Fix leak in test"
This reverts commit 670379b26f.

This is causing distcheck to fail and will have to be revisited later.
2013-11-12 00:05:09 -05:00
Ryan Lortie
5c4f3f4dab gsettings test: fix srcdir != builddir
Just copy the schemas to the builddir and compile them in place instead
of trying to mess around with creating the compiled file in a different
dir.  This solves issues in the summary/description testcase when
GSettings expects the usual situation of having the .xml files present
in the same directory.
2013-11-12 00:05:04 -05:00
Stef Walter
1e5e3b64a8 gsubprocess: Fix a number of leaks and a segfault
Fixed a number of leaks in gsubprocess, as well as a segfault
that was hidden by never calling g_subprocess_communicate_state_free().

https://bugzilla.gnome.org/show_bug.cgi?id=711803
2013-11-11 17:41:39 +01:00
Stef Walter
a638be8a79 Revert "giomodule: Fix leaks in module loading"
This reverts commit dc72039c16.

This depends on a patch that allows GTypeModule to be finalized.
Lets put this back in bugzilla until that gets in.
2013-11-11 17:17:10 +01:00
Chun-wei Fan
0212ab6182 Tests: Fix up the expected messages
There was an expected messages that was not in the form that GLib on
Windows actually produces, which causes some test to fail.  Fix this up.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:40:57 +08:00
Chun-wei Fan
b27a2d436b gio/tests/gsubprocess.c: Fix on Windows
We need to check for the correct line endings on Windows (\r\n) for the
echo tests and currently need to skip the test_echo_eof test there, as
it depends on the cat utility that is not normally found on Windows, and
using an external installation of cat via MSYS or Cygwin would render the
test program to hang as cat waits for user input.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:38:05 +08:00
Dan Winship
fff14a5b7c gcancellable: don't use g_cancellable_connect() in GCancellableSource
g_cancellable_connect() is documented as calling its callback only
once, but GCancellableSource should trigger every time the cancellable
is cancelled.

https://bugzilla.gnome.org/show_bug.cgi?id=710691
https://bugzilla.gnome.org/show_bug.cgi?id=711286
2013-11-11 09:28:07 -05:00
Stef Walter
670379b26f gdbus-connection-loss: Fix leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 08:46:45 +01:00
Stef Walter
14b27eaab8 gdbus-introspection: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 08:46:33 +01:00
Stef Walter
dc72039c16 giomodule: Fix leaks in module loading
https://bugzilla.gnome.org/show_bug.cgi?id=711798
2013-11-11 07:22:48 +01:00
Stef Walter
91c8fb82fe gdbus-connection: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:12:53 +01:00
Stef Walter
f80e2695e1 gdbus-connection-slow: Fix leak in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:12:37 +01:00
Stef Walter
0d51ff79ed gdbus-connection: Fix use after free in test
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:12:26 +01:00
Stef Walter
95526b5db5 gsubprocess: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:12:18 +01:00
Stef Walter
fe3c878c53 gsubprocess: Fix error detection logic in tests
Various tests were depending on local_error being set by a callback
when it could never have been the case. Simplify async error detection
logic in those cases, and fix leak of GError.

https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:12:00 +01:00
Stef Walter
78ad171da9 g-icon: Fix memory leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:11:29 +01:00
Stef Walter
faafd4c051 contexts: Fix memory leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:11:22 +01:00
Stef Walter
438f7110f9 data-output-stream: Fix some access after free
The memory pointed to by a GMemoryOutputStream can be realloc'd

https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:11:14 +01:00
Stef Walter
72171240cc buffered-output-stream: Fix some access after free
The memory pointed to by a GMemoryOutputStream can be realloc'd

https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 07:10:59 +01:00
Stef Walter
419b47e166 gtestdbus: Fix leak of GMainLoop
https://bugzilla.gnome.org/show_bug.cgi?id=711808
2013-11-11 06:55:09 +01:00
Michael Catanzaro
ae6dbb35cb giomodule: small typo in documentation 2013-11-09 09:35:14 -06:00
Matthias Clasen
0cb8454b5c Small documentation improvement 2013-11-08 20:57:04 -05:00
Rico Tzschichholz
83d4278197 Revert "gio/Makefile: make sure to dist gappinfoprivate.h"
This reverts commit c45b26d61f.
2013-11-08 08:15:43 +01:00
Ryan Lortie
bda60c3e8b GAppInfoMonitor: don't try to use NULL hash table
Don't g_hash_table_iter_init() on a NULL table if we see the app info
monitoring but no monitors have been created yet.

https://bugzilla.gnome.org/show_bug.cgi?id=711632
2013-11-07 13:56:56 -05:00
Ryan Lortie
ffbf866d3b GApplication: fix bogus testcase
We had a GApplication testcase that handled both open and commandline.
This only way that this worked was by implementing the commandline
handler without actually setting the HANDLES_COMMAND_LINE flag.

This behaviour is now invalid, so just rip out the offending part of the
test.

https://bugzilla.gnome.org/show_bug.cgi?id=711099
2013-11-07 13:51:05 -05:00
Ryan Lortie
6e0bbd8adb appinfo: Add some testcases for searching
https://bugzilla.gnome.org/show_bug.cgi?id=711557
2013-11-07 12:41:27 -05:00
Ryan Lortie
3d32d5359a Add g_desktop_app_info_search()
The first time this function is called we load all of the keyfiles in
the directory, ignoring the 'Hidden' ones and build an index out of the
interesting fields using g_str_tokenize_and_fold().

We do prefix matching on the tokens to find relevent desktop files.

Right now this is implemented as a hashtable that we iterate over,
checking prefixes on each token.  This could possibly be sped up by
creating an array, but it's already pretty fast...

https://bugzilla.gnome.org/show_bug.cgi?id=711557
2013-11-07 12:41:27 -05:00
Ryan Lortie
c45b26d61f gio/Makefile: make sure to dist gappinfoprivate.h 2013-11-07 12:41:27 -05:00
Rico Tzschichholz
ffb39bff6f gio: Add gappinfoprivate.h to Makefile.am
In addition to e55d33edc1
2013-11-07 17:37:13 +01:00
Chun-wei Fan
87e6db8deb codegen.py: Rearrange GLib Version Check
...so that the generated code will build on all platforms, as compilers
like Visual C++ does not like #ifdef checks during a definition/use of
a macro.

https://bugzilla.gnome.org/show_bug.cgi?id=711049
2013-11-07 09:25:54 +08:00
Ryan Lortie
e55d33edc1 Add GAppInfoMonitor
This is a simple object that emits a "change" signal when the installed
applications may have changed in some way.

https://bugzilla.gnome.org/show_bug.cgi?id=711556
2013-11-06 11:26:53 -05:00
Ryan Lortie
86ce3bf48e gdesktopappinfo: keep a list of files in the dirs
In each DesktopFileDir, store a list of desktop files for that
directory.  This speeds up opening desktop files by name because we can
skip statting in directories that we know don't have the file and also
speeds up _get_all() because we can avoid enumeration.

This also improves our support for dealing with names like
'kde4/kate.desktop' (equivalent to kde4-kate.desktop) since we find out
about all of these files are the start and don't need to guess about
which '-' to change to a '/'.  It also means that we can easily deal
with more than one level of such prefixes.

We use a file monitor to watch for changes, invalidating our lists when
we notice them.

https://bugzilla.gnome.org/show_bug.cgi?id=711520
2013-11-06 10:56:25 -05:00