[gnome-builder] workbench: work around x-mod gvfs content-type for Makefile.am



commit cd24b215c45ac1bc11d1255d4cf5e1e2d3e825d9
Author: Christian Hergert <chergert redhat com>
Date:   Sun Dec 13 18:40:22 2015 -0800

    workbench: work around x-mod gvfs content-type for Makefile.am
    
    Sometimes we have makefiles that are getting reported as x-mod. In
    particular, when the makefile.am starts with "if ENABLE_FOO".

 libide/ide-workbench-open.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-workbench-open.c b/libide/ide-workbench-open.c
index 37c5316..f2cb6fb 100644
--- a/libide/ide-workbench-open.c
+++ b/libide/ide-workbench-open.c
@@ -221,7 +221,22 @@ ide_workbench_open_discover_content_type_cb (GObject      *object,
     }
   else
     {
-      open_uri_state->content_type = g_strdup (g_file_info_get_content_type (file_info));
+      g_autofree gchar *name = NULL;
+      const gchar *content_type;
+
+      name = g_file_get_basename (file);
+      content_type = g_file_info_get_content_type (file_info);
+
+      /*
+       * TODO: Make various overrides a bit more generic.
+       *       It should support globs and such.
+       */
+      if ((g_strcmp0 (name, "Makefile.am") == 0) ||
+          (g_strcmp0 (name, "GNUMakefile.am") == 0))
+        content_type = "text/plain";
+
+      open_uri_state->content_type = g_strdup (content_type);
+
       g_clear_object (&file_info);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]