[Xfce4-commits] [apps/mousepad] 01/01: Fix language guess function (Bug #15141)
noreply at xfce.org
noreply at xfce.org
Sat Feb 23 21:03:22 CET 2019
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/mousepad.
commit 67063863a1620c8bfce367e204f6513eb44cb614
Author: Nikita Zlobin <nick87720z at gmail.com>
Date: Sun Feb 17 11:05:14 2019 +0500
Fix language guess function (Bug #15141)
---
mousepad/mousepad-file.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index 3d12f1b..c3d494b 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -450,23 +450,19 @@ GtkSourceLanguage *
mousepad_file_guess_language (MousepadFile *file)
{
gchar *content_type;
+ gchar *basename;
gboolean result_uncertain;
- GtkSourceLanguage *language = NULL;
+ GtkSourceLanguage *language;
- content_type = g_content_type_guess (file->filename, NULL, 0, &result_uncertain);
- if (result_uncertain)
- {
- g_free (content_type);
- content_type = NULL;
- }
+ g_return_val_if_fail ((file->filename != NULL), NULL);
- if (G_LIKELY (content_type != NULL || file->filename != NULL))
- {
- language = gtk_source_language_manager_guess_language (gtk_source_language_manager_get_default (),
- file->filename,
- content_type);
- }
+ content_type = g_content_type_guess (file->filename, NULL, 0, &result_uncertain);
+ basename = g_path_get_basename (file->filename);
+ language = gtk_source_language_manager_guess_language (gtk_source_language_manager_get_default (),
+ basename,
+ result_uncertain ? NULL : content_type);
+ g_free (basename);
g_free (content_type);
return language;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list