From 743677c560547d6b7ebc819e7f13d7ce3742d671 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Wed, 13 Mar 2019 13:19:31 +0100 Subject: [PATCH] info: Remove unused gsd-disk-space-helper.[h|c] GNOME/gnome-control-center!387 ported info panel to use UDisks2 instead of GUnixMounts and thus the helpers from gsd-disk-space-helper.[h|c] are no more needed. --- panels/info/cc-info-default-apps-panel.c | 2 - panels/info/cc-info-overview-panel.c | 2 - panels/info/cc-info-removable-media-panel.c | 2 - panels/info/gsd-disk-space-helper.c | 156 -------------------- panels/info/gsd-disk-space-helper.h | 38 ----- panels/info/meson.build | 29 +--- 6 files changed, 1 insertion(+), 228 deletions(-) delete mode 100644 panels/info/gsd-disk-space-helper.c delete mode 100644 panels/info/gsd-disk-space-helper.h diff --git a/panels/info/cc-info-default-apps-panel.c b/panels/info/cc-info-default-apps-panel.c index 107c4f6ac..414131c80 100644 --- a/panels/info/cc-info-default-apps-panel.c +++ b/panels/info/cc-info-default-apps-panel.c @@ -42,8 +42,6 @@ #include #endif -#include "gsd-disk-space-helper.h" - #include "cc-info-default-apps-panel.h" typedef struct diff --git a/panels/info/cc-info-overview-panel.c b/panels/info/cc-info-overview-panel.c index ff47c1fef..4541986db 100644 --- a/panels/info/cc-info-overview-panel.c +++ b/panels/info/cc-info-overview-panel.c @@ -47,8 +47,6 @@ #include #endif -#include "gsd-disk-space-helper.h" - #include "cc-info-overview-panel.h" diff --git a/panels/info/cc-info-removable-media-panel.c b/panels/info/cc-info-removable-media-panel.c index ea8dc500e..fea667ceb 100644 --- a/panels/info/cc-info-removable-media-panel.c +++ b/panels/info/cc-info-removable-media-panel.c @@ -42,8 +42,6 @@ #include #endif -#include "gsd-disk-space-helper.h" - #include "cc-info-removable-media-panel.h" diff --git a/panels/info/gsd-disk-space-helper.c b/panels/info/gsd-disk-space-helper.c deleted file mode 100644 index fe56a5132..000000000 --- a/panels/info/gsd-disk-space-helper.c +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * vim: set et sw=8 ts=8: - * - * Copyright (c) 2008, Novell, Inc. - * Copyright (c) 2012, Red Hat, Inc. - * - * Authors: Vincent Untz - * Bastien Nocera - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - * - */ - -#include "config.h" - -#include -#include - -#include "gsd-disk-space-helper.h" - -gboolean -gsd_should_ignore_unix_mount (GUnixMountEntry *mount) -{ - const char *fs, *device; - g_autofree char *label = NULL; - guint i; - - /* This is borrowed from GLib and used as a way to determine - * which mounts we should ignore by default. GLib doesn't - * expose this in a way that allows it to be used for this - * purpose - */ - - /* We also ignore network filesystems */ -#if !GLIB_CHECK_VERSION(2, 56, 0) - const gchar *ignore_fs[] = { - "adfs", - "afs", - "auto", - "autofs", - "autofs4", - "cgroup", - "configfs", - "cxfs", - "debugfs", - "devfs", - "devpts", - "devtmpfs", - "ecryptfs", - "fdescfs", - "fusectl", - "gfs", - "gfs2", - "gpfs", - "hugetlbfs", - "kernfs", - "linprocfs", - "linsysfs", - "lustre", - "lustre_lite", - "mfs", - "mqueue", - "ncpfs", - "nfsd", - "nullfs", - "ocfs2", - "overlay", - "proc", - "procfs", - "pstore", - "ptyfs", - "rootfs", - "rpc_pipefs", - "securityfs", - "selinuxfs", - "sysfs", - "tmpfs", - "usbfs", - "zfs", - NULL - }; -#endif /* GLIB < 2.56.0 */ - const gchar *ignore_network_fs[] = { - "cifs", - "nfs", - "nfs4", - "smbfs", - NULL - }; - const gchar *ignore_devices[] = { - "none", - "sunrpc", - "devpts", - "nfsd", - "/dev/loop", - "/dev/vn", - NULL - }; - const gchar *ignore_labels[] = { - "RETRODE", - NULL - }; - - fs = g_unix_mount_get_fs_type (mount); -#if GLIB_CHECK_VERSION(2, 56, 0) - if (g_unix_is_system_fs_type (fs)) - return TRUE; -#else - for (i = 0; ignore_fs[i] != NULL; i++) - if (g_str_equal (ignore_fs[i], fs)) - return TRUE; -#endif - for (i = 0; ignore_network_fs[i] != NULL; i++) - if (g_str_equal (ignore_network_fs[i], fs)) - return TRUE; - - device = g_unix_mount_get_device_path (mount); - for (i = 0; ignore_devices[i] != NULL; i++) - if (g_str_equal (ignore_devices[i], device)) - return TRUE; - - label = g_unix_mount_guess_name (mount); - for (i = 0; ignore_labels[i] != NULL; i++) - if (g_str_equal (ignore_labels[i], label)) - return TRUE; - - return FALSE; -} - -gboolean -gsd_is_removable_mount (GUnixMountEntry *mount) -{ - const char *mount_path; - g_autofree gchar *path = NULL; - - mount_path = g_unix_mount_get_mount_path (mount); - if (mount_path == NULL) - return FALSE; - - path = g_strdup_printf ("/run/media/%s", g_get_user_name ()); - if (g_str_has_prefix (mount_path, path)) - return TRUE; - - return FALSE; -} diff --git a/panels/info/gsd-disk-space-helper.h b/panels/info/gsd-disk-space-helper.h deleted file mode 100644 index 3898359d5..000000000 --- a/panels/info/gsd-disk-space-helper.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * vim: set et sw=8 ts=8: - * - * Copyright (c) 2008, Novell, Inc. - * Copyright (c) 2012, Red Hat, Inc. - * - * Authors: Vincent Untz - * Bastien Nocera - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - * - */ - -#ifndef __GSD_DISK_SPACE_HELPER_H -#define __GSD_DISK_SPACE_HELPER_H - -#include -#include - -G_BEGIN_DECLS - -gboolean gsd_should_ignore_unix_mount (GUnixMountEntry *mount); -gboolean gsd_is_removable_mount (GUnixMountEntry *mount); - -G_END_DECLS - -#endif /* __GSD_DISK_SPACE_HELPER_H */ diff --git a/panels/info/meson.build b/panels/info/meson.build index c54e5fdaf..911abbe9f 100644 --- a/panels/info/meson.build +++ b/panels/info/meson.build @@ -33,11 +33,7 @@ cflags += [ '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir) ] -gsd_headers = ['gsd-disk-space-helper.h'] - -gsd_sources = ['gsd-disk-space-helper.c'] - -sources = files(gsd_sources) + files( +sources = files( 'cc-info-default-apps-panel.c', 'cc-info-overview-panel.c', 'cc-info-removable-media-panel.c', @@ -73,26 +69,3 @@ info_panel_lib = static_library( c_args: cflags ) panels_libs += info_panel_lib - -# FIXME: workaround for updating different sources code -input_dir = join_paths(meson.source_root(), '..', 'gnome-settings-daemon', 'plugins', 'housekeeping') - -script_conf = configuration_data() -script_conf.set('program', update_from_gsd.path()) -script_conf.set('input_dir', input_dir) -script_conf.set('working_dir', meson.current_source_dir()) -script_conf.set('source_files', ' '.join(gsd_sources + gsd_headers)) -script_conf.set('source_message', 'info: Update from gnome-settings-daemon') - -script_name = 'update-info-from-gsd' - -script = configure_file( - input: update_from_gsd_in, - output: script_name + '.sh', - configuration: script_conf -) - -run_target( - script_name, - command: script -)