aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-10-08 21:36:32 +0000
committerChristian Grothoff <christian@grothoff.org>2012-10-08 21:36:32 +0000
commit58523b97aa3f479017133bfc77272cf518232806 (patch)
tree172b5f8154efc319503e93e97391d6c29a396361
parent88eecf679befb35f882c6a4437e865ac69d4e320 (diff)
downloadgnunet-gtk-58523b97aa3f479017133bfc77272cf518232806.tar.gz
gnunet-gtk-58523b97aa3f479017133bfc77272cf518232806.zip
-keep gtk-style mime detection on GNU as a backup
-rw-r--r--src/fs/gnunet-fs-gtk_publish-edit-dialog.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
index 9fa89481..786f0fe2 100644
--- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
@@ -1034,7 +1034,7 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
1034 gchar *fn; 1034 gchar *fn;
1035 char *data; 1035 char *data;
1036 gsize data_size; 1036 gsize data_size;
1037 const char *mime; 1037 char *mime;
1038 GFile *f; 1038 GFile *f;
1039 1039
1040 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER 1040 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER
@@ -1050,10 +1050,27 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
1050 else 1050 else
1051 { 1051 {
1052 mime = get_mime_type (data, data_size); 1052 mime = get_mime_type (data, data_size);
1053#if LINUX
1054 if (NULL == mime)
1055 {
1056 /* fall back to Gtk mime-detection; this only works on GNU */
1057 GFileInfo *finfo;
1058 const char *gmime;
1059
1060 finfo = g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
1061 0, NULL, NULL);
1062 gmime = g_file_info_get_attribute_string (finfo,
1063 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
1064 if (NULL != gmime)
1065 mime = GNUNET_strdup (gmime);
1066 g_object_unref (finfo);
1067 }
1068#endif
1053 GNUNET_CONTAINER_meta_data_insert (meta, "<user>", 1069 GNUNET_CONTAINER_meta_data_insert (meta, "<user>",
1054 EXTRACTOR_METATYPE_THUMBNAIL, 1070 EXTRACTOR_METATYPE_THUMBNAIL,
1055 EXTRACTOR_METAFORMAT_BINARY, mime, 1071 EXTRACTOR_METAFORMAT_BINARY, mime,
1056 data, data_size); 1072 data, data_size);
1073 GNUNET_free_non_null (mime);
1057 } 1074 }
1058 g_object_unref (f); 1075 g_object_unref (f);
1059 g_free (fn); 1076 g_free (fn);