summaryrefslogtreecommitdiff
path: root/src/fr-init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fr-init.c')
-rw-r--r--src/fr-init.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/src/fr-init.c b/src/fr-init.c
index 7d7b313..c7a876d 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -54,7 +54,6 @@
#include "typedefs.h"
#include "preferences.h"
-
/* The capabilities are computed automatically in
* compute_supported_archive_types() so it's correct to initialize to 0 here. */
FrMimeTypeDescription mime_type_desc[] = {
@@ -110,7 +109,8 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "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 },
- { ZSTD_MIME_TYPE, ".zst", N_("Zstandard compressed file"), 0 },
+ { "application/zstd", ".zst", N_("Zstandard compressed file"), 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 }
@@ -185,11 +185,10 @@ FrExtensionType file_ext_type[] = {
{ ".Z", "application/x-compress" },
{ ".zip", "application/zip" },
{ ".zoo", "application/x-zoo" },
- { ".zst", ZSTD_MIME_TYPE },
+ { ".zst", "application/zstd" },
{ NULL, NULL }
};
-
GList *CommandList;
gint ForceDirectoryCreation;
GHashTable *ProgramsCache;
@@ -199,7 +198,6 @@ int save_type[G_N_ELEMENTS (mime_type_desc)];
int open_type[G_N_ELEMENTS (mime_type_desc)];
int create_type[G_N_ELEMENTS (mime_type_desc)];
-
static void
migrate_options_directory (void)
{
@@ -225,10 +223,8 @@ migrate_options_directory (void)
g_free (old_directory_path);
}
-
/* -- FrRegisteredCommand -- */
-
static FrRegisteredCommand *
fr_registered_command_new (GType command_type)
{
@@ -269,14 +265,12 @@ fr_registered_command_new (GType command_type)
return reg_com;
}
-
G_GNUC_UNUSED static void
fr_registered_command_ref (FrRegisteredCommand *reg_com)
{
reg_com->ref++;
}
-
static void
fr_registered_command_unref (FrRegisteredCommand *reg_com)
{
@@ -288,7 +282,6 @@ fr_registered_command_unref (FrRegisteredCommand *reg_com)
g_free (reg_com);
}
-
static FrCommandCaps
fr_registered_command_get_capabilities (FrRegisteredCommand *reg_com,
const char *mime_type)
@@ -299,14 +292,13 @@ fr_registered_command_get_capabilities (FrRegisteredCommand *reg_com,
FrMimeTypeCap *cap;
cap = g_ptr_array_index (reg_com->caps, i);
- if (strcmp (mime_type, cap->mime_type) == 0)
+ if (is_mime_type (mime_type, cap->mime_type))
return cap->current_capabilities;
}
return FR_COMMAND_CAN_DO_NOTHING;
}
-
static FrCommandCaps
fr_registered_command_get_potential_capabilities (FrRegisteredCommand *reg_com,
const char *mime_type)
@@ -320,14 +312,13 @@ fr_registered_command_get_potential_capabilities (FrRegisteredCommand *reg_com,
FrMimeTypeCap *cap;
cap = g_ptr_array_index (reg_com->caps, i);
- if ((cap->mime_type != NULL) && (strcmp (mime_type, cap->mime_type) == 0))
+ if ((cap->mime_type != NULL) && (is_mime_type (mime_type, cap->mime_type)))
return cap->potential_capabilities;
}
return FR_COMMAND_CAN_DO_NOTHING;
}
-
static void
register_command (GType command_type)
{
@@ -336,7 +327,6 @@ register_command (GType command_type)
g_ptr_array_add (Registered_Commands, fr_registered_command_new (command_type));
}
-
G_GNUC_UNUSED static gboolean
unregister_command (GType command_type)
{
@@ -356,7 +346,6 @@ unregister_command (GType command_type)
return FALSE;
}
-
static void
register_commands (void)
{
@@ -390,7 +379,6 @@ register_commands (void)
#endif
}
-
GType
get_command_type_from_mime_type (const char *mime_type,
FrCommandCaps requested_capabilities)
@@ -415,7 +403,6 @@ get_command_type_from_mime_type (const char *mime_type,
return 0;
}
-
GType
get_preferred_command_for_mime_type (const char *mime_type,
FrCommandCaps requested_capabilities)
@@ -437,7 +424,6 @@ get_preferred_command_for_mime_type (const char *mime_type,
return 0;
}
-
void
update_registered_commands_capabilities (void)
{
@@ -463,7 +449,6 @@ update_registered_commands_capabilities (void)
}
}
-
const char *
get_mime_type_from_extension (const char *ext)
{
@@ -482,7 +467,6 @@ get_mime_type_from_extension (const char *ext)
return NULL;
}
-
const char *
get_archive_filename_extension (const char *filename)
{
@@ -524,12 +508,11 @@ get_mime_type_index (const char *mime_type)
int i;
for (i = 0; mime_type_desc[i].mime_type != NULL; i++)
- if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0)
+ if (is_mime_type (mime_type_desc[i].mime_type, mime_type))
return i;
return -1;
}
-
static void
add_if_non_present (int *a,
int *n,
@@ -545,7 +528,6 @@ add_if_non_present (int *a,
*n = *n + 1;
}
-
static int
cmp_mime_type_by_extension (const void *p1,
const void *p2)
@@ -556,7 +538,6 @@ cmp_mime_type_by_extension (const void *p1,
return strcmp (mime_type_desc[i1].default_ext, mime_type_desc[i2].default_ext);
}
-
static int
cmp_mime_type_by_description (const void *p1,
const void *p2)
@@ -567,7 +548,6 @@ cmp_mime_type_by_description (const void *p1,
return g_utf8_collate (_(mime_type_desc[i1].name), _(mime_type_desc[i2].name));
}
-
static void
sort_mime_types (int *a,
int(*compar)(const void *, const void *))
@@ -579,21 +559,18 @@ sort_mime_types (int *a,
qsort (a, n, sizeof (int), compar);
}
-
void
sort_mime_types_by_extension (int *a)
{
sort_mime_types (a, cmp_mime_type_by_extension);
}
-
void
sort_mime_types_by_description (int *a)
{
sort_mime_types (a, cmp_mime_type_by_description);
}
-
static void
compute_supported_archive_types (void)
{
@@ -637,7 +614,6 @@ compute_supported_archive_types (void)
create_type[c_i] = -1;
}
-
static gboolean initialized = FALSE;
void
@@ -657,7 +633,6 @@ initialize_data (void)
compute_supported_archive_types ();
}
-
static void
command_done (CommandData *cdata)
{
@@ -690,7 +665,6 @@ command_done (CommandData *cdata)
g_free (cdata);
}
-
void
release_data (void)
{