From 3dc752331d19de369a00104648d55f6b5dce4dda Mon Sep 17 00:00:00 2001 From: Thomas Florio Date: Wed, 2 Oct 2024 10:15:26 +0200 Subject: [PATCH] Use correct Clutter classes --- src/main/typescript/widget/GitHubWidget.ts | 2 +- src/main/typescript/widget/WidgetController.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/typescript/widget/GitHubWidget.ts b/src/main/typescript/widget/GitHubWidget.ts index 9ebe12a..37f36b6 100644 --- a/src/main/typescript/widget/GitHubWidget.ts +++ b/src/main/typescript/widget/GitHubWidget.ts @@ -56,7 +56,7 @@ export class GitHubWidget extends Button { private readonly label: St.Label; public constructor(defaultIcon: Gio.Icon, initialText: string = '') { - super(0, 'GithubManagerButton', true); + super(0.5, 'GithubManagerButton', true); this.styleClass = 'github-widget-button'; diff --git a/src/main/typescript/widget/WidgetController.ts b/src/main/typescript/widget/WidgetController.ts index 0958146..769e156 100644 --- a/src/main/typescript/widget/WidgetController.ts +++ b/src/main/typescript/widget/WidgetController.ts @@ -1,3 +1,4 @@ +import Clutter from '@girs/clutter-15'; import Gdk from '@girs/gdk-4.0'; import Gio from '@girs/gio-2.0'; import { Extension } from '@girs/gnome-shell/dist/extensions/extension'; @@ -22,7 +23,7 @@ export class WidgetController implements Disposable { public constructor(settings: SettingsWrapper, eventDispatcher: EventDispatcher, githubIcon: Gio.Icon) { this.settings = settings; this.widget = new GitHubWidget(githubIcon, '0'); - this.buttonPressId = this.widget.connect('button-press-event', (_: this, event: Gdk.ButtonEvent) => + this.buttonPressId = this.widget.connect('button-press-event', (_: this, event: Clutter.Event): boolean => this.handleButtonPress(event) ); @@ -51,9 +52,9 @@ export class WidgetController implements Disposable { this.widget.text = text; } - private handleButtonPress(event: Gdk.ButtonEvent): void { + private handleButtonPress(event: Clutter.Event): boolean { switch (event.get_button()) { - case Gdk.BUTTON_PRIMARY: + case Clutter.BUTTON_PRIMARY: try { let url = `https://${this.settings.domain}/notifications`; if (this.settings.showParticipatingOnly) { @@ -65,10 +66,12 @@ export class WidgetController implements Disposable { WidgetController.LOGGER.error('Cannot open uri', e); } break; - case Gdk.BUTTON_SECONDARY: + case Clutter.BUTTON_SECONDARY: this.openPreferences(); break; } + + return true; } private updateNotificationCount(notificationCount?: number): void {