From d2785d62ca9955739a40a61e0e361f0a941e2cd1 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(+) mode change 100644 => 100755 capplets/appearance/theme-installer.c diff --git a/capplets/appearance/theme-installer.c b/capplets/appearance/theme-installer.c old mode 100644 new mode 100755 index e28b9383..ad0a7484 --- 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; } @@ -505,6 +508,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 { @@ -692,6 +697,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); @@ -768,6 +775,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