summaryrefslogtreecommitdiff
path: root/lib/ephy-file-helpers.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert "Ensure directories are created before sandbox is initialized""Michael Catanzaro2019-07-241-0/+1
| | | | This reverts commit dd021bedc6a3dae42e2881a5077720a8fff764b9.
* Mass update: Apply uncrustify style to everythingJan-Michael Brummer2019-07-151-24/+25
|
* Build with -Werror=declaration-after-statementMichael Catanzaro2019-07-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically, Epiphany did not permit declarations after the first statement in a block due to its use of AX_COMPILER_FLAGS, which adds -Werror=declaration-after-statement when compiling C files. But I dropped this in switching to meson, thinking we would adopt a more modern code style. There are two schools of thought here: (1) It's safest and cleanest to limit variable declarations to the smallest-possible scope. I'm a firm believer in this rule and I almost always follow it when writing C++. (2) It just doesn't look very good in C, especially with GNOME code style. I'm starting to become sympathetic to (2). Especially now that we are starting to use autofrees and autoptrs all over the place, I find that declaring these at point of first use causes the code to become rather cluttered. There is not much code in Epiphany that violates the rule because we only recently began to allow it, so not much to clean up. The only code that really does not benefit from this is the profile migrator code, which probably overuses local variables. I'd call that an exception rather than the rule. Let's sneak in -Werror=implicit-function-declaration at the same time, since this is always a serious bug.
* Revert "Ensure directories are created before sandbox is initialized"Michael Catanzaro2019-07-011-1/+0
| | | | This reverts commit 2f51e6b45d17a87dc6293bd1d859505d9bb1411f.
* Ensure directories are created before sandbox is initializedMichael Catanzaro2019-06-301-0/+1
| | | | | Anything that doesn't exist at process launch time will not be mounted in the sandbox.
* Fix setting cache/config dir for custom (non-webapp) profile dirPatrick Griffis2019-01-311-0/+3
|
* Store web extension settings in config dirPatrick Griffis2019-01-311-0/+37
|
* Rename ephy_dot_dir() to ephy_profile_dir()Patrick Griffis2019-01-311-44/+41
| | | | This just more accurately reflects what it actually is.
* Move profile directories to data dirPatrick Griffis2019-01-311-1/+1
| | | | Fixes #182
* Move adblock and safe-browsing data to cache dirPatrick Griffis2019-01-311-2/+45
| | | | | | | | This does reduce file sharing but that is required anyway for the sandbox since web apps don't have read access to the same directories. Fixes #477
* Migrate web app profiles into their own toplevel directoriesPatrick Griffis2019-01-311-5/+2
| | | | | This layout better reflects how the sandbox expects with the top level XDG directories containing prgname matching directories.
* Fix New Window action in incognito modeMichael Catanzaro2019-01-301-1/+1
| | | | | | This broke in f601feb4c0b0e8aabf5885e56fe6423b73f21fff. We have to pass --new-window now to get a new window; otherwise, it creates a new tab. Fixes #657
* Fix ephy_file_browse_to() to ensure it selects the fileMichael Catanzaro2019-01-091-33/+25
| | | | | | | | | | | In cd0e4ef1 I "cleverly" reimplemented ephy_file_browse_to() to remove the need for the MIME type parameter, but it was too clever. The new implementation only opened the parent directory of the file without actually browsing to the file within that directory. I don't want to revert, because I don't want ephy_file_launch_handler() to know about MIME types anymore. Instead, we can share code with ephy_file_open_uri_in_default_browser().
* file-helpers: further simplify application launchingMichael Catanzaro2019-01-081-49/+20
| | | | | Remove some unused parameters, make sure we warn on failure, convert to autoptrs, etc.
* Make it harder to call functions that don't work under flatpakMichael Catanzaro2019-01-081-9/+17
| | | | | | | | | Since calling these functions now results in a crash, let's make it harder to use them by adding EphyFileHelpersNotFlatpakTag, which just forces the caller to pass an ugly enum value EPHY_FILE_HELPERS_I_UNDERSTAND_I_MUST_NOT_USE_THIS_FUNCTION_UNDER_FLATPAK in order to use any of the functions. Ugliness is a feature here, not a bug, to draw scrutiny to any code that might be using these functions.
* file-helpers: Remove unused functionsMichael Catanzaro2019-01-081-189/+0
| | | | A lot of unused stuff in here!
* Simplify and fix opening filesMichael Catanzaro2019-01-081-70/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opening files regressed in 7c8f19af448d42cb498bd729f498f49ebcd554c6. EphyDownload always passes NULL for MIME type, so we skip all the code for launching applications. Oops. Instead of reverting this commit, let's delete all the code! We can simplify file launching in several ways: (1) ephy_embed_shell_launch_handler() is no longer needed at all. It's a a wrapper around ephy_file_launch_handler() that just checks to ensure Epiphany is not launching itself, to avoid recursive launching. This is no longer needed because we no longer open files automatically under any circumstances, so recursive launching is no longer possible (unless the user manually opens the same file again and again for fun or something). Remove this function altogether. EphyDownload can use ephy_file_launch_handler() directly instead. (2) Delete the test for ephy_embed_shell_launch_handler(), since it only tests to ensure we avoid recursive launching, which is, again, no longer a problem. (3) ephy_file_launch_handler() doesn't actually need the MIME type for anything, except for use by ephy_file_browse_to(). So get rid of it from all associated functions. Reimplement ephy_file_browse_to() without it. (The MIME type used to be important for making sure it's safe to automatically open a file, but we never do that anymore.) A mistake regarding the MIME types is what introduced the bug that triggered this investigation, so eliminating it altogether seems worth it, especially when it's only used in the corner case of ephy_file_browse_to(). (4) Make ephy_file_launch_handler() automatically launch via URI handler when running in flatpak. This way, higher-level code no longer needs to decide between using ephy_file_launch_handler() and ephy_file_launch_file_via_uri_handler() based on whether flatpak is in use. (5) ephy_file_launch_file_via_uri_handler() and ephy_file_launch_via_uri_handler() no longer need to be public, and can be compressed into one function. ephy_file_launch_application also no longer needs to be public. (6) Add assertions to ephy_file_browse_to(), ephy_file_launch_desktop_file(), and ephy_file_open_uri_in_default_browser() to ensure they are never called when running in flatpak, since it's impossible to make them work (because the only way to open files in flatpak is via the OpenURI portal, which gives the user, not the application, the choice of which application to open). It's already impossible for any of these functions to be called inside flatpak. (Hopefully! :) I tried to split this up into separate commits, but it got rather complicated, so here it is as an all-in-one. Note this consequently fixes opening downloaded files in flatpak, albeit not in the simplest-possible way.
* Downloads dir should always be ~/Downloads in flatpakMichael Catanzaro2019-01-081-11/+9
| | | | | | | | This was a mistake in 9d54c689. It doesn't make sense for the downloads directory to ever be ~/Desktop under flatpak, because it won't ever be writable. (I'm not sure why it passes on our CI; maybe the tests don't actually run inside the flatpak sandbox?) Better to just skip this test under flatpak.
* Reenable test for ephy-file-helpersJan-Michael Brummer2018-12-291-5/+5
| | | | | | Fix ephy_file_get_downloads_dir () returning the wrong value for Desktop keys and reenable test for ephy-file-helpers. Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/419
* Remove mime-types-permissions.xml handlingJan-Michael Brummer2018-12-191-84/+1
| | | | Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/310
* Enable web app utils tests againCarlos Garcia Campos2018-06-281-5/+10
| | | | | | | | Add a new file helpers flag to indicate it's a private profile for testing. In testing mode, we should never use the user dot dir, so this private profile dir should be considered the default one. https://bugzilla.gnome.org/show_bug.cgi?id=759256
* Fix leaks in ephy_file_get_downloads_dirMichael Catanzaro2018-06-251-5/+10
| | | | | As usual, there are multiple ways to fix this, but here is what I think looks best....
* flatpak: Allow opening downloaded filesMichael Catanzaro2017-11-191-0/+30
|
* flatpak: Ignore download directory gsettingMichael Catanzaro2017-10-041-3/+5
| | | | We always need to download into ~/Downloads
* Purge unnecessary use of g_str_equalMichael Catanzaro2017-09-131-2/+2
| | | | This function is intended for use in hash tables.
* Purge g_return from lib/Michael Catanzaro2017-09-131-8/+8
|
* file-herlpers: Add ephy_dot_dir_is_web_application()Carlos Garcia Campos2017-02-061-9/+36
|
* "New Window" should never open incognito windowMichael Catanzaro2016-10-281-0/+13
| | | | | | There is already a different menu item to get an incognito window. https://bugzilla.gnome.org/show_bug.cgi?id=723185
* ephy-file-helpers: Free GBytes with g_bytes_unref()Iulian Radu2016-10-221-1/+1
| | | | Fixes segfault when trying to open a download file.
* Move mime-types-permissions to gresourceMichael Catanzaro2016-10-171-54/+8
| | | | And get rid of ephy_file()
* Relicense to GPLv3+Michael Catanzaro2016-10-071-5/+7
| | | | | | | | To use GMP. Because a few GPLv3+ files had already snuck in by mistake. And because http://www.gnu.org/licenses/rms-why-gplv3.html
* Standardize modelinesMichael Catanzaro2016-09-111-1/+1
|
* Replace SHARE_DIR with PKGDATADIRMichael Catanzaro2016-08-071-3/+3
|
* UncrustifyMichael Catanzaro2016-03-291-647/+579
| | | | | | | | | | | | | | For a better future. Apologies when your 'git blame' resolves to this. I'm actually really impressed how well uncrustify works. This required only a little one-time manual work to avoid extra space in 'else {'. This breaks function prototype alignment, but we should get rid of most of those anyway. We decided to start aligning function parameters, like other GNOME applications. It looks nicer this way, and I couldn't teach uncrustify the previous Epiphany style.
* Improve some FIXMEsMichael Catanzaro2016-03-111-1/+0
| | | | | | | * Let's not rename downloaded files * g_application_get_application_id is a thing https://bugzilla.gnome.org/show_bug.cgi?id=610586
* file-helpers: convert profile_dir to absolute pathMichael Catanzaro2016-02-291-2/+12
| | | | | | | | | When Epiphany is run with --profile and a relative path to the profile dir, it mostly works fine, with the exception of a bunch of criticals coming from EphyUriTester. Fix it here so the rest of the code doesn't have to worry about relative paths. https://bugzilla.gnome.org/show_bug.cgi?id=762762
* Fix crash starting incognito modeMichael Catanzaro2016-01-151-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=760667
* Enable and placate -Wsign-compareMichael Catanzaro2015-12-261-1/+1
|
* Enable and placate -Wno-shadowMichael Catanzaro2015-12-261-10/+10
|
* build: Fix build with clang -Werror and -Wwrite-stringsTing-Wei Lan2015-12-111-1/+1
| | | | | | String literals are 'const char[]' when -Wwrite-strings is used. https://bugzilla.gnome.org/show_bug.cgi?id=759200
* Remove FSF address from license headersMichael Catanzaro2015-12-071-3/+1
|
* file-helpers: Only write the migration version when creating the dot dirCarlos Garcia Campos2015-11-171-5/+8
| | | | | | ephy_ensure_dir_exists() is supposed to be generic function, not only to ensure dot dir exists. We don't want to create the migration version file every time a new directory is created.
* file-helpers: Add ephy_default_dot_dir()Carlos Garcia Campos2015-11-171-3/+14
| | | | | | It always returns the main default dot dir, no matter what the current profile is. This is needed because some private profiles could need to use the default dot dir, for example, web applications.
* build: Get rid of custom error message for missing mkdtempMichael Catanzaro2015-11-071-4/+0
|
* Get default browser app info using x-scheme-handlerJérémy Lal2015-10-071-2/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=750275
* Use AX_CHECK_ENABLE_DEBUG instead of GNOME_DEBUG_CHECKMichael Catanzaro2015-06-301-1/+1
| | | | | | | | Behavior change: debug mode is now enabled by default for builds from git (but not for tarball builds). Now I don't need to pass --enable-debug in my module_autogenargs in jhbuildrc anymore, yay! https://wiki.gnome.org/Projects/GnomeCommon/Migration
* file-helpers: add helper to launch a incognito windowClaudio Saavedra2015-06-021-0/+24
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=749454
* ephy-file-helpers: fix ephy_file_delete_dir_recursively()Claudio Saavedra2014-12-071-0/+1
| | | | The directory iterator is not advanced.
* file-helpers: Fix ephy_file_delete_dir_recursively when an error is givenCarlos Garcia Campos2014-12-011-45/+47
| | | | | | | | | | | | | The implementation is checking the given error pointer to check if an error ocurred, instead of checking the pointer pointed by the passed in error. This means that it is always failing when an error is passed, but it works in most of the cases when NULL is passed because the return value of functions is checked too. There's still a problem when g_file_enumerator_next_file() returns NULL, because in case of error we are considering it as end of enumeration. We can simplify the implementation and the caller code, by using the stdio API instead of GIO, since we know we are dealing with local files anyway and we are using the synchronous API.
* file-helpers: Add ephy_file_open_uri_in_default_browser()Carlos Garcia Campos2014-10-141-0/+33
| | | | Helper function to open the given uri in the default browser