Skip to content

Commit

Permalink
Update alias of import modules
Browse files Browse the repository at this point in the history
extensionUtils.d.ts have been removed in gnome 45
  • Loading branch information
yilozt committed Nov 12, 2023
1 parent 97e2f9c commit 0426cf1
Show file tree
Hide file tree
Showing 12 changed files with 234 additions and 118 deletions.
50 changes: 50 additions & 0 deletions @imports/extensions/extension.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// auto generate by tsc:
// tsc -d --allowJs /path/to/source/of/gnome-shell/js/extensions/*

export class Extension extends ExtensionBase {
static lookupByUUID(uuid: any): any;
static defineTranslationFunctions(url: any): {
gettext: any;
ngettext: any;
pgettext: any;
};
enable(): void;
disable(): void;
/**
* Open the extension's preferences window
*/
openPreferences(): void;
}
export const gettext: any;
export const ngettext: any;
export const pgettext: any;
export class InjectionManager {
/**
* @callback CreateOverrideFunc
* @param {Function?} originalMethod - the original method if it exists
* @returns {Function} - a function to be used as override
*/
/**
* Modify, replace or inject a method
*
* @param {object} prototype - the object (or prototype) that is modified
* @param {string} methodName - the name of the overwritten method
* @param {CreateOverrideFunc} createOverrideFunc - function to call to create the override
*/
overrideMethod(prototype: object, methodName: string, createOverrideFunc: (originalMethod: Function | null) => Function): void;
/**
* Restore the original method
*
* @param {object} prototype - the object (or prototype) that is modified
* @param {string} methodName - the name of the method to restore
*/
restoreMethod(prototype: object, methodName: string): void;
/**
* Restore all original methods and clear overrides
*/
clear(): void;
_saveMethod(prototype: any, methodName: any): any;
_installMethod(prototype: any, methodName: any, method: any): void;
#private;
}
import { ExtensionBase } from './sharedInternals.js';
35 changes: 35 additions & 0 deletions @imports/extensions/prefs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as Gtk from '@gi-types/gtk4'
import * as Adw from '@gi-types/adw1'

// auto generate by tsc:
// tsc -d --allowJs /path/to/source/of/gnome-shell/js/extensions/*

export class ExtensionPreferences extends ExtensionBase {
static lookupByUUID(uuid: any): any;
static defineTranslationFunctions(url: any): {
gettext: any;
ngettext: any;
pgettext: any;
};
/**
* Get the single widget that implements
* the extension's preferences.
*
* @returns {Gtk.Widget}
*/
getPreferencesWidget(): Gtk.Widget;
/**
* Fill the preferences window with preferences.
*
* The default implementation adds the widget
* returned by getPreferencesWidget().
*
* @param {Adw.PreferencesWindow} window - the preferences window
*/
fillPreferencesWindow(window: Adw.PreferencesWindow): void;
_wrapWidget(widget: any): any;
}
export const gettext: any;
export const ngettext: any;
export const pgettext: any;
import { ExtensionBase } from './sharedInternals.js';
119 changes: 119 additions & 0 deletions @imports/extensions/sharedInternals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import * as Gio from '@gi-types/gio2'

// auto generate by tsc:
// tsc -d --allowJs /path/to/source/of/gnome-shell/js/extensions/*

