Commit 93977e5e authored by Paolo Maggi's avatar Paolo Maggi Committed by Paolo Maggi

new function (it will be removed when gnome-vfs will expose an equivalent

2004-03-05  Paolo Maggi  <paolo.maggi@polito.it>

	* gedit-document.c (get_slow_mime_type): new function (it will
	be removed when gnome-vfs will expose an equivalent public
	function)
	(gedit_document_set_uri): use get_slow_mime_type to get the mime-type,
	fixes bug #135565 (.cgi files no longer highlight)

	* gedit-mdi-child.c (get_slow_mime_type): new function
	(set_tab_icon)(set_tooltip): use get_slow_mime_type to get
	the mime-type

	Probably we should add a gedit_document_get_mime_type function.
parent 1a4eb9e2
2004-03-05 Paolo Maggi <paolo.maggi@polito.it>
* gedit-document.c (get_slow_mime_type): new function (it will
be removed when gnome-vfs will expose an equivalent public
function)
(gedit_document_set_uri): use get_slow_mime_type to get the mime-type,
fixes bug #135565 (.cgi files no longer highlight)
* gedit-mdi-child.c (get_slow_mime_type): new function
(set_tab_icon)(set_tooltip): use get_slow_mime_type to get
the mime-type
Probably we should add a gedit_document_get_mime_type function.
2004-02-25 Paolo Maggi <paolo.maggi@polito.it>
* gedit-commands.c (gedit_cmd_help_about): added Paolo Borelli
......
......@@ -1366,6 +1366,30 @@ gedit_document_is_untouched (const GeditDocument *doc)
(!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)));
}
/* FIXME: Remove this function when gnome-vfs will add an equivalent public
function - Paolo (Mar 05, 2004) */
static gchar *
get_slow_mime_type (const char *text_uri)
{
GnomeVFSFileInfo *info;
char *mime_type;
GnomeVFSResult result;
info = gnome_vfs_file_info_new ();
result = gnome_vfs_get_file_info (text_uri, info,
GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE |
GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
if (info->mime_type == NULL || result != GNOME_VFS_OK) {
mime_type = NULL;
} else {
mime_type = g_strdup (info->mime_type);
}
gnome_vfs_file_info_unref (info);
return mime_type;
}
static void
gedit_document_set_uri (GeditDocument* doc, const gchar* uri)
{
......@@ -1414,7 +1438,7 @@ gedit_document_set_uri (GeditDocument* doc, const gchar* uri)
{
gchar *mime_type;
mime_type = gnome_vfs_get_mime_type (uri);
mime_type = get_slow_mime_type (uri);
if (mime_type != NULL)
{
......
......@@ -648,6 +648,31 @@ create_popup_menu (BonoboMDIChild *child, GtkWidget *view)
}
/* FIXME: Remove this function when gnome-vfs will add an equivalent public
function - Paolo (Mar 05, 2004) */
static gchar *
get_slow_mime_type (const char *text_uri)
{
GnomeVFSFileInfo *info;
char *mime_type;
GnomeVFSResult result;
info = gnome_vfs_file_info_new ();
result = gnome_vfs_get_file_info (text_uri, info,
GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE |
GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
if (info->mime_type == NULL || result != GNOME_VFS_OK) {
mime_type = NULL;
} else {
mime_type = g_strdup (info->mime_type);
}
gnome_vfs_file_info_unref (info);
return mime_type;
}
/* FIXME: implementing theme changed handler */
static GnomeIconTheme *theme = NULL;
......@@ -675,7 +700,7 @@ set_tab_icon (GtkWidget *image, BonoboMDIChild *child)
raw_uri = gedit_document_get_raw_uri (GEDIT_MDI_CHILD (child)->document);
if (raw_uri != NULL)
mime_type = gnome_vfs_get_mime_type (raw_uri);
mime_type = get_slow_mime_type (raw_uri);
if (mime_type == NULL)
mime_type = g_strdup ("text/plain");
......@@ -717,7 +742,7 @@ set_tooltip (GeditTooltips *tooltips, GtkWidget *widget, BonoboMDIChild *child)
raw_uri = gedit_document_get_raw_uri (GEDIT_MDI_CHILD (child)->document);
if (raw_uri != NULL)
mime_type = gnome_vfs_get_mime_type (raw_uri);
mime_type = get_slow_mime_type (raw_uri);
if (mime_type != NULL)
mime_description = gnome_vfs_mime_get_description (mime_type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment