1
0
forked from brl/citadel

Remove unneeded panels from gnome-control-center

This commit is contained in:
David McKinney 2019-05-07 09:35:25 -04:00 committed by Bruce Leidl
parent 6ac40da990
commit 0c40635fc3
3 changed files with 573 additions and 1 deletions

View File

@ -0,0 +1,323 @@
From e0460ca5f7d65d17729e9eedffe3f0506e6ba3a3 Mon Sep 17 00:00:00 2001
From: Bruce Leidl <bruce@subgraph.com>
Date: Fri, 5 Apr 2019 07:36:45 -0400
Subject: [PATCH] Make GOA, CUPS, and User Accounts optional
---
meson.build | 13 +++++++++++++
meson_options.txt | 7 ++++++-
panels/background/bg-pictures-source.c | 20 ++++++++++++++++++++
panels/background/meson.build | 15 +++++++++++----
panels/meson.build | 15 ++++++++++++---
shell/cc-panel-loader.c | 6 ++++++
tests/meson.build | 2 +-
7 files changed, 69 insertions(+), 9 deletions(-)
diff --git a/meson.build b/meson.build
index e89ea52..d7926c9 100644
--- a/meson.build
+++ b/meson.build
@@ -112,6 +112,13 @@ if not libhandy_dep.found()
libhandy_dep = libhandy.get_variable('libhandy_dep')
endif
+enable_goa = get_option('online_accounts')
+enable_cups = get_option('cups')
+enable_user_accounts = get_option('user_accounts')
+config_h.set('WITH_GOA', enable_goa, description: 'Define to enable support for Gnome Online Accounts')
+config_h.set('WITH_CUPS', enable_goa, description: 'Define to enable support for CUPS')
+config_h.set('WITH_USER_ACCOUNTS', enable_user_accounts, description: 'Define to enable user accounts panel')
+
goa_req_version = '>= 3.25.3'
pulse_req_version = '>= 2.0'
@@ -122,7 +129,9 @@ gio_dep = dependency('gio-2.0')
glib_dep = dependency('glib-2.0', version: '>= 2.53.0')
gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.27.90')
gnome_settings_dep = dependency('gnome-settings-daemon', version: '>= 3.25.90')
+if enable_goa
goa_dep = dependency('goa-1.0', version: goa_req_version)
+endif
gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.31.0')
libxml_dep = dependency('libxml-2.0')
polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.103')
@@ -144,6 +153,8 @@ common_deps = [
dependency('gtk+-3.0', version: '>= 3.22.20')
]
+if enable_cups
+
# Check for CUPS 1.4 or newer
cups_dep = dependency('cups', version : '>= 1.4', required: false)
assert(cups_dep.found(), 'CUPS 1.4 or newer not found')
@@ -164,6 +175,8 @@ foreach header: check_headers
assert(cc.has_header(header[1], args: cups_cflags), 'CUPS headers not found: ' + header[1])
endforeach
+endif
+
# Optional dependency for the user accounts panel
enable_cheese = get_option('cheese')
if enable_cheese
diff --git a/meson_options.txt b/meson_options.txt
index a347168..e0c3b23 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,4 +3,9 @@ option('documentation', type: 'boolean', value: false, description: 'build docum
option('gnome_session_libexecdir', type: 'string', value: '', description: 'Directory for gnome-session\'s libexecdir')
option('ibus', type: 'boolean', value: true, description: 'build with IBus support')
option('tracing', type: 'boolean', value: false, description: 'add extra debugging information')
-option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
\ No newline at end of file
+option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
+
+option('staging_dir', type: 'string', description: 'set staging directory for cross-compile')
+option('online_accounts', type: 'boolean', value: false, description: 'build with support for gnome-online-accounts')
+option('cups', type: 'boolean', value: false, description: 'build with support for CUPS')
+option('user_accounts', type: 'boolean', value: false, description: 'build with support for user accounts panel')
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index 714c7f7..59723e1 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -23,13 +23,17 @@
#include "bg-pictures-source.h"
+#ifdef WITH_GOA
#include "cc-background-grilo-miner.h"
+#endif
#include "cc-background-item.h"
#include <string.h>
#include <cairo-gobject.h>
#include <gio/gio.h>
+#ifdef WITH_GOA
#include <grilo.h>
+#endif
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
#include <gdesktop-enums.h>
@@ -43,7 +47,9 @@ struct _BgPicturesSource
GCancellable *cancellable;
+#ifdef WITH_GOA
CcBackgroundGriloMiner *grl_miner;
+#endif
GnomeDesktopThumbnailFactory *thumb_factory;
@@ -85,7 +91,9 @@ bg_pictures_source_dispose (GObject *object)
g_clear_object (&source->cancellable);
}
+#ifdef WITH_GOA
g_clear_object (&source->grl_miner);
+#endif
g_clear_object (&source->thumb_factory);
G_OBJECT_CLASS (bg_pictures_source_parent_class)->dispose (object);
@@ -461,7 +469,9 @@ add_single_file (BgPicturesSource *bg_source,
const gchar *pictures_path;
g_autoptr(GFile) pictures_dir = NULL;
g_autoptr(GFile) cache_dir = NULL;
+#ifdef WITH_GOA
GrlMedia *media;
+#endif
/* find png and jpeg files */
if (!content_type)
@@ -520,13 +530,16 @@ add_single_file (BgPicturesSource *bg_source,
read_file:
+#ifdef WITH_GOA
media = g_object_get_data (G_OBJECT (file), "grl-media");
if (media == NULL)
{
+#endif
g_object_set_data_full (G_OBJECT (file), "item", g_object_ref (item), g_object_unref);
g_file_read_async (file, G_PRIORITY_DEFAULT,
bg_source->cancellable,
picture_opened_for_read, bg_source);
+#ifdef WITH_GOA
}
else
{
@@ -564,6 +577,7 @@ add_single_file (BgPicturesSource *bg_source,
picture_copied_for_read,
bg_source);
}
+#endif
retval = TRUE;
@@ -594,6 +608,7 @@ add_single_file_from_info (BgPicturesSource *bg_source,
return add_single_file (bg_source, file, content_type, mtime, ret_row_ref);
}
+#ifdef WITH_GOA
static gboolean
add_single_file_from_media (BgPicturesSource *bg_source,
GFile *file,
@@ -618,6 +633,7 @@ add_single_file_from_media (BgPicturesSource *bg_source,
return add_single_file (bg_source, file, content_type, (guint64) mtime_unix, NULL);
}
+#endif
gboolean
bg_pictures_source_add (BgPicturesSource *bg_source,
@@ -934,6 +950,7 @@ monitor_path (BgPicturesSource *self,
return monitor;
}
+#ifdef WITH_GOA
static void
media_found_cb (BgPicturesSource *self, GrlMedia *media)
{
@@ -945,6 +962,7 @@ media_found_cb (BgPicturesSource *self, GrlMedia *media)
g_object_set_data_full (G_OBJECT (file), "grl-media", g_object_ref (media), g_object_unref);
add_single_file_from_media (self, file, media);
}
+#endif
static void
bg_pictures_source_init (BgPicturesSource *self)
@@ -968,9 +986,11 @@ bg_pictures_source_init (BgPicturesSource *self)
cache_path = bg_pictures_source_get_cache_path ();
self->cache_dir_monitor = monitor_path (self, cache_path);
+#ifdef WITH_GOA
self->grl_miner = cc_background_grilo_miner_new ();
g_signal_connect_swapped (self->grl_miner, "media-found", G_CALLBACK (media_found_cb), self);
cc_background_grilo_miner_start (self->grl_miner);
+#endif
self->thumb_factory =
gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
diff --git a/panels/background/meson.build b/panels/background/meson.build
index bb34b69..0db3dae 100644
--- a/panels/background/meson.build
+++ b/panels/background/meson.build
@@ -34,9 +34,11 @@ install_data(
common_sources = []
+staging = get_option('staging_dir')
+
enums = 'gdesktop-enums-types'
enums_header = files(
- gsettings_desktop_dep.get_pkgconfig_variable('prefix') + '/include/gsettings-desktop-schemas/gdesktop-enums.h',
+ staging + gsettings_desktop_dep.get_pkgconfig_variable('prefix') + '/include/gsettings-desktop-schemas/gdesktop-enums.h',
'cc-background-item.h'
)
@@ -75,20 +77,25 @@ sources = common_sources + files(
'bg-source.c',
'bg-wallpapers-source.c',
'cc-background-chooser-dialog.c',
- 'cc-background-grilo-miner.c',
'cc-background-item.c',
'cc-background-xml.c'
)
+if enable_goa
+sources += files('cc-background-grilo-miner.c')
+endif
+
deps = common_deps + [
gdk_pixbuf_dep,
gnome_desktop_dep,
- goa_dep,
libxml_dep,
dependency('cairo-gobject'),
- dependency('grilo-0.3', version: '>= 0.3.0')
]
+if enable_goa
+deps += [ goa_dep, dependency('grilo-0.3', version: '>= 0.3.0') ]
+endif
+
cflags += [
'-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir),
'-DDATADIR="@0@"'.format(control_center_datadir),
diff --git a/panels/meson.build b/panels/meson.build
index 95a44bb..0f927bd 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -10,16 +10,13 @@ panels = [
'keyboard',
'mouse',
'notifications',
- 'online-accounts',
'power',
- 'printers',
'privacy',
'region',
'search',
'sharing',
'sound',
'universal-access',
- 'user-accounts'
]
if host_is_linux
@@ -34,6 +31,18 @@ if host_is_linux_not_s390
]
endif
+if enable_goa
+ panels += ['online-accounts']
+endif
+
+if enable_cups
+ panels += ['printers']
+endif
+
+if enable_user_accounts
+ panels += ['user-accounts']
+endif
+
panels_list = []
panels_libs = []
foreach cappletname: panels
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 5eeb44e..93d18f0 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -102,9 +102,13 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("wifi", cc_wifi_panel_get_type, cc_wifi_panel_static_init_func),
#endif
PANEL_TYPE("notifications", cc_notifications_panel_get_type, NULL),
+#ifdef WITH_GOA
PANEL_TYPE("online-accounts", cc_goa_panel_get_type, NULL),
+#endif
PANEL_TYPE("power", cc_power_panel_get_type, NULL),
+#ifdef WITH_CUPS
PANEL_TYPE("printers", cc_printers_panel_get_type, NULL),
+#endif
PANEL_TYPE("privacy", cc_privacy_panel_get_type, NULL),
PANEL_TYPE("region", cc_region_panel_get_type, NULL),
PANEL_TYPE("search", cc_search_panel_get_type, NULL),
@@ -114,7 +118,9 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("thunderbolt", cc_bolt_panel_get_type, NULL),
#endif
PANEL_TYPE("universal-access", cc_ua_panel_get_type, NULL),
+#ifdef WITH_USER_ACCOUNTS
PANEL_TYPE("user-accounts", cc_user_panel_get_type, NULL),
+#endif
#ifdef BUILD_WACOM
PANEL_TYPE("wacom", cc_wacom_panel_get_type, cc_wacom_panel_static_init_func),
#endif
diff --git a/tests/meson.build b/tests/meson.build
index 4594327..cd52250 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -6,5 +6,5 @@ endif
subdir('interactive-panels')
-subdir('printers')
+#subdir('printers')
subdir('info')

View File

@ -0,0 +1,242 @@
From 6e45a21ff2f60e81b5e69e70fed9a29fb0fdaa06 Mon Sep 17 00:00:00 2001
From: David McKinney <mckinney@subgraph.com>
Date: Mon, 6 May 2019 17:44:59 +0000
Subject: [PATCH] Remove unneeded panels
---
meson.build | 2 ++
meson_options.txt | 1 +
panels/info/meson.build | 26 +++++++++++++++++++-------
panels/meson.build | 6 ++++--
shell/cc-panel-list.c | 6 ++++++
shell/cc-panel-loader.c | 12 ++++++++++++
tests/meson.build | 8 ++++----
7 files changed, 48 insertions(+), 13 deletions(-)
diff --git a/meson.build b/meson.build
index d7926c9..63cf927 100644
--- a/meson.build
+++ b/meson.build
@@ -115,9 +115,11 @@ endif
enable_goa = get_option('online_accounts')
enable_cups = get_option('cups')
enable_user_accounts = get_option('user_accounts')
+enable_citadel = get_option('citadel')
config_h.set('WITH_GOA', enable_goa, description: 'Define to enable support for Gnome Online Accounts')
config_h.set('WITH_CUPS', enable_goa, description: 'Define to enable support for CUPS')
config_h.set('WITH_USER_ACCOUNTS', enable_user_accounts, description: 'Define to enable user accounts panel')
+config_h.set('CITADEL', enable_citadel, description: 'Define to enable the removal of components unneeded in Citadel')
goa_req_version = '>= 3.25.3'
pulse_req_version = '>= 2.0'
diff --git a/meson_options.txt b/meson_options.txt
index e0c3b23..0b969a1 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,3 +9,4 @@ option('staging_dir', type: 'string', description: 'set staging directory for cr
option('online_accounts', type: 'boolean', value: false, description: 'build with support for gnome-online-accounts')
option('cups', type: 'boolean', value: false, description: 'build with support for CUPS')
option('user_accounts', type: 'boolean', value: false, description: 'build with support for user accounts panel')
+option('citadel', type: 'boolean', value: true, description: 'build with Citadel support, which removes unneeded components')
diff --git a/panels/info/meson.build b/panels/info/meson.build
index c54e5fd..a3f3aa9 100644
--- a/panels/info/meson.build
+++ b/panels/info/meson.build
@@ -1,9 +1,11 @@
panel_names = [
- 'default-apps',
'info-overview',
- 'removable-media'
]
+if not enable_citadel
+ panel_names += ['default-apps', 'removable-media']
+endif
+
panels_list += panel_names
foreach name: panel_names
@@ -38,19 +40,29 @@ gsd_headers = ['gsd-disk-space-helper.h']
gsd_sources = ['gsd-disk-space-helper.c']
sources = files(gsd_sources) + files(
- 'cc-info-default-apps-panel.c',
'cc-info-overview-panel.c',
- 'cc-info-removable-media-panel.c',
'info-cleanup.c'
)
+if not enable_citadel
+ sources += files(
+ 'cc-info-default-apps-panel.c',
+ 'cc-info-removable-media-panel.c'
+ )
+endif
+
resource_data = files(
'GnomeLogoVerticalMedium.svg',
- 'cc-info-default-apps-panel.ui',
- 'cc-info-overview-panel.ui',
- 'cc-info-removable-media-panel.ui'
+ 'cc-info-overview-panel.ui'
)
+if not enable_citadel
+ resource_data += files(
+ 'cc-info-default-apps-panel.ui',
+ 'cc-info-removable-media-panel.ui'
+ )
+endif
+
sources += gnome.compile_resources(
'cc-' + cappletname + '-resources',
cappletname + '.gresource.xml',
diff --git a/panels/meson.build b/panels/meson.build
index 0f927bd..8d2ef07 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -1,7 +1,6 @@
subdir('common')
panels = [
- 'applications',
'background',
'color',
'datetime',
@@ -14,7 +13,6 @@ panels = [
'privacy',
'region',
'search',
- 'sharing',
'sound',
'universal-access',
]
@@ -43,6 +41,10 @@ if enable_user_accounts
panels += ['user-accounts']
endif
+if not enable_citadel
+ panels += ['applications', 'sharing']
+endif
+
panels_list = []
panels_libs = []
foreach cappletname: panels
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index 5bdc4c8..6ca22b8 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -386,8 +386,10 @@ static const gchar * const panel_order[] = {
"universal-access",
"online-accounts",
"privacy",
+#ifndef CITADEL
"applications",
"sharing",
+#endif
"sound",
"power",
"network",
@@ -397,7 +399,9 @@ static const gchar * const panel_order[] = {
"keyboard",
"mouse",
"printers",
+#ifndef CITADEL
"removable-media",
+#endif
"thunderbolt",
"wacom",
"color",
@@ -406,7 +410,9 @@ static const gchar * const panel_order[] = {
"info-overview",
"datetime",
"user-accounts",
+#ifndef CITADEL
"default-apps",
+#endif
"reset-settings"
};
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 93d18f0..c992e40 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -31,7 +31,9 @@
#ifndef CC_PANEL_LOADER_NO_GTYPES
/* Extension points */
+#ifndef CITADEL
extern GType cc_applications_panel_get_type (void);
+#endif
extern GType cc_background_panel_get_type (void);
#ifdef BUILD_BLUETOOTH
extern GType cc_bluetooth_panel_get_type (void);
@@ -40,8 +42,10 @@ extern GType cc_color_panel_get_type (void);
extern GType cc_date_time_panel_get_type (void);
extern GType cc_display_panel_get_type (void);
extern GType cc_info_overview_panel_get_type (void);
+#ifndef CITADEL
extern GType cc_info_default_apps_panel_get_type (void);
extern GType cc_info_removable_media_panel_get_type (void);
+#endif
extern GType cc_keyboard_panel_get_type (void);
extern GType cc_mouse_panel_get_type (void);
#ifdef BUILD_NETWORK
@@ -55,7 +59,9 @@ extern GType cc_printers_panel_get_type (void);
extern GType cc_privacy_panel_get_type (void);
extern GType cc_region_panel_get_type (void);
extern GType cc_search_panel_get_type (void);
+#ifndef CITADEL
extern GType cc_sharing_panel_get_type (void);
+#endif
extern GType cc_sound_panel_get_type (void);
#ifdef BUILD_THUNDERBOLT
extern GType cc_bolt_panel_get_type (void);
@@ -84,7 +90,9 @@ extern void cc_wacom_panel_static_init_func (void);
static CcPanelLoaderVtable default_panels[] =
{
+#ifndef CITADEL
PANEL_TYPE("applications", cc_applications_panel_get_type, NULL),
+#endif
PANEL_TYPE("background", cc_background_panel_get_type, NULL),
#ifdef BUILD_BLUETOOTH
PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),
@@ -93,8 +101,10 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("datetime", cc_date_time_panel_get_type, NULL),
PANEL_TYPE("display", cc_display_panel_get_type, NULL),
PANEL_TYPE("info-overview", cc_info_overview_panel_get_type, NULL),
+#ifndef CITADEL
PANEL_TYPE("default-apps", cc_info_default_apps_panel_get_type, NULL),
PANEL_TYPE("removable-media", cc_info_removable_media_panel_get_type, NULL),
+#endif
PANEL_TYPE("keyboard", cc_keyboard_panel_get_type, NULL),
PANEL_TYPE("mouse", cc_mouse_panel_get_type, NULL),
#ifdef BUILD_NETWORK
@@ -112,7 +122,9 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("privacy", cc_privacy_panel_get_type, NULL),
PANEL_TYPE("region", cc_region_panel_get_type, NULL),
PANEL_TYPE("search", cc_search_panel_get_type, NULL),
+#ifndef CITADEL
PANEL_TYPE("sharing", cc_sharing_panel_get_type, NULL),
+#endif
PANEL_TYPE("sound", cc_sound_panel_get_type, NULL),
#ifdef BUILD_THUNDERBOLT
PANEL_TYPE("thunderbolt", cc_bolt_panel_get_type, NULL),
diff --git a/tests/meson.build b/tests/meson.build
index cd52250..d0335b1 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,8 +1,8 @@
subdir('common')
-subdir('datetime')
-if host_is_linux
- subdir('network')
-endif
+#subdir('datetime')
+#if host_is_linux
+# subdir('network')
+#endif
subdir('interactive-panels')

View File

@ -30,8 +30,15 @@ DEPENDS = "pulseaudio colord-gtk networkmanager ibus colord gnome-desktop gnome-
#
# EXTRA_OEMESON += "-Duser_accounts=true"
# DEPENDS += "accountsservice krb5"
# Citadel
#
SRC_URI += "file://0001-Make-GOA-CUPS-and-User-Accounts-optional.patch"
# This option disables some things in gnome-control-center such as certain
# panels that are not used in Citadel, defaults to true in meson_options.
# To re-enable these things, set the option to false:
#
# EXTRA_OEMESON += "-Dcitadel=false"
SRC_URI += " file://0001-Make-GOA-CUPS-and-User-Accounts-optional.patch \
file://0001-Remove-unneeded-panels.patch"
FILES_${PN} += "\
${datadir}/bash-completion \