From 9991fb1762bd44762c4ee43b2484f30114a307d4 Mon Sep 17 00:00:00 2001 From: Max Eliaser Date: Sun, 30 Dec 2018 14:20:02 -0800 Subject: [libcaja-private] Re-check file MIME type before picking an application. An example of when the MIME type might change: a file is initially created with 0 bytes of content, but more data is added later. Empty files are always detected as plain text, but the file might not be empty anymore when the user opens it. This commit affects the behavior when double-clicking a file and when right- clicking on it too. --- libcaja-private/caja-file.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libcaja-private/caja-file.c') diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index 1a9dd1be..4b35195c 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -2555,6 +2555,24 @@ caja_file_update_info (CajaFile *file, return update_info_internal (file, info, FALSE); } +void +caja_file_refresh_info (CajaFile *file) +{ + GFile *gfile; + GFileInfo *new_info; + + gfile = caja_file_get_location (file); + new_info = g_file_query_info (gfile, CAJA_FILE_DEFAULT_ATTRIBUTES, + G_FILE_QUERY_INFO_NONE, NULL, NULL); + if (new_info != NULL) { + if (caja_file_update_info (file, new_info)) { + caja_file_changed (file); + } + g_object_unref (new_info); + } + g_object_unref (gfile); +} + static gboolean update_name_internal (CajaFile *file, const char *name, -- cgit v1.2.1