[Xfce4-commits] [apps/mousepad] 01/01: Only set template filetype when detected (Bug #15314)

noreply at xfce.org noreply at xfce.org
Wed Apr 24 03:36:29 CEST 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 4e814555204a985f2239d946d3b6b49b257aef5b
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date:   Tue Apr 23 20:17:27 2019 +0200

    Only set template filetype when detected (Bug #15314)
---
 mousepad/mousepad-file.c   | 7 +++++--
 mousepad/mousepad-window.c | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index c70fdfb..980d5ce 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -682,8 +682,11 @@ mousepad_file_open (MousepadFile  *file,
       g_mapped_file_free (mapped_file);
 #endif
 
-      /* guess and set the file's filetype/language */
-      mousepad_file_set_language (file, mousepad_file_guess_language (file));
+      if (G_LIKELY (filename != template_filename))
+        {
+          /* guess and set the file's filetype/language */
+          mousepad_file_set_language (file, mousepad_file_guess_language (file));
+        }
 
       /* this does not count as a modified buffer */
       gtk_text_buffer_set_modified (file->buffer, FALSE);
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index ab84f4d..f83a187 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2360,7 +2360,8 @@ mousepad_window_menu_templates_fill (MousepadWindow *window,
       item = gtk_image_menu_item_new_with_label (label);
       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
       mousepad_object_set_data_full (G_OBJECT (item), "filename", li->data, g_free);
-      mousepad_object_set_data_full (G_OBJECT (item), "language", g_object_ref (language), g_object_unref);
+      if (language != NULL)
+        mousepad_object_set_data_full (G_OBJECT (item), "language", g_object_ref (language), g_object_unref);
       g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (mousepad_window_action_new_from_template), window);
       gtk_widget_show (item);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list