Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>2006-01-06 13:23:27 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2006-01-06 13:23:27 (GMT)
commitd2291de1b6c2226d9ac294ace75ad4450d6e5cff (patch)
tree7f64aea11a51aaf49a255e9d8334f9b0f4e9f09a /backend
parentd8d90e4a79195019fc19882729b8fda0be5ba563 (diff)
Don't add pixbuf mime types if pixbuf backend is disabled.
* backend/ev-document-factory.c: (gdk_pixbuf_mime_type_list), (mime_type_supported_by_gdk_pixbuf), (ev_document_factory_get_mime_types), (ev_document_factory_get_all_mime_types): Don't add pixbuf mime types if pixbuf backend is disabled. * shell/ev-application.c: (ev_application_get_uri_window): Fix for the bug 325815 - unhandled MIME type message doesn't appear a second time. * shell/ev-document-types.c: (ev_document_types_add_filters): * shell/ev-window.c: (page_changed_cb), (ev_window_setup_document), (password_dialog_response), (ev_window_popup_password_dialog), (ev_window_load_job_cb), (ev_window_sidebar_position_change_cb), (ev_window_run_fullscreen), (ev_window_stop_fullscreen), (ev_window_run_presentation), (ev_window_stop_presentation), (save_sizing_mode), (ev_window_zoom_changed_cb), (ev_window_continuous_changed_cb), (ev_window_rotation_changed_cb), (ev_window_dual_mode_changed_cb), (ev_window_sidebar_current_page_changed_cb), (ev_window_sidebar_visibility_changed_cb), (ev_window_dispose), (window_state_event_cb), (window_configure_event_cb): Cleanup additional uris holded by EvWindow.
Diffstat (limited to 'backend')
-rw-r--r--backend/ev-document-factory.c53
1 files changed, 38 insertions, 15 deletions
diff --git a/backend/ev-document-factory.c b/backend/ev-document-factory.c
index a695c45..38054ba 100644
--- a/backend/ev-document-factory.c
+++ b/backend/ev-document-factory.c
@@ -85,17 +85,17 @@ const EvDocumentType document_types[] = {
};
#ifdef ENABLE_PIXBUF
-/* Would be nice to have this in gdk-pixbuf */
-static gboolean
-mime_type_supported_by_gdk_pixbuf (const gchar *mime_type)
+
+static GList*
+gdk_pixbuf_mime_type_list ()
{
GSList *formats, *list;
- gboolean retval = FALSE;
+ GList *result;
formats = gdk_pixbuf_get_formats ();
+ result = NULL;
- list = formats;
- while (list) {
+ for (list = formats; list != NULL; list = list->next) {
GdkPixbufFormat *format = list->data;
int i;
gchar **mime_types;
@@ -106,19 +106,32 @@ mime_type_supported_by_gdk_pixbuf (const gchar *mime_type)
mime_types = gdk_pixbuf_format_get_mime_types (format);
for (i = 0; mime_types[i] != NULL; i++) {
- if (strcmp (mime_types[i], mime_type) == 0) {
- retval = TRUE;
- break;
- }
+ result = g_list_append (result, mime_types[i]);
}
+ }
+ g_slist_free (formats);
- if (retval)
- break;
+ return result;
+}
- list = list->next;
+/* Would be nice to have this in gdk-pixbuf */
+static gboolean
+mime_type_supported_by_gdk_pixbuf (const gchar *mime_type)
+{
+ GList *mime_types;
+ GList *list;
+ gboolean retval = FALSE;
+
+ mime_types = gdk_pixbuf_mime_type_list ();
+ for (list = mime_types; list; list = list->next) {
+ if (strcmp ((char *)list->data, mime_type) == 0) {
+ retval = TRUE;
+ break;
+ }
}
-
- g_slist_free (formats);
+
+ g_list_foreach (mime_types, (GFunc)g_free, NULL);
+ g_list_free (mime_types);
return retval;
}
@@ -183,6 +196,12 @@ ev_document_factory_get_mime_types (EvBackend backend)
GList *types = NULL;
int i;
+#ifdef ENABLE_PIXBUF
+ if (backend == EV_BACKEND_PIXBUF) {
+ return gdk_pixbuf_mime_type_list ();
+ }
+#endif
+
for (i = 0; i < G_N_ELEMENTS (document_types); i++) {
if (document_types[i].backend == backend) {
types = g_list_append (types, g_strdup (document_types[i].mime_type));
@@ -201,6 +220,10 @@ ev_document_factory_get_all_mime_types (void)
for (i = 0; i < G_N_ELEMENTS (document_types); i++) {
types = g_list_append (types, g_strdup (document_types[i].mime_type));
}
+
+#ifdef ENABLE_PIXBUF
+ types = g_list_concat (types, gdk_pixbuf_mime_type_list ());
+#endif
return types;
}