Control: tags 1052101 + patch Control: tags 1052101 + pending
Dear maintainer, I've prepared an NMU for gnome-shell-extension-hamster (versioned as 0.10.0+git20240714-0.1) and uploaded it to DELAYED/10. Please feel free to tell me if I should delay it longer. The debdiff is available as MRs for the affected branches: master: https://salsa.debian.org/projecthamster-team/gnome-shell-extension-hamster/-/merge_requests/4 upstream: https://salsa.debian.org/projecthamster-team/gnome-shell-extension-hamster/-/merge_requests/5 pristine-tar https://salsa.debian.org/projecthamster-team/gnome-shell-extension-hamster/-/merge_requests/6 -- Regards, tobi
diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/data/metadata.json.in gnome-shell-extension-hamster-0.10.0+git20240714/data/metadata.json.in --- gnome-shell-extension-hamster-0.10.0+git20230901/data/metadata.json.in 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/data/metadata.json.in 2024-04-09 15:09:59.000000000 +0200 @@ -10,14 +10,8 @@ "gettext-domain": "hamster-shell-extension", "settings-schema": "org.gnome.shell.extensions.project-hamster", "shell-version": [ - "3.34", - "3.36", - "3.38", - "40", - "41", - "42", - "43", - "44" + "45", + "46" ], "url": "https://github.com/projecthamster/hamster-shell-extension.git", "uuid": @UUID@ diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/data/schemas/org.gnome.shell.extensions.project-hamster.gschema.xml gnome-shell-extension-hamster-0.10.0+git20240714/data/schemas/org.gnome.shell.extensions.project-hamster.gschema.xml --- gnome-shell-extension-hamster-0.10.0+git20230901/data/schemas/org.gnome.shell.extensions.project-hamster.gschema.xml 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/data/schemas/org.gnome.shell.extensions.project-hamster.gschema.xml 2024-04-09 15:09:59.000000000 +0200 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<schemalist> +<schemalist gettext-domain="hamster-shell-extension"> <schema id="org.gnome.shell.extensions.project-hamster" path="/org/gnome/shell/extensions/project-hamster/"> <key name="panel-placement" type="i"> <default>0</default> <summary>Placement in the panel.</summary> - <description>Position to place extension at. 0 - default, 1 - replace calendar, 2 - replace activities.</description> + <description>Position to place extension at. 0 - default, 1 - replace calendar, 2 - replace activities, 3 - Center, next to calendar.</description> </key> <key name="panel-appearance" type="i"> diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/debian/changelog gnome-shell-extension-hamster-0.10.0+git20240714/debian/changelog --- gnome-shell-extension-hamster-0.10.0+git20230901/debian/changelog 2023-09-01 08:43:28.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/debian/changelog 2024-07-14 09:43:35.000000000 +0200 @@ -1,3 +1,12 @@ +gnome-shell-extension-hamster (0.10.0+git20240714-0.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * New upstream git snaphsot with GNOME Shell 46 compat. (Closes: #1052101) + * Update version constraints on gnome-shell, as this version is only + compatible with GNOME Shell 45 and up. + + -- Tobias Frost <t...@debian.org> Sun, 14 Jul 2024 09:43:35 +0200 + gnome-shell-extension-hamster (0.10.0+git20230901-1) unstable; urgency=medium * New upstream git snapshot with GNOME Shell 44 compat. (Closes: #1041574) diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/debian/control gnome-shell-extension-hamster-0.10.0+git20240714/debian/control --- gnome-shell-extension-hamster-0.10.0+git20230901/debian/control 2023-09-01 08:43:28.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/debian/control 2024-07-14 09:43:35.000000000 +0200 @@ -18,8 +18,8 @@ Architecture: all Depends: hamster-time-tracker, - gnome-shell (>= 3.38), - gnome-shell (<< 45~), + gnome-shell (>= 45), + gnome-shell (<< 47~), ${misc:Depends} Description: GNOME Shell extension for the Hamster Time Tracker Project Hamster helps you to keep track of how much time you spend on various diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/extension.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/extension.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/extension.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/extension.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,18 +21,14 @@ */ -const GLib = imports.gi.GLib; -const Shell = imports.gi.Shell; -const Meta = imports.gi.Meta; -const Main = imports.ui.main; -const Gio = imports.gi.Gio; - -const Gettext = imports.gettext.domain('hamster-shell-extension'); -const _ = Gettext.gettext; - -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const PanelWidget = Me.imports.widgets.panelWidget.PanelWidget; +import GLib from 'gi://GLib'; +import Shell from 'gi://Shell'; +import Meta from 'gi://Meta'; +import Gio from 'gi://Gio'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; + +import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; +import PanelWidget from './widgets/panelWidget.js'; // dbus-send --session --type=method_call --print-reply --dest=org.gnome.Hamster /org/gnome/Hamster org.freedesktop.DBus.Introspectable.Introspect const ApiProxyIface = ['', @@ -92,11 +88,11 @@ * * @class */ -class Controller { +export default class Controller extends Extension { constructor(extensionMeta) { let dateMenu = Main.panel.statusArea.dateMenu; - this.extensionMeta = extensionMeta; + super(extensionMeta); this.panelWidget = null; this.settings = null; this.placement = 0; @@ -140,7 +136,7 @@ if (!this.shouldEnable || !this.apiProxy || !this.windowsProxy) return; - this.settings = ExtensionUtils.getSettings(); + this.settings = this.getSettings(); this.panelWidget = new PanelWidget(this); this.placement = this.settings.get_int("panel-placement"); @@ -191,7 +187,7 @@ this.shouldEnable = false; Main.wm.removeKeybinding("show-hamster-dropdown"); - global.log('Shutting down hamster-shell-extension.'); + console.log('Shutting down hamster-shell-extension.'); this._removeWidget(this.placement); Main.panel.menuManager.removeMenu(this.panelWidget.menu); this.panelWidget.destroy(); @@ -213,7 +209,6 @@ this.reportIfError(_("Failed to get activities"), err); this.runningActivitiesQuery = false; this.activities = response; - // global.log('ACTIVITIES HAMSTER: ', this.activities); }.bind(this)); } @@ -224,7 +219,7 @@ reportIfError(msg, error) { if (error) { // Use toString, error can be a string, exception, etc. - global.log("error: Hamster: " + msg + ": " + error.toString()); + console.log("error: Hamster: " + msg + ": " + error.toString()); // Prefix msg to details (second argument), since the // details are word-wrapped and the title is not. Main.notify("Hamster: " + msg, msg + "\n" + error.toString()); @@ -243,7 +238,7 @@ // 'Replace calendar' Main.panel.addToStatusArea("hamster", this.panelWidget, 0, "center"); - Main.panel._centerBox.remove_actor(dateMenu.container); + Main.panel._centerBox.remove_child(dateMenu.container); Main.panel._addToPanelBox('dateMenu', dateMenu, -1, Main.panel._rightBox); } else if (placement == 2) { // 'Replace activities' @@ -266,27 +261,22 @@ _removeWidget(placement) { if (placement == 1) { // We replaced the calendar - Main.panel._rightBox.remove_actor(dateMenu.container); + Main.panel._rightBox.remove_child(dateMenu.container); Main.panel._addToPanelBox( 'dateMenu', dateMenu, Main.sessionMode.panel.center.indexOf('dateMenu'), Main.panel._centerBox ); - Main.panel._centerBox.remove_actor(this.panelWidget.container); + Main.panel._centerBox.remove_child(this.panelWidget.container); } else if (placement == 2) { // We replaced the 'Activities' menu let activitiesMenu = Main.panel._leftBox.get_children()[0].get_children()[0].get_children()[0].get_children()[0]; activitiesMenu.set_text(this._activitiesText); - Main.panel._leftBox.remove_actor(this.panelWidget.container); + Main.panel._leftBox.remove_child(this.panelWidget.container); } else { - Main.panel._rightBox.remove_actor(this.panelWidget.container); + Main.panel._rightBox.remove_child(this.panelWidget.container); } } } - -function init(extensionMeta) { - ExtensionUtils.initTranslations(); - return new Controller(extensionMeta); -} diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/prefs.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/prefs.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/prefs.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/prefs.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,167 +21,132 @@ */ -const Gdk = imports.gi.Gdk; -const Gio = imports.gi.Gio; -const Gtk = imports.gi.Gtk; -const GObject = imports.gi.GObject; - - -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); - -const HamsterSettingsWidget = GObject.registerClass( -class HamsterSettingsWidget extends Gtk.Grid { - _init(params) { - super._init(params); - - this.name = 'ProjectHamster.Prefs.HamsterSettingsWidget'; - - this.set_margin_bottom(18); - this.set_margin_end(18); - this.set_margin_start(18); - this.set_margin_top(18); - this.set_column_spacing(12); - this.set_row_spacing(12); - this.visible = true; - - this._settings = ExtensionUtils.getSettings(); - - let label = new Gtk.Label({ - label: "Positioning:", - halign: Gtk.Align.START, - visible: true - }); - this.attach(label, 0, 0, 1, 1); - - let placementOptions = new Gtk.ListStore(); - placementOptions.set_column_types([GObject.TYPE_STRING, GObject.TYPE_INT]); - - placementOptions.set(placementOptions.append(), [0, 1], ["Default", 0]); - placementOptions.set(placementOptions.append(), [0, 1], ["Replace calendar", 1]); - placementOptions.set(placementOptions.append(), [0, 1], ["Replace activities", 2]); - placementOptions.set(placementOptions.append(), [0, 1], ["Center, next to calendar", 3]); - - let placementCombo = new Gtk.ComboBox({ - model: placementOptions, - visible: true - }); - - let placementComboRenderer = new Gtk.CellRendererText(); - placementCombo.pack_start(placementComboRenderer, true); - placementCombo.add_attribute(placementComboRenderer, 'text', 0); - placementCombo.connect('changed', this._onPlacementChange.bind(this)); - placementCombo.set_active(this._settings.get_int("panel-placement")); - this.attach(placementCombo, 1, 0, 1, 1); - - label = new Gtk.Label({ - label: "Appearance in panel:", - halign: Gtk.Align.START, - visible: true - }); - this.attach(label, 0, 1, 1, 1); - - let appearanceOptions = new Gtk.ListStore(); - appearanceOptions.set_column_types([GObject.TYPE_STRING, GObject.TYPE_INT]); - - appearanceOptions.set(appearanceOptions.append(), [0, 1], ["Label", 0]); - appearanceOptions.set(appearanceOptions.append(), [0, 1], ["Icon", 1]); - appearanceOptions.set(appearanceOptions.append(), [0, 1], ["Label and icon", 2]); - - let appearanceCombo = new Gtk.ComboBox({ - model: appearanceOptions, - visible: true - }); - - let appearanceComboRenderer = new Gtk.CellRendererText(); - appearanceCombo.pack_start(appearanceComboRenderer, true); - appearanceCombo.add_attribute(appearanceComboRenderer, 'text', 0); - appearanceCombo.connect('changed', this._onAppearanceChange.bind(this)); - appearanceCombo.set_active(this._settings.get_int("panel-appearance")); - this.attach(appearanceCombo, 1, 1, 1, 1); - - label = new Gtk.Label({ - label: "Global hotkey:", - halign: Gtk.Align.START, - visible: true - }); - this.attach(label, 0, 2, 1, 1); - - let entry = new Gtk.Entry({ - margin_bottom: 10, - margin_top: 5, - text: this._settings.get_strv("show-hamster-dropdown")[0], - visible: true - }); - entry.connect('changed', this._onHotkeyChange.bind(this)); - this.attach(entry, 1, 2, 1, 1); - - label = new Gtk.Label({ - label: "Reload gnome shell after updating prefs (alt+f2 > r)", - halign: Gtk.Align.CENTER, - visible: true, - margin_top: 70 - }); - this.attach(label, 0, 3, 2, 1); - - let version_text = Me.metadata.version; - label = new Gtk.Label({ - label: "You are running hamster-shell-extension version " + version_text, - halign: Gtk.Align.CENTER, - visible: true, - margin_top: 10 - }); - this.attach(label, 0, 4, 2, 1); - } - - _onPlacementChange(widget) { - let [success, iter] = widget.get_active_iter(); - if (!success) - return; - - let newPlacement = widget.get_model().get_value(iter, 1); +import Adw from 'gi://Adw'; +import Gdk from 'gi://Gdk'; +import Gio from 'gi://Gio'; +import Gtk from 'gi://Gtk'; +import GObject from 'gi://GObject'; +import GLib from 'gi://GLib'; + +import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; + + +class HotkeyRow extends Adw.EntryRow { + static { + GObject.registerClass(this); + } + + constructor({ title, settings, bind }) { + super({ + title: title, + }); + + this.connect("apply", () => { + const hotkeys = this.get_text(); + + const mappings = hotkeys.split(",").map((x) => { + const [, key, mods] = Gtk.accelerator_parse(x); + return Gtk.accelerator_valid(key, mods) && Gtk.accelerator_name(key, mods); + }); + + if (mappings.every((x) => !!x)) { + console.log("HotkeyRow: good hotkey value ", hotkeys); + this.current = mappings; + settings.set_strv(bind, this.current); + } else { + console.log("invalid hotkey value ", hotkeys); + this.set_text(this.current.join(",")); + } + }); + + this.show_apply_button = true, + this.current = settings.get_strv(bind); + console.log("HotkeyRow current: ", bind, this.current); + this.set_text(this.current.join(",")); + } +} - if (this._settings.get_int("panel-placement") == newPlacement) - return; +class HamsterPrefsWidget extends Adw.PreferencesPage { - this._settings.set_int("panel-placement", newPlacement); + static { + GObject.registerClass(this); + } + + constructor(settings) { + super(); + this._settings = settings; + + this._actionGroup = new Gio.SimpleActionGroup(); + this.insert_action_group('hamster', this._actionGroup); + this._actionGroup.add_action( + this._settings.create_action('panel-placement')); + this._actionGroup.add_action( + this._settings.create_action('panel-appearance')); + + const placementGroup = new Adw.PreferencesGroup({ + title: _('Panel Placement'), + }); + this.add(placementGroup); + + const placements = [ + { p: 0, title: _("Default") }, + { p: 1, title: _("Replace calendar") }, + { p: 2, title: _("Replace activities") }, + { p: 3, title: _("Center, next to calendar") }, + ]; + + for (const {p, title} of placements) { + const btn = new Gtk.CheckButton({ + action_name: 'hamster.panel-placement', + action_target: new GLib.Variant('i', p), + }); + const row = new Adw.ActionRow({ + activatable_widget: btn, + title, + }); + row.add_prefix(btn); + placementGroup.add(row); } - _onAppearanceChange(widget) { - let [success, iter] = widget.get_active_iter(); - if (!success) - return; - - let newAppearance = widget.get_model().get_value(iter, 1); - - if (this._settings.get_int("panel-appearance") == newAppearance) - return; - - this._settings.set_int("panel-appearance", newAppearance); + const appearanceGroup = new Adw.PreferencesGroup({ + title: _('Panel Appearance'), + }); + this.add(appearanceGroup); + + const appearances = [ + { a: 0, title: _("Label") }, + { a: 1, title: _("Icon") }, + { a: 2, title: _("Label and icon") }, + ]; + + for (const {a, title} of appearances) { + const btn = new Gtk.CheckButton({ + action_name: 'hamster.panel-appearance', + action_target: new GLib.Variant('i', a), + }); + const row = new Adw.ActionRow({ + activatable_widget: btn, + title, + }); + row.add_prefix(btn); + appearanceGroup.add(row); } - _onHotkeyChange(widget, bananas) { - let hotkey = widget.get_text(); - let [key, mods] = [null, null]; - - if (Gtk.MAJOR_VERSION >= 4) { - let _r = null; - [_r, key, mods] = Gtk.accelerator_parse(hotkey); - } else { - [key, mods] = Gtk.accelerator_parse(hotkey); - } - - if (key != 0) { - let parsedName = Gtk.accelerator_name(key, mods); - this._settings.set_strv("show-hamster-dropdown", [parsedName]); - } + const miscGroup = new Adw.PreferencesGroup(); + this.add(miscGroup); - } -}); + let row = new HotkeyRow({ + title: _("Global hotkey"), + settings: this._settings, + bind: "show-hamster-dropdown", + }); -function init() { + miscGroup.add(row); + } } -function buildPrefsWidget() { - return new HamsterSettingsWidget(); +export default class HamsterPrefs extends ExtensionPreferences { + getPreferencesWidget() { + return new HamsterPrefsWidget(this.getSettings()); + } } diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/stuff.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/stuff.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/stuff.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/stuff.js 2024-04-09 15:09:59.000000000 +0200 @@ -29,7 +29,7 @@ * * @param {int} - Total amount of seconds to represent. */ -function formatDuration(total_seconds) { +export function formatDuration(total_seconds) { let hours = total_seconds / 3600; let remaining_seconds = total_seconds % 3600; // We only care for "full minutes". @@ -45,7 +45,7 @@ * * @param {int} - Total amount of seconds to represent. */ -function formatDurationHuman(total_seconds) { +export function formatDurationHuman(total_seconds) { let hours = total_seconds / 3600; let remaining_seconds = total_seconds % 3600; // We only care for "full minutes". @@ -75,7 +75,7 @@ * * @param {int} - Total amount of seconds to represent. */ -function formatDurationHours(seconds) { +export function formatDurationHours(seconds) { // We shift by one decimal place to the left in order to round properly. let hours = Math.round((seconds/3600)*10); // Shift right after rounding. @@ -85,7 +85,7 @@ // Other helper functions -function fromDbusFact(fact) { +export function fromDbusFact(fact) { // converts a fact coming from dbus into a usable object function UTCToLocal(timestamp) { // TODO - is this really the way?! @@ -108,7 +108,7 @@ return result; } -function fromDbusFacts(facts) { +export function fromDbusFacts(facts) { let res = []; for (var fact of facts) { res.push(fromDbusFact(fact)); diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/categoryTotalsWidget.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/categoryTotalsWidget.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/categoryTotalsWidget.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/categoryTotalsWidget.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,13 +21,11 @@ */ -const St = imports.gi.St; -const Clutter = imports.gi.Clutter; -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; - -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Stuff = Me.imports.stuff; +import St from 'gi://St'; +import Clutter from 'gi://Clutter'; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; +import * as Stuff from '../stuff.js' /** @@ -66,3 +64,5 @@ this.set_text(getString(facts)); } }); + +export default CategoryTotalsWidget; diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/factsBox.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/factsBox.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/factsBox.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/factsBox.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,23 +21,18 @@ */ -const St = imports.gi.St; -const PopupMenu = imports.ui.popupMenu; -const Clutter = imports.gi.Clutter; -const Mainloop = imports.mainloop; -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; - -const Gettext = imports.gettext.domain('hamster-shell-extension'); -const _ = Gettext.gettext; - -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Stuff = Me.imports.stuff; -const OngoingFactEntry = Me.imports.widgets.ongoingFactEntry.OngoingFactEntry; -const CategoryTotalsWidget = Me.imports.widgets.categoryTotalsWidget.CategoryTotalsWidget; -const TotalTimeWidget = Me.imports.widgets.totalTimeWidget.TotalTimeWidget; -const TodaysFactsWidget = Me.imports.widgets.todaysFactsWidget.TodaysFactsWidget; - +import St from 'gi://St'; +import Clutter from 'gi://Clutter'; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; + +import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; +import * as Stuff from '../stuff.js'; +import OngoingFactEntry from './ongoingFactEntry.js'; +import CategoryTotalsWidget from './categoryTotalsWidget.js'; +import TotalTimeWidget from './totalTimeWidget.js'; +import TodaysFactsWidget from './todaysFactsWidget.js'; /** * Create the widget that ``PanelWidget`` will use to dispay the *raw fact entry* as @@ -59,30 +54,29 @@ // Setup *ongoing fact* label and widget let _ongoingFactLabel = new St.Label({style_class: 'hamster-box-label'}); _ongoingFactLabel.set_text(_("What are you doing?")); - main_box.add(_ongoingFactLabel); + main_box.add_child(_ongoingFactLabel); this.ongoingFactEntry = new OngoingFactEntry(this._controller); //this.ongoingFactEntry.clutter_text.connect('key-release-event', this._onKeyReleaseEvent.bind(this)); - main_box.add(this.ongoingFactEntry); + main_box.add_child(this.ongoingFactEntry); let fact_list_label = new St.Label({style_class: 'hamster-box-label'}); fact_list_label.set_text(_("Today's activities")); - main_box.add(fact_list_label); + main_box.add_child(fact_list_label); // Scrollbox that will house the list of todays facts // Since ``St.Table`` does not implement St.Scrollable, we create a // container object that does. this.todaysFactsWidget = new TodaysFactsWidget(this._controller, panelWidget); this._scrollAdjustment = this.todaysFactsWidget.vscroll.adjustment; - main_box.add(this.todaysFactsWidget); + main_box.add_child(this.todaysFactsWidget); // Setup category summery this.summaryLabel = new CategoryTotalsWidget(); - main_box.add(this.summaryLabel); - + main_box.add_child(this.summaryLabel); // Setup total time this.totalTimeLabel = new TotalTimeWidget(); - main_box.add(this.totalTimeLabel); + main_box.add_child(this.totalTimeLabel); } // [FIXME] @@ -100,7 +94,7 @@ * Focus the fact entry and make sure todaysFactsWidget are scrolled to the bottom. */ focus() { - Mainloop.timeout_add(20, function() { + GLib.timeout_add(GLib.PRIORITY_DEFAULT, 20, function() { this._scrollAdjustment.value = this._scrollAdjustment.upper; global.stage.set_key_focus(this.ongoingFactEntry); }.bind(this)); @@ -113,3 +107,5 @@ global.stage.set_key_focus(null); } }); + +export default FactsBox; diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/ongoingFactEntry.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/ongoingFactEntry.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/ongoingFactEntry.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/ongoingFactEntry.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,15 +21,11 @@ */ -const GObject = imports.gi.GObject; -const St = imports.gi.St; -const Clutter = imports.gi.Clutter; - -const Gettext = imports.gettext.domain('hamster-shell-extension'); -const _ = Gettext.gettext; - -const Me = imports.misc.extensionUtils.getCurrentExtension(); +import GObject from 'gi://GObject'; +import St from 'gi://St'; +import Clutter from 'gi://Clutter'; +import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; /** * Custom Entry widget that allows entering a *raw fact* string for a new ongoing fact. @@ -186,3 +182,5 @@ } } }); + +export default OngoingFactEntry; diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/panelWidget.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/panelWidget.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/panelWidget.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/panelWidget.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,20 +21,17 @@ */ -const Gio = imports.gi.Gio; -const GObject = imports.gi.GObject; -const Clutter = imports.gi.Clutter; -const PanelMenu = imports.ui.panelMenu; -const St = imports.gi.St; -const PopupMenu = imports.ui.popupMenu; -const GLib = imports.gi.GLib; - -const Gettext = imports.gettext.domain('hamster-shell-extension'); -const _ = Gettext.gettext; - -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const FactsBox = Me.imports.widgets.factsBox.FactsBox; -const Stuff = Me.imports.stuff; +import Gio from 'gi://Gio'; +import GObject from 'gi://GObject'; +import Clutter from 'gi://Clutter'; +import St from 'gi://St'; +import GLib from 'gi://GLib'; +import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; + +import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; +import FactsBox from './factsBox.js'; +import * as Stuff from '../stuff.js'; /** * Class that defines the actual extension widget to be shown in the panel. @@ -65,7 +62,7 @@ this._controller = controller; // [FIXME] // Still needed? - this._extensionMeta = controller.extensionMeta; + this._extensionMeta = controller.metadata; this._settings = controller.settings; this._windowsProxy = controller.windowsProxy; @@ -78,7 +75,7 @@ let panelContainer = new St.BoxLayout({style_class: "panel-box"}); let _actor = (this instanceof Clutter.Actor ? this : this.actor); - _actor.add_actor(panelContainer); + _actor.add_child(panelContainer); _actor.add_style_class_name('panel-status-button'); this.panelLabel = new St.Label({ @@ -96,8 +93,8 @@ icon_size: 16, style_class: "panel-icon"}); - panelContainer.add(this.icon); - panelContainer.add(this.panelLabel); + panelContainer.add_child(this.icon); + panelContainer.add_child(this.panelLabel); this.factsBox = new FactsBox(controller, this); this.menu.addMenuItem(this.factsBox); @@ -125,6 +122,11 @@ SettingMenuItem.connect('activate', this._onOpenSettings.bind(this)); this.menu.addMenuItem(SettingMenuItem); + let ExtSettingMenuItem = new PopupMenu.PopupMenuItem(_("Extension Settings")); + ExtSettingMenuItem.connect('activate', + () => this._controller.openPreferences()); + this.menu.addMenuItem(ExtSettingMenuItem); + // focus menu upon display this.menu.connect('open-state-changed', function(menu, open) { @@ -336,3 +338,5 @@ } } }); + +export default PanelWidget; diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/todaysFactsWidget.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/todaysFactsWidget.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/todaysFactsWidget.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/todaysFactsWidget.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,17 +21,14 @@ */ -const St = imports.gi.St; -const Clutter = imports.gi.Clutter; -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; - -const Gettext = imports.gettext.domain('hamster-shell-extension'); -const _ = Gettext.gettext; - -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Stuff = Me.imports.stuff; - +import St from 'gi://St'; +import Clutter from 'gi://Clutter'; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; + +import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; +import * as Stuff from '../stuff.js'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; /** * A widget that lists all facts for *today*. @@ -51,8 +48,11 @@ layout_manager: new Clutter.GridLayout(), reactive: true }); - this.factsBox.add(this.facts_widget); - this.add_actor(this.factsBox); + this.factsBox.add_child(this.facts_widget); + if (Config.PACKAGE_VERSION.substring(0, 2) == "45") + this.add_actor(this.factsBox); + else + this.add_child(this.factsBox); } @@ -195,3 +195,5 @@ this.populateFactsWidget(facts, ongoingFact); } }); + +export default TodaysFactsWidget; diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/totalTimeWidget.js gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/totalTimeWidget.js --- gnome-shell-extension-hamster-0.10.0+git20230901/extension/widgets/totalTimeWidget.js 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/extension/widgets/totalTimeWidget.js 2024-04-09 15:09:59.000000000 +0200 @@ -21,32 +21,25 @@ Copyright (c) 2018 Thibaut Madelaine <madtibo_...@tribu-ml.fr> */ - -const Lang = imports.lang; -const St = imports.gi.St; -const Clutter = imports.gi.Clutter; -const GLib = imports.gi.GLib; - -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Stuff = Me.imports.stuff; - +import St from 'gi://St'; +import Clutter from 'gi://Clutter'; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; +import * as Stuff from '../stuff.js'; /** * Custom Label widget that displays total time. */ -var TotalTimeWidget = new Lang.Class({ - Name: 'TotalTime', - Extends: St.Label, - - _init: function() { - this.parent({style_class: 'summary-label'}); - - }, +var TotalTimeWidget = GObject.registerClass( + class TotalTime extends St.Label { + _init() { + super._init({style_class: 'summary-label'}); + } /** * Recompute values and replace old string with new one based on passed facts. */ - refresh: function(facts) { + refresh(facts) { /** * Construct a string representing today total. */ @@ -61,5 +54,7 @@ } this.set_text(getString(facts)); - }, + } }); + +export default TotalTimeWidget; diff -Nru gnome-shell-extension-hamster-0.10.0+git20230901/README.rst gnome-shell-extension-hamster-0.10.0+git20240714/README.rst --- gnome-shell-extension-hamster-0.10.0+git20230901/README.rst 2023-08-10 18:33:38.000000000 +0200 +++ gnome-shell-extension-hamster-0.10.0+git20240714/README.rst 2024-04-09 15:09:59.000000000 +0200 @@ -31,67 +31,41 @@ Install For Production ~~~~~~~~~~~~~~~~~~~~~~ -The extension is available on `the central extension repository <https://extensions.gnome.org/extension/425/project-hamster-extension>`_. -Current compatible Gnome shell versions: 3.34, 3.36. *This version is not compatible -with Gnome shell 3.32 and earlier.* -For previous shell versions check `releases <https://github.com/projecthamster/hamster-shell-extension/tags>`_. - -Creating a development environment -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -As ``hamster-shell-extension`` is mainly simple JS there is not much of a development -setup needed if you just want to get hacking right away. We do however provide -a few convenience functionalities that make documenting and releasing the extension -easier. For those purposes some additional python packages are required. -The easiest and cleanest way to go about this is to create a new virtual environment and activate -it:: +Please follow the instructions under +`Manual Installation For Testing and Development`_ below to install from git. +See `metadata.json.in`_ for GNOME shell compatibility status of the current branch. + +*Important:* The "Hamster Time Tracker" extension on +`extensions.gnome.org https://extensions.gnome.org/extension/425/project-hamster-extension/`_ +is *severely outdated*; it supports GNOME shell up to 3.20 only. There are +some other versions of this extension on extensions.gnome.org, but none of +them is supported by the current maintainers of the extension. - python3 -m venv .venv - source .venv/bin/activate - -Now you are all setup to run ``make develop`` and related make targets without -changing you main environment. +.. _metadata.json.in: data/metadata.json.in Manual Installation For Testing and Development ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Clone the repository:: git clone https://github.com/projecthamster/hamster-shell-extension.git Make sure you are on the development branch:: - git checkout develop + git switch -c develop origin/develop -Build a fresh distribution package:: - - make dist +To make this build available locally under your user account:: -This will create a distributable archive located in the ``dist/`` folder. + make install-user +To build a fresh distribution package (this will create a distributable archive located in the ``dist/`` folder):: -**Shortcut on** ``develop`` - -If you are using the ``develop`` branch since May 2020, you can run ``make -install-user`` to install your current working branch in your user environment -or ``make install`` for a system-wide installation. The ``DESTDIR`` variable -can be provided to ``make install`` to adjust the base installation path (it -defaults to ``DESTDIR=/usr/local``). + make dist -Otherwise, on other branches, follow the steps below to manually install the -distribution archive:: +Afterwards, enable the extension and change the preferences using the +*gnome-extensions* tool (on GNOME 3.34 and earlier, you need to use *gnome-tweak-tool*). - # Build - make dist - # Remove any old installation - rm -rf ~/.local/share/gnome-shell/extensions/cont...@projecthamster.org - # Create directory - mkdir -p ~/.local/share/gnome-shell/extensions/cont...@projecthamster.org - # Unpack build - tar xfz dist/cont...@projecthamster.org.tar.gz -C ~/.local/share/gnome-shell/extensions/cont...@projecthamster.org - -Afterwards, enable the extension and change the preferences using Tweak Tool, -or on ``https://extensions.gnome.org/local/``. On GNOME 3.36 and later, you -can also use the GNOME "Extensions" tool. Reloading the Extension ~~~~~~~~~~~~~~~~~~~~~~~
signature.asc
Description: PGP signature