Commit 77bdc385 authored by Richard Hughes's avatar Richard Hughes

Remove support for Shell extensions

These are now handled in GNOME Shell itself

gnome-shell#1968
parent 184ec1bf
Pipeline #148069 passed with stage
in 2 minutes and 53 seconds
......@@ -183,7 +183,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_provenance.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_repos.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_rewrite-resource.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_shell-extensions.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_systemd-updates.so
%{_sysconfdir}/xdg/autostart/gnome-software-service.desktop
%{_datadir}/app-info/xmls/org.gnome.Software.Featured.xml
......
......@@ -10,7 +10,6 @@ option('fwupd', type : 'boolean', value : true, description : 'enable fwupd supp
option('flatpak', type : 'boolean', value : true, description : 'enable Flatpak support')
option('malcontent', type : 'boolean', value : true, description : 'enable parental controls support using libmalcontent')
option('rpm_ostree', type : 'boolean', value : false, description : 'enable rpm-ostree support')
option('shell_extensions', type : 'boolean', value : true, description : 'enable shell extensions support')
option('odrs', type : 'boolean', value : true, description : 'enable ODRS support')
option('gudev', type : 'boolean', value : true, description : 'enable GUdev support')
option('snap', type : 'boolean', value : false, description : 'enable Snap support')
......
......@@ -30,6 +30,15 @@ gs_appstream_create_app (GsPlugin *plugin, XbSilo *silo, XbNode *component, GErr
if (gs_app_has_quirk (app_new, GS_APP_QUIRK_IS_WILDCARD))
return g_steal_pointer (&app_new);
/* no longer supported */
if (gs_app_get_kind (app_new) == AS_APP_KIND_SHELL_EXTENSION) {
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_NOT_SUPPORTED,
"shell extensions no longer supported");
return NULL;
}
/* look for existing object */
app = gs_plugin_cache_lookup (plugin, gs_app_get_unique_id (app_new));
if (app != NULL)
......@@ -1536,11 +1545,6 @@ gs_appstream_component_add_extra_info (GsPlugin *plugin, XbBuilderNode *componen
gs_appstream_component_add_category (component, "Addon");
gs_appstream_component_add_category (component, "Font");
break;
case AS_APP_KIND_SHELL_EXTENSION:
gs_appstream_component_add_category (component, "Addon");
gs_appstream_component_add_category (component, "ShellExtension");
gs_appstream_component_add_icon (component, "application-x-addon-symbolic");
break;
case AS_APP_KIND_DRIVER:
gs_appstream_component_add_category (component, "Addon");
gs_appstream_component_add_category (component, "Driver");
......
......@@ -203,9 +203,6 @@ static const GsDesktopMap map_addons[] = {
{ "language-packs", NC_("Menu of Add-ons", "Language Packs"),
{ "Addon::LanguagePack",
NULL} },
{ "shell-extensions", NC_("Menu of Add-ons", "Shell Extensions"),
{ "Addon::ShellExtension",
NULL} },
{ "localization", NC_("Menu of Add-ons", "Localization"),
{ "Addon::Localization",
NULL} },
......
......@@ -39,9 +39,6 @@ subdir('repos')
if get_option('rpm_ostree')
subdir('rpm-ostree')
endif
if get_option('shell_extensions')
subdir('shell-extensions')
endif
if get_option('snap')
subdir('snap')
endif
......
......@@ -688,8 +688,5 @@ gs_plugin_launch (GsPlugin *plugin,
if (g_strcmp0 (gs_app_get_management_plugin (app),
gs_plugin_get_name (plugin)) != 0)
return TRUE;
/* these are handled by the shell extensions plugin */
if (gs_app_get_kind (app) == AS_APP_KIND_SHELL_EXTENSION)
return TRUE;
return gs_plugin_app_launch (plugin, app, error);
}
../core/gs-appstream.c
\ No newline at end of file
../core/gs-appstream.h
\ No newline at end of file
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include "config.h"
#include <glib/gstdio.h>
#include <xmlb.h>
#include "gnome-software-private.h"
#include "gs-test.h"
static void
gs_plugins_shell_extensions_installed_func (GsPluginLoader *plugin_loader)
{
GsApp *app;
g_autoptr(GError) error = NULL;
g_autoptr(GsAppList) list = NULL;
g_autoptr(GsPluginJob) plugin_job = NULL;
/* no shell-extensions, abort */
if (!gs_plugin_loader_get_enabled (plugin_loader, "shell-extensions")) {
g_test_skip ("not enabled");
return;
}
/* get installed packages */
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_INSTALLED,
"refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_CATEGORIES,
NULL);
list = gs_plugin_loader_job_process (plugin_loader, plugin_job, NULL, &error);
gs_test_flush_main_context ();
g_assert_no_error (error);
g_assert (list != NULL);
/* no shell-extensions installed, abort */
if (gs_app_list_length (list) < 1) {
g_test_skip ("no shell extensions installed");
return;
}
/* test properties */
app = gs_app_list_lookup (list, "*/*/*/*/background-logo_fedorahosted.org/*");
if (app == NULL) {
g_test_skip ("not found");
return;
}
g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_INSTALLED);
g_assert_cmpint (gs_app_get_scope (app), ==, AS_APP_SCOPE_USER);
g_assert_cmpstr (gs_app_get_name (app), ==, "Background Logo");
g_assert_cmpstr (gs_app_get_summary (app), ==, "GNOME Shell Extension");
g_assert_cmpstr (gs_app_get_description (app), ==,
"Overlay a tasteful logo on the background to "
"enhance the user experience");
g_assert_cmpstr (gs_app_get_license (app), ==, "GPL-2.0+");
g_assert_cmpstr (gs_app_get_management_plugin (app), ==, "shell-extensions");
g_assert (gs_app_has_category (app, "Addon"));
g_assert (gs_app_has_category (app, "ShellExtension"));
g_assert_cmpstr (gs_app_get_metadata_item (app, "shell-extensions::has-prefs"), ==, "");
g_assert_cmpstr (gs_app_get_metadata_item (app, "shell-extensions::uuid"), ==,
"background-logo@fedorahosted.org");
}
static void
gs_plugins_shell_extensions_remote_func (GsPluginLoader *plugin_loader)
{
const gchar *cachedir = "/var/tmp/gs-self-test";
gboolean ret;
g_autofree gchar *fn = NULL;
g_autoptr(GError) error = NULL;
g_autoptr(GFile) file = NULL;
g_autoptr(GPtrArray) components = NULL;
g_autoptr(GsPluginJob) plugin_job = NULL;
g_autoptr(XbSilo) silo = NULL;
/* no shell-extensions, abort */
if (!gs_plugin_loader_get_enabled (plugin_loader, "shell-extensions")) {
g_test_skip ("not enabled");
return;
}
/* ensure files are removed */
g_setenv ("GS_SELF_TEST_CACHEDIR", cachedir, TRUE);
gs_utils_rmtree (cachedir, NULL);
/* refresh the metadata */
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REFRESH,
"age", (guint64) G_MAXUINT,
NULL);
ret = gs_plugin_loader_job_action (plugin_loader, plugin_job, NULL, &error);
g_assert_no_error (error);
g_assert (ret);
/* ensure file was populated */
silo = xb_silo_new ();
fn = gs_utils_get_cache_filename ("shell-extensions",
"extensions-web.xmlb",
GS_UTILS_CACHE_FLAG_WRITEABLE,
&error);
g_assert_no_error (error);
g_assert_nonnull (fn);
file = g_file_new_for_path (fn);
ret = xb_silo_load_from_file (silo, file,
XB_SILO_LOAD_FLAG_NONE,
NULL, &error);
g_assert_no_error (error);
g_assert (ret);
components = xb_silo_query (silo, "components/component", 0, &error);
g_assert_no_error (error);
g_assert_nonnull (components);
g_assert_cmpint (components->len, >, 20);
}
int
main (int argc, char **argv)
{
gboolean ret;
g_autoptr(GError) error = NULL;
g_autoptr(GsPluginLoader) plugin_loader = NULL;
const gchar *whitelist[] = {
"shell-extensions",
NULL
};
g_test_init (&argc, &argv, NULL);
g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
/* only critical and error are fatal */
g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
/* we can only load this once per process */
plugin_loader = gs_plugin_loader_new ();
gs_plugin_loader_add_location (plugin_loader, LOCALPLUGINDIR);
ret = gs_plugin_loader_setup (plugin_loader,
(gchar**) whitelist,
NULL,
NULL,
&error);
g_assert_no_error (error);
g_assert (ret);
/* plugin tests go here */
g_test_add_data_func ("/gnome-software/plugins/shell-extensions/installed",
plugin_loader,
(GTestDataFunc) gs_plugins_shell_extensions_installed_func);
g_test_add_data_func ("/gnome-software/plugins/shell-extensions/remote",
plugin_loader,
(GTestDataFunc) gs_plugins_shell_extensions_remote_func);
return g_test_run ();
}
cargs = ['-DG_LOG_DOMAIN="GsPluginShellExtensions"']
cargs += ['-DLOCALPLUGINDIR="' + meson.current_build_dir() + '"']
shared_module(
'gs_plugin_shell-extensions',
sources : [
'gs-appstream.c',
'gs-plugin-shell-extensions.c'
],
include_directories : [
include_directories('../..'),
include_directories('../../lib'),
],
install : true,
install_dir: plugin_dir,
c_args : cargs,
dependencies : [
plugin_libs,
libxmlb,
],
link_with : [
libgnomesoftware
]
)
if get_option('tests')
e = executable(
'gs-self-test-shell-extensions',
compiled_schemas,
sources : [
'gs-self-test.c'
],
include_directories : [
include_directories('../..'),
include_directories('../../lib'),
],
dependencies : [
plugin_libs,
libxmlb,
],
link_with : [
libgnomesoftware
],
c_args : cargs,
)
test('gs-self-test-shell-extensions', e, suite: ['plugins', 'shell-extensions'], env: test_env)
endif
......@@ -38,8 +38,6 @@ struct _GsCategoryPage
guint sort_name_handler_id;
SubcategorySortType sort_type;
GtkWidget *infobar_category_shell_extensions;
GtkWidget *button_category_shell_extensions;
GtkWidget *category_detail_box;
GtkWidget *scrolledwindow_category;
GtkWidget *subcats_filter_label;
......@@ -323,12 +321,6 @@ gs_category_page_reload (GsPage *page)
gtk_widget_set_visible (self->subcats_sort_button, TRUE);
}
/* show the shell extensions header */
if (g_strcmp0 (gs_category_get_id (self->subcategory), "shell-extensions") == 0)
gtk_widget_set_visible (self->infobar_category_shell_extensions, TRUE);
else
gtk_widget_set_visible (self->infobar_category_shell_extensions, FALSE);
if (self->sort_rating_handler_id > 0) {
g_signal_handler_disconnect (self->sort_rating_button,
self->sort_rating_handler_id);
......@@ -532,18 +524,6 @@ gs_category_page_dispose (GObject *object)
G_OBJECT_CLASS (gs_category_page_parent_class)->dispose (object);
}
static void
button_shell_extensions_cb (GtkButton *button, GsCategoryPage *self)
{
gboolean ret;
g_autoptr(GError) error = NULL;
const gchar *argv[] = { "gnome-shell-extension-prefs", NULL };
ret = g_spawn_async (NULL, (gchar **) argv, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, &error);
if (!ret)
g_warning ("failed to exec %s: %s", argv[0], error->message);
}
static gboolean
gs_category_page_setup (GsPage *page,
GsShell *shell,
......@@ -565,9 +545,6 @@ gs_category_page_setup (GsPage *page,
adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_category));
gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->category_detail_box), adj);
g_signal_connect (self->button_category_shell_extensions, "clicked",
G_CALLBACK (button_shell_extensions_cb), self);
return TRUE;
}
......@@ -586,8 +563,6 @@ gs_category_page_class_init (GsCategoryPageClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-category-page.ui");
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, category_detail_box);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, infobar_category_shell_extensions);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, button_category_shell_extensions);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, scrolledwindow_category);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, subcats_filter_label);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, subcats_filter_button_label);
......
......@@ -97,51 +97,6 @@
<property name="margin_end">24</property>
</object>
</child>
<child>
<object class="GtkInfoBar" id="infobar_category_shell_extensions">
<property name="visible">False</property>
<property name="app_paintable">True</property>
<property name="hexpand">True</property>
<property name="message_type">other</property>
<property name="margin_start">24</property>
<property name="margin_top">24</property>
<property name="margin_end">24</property>
<style>
<class name="application-details-infobar"/>
</style>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button_category_shell_extensions">
<property name="label" translatable="yes">Extension Settings</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
</object>
</child>
</object>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="spacing">16</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="label" translatable="yes">Extensions are used at your own risk. If you have any system problems, it is recommended to disable them.</property>
<property name="hexpand">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
......
......@@ -923,17 +923,9 @@ gs_details_page_refresh_buttons (GsDetailsPage *self)
break;
}
if (gs_app_get_kind (self->app) == AS_APP_KIND_SHELL_EXTENSION) {
gtk_button_set_label (GTK_BUTTON (self->button_details_launch),
/* TRANSLATORS: A label for a button to show the settings for
the selected shell extension. */
_("Extension Settings"));
} else {
gtk_button_set_label (GTK_BUTTON (self->button_details_launch),
/* TRANSLATORS: A label for a button to execute the selected
application. */
_("_Launch"));
}
gtk_button_set_label (GTK_BUTTON (self->button_details_launch),
/* TRANSLATORS: A label for a button to execute the selected application. */
_("_Launch"));
/* don't show the launch and shortcut buttons if the app doesn't have a desktop ID */
if (gs_app_get_id (self->app) == NULL) {
......
......@@ -68,8 +68,7 @@ repo_supports_removal (GsApp *repo)
/* can't remove a repo, only enable/disable existing ones */
if (g_strcmp0 (management_plugin, "fwupd") == 0 ||
g_strcmp0 (management_plugin, "packagekit") == 0 ||
g_strcmp0 (management_plugin, "rpm-ostree") == 0 ||
g_strcmp0 (management_plugin, "shell-extensions") == 0)
g_strcmp0 (management_plugin, "rpm-ostree") == 0)
return FALSE;
return TRUE;
......
......@@ -136,8 +136,7 @@ repo_supports_removal (GsApp *repo)
/* can't remove a repo, only enable/disable existing ones */
if (g_strcmp0 (management_plugin, "fwupd") == 0 ||
g_strcmp0 (management_plugin, "packagekit") == 0 ||
g_strcmp0 (management_plugin, "rpm-ostree") == 0 ||
g_strcmp0 (management_plugin, "shell-extensions") == 0)
g_strcmp0 (management_plugin, "rpm-ostree") == 0)
return FALSE;
return TRUE;
......
......@@ -41,7 +41,7 @@ gs_summary_tile_refresh (GsAppTile *self)
const GdkPixbuf *pixbuf;
gboolean installed;
g_autofree gchar *name = NULL;
g_autofree gchar *summary = NULL;
const gchar *summary;
const gchar *css;
if (app == NULL)
......@@ -53,18 +53,7 @@ gs_summary_tile_refresh (GsAppTile *self)
/* set name */
gtk_label_set_label (GTK_LABEL (tile->name), gs_app_get_name (app));
/* some kinds have boring summaries */
switch (gs_app_get_kind (app)) {
case AS_APP_KIND_SHELL_EXTENSION:
summary = g_strdup (gs_app_get_description (app));
if (summary != NULL)
g_strdelimit (summary, "\n\t", ' ');
break;
default:
summary = g_strdup (gs_app_get_summary (app));
break;
}
summary = gs_app_get_summary (app);
gtk_label_set_label (GTK_LABEL (tile->summary), summary);
gtk_widget_set_visible (tile->summary, summary && summary[0]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment