X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=properties%2Fev-properties-main.c;h=e0631f9765307fc9ea7dc84c0393f1875e00005a;hb=3d3c4a5a08f1b8b536542735110c1376fb3e30bf;hp=87f4a59012927a8b2965bf6c443e138ba06b81fb;hpb=8f535d303b8985db357abc54cb4d3fe1ff7e84bd;p=evince.git diff --git a/properties/ev-properties-main.c b/properties/ev-properties-main.c index 87f4a590..e0631f97 100644 --- a/properties/ev-properties-main.c +++ b/properties/ev-properties-main.c @@ -27,16 +27,19 @@ * */ -#include "ev-properties-view.h" -#include "pdf-document.h" - #include + #include + #include -#include +#include + #include #include +#include +#include "ev-properties-view.h" + static GType epp_type = 0; static void property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface); @@ -46,7 +49,7 @@ static GList *ev_properties_get_pages static void ev_properties_plugin_register_type (GTypeModule *module) { - static const GTypeInfo info = { + const GTypeInfo info = { sizeof (GObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, @@ -57,7 +60,7 @@ ev_properties_plugin_register_type (GTypeModule *module) 0, (GInstanceInitFunc) NULL }; - static const GInterfaceInfo property_page_provider_iface_info = { + const GInterfaceInfo property_page_provider_iface_info = { (GInterfaceInitFunc)property_page_provider_iface_init, NULL, NULL @@ -82,11 +85,12 @@ static GList * ev_properties_get_pages (NautilusPropertyPageProvider *provider, GList *files) { - GError *error; + GError *error = NULL; EvDocument *document; GList *pages = NULL; NautilusFileInfo *file; - char *uri = NULL; + gchar *uri = NULL; + gchar *mime_type = NULL; GtkWidget *page, *label; NautilusPropertyPage *property_page; @@ -95,19 +99,22 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider, goto end; file = files->data; - if (!nautilus_file_info_is_mime_type (file, "application/pdf")) { - goto end; - } - /* okay, make the page */ - document = EV_DOCUMENT (pdf_document_new ()); uri = nautilus_file_info_get_uri (file); - if (!ev_document_load (document, uri, &error)) { + mime_type = nautilus_file_info_get_mime_type (file); + + document = ev_backends_manager_get_document (mime_type); + if (!document) + goto end; + + ev_document_load (document, uri, &error); + if (error) { g_error_free (error); goto end; } + label = gtk_label_new (_("Document")); - page = ev_properties_view_new (); + page = ev_properties_view_new (uri); ev_properties_view_set_info (EV_PROPERTIES_VIEW (page), ev_document_get_info (document)); gtk_widget_show (page); @@ -119,6 +126,8 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider, end: g_free (uri); + g_free (mime_type); + return pages; } @@ -129,14 +138,13 @@ nautilus_module_initialize (GTypeModule *module) ev_properties_plugin_register_type (module); ev_properties_view_register_type (module); - /* set up translation catalog */ - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + ev_init (); } void nautilus_module_shutdown (void) { + ev_shutdown (); } void @@ -149,4 +157,3 @@ nautilus_module_list_types (const GType **types, *types = type_list; *num_types = G_N_ELEMENTS (type_list); } -