]> www.fi.muni.cz Git - evince.git/blobdiff - properties/ev-properties-main.c
[dualscreen] fix crash on ctrl+w and fix control window closing
[evince.git] / properties / ev-properties-main.c
index 2e566d5505763b5397f4641f27f95162088434b5..1a7cccd77bcbc52551e365a25eb992ffa6d7e519 100644 (file)
@@ -6,7 +6,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * version 2 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Ev project hereby grant permission for non-gpl compatible GStreamer
  * plugins to be used and distributed together with GStreamer and Ev. This
  *
  */
 
-#include "ev-properties-view.h"
-#include "ev-document-factory.h"
-
 #include <config.h>
+
 #include <string.h>
+
 #include <glib/gi18n-lib.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
+
 #include <libnautilus-extension/nautilus-extension-types.h>
 #include <libnautilus-extension/nautilus-property-page-provider.h>
 
+#include <evince-document.h>
+#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
@@ -83,11 +86,11 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider,
                         GList *files)
 {
        GError *error = NULL;
-       char *mime;
        EvDocument *document;
        GList *pages = NULL;
        NautilusFileInfo *file;
-       char *uri = NULL;
+       gchar *uri = NULL;
+       gchar *mime_type = NULL;
        GtkWidget *page, *label;
        NautilusPropertyPage *property_page;
 
@@ -97,22 +100,21 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider,
        file = files->data;
 
        /* okay, make the page */
-       mime = nautilus_file_info_get_mime_type (file);
-       document = ev_document_factory_get_document (mime);
-       g_free (mime);
-
-       if (document == NULL)
+       uri = nautilus_file_info_get_uri (file);
+       mime_type = nautilus_file_info_get_mime_type (file);
+       
+       document = ev_backends_manager_get_document (mime_type);
+       if (!document)
                goto end;
 
-       uri = nautilus_file_info_get_uri (file);
-       if (!ev_document_load (document, uri, &error)) {
-               if (error) {
-                       g_error_free (error);
-               }
+       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);
@@ -124,6 +126,8 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider,
 
 end:
        g_free (uri);
+       g_free (mime_type);
+       
        return pages;
 }
 
@@ -134,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
@@ -154,4 +157,3 @@ nautilus_module_list_types (const GType **types,
        *types = type_list;
        *num_types = G_N_ELEMENTS (type_list);
 }
-