From 921b6519f1c1394bea02a2a4bde6859fd162f125 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 30 May 2014 23:45:11 -0400 Subject: [PATCH] inspector: better type detection for resources Pass the name to g_content_type_guess. With this, most CSS gets sniffed as C source code. --- gtk/inspector/resource-list.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/inspector/resource-list.c b/gtk/inspector/resource-list.c index d08bfbb345..c3ad3c3ebc 100644 --- a/gtk/inspector/resource-list.c +++ b/gtk/inspector/resource-list.c @@ -86,6 +86,7 @@ selection_changed (GtkTreeSelection *selection, if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { gchar *path; + gchar *name; GBytes *bytes; gchar *type; gconstpointer data; @@ -96,6 +97,7 @@ selection_changed (GtkTreeSelection *selection, gtk_tree_model_get (GTK_TREE_MODEL (rl->priv->model), &iter, COLUMN_PATH, &path, + COLUMN_NAME, &name, -1); if (g_str_has_suffix (path, "/")) @@ -116,7 +118,7 @@ selection_changed (GtkTreeSelection *selection, gchar *text; data = g_bytes_get_data (bytes, &size); - type = g_content_type_guess (NULL, data, size, NULL); + type = g_content_type_guess (name, data, size, NULL); text = g_content_type_get_description (type); gtk_label_set_text (GTK_LABEL (rl->priv->type_label), text); @@ -149,6 +151,7 @@ selection_changed (GtkTreeSelection *selection, } out: g_free (path); + g_free (name); } else {