[gtk+] inspector: better type detection for resources
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: better type detection for resources
- Date: Sat, 31 May 2014 03:45:55 +0000 (UTC)
commit 921b6519f1c1394bea02a2a4bde6859fd162f125
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 30 23:45:11 2014 -0400
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 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/inspector/resource-list.c b/gtk/inspector/resource-list.c
index d08bfbb..c3ad3c3 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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]