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

GTK4/libadwaita port #464

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
dbc59b3
Initial GTK4/libadwaita port
togetherwithasteria Aug 3, 2022
5a52136
gtk4: Remove visible properties in UI file
togetherwithasteria Aug 3, 2022
2022436
gtk4: remove unneeded debug logs
togetherwithasteria Aug 3, 2022
902c452
gtk4: Fix response signal doesn't exist
togetherwithasteria Aug 3, 2022
4390d5d
gtk4: remove ALL
togetherwithasteria Aug 3, 2022
fccd4f0
gtk4: Fix assignment to unitialized variable row and remove row from …
togetherwithasteria Aug 3, 2022
e5013da
gtk4: reimplement Find keybinding
togetherwithasteria Aug 12, 2022
6c287cd
gtk4: Run gtk4-builder-tool with the ui files
togetherwithasteria Nov 4, 2022
884558b
gtk4: Remove some visible 0 properties
togetherwithasteria Nov 4, 2022
e873e8a
gtk4: remove the keybindings
togetherwithasteria Nov 4, 2022
a757032
gtk4: check if row.destroy exist first in paths viewer
togetherwithasteria Nov 4, 2022
db8102e
Merge branch 'master' of https://github.com/tchx84/Flatseal
togetherwithasteria Nov 4, 2022
1dbd200
gtk4: Switch to AdwAboutWindow
togetherwithasteria Nov 4, 2022
dc83a89
gtk4: Remove all can-focus properties from builder files
togetherwithasteria Nov 5, 2022
3ff15b4
gtk4: Fix visibility regression with actionbar
togetherwithasteria Nov 5, 2022
c7883d1
gtk4: use sidebar css class in the apps list
togetherwithasteria Nov 5, 2022
b1bb46d
gtk4: Fix app title size refression
togetherwithasteria Nov 5, 2022
768b678
gtk4: Fix regression with the theme not loading
togetherwithasteria Nov 5, 2022
aabc192
gtk4: remove the row.destroy() part in pathsviewer
togetherwithasteria Nov 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 20 additions & 26 deletions src/application.js
Expand Up @@ -19,23 +19,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject, Gtk, Gdk, Gio, Handy} = imports.gi;
const { GObject, Gtk, Gdk, Gio, Adw } = imports.gi;

const {FlatsealWindow} = imports.widgets.window;
const {FlatsealAboutDialog} = imports.widgets.aboutDialog;
const {FlatsealDocsViewer} = imports.widgets.docsViewer;
const {FlatsealShortcutsWindow} = imports.widgets.shortcutsWindow;
const { FlatsealWindow } = imports.widgets.window;
const { showAboutDialog } = imports.widgets.aboutDialog;
const { FlatsealDocsViewer } = imports.widgets.docsViewer;
const { FlatsealShortcutsWindow } = imports.widgets.shortcutsWindow;

var FlatsealApplication = GObject.registerClass({
GTypeName: 'FlatsealApplication',
}, class FlatsealApplication extends Gtk.Application {
}, class FlatsealApplication extends Adw.Application {
_init() {
super._init({
application_id: 'com.github.tchx84.Flatseal',
flags: Gio.ApplicationFlags.FLAGS_NONE,
resource_base_path: '/com/github/tchx84/Flatseal/',
});

this._window = null;

}

_displayHelp() {
Expand All @@ -48,12 +50,11 @@ var FlatsealApplication = GObject.registerClass({
}

_displayAbout() {
const dialog = new FlatsealAboutDialog({transient_for: this._window, modal: true});
dialog.present();
showAboutDialog();
}

_displayShortcuts() {
const dialog = new FlatsealShortcutsWindow({transient_for: this._window});
const dialog = new FlatsealShortcutsWindow({ transient_for: this._window });
dialog.present();
}

Expand All @@ -63,19 +64,19 @@ var FlatsealApplication = GObject.registerClass({
}

_setupActions() {
const help_action = new Gio.SimpleAction({name: 'help', state: null});
const help_action = new Gio.SimpleAction({ name: 'help', state: null });
help_action.connect('activate', this._displayHelp.bind(this));

const documentation_action = new Gio.SimpleAction({name: 'documentation', state: null});
const documentation_action = new Gio.SimpleAction({ name: 'documentation', state: null });
documentation_action.connect('activate', this._displayDocumentation.bind(this));

const shortcuts_action = new Gio.SimpleAction({name: 'shortcuts', state: null});
const shortcuts_action = new Gio.SimpleAction({ name: 'shortcuts', state: null });
shortcuts_action.connect('activate', this._displayShortcuts.bind(this));

const about_action = new Gio.SimpleAction({name: 'about', state: null});
const about_action = new Gio.SimpleAction({ name: 'about', state: null });
about_action.connect('activate', this._displayAbout.bind(this));

const quit_action = new Gio.SimpleAction({name: 'quit', state: null});
const quit_action = new Gio.SimpleAction({ name: 'quit', state: null });
quit_action.connect('activate', this._quit.bind(this));

this.add_action(help_action);
Expand All @@ -89,14 +90,9 @@ var FlatsealApplication = GObject.registerClass({
this.set_accels_for_action('app.quit', ['<Primary>q']);
}

_setupStylesheet() {
const provider = new Gtk.CssProvider();
provider.load_from_resource('/com/github/tchx84/Flatseal/application.css');
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
}

vfunc_activate() {
activate() {

if (this._window === null)
this._window = new FlatsealWindow(this);

Expand All @@ -105,11 +101,9 @@ var FlatsealApplication = GObject.registerClass({

vfunc_startup() {
super.vfunc_startup();
Handy.init();
Adw.init();
this._setupActions();
this._setupStylesheet();

Handy.StyleManager.get_default().set_color_scheme(
Handy.ColorScheme.PREFER_LIGHT);
Adw.StyleManager.get_default().set_color_scheme(
Adw.ColorScheme.PREFER_LIGHT);
}
});
2 changes: 1 addition & 1 deletion src/com.github.tchx84.Flatseal.data.gresource.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/github/tchx84/Flatseal">
<file>application.css</file>
<file>style.css</file>
<file>widgets/aboutDialog.ui</file>
<file>widgets/appInfoViewer.ui</file>
<file>widgets/applicationRow.ui</file>
Expand Down
11 changes: 7 additions & 4 deletions src/main.js
Expand Up @@ -22,15 +22,18 @@ pkg.initGettext();
pkg.initFormat();
pkg.require({
Gio: '2.0',
Gtk: '3.0',
Handy: '1',
WebKit2: '4.1',
Gtk: '4.0',
Adw: '1',
});

const {FlatsealApplication} = imports.application;
const { FlatsealApplication } = imports.application;


function main(argv) {
const application = new FlatsealApplication();

application.connect('activate', app => {
app.activate();
})
return application.run(argv);
}
2 changes: 1 addition & 1 deletion src/meson.build
@@ -1,7 +1,7 @@
pkgdatadir = join_paths(get_option('datadir'), meson.project_name())
gnome = import('gnome')

dependency('libhandy-1', version : '>= 1.5')
dependency('libadwaita-1', version : '>= 1.0')

src_res = gnome.compile_resources('com.github.tchx84.Flatseal.src',
'com.github.tchx84.Flatseal.src.gresource.xml',
Expand Down
8 changes: 4 additions & 4 deletions src/models/applications.js
Expand Up @@ -18,9 +18,9 @@

/* exported FlatpakApplicationsModel getDefault */

const {GObject, GLib, Gio, AppStreamGlib} = imports.gi;
const { GObject, GLib, Gio, AppStreamGlib } = imports.gi;

const {FlatpakInfoModel} = imports.models.info;
const { FlatpakInfoModel } = imports.models.info;

var FlatpakApplicationsModel = GObject.registerClass({
GTypeName: 'FlatpakApplicationsModel',
Expand Down Expand Up @@ -338,9 +338,9 @@ var FlatpakApplicationsModel = GObject.registerClass({
});


var getDefault = (function() {
var getDefault = (function () {
let instance;
return function() {
return function () {
if (typeof instance === 'undefined')
instance = new FlatpakApplicationsModel();
return instance;
Expand Down
4 changes: 2 additions & 2 deletions src/models/devices.js
Expand Up @@ -18,9 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject} = imports.gi;
const { GObject } = imports.gi;

const {FlatpakSharedModel} = imports.models.shared;
const { FlatpakSharedModel } = imports.models.shared;


var FlatpakDevicesModel = GObject.registerClass({
Expand Down
4 changes: 2 additions & 2 deletions src/models/features.js
Expand Up @@ -18,9 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject} = imports.gi;
const { GObject } = imports.gi;

const {FlatpakSharedModel} = imports.models.shared;
const { FlatpakSharedModel } = imports.models.shared;


var FlatpakFeaturesModel = GObject.registerClass({
Expand Down
8 changes: 4 additions & 4 deletions src/models/filesystems.js
Expand Up @@ -18,9 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject} = imports.gi;
const { GObject } = imports.gi;

const {FlatpakSharedModel} = imports.models.shared;
const { FlatpakSharedModel } = imports.models.shared;


var FlatpakFilesystemsModel = GObject.registerClass({
Expand Down Expand Up @@ -84,9 +84,9 @@ var FlatpakFilesystemsModel = GObject.registerClass({
}
});

var getDefault = (function() {
var getDefault = (function () {
let instance;
return function() {
return function () {
if (typeof instance === 'undefined')
instance = new FlatpakFilesystemsModel();
return instance;
Expand Down
6 changes: 3 additions & 3 deletions src/models/filesystemsOther.js
Expand Up @@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject} = imports.gi;
const { GObject } = imports.gi;

const {filesystems} = imports.models;
const {FlatpakSharedModel} = imports.models.shared;
const { filesystems } = imports.models;
const { FlatpakSharedModel } = imports.models.shared;


var FlatpakFilesystemsOtherModel = GObject.registerClass({
Expand Down
6 changes: 3 additions & 3 deletions src/models/info.js
Expand Up @@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject, GLib} = imports.gi;
const { GObject, GLib } = imports.gi;


var FlatpakInfoModel = GObject.registerClass({
Expand Down Expand Up @@ -86,9 +86,9 @@ var FlatpakInfoModel = GObject.registerClass({
});


var getDefault = (function() {
var getDefault = (function () {
let instance;
return function() {
return function () {
if (typeof instance === 'undefined')
instance = new FlatpakInfoModel();
return instance;
Expand Down
34 changes: 17 additions & 17 deletions src/models/permissions.js
Expand Up @@ -18,21 +18,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject, GLib} = imports.gi;

const {FlatpakApplicationsModel} = imports.models.applications;
const {FlatpakUnsupportedModel} = imports.models.unsupported;
const {FlatpakDevicesModel} = imports.models.devices;
const {FlatpakSharedModel} = imports.models.shared;
const {FlatpakSocketsModel} = imports.models.sockets;
const {FlatpakFeaturesModel} = imports.models.features;
const {FlatpakFilesystemsOtherModel} = imports.models.filesystemsOther;
const {FlatpakVariablesModel} = imports.models.variables;
const {FlatpakSessionBusModel} = imports.models.sessionBus;
const {FlatpakSystemBusModel} = imports.models.systemBus;
const {FlatsealOverrideStatus} = imports.models.overrideStatus;
const {isGlobalOverride} = imports.models.globalModel;
const {filesystems, persistent, portals} = imports.models;
const { GObject, GLib } = imports.gi;

const { FlatpakApplicationsModel } = imports.models.applications;
const { FlatpakUnsupportedModel } = imports.models.unsupported;
const { FlatpakDevicesModel } = imports.models.devices;
const { FlatpakSharedModel } = imports.models.shared;
const { FlatpakSocketsModel } = imports.models.sockets;
const { FlatpakFeaturesModel } = imports.models.features;
const { FlatpakFilesystemsOtherModel } = imports.models.filesystemsOther;
const { FlatpakVariablesModel } = imports.models.variables;
const { FlatpakSessionBusModel } = imports.models.sessionBus;
const { FlatpakSystemBusModel } = imports.models.systemBus;
const { FlatsealOverrideStatus } = imports.models.overrideStatus;
const { isGlobalOverride } = imports.models.globalModel;
const { filesystems, persistent, portals } = imports.models;

const FLAGS = GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT;

Expand Down Expand Up @@ -352,9 +352,9 @@ var FlatpakPermissionsModel = GObject.registerClass({
});


var getDefault = (function() {
var getDefault = (function () {
let instance;
return function() {
return function () {
if (typeof instance === 'undefined')
instance = new FlatpakPermissionsModel();
return instance;
Expand Down
8 changes: 4 additions & 4 deletions src/models/persistent.js
Expand Up @@ -18,9 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject} = imports.gi;
const { GObject } = imports.gi;

const {FlatpakSharedModel} = imports.models.shared;
const { FlatpakSharedModel } = imports.models.shared;


var FlatpakPersistentModel = GObject.registerClass({
Expand Down Expand Up @@ -115,9 +115,9 @@ var FlatpakPersistentModel = GObject.registerClass({
}
});

var getDefault = (function() {
var getDefault = (function () {
let instance;
return function() {
return function () {
if (typeof instance === 'undefined')
instance = new FlatpakPersistentModel();
return instance;
Expand Down
8 changes: 4 additions & 4 deletions src/models/portals.js
Expand Up @@ -19,8 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {Gio, GLib, GObject} = imports.gi;
const {info} = imports.models;
const { Gio, GLib, GObject } = imports.gi;
const { info } = imports.models;

var PermissionsIface = `
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
Expand Down Expand Up @@ -413,9 +413,9 @@ var FlatpakPortalsModel = GObject.registerClass({
});


var getDefault = (function() {
var getDefault = (function () {
let instance;
return function() {
return function () {
if (typeof instance === 'undefined')
instance = new FlatpakPortalsModel();
return instance;
Expand Down
14 changes: 7 additions & 7 deletions src/models/sessionBus.js
Expand Up @@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const {GObject} = imports.gi;
const { GObject } = imports.gi;

const {FlatpakSharedModel} = imports.models.shared;
const {FlatsealOverrideStatus} = imports.models.overrideStatus;
const { FlatpakSharedModel } = imports.models.shared;
const { FlatsealOverrideStatus } = imports.models.overrideStatus;


var FlatpakSessionBusModel = GObject.registerClass({
Expand Down Expand Up @@ -90,7 +90,7 @@ var FlatpakSessionBusModel = GObject.registerClass({
const prefix = this.constructor.getPrefix();
const option = property.replace(`${prefix}-`, '');

const originals = {...this._originals, ...this._globals};
const originals = { ...this._originals, ...this._globals };
const values = value.split(';');

/* Reset overrides on Talk since it's the first to update */
Expand Down Expand Up @@ -126,7 +126,7 @@ var FlatpakSessionBusModel = GObject.registerClass({
if (option !== 'own')
return;

this._overrides = {...this._missing, ...this._overrides};
this._overrides = { ...this._missing, ...this._overrides };
}

_getStatusForPermission(name) {
Expand Down Expand Up @@ -158,8 +158,8 @@ var FlatpakSessionBusModel = GObject.registerClass({
}

updateProxyProperty(proxy) {
const options = {talk: [], own: [], none: []};
const values = {...this._originals, ...this._globals, ...this._overrides};
const options = { talk: [], own: [], none: [] };
const values = { ...this._originals, ...this._globals, ...this._overrides };

Object.entries(values).forEach(([name, option]) => {
if (!(option in options))
Expand Down