Commit Graph

15 Commits

Author SHA1 Message Date
Robert Mader
22f691939c Stop using GSlice
It has been inofficially deprecated for years, is known to cause issues
with valgrind and potentially hides memory corruption.
Lets stop using it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1473
2020-10-19 20:18:11 +02:00
Marco Trevisan (Treviño)
46547ae027 shell-mime-sniffer: Ignore invalid file content type
The shell mime sniffer goes through all the files in a directory,
however in case a file content type is not recognized, the GIO function
g_file_info_get_content_type() may return NULL, causing a crash when
looking up into the content type tables, as they are supposed to contain
strings only and they use `g_str_hash` has func, which doesn't support
NULL values.

So, in case we get an invalid content type, let's just ignore it,
without adding it to the cache as we do in the nautilus code that was
inspiring the sniffer.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2643
2020-06-05 16:27:29 +02:00
Robert Mader
c48330a986 cleanup: Use g_clear_handle_id() for g_source_remove()
It makes sure we do not forget to zero the id and lets us avoid
zero checks before. We use it for all new code, lets clean up the
existing code base.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/845
2019-11-22 01:45:25 +01:00
Florian Müllner
9b7f228f8e src: Stop using g_get_current_time()
It isn't 2k38 safe and has therefore been deprecated. Replace it
with GDateTime or g_get_real_time() as appropriate.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/657
2019-08-09 19:22:18 +00:00
Niels De Graef
28ab1f4af4 Ensure G_PARAM_STATIC_STRINGS for all properties
In `st`, we can do this by using `ST_PARAM_*`. In the other code files,
just use `G_PARAM_STATIC_STRINGS` directly.

This is just a minor convenience to prevent a few unnecessary string
copies.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/646
2019-07-30 13:58:44 +00:00
Robert Mader
1dff32e48a hotplug-sniffer: Add gnu_printf format attribute
Suggested by compiler with `-Wsuggest-attribute=format`

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/441
2019-04-17 21:39:03 +00:00
Florian Müllner
c987d3d2c9 build: Support the meson build system
Meson is on track to replace autotools as the build system of choice,
so support it in addition to autotools. If all goes well, we'll
eventually be able to drop the latter ...

https://bugzilla.gnome.org/show_bug.cgi?id=783229
2017-07-20 00:20:54 +02:00
Florian Müllner
bf0be6ef12 hotplug-sniffer: Port to GTask
GSimpleAsyncResult is deprecated.
2015-10-15 22:59:48 +02:00
Florian Müllner
ede81017ec hotplug-sniffer: Modernize GObject usage 2015-10-15 21:04:07 +02:00
Bastien Nocera
85f811f147 src: Name all the timeouts and idles
https://bugzilla.gnome.org/show_bug.cgi?id=727983
2014-04-10 19:38:04 +02:00
Andika Triwidada
f3dad3765e Changed obsolete FSF postal address.
https://bugzilla.gnome.org/show_bug.cgi?id=721507
2014-01-08 04:35:14 +07:00
Florian Müllner
1735f28f5a Remove use of deprecated g_type_init () ...
... and bump GObject requirement accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=686318
2012-10-17 22:49:32 +02:00
Owen W. Taylor
33d4518e50 hotplug-sniffer: fix double free when setting D-Bus return value
g_dbus_method_invocation_return_value() adopts a floating reference,
so we don't also need to unreference it; fix by replacing the code
using a more compact form using the ^ convenience character in
GVariant type specifications. (Thanks to Ryan Lortie for the
suggestion.)

https://bugzilla.gnome.org/show_bug.cgi?id=667378
2012-01-16 17:38:38 -05:00
Dan Winship
4333bdc709 *.[ch]: add emacs modeline to C files that were missing it
(excluding files that are synced from another module)

https://bugzilla.gnome.org/show_bug.cgi?id=660358
2011-10-11 08:05:17 -04:00
Cosimo Cecchi
0b9c726b4e sniffer: add a mimetype sniffer helper executable
The sniffer is a simple helper process, activated as a DBus service,
that tries to crawl as many files as possible in the provided target
directory (i.e. the new mount's root), for a maximum amount of time -
which is set here to 1.5 seconds (i.e. it will crawl either all the
files in the directory tree, or as many as it can before the specified
timeout expires).

Crawled files are ordered by their content type, and a generic estimation
of the type of files composing the directory is returned to the caller,
using generic 'x-content/*' mimetypes.

The process will then set an autoquit timeout on itself, which can be
disabled by setting the env variable HOTPLUG_SNIFFER_PERSIST for
debugging purposes. The HOTPLUG_SNIFFER_DEBUG env variable can also be
set to enable debugging output.

https://bugzilla.gnome.org/show_bug.cgi?id=653520
2011-07-13 14:39:35 -04:00