[evince] comics: Fix mime-type comparisons



commit 364b340d59a232d600c58e49942172af30e0407d
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Sep 12 17:49:50 2016 +0200

    comics: Fix mime-type comparisons
    
    The comics backend was using string equality to match mime-types. This
    doesn't work when the mime-type has changed, and the old name is now
    simply an alias. Use g_content_type_is_a() instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770903

 backend/comics/comics-document.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index 1d15428..845f517 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -315,8 +315,8 @@ comics_check_decompress_command     (gchar          *mime_type,
        /* FIXME, use proper cbr/cbz mime types once they're
         * included in shared-mime-info */
        
-       if (!strcmp (mime_type, "application/x-cbr") ||
-           !strcmp (mime_type, "application/x-rar")) {
+       if (g_content_type_is_a (mime_type, "application/x-cbr") ||
+           g_content_type_is_a (mime_type, "application/x-rar")) {
                /* The RARLAB provides a no-charge proprietary (freeware) 
                * decompress-only client for Linux called unrar. Another 
                * option is a GPLv2-licensed command-line tool developed by 
@@ -371,8 +371,8 @@ comics_check_decompress_command     (gchar          *mime_type,
                        return TRUE;
                }
 
-       } else if (!strcmp (mime_type, "application/x-cbz") ||
-                  !strcmp (mime_type, "application/zip")) {
+       } else if (g_content_type_is_a (mime_type, "application/x-cbz") ||
+                  g_content_type_is_a (mime_type, "application/zip")) {
                /* InfoZIP's unzip program */
                comics_document->selected_command = 
                                g_find_program_in_path ("unzip");
@@ -403,8 +403,8 @@ comics_check_decompress_command     (gchar          *mime_type,
                        return TRUE;
                }
 
-       } else if (!strcmp (mime_type, "application/x-cb7") ||
-                  !strcmp (mime_type, "application/x-7z-compressed")) {
+       } else if (g_content_type_is_a (mime_type, "application/x-cb7") ||
+                  g_content_type_is_a (mime_type, "application/x-7z-compressed")) {
                /* 7zr, 7za and 7z are the commands from the p7zip project able 
                 * to decompress .7z files */ 
                comics_document->selected_command =
@@ -431,8 +431,8 @@ comics_check_decompress_command     (gchar          *mime_type,
                        comics_document->command_usage = TAR;
                        return TRUE;
                }
-       } else if (!strcmp (mime_type, "application/x-cbt") ||
-                  !strcmp (mime_type, "application/x-tar")) {
+       } else if (g_content_type_is_a (mime_type, "application/x-cbt") ||
+                  g_content_type_is_a (mime_type, "application/x-tar")) {
                /* tar utility (Tape ARchive) */
                comics_document->selected_command =
                                g_find_program_in_path ("tar");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]