* renumber patch: 0103-convenience.js-has-been-removed-in-GNOME-extensions-.patch * renumber patch: 0104-Makefile-allow-shipping-convenience.js.patch (was 0005) * renumber patch: 0105-metadata.json-mark-GNOME-3.30-as-supported.patch (was 0004) * remove patch: 0006-Makefile-don-t-zip.patch * add patch: 0106-Fix-installation-instructions-matches-Ubuntu-18.04-T.patch OBS-URL: https://build.opensuse.org/package/show/Office/hamster-time-tracker?expand=0&rev=12
332 lines
15 KiB
Diff
332 lines
15 KiB
Diff
From 40d60553c99c7bafd36268039aa6a93c76c5cdc4 Mon Sep 17 00:00:00 2001
|
|
From: Martin Wilck <mwilck@suse.com>
|
|
Date: Thu, 9 May 2019 22:35:44 +0200
|
|
Subject: [PATCH 114/130] replace Lang.bind() with $(function).bind()
|
|
|
|
Code cleanup. Mostly gets rid of the Lang module.
|
|
Don't use arrow functions just yet.
|
|
---
|
|
extension/extension.js | 16 +++++++--------
|
|
extension/prefs.js | 7 +++----
|
|
extension/widgets/categoryTotalsWidget.js | 1 -
|
|
extension/widgets/factsBox.js | 7 +++----
|
|
extension/widgets/ongoingFactEntry.js | 9 ++++----
|
|
extension/widgets/panelWidget.js | 25 +++++++++++------------
|
|
extension/widgets/todaysFactsWidget.js | 11 +++++-----
|
|
7 files changed, 35 insertions(+), 41 deletions(-)
|
|
|
|
diff --git a/extension/extension.js b/extension/extension.js
|
|
index 532f19b..3168827 100644
|
|
--- a/extension/extension.js
|
|
+++ b/extension/extension.js
|
|
@@ -120,16 +120,16 @@ function Controller(extensionMeta) {
|
|
enable: function() {
|
|
this.shouldEnable = true;
|
|
new ApiProxy(Gio.DBus.session, 'org.gnome.Hamster', '/org/gnome/Hamster',
|
|
- Lang.bind(this, function(proxy) {
|
|
+ function(proxy) {
|
|
this.apiProxy = proxy;
|
|
this.deferred_enable();
|
|
- }));
|
|
+ }.bind(this));
|
|
new WindowsProxy(Gio.DBus.session, "org.gnome.Hamster.WindowServer",
|
|
"/org/gnome/Hamster/WindowServer",
|
|
- Lang.bind(this, function(proxy) {
|
|
+ function(proxy) {
|
|
this.windowsProxy = proxy;
|
|
this.deferred_enable();
|
|
- }));
|
|
+ }.bind(this));
|
|
},
|
|
|
|
deferred_enable: function() {
|
|
@@ -172,7 +172,7 @@ function Controller(extensionMeta) {
|
|
Gio.BusNameWatcherFlags.NONE, windowsProxy_appeared_callback.bind(this),
|
|
windowsProxy_vanished_callback.bind(this));
|
|
|
|
- this.apiProxy.connectSignal('ActivitiesChanged', Lang.bind(this, this.refreshActivities));
|
|
+ this.apiProxy.connectSignal('ActivitiesChanged', this.refreshActivities.bind(this));
|
|
this.refreshActivities();
|
|
|
|
Main.panel.menuManager.addMenu(this.panelWidget.menu);
|
|
@@ -181,7 +181,7 @@ function Controller(extensionMeta) {
|
|
Meta.KeyBindingFlags.NONE,
|
|
// Since Gnome 3.16, Shell.KeyBindingMode is replaced by Shell.ActionMode
|
|
Shell.KeyBindingMode ? Shell.KeyBindingMode.ALL : Shell.ActionMode.ALL,
|
|
- Lang.bind(this.panelWidget, this.panelWidget.toggle)
|
|
+ this.panelWidget.toggle.bind(this.panelWidget)
|
|
);
|
|
},
|
|
|
|
@@ -212,11 +212,11 @@ function Controller(extensionMeta) {
|
|
}
|
|
|
|
this.runningActivitiesQuery = true;
|
|
- controller.apiProxy.GetActivitiesRemote("", Lang.bind(this, function([response], err) {
|
|
+ controller.apiProxy.GetActivitiesRemote("", function([response], err) {
|
|
controller.runningActivitiesQuery = false;
|
|
controller.activities = response;
|
|
global.log('ACTIVITIES HAMSTER: ', controller.activities);
|
|
- }));
|
|
+ }.bind(this));
|
|
}
|
|
|
|
getActivities(this);
|
|
diff --git a/extension/prefs.js b/extension/prefs.js
|
|
index 608034a..3555673 100644
|
|
--- a/extension/prefs.js
|
|
+++ b/extension/prefs.js
|
|
@@ -25,7 +25,6 @@ const Gdk = imports.gi.Gdk;
|
|
const Gio = imports.gi.Gio;
|
|
const Gtk = imports.gi.Gtk;
|
|
const GObject = imports.gi.GObject;
|
|
-const Lang = imports.lang;
|
|
|
|
|
|
const ExtensionUtils = imports.misc.extensionUtils;
|
|
@@ -64,7 +63,7 @@ class HamsterSettingsWidget extends Gtk.VBox {
|
|
let placementComboRenderer = new Gtk.CellRendererText();
|
|
placementCombo.pack_start(placementComboRenderer, true);
|
|
placementCombo.add_attribute(placementComboRenderer, 'text', 0);
|
|
- placementCombo.connect('changed', Lang.bind(this, this._onPlacementChange));
|
|
+ placementCombo.connect('changed', this._onPlacementChange.bind(this));
|
|
placementCombo.set_active(this._settings.get_int("panel-placement"));
|
|
|
|
vbox.add(placementCombo);
|
|
@@ -89,7 +88,7 @@ class HamsterSettingsWidget extends Gtk.VBox {
|
|
let appearanceComboRenderer = new Gtk.CellRendererText();
|
|
appearanceCombo.pack_start(appearanceComboRenderer, true);
|
|
appearanceCombo.add_attribute(appearanceComboRenderer, 'text', 0);
|
|
- appearanceCombo.connect('changed', Lang.bind(this, this._onAppearanceChange));
|
|
+ appearanceCombo.connect('changed', this._onAppearanceChange.bind(this));
|
|
appearanceCombo.set_active(this._settings.get_int("panel-appearance"));
|
|
|
|
vbox.add(appearanceCombo);
|
|
@@ -106,7 +105,7 @@ class HamsterSettingsWidget extends Gtk.VBox {
|
|
margin_top: 5,
|
|
text: this._settings.get_strv("show-hamster-dropdown")[0]});
|
|
vbox.add(entry);
|
|
- entry.connect('changed', Lang.bind(this, this._onHotkeyChange));
|
|
+ entry.connect('changed', this._onHotkeyChange.bind(this));
|
|
|
|
vbox.add(new Gtk.Label({label: "Reload gnome shell after updating prefs (alt+f2 > r)",
|
|
margin_top: 70}));
|
|
diff --git a/extension/widgets/categoryTotalsWidget.js b/extension/widgets/categoryTotalsWidget.js
|
|
index 17af747..88f9b96 100644
|
|
--- a/extension/widgets/categoryTotalsWidget.js
|
|
+++ b/extension/widgets/categoryTotalsWidget.js
|
|
@@ -21,7 +21,6 @@ Copyright (c) 2016 - 2018 Eric Goller / projecthamster <elbenfreund@projecthamst
|
|
*/
|
|
|
|
|
|
-const Lang = imports.lang;
|
|
const St = imports.gi.St;
|
|
const Clutter = imports.gi.Clutter;
|
|
const GLib = imports.gi.GLib;
|
|
diff --git a/extension/widgets/factsBox.js b/extension/widgets/factsBox.js
|
|
index aa5a336..5deb703 100644
|
|
--- a/extension/widgets/factsBox.js
|
|
+++ b/extension/widgets/factsBox.js
|
|
@@ -21,7 +21,6 @@ Copyright (c) 2016 - 2018 Eric Goller / projecthamster <elbenfreund@projecthamst
|
|
*/
|
|
|
|
|
|
-const Lang = imports.lang;
|
|
const St = imports.gi.St;
|
|
const PopupMenu = imports.ui.popupMenu;
|
|
const Clutter = imports.gi.Clutter;
|
|
@@ -62,7 +61,7 @@ class FactsBox extends PopupMenu.PopupBaseMenuItem {
|
|
main_box.add(_ongoingFactLabel);
|
|
|
|
this.ongoingFactEntry = new OngoingFactEntry(this._controller);
|
|
- //this.ongoingFactEntry.clutter_text.connect('key-release-event', Lang.bind(this, this._onKeyReleaseEvent));
|
|
+ //this.ongoingFactEntry.clutter_text.connect('key-release-event', this._onKeyReleaseEvent.bind(this));
|
|
main_box.add(this.ongoingFactEntry);
|
|
|
|
let fact_list_label = new St.Label({style_class: 'hamster-box-label'});
|
|
@@ -95,10 +94,10 @@ class FactsBox extends PopupMenu.PopupBaseMenuItem {
|
|
* Focus the fact entry and make sure todaysFactsWidget are scrolled to the bottom.
|
|
*/
|
|
focus() {
|
|
- Mainloop.timeout_add(20, Lang.bind(this, function() {
|
|
+ Mainloop.timeout_add(20, function() {
|
|
this._scrollAdjustment.value = this._scrollAdjustment.upper;
|
|
global.stage.set_key_focus(this.ongoingFactEntry);
|
|
- }));
|
|
+ }.bind(this));
|
|
}
|
|
|
|
/**
|
|
diff --git a/extension/widgets/ongoingFactEntry.js b/extension/widgets/ongoingFactEntry.js
|
|
index b90238e..688aa6b 100644
|
|
--- a/extension/widgets/ongoingFactEntry.js
|
|
+++ b/extension/widgets/ongoingFactEntry.js
|
|
@@ -21,7 +21,6 @@ Copyright (c) 2016 - 2018 Eric Goller / projecthamster <elbenfreund@projecthamst
|
|
*/
|
|
|
|
|
|
-const Lang = imports.lang;
|
|
const GObject = imports.gi.GObject;
|
|
const St = imports.gi.St;
|
|
const Clutter = imports.gi.Clutter;
|
|
@@ -56,8 +55,8 @@ class OngoingFactEntry extends St.Entry {
|
|
// Seems to be populate by GetActivities.
|
|
this._autocompleteActivities = [];
|
|
this._runningActivitiesQuery = null;
|
|
- this.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivated));
|
|
- this.clutter_text.connect('key-release-event', Lang.bind(this, this._onKeyReleaseEvent));
|
|
+ this.clutter_text.connect('activate', this._onEntryActivated.bind(this));
|
|
+ this.clutter_text.connect('key-release-event', this._onKeyReleaseEvent.bind(this));
|
|
}
|
|
|
|
/**
|
|
@@ -71,9 +70,9 @@ class OngoingFactEntry extends St.Entry {
|
|
*/
|
|
_onEntryActivated() {
|
|
let text = this.get_text();
|
|
- this._controller.apiProxy.AddFactRemote(text, 0, 0, false, Lang.bind(this, function(response, error) {
|
|
+ this._controller.apiProxy.AddFactRemote(text, 0, 0, false, function(response, error) {
|
|
// not interested in the new id - this shuts up the warning
|
|
- }));
|
|
+ }.bind(this));
|
|
this.set_text('');
|
|
}
|
|
|
|
diff --git a/extension/widgets/panelWidget.js b/extension/widgets/panelWidget.js
|
|
index de77f4a..905623a 100644
|
|
--- a/extension/widgets/panelWidget.js
|
|
+++ b/extension/widgets/panelWidget.js
|
|
@@ -21,7 +21,6 @@ Copyright (c) 2016 - 2018 Eric Goller / projecthamster <elbenfreund@projecthamst
|
|
*/
|
|
|
|
|
|
-const Lang = imports.lang;
|
|
const Gio = imports.gi.Gio;
|
|
const GObject = imports.gi.GObject;
|
|
const Clutter = imports.gi.Clutter;
|
|
@@ -70,8 +69,8 @@ class PanelWidget extends PanelMenu.Button {
|
|
this._settings = controller.settings;
|
|
this._windowsProxy = controller.windowsProxy;
|
|
|
|
- controller.apiProxy.connectSignal('FactsChanged', Lang.bind(this, this.refresh));
|
|
- controller.apiProxy.connectSignal('TagsChanged', Lang.bind(this, this.refresh));
|
|
+ controller.apiProxy.connectSignal('FactsChanged', this.refresh.bind(this));
|
|
+ controller.apiProxy.connectSignal('TagsChanged', this.refresh.bind(this));
|
|
|
|
|
|
// Setup the main layout container for the part of the extension
|
|
@@ -103,41 +102,41 @@ class PanelWidget extends PanelMenu.Button {
|
|
|
|
// overview
|
|
let overviewMenuItem = new PopupMenu.PopupMenuItem(_("Show Overview"));
|
|
- overviewMenuItem.connect('activate', Lang.bind(this, this._onOpenOverview));
|
|
+ overviewMenuItem.connect('activate', this._onOpenOverview.bind(this));
|
|
this.menu.addMenuItem(overviewMenuItem);
|
|
|
|
// [FIXME]
|
|
// This should only be shown if we have an 'ongoing fact'.
|
|
// stop tracking
|
|
let stopTrackinMenuItem = new PopupMenu.PopupMenuItem(_("Stop Tracking"));
|
|
- stopTrackinMenuItem.connect('activate', Lang.bind(this, this._onStopTracking));
|
|
+ stopTrackinMenuItem.connect('activate', this._onStopTracking.bind(this));
|
|
this.menu.addMenuItem(stopTrackinMenuItem);
|
|
|
|
// add new task
|
|
let addNewFactMenuItem = new PopupMenu.PopupMenuItem(_("Add Earlier Activity"));
|
|
- addNewFactMenuItem.connect('activate', Lang.bind(this, this._onOpenAddFact));
|
|
+ addNewFactMenuItem.connect('activate', this._onOpenAddFact.bind(this));
|
|
this.menu.addMenuItem(addNewFactMenuItem);
|
|
|
|
// settings
|
|
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
|
let SettingMenuItem = new PopupMenu.PopupMenuItem(_("Tracking Settings"));
|
|
- SettingMenuItem.connect('activate', Lang.bind(this, this._onOpenSettings));
|
|
+ SettingMenuItem.connect('activate', this._onOpenSettings.bind(this));
|
|
this.menu.addMenuItem(SettingMenuItem);
|
|
|
|
// focus menu upon display
|
|
- this.menu.connect('open-state-changed', Lang.bind(this,
|
|
+ this.menu.connect('open-state-changed',
|
|
function(menu, open) {
|
|
if (open) {
|
|
this.factsBox.focus();
|
|
} else {
|
|
this.factsBox.unfocus();
|
|
}
|
|
- }
|
|
- ));
|
|
+ }.bind(this)
|
|
+ );
|
|
|
|
// refresh the widget every 60 secs
|
|
- this.timeout = GLib.timeout_add_seconds(0, 60, Lang.bind(this, this.refresh));
|
|
- this.connect('destroy', Lang.bind(this, this._disableRefreshTimer));
|
|
+ this.timeout = GLib.timeout_add_seconds(0, 60, this.refresh.bind(this));
|
|
+ this.connect('destroy', this._disableRefreshTimer.bind(this));
|
|
this.refresh();
|
|
}
|
|
|
|
@@ -195,7 +194,7 @@ class PanelWidget extends PanelMenu.Button {
|
|
// This should really be a synchronous call fetching the facts.
|
|
// Once this is done, the actual code from the callback should follow
|
|
// here.
|
|
- this._controller.apiProxy.GetTodaysFactsRemote(Lang.bind(this, _refresh));
|
|
+ this._controller.apiProxy.GetTodaysFactsRemote(_refresh.bind(this));
|
|
return GLib.SOURCE_CONTINUE;
|
|
}
|
|
|
|
diff --git a/extension/widgets/todaysFactsWidget.js b/extension/widgets/todaysFactsWidget.js
|
|
index 1d8acf5..deafbdc 100644
|
|
--- a/extension/widgets/todaysFactsWidget.js
|
|
+++ b/extension/widgets/todaysFactsWidget.js
|
|
@@ -21,7 +21,6 @@ Copyright (c) 2016 - 2018 Eric Goller / projecthamster <elbenfreund@projecthamst
|
|
*/
|
|
|
|
|
|
-const Lang = imports.lang;
|
|
const St = imports.gi.St;
|
|
const Clutter = imports.gi.Clutter;
|
|
const GLib = imports.gi.GLib;
|
|
@@ -114,9 +113,9 @@ class TodaysFactsWidget extends St.ScrollView {
|
|
}
|
|
|
|
/* jshint validthis: true */
|
|
- controller.apiProxy.AddFactRemote(factStr, 0, 0, false, Lang.bind(this, function(response, err) {
|
|
+ controller.apiProxy.AddFactRemote(factStr, 0, 0, false, function(response, err) {
|
|
// not interested in the new id - this shuts up the warning
|
|
- }));
|
|
+ }.bind(this));
|
|
menu.close();
|
|
}
|
|
|
|
@@ -148,7 +147,7 @@ class TodaysFactsWidget extends St.ScrollView {
|
|
editButton.set_child(editIcon);
|
|
// [FIXME]
|
|
// Wouldn't it be cleaner to pass the fact as data payload to the callback binding?
|
|
- editButton.connect('clicked', Lang.bind(this, onOpenEditDialog));
|
|
+ editButton.connect('clicked', onOpenEditDialog.bind(this));
|
|
|
|
// Construct a 'start previous fact's activity as new' button.
|
|
// This is only done if the *ongoing fact* activity is actually
|
|
@@ -160,7 +159,7 @@ class TodaysFactsWidget extends St.ScrollView {
|
|
continueButton = new St.Button({style_class: 'clickable cell-button'});
|
|
continueButton.set_child(continueIcon);
|
|
continueButton.fact = fact;
|
|
- continueButton.connect('clicked', Lang.bind(this, onContinueButton));
|
|
+ continueButton.connect('clicked', onContinueButton.bind(this));
|
|
}
|
|
|
|
//The order of the array will be the order in which they will be added to the row.
|
|
@@ -176,7 +175,7 @@ class TodaysFactsWidget extends St.ScrollView {
|
|
let rowCount = 0;
|
|
let layout = this.facts_widget.layout_manager;
|
|
for (let fact of facts) {
|
|
- let rowComponents = Lang.bind(this, constructRow)(fact, ongoingFact, this._controller, this._panelWidget.menu);
|
|
+ let rowComponents = constructRow.bind(this)(fact, ongoingFact, this._controller, this._panelWidget.menu);
|
|
for (let component of rowComponents) {
|
|
layout.pack(component, rowComponents.indexOf(component), rowCount);
|
|
}
|
|
--
|
|
2.26.1
|
|
|