From bf899da943f62eba3b78b998334eba1c52874b7b Mon Sep 17 00:00:00 2001 From: Zhang Xianwei Date: Mon, 15 Jan 2018 18:15:11 +0800 Subject: Support the theme compression package for installing XZ format This closes #320. Signed-off-by: Zhang Xianwei --- capplets/appearance/theme-installer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/capplets/appearance/theme-installer.c b/capplets/appearance/theme-installer.c index 2ffb1158..dcb899ac 100644 --- a/capplets/appearance/theme-installer.c +++ b/capplets/appearance/theme-installer.c @@ -48,6 +48,7 @@ enum { enum { TARGZ, TARBZ, + TARXZ, DIRECTORY }; @@ -258,6 +259,8 @@ process_local_theme_archive (GtkWindow *parent, return process_local_theme_tgz_tbz (parent, "gzip", tmp_dir, archive); else if (filetype == TARBZ) return process_local_theme_tgz_tbz (parent, "bzip2", tmp_dir, archive); + else if (filetype == TARXZ) + return process_local_theme_tgz_tbz (parent, "xz", tmp_dir, archive); else return FALSE; } @@ -509,6 +512,8 @@ process_local_theme (GtkWindow *parent, filetype = TARGZ; } else if (g_str_has_suffix (path, ".tar.bz2")) { filetype = TARBZ; + } else if (g_str_has_suffix (path, ".tar.xz")) { + filetype = TARXZ; } else if (g_file_test (path, G_FILE_TEST_IS_DIR)) { filetype = DIRECTORY; } else { @@ -696,6 +701,8 @@ mate_theme_install (GFile *file, template = "mate-theme-%d.gtp"; else if (g_str_has_suffix (base, ".tar.bz2")) template = "mate-theme-%d.tar.bz2"; + else if (g_str_has_suffix (base, ".tar.xz")) + template = "mate-theme-%d.tar.xz"; else { invalid_theme_dialog (parent, base, FALSE); g_free (base); @@ -772,6 +779,7 @@ mate_theme_installer_run (GtkWindow *parent, filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Theme Packages")); gtk_file_filter_add_mime_type (filter, "application/x-bzip-compressed-tar"); + gtk_file_filter_add_mime_type (filter, "application/x-xz-compressed-tar"); gtk_file_filter_add_mime_type (filter, "application/x-compressed-tar"); gtk_file_filter_add_mime_type (filter, "application/x-mate-theme-package"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); -- cgit v1.2.1