-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #345 from hardpixel/gnome45
Port to gnome 45
- Loading branch information
Showing
22 changed files
with
457 additions
and
2,121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
const Gettext = imports.gettext | ||
const GObject = imports.gi.GObject | ||
const Gio = imports.gi.Gio | ||
const Config = imports.misc.config | ||
const Me = imports.misc.extensionUtils.getCurrentExtension() | ||
import GObject from 'gi://GObject' | ||
import Gio from 'gi://Gio' | ||
|
||
var SettingsObject = GObject.registerClass( | ||
export const SettingsObject = GObject.registerClass( | ||
class UniteSettingsObject extends Gio.Settings { | ||
exists(key) { | ||
return this.settings_schema.has_key(key) | ||
|
@@ -20,7 +17,7 @@ var SettingsObject = GObject.registerClass( | |
} | ||
) | ||
|
||
var SettingsManager = GObject.registerClass( | ||
export const SettingsManager = GObject.registerClass( | ||
class UniteSettings extends Gio.Settings { | ||
get DEFAULT_BINDING() { | ||
return Gio.SettingsBindFlags.DEFAULT | ||
|
@@ -31,22 +28,18 @@ var SettingsManager = GObject.registerClass( | |
'autofocus-windows': 'boolean', | ||
'hide-activities-button': 'enum', | ||
'show-window-title': 'enum', | ||
'show-appmenu-button': 'boolean', | ||
'show-desktop-name': 'boolean', | ||
'desktop-name-text': 'string', | ||
'extend-left-box': 'boolean', | ||
'notifications-position': 'enum', | ||
'use-system-fonts': 'boolean', | ||
'show-legacy-tray': 'boolean', | ||
'greyscale-tray-icons': 'boolean', | ||
'show-window-buttons': 'enum', | ||
'window-buttons-theme': 'select', | ||
'hide-window-titlebars': 'enum', | ||
'enable-titlebar-actions': 'boolean', | ||
'window-buttons-placement': 'enum', | ||
'hide-dropdown-arrows': 'boolean', | ||
'hide-aggregate-menu-arrow': 'boolean', | ||
'hide-app-menu-arrow': 'boolean', | ||
'hide-app-menu-icon': 'boolean', | ||
'reduce-panel-spacing': 'boolean', | ||
'restrict-to-primary-screen': 'boolean', | ||
'app-menu-max-width': 'int', | ||
|
@@ -88,7 +81,7 @@ var SettingsManager = GObject.registerClass( | |
} | ||
) | ||
|
||
var PreferencesManager = GObject.registerClass( | ||
export const PreferencesManager = GObject.registerClass( | ||
class UnitePreferences extends Gio.Settings { | ||
get window_buttons_position() { | ||
let setting = this.get_string('button-layout') | ||
|
@@ -118,24 +111,11 @@ var PreferencesManager = GObject.registerClass( | |
} | ||
) | ||
|
||
function initTranslations(domain) { | ||
let textDomain = domain || Me.metadata['gettext-domain'] | ||
let localeDir = Me.dir.get_child('locale') | ||
|
||
if (localeDir.query_exists(null)) { | ||
localeDir = localeDir.get_path() | ||
} else { | ||
localeDir = Config.LOCALEDIR | ||
} | ||
|
||
Gettext.bindtextdomain(textDomain, localeDir) | ||
} | ||
|
||
function getSettings(schema) { | ||
schema = schema || Me.metadata['settings-schema'] | ||
export function getSettings(schema) { | ||
schema = schema || 'org.gnome.shell.extensions.unite' | ||
|
||
let gioSSS = Gio.SettingsSchemaSource | ||
let schemaDir = Me.dir.get_child('schemas') | ||
let schemaDir = getDir().get_child('schemas') | ||
let schemaSource = gioSSS.get_default() | ||
|
||
if (schemaDir.query_exists(null)) { | ||
|
@@ -146,7 +126,7 @@ function getSettings(schema) { | |
let schemaObj = schemaSource.lookup(schema, true) | ||
|
||
if (!schemaObj) { | ||
let metaId = Me.metadata.uuid | ||
let metaId = '[email protected]' | ||
let message = `Schema ${schema} could not be found for extension ${metaId}.` | ||
|
||
throw new Error(`${message} Please check your installation.`) | ||
|
@@ -155,12 +135,20 @@ function getSettings(schema) { | |
return new SettingsManager({ settings_schema: schemaObj }) | ||
} | ||
|
||
function getPreferences() { | ||
export function getPreferences() { | ||
let schemaId = 'org.gnome.desktop.wm.preferences' | ||
return new PreferencesManager({ schema_id: schemaId }) | ||
} | ||
|
||
function getInterface() { | ||
export function getInterface() { | ||
let schemaId = 'org.gnome.desktop.interface' | ||
return new SettingsObject({ schema_id: schemaId }) | ||
} | ||
|
||
export function getDir() { | ||
return Gio.File.new_for_uri(import.meta.url).get_parent() | ||
} | ||
|
||
export function getPath() { | ||
return getDir().get_path() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,40 @@ | ||
const GObject = imports.gi.GObject | ||
const Main = imports.ui.main | ||
const Me = imports.misc.extensionUtils.getCurrentExtension() | ||
const Handlers = Me.imports.handlers | ||
const PanelManager = Me.imports.panel.PanelManager | ||
const LayoutManager = Me.imports.layout.LayoutManager | ||
const WindowManager = Me.imports.window.WindowManager | ||
|
||
var UniteExtension = GObject.registerClass( | ||
class UniteExtension extends GObject.Object { | ||
_init() { | ||
this.panelManager = new PanelManager() | ||
this.layoutManager = new LayoutManager() | ||
this.windowManager = new WindowManager() | ||
} | ||
|
||
get focusWindow() { | ||
return this.windowManager.focusWindow | ||
} | ||
|
||
activate() { | ||
Handlers.resetGtkStyles() | ||
|
||
this.panelManager.activate() | ||
this.layoutManager.activate() | ||
this.windowManager.activate() | ||
|
||
Main.panel.add_style_class_name('unite-shell') | ||
} | ||
|
||
destroy() { | ||
Handlers.resetGtkStyles() | ||
|
||
this.panelManager.destroy() | ||
this.layoutManager.destroy() | ||
this.windowManager.destroy() | ||
|
||
Main.panel.remove_style_class_name('unite-shell') | ||
} | ||
import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js' | ||
import * as Main from 'resource:///org/gnome/shell/ui/main.js' | ||
import * as Handlers from './handlers.js' | ||
import { PanelManager } from './panel.js' | ||
import { LayoutManager } from './layout.js' | ||
import { WindowManager } from './window.js' | ||
|
||
export default class UniteExtension extends Extension { | ||
enable() { | ||
global.unite = this | ||
|
||
this.panelManager = new PanelManager() | ||
this.layoutManager = new LayoutManager() | ||
this.windowManager = new WindowManager() | ||
|
||
Handlers.resetGtkStyles() | ||
|
||
this.panelManager.activate() | ||
this.layoutManager.activate() | ||
this.windowManager.activate() | ||
|
||
Main.panel.add_style_class_name('unite-shell') | ||
} | ||
) | ||
|
||
function enable() { | ||
global.unite = new UniteExtension() | ||
global.unite.activate() | ||
} | ||
disable() { | ||
Handlers.resetGtkStyles() | ||
|
||
function disable() { | ||
global.unite.destroy() | ||
global.unite = null | ||
this.panelManager.destroy() | ||
this.layoutManager.destroy() | ||
this.windowManager.destroy() | ||
|
||
Main.panel.remove_style_class_name('unite-shell') | ||
|
||
global.unite = null | ||
} | ||
|
||
get focusWindow() { | ||
return this.windowManager.focusWindow | ||
} | ||
} |
Oops, something went wrong.