Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-window.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2005-05-08 18:26:01 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-05-08 18:26:01 (GMT)
commita5e3f1314e7e27fb0e765b3b9b8e1deb92c7c536 (patch)
tree877ee4110e50389f75507166a092d0a9c0049d51 /shell/ev-window.c
parentb9898930ba07edc66523a753de8dd5a4f69703dd (diff)
Change api to lookup from uri. Do fast lookup first, if the type is
2005-05-08 Marco Pesenti Gritti <mpg@redhat.com> * shell/ev-document-types.c: (get_slow_mime_type), (get_document_type_from_mime), (ev_document_type_lookup): * shell/ev-document-types.h: Change api to lookup from uri. Do fast lookup first, if the type is unknown try with data sniffing. * shell/ev-window.c: (ev_window_open), (ev_window_open_uri_list): * thumbnailer/evince-thumbnailer.c: (evince_thumbnail_pngenc_get): Adapt to api change
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r--shell/ev-window.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 58d30a4..2f102bf 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -54,7 +54,6 @@
#include <gtk/gtk.h>
#include <gnome.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomeprintui/gnome-print-dialog.h>
@@ -743,21 +742,15 @@ void
ev_window_open (EvWindow *ev_window, const char *uri)
{
EvDocument *document = NULL;
- char *mime_type;
+ GType document_type;
+ char *mime_type = NULL;
g_free (ev_window->priv->uri);
ev_window->priv->uri = g_strdup (uri);
- mime_type = gnome_vfs_get_mime_type (uri);
-
- if (mime_type == NULL)
- document = NULL;
- else {
- GType document_type = ev_document_type_lookup (mime_type);
-
- if (document_type!=G_TYPE_INVALID) {
- document = g_object_new (document_type, NULL);
- }
+ document_type = ev_document_type_lookup (uri, &mime_type);
+ if (document_type != G_TYPE_INVALID) {
+ document = g_object_new (document_type, NULL);
}
if (document) {
@@ -782,16 +775,15 @@ static void
ev_window_open_uri_list (EvWindow *ev_window, GList *uri_list)
{
GList *list;
- gchar *uri, *mime_type;
+ gchar *uri;
g_return_if_fail (uri_list != NULL);
list = uri_list;
while (list) {
uri = gnome_vfs_uri_to_string (list->data, GNOME_VFS_URI_HIDE_NONE);
- mime_type = gnome_vfs_get_mime_type (uri);
- if (ev_document_type_lookup (mime_type)!=G_TYPE_INVALID) {
+ if (ev_document_type_lookup (uri, NULL) != G_TYPE_INVALID) {
if (ev_window_is_empty (EV_WINDOW (ev_window))) {
ev_window_open (ev_window, uri);
@@ -806,7 +798,6 @@ ev_window_open_uri_list (EvWindow *ev_window, GList *uri_list)
}
}
- g_free (mime_type);
g_free (uri);
list = g_list_next (list);