diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/eggfileformatchooser.c | 23 | ||||
-rw-r--r-- | src/fr-init.c | 108 |
2 files changed, 60 insertions, 71 deletions
diff --git a/src/eggfileformatchooser.c b/src/eggfileformatchooser.c index f4d5a4e..9161ea4 100644 --- a/src/eggfileformatchooser.c +++ b/src/eggfileformatchooser.c @@ -162,9 +162,9 @@ egg_file_format_filter_add_extensions (GtkFileFilter *filter, { EggFileFormatFilterInfo *info; GString *filter_name; - const gchar *extptr; + gchar **strings; + gchar **ptr; gchar *pattern; - gsize length; g_assert (NULL != extensions); @@ -182,31 +182,22 @@ egg_file_format_filter_add_extensions (GtkFileFilter *filter, else filter_name = NULL; - extptr = extensions; - while (*extptr) + strings = g_strsplit (extensions, ", ", -1); + for (ptr = strings; *ptr; ptr++) { - length = strcspn (extptr, ","); - pattern = g_new (gchar, length + 3); - - memcpy (pattern, "*.", 2); - memcpy (pattern + 2, extptr, length); - pattern[length + 2] = '\0'; + pattern = g_strdup_printf ("*%s", *ptr); if (filter_name) { - if (extptr != extensions) + if (ptr != strings) g_string_append (filter_name, ", "); g_string_append (filter_name, pattern); } - extptr += length; - - if (*extptr) - extptr += 2; - g_hash_table_replace (info->extension_set, pattern, pattern); } + g_strfreev (strings); if (filter_name) { diff --git a/src/fr-init.c b/src/fr-init.c index d4c4885..5f4f3a8 100644 --- a/src/fr-init.c +++ b/src/fr-init.c @@ -58,61 +58,59 @@ /* The capabilities are computed automatically in * compute_supported_archive_types() so it's correct to initialize to 0 here. */ FrMimeTypeDescription mime_type_desc[] = { - { "application/vnd.debian.binary-package", ".deb", N_("Debian package (.deb)"), 0 }, - { "application/vnd.debian.binary-package", ".udeb", N_("Debian package (.udeb)"), 0 }, - { "application/vnd.ms-cab-compressed", ".cab", N_("Cabinet (.cab)"), 0 }, - { "application/vnd.oasis.opendocument.presentation", ".odp", N_("OpenDocument Presentation (.odp)"), 0 }, - { "application/vnd.oasis.opendocument.spreadsheet", ".ods", N_("OpenDocument Spreadsheet (.ods)"), 0 }, - { "application/vnd.oasis.opendocument.text", ".odt", N_("OpenDocument Text (.odt)"), 0 }, - { "application/vnd.oasis.opendocument.presentation-template", ".otp", N_("OpenDocument Presentation Template (.otp)"), 0 }, - { "application/vnd.oasis.opendocument.spreadsheet-template", ".ots", N_("OpenDocument Spreadsheet Template (.ots)"), 0 }, - { "application/vnd.oasis.opendocument.text-template", ".ott", N_("OpenDocument Text Template (.ott)"), 0 }, - { "application/x-7z-compressed", ".7z", N_("7-Zip (.7z)"), 0 }, - { "application/x-7z-compressed-tar", ".tar.7z", N_("Tar compressed with 7z (.tar.7z)"), 0 }, - { "application/x-ace", ".ace", N_("Ace (.ace)"), 0 }, - { "application/x-alz", ".alz", N_("ALZip archive (.alz)"), 0 }, - { "application/x-archive", ".a", N_("Ar (.a)"), 0 }, - { "application/x-archive", ".ar", N_("Ar (.ar)"), 0 }, - { "application/x-arj", ".arj", N_("Arj (.arj)"), 0 }, - { "application/x-brotli", ".br", N_("brotli (.br)"), 0 }, - { "application/x-brotli-compressed-tar", ".tar.br", N_("Tar compressed with brotli (.tar.br)"), 0 }, - { "application/x-bzip", ".bz2", N_("Bzip2 compressed file (.bz2)"), 0 }, - { "application/x-bzip-compressed-tar", ".tar.bz2", N_("Tar compressed with bzip2 (.tar.bz2)"), 0 }, - { "application/x-bzip1", ".bz", N_("Bzip compressed file (.bz)"), 0 }, - { "application/x-bzip1-compressed-tar", ".tar.bz", N_("Tar compressed with bzip (.tar.bz)"), 0 }, - { "application/x-cbr", ".cbr", N_("Rar Archived Comic Book (.cbr)"), 0 }, - { "application/x-cbz", ".cbz", N_("Zip Archived Comic Book (.cbz)"), 0 }, - { "application/x-cd-image", ".iso", N_("Disc Image File (.iso)"), 0 }, - { "application/x-compress", ".Z", N_("Unix Compressed Archive file (.Z)"), 0 }, - { "application/x-compressed-tar", ".tar.gz", N_("Tar compressed with gzip (.tar.gz)"), 0 }, - { "application/x-cpio", ".cpio", N_("Unix CPIO Archive (.cpio)"), 0 }, - { "application/x-ear", ".ear", N_("Ear (.ear)"), 0 }, - { "application/x-gzip", ".gz", N_("GZip compressed file (.gz)"), 0 }, - { "application/x-java-archive", ".jar", N_("Jar (.jar)"), 0 }, - { "application/x-lzh-compressed", ".lzh", N_("Lha (.lzh)"), 0 }, - { "application/x-lrzip", ".lrz", N_("Lrzip (.lrz)"), 0}, - { "application/x-lrzip-compressed-tar", ".tar.lrz", N_("Tar compressed with lrzip (.tar.lrz)"), 0 }, - { "application/x-lzip", ".lz", N_("LZip compressed file (.lz)"), 0 }, - { "application/x-lzip-compressed-tar", ".tar.lz", N_("Tar compressed with lzip (.tar.lz)"), 0 }, - { "application/x-lzma", ".lzma", N_("LZMA compressed file (.lzma)"), 0 }, - { "application/x-lzma-compressed-tar", ".tar.lzma", N_("Tar compressed with lzma (.tar.lzma)"), 0 }, - { "application/x-lzop", ".lzo", N_("LZO compressed file (.lzo)"), 0 }, - { "application/x-lzop-compressed-tar", ".tar.lzo", N_("Tar compressed with lzop (.tar.lzo)"), 0 }, - { "application/x-ms-dos-executable", ".exe", N_("Self-extracting zip (.exe)"), 0 }, - { "application/x-ms-wim", ".wim", N_("Windows Imaging Format (.wim)"), 0 }, - { "application/x-rar", ".rar", N_("Rar (.rar)"), 0 }, - { "application/x-rpm", ".rpm", N_("Red Hat Package Manager file (.rpm)"), 0 }, - { "application/x-rzip", ".rz", N_("RZip compressed file (.rz)"), 0 }, - { "application/x-stuffit", ".sit", N_("StuffIt Archive (.sit)"), 0 }, - { "application/x-tar", ".tar", N_("Tar uncompressed (.tar)"), 0 }, - { "application/x-tarz", ".tar.Z", N_("Tar compressed with compress (.tar.Z)"), 0 }, - { "application/x-war", ".war", N_("War (.war)"), 0 }, - { "application/x-xz", ".xz", N_("Xz (.xz)"), 0 }, - { "application/x-xz-compressed-tar", ".tar.xz", N_("Tar compressed with xz (.tar.xz)"), 0 }, - { "application/x-zoo", ".zoo", N_("Zoo (.zoo)"), 0 }, - { "application/x-zstd", ".zst", N_("Zstandard (.zst)"), 0 }, - { "application/x-zstd-compressed-tar", ".tar.zst", N_("Tar compressed with zstd (.tar.zst)"), 0 }, - { "application/zip", ".zip", N_("Zip (.zip)"), 0 }, + { "application/vnd.debian.binary-package", ".deb", N_("Debian package"), 0 }, + { "application/vnd.ms-cab-compressed", ".cab", N_("Cabinet"), 0 }, + { "application/vnd.oasis.opendocument.presentation", ".odp", N_("OpenDocument Presentation"), 0 }, + { "application/vnd.oasis.opendocument.spreadsheet", ".ods", N_("OpenDocument Spreadsheet"), 0 }, + { "application/vnd.oasis.opendocument.text", ".odt", N_("OpenDocument Text"), 0 }, + { "application/vnd.oasis.opendocument.presentation-template", ".otp", N_("OpenDocument Presentation Template"), 0 }, + { "application/vnd.oasis.opendocument.spreadsheet-template", ".ots", N_("OpenDocument Spreadsheet Template"), 0 }, + { "application/vnd.oasis.opendocument.text-template", ".ott", N_("OpenDocument Text Template"), 0 }, + { "application/x-7z-compressed", ".7z", N_("7-Zip"), 0 }, + { "application/x-7z-compressed-tar", ".tar.7z", N_("Tar compressed with 7z"), 0 }, + { "application/x-ace", ".ace", N_("Ace"), 0 }, + { "application/x-alz", ".alz", N_("ALZip archive"), 0 }, + { "application/x-archive", ".ar", N_("Ar"), 0 }, + { "application/x-arj", ".arj", N_("Arj"), 0 }, + { "application/x-brotli", ".br", N_("Brotli compressed file"), 0 }, + { "application/x-brotli-compressed-tar", ".tar.br", N_("Tar compressed with brotli"), 0 }, + { "application/x-bzip", ".bz2", N_("Bzip2 compressed file"), 0 }, + { "application/x-bzip-compressed-tar", ".tar.bz2", N_("Tar compressed with bzip2"), 0 }, + { "application/x-bzip1", ".bz", N_("Bzip compressed file"), 0 }, + { "application/x-bzip1-compressed-tar", ".tar.bz", N_("Tar compressed with bzip"), 0 }, + { "application/x-cbr", ".cbr", N_("Rar Archived Comic Book"), 0 }, + { "application/x-cbz", ".cbz", N_("Zip Archived Comic Book"), 0 }, + { "application/x-cd-image", ".iso", N_("Disc Image File"), 0 }, + { "application/x-compress", ".Z", N_("Unix Compressed Archive file"), 0 }, + { "application/x-compressed-tar", ".tar.gz", N_("Tar compressed with gzip"), 0 }, + { "application/x-cpio", ".cpio", N_("Unix CPIO Archive"), 0 }, + { "application/x-ear", ".ear", N_("Ear"), 0 }, + { "application/x-gzip", ".gz", N_("GZip compressed file"), 0 }, + { "application/x-java-archive", ".jar", N_("Jar"), 0 }, + { "application/x-lzh-compressed", ".lzh", N_("Lha"), 0 }, + { "application/x-lrzip", ".lrz", N_("Lrzip "), 0}, + { "application/x-lrzip-compressed-tar", ".tar.lrz", N_("Tar compressed with lrzip"), 0 }, + { "application/x-lzip", ".lz", N_("LZip compressed file"), 0 }, + { "application/x-lzip-compressed-tar", ".tar.lz", N_("Tar compressed with lzip"), 0 }, + { "application/x-lzma", ".lzma", N_("LZMA compressed file"), 0 }, + { "application/x-lzma-compressed-tar", ".tar.lzma", N_("Tar compressed with lzma"), 0 }, + { "application/x-lzop", ".lzo", N_("LZO compressed file"), 0 }, + { "application/x-lzop-compressed-tar", ".tar.lzo", N_("Tar compressed with lzop"), 0 }, + { "application/x-ms-dos-executable", ".exe", N_("Self-extracting zip"), 0 }, + { "application/x-ms-wim", ".wim", N_("Windows Imaging Format"), 0 }, + { "application/x-rar", ".rar", N_("Rar"), 0 }, + { "application/x-rpm", ".rpm", N_("Red Hat Package Manager file"), 0 }, + { "application/x-rzip", ".rz", N_("RZip compressed file"), 0 }, + { "application/x-stuffit", ".sit", N_("StuffIt Archive"), 0 }, + { "application/x-tar", ".tar", N_("Tar uncompressed"), 0 }, + { "application/x-tarz", ".tar.Z", N_("Tar compressed with compress"), 0 }, + { "application/x-war", ".war", N_("War"), 0 }, + { "application/x-xz", ".xz", N_("Xz compressed file"), 0 }, + { "application/x-xz-compressed-tar", ".tar.xz", N_("Tar compressed with xz"), 0 }, + { "application/x-zoo", ".zoo", N_("Zoo"), 0 }, + { "application/x-zstd", ".zst", N_("Zstandard compressed file"), 0 }, + { "application/x-zstd-compressed-tar", ".tar.zst", N_("Tar compressed with zstd"), 0 }, + { "application/zip", ".zip", N_("Zip"), 0 }, { NULL, NULL, NULL, 0 } }; |