Try to get real mime type for bak files
parent
c66f97a3ba
commit
6e325a8e25
2
moo.mprj
2
moo.mprj
|
@ -34,7 +34,7 @@
|
|||
</configure>
|
||||
</optimized>
|
||||
</configurations>
|
||||
<file_selector_dir>/home/muntyan/projects/moo/</file_selector_dir>
|
||||
<file_selector_dir>/home/muntyan/projects/moo/moo/mooedit/</file_selector_dir>
|
||||
<run>
|
||||
<args>--g-fatal-warnings --new-app --mode=project</args>
|
||||
<exe>medit/medit</exe>
|
||||
|
|
|
@ -303,6 +303,22 @@ moo_file_selector_activate (MooFileView *fileview,
|
|||
#ifdef MOO_USE_XDGMIME
|
||||
{
|
||||
const char *mime_type = xdg_mime_get_mime_type_for_file (path, &statbuf);
|
||||
|
||||
if (!strcmp (mime_type, "application/x-trash"))
|
||||
{
|
||||
guint i;
|
||||
const char *bak_suffixes[] = {"~", "%", ".bak", ".old", ".sik"};
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (bak_suffixes); ++i)
|
||||
if (g_str_has_suffix (path, bak_suffixes[i]))
|
||||
{
|
||||
char *tmp = g_strndup (path, strlen (path) - strlen (bak_suffixes[i]));
|
||||
mime_type = xdg_mime_get_mime_type_from_file_name (tmp);
|
||||
g_free (tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
is_text = !strcmp (mime_type, "application/octet-stream") ||
|
||||
xdg_mime_mime_type_subclass (mime_type, "text/plain");
|
||||
is_exe = !strcmp (mime_type, "application/x-executable");
|
||||
|
|
Loading…
Reference in New Issue