export class ExtensionBase {
/**
* Look up an extension by URL (usually 'import.meta.url')
*
* @param {string} url - a file:// URL
*/
static lookupByURL(url: string): ExtensionBase;
/**
* Look up an extension by UUID
*
* @param {string} _uuid
*/
static lookupByUUID(_uuid: string): void;
/**
* @param {object} metadata - metadata passed in when loading the extension
*/
constructor(metadata: object);
metadata: any;
/**
* @type {string}
*/
get uuid(): string;
/**
* @type {Gio.File}
*/
get dir(): Gio.File;
/**
* @type {string}
*/
get path(): string;
/**
* Get a GSettings object for schema, using schema files in
* extensionsdir/schemas. If schema is omitted, it is taken
* from metadata['settings-schema'].
*
* @param {string=} schema - the GSettings schema id
*
* @returns {Gio.Settings}
*/
getSettings(schema?: string | undefined): Gio.Settings;
/**
* Initialize Gettext to load translations from extensionsdir/locale. If
* domain is not provided, it will be taken from metadata['gettext-domain']
* if provided, or use the UUID
*
* @param {string=} domain - the gettext domain to use
*/
initTranslations(domain?: string | undefined): void;
/**
* Translate `str` using the extension's gettext domain
*
* @param {string} str - the string to translate
*
* @returns {string} the translated string
*/
gettext(str: string): string;
/**
* Translate `str` and choose plural form using the extension's
* gettext domain
*
* @param {string} str - the string to translate
* @param {string} strPlural - the plural form of the string
* @param {number} n - the quantity for which translation is needed
*
* @returns {string} the translated string
*/
ngettext(str: string, strPlural: string, n: number): string;
/**
* Translate `str` in the context of `context` using the extension's
* gettext domain
*
* @param {string} context - context to disambiguate `str`
* @param {string} str - the string to translate
*
* @returns {string} the translated string
*/
pgettext(context: string, str: string): string;
#private;
}
export class GettextWrapper {
constructor(extensionClass: any, url: any);
defineTranslationFunctions(): {
/**
* Translate `str` using the extension's gettext domain
*
* @param {string} str - the string to translate
*
* @returns {string} the translated string
*/
gettext: any;
/**
* Translate `str` and choose plural form using the extension's
* gettext domain
*
* @param {string} str - the string to translate
* @param {string} strPlural - the plural form of the string
* @param {number} n - the quantity for which translation is needed
*
* @returns {string} the translated string
*/
ngettext: any;
/**
* Translate `str` in the context of `context` using the extension's
* gettext domain
*
* @param {string} context - context to disambiguate `str`
* @param {string} str - the string to translate
*
* @returns {string} the translated string
*/
pgettext: any;
};
#private;
}
91 changes: 0 additions & 91 deletions @imports/misc/extensionUtils.d.ts

This file was deleted.

5 changes: 3 additions & 2 deletions @imports/ui/lookingGlass.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as St from '@gi/St'
import * as Clutter from '@gi/Clutter'
import * as St from 'gi://St'
import * as Clutter from 'gi://Clutter'
export class Inspector extends Clutter.Actor {
constructor(looking_glass: any)
connect(signal: 'closed', cb: any);
open();
connect(signal: 'target', cb: (me: Inspector, target: Clutter.Actor, stageX: number, stageY: number) => void);
Expand Down
2 changes: 1 addition & 1 deletion @imports/ui/main.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LookingGlass } from "./lookingGlass";
import * as GObject from '@gi/GObject'
import * as GObject from 'gi://GObject'

export const createLookingGlass: () => LookingGlass;

Expand Down
4 changes: 2 additions & 2 deletions @imports/ui/windowManager.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WindowActor } from '@gi/Meta';
import { WM } from '@gi/Shell'
import { WindowActor } from 'gi://Meta';
import { WM } from 'gi://Shell'

declare function getWindowDimmer(actor: any): any;

Expand Down
7 changes: 4 additions & 3 deletions @imports/ui/windowPreview.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as Shell from '@gi/Shell'
import * as Meta from '@gi/Meta'
import * as Shell from 'gi://Shell'
import * as Meta from 'gi://Meta'

export class WindowPreview extends Shell.WindowPreview {
export class WindowPreview extends Shell.WindowPreview {
[x: string]: any
_addWindow (_: Meta.Window): void;
_windowActor: Meta.WindowActor
}
4 changes: 2 additions & 2 deletions @imports/ui/workspace.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Window } from '@gi/Meta'
import { Window } from 'gi://Meta'
import { WindowPreview } from './windowPreview'
import { Actor } from '@gi/Clutter';
import { Actor } from 'gi://Clutter';

export class Workspace extends Actor {
_addWindowClone(metaWindow: Window): WindowPreview;
Expand Down
4 changes: 2 additions & 2 deletions @imports/ui/workspaceAnimation.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Window, WindowActor } from '@gi/Meta'
import { Actor, Clone } from '@gi/Clutter'
import { Window, WindowActor } from 'gi://Meta'
import { Actor, Clone } from 'gi://Clutter'

export class WorkspaceAnimationController {
_movingWindow: Window;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "GPL-3.0-or-later",
"main": "src/extension.ts",
"devDependencies": {
"@gi-types/adw1": "^1.1.1",
"@gi-types/gtk4": "^4.6.1",
"@gi-types/meta10": "^10.0.1",
"@gi-types/shell0": "^0.1.1",
Expand All @@ -18,7 +19,6 @@
"gulp-cli": "^2.3.0",
"gulp-eslint-new": "^1.5.1",
"gulp-fill-pot-po": "^2.0.2",
"gulp-potomo": "^1.1.0",
"gulp-preserve-typescript-whitespace": "^1.0.3",
"gulp-prettier": "^4.0.0",
"gulp-rename": "^2.0.0",
Expand Down
Loading

0 comments on commit 0426cf1

Please sign in to comment.