Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all files when disabling extension #1270

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/metadata.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"description": "GSConnect is a complete implementation of KDE Connect especially for GNOME Shell with Nautilus, Chrome and Firefox integration. It does not rely on the KDE Connect desktop application and will not work with it installed.\n\nKDE Connect allows devices to securely share content like notifications or files and other features like SMS messaging and remote control. The KDE Connect team has applications for Linux, BSD, Android, Sailfish and Windows.\n\nPlease report issues on Github!",
"version": @PACKAGE_VERSION@,
"shell-version": [ "41" ],
"url": "@PACKAGE_URL@/wiki"
"url": "@PACKAGE_URL@/wiki",
"session-modes": ["user", "unlock-dialog"],
andyholmes marked this conversation as resolved.
Show resolved Hide resolved
}
11 changes: 5 additions & 6 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,6 @@ var serviceIndicator = null;


function init() {
// If installed as a user extension, this will install the Desktop entry,
// DBus and systemd service files necessary for DBus activation and
// GNotifications. Since there's no uninit()/uninstall() hook for extensions
// and they're only used *by* GSConnect, they should be okay to leave.
Utils.installService();

// These modify the notification source for GSConnect's GNotifications and
// need to be active even when the extension is disabled (eg. lock screen).
// Since they *only* affect notifications from GSConnect, it should be okay
Expand All @@ -443,6 +437,10 @@ function init() {


function enable() {
// If installed as a user extension, this will install the Desktop entry,
// DBus and systemd service files necessary for DBus activation and
// GNotifications.
Utils.installService(true);
serviceIndicator = new ServiceIndicator();
Notification.patchGtkNotificationSources();
}
Expand All @@ -452,4 +450,5 @@ function disable() {
serviceIndicator.destroy();
serviceIndicator = null;
Notification.unpatchGtkNotificationSources();
Utils.installService(false);
}
2 changes: 1 addition & 1 deletion src/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Extension = imports.misc.extensionUtils.getCurrentExtension();
const Utils = Extension.imports.shell.utils;

function init() {
Utils.installService();
Utils.installService(true);
}

function buildPrefsWidget() {
Expand Down
4 changes: 2 additions & 2 deletions src/shell/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function _installResource(dirname, basename, relativePath) {
/**
* Install the files necessary for the GSConnect service to run.
*/
function installService() {
function installService(enabling) {
const confDir = GLib.get_user_config_dir();
const dataDir = GLib.get_user_data_dir();
const homeDir = GLib.get_home_dir();
Expand Down Expand Up @@ -171,7 +171,7 @@ function installService() {

// If running as a user extension, ensure the DBus service, desktop entry,
// file manager scripts, and WebExtension manifests are installed.
if (Config.IS_USER) {
if (Config.IS_USER && enabling) {
// DBus Service
if (!_installResource(dbusDir, dbusFile, `${dbusFile}.in`))
throw Error('GSConnect: Failed to install DBus Service');
Expand Down