2 * Copyright (C) 2000, 2001 Eazel Inc.
3 * Copyright (C) 2003 Andrew Sobala <aes@gnome.org>
4 * Copyright (C) 2005 Bastien Nocera <hadess@hadess.net>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Ev project hereby grant permission for non-gpl compatible GStreamer
21 * plugins to be used and distributed together with GStreamer and Ev. This
22 * permission are above and beyond the permissions granted by the GPL license
25 * Monday 7th February 2005: Christian Schaller: Add excemption clause.
26 * See license_change file for details.
34 #include <glib/gi18n-lib.h>
37 #include <libnautilus-extension/nautilus-extension-types.h>
38 #include <libnautilus-extension/nautilus-property-page-provider.h>
40 #include <evince-document.h>
41 #include "ev-properties-view.h"
43 static GType epp_type = 0;
44 static void property_page_provider_iface_init
45 (NautilusPropertyPageProviderIface *iface);
46 static GList *ev_properties_get_pages
47 (NautilusPropertyPageProvider *provider, GList *files);
50 ev_properties_plugin_register_type (GTypeModule *module)
52 const GTypeInfo info = {
53 sizeof (GObjectClass),
55 (GBaseFinalizeFunc) NULL,
56 (GClassInitFunc) NULL,
61 (GInstanceInitFunc) NULL
63 const GInterfaceInfo property_page_provider_iface_info = {
64 (GInterfaceInitFunc)property_page_provider_iface_init,
69 epp_type = g_type_module_register_type (module, G_TYPE_OBJECT,
72 g_type_module_add_interface (module,
74 NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
75 &property_page_provider_iface_info);
79 property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface)
81 iface->get_pages = ev_properties_get_pages;
85 ev_properties_get_pages (NautilusPropertyPageProvider *provider,
91 NautilusFileInfo *file;
93 gchar *mime_type = NULL;
94 GtkWidget *page, *label;
95 NautilusPropertyPage *property_page;
97 /* only add properties page if a single file is selected */
98 if (files == NULL || files->next != NULL)
102 /* okay, make the page */
103 uri = nautilus_file_info_get_uri (file);
104 mime_type = nautilus_file_info_get_mime_type (file);
106 document = ev_backends_manager_get_document (mime_type);
110 ev_document_load (document, uri, &error);
112 g_error_free (error);
116 label = gtk_label_new (_("Document"));
117 page = ev_properties_view_new (uri);
118 ev_properties_view_set_info (EV_PROPERTIES_VIEW (page),
119 ev_document_get_info (document));
120 gtk_widget_show (page);
121 property_page = nautilus_property_page_new ("document-properties",
123 g_object_unref (document);
125 pages = g_list_prepend (pages, property_page);
134 /* --- extension interface --- */
136 nautilus_module_initialize (GTypeModule *module)
138 ev_properties_plugin_register_type (module);
139 ev_properties_view_register_type (module);
145 nautilus_module_shutdown (void)
151 nautilus_module_list_types (const GType **types,
154 static GType type_list[1];
156 type_list[0] = epp_type;
158 *num_types = G_N_ELEMENTS (type_list);