[polari/wip/fmuellner/es6-classes: 2/4] Use method syntax
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/es6-classes: 2/4] Use method syntax
- Date: Fri, 27 Oct 2017 02:27:03 +0000 (UTC)
commit 4696f9d34cd348eaae21a3d103cbc79fe6e5dff8
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Oct 26 20:33:01 2017 +0200
Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for porting to ES6 classes.
Fixes https://gitlab.gnome.org/GNOME/polari/issues/14
src/accountsMonitor.js | 20 ++++----
src/appNotifications.js | 30 +++++------
src/application.js | 84 +++++++++++++++----------------
src/chatView.js | 128 +++++++++++++++++++++++------------------------
src/connections.js | 46 ++++++++---------
src/emojiPicker.js | 12 ++---
src/entryArea.js | 44 ++++++++--------
src/initialSetup.js | 12 ++---
src/ircParser.js | 14 +++---
src/joinDialog.js | 18 +++----
src/mainWindow.js | 34 ++++++-------
src/networksManager.js | 22 ++++----
src/pasteManager.js | 20 ++++----
src/polari-accounts.in | 8 +--
src/roomList.js | 70 +++++++++++++-------------
src/roomManager.js | 32 ++++++------
src/roomStack.js | 24 ++++-----
src/serverRoomManager.js | 34 ++++++-------
src/tabCompletion.js | 28 +++++------
src/telepathyClient.js | 70 +++++++++++++-------------
src/userList.js | 88 ++++++++++++++++----------------
src/userTracker.js | 64 ++++++++++++------------
22 files changed, 451 insertions(+), 451 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 65b3188..2fde77f 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -15,7 +15,7 @@ function getDefault() {
var AccountsMonitor = new Lang.Class({
Name: 'AccountsMonitor',
- _init: function() {
+ _init() {
this._accounts = new Map();
this._accountSettings = new Map();
@@ -47,11 +47,11 @@ var AccountsMonitor = new Lang.Class({
return this._accountManager;
},
- lookupAccount: function(accountPath) {
+ lookupAccount(accountPath) {
return this._accounts.get(accountPath);
},
- getAccountSettings: function(account) {
+ getAccountSettings(account) {
let accountPath = account.object_path;
let settings = this._accountSettings.get(accountPath);
if (settings)
@@ -64,7 +64,7 @@ var AccountsMonitor = new Lang.Class({
return settings;
},
- prepare: function(callback) {
+ prepare(callback) {
let quark = Tp.AccountManager.get_feature_quark_core();
if (this._accountManager.is_prepared(quark))
callback();
@@ -72,7 +72,7 @@ var AccountsMonitor = new Lang.Class({
this._preparedCallbacks.push(callback);
},
- _onPrepared: function(am, res) {
+ _onPrepared(am, res) {
try {
am.prepare_finish(res);
} catch(e) {
@@ -99,7 +99,7 @@ var AccountsMonitor = new Lang.Class({
this._preparedCallbacks.forEach(callback => { callback(); });
},
- _onPrepareShutdown: function() {
+ _onPrepareShutdown() {
let presence = Tp.ConnectionPresenceType.OFFLINE;
this.accounts.filter(a => a.requested_presence_type != presence).forEach(a => {
this._app.hold();
@@ -112,11 +112,11 @@ var AccountsMonitor = new Lang.Class({
});
},
- _shouldMonitorAccount: function(account) {
+ _shouldMonitorAccount(account) {
return account.protocol_name == 'irc';
},
- _addAccount: function(account) {
+ _addAccount(account) {
if (!this._shouldMonitorAccount(account))
return;
@@ -133,7 +133,7 @@ var AccountsMonitor = new Lang.Class({
this.emit('accounts-changed');
},
- _removeAccount: function(account) {
+ _removeAccount(account) {
if (!this._accounts.delete(account.object_path))
return;
@@ -144,7 +144,7 @@ var AccountsMonitor = new Lang.Class({
this.emit('accounts-changed');
},
- _accountEnabledChanged: function(am, account) {
+ _accountEnabledChanged(am, account) {
if (!this._accounts.has(account.object_path))
return;
this.emit(account.enabled ? 'account-enabled'
diff --git a/src/appNotifications.js b/src/appNotifications.js
index 1193ba7..455feda 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -14,18 +14,18 @@ var AppNotification = new Lang.Class({
Abstract: true,
Extends: Gtk.Revealer,
- _init: function() {
+ _init() {
this.parent({ reveal_child: true,
transition_type: Gtk.RevealerTransitionType.SLIDE_DOWN });
this.connect('notify::child-revealed',
Lang.bind(this, this._onChildRevealed));
},
- close: function() {
+ close() {
this.reveal_child = false;
},
- _onChildRevealed: function() {
+ _onChildRevealed() {
if (!this.child_revealed)
this.destroy();
}
@@ -35,7 +35,7 @@ var MessageNotification = new Lang.Class({
Name: 'MessageNotification',
Extends: AppNotification,
- _init: function(label, iconName) {
+ _init(label, iconName) {
this.parent();
Mainloop.timeout_add_seconds(TIMEOUT, Lang.bind(this, this.close));
@@ -58,7 +58,7 @@ var MessageNotification = new Lang.Class({
},
- addButton: function(label, callback) {
+ addButton(label, callback) {
let button = new Gtk.Button({ label: label, visible: true });
button.connect('clicked', () => {
if (callback)
@@ -75,7 +75,7 @@ var UndoNotification = new Lang.Class({
Extends: MessageNotification,
Signals: { closed: {}, undo: {} },
- _init: function(label) {
+ _init(label) {
this.parent(label);
this._undo = false;
@@ -89,12 +89,12 @@ var UndoNotification = new Lang.Class({
Lang.bind(this, this.close));
},
- close: function() {
+ close() {
this.emit(this._undo ? 'undo' : 'closed');
this.parent();
},
- _onDestroy: function() {
+ _onDestroy() {
if (this._shutdownId)
this._app.disconnect(this._shutdownId);
this._shutdownId = 0;
@@ -106,7 +106,7 @@ var CommandOutputNotification = new Lang.Class({
Extends: AppNotification,
Abstract: true,
- _init: function() {
+ _init() {
this.parent();
this.transition_type = Gtk.RevealerTransitionType.SLIDE_UP;
@@ -119,7 +119,7 @@ var SimpleOutput = new Lang.Class({
Name: 'SimpleOutput',
Extends: CommandOutputNotification,
- _init: function(text) {
+ _init(text) {
this.parent();
let label = new Gtk.Label({ label: text,
@@ -135,7 +135,7 @@ var GridOutput = new Lang.Class({
Name: 'GridOutput',
Extends: CommandOutputNotification,
- _init: function(header, items) {
+ _init(header, items) {
this.parent();
let numItems = items.length;
@@ -167,7 +167,7 @@ var NotificationQueue = new Lang.Class({
Name: 'NotificationQueue',
Extends: Gtk.Frame,
- _init: function() {
+ _init() {
this.parent({ valign: Gtk.Align.START,
halign: Gtk.Align.CENTER,
margin_start: 24, margin_end: 24,
@@ -179,14 +179,14 @@ var NotificationQueue = new Lang.Class({
this.add(this._grid);
},
- addNotification: function(notification) {
+ addNotification(notification) {
this._grid.add(notification);
notification.connect('destroy', Lang.bind(this, this._onChildDestroy));
this.show();
},
- _onChildDestroy: function() {
+ _onChildDestroy() {
if (this._grid.get_children().length == 0)
this.hide();
}
@@ -196,7 +196,7 @@ var CommandOutputQueue = new Lang.Class({
Name: 'CommandOutputQueue',
Extends: NotificationQueue,
- _init: function() {
+ _init() {
this.parent();
this.valign = Gtk.Align.END;
diff --git a/src/application.js b/src/application.js
index 6a7352b..894a7e4 100644
--- a/src/application.js
+++ b/src/application.js
@@ -32,7 +32,7 @@ var Application = new Lang.Class({
Signals: { 'prepare-shutdown': {},
'room-focus-changed': {} },
- _init: function() {
+ _init() {
this.parent({ application_id: 'org.gnome.Polari',
flags: Gio.ApplicationFlags.HANDLES_OPEN });
@@ -73,21 +73,21 @@ var Application = new Lang.Class({
});
},
- isRoomFocused: function(room) {
+ isRoomFocused(room) {
return this.active_window &&
this.active_window['is-active'] &&
this.active_window.active_room == room;
},
// Small wrapper to mark user-requested nick changes
- setAccountNick: function(account, nick) {
+ setAccountNick(account, nick) {
account.set_nickname_async(nick, (a, res) => {
account.set_nickname_finish(res);
});
this._untrackNominalNick(account);
},
- _checkService: function(conn, name, opath, iface) {
+ _checkService(conn, name, opath, iface) {
let flags = Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS;
let proxy = null;
@@ -100,7 +100,7 @@ var Application = new Lang.Class({
return proxy != null && proxy.get_name_owner() != null;
},
- _ensureService: function(conn, name, opath, iface, command) {
+ _ensureService(conn, name, opath, iface, command) {
debug('Trying to ensure service %s'.format(name));
if (this._checkService(conn, name, opath, iface))
@@ -118,7 +118,7 @@ var Application = new Lang.Class({
}
},
- vfunc_dbus_register: function(conn, path) {
+ vfunc_dbus_register(conn, path) {
if (!Utils.isFlatpakSandbox())
return true;
@@ -141,13 +141,13 @@ var Application = new Lang.Class({
return true;
},
- vfunc_dbus_unregister: function(conn, path) {
+ vfunc_dbus_unregister(conn, path) {
for (let proc of this._demons)
proc.force_exit();
this._demons = [];
},
- vfunc_startup: function() {
+ vfunc_startup() {
this.parent();
let actionEntries = [
@@ -281,7 +281,7 @@ var Application = new Lang.Class({
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
},
- vfunc_activate: function() {
+ vfunc_activate() {
this.activate_action('start-client', null);
if (!this.active_window) {
@@ -309,7 +309,7 @@ var Application = new Lang.Class({
this.active_window.present();
},
- vfunc_window_added: function(window) {
+ vfunc_window_added(window) {
this.parent(window);
if (!(window instanceof MainWindow.MainWindow))
@@ -326,7 +326,7 @@ var Application = new Lang.Class({
this._updateUserListAction();
},
- vfunc_open: function(files) {
+ vfunc_open(files) {
this.activate();
let time = Utils.getTpEventTime();
@@ -337,7 +337,7 @@ var Application = new Lang.Class({
});
},
- _openURIs: function(uris, time) {
+ _openURIs(uris, time) {
let map = {};
this._accountsMonitor.enabledAccounts.forEach(a => {
@@ -373,7 +373,7 @@ var Application = new Lang.Class({
});
},
- _parseURI: function(uri) {
+ _parseURI(uri) {
let server, port, room;
let success = false;
try {
@@ -389,7 +389,7 @@ var Application = new Lang.Class({
return [success, server, port, room];
},
- _createAccount: function(id, server, port, callback) {
+ _createAccount(id, server, port, callback) {
let params, name;
if (id) {
@@ -423,7 +423,7 @@ var Application = new Lang.Class({
});
},
- _touchFile: function(file) {
+ _touchFile(file) {
try {
file.get_parent().make_directory_with_parents(null);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
@@ -434,7 +434,7 @@ var Application = new Lang.Class({
stream.close(null);
},
- _needsInitialSetup: function() {
+ _needsInitialSetup() {
if (GLib.getenv('POLARI_FORCE_INITIAL_SETUP')) {
GLib.unsetenv('POLARI_FORCE_INITIAL_SETUP');
return true;
@@ -454,13 +454,13 @@ var Application = new Lang.Class({
return savedRooms.n_children() == 0;
},
- _updateUserListAction: function() {
+ _updateUserListAction() {
let room = this.active_window.active_room;
let action = this.lookup_action('user-list');
action.enabled = room && room.type == Tp.HandleType.ROOM && room.channel;
},
- _userListCreateHook: function(action) {
+ _userListCreateHook(action) {
action.connect('notify::enabled', () => {
if (!action.enabled)
action.change_state(GLib.Variant.new('b', false));
@@ -468,28 +468,28 @@ var Application = new Lang.Class({
action.enabled = false;
},
- _onShowJoinDialog: function() {
+ _onShowJoinDialog() {
this.active_window.showJoinRoomDialog();
},
- _maybePresent: function(time) {
+ _maybePresent(time) {
let [present, ] = Tp.user_action_time_should_present(time);
if (!this.active_window || present)
this.activate();
},
- _onJoinRoom: function(action, parameter) {
+ _onJoinRoom(action, parameter) {
let [accountPath, channelName, time] = parameter.deep_unpack();
this._maybePresent(time);
},
- _onMessageUser: function(action, parameter) {
+ _onMessageUser(action, parameter) {
let [accountPath, contactName, message, time] = parameter.deep_unpack();
this._maybePresent(time);
},
- _trackNominalNick: function(account) {
+ _trackNominalNick(account) {
if (this._nickTrackData.has(account))
return;
@@ -514,7 +514,7 @@ var Application = new Lang.Class({
this._nickTrackData.set(account, { tracker, contactsChangedId });
},
- _untrackNominalNick: function(account) {
+ _untrackNominalNick(account) {
let data = this._nickTrackData.get(account);
if (!data)
return;
@@ -523,7 +523,7 @@ var Application = new Lang.Class({
this._nickTrackData.delete(account);
},
- _ensureRetryData: function(account) {
+ _ensureRetryData(account) {
let data = this._retryData.get(account.object_path);
if (data)
return data;
@@ -547,19 +547,19 @@ var Application = new Lang.Class({
return data;
},
- _getTrimmedAccountName: function(account) {
+ _getTrimmedAccountName(account) {
let params = Connections.getAccountParams(account);
return params.account.replace(/_+$/, '');
},
- _restoreAccountName: function(account) {
+ _restoreAccountName(account) {
let accountName = this._getTrimmedAccountName(account);
let params = { account: new GLib.Variant('s', accountName) };
let asv = new GLib.Variant('a{sv}', params);
account.update_parameters_vardict_async(asv, [], null);
},
- _retryWithParams: function(account, params) {
+ _retryWithParams(account, params) {
account.update_parameters_vardict_async(params, [], () => {
let presence = Tp.ConnectionPresenceType.AVAILABLE;
let msg = account.requested_status_message;
@@ -567,7 +567,7 @@ var Application = new Lang.Class({
});
},
- _retryNickRequest: function(account) {
+ _retryNickRequest(account) {
let retryData = this._ensureRetryData(account);
if (retryData.retry++ >= MAX_RETRIES)
@@ -584,7 +584,7 @@ var Application = new Lang.Class({
return true;
},
- _retryServerRequest: function(account) {
+ _retryServerRequest(account) {
let retryData = this._ensureRetryData(account);
let server = retryData.alternateServers.shift();
@@ -599,7 +599,7 @@ var Application = new Lang.Class({
return true;
},
- _onAccountStatusChanged: function(mon, account) {
+ _onAccountStatusChanged(mon, account) {
let status = account.connection_status;
if (status == Tp.ConnectionStatus.CONNECTING)
@@ -632,7 +632,7 @@ var Application = new Lang.Class({
this._restoreAccountName(account);
},
- _onLeaveCurrentRoom: function() {
+ _onLeaveCurrentRoom() {
let room = this.active_window.active_room;
if (!room)
return;
@@ -640,7 +640,7 @@ var Application = new Lang.Class({
action.activate(GLib.Variant.new('(ss)', [room.id, '']));
},
- _onConnectAccount: function(action, parameter) {
+ _onConnectAccount(action, parameter) {
let accountPath = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
if (account)
@@ -648,12 +648,12 @@ var Application = new Lang.Class({
this._retryData.delete(accountPath);
},
- _onToggleAction: function(action) {
+ _onToggleAction(action) {
let state = action.get_state();
action.change_state(GLib.Variant.new('b', !state.get_boolean()));
},
- _onRemoveConnection: function(action, parameter){
+ _onRemoveConnection(action, parameter){
let accountPath = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
account.set_enabled_async(false, () => {
@@ -674,7 +674,7 @@ var Application = new Lang.Class({
});
},
- _onEditConnection: function(action, parameter) {
+ _onEditConnection(action, parameter) {
let accountPath = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
let dialog = new Connections.ConnectionProperties(account);
@@ -685,7 +685,7 @@ var Application = new Lang.Class({
dialog.show();
},
- _createLink: function(file, target) {
+ _createLink(file, target) {
try {
file.get_parent().make_directory_with_parents(null);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
@@ -695,7 +695,7 @@ var Application = new Lang.Class({
file.make_symbolic_link(target, null);
},
- _onRunInBackgroundChanged: function() {
+ _onRunInBackgroundChanged() {
let file = Gio.File.new_for_path(AUTOSTART_DIR + AUTOSTART_FILE);
if (this._settings.get_boolean('run-in-background'))
@@ -714,7 +714,7 @@ var Application = new Lang.Class({
}
},
- _onStartClient: function() {
+ _onStartClient() {
if (this._telepathyClient)
return;
@@ -726,11 +726,11 @@ var Application = new Lang.Class({
this._telepathyClient = new TelepathyClient.TelepathyClient(params);
},
- _onShowHelp: function() {
+ _onShowHelp() {
Utils.openURL('help:org.gnome.Polari', Gtk.get_current_event_time());
},
- _onShowAbout: function() {
+ _onShowAbout() {
if (this._aboutDialog) {
this._aboutDialog.present();
return;
@@ -778,7 +778,7 @@ var Application = new Lang.Class({
});
},
- _onQuit: function() {
+ _onQuit() {
if (this._windowRemovedId)
this.disconnect(this._windowRemovedId);
this._windowRemovedId = 0;
diff --git a/src/chatView.js b/src/chatView.js
index dbeb176..8b21f18 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -51,18 +51,18 @@ var TextView = new Lang.Class({
Name: 'TextView',
Extends: Gtk.TextView,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.buffer.connect('mark-set', Lang.bind(this, this._onMarkSet));
this.connect('screen-changed', Lang.bind(this, this._updateLayout));
},
- vfunc_get_preferred_width: function() {
+ vfunc_get_preferred_width() {
return [1, 1];
},
- vfunc_style_updated: function() {
+ vfunc_style_updated() {
let context = this.get_style_context();
context.save();
context.add_class('dim-label');
@@ -73,7 +73,7 @@ var TextView = new Lang.Class({
this.parent();
},
- vfunc_draw: function(cr) {
+ vfunc_draw(cr) {
this.parent(cr);
let mark = this.buffer.get_mark('indicator-line');
@@ -132,12 +132,12 @@ var TextView = new Lang.Class({
return Gdk.EVENT_PROPAGATE;
},
- _onMarkSet: function(buffer, iter, mark) {
+ _onMarkSet(buffer, iter, mark) {
if (mark.name == 'indicator-line')
this.queue_draw();
},
- _updateLayout: function() {
+ _updateLayout() {
this._layout = this.create_pango_layout(null);
this._layout.set_markup('<small><b>%s</b></small>'.format(_("New Messages")), -1);
}
@@ -169,7 +169,7 @@ var ButtonTag = new Lang.Class({
'clicked': { }
},
- _init: function(params) {
+ _init(params) {
this._hover = false;
this._pressed = false;
@@ -188,19 +188,19 @@ var ButtonTag = new Lang.Class({
this.notify('hover');
},
- on_notify: function(pspec) {
+ on_notify(pspec) {
if (pspec.name == 'hover' && !this.hover)
this._pressed = false;
},
- 'on_button-press-event': function(event) {
+ 'on_button-press-event'(event) {
let [, button] = event.get_button();
this._pressed = button == Gdk.BUTTON_PRIMARY;
return Gdk.EVENT_STOP;
},
- 'on_button-release-event': function(event) {
+ 'on_button-release-event'(event) {
let [, button] = event.get_button();
if (!(button == Gdk.BUTTON_PRIMARY && this._pressed))
return Gdk.EVENT_PROPAGATE;
@@ -210,7 +210,7 @@ var ButtonTag = new Lang.Class({
return Gdk.EVENT_STOP;
},
- vfunc_event: function(object, event, iter) {
+ vfunc_event(object, event, iter) {
let type = event.get_event_type();
if (!this._hover)
@@ -243,7 +243,7 @@ var HoverFilterTag = new Lang.Class({
0.0, 1.0, 1.0)
},
- _init: function(params) {
+ _init(params) {
this._filteredTag = null;
this._hoverOpacity = 1.;
@@ -252,7 +252,7 @@ var HoverFilterTag = new Lang.Class({
this.connect('notify::hover', () => { this._updateColor(); });
},
- _updateColor: function() {
+ _updateColor() {
if (!this._filteredTag)
return;
@@ -304,7 +304,7 @@ var ChatView = new Lang.Class({
0, GLib.MAXUINT32, 0)
},
- _init: function(room) {
+ _init(room) {
this.parent({ hscrollbar_policy: Gtk.PolicyType.NEVER, vexpand: true });
this.get_style_context().add_class('polari-chat-view');
@@ -429,7 +429,7 @@ var ChatView = new Lang.Class({
});
},
- _createTags: function() {
+ _createTags() {
let buffer = this._view.get_buffer();
let tagTable = buffer.get_tag_table();
let tags = [
@@ -464,7 +464,7 @@ var ChatView = new Lang.Class({
tags.forEach(tagProps => { tagTable.add(new Gtk.TextTag(tagProps)); });
},
- _onStyleUpdated: function() {
+ _onStyleUpdated() {
let context = this.get_style_context();
context.save();
context.add_class('dim-label');
@@ -530,7 +530,7 @@ var ChatView = new Lang.Class({
});
},
- _onDestroy: function() {
+ _onDestroy() {
for (let i = 0; i < this._channelSignals.length; i++)
this._channel.disconnect(this._channelSignals[i]);
this._channelSignals = [];
@@ -547,7 +547,7 @@ var ChatView = new Lang.Class({
this._logWalker = null;
},
- _onLogEventsReady: function(lw, res) {
+ _onLogEventsReady(lw, res) {
this._hideLoadingIndicator();
this._fetchingBacklog = false;
@@ -557,7 +557,7 @@ var ChatView = new Lang.Class({
this._insertPendingLogs();
},
- _createMessage: function(source) {
+ _createMessage(source) {
if (source instanceof Tp.Message) {
let [text, ] = source.to_text();
let [id, valid] = source.get_pending_message_id();
@@ -577,7 +577,7 @@ var ChatView = new Lang.Class({
throw new Error('Cannot create message from source ' + source);
},
- _getReadyLogs: function() {
+ _getReadyLogs() {
if (this._logWalker.is_end())
return this._pendingLogs.splice(0);
@@ -591,7 +591,7 @@ var ChatView = new Lang.Class({
return [];
},
- _appendInitialPending: function(logs) {
+ _appendInitialPending(logs) {
let pending = this._initialPending.splice(0);
let firstPending = pending[0];
@@ -608,7 +608,7 @@ var ChatView = new Lang.Class({
logs.splice.apply(logs, [pos, numLogs, ...pending]);
},
- _insertPendingLogs: function() {
+ _insertPendingLogs() {
let pending = this._getReadyLogs();
if (!pending.length) {
@@ -647,7 +647,7 @@ var ChatView = new Lang.Class({
return this._channel != null;
},
- _updateMaxNickChars: function(length) {
+ _updateMaxNickChars(length) {
if (length <= this._maxNickChars)
return;
@@ -656,7 +656,7 @@ var ChatView = new Lang.Class({
this._updateIndent();
},
- _updateIndent: function() {
+ _updateIndent() {
let context = this._view.get_pango_context();
let metrics = context.get_metrics(null, null);
let charWidth = Math.max(metrics.get_approximate_char_width(),
@@ -672,7 +672,7 @@ var ChatView = new Lang.Class({
this._view.left_margin = MARGIN + totalWidth;
},
- _updateScroll: function() {
+ _updateScroll() {
if (!this._autoscroll)
return;
@@ -686,7 +686,7 @@ var ChatView = new Lang.Class({
}
},
- _onScroll: function(w, event) {
+ _onScroll(w, event) {
let [hasDir, dir] = event.get_scroll_direction();
if (hasDir && dir != Gdk.ScrollDirection.UP)
return Gdk.EVENT_PROPAGATE;
@@ -700,7 +700,7 @@ var ChatView = new Lang.Class({
return this._fetchBacklog();
},
- _onKeyPress: function(w, event) {
+ _onKeyPress(w, event) {
let [, keyval] = event.get_keyval();
if (keyval === Gdk.KEY_Home ||
@@ -728,7 +728,7 @@ var ChatView = new Lang.Class({
return this._fetchBacklog();
},
- _fetchBacklog: function() {
+ _fetchBacklog() {
if (this.vadjustment.value != 0 ||
this._logWalker.is_end())
return Gdk.EVENT_PROPAGATE;
@@ -747,7 +747,7 @@ var ChatView = new Lang.Class({
return Gdk.EVENT_STOP;
},
- _onValueChanged: function() {
+ _onValueChanged() {
if (this._valueChangedId)
return;
@@ -758,14 +758,14 @@ var ChatView = new Lang.Class({
});
},
- _pendingMessageRemoved: function(channel, message) {
+ _pendingMessageRemoved(channel, message) {
let [id, valid] = message.get_pending_message_id();
if (!valid || !this._pending.has(id))
return;
this._removePendingMark(id);
},
- _removePendingMark: function(id) {
+ _removePendingMark(id) {
let mark = this._pending.get(id);
// Re-enable auto-scrolling if this is the most recent message
if (this._view.buffer.get_iter_at_mark(mark).is_end())
@@ -774,7 +774,7 @@ var ChatView = new Lang.Class({
this._pending.delete(id);
},
- _showUrlContextMenu: function(url, button, time) {
+ _showUrlContextMenu(url, button, time) {
let menu = new Gtk.Menu();
let item = new Gtk.MenuItem({ label: _("Open Link") });
@@ -794,7 +794,7 @@ var ChatView = new Lang.Class({
menu.popup(null, null, null, button, time);
},
- _handleButtonTagsHover: function(view, event) {
+ _handleButtonTagsHover(view, event) {
let [, eventX, eventY] = event.get_coords();
let [x, y] = view.window_to_buffer_coords(Gtk.TextWindowType.WIDGET,
eventX, eventY);
@@ -824,7 +824,7 @@ var ChatView = new Lang.Class({
return Gdk.EVENT_PROPAGATE;
},
- _showLoadingIndicator: function() {
+ _showLoadingIndicator() {
let indicator = new Gtk.Image({ icon_name: 'content-loading-symbolic',
visible: true });
indicator.get_style_context().add_class('dim-label');
@@ -840,7 +840,7 @@ var ChatView = new Lang.Class({
buffer.apply_tag(this._lookupTag('loading'), start, iter);
},
- _hideLoadingIndicator: function() {
+ _hideLoadingIndicator() {
let buffer = this._view.buffer;
let iter = buffer.get_start_iter();
@@ -851,7 +851,7 @@ var ChatView = new Lang.Class({
buffer.delete(buffer.get_start_iter(), iter);
},
- _setIndicatorMark: function(iter) {
+ _setIndicatorMark(iter) {
let lineStart = iter.copy();
lineStart.set_line_offset(0);
@@ -872,7 +872,7 @@ var ChatView = new Lang.Class({
this._needsIndicator = false;
},
- _checkMessages: function() {
+ _checkMessages() {
if (!this._app.isRoomFocused(this._room) || !this._channel)
return;
@@ -898,17 +898,17 @@ var ChatView = new Lang.Class({
}
},
- _getNickTagName: function(nick) {
+ _getNickTagName(nick) {
return NICKTAG_PREFIX + Polari.util_get_basenick(nick);
},
- _getNickFromTagName: function(tagName) {
+ _getNickFromTagName(tagName) {
if (tagName.startsWith(NICKTAG_PREFIX))
return tagName.replace(NICKTAG_PREFIX, '');
return null;
},
- _onChannelChanged: function() {
+ _onChannelChanged() {
if (this._channel == this._room.channel)
return;
@@ -950,19 +950,19 @@ var ChatView = new Lang.Class({
this._initialPending = pending.map(p => this._createMessage(p));
},
- _onMemberRenamed: function(room, oldMember, newMember) {
+ _onMemberRenamed(room, oldMember, newMember) {
let text = _("%s is now known as %s").format(oldMember.alias, newMember.alias);
this._insertStatus(text, oldMember.alias, 'renamed');
},
- _onMemberDisconnected: function(room, member, message) {
+ _onMemberDisconnected(room, member, message) {
let text = _("%s has disconnected").format(member.alias);
if (message)
text += ' (%s)'.format(message);
this._insertStatus(text, member.alias, 'left');
},
- _onMemberKicked: function(room, member, actor) {
+ _onMemberKicked(room, member, actor) {
let message =
actor ? _("%s has been kicked by %s").format(member.alias,
actor.alias)
@@ -970,7 +970,7 @@ var ChatView = new Lang.Class({
this._insertStatus(message, member.alias, 'left');
},
- _onMemberBanned: function(room, member, actor) {
+ _onMemberBanned(room, member, actor) {
let message =
actor ? _("%s has been banned by %s").format(member.alias,
actor.alias)
@@ -978,12 +978,12 @@ var ChatView = new Lang.Class({
this._insertStatus(message, member.alias, 'left');
},
- _onMemberJoined: function(room, member) {
+ _onMemberJoined(room, member) {
let text = _("%s joined").format(member.alias);
this._insertStatus(text, member.alias, 'joined');
},
- _onMemberLeft: function(room, member, message) {
+ _onMemberLeft(room, member, message) {
let text = _("%s left").format(member.alias);
if (message)
@@ -992,7 +992,7 @@ var ChatView = new Lang.Class({
this._insertStatus(text, member.alias, 'left');
},
- _onMessageReceived: function(channel, tpMessage) {
+ _onMessageReceived(channel, tpMessage) {
this._insertTpMessage(tpMessage);
this._resetStatusCompressed();
let nick = tpMessage.sender.alias;
@@ -1002,12 +1002,12 @@ var ChatView = new Lang.Class({
nickTag._lastActivity = GLib.get_monotonic_time();
},
- _onMessageSent: function(channel, tpMessage) {
+ _onMessageSent(channel, tpMessage) {
this._insertTpMessage(tpMessage);
this._resetStatusCompressed();
},
- _resetStatusCompressed: function() {
+ _resetStatusCompressed() {
let markStart = this._view.buffer.get_mark('idle-status-start');
if (!markStart)
return;
@@ -1017,7 +1017,7 @@ var ChatView = new Lang.Class({
this._state.lastStatusGroup++;
},
- _shouldShowStatus: function(nick) {
+ _shouldShowStatus(nick) {
let nickTag = this._lookupTag('nick' + nick);
if (!nickTag || !nickTag._lastActivity)
@@ -1027,7 +1027,7 @@ var ChatView = new Lang.Class({
return (time - nickTag._lastActivity) / (1000 * 1000) < INACTIVITY_THRESHOLD;
},
- _updateStatusHeader: function() {
+ _updateStatusHeader() {
let buffer = this._view.buffer;
let headerMark = buffer.get_mark('idle-status-start');
@@ -1093,7 +1093,7 @@ var ChatView = new Lang.Class({
this._insertWithTags(iter, '\u25BC', tags.concat(groupTag));
},
- _insertStatus: function(text, member, type) {
+ _insertStatus(text, member, type) {
let time = GLib.DateTime.new_now_utc().to_unix();
if (time - this._joinTime < IGNORE_STATUS_TIME)
return;
@@ -1124,7 +1124,7 @@ var ChatView = new Lang.Class({
this._insertWithTags(iter, text, tags);
},
- _formatTimestamp: function(timestamp) {
+ _formatTimestamp(timestamp) {
let date = GLib.DateTime.new_from_unix_local(timestamp);
let now = GLib.DateTime.new_now_local();
@@ -1203,7 +1203,7 @@ var ChatView = new Lang.Class({
return date.format(format);
},
- _insertTpMessage: function(tpMessage) {
+ _insertTpMessage(tpMessage) {
let message = this._createMessage(tpMessage);
this._ensureNewLine();
@@ -1218,7 +1218,7 @@ var ChatView = new Lang.Class({
this._setIndicatorMark(this._view.buffer.get_end_iter());
},
- _insertMessage: function(iter, message, state) {
+ _insertMessage(iter, message, state) {
let isAction = message.messageType == Tp.ChannelTextMessageType.ACTION;
let needsGap = message.nick != state.lastNick || isAction;
let highlight = this._room.should_highlight_message(message.nick,
@@ -1317,7 +1317,7 @@ var ChatView = new Lang.Class({
this._view.buffer.create_mark(null, iter, true));
},
- _onNickStatusChanged: function(baseNick, status) {
+ _onNickStatusChanged(baseNick, status) {
if (this._room.type == Tp.HandleType.CONTACT &&
status == Tp.ConnectionPresenceType.OFFLINE &&
this._room.channel)
@@ -1334,14 +1334,14 @@ var ChatView = new Lang.Class({
this._updateNickTag(nickTag, status);
},
- _updateNickTag: function(tag, status) {
+ _updateNickTag(tag, status) {
if (status == Tp.ConnectionPresenceType.AVAILABLE)
tag.foreground_rgba = this._activeNickColor;
else
tag.foreground_rgba = this._inactiveNickColor;
},
- _onNickTagClicked: function(tag) {
+ _onNickTagClicked(tag) {
let view = this._view;
let event = Gtk.get_current_event();
let [, eventX, eventY] = event.get_coords();
@@ -1378,7 +1378,7 @@ var ChatView = new Lang.Class({
tag._popover.show();
},
- _createUrlTag: function(url) {
+ _createUrlTag(url) {
if (url.indexOf(':') == -1)
url = 'http://' + url;
@@ -1400,7 +1400,7 @@ var ChatView = new Lang.Class({
return tag;
},
- _ensureNewLine: function() {
+ _ensureNewLine() {
let buffer = this._view.get_buffer();
let iter = buffer.get_end_iter();
let tags = [];
@@ -1414,7 +1414,7 @@ var ChatView = new Lang.Class({
this._insertWithTags(iter, '\n', tags);
},
- _getLineIters: function(iter) {
+ _getLineIters(iter) {
let start = iter.copy();
start.backward_line();
start.forward_to_line_end();
@@ -1425,15 +1425,15 @@ var ChatView = new Lang.Class({
return [start, end];
},
- _lookupTag: function(name) {
+ _lookupTag(name) {
return this._view.get_buffer().tag_table.lookup(name);
},
- _insertWithTagName: function(iter, text, name) {
+ _insertWithTagName(iter, text, name) {
this._insertWithTags(iter, text, [this._lookupTag(name)]);
},
- _insertWithTags: function(iter, text, tags) {
+ _insertWithTags(iter, text, tags) {
let buffer = this._view.get_buffer();
let offset = iter.get_offset();
diff --git a/src/connections.js b/src/connections.js
index fbec967..c0ba771 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -33,7 +33,7 @@ var ConnectionRow = new Lang.Class({
Name: 'ConnectionRow',
Extends: Gtk.ListBoxRow,
- _init: function(params) {
+ _init(params) {
if (!params || !params.id)
throw new Error('No id in parameters');
@@ -83,7 +83,7 @@ var ConnectionsList = new Lang.Class({
Signals: { 'account-created': { param_types: [Tp.Account.$gtype] },
'account-selected': {}},
- _init: function(params) {
+ _init(params) {
this._favoritesOnly = false;
this.parent(params);
@@ -128,38 +128,38 @@ var ConnectionsList = new Lang.Class({
this.notify('favorites-only');
},
- setFilter: function(filter) {
+ setFilter(filter) {
if (Utils.updateTerms(this._filterTerms, filter))
this._list.invalidate_filter();
},
- activateFirst: function() {
+ activateFirst() {
let row = this._list.get_row_at_y(0);
if (row)
row.activate();
},
- activateSelected: function() {
+ activateSelected() {
let row = this._list.get_selected_row();
if (row)
row.activate();
},
- _filterRows: function(row) {
+ _filterRows(row) {
let matchTerms = this._networksManager.getNetworkMatchTerms(row.id);
return this._filterTerms.every(term => {
return matchTerms.some(s => s.indexOf(term) != -1);
});
},
- _updateHeader: function(row, before) {
+ _updateHeader(row, before) {
if (!before)
row.set_header(null);
else if (!row.get_header())
row.set_header(new Gtk.Separator());
},
- _networksChanged: function() {
+ _networksChanged() {
this._list.foreach(w => { w.destroy(); });
let accounts = this._accountsMonitor.accounts;
@@ -180,7 +180,7 @@ var ConnectionsList = new Lang.Class({
});
},
- _onRowActivated: function(list, row) {
+ _onRowActivated(list, row) {
let name = this._networksManager.getNetworkName(row.id);
let req = new Tp.AccountRequest({ account_manager: Tp.AccountManager.dup(),
connection_manager: 'idle',
@@ -202,7 +202,7 @@ var ConnectionsList = new Lang.Class({
this.emit('account-selected');
},
- _setAccountRowSensitive: function(account, sensitive) {
+ _setAccountRowSensitive(account, sensitive) {
if (!this._networksManager.getAccountIsPredefined(account))
return;
@@ -212,7 +212,7 @@ var ConnectionsList = new Lang.Class({
this._rows.get(account.service).sensitive = sensitive;
},
- _sort: function(row1, row2) {
+ _sort(row1, row2) {
let isFavorite1 = this._networksManager.getNetworkIsFavorite(row1.id);
let isFavorite2 = this._networksManager.getNetworkIsFavorite(row2.id);
@@ -247,7 +247,7 @@ var ConnectionDetails = new Lang.Class({
false)},
Signals: { 'account-created': { param_types: [Tp.Account.$gtype] }},
- _init: function(params) {
+ _init(params) {
this._networksManager = NetworksManager.getDefault();
this._networksManager.connect('changed', () => {
this.notify('has-service');
@@ -281,7 +281,7 @@ var ConnectionDetails = new Lang.Class({
this.reset();
},
- setErrorHint: function(hint) {
+ setErrorHint(hint) {
if (hint == ErrorHint.SERVER)
this._serverEntry.get_style_context().add_class('error');
else
@@ -293,7 +293,7 @@ var ConnectionDetails = new Lang.Class({
this._nickEntry.get_style_context().remove_class('error');
},
- _getParams: function() {
+ _getParams() {
let nameText = this._nameEntry.text.trim();
let serverText = this._serverEntry.text.trim();
@@ -318,7 +318,7 @@ var ConnectionDetails = new Lang.Class({
return params;
},
- reset: function() {
+ reset() {
this._savedName = '';
this._savedServer = '';
this._savedNick = GLib.get_user_name();
@@ -337,11 +337,11 @@ var ConnectionDetails = new Lang.Class({
this._nickEntry.grab_focus();
},
- _onCanConfirmChanged: function() {
+ _onCanConfirmChanged() {
this.notify('can-confirm');
},
- _populateFromAccount: function(account) {
+ _populateFromAccount(account) {
let params = getAccountParams(account);
this._savedSSL = params['use-ssl'];
@@ -389,7 +389,7 @@ var ConnectionDetails = new Lang.Class({
this._populateFromAccount(this._account);
},
- save: function() {
+ save() {
if (!this.can_confirm)
return;
@@ -399,7 +399,7 @@ var ConnectionDetails = new Lang.Class({
this._createAccount();
},
- _createAccount: function() {
+ _createAccount() {
let params = this._getParams();
let accountManager = Tp.AccountManager.dup();
let req = new Tp.AccountRequest({ account_manager: accountManager,
@@ -420,7 +420,7 @@ var ConnectionDetails = new Lang.Class({
});
},
- _updateAccount: function() {
+ _updateAccount() {
let params = this._getParams();
let account = this._account;
let oldDetails = account.dup_parameters_vardict().deep_unpack();
@@ -436,7 +436,7 @@ var ConnectionDetails = new Lang.Class({
});
},
- _detailsFromParams: function(params, oldDetails) {
+ _detailsFromParams(params, oldDetails) {
let details = { account: GLib.Variant.new('s', params.account),
username: GLib.Variant.new('s', params.account),
server: GLib.Variant.new('s', params.server) };
@@ -463,7 +463,7 @@ var ConnectionProperties = new Lang.Class({
'errorBox',
'errorLabel'],
- _init: function(account) {
+ _init(account) {
/* Translators: %s is a connection name */
let title = _("“%s” Properties").format(account.display_name);
this.parent({ title: title,
@@ -492,7 +492,7 @@ var ConnectionProperties = new Lang.Class({
this._syncErrorMessage(account);
},
- _syncErrorMessage: function(account) {
+ _syncErrorMessage(account) {
let status = account.connection_status;
let reason = account.connection_status_reason;
diff --git a/src/emojiPicker.js b/src/emojiPicker.js
index 618f785..a3e868a 100644
--- a/src/emojiPicker.js
+++ b/src/emojiPicker.js
@@ -65,7 +65,7 @@ const Emoji = new Lang.Class({
Name: 'Emoji',
Extends: Gtk.FlowBoxChild,
- _init: function(emojiData) {
+ _init(emojiData) {
this._name = emojiData.name;
this._matchName = this._name.toLowerCase();
this._char = emojiData.char;
@@ -91,7 +91,7 @@ const Emoji = new Lang.Class({
box.show_all();
},
- match: function(terms) {
+ match(terms) {
return terms.every(t => this._matchName.includes(t));
},
@@ -104,7 +104,7 @@ const SectionIndicator = new Lang.Class({
Name: 'SectionIndicator',
Extends: Gtk.Button,
- _init: function(labelCode, from, to) {
+ _init(labelCode, from, to) {
this._from = from;
this._to = to;
@@ -116,7 +116,7 @@ const SectionIndicator = new Lang.Class({
visible: true }));
},
- updateForIndex: function(index) {
+ updateForIndex(index) {
if (this._from <= index && index <= this._to)
this.set_state_flags(Gtk.StateFlags.CHECKED, false);
else
@@ -129,7 +129,7 @@ var EmojiPicker = new Lang.Class({
Extends: Gtk.Popover,
Signals: { 'emoji-picked': { param_types: [GObject.TYPE_STRING] } },
- _init: function(params) {
+ _init(params) {
this._terms = [];
let sections = {
@@ -227,7 +227,7 @@ var EmojiPicker = new Lang.Class({
});
},
- _updateIndicators: function() {
+ _updateIndicators() {
let child = null;
if (this._terms.length == 0) {
diff --git a/src/entryArea.js b/src/entryArea.js
index c706751..124f694 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -33,7 +33,7 @@ var ChatEntry = new Lang.Class({
'image-pasted': { param_types: [GdkPixbuf.Pixbuf.$gtype] },
'file-pasted': { param_types: [Gio.File.$gtype] } },
- _init: function(params) {
+ _init(params) {
this.parent(params);
PasteManager.DropTargetIface.addTargets(this, this);
@@ -63,7 +63,7 @@ var ChatEntry = new Lang.Class({
this._useDefaultHandler = false;
},
- _showEmojiPicker: function() {
+ _showEmojiPicker() {
if (!this.is_sensitive() || !this.get_mapped())
return;
@@ -89,7 +89,7 @@ var ChatEntry = new Lang.Class({
return true;
},
- vfunc_drag_data_received: function(context, x, y, data, info, time) {
+ vfunc_drag_data_received(context, x, y, data, info, time) {
let str = data.get_text();
if (!str || str.split('\n').length >= MAX_LINES)
// Disable GtkEntry's built-in drop target support
@@ -99,7 +99,7 @@ var ChatEntry = new Lang.Class({
this.parent(context, x, y, data, info, time);
},
- vfunc_paste_clipboard: function(entry) {
+ vfunc_paste_clipboard(entry) {
if (!this.editable || this._useDefaultHandler) {
this.parent();
return;
@@ -120,7 +120,7 @@ var ChatEntry = new Lang.Class({
});
},
- _onTextReceived: function(clipboard, text) {
+ _onTextReceived(clipboard, text) {
if (text == null)
return;
text = text.trim();
@@ -160,7 +160,7 @@ var EntryArea = new Lang.Class({
0, GLib.MAXUINT32, 0)
},
- _init: function(params) {
+ _init(params) {
this._room = params.room;
delete params.room;
@@ -269,7 +269,7 @@ var EntryArea = new Lang.Class({
this._updateNick();
},
- _updateCompletions: function() {
+ _updateCompletions() {
let nicks = [];
if (this._chatEntry.get_mapped() &&
@@ -282,7 +282,7 @@ var EntryArea = new Lang.Class({
this._completion.setCompletions(nicks);
},
- _canFocusChatEntry: function() {
+ _canFocusChatEntry() {
let toplevelFocus = this._chatEntry.get_toplevel().get_focus();
return this.sensitive &&
this._chatEntry.get_mapped() &&
@@ -290,7 +290,7 @@ var EntryArea = new Lang.Class({
!(toplevelFocus instanceof Gtk.Entry);
},
- _onKeyPressEvent: function(w, event) {
+ _onKeyPressEvent(w, event) {
if (!this._canFocusChatEntry())
return Gdk.EVENT_PROPAGATE;
@@ -316,11 +316,11 @@ var EntryArea = new Lang.Class({
return Gdk.EVENT_STOP;
},
- _onEntryChanged: function() {
+ _onEntryChanged() {
this._chatEntry.get_style_context().remove_class('error');
},
- _setPasteContent: function(content) {
+ _setPasteContent(content) {
this._pasteContent = content;
if (content) {
@@ -333,7 +333,7 @@ var EntryArea = new Lang.Class({
}
},
- pasteText: function(text, nLines) {
+ pasteText(text, nLines) {
this._confirmLabel.label =
ngettext("Paste %s line of text to public paste service?",
"Paste %s lines of text to public paste service?",
@@ -345,20 +345,20 @@ var EntryArea = new Lang.Class({
this._setPasteContent(text);
},
- pasteImage: function(pixbuf) {
+ pasteImage(pixbuf) {
this._confirmLabel.label = _("Upload image to public paste service?");
this._uploadLabel.label = _("Uploading image to public paste service…");
this._setPasteContent(pixbuf);
},
- pasteFile: function(file) {
+ pasteFile(file) {
file.query_info_async(Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
Gio.FileQueryInfoFlags.NONE,
GLib.PRIORITY_DEFAULT, null,
Lang.bind(this, this._onFileInfoReady));
},
- _onFileInfoReady: function(file, res) {
+ _onFileInfoReady(file, res) {
let fileInfo = null;
try {
fileInfo = file.query_info_finish(res);
@@ -374,7 +374,7 @@ var EntryArea = new Lang.Class({
this._setPasteContent(file);
},
- _onPasteClicked: function() {
+ _onPasteClicked() {
let title;
let nick = this._room.channel.connection.self_contact.alias;
if (this._room.type == Tp.HandleType.ROOM)
@@ -399,16 +399,16 @@ var EntryArea = new Lang.Class({
this._confirmLabel.hide();
},
- _onCancelClicked: function() {
+ _onCancelClicked() {
this._setPasteContent(null);
},
- _onSensitiveChanged: function() {
+ _onSensitiveChanged() {
if (this._canFocusChatEntry())
this._chatEntry.grab_focus();
},
- _onChannelChanged: function(room) {
+ _onChannelChanged(room) {
this._updateCompletions();
if (room.channel)
@@ -421,7 +421,7 @@ var EntryArea = new Lang.Class({
},
- _setNick: function(nick) {
+ _setNick(nick) {
this._nickLabel.width_chars = Math.max(nick.length, this._maxNickChars);
this._nickLabel.label = nick;
@@ -442,7 +442,7 @@ var EntryArea = new Lang.Class({
});
},
- _updateNick: function() {
+ _updateNick() {
let channel = this._room ? this._room.channel : null;
let nick = channel ? channel.connection.self_contact.alias
: this._room ? this._room.account.nickname : '';
@@ -454,7 +454,7 @@ var EntryArea = new Lang.Class({
this._nickEntry.text = nick;
},
- _onDestroy: function() {
+ _onDestroy() {
if (this._membersChangedId)
this._room.disconnect(this._membersChangedId);
this._membersChangedId = 0;
diff --git a/src/initialSetup.js b/src/initialSetup.js
index dc0149e..1dd0362 100644
--- a/src/initialSetup.js
+++ b/src/initialSetup.js
@@ -21,7 +21,7 @@ var InitialSetupWindow = new Lang.Class({
'prevButton',
'serverRoomList'],
- _init: function(params) {
+ _init(params) {
this.parent(params);
@@ -63,7 +63,7 @@ var InitialSetupWindow = new Lang.Class({
this._onNetworkAvailableChanged();
},
- _onNetworkAvailableChanged: function() {
+ _onNetworkAvailableChanged() {
if (this._networkMonitor.network_available)
this._setPage(this._currentAccount ? SetupPage.ROOM
: SetupPage.CONNECTION);
@@ -71,7 +71,7 @@ var InitialSetupWindow = new Lang.Class({
this._setPage(SetupPage.OFFLINE);
},
- _setPage: function(page) {
+ _setPage(page) {
if (page == SetupPage.CONNECTION)
this._contentStack.visible_child_name = 'connections';
else if (page == SetupPage.ROOM)
@@ -94,7 +94,7 @@ var InitialSetupWindow = new Lang.Class({
this._updateNextSensitivity();
},
- _unsetAccount: function() {
+ _unsetAccount() {
if (!this._currentAccount)
return;
@@ -113,7 +113,7 @@ var InitialSetupWindow = new Lang.Class({
return SetupPage.OFFLINE;
},
- _updateNextSensitivity: function() {
+ _updateNextSensitivity() {
let sensitive = this._page != SetupPage.OFFLINE;
if (this._page == SetupPage.ROOM)
@@ -122,7 +122,7 @@ var InitialSetupWindow = new Lang.Class({
this._nextButton.sensitive = sensitive;
},
- _joinRooms: function() {
+ _joinRooms() {
this.hide();
let toJoinRooms = this._serverRoomList.selectedRooms;
diff --git a/src/ircParser.js b/src/ircParser.js
index c3f9a49..0a7709f 100644
--- a/src/ircParser.js
+++ b/src/ircParser.js
@@ -42,25 +42,25 @@ const UNKNOWN_COMMAND_MESSAGE =
var IrcParser = new Lang.Class({
Name: 'IrcParser',
- _init: function(room) {
+ _init(room) {
this._app = Gio.Application.get_default();
this._roomManager = RoomManager.getDefault();
this._room = room;
},
- _createFeedbackLabel: function(text) {
+ _createFeedbackLabel(text) {
return new AppNotifications.SimpleOutput(text);
},
- _createFeedbackUsage: function(cmd) {
+ _createFeedbackUsage(cmd) {
return this._createFeedbackLabel(_("Usage: %s").format(_(knownCommands[cmd])));
},
- _createFeedbackGrid: function(header, items) {
+ _createFeedbackGrid(header, items) {
return new AppNotifications.GridOutput(header, items);
},
- process: function(text) {
+ process(text) {
if (!this._room || !this._room.channel || !text.length)
return true;
@@ -281,13 +281,13 @@ var IrcParser = new Lang.Class({
return retval;
},
- _sendText: function(text) {
+ _sendText(text) {
let type = Tp.ChannelTextMessageType.NORMAL;
let message = Tp.ClientMessage.new_text(type, text);
this._sendMessage(message);
},
- _sendMessage: function(message) {
+ _sendMessage(message) {
this._room.channel.send_message_async(message, 0, (c, res) => {
try {
c.send_message_finish(res);
diff --git a/src/joinDialog.js b/src/joinDialog.js
index c04803b..080a977 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -32,7 +32,7 @@ var JoinDialog = new Lang.Class({
'addButton',
'customToggle'],
- _init: function(params) {
+ _init(params) {
params['use-header-bar'] = 1;
this.parent(params);
@@ -95,7 +95,7 @@ var JoinDialog = new Lang.Class({
return Object.keys(this._accounts).length > 0;
},
- _setupMainPage: function() {
+ _setupMainPage() {
this._connectionButton.connect('clicked', () => {
this._setPage(DialogPage.CONNECTION);
});
@@ -108,7 +108,7 @@ var JoinDialog = new Lang.Class({
Lang.bind(this, this._updateCanJoin));
},
- _setupConnectionPage: function() {
+ _setupConnectionPage() {
this._backButton.connect('clicked', () => {
this._setPage(DialogPage.MAIN);
});
@@ -150,7 +150,7 @@ var JoinDialog = new Lang.Class({
});
},
- _onAccountChanged: function() {
+ _onAccountChanged() {
let selected = this._connectionCombo.get_active_text();
let account = this._accounts[selected];
if (!account)
@@ -159,11 +159,11 @@ var JoinDialog = new Lang.Class({
this._serverRoomList.setAccount(account);
},
- _onAccountCreated: function(w, account) {
+ _onAccountCreated(w, account) {
this._connectionCombo.set_active_id(account.display_name);
},
- _joinRoom: function() {
+ _joinRoom() {
this.hide();
let selected = this._connectionCombo.get_active_text();
@@ -183,7 +183,7 @@ var JoinDialog = new Lang.Class({
});
},
- _updateConnectionCombo: function() {
+ _updateConnectionCombo() {
this._connectionCombo.remove_all();
let names = Object.keys(this._accounts).sort((a, b) => {
@@ -202,7 +202,7 @@ var JoinDialog = new Lang.Class({
this._connectionCombo.set_active(activeIndex);
},
- _updateCanJoin: function() {
+ _updateCanJoin() {
let sensitive = false;
if (this._page == DialogPage.MAIN)
@@ -221,7 +221,7 @@ var JoinDialog = new Lang.Class({
return DialogPage.MAIN;
},
- _setPage: function(page) {
+ _setPage(page) {
let isMain = page == DialogPage.MAIN;
let isAccountsEmpty = !this._hasAccounts;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index f508a6e..1af30a0 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -34,14 +34,14 @@ var FixedSizeFrame = new Lang.Class({
-1, GLib.MAXINT32, -1)
},
- _init: function(params) {
+ _init(params) {
this._height = -1;
this._width = -1;
this.parent(params);
},
- _queueRedraw: function() {
+ _queueRedraw() {
let child = this.get_child();
if (child)
child.queue_resize();
@@ -75,12 +75,12 @@ var FixedSizeFrame = new Lang.Class({
this._queueRedraw();
},
- vfunc_get_preferred_width_for_height: function(forHeight) {
+ vfunc_get_preferred_width_for_height(forHeight) {
let [min, nat] = this.parent(forHeight);
return [min, this._width < 0 ? nat : this._width];
},
- vfunc_get_preferred_height_for_width: function(forWidth) {
+ vfunc_get_preferred_height_for_width(forWidth) {
let [min, nat] = this.parent(forWidth);
return [min, this._height < 0 ? nat : this._height];
}
@@ -118,7 +118,7 @@ var MainWindow = new Lang.Class({
},
Signals: { 'active-room-state-changed': {} },
- _init: function(params) {
+ _init(params) {
this._subtitle = '';
params.show_menubar = false;
@@ -220,19 +220,19 @@ var MainWindow = new Lang.Class({
return this._subtitle.length > 0;
},
- _onWindowStateEvent: function(widget, event) {
+ _onWindowStateEvent(widget, event) {
let state = event.get_window().get_state();
this._isFullscreen = (state & Gdk.WindowState.FULLSCREEN) != 0;
this._isMaximized = (state & Gdk.WindowState.MAXIMIZED) != 0;
},
- _onSizeAllocate: function(widget, allocation) {
+ _onSizeAllocate(widget, allocation) {
if (!this._isFullscreen && !this._isMaximized)
this._currentSize = this.get_size();
},
- _onDestroy: function(widget) {
+ _onDestroy(widget) {
this._settings.set_boolean ('window-maximized', this._isMaximized);
this._settings.set_value('window-size',
GLib.Variant.new('ai', this._currentSize));
@@ -250,7 +250,7 @@ var MainWindow = new Lang.Class({
this._settings.reset('last-selected-channel');
},
- _touchFile: function(file) {
+ _touchFile(file) {
try {
file.get_parent().make_directory_with_parents(null);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
@@ -261,7 +261,7 @@ var MainWindow = new Lang.Class({
stream.close(null);
},
- _onDeleteEvent: function() {
+ _onDeleteEvent() {
let f = Gio.File.new_for_path(GLib.get_user_cache_dir() +
'/polari/close-confirmation-shown');
try {
@@ -276,12 +276,12 @@ var MainWindow = new Lang.Class({
return Gdk.EVENT_STOP;
},
- _onAccountsChanged: function(am) {
+ _onAccountsChanged(am) {
let hasAccounts = this._accountsMonitor.enabledAccounts.length > 0;
this._roomListRevealer.reveal_child = hasAccounts;
},
- _updateDecorations: function() {
+ _updateDecorations() {
let layoutLeft = null;
let layoutRight = null;
@@ -344,7 +344,7 @@ var MainWindow = new Lang.Class({
});
},
- _onRoomsLoaded: function(mgr) {
+ _onRoomsLoaded(mgr) {
if (this.active_room)
return;
@@ -362,17 +362,17 @@ var MainWindow = new Lang.Class({
this._roomManager.rooms.shift();
},
- _onRoomRemoved: function(mgr, room) {
+ _onRoomRemoved(mgr, room) {
if (room == this._lastActiveRoom)
this._lastActiveRoom = null;
},
- showJoinRoomDialog: function() {
+ showJoinRoomDialog() {
let dialog = new JoinDialog.JoinDialog({ transient_for: this });
dialog.show();
},
- _updateUserListLabel: function() {
+ _updateUserListLabel() {
let numMembers = 0;
if (this._room &&
@@ -386,7 +386,7 @@ var MainWindow = new Lang.Class({
this._showUserListButton.label = '%d'.format(numMembers);
},
- _updateTitlebar: function() {
+ _updateTitlebar() {
let subtitle = '';
if (this._room && this._room.topic) {
let urls = Utils.findUrls(this._room.topic);
diff --git a/src/networksManager.js b/src/networksManager.js
index f69c8cc..d3e6d32 100644
--- a/src/networksManager.js
+++ b/src/networksManager.js
@@ -15,7 +15,7 @@ function getDefault() {
var NetworksManager = new Lang.Class({
Name: 'NetworksManager',
- _init: function() {
+ _init() {
this._networks = [];
this._networksById = new Map();
@@ -30,7 +30,7 @@ var NetworksManager = new Lang.Class({
}
},
- _onContentsReady: function(f, res) {
+ _onContentsReady(f, res) {
let success, data;
try {
[success, data, ] = f.load_contents_finish(res);
@@ -42,7 +42,7 @@ var NetworksManager = new Lang.Class({
this.emit('changed');
},
- _parseNetworks: function(data) {
+ _parseNetworks(data) {
let networks;
try {
networks = JSON.parse(data);
@@ -59,7 +59,7 @@ var NetworksManager = new Lang.Class({
return true;
},
- _lookupNetwork: function(id) {
+ _lookupNetwork(id) {
let network = this._networksById.get(id);
if (!network)
throw new Error('Invalid network ID');
@@ -70,15 +70,15 @@ var NetworksManager = new Lang.Class({
return this._networks;
},
- getAccountIsPredefined: function(account) {
+ getAccountIsPredefined(account) {
return account && this._networksById.get(account.service) != null;
},
- getNetworkName: function(id) {
+ getNetworkName(id) {
return this._lookupNetwork(id).name;
},
- getNetworkIsFavorite: function(id) {
+ getNetworkIsFavorite(id) {
let network = this._lookupNetwork(id);
if (network.hasOwnProperty('favorite'))
@@ -87,7 +87,7 @@ var NetworksManager = new Lang.Class({
return false;
},
- getNetworkDetails: function(id) {
+ getNetworkDetails(id) {
let network = this._lookupNetwork(id);
if (!network.servers || !network.servers.length)
throw new Error('No servers for network ' + id);
@@ -101,21 +101,21 @@ var NetworksManager = new Lang.Class({
};
},
- getNetworkServers: function(id) {
+ getNetworkServers(id) {
let network = this._lookupNetwork(id);
let sslServers = network.servers.filter(s => s.ssl);
return sslServers.length > 0 ? sslServers
: network.servers.slice();
},
- getNetworkMatchTerms: function(id) {
+ getNetworkMatchTerms(id) {
let network = this._lookupNetwork(id);
let servers = network.servers.map(s => s.address.toLowerCase());
return [network.name.toLowerCase(),
network.id.toLowerCase()].concat(servers);
},
- findByServer: function(server) {
+ findByServer(server) {
for (let n of this._networks)
if (n.servers.some(s => s.address == server))
return n.id;
diff --git a/src/pasteManager.js b/src/pasteManager.js
index aa321f4..e506a3f 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -31,10 +31,10 @@ function _getTargetForContentType(contentType) {
var PasteManager = new Lang.Class({
Name: 'PasteManager',
- _init: function() {
+ _init() {
},
- pasteContent: function(content, title, callback) {
+ pasteContent(content, title, callback) {
if (typeof content == 'string') {
Utils.gpaste(content, title, callback);
} else if (content instanceof GdkPixbuf.Pixbuf) {
@@ -46,14 +46,14 @@ var PasteManager = new Lang.Class({
}
},
- _pasteFile: function(file, title, callback) {
+ _pasteFile(file, title, callback) {
file.query_info_async(Gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
Gio.FileQueryInfoFlags.NONE,
GLib.PRIORITY_DEFAULT, null,
Lang.bind(this, this._onFileQueryFinish, title, callback));
},
- _onFileQueryFinish: function(file, res, title, callback) {
+ _onFileQueryFinish(file, res, title, callback) {
let fileInfo = null;
try {
fileInfo = file.query_info_finish(res);
@@ -96,7 +96,7 @@ var DropTargetIface = new Lang.Interface({
'file-dropped': { param_types: [Gio.File.$gtype] }
},
- addTargets: function(widget) {
+ addTargets(widget) {
this._dragHighlight = false;
widget.drag_dest_set(0, [], Gdk.DragAction.COPY);
@@ -118,7 +118,7 @@ var DropTargetIface = new Lang.Interface({
Lang.bind(this, this._onDragDataReceived));
},
- _onDragDrop: function(widget, context, x, y, time) {
+ _onDragDrop(widget, context, x, y, time) {
if (!this.can_drop)
return Gdk.EVENT_PROPAGATE;
@@ -129,12 +129,12 @@ var DropTargetIface = new Lang.Interface({
return Gdk.EVENT_STOP;
},
- _onDragLeave: function(widget, context, time) {
+ _onDragLeave(widget, context, time) {
widget.drag_unhighlight();
this._dragHighlight = false;
},
- _onDragMotion: function(widget, context, x, y, time) {
+ _onDragMotion(widget, context, x, y, time) {
if (!this.can_drop)
return Gdk.EVENT_PROPAGATE;
@@ -161,7 +161,7 @@ var DropTargetIface = new Lang.Interface({
},
- _onDragDataReceived: function(widget, context, x, y, data, info, time) {
+ _onDragDataReceived(widget, context, x, y, data, info, time) {
if (info == DndTargetType.URI_LIST) {
let uris = data.get_uris();
if (!uris) {
@@ -197,7 +197,7 @@ var DropTargetIface = new Lang.Interface({
}
},
- _lookupFileInfo: function(file, callback) {
+ _lookupFileInfo(file, callback) {
let attr = Gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE;
let flags = Gio.FileQueryInfoFlags.NONE;
let priority = GLib.PRIORITY_DEFAULT;
diff --git a/src/polari-accounts.in b/src/polari-accounts.in
index b548ab0..9dae1e2 100755
--- a/src/polari-accounts.in
+++ b/src/polari-accounts.in
@@ -11,7 +11,7 @@ const AccountsWindow = new Lang.Class({
Name: 'AccountsWindow',
Extends: Gtk.ApplicationWindow,
- _init: function(params) {
+ _init(params) {
this.parent(params);
let scrolled = new Gtk.ScrolledWindow({ hscrollbar_policy: Gtk.PolicyType.NEVER,
@@ -40,7 +40,7 @@ const AccountsWindow = new Lang.Class({
am.prepare_async(null, Lang.bind(this, this._onPrepared));
},
- _onPrepared: function(am) {
+ _onPrepared(am) {
am.connect('account-validity-changed', (am, account, valid) => {
if (valid)
this._addAccount(account);
@@ -53,7 +53,7 @@ const AccountsWindow = new Lang.Class({
am.dup_valid_accounts().forEach(Lang.bind(this, this._addAccount));
},
- _addAccount: function(account) {
+ _addAccount(account) {
if (account.protocol_name != 'irc')
return;
@@ -86,7 +86,7 @@ const AccountsWindow = new Lang.Class({
});
},
- _removeAccount: function(account) {
+ _removeAccount(account) {
let rows = this._list.get_children();
for (let i = 0; i < rows.length; i++)
if (rows[i].account == account) {
diff --git a/src/roomList.js b/src/roomList.js
index 34fae4e..37c2c19 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -24,7 +24,7 @@ var RoomRow = new Lang.Class({
Template: 'resource:///org/gnome/Polari/ui/room-list-row.ui',
InternalChildren: ['eventBox', 'icon', 'roomLabel', 'counter'],
- _init: function(room) {
+ _init(room) {
this.parent();
this._room = room;
@@ -59,12 +59,12 @@ var RoomRow = new Lang.Class({
return !this.get_style_context().has_class('inactive');
},
- selected: function() {
+ selected() {
if (!this._room.channel)
this._updatePending();
},
- _getNumPending: function() {
+ _getNumPending() {
if (!this._room.channel)
return [0, 0];
@@ -80,7 +80,7 @@ var RoomRow = new Lang.Class({
return [nPending, highlights.length];
},
- _updatePending: function() {
+ _updatePending() {
let [nPending, nHighlights] = this._getNumPending();
this._counter.label = nHighlights.toString();
@@ -93,7 +93,7 @@ var RoomRow = new Lang.Class({
context.remove_class('inactive');
},
- _onChannelChanged: function() {
+ _onChannelChanged() {
if (!this._room.channel)
return;
this._room.channel.connect('message-received',
@@ -103,7 +103,7 @@ var RoomRow = new Lang.Class({
this._updatePending();
},
- _onButtonRelease: function(w, event) {
+ _onButtonRelease(w, event) {
let [, button] = event.get_button();
if (button != Gdk.BUTTON_SECONDARY)
return Gdk.EVENT_PROPAGATE;
@@ -113,7 +113,7 @@ var RoomRow = new Lang.Class({
return Gdk.EVENT_STOP;
},
- _onKeyPress: function(w, event) {
+ _onKeyPress(w, event) {
let [, keyval] = event.get_keyval();
let [, mods] = event.get_state();
if (keyval != Gdk.KEY_Menu &&
@@ -126,7 +126,7 @@ var RoomRow = new Lang.Class({
return Gdk.EVENT_STOP;
},
- _showPopover: function() {
+ _showPopover() {
if (!this._popover) {
let menu = new Gio.Menu();
let isRoom = this._room.type == Tp.HandleType.ROOM;
@@ -157,7 +157,7 @@ var RoomListHeader = new Lang.Class({
'popoverProperties',
'spinner'],
- _init: function(params) {
+ _init(params) {
this._account = params.account;
delete params.account;
@@ -207,7 +207,7 @@ var RoomListHeader = new Lang.Class({
});
},
- _onDisplayNameChanged: function() {
+ _onDisplayNameChanged() {
this._label.label = this._account.display_name;
/* update pop-over status label */
@@ -226,26 +226,26 @@ var RoomListHeader = new Lang.Class({
},
/* hack: Handle primary and secondary button interchangeably */
- vfunc_button_press_event: function(event) {
+ vfunc_button_press_event(event) {
if (event.button == Gdk.BUTTON_SECONDARY)
event.button = Gdk.BUTTON_PRIMARY;
return this.parent(event);
},
- vfunc_button_release_event: function(event) {
+ vfunc_button_release_event(event) {
if (event.button == Gdk.BUTTON_SECONDARY)
event.button = Gdk.BUTTON_PRIMARY;
return this.parent(event);
},
- _getConnectionStatus: function() {
+ _getConnectionStatus() {
let presence = this._account.requested_presence_type;
if (presence == Tp.ConnectionPresenceType.OFFLINE)
return Tp.ConnectionStatus.DISCONNECTED;
return this._account.connection_status;
},
- _onConnectionStatusChanged: function() {
+ _onConnectionStatusChanged() {
let status = this._getConnectionStatus();
let reason = this._account.connection_status_reason;
let authError = Tp.error_get_dbus_name(Tp.Error.AUTHENTICATION_FAILED);
@@ -290,7 +290,7 @@ var RoomListHeader = new Lang.Class({
}
},
- _onRequestedPresenceChanged: function() {
+ _onRequestedPresenceChanged() {
let presence = this._account.requested_presence_type;
let offline = presence == Tp.ConnectionPresenceType.OFFLINE;
this._popoverConnect.visible = offline;
@@ -298,7 +298,7 @@ var RoomListHeader = new Lang.Class({
this._onConnectionStatusChanged();
},
- _getStatusLabel: function() {
+ _getStatusLabel() {
switch (this._getConnectionStatus()) {
case Tp.ConnectionStatus.CONNECTED:
return _("Connected");
@@ -311,7 +311,7 @@ var RoomListHeader = new Lang.Class({
}
},
- _getErrorLabel: function() {
+ _getErrorLabel() {
switch (this._account.connection_error) {
case Tp.error_get_dbus_name(Tp.Error.CERT_REVOKED):
@@ -348,7 +348,7 @@ var RoomList = new Lang.Class({
Name: 'RoomList',
Extends: Gtk.ListBox,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.set_header_func(Lang.bind(this, this._updateHeader));
@@ -410,7 +410,7 @@ var RoomList = new Lang.Class({
});
},
- vfunc_realize: function() {
+ vfunc_realize() {
this.parent();
let toplevel = this.get_toplevel();
@@ -419,13 +419,13 @@ var RoomList = new Lang.Class({
this._activeRoomChanged();
},
- _rowToRoomIndex: function(index) {
+ _rowToRoomIndex(index) {
let placeholders = [...this._placeholders.values()];
let nBefore = placeholders.filter(p => p.get_index() < index).length;
return index - nBefore;
},
- _roomToRowIndex: function(index) {
+ _roomToRowIndex(index) {
let nChildren = this.get_children().length;
for (let i = 0, roomIndex = 0; i < nChildren; i++)
if (this.get_row_at_index(i).room && roomIndex++ == index)
@@ -433,21 +433,21 @@ var RoomList = new Lang.Class({
return -1;
},
- _getRoomRowAtIndex: function(index) {
+ _getRoomRowAtIndex(index) {
return this.get_row_at_index(this._roomToRowIndex(index));
},
- _selectRoomAtIndex: function(index) {
+ _selectRoomAtIndex(index) {
let row = this._getRoomRowAtIndex(index);
if (row)
this.select_row(row);
},
- _moveSelection: function(direction) {
+ _moveSelection(direction) {
this._moveSelectionFull(direction, () => { return true; });
},
- _moveSelectionFull: function(direction, testFunction){
+ _moveSelectionFull(direction, testFunction){
let current = this.get_selected_row();
if (!current)
return;
@@ -466,7 +466,7 @@ var RoomList = new Lang.Class({
this.select_row(row);
},
- _moveSelectionFromRow: function(row) {
+ _moveSelectionFromRow(row) {
if (this._roomManager.roomCount == 0)
return;
@@ -493,7 +493,7 @@ var RoomList = new Lang.Class({
this.select_row(selected);
},
- _accountAdded: function(am, account) {
+ _accountAdded(am, account) {
if (this._placeholders.has(account))
return;
@@ -512,7 +512,7 @@ var RoomList = new Lang.Class({
this._updatePlaceholderVisibility(account);
},
- _accountRemoved: function(am, account) {
+ _accountRemoved(am, account) {
let placeholder = this._placeholders.get(account);
if (!placeholder)
@@ -522,7 +522,7 @@ var RoomList = new Lang.Class({
placeholder.destroy();
},
- _roomAdded: function(roomManager, room) {
+ _roomAdded(roomManager, room) {
if (this._roomRows.has(room.id))
return;
@@ -534,7 +534,7 @@ var RoomList = new Lang.Class({
this._placeholders.get(room.account).hide();
},
- _roomRemoved: function(roomManager, room) {
+ _roomRemoved(roomManager, room) {
let row = this._roomRows.get(room.id);
if (!row)
return;
@@ -545,7 +545,7 @@ var RoomList = new Lang.Class({
this._updatePlaceholderVisibility(room.account);
},
- _updatePlaceholderVisibility: function(account) {
+ _updatePlaceholderVisibility(account) {
if (!account.enabled) {
this._placeholders.get(account).hide();
return;
@@ -556,7 +556,7 @@ var RoomList = new Lang.Class({
this._placeholders.get(account).visible = !hasRooms;
},
- _activeRoomChanged: function() {
+ _activeRoomChanged() {
let room = this.get_toplevel().active_room;
if (!room)
return;
@@ -569,13 +569,13 @@ var RoomList = new Lang.Class({
row.can_focus = true;
},
- vfunc_row_selected: function(row) {
+ vfunc_row_selected(row) {
this.get_toplevel().active_room = row ? row.room : null;
if (row)
row.selected();
},
- _updateHeader: function(row, before) {
+ _updateHeader(row, before) {
let getAccount = row => row ? row.account : null;
let beforeAccount = getAccount(before);
@@ -596,7 +596,7 @@ var RoomList = new Lang.Class({
row.set_header(roomListHeader);
},
- _sort: function(row1, row2) {
+ _sort(row1, row2) {
let account1 = row1.account;
let account2 = row2.account;
diff --git a/src/roomManager.js b/src/roomManager.js
index 3ae8ead..5931faa 100644
--- a/src/roomManager.js
+++ b/src/roomManager.js
@@ -18,7 +18,7 @@ function getDefault() {
var _RoomManager = new Lang.Class({
Name: '_RoomManager',
- _init: function() {
+ _init() {
this._rooms = new Map();
this._settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' })
@@ -54,18 +54,18 @@ var _RoomManager = new Lang.Class({
this._accountsMonitor.prepare(() => { this._restoreRooms(); });
},
- lookupRoom: function(id) {
+ lookupRoom(id) {
return this._rooms.get(id);
},
- lookupRoomByName: function(name, account) {
+ lookupRoomByName(name, account) {
for (let room of this._rooms.values())
if (room.channel_name == name && room.account == account)
return room;
return null;
},
- lookupRoomByChannel: function(channel) {
+ lookupRoomByChannel(channel) {
let account = channel.connection.get_account();
let channelName = channel.identifier;
let id = Polari.create_room_id(account, channelName, channel.handle_type);
@@ -80,7 +80,7 @@ var _RoomManager = new Lang.Class({
return [...this._rooms.values()];
},
- _onJoinActivated: function(action, parameter) {
+ _onJoinActivated(action, parameter) {
let [accountPath, channelName, time] = parameter.deep_unpack();
this._addSavedChannel(accountPath, channelName);
@@ -89,7 +89,7 @@ var _RoomManager = new Lang.Class({
});
},
- _onQueryActivated: function(action, parameter) {
+ _onQueryActivated(action, parameter) {
let [accountPath, channelName, , time] = parameter.deep_unpack();
this._accountsMonitor.prepare(() => {
@@ -97,7 +97,7 @@ var _RoomManager = new Lang.Class({
});
},
- _onLeaveActivated: function(action, parameter) {
+ _onLeaveActivated(action, parameter) {
let [id, ] = parameter.deep_unpack();
let room = this._rooms.get(id);
@@ -105,7 +105,7 @@ var _RoomManager = new Lang.Class({
this._removeRoom(room);
},
- _restoreRooms: function(accountPath) {
+ _restoreRooms(accountPath) {
this._settings.get_value('saved-channel-list').deep_unpack().forEach(c => {
for (let prop in c)
c[prop] = c[prop].deep_unpack();
@@ -115,13 +115,13 @@ var _RoomManager = new Lang.Class({
this.emit('rooms-loaded');
},
- _removeRooms: function(accountPath) {
+ _removeRooms(accountPath) {
for (let room of this._rooms.values())
if (accountPath == null || room.account.object_path == accountPath)
this._removeRoom(room);
},
- _findChannelIndex: function(channels, accountPath, channelName) {
+ _findChannelIndex(channels, accountPath, channelName) {
let matchName = channelName.toLowerCase();
for (let i = 0; i < channels.length; i++)
if (channels[i].account.deep_unpack() == accountPath &&
@@ -130,7 +130,7 @@ var _RoomManager = new Lang.Class({
return -1;
},
- _addSavedChannel: function(accountPath, channelName) {
+ _addSavedChannel(accountPath, channelName) {
let channels = this._settings.get_value('saved-channel-list').deep_unpack();
if (this._findChannelIndex(channels, accountPath, channelName) != -1)
return;
@@ -142,7 +142,7 @@ var _RoomManager = new Lang.Class({
new GLib.Variant('aa{sv}', channels));
},
- _removeSavedChannel: function(accountPath, channelName) {
+ _removeSavedChannel(accountPath, channelName) {
let channels = this._settings.get_value('saved-channel-list').deep_unpack();
let pos = this._findChannelIndex(channels, accountPath, channelName);
if (pos < 0)
@@ -152,7 +152,7 @@ var _RoomManager = new Lang.Class({
new GLib.Variant('aa{sv}', channels));
},
- _removeSavedChannelsForAccount: function(accountPath) {
+ _removeSavedChannelsForAccount(accountPath) {
let channels = this._settings.get_value('saved-channel-list').deep_unpack();
let account = new GLib.Variant('s', accountPath);
@@ -161,7 +161,7 @@ var _RoomManager = new Lang.Class({
new GLib.Variant('aa{sv}', channels));
},
- _ensureRoom: function(accountPath, channelName, type, time) {
+ _ensureRoom(accountPath, channelName, type, time) {
let account = this._accountsMonitor.lookupAccount(accountPath);
if (!account) {
@@ -189,7 +189,7 @@ var _RoomManager = new Lang.Class({
return room;
},
- ensureRoomForChannel: function(channel, time) {
+ ensureRoomForChannel(channel, time) {
let accountPath = channel.connection.get_account().object_path;
let targetContact = channel.target_contact;
let channelName = targetContact ? targetContact.alias
@@ -198,7 +198,7 @@ var _RoomManager = new Lang.Class({
room.channel = channel;
},
- _removeRoom: function(room) {
+ _removeRoom(room) {
if (this._rooms.delete(room.id))
this.emit('room-removed', room);
}
diff --git a/src/roomStack.js b/src/roomStack.js
index a4dd81a..582d5e7 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -22,7 +22,7 @@ var RoomStack = new Lang.Class({
0, GLib.MAXUINT32, 0)
},
- _init: function(params) {
+ _init(params) {
this.parent(params);
this._sizeGroup = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.VERTICAL });
@@ -45,7 +45,7 @@ var RoomStack = new Lang.Class({
});
},
- vfunc_realize: function() {
+ vfunc_realize() {
this.parent();
let toplevel = this.get_toplevel();
@@ -62,26 +62,26 @@ var RoomStack = new Lang.Class({
return this._entryAreaHeight;
},
- _addView: function(id, view) {
+ _addView(id, view) {
this._rooms.set(id, view);
this.add_named(view, id);
},
- _roomAdded: function(roomManager, room) {
+ _roomAdded(roomManager, room) {
this._addView(room.id, new RoomView(room, this._sizeGroup));
},
- _roomRemoved: function(roomManager, room) {
+ _roomRemoved(roomManager, room) {
this._rooms.get(room.id).destroy();
this._rooms.delete(room.id);
},
- _activeRoomChanged: function() {
+ _activeRoomChanged() {
let room = this.get_toplevel().active_room;
this.set_visible_child_name(room ? room.id : 'placeholder');
},
- _updateSensitivity: function() {
+ _updateSensitivity() {
let room = this.get_toplevel().active_room;
if (!room)
return;
@@ -94,7 +94,7 @@ var SavePasswordConfirmationBar = new Lang.Class({
Name: 'SavePasswordConfirmationBar',
Extends: Gtk.Revealer,
- _init: function(room) {
+ _init(room) {
this._room = room;
this.parent({ valign: Gtk.Align.START });
@@ -116,7 +116,7 @@ var SavePasswordConfirmationBar = new Lang.Class({
});
},
- _createWidget: function() {
+ _createWidget() {
this._infoBar = new Gtk.InfoBar({ show_close_button: true })
this.add(this._infoBar);
@@ -146,7 +146,7 @@ var SavePasswordConfirmationBar = new Lang.Class({
this._infoBar.show_all();
},
- _onDestroy: function() {
+ _onDestroy() {
if (this._identifySentId)
this._room.disconnect(this._identifySentId);
this._identifySentId = 0;
@@ -157,7 +157,7 @@ var ChatPlaceholder = new Lang.Class({
Name: 'ChatPlaceholder',
Extends: Gtk.Overlay,
- _init: function(sizeGroup) {
+ _init(sizeGroup) {
this._accountsMonitor = AccountsMonitor.getDefault();
let image = new Gtk.Image({ icon_name: 'org.gnome.Polari-symbolic',
@@ -195,7 +195,7 @@ var RoomView = new Lang.Class({
Name: 'RoomView',
Extends: Gtk.Overlay,
- _init: function(room, sizeGroup) {
+ _init(room, sizeGroup) {
this.parent();
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 78004f3..7fcb2d6 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -25,7 +25,7 @@ function getDefault() {
var _ServerRoomManager = new Lang.Class({
Name: '_ServerRoomManager',
- _init: function() {
+ _init() {
this._roomLists = new Map();
this._accountsMonitor = AccountsMonitor.getDefault();
@@ -40,21 +40,21 @@ var _ServerRoomManager = new Lang.Class({
});
},
- getRoomInfos: function(account) {
+ getRoomInfos(account) {
let roomList = this._roomLists.get(account);
if (!roomList || roomList.list.listing)
return [];
return roomList.rooms.slice();
},
- isLoading: function(account) {
+ isLoading(account) {
let roomList = this._roomLists.get(account);
if (!roomList)
return account.connection_status == Tp.ConnectionStatus.CONNECTING;
return roomList.list.listing;
},
- _onAccountStatusChanged: function(mon, account) {
+ _onAccountStatusChanged(mon, account) {
if (account.connection_status == Tp.ConnectionStatus.CONNECTING)
this.emit('loading-changed', account);
@@ -80,7 +80,7 @@ var _ServerRoomManager = new Lang.Class({
this._roomLists.set(account, { list: roomList, rooms: [] });
},
- _onAccountRemoved: function(mon, account) {
+ _onAccountRemoved(mon, account) {
let roomList = this._roomLists.get(account);
if (!roomList)
return;
@@ -89,14 +89,14 @@ var _ServerRoomManager = new Lang.Class({
this._roomLists.delete(account);
},
- _onGotRoom: function(list, roomInfo) {
+ _onGotRoom(list, roomInfo) {
let roomList = this._roomLists.get(list.account);
if (!roomList)
return;
roomList.rooms.push(roomInfo);
},
- _onListingChanged: function(list) {
+ _onListingChanged(list) {
this.emit('loading-changed', list.account);
}
});
@@ -131,7 +131,7 @@ var ServerRoomList = new Lang.Class({
false)
},
- _init: function(params) {
+ _init(params) {
this._account = null;
this._pendingInfos = [];
this._filterTerms = [];
@@ -220,7 +220,7 @@ var ServerRoomList = new Lang.Class({
return rooms;
},
- setAccount: function(account) {
+ setAccount(account) {
if (this._account == account)
return;
@@ -231,17 +231,17 @@ var ServerRoomList = new Lang.Class({
this._onLoadingChanged(this._manager, account);
},
- focusEntry: function() {
+ focusEntry() {
this._filterEntry.grab_focus();
},
- _isCustomRoomItem: function(iter) {
+ _isCustomRoomItem(iter) {
let path = this._store.get_path(iter);
let customPath = this._store.get_path(this._customRoomItem);
return path.compare(customPath) == 0;
},
- _updateCustomRoomName: function() {
+ _updateCustomRoomName() {
let newName = this._filterEntry.text.trim();
if (newName.search(/\s/) != -1)
newName = '';
@@ -263,7 +263,7 @@ var ServerRoomList = new Lang.Class({
this._store.set_value(this._customRoomItem, RoomListColumn.NAME, newName);
},
- _updateSelection: function() {
+ _updateSelection() {
if (this._filterEntry.text.trim().length == 0)
return;
@@ -276,7 +276,7 @@ var ServerRoomList = new Lang.Class({
this._list.scroll_to_cell(model.get_path(iter), null, true, 0.0, 0.0);
},
- _clearList: function() {
+ _clearList() {
let [valid, iter] = this._store.get_iter_first();
if (this._isCustomRoomItem(iter))
return;
@@ -285,7 +285,7 @@ var ServerRoomList = new Lang.Class({
;
},
- _onLoadingChanged: function(mgr, account) {
+ _onLoadingChanged(mgr, account) {
if (account != this._account)
return;
@@ -352,13 +352,13 @@ var ServerRoomList = new Lang.Class({
});
},
- _checkSpinner: function() {
+ _checkSpinner() {
let loading = this._pendingInfos.length ||
(this._account && this._manager.isLoading(this._account));
this._spinner.active = loading;
},
- _toggleChecked: function(path) {
+ _toggleChecked(path) {
let childPath = this._list.model.convert_path_to_child_path(path);
let [valid, iter] = this._store.get_iter(childPath);
if (!this._store.get_value(iter, RoomListColumn.SENSITIVE))
diff --git a/src/tabCompletion.js b/src/tabCompletion.js
index 8e72ecf..bd36e70 100644
--- a/src/tabCompletion.js
+++ b/src/tabCompletion.js
@@ -8,7 +8,7 @@ const Lang = imports.lang;
var TabCompletion = new Lang.Class({
Name: 'TabCompletion',
- _init: function(entry) {
+ _init(entry) {
this._entry = entry;
this._canComplete = false;
this._key = '';
@@ -52,7 +52,7 @@ var TabCompletion = new Lang.Class({
}
},
- _showPopup: function() {
+ _showPopup() {
this._list.show_all();
let [, height] = this._list.get_preferred_height();
@@ -75,7 +75,7 @@ var TabCompletion = new Lang.Class({
this._popup.show();
},
- setCompletions: function(completions) {
+ setCompletions(completions) {
if (this._popup.visible) {
let id = this._popup.connect('unmap', () => {
this._popup.disconnect(id);
@@ -120,7 +120,7 @@ var TabCompletion = new Lang.Class({
this._canComplete = completions.length > 0;
},
- _onKeyPress: function(w, event) {
+ _onKeyPress(w, event) {
let [, keyval] = event.get_keyval();
if (this._key.length == 0) {
@@ -158,7 +158,7 @@ var TabCompletion = new Lang.Class({
return Gdk.EVENT_PROPAGATE;
},
- _getRowCompletion: function(row) {
+ _getRowCompletion(row) {
this._previousWasCommand = this._isCommand;
if (this._isCommand)
@@ -168,18 +168,18 @@ var TabCompletion = new Lang.Class({
return row._text;
},
- _onRowSelected: function(w, row) {
+ _onRowSelected(w, row) {
if (row)
this._insertCompletion(this._getRowCompletion(row));
},
- _filter: function(row) {
+ _filter(row) {
if (this._key.length == 0)
return false;
return row._casefoldedText.startsWith(this._key);
},
- _insertCompletion: function(completion) {
+ _insertCompletion(completion) {
let pos = this._entry.get_position();
this._endPos = this._startPos + completion.length;
this._entry.delete_text(this._startPos, pos);
@@ -187,14 +187,14 @@ var TabCompletion = new Lang.Class({
this._entry.set_position(this._endPos);
},
- _setPreviousCompletionChained: function(chained) {
+ _setPreviousCompletionChained(chained) {
let repl = chained ? ',' : ':';
let start = this._startPos - 2;
this._entry.delete_text(start, start + 1);
this._entry.insert_text(repl, -1, start);
},
- _start: function() {
+ _start() {
if (!this._canComplete)
return;
@@ -229,7 +229,7 @@ var TabCompletion = new Lang.Class({
}
},
- _onKeynavFailed: function(w, dir) {
+ _onKeynavFailed(w, dir) {
if (this._inHandler)
return Gdk.EVENT_PROPAGATE;
let count = dir == Gtk.DirectionType.DOWN ? -1 : 1;
@@ -239,13 +239,13 @@ var TabCompletion = new Lang.Class({
return Gdk.EVENT_STOP;
},
- _moveSelection: function(movement, count) {
+ _moveSelection(movement, count) {
this._list.emit('move-cursor', movement, count);
let row = this._list.get_focus_child();
this._list.select_row(row);
},
- _stop: function() {
+ _stop() {
if (this._key.length == 0)
return;
@@ -257,7 +257,7 @@ var TabCompletion = new Lang.Class({
this._list.invalidate_filter();
},
- _cancel: function() {
+ _cancel() {
if (this._key.length == 0)
return;
if (this._isChained)
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 0b11e9a..d682838 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -47,7 +47,7 @@ const SASLAbortReason = {
var SASLAuthHandler = new Lang.Class({
Name: 'SASLAuthHandler',
- _init: function(channel) {
+ _init(channel) {
this._channel = channel;
this._proxy = new SASLAuthProxy(Gio.DBus.session,
channel.bus_name,
@@ -55,7 +55,7 @@ var SASLAuthHandler = new Lang.Class({
Lang.bind(this, this._onProxyReady));
},
- _onProxyReady: function(proxy) {
+ _onProxyReady(proxy) {
this._proxy.connectSignal('SASLStatusChanged',
Lang.bind(this, this._onSASLStatusChanged));
@@ -64,7 +64,7 @@ var SASLAuthHandler = new Lang.Class({
Lang.bind(this, this._onPasswordReady));
},
- _onPasswordReady: function(password) {
+ _onPasswordReady(password) {
if (password)
this._proxy.StartMechanismWithDataRemote('X-TELEPATHY-PASSWORD',
password);
@@ -74,7 +74,7 @@ var SASLAuthHandler = new Lang.Class({
Lang.bind(this, this._resetPrompt));
},
- _onSASLStatusChanged: function(proxy, sender, [status]) {
+ _onSASLStatusChanged(proxy, sender, [status]) {
let name = this._channel.connection.get_account().display_name;
let statusString = (Object.keys(SASLStatus))[status];
debug('Auth status for server "%s": %s'.format(name, statusString));
@@ -97,7 +97,7 @@ var SASLAuthHandler = new Lang.Class({
}
},
- _resetPrompt: function() {
+ _resetPrompt() {
let account = this._channel.connection.get_account();
let prompt = new GLib.Variant('b', false);
let params = new GLib.Variant('a{sv}', { 'password-prompt': prompt });
@@ -113,7 +113,7 @@ var TelepathyClient = new Lang.Class({
Name: 'TelepathyClient',
Extends: Tp.BaseClient,
- _init: function(params) {
+ _init(params) {
this._app = Gio.Application.get_default();
this._app.connect('prepare-shutdown', () => {
[...this._pendingRequests.values()].forEach(r => { r.cancel(); });
@@ -141,7 +141,7 @@ var TelepathyClient = new Lang.Class({
this._accountsMonitor.prepare(Lang.bind(this, this._onPrepared));
},
- _onPrepared: function() {
+ _onPrepared() {
let actions = [
{ name: 'message-user',
handler: Lang.bind(this, this._onQueryActivated) },
@@ -203,7 +203,7 @@ var TelepathyClient = new Lang.Class({
this._networkMonitor.network_available);
},
- _onNetworkChanged: function(mon, connected) {
+ _onNetworkChanged(mon, connected) {
let presence = connected ? Tp.ConnectionPresenceType.AVAILABLE
: Tp.ConnectionPresenceType.OFFLINE;
debug('Network changed to %s'.format(connected ? 'available'
@@ -214,7 +214,7 @@ var TelepathyClient = new Lang.Class({
});
},
- _onAccountStatusChanged: function(mon, account) {
+ _onAccountStatusChanged(mon, account) {
if (account.connection_status != Tp.ConnectionStatus.CONNECTED)
return;
@@ -226,11 +226,11 @@ var TelepathyClient = new Lang.Class({
});
},
- _connectAccount: function(account) {
+ _connectAccount(account) {
this._setAccountPresence(account, Tp.ConnectionPresenceType.AVAILABLE);
},
- _setAccountPresence: function(account, presence) {
+ _setAccountPresence(account, presence) {
let statuses = Object.keys(Tp.ConnectionPresenceType).map(s =>
s.replace(/_/g, '-').toLowerCase()
);
@@ -249,18 +249,18 @@ var TelepathyClient = new Lang.Class({
});
},
- _connectRooms: function(account) {
+ _connectRooms(account) {
this._roomManager.rooms.forEach(room => {
if (account == null || room.account == account)
this._connectRoom(room);
});
},
- _connectRoom: function(room) {
+ _connectRoom(room) {
this._requestChannel(room.account, room.type, room.channel_name, null);
},
- _requestChannel: function(account, targetType, targetId, callback) {
+ _requestChannel(account, targetType, targetId, callback) {
if (!account || !account.enabled)
return;
@@ -294,7 +294,7 @@ var TelepathyClient = new Lang.Class({
});
},
- _sendIdentify: function(account, password) {
+ _sendIdentify(account, password) {
let settings = this._accountsMonitor.getAccountSettings(account);
let params = account.dup_parameters_vardict().deep_unpack();
@@ -325,7 +325,7 @@ var TelepathyClient = new Lang.Class({
});
},
- _sendMessage: function(channel, message) {
+ _sendMessage(channel, message) {
if (!message || !channel)
return;
@@ -340,19 +340,19 @@ var TelepathyClient = new Lang.Class({
});
},
- _onConnectAccountActivated: function(action, parameter) {
+ _onConnectAccountActivated(action, parameter) {
let accountPath = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
this._connectAccount(account);
},
- _onReconnectAccountActivated: function(action, parameter) {
+ _onReconnectAccountActivated(action, parameter) {
let accountPath = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
account.reconnect_async((a, res) => { a.reconnect_finish(res); });
},
- _onAuthenticateAccountActivated: function(action, parameter) {
+ _onAuthenticateAccountActivated(action, parameter) {
let [accountPath, password] = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
@@ -366,7 +366,7 @@ var TelepathyClient = new Lang.Class({
});
},
- _onQueryActivated: function(action, parameter) {
+ _onQueryActivated(action, parameter) {
let [accountPath, channelName, message, time] = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
@@ -377,7 +377,7 @@ var TelepathyClient = new Lang.Class({
Lang.bind(this, this._sendMessage, message));
},
- _onLeaveActivated: function(action, parameter) {
+ _onLeaveActivated(action, parameter) {
let [id, message] = parameter.deep_unpack();
let request = this._pendingRequests.get(id);
@@ -409,7 +409,7 @@ var TelepathyClient = new Lang.Class({
});
},
- _onSaveIdentifyPasswordActivated: function(action, parameter) {
+ _onSaveIdentifyPasswordActivated(action, parameter) {
let accountPath = parameter.deep_unpack();
let account = this._accountsMonitor.lookupAccount(accountPath);
if (!account)
@@ -427,7 +427,7 @@ var TelepathyClient = new Lang.Class({
});
},
- _saveIdentifySettings: function(account, data) {
+ _saveIdentifySettings(account, data) {
let settings = this._accountsMonitor.getAccountSettings(account);
if (data.botname == 'NickServ')
@@ -444,22 +444,22 @@ var TelepathyClient = new Lang.Class({
settings.set_boolean('identify-username-supported', data.usernameSupported);
},
- _onDiscardIdentifyPasswordActivated: function(action, parameter) {
+ _onDiscardIdentifyPasswordActivated(action, parameter) {
let accountPath = parameter.deep_unpack();
this._discardIdentifyPassword(accountPath);
},
- _discardIdentifyPassword: function(accountPath) {
+ _discardIdentifyPassword(accountPath) {
this._pendingBotPasswords.delete(accountPath);
this._app.withdraw_notification(this._getIdentifyNotificationID(accountPath));
},
- _isAuthChannel: function(channel) {
+ _isAuthChannel(channel) {
return channel.channel_type == Tp.IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION;
},
- _processRequest: function(context, connection, channels, processChannel) {
+ _processRequest(context, connection, channels, processChannel) {
if (connection.protocol_name != 'irc') {
let message = 'Not implementing non-IRC protocols';
context.fail(new Tp.Error({ code: Tp.Error.NOT_IMPLEMENTED,
@@ -482,7 +482,7 @@ var TelepathyClient = new Lang.Class({
context.accept();
},
- vfunc_observe_channels: function(account, connection, channels,
+ vfunc_observe_channels(account, connection, channels,
op, requests, context) {
this._processRequest(context, connection, channels, channel => {
if (this._isAuthChannel(channel))
@@ -505,7 +505,7 @@ var TelepathyClient = new Lang.Class({
});
},
- vfunc_handle_channels: function(account, connection, channels,
+ vfunc_handle_channels(account, connection, channels,
satisfied, userTime, context) {
let [present, ] = Tp.user_action_time_should_present(userTime);
@@ -523,15 +523,15 @@ var TelepathyClient = new Lang.Class({
});
},
- _getPendingNotificationID: function(room, id) {
+ _getPendingNotificationID(room, id) {
return 'pending-message-%s-%d'.format(room.id, id);
},
- _getIdentifyNotificationID: function(accountPath) {
+ _getIdentifyNotificationID(accountPath) {
return 'identify-password-%s'.format(accountPath);
},
- _createNotification: function(room, summary, body) {
+ _createNotification(room, summary, body) {
let notification = new Gio.Notification();
notification.set_title(summary);
notification.set_body(body);
@@ -555,7 +555,7 @@ var TelepathyClient = new Lang.Class({
return notification;
},
- _onIdentifySent: function(room, command, username, password) {
+ _onIdentifySent(room, command, username, password) {
let accountPath = room.account.object_path;
let data = {
@@ -583,7 +583,7 @@ var TelepathyClient = new Lang.Class({
this._app.send_notification(this._getIdentifyNotificationID(accountPath), notification);
},
- _onMessageReceived: function(channel, msg) {
+ _onMessageReceived(channel, msg) {
let [id, ] = msg.get_pending_message_id();
let room = this._roomManager.lookupRoomByChannel(channel);
@@ -605,7 +605,7 @@ var TelepathyClient = new Lang.Class({
this._app.send_notification(this._getPendingNotificationID(room, id), notification);
},
- _onPendingMessageRemoved: function(channel, msg) {
+ _onPendingMessageRemoved(channel, msg) {
let [id, valid] = msg.get_pending_message_id();
if (!valid)
return;
diff --git a/src/userList.js b/src/userList.js
index aa862f2..922ee2c 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -19,7 +19,7 @@ var UserListPopover = new Lang.Class({
Name: 'UserListPopover',
Extends: Gtk.Popover,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this._createWidget();
@@ -34,7 +34,7 @@ var UserListPopover = new Lang.Class({
});
},
- vfunc_realize: function() {
+ vfunc_realize() {
this.parent();
let toplevel = this.get_toplevel();
@@ -42,7 +42,7 @@ var UserListPopover = new Lang.Class({
Lang.bind(this, this._activeRoomChanged));
},
- _createWidget: function() {
+ _createWidget() {
this._box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
spacing: 6 });
this.add(this._box);
@@ -61,7 +61,7 @@ var UserListPopover = new Lang.Class({
this._box.show_all();
},
- _activeRoomChanged: function() {
+ _activeRoomChanged() {
this._entry.text = '';
if (this._userList)
@@ -69,7 +69,7 @@ var UserListPopover = new Lang.Class({
this._userList = null;
},
- _ensureUserList: function() {
+ _ensureUserList() {
if (this._userList)
return;
@@ -85,7 +85,7 @@ var UserListPopover = new Lang.Class({
this._updateEntryVisibility();
},
- _updateEntryVisibility: function() {
+ _updateEntryVisibility() {
if (!this._userList)
return;
@@ -94,7 +94,7 @@ var UserListPopover = new Lang.Class({
this._revealer.reveal_child = reveal;
},
- _updateFilter: function() {
+ _updateFilter() {
if (!this._userList)
return;
this._userList.setFilter(this._entry.text);
@@ -123,7 +123,7 @@ var UserDetails = new Lang.Class({
READWRITE,
false)},
- _init: function(params = {}) {
+ _init(params = {}) {
let user = params.user;
delete params.user;
@@ -209,7 +209,7 @@ var UserDetails = new Lang.Class({
this.notify('expanded');
},
- _expand: function() {
+ _expand() {
this._detailsGrid.visible = this._initialDetailsLoaded;
this._spinnerBox.visible = !this._initialDetailsLoaded;
this._spinner.start();
@@ -224,7 +224,7 @@ var UserDetails = new Lang.Class({
this._revealDetails();
},
- _unexpand: function() {
+ _unexpand() {
this._spinner.stop();
if (this._cancellable)
@@ -232,7 +232,7 @@ var UserDetails = new Lang.Class({
this._cancellable = null;
},
- _formatLast: function(seconds) {
+ _formatLast(seconds) {
if (seconds < 60)
return ngettext("%d second ago",
"%d seconds ago", seconds).format(seconds);
@@ -262,7 +262,7 @@ var UserDetails = new Lang.Class({
"%d months ago", months).format(months);
},
- _onContactInfoReady: function(c, res) {
+ _onContactInfoReady(c, res) {
this._initialDetailsLoaded = true;
let fn, last;
@@ -289,13 +289,13 @@ var UserDetails = new Lang.Class({
this._revealDetails();
},
- _revealDetails: function() {
+ _revealDetails() {
this._spinner.stop();
this._spinnerBox.hide();
this._detailsGrid.show();
},
- _onMessageButtonClicked: function() {
+ _onMessageButtonClicked() {
let account = this._user.connection.get_account();
let app = Gio.Application.get_default();
@@ -308,7 +308,7 @@ var UserDetails = new Lang.Class({
time ]));
},
- _updateButtonVisibility: function() {
+ _updateButtonVisibility() {
if (!this._user) {
this._messageButton.sensitive = false;
@@ -334,7 +334,7 @@ var UserPopover = new Lang.Class({
'notifyButton',
'userDetails'],
- _init: function(params) {
+ _init(params) {
this._room = params.room;
delete params.room;
@@ -378,7 +378,7 @@ var UserPopover = new Lang.Class({
this._setBasenick(Polari.util_get_basenick(nickname));
},
- _setBasenick: function(basenick) {
+ _setBasenick(basenick) {
if (this._basenick == basenick)
return;
@@ -408,7 +408,7 @@ var UserPopover = new Lang.Class({
return this._nickname;
},
- _onStatusChanged: function() {
+ _onStatusChanged() {
let status = this._userTracker.getNickStatus(this._nickname);
let roomStatus = this._userTracker.getNickRoomStatus(this._nickname,
this._room);
@@ -425,11 +425,11 @@ var UserPopover = new Lang.Class({
this._nickLabel.sensitive = (status == Tp.ConnectionPresenceType.AVAILABLE);
},
- _updateDetailsContact: function() {
+ _updateDetailsContact() {
this._userDetails.user = this._userTracker.lookupContact(this._nickname);
},
- _onNickStatusChanged: function(baseNick, status) {
+ _onNickStatusChanged(baseNick, status) {
this._onStatusChanged();
}
});
@@ -438,7 +438,7 @@ var UserListRow = new Lang.Class({
Name: 'UserListRow',
Extends: Gtk.ListBoxRow,
- _init: function(user) {
+ _init(user) {
this._user = user;
this.parent();
@@ -469,7 +469,7 @@ var UserListRow = new Lang.Class({
this._revealer.reveal_child = expand;
},
- _createWidget: function() {
+ _createWidget() {
let vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
this.add(vbox);
@@ -492,7 +492,7 @@ var UserListRow = new Lang.Class({
this.show_all();
},
- _ensureDetails: function() {
+ _ensureDetails() {
if (this._revealer.get_child())
return;
@@ -503,16 +503,16 @@ var UserListRow = new Lang.Class({
this._revealer.add(details);
},
- shouldShow: function() {
+ shouldShow() {
return this._user.alias.toLowerCase().indexOf(this._filter) != -1;
},
- setFilter: function(filter) {
+ setFilter(filter) {
this._filter = filter.toLowerCase();
this._updateLabel();
},
- _updateLabel: function() {
+ _updateLabel() {
let filterIndex = -1;
if (this._filter)
filterIndex = this._user.alias.toLowerCase().indexOf(this._filter);
@@ -527,14 +527,14 @@ var UserListRow = new Lang.Class({
}
},
- _updateArrowVisibility: function() {
+ _updateArrowVisibility() {
let flags = this.get_state_flags();
this._arrow.visible = this.expand ||
flags & Gtk.StateFlags.PRELIGHT ||
flags & Gtk.StateFlags.FOCUSED;
},
- _onExpandedChanged: function() {
+ _onExpandedChanged() {
if (this._revealer.reveal_child) {
this.get_style_context().add_class('expanded');
this._arrow.arrow_type = Gtk.ArrowType.DOWN;
@@ -550,7 +550,7 @@ var UserList = new Lang.Class({
Name: 'UserList',
Extends: Gtk.ScrolledWindow,
- _init: function(room) {
+ _init(room) {
this.parent({ hexpand: true,
shadow_type: Gtk.ShadowType.ETCHED_IN,
hscrollbar_policy: Gtk.PolicyType.NEVER,
@@ -627,18 +627,18 @@ var UserList = new Lang.Class({
return Object.keys(this._rows).length;
},
- _onDestroy: function() {
+ _onDestroy() {
for (let i = 0; i < this._roomSignals.length; i++)
this._room.disconnect(this._roomSignals[i]);
this._roomSignals = [];
},
- setFilter: function(filter) {
+ setFilter(filter) {
this._filter = filter;
this._list.invalidate_filter();
},
- _updateContentHeight: function() {
+ _updateContentHeight() {
if (this._updateHeightId != 0)
return;
@@ -662,24 +662,24 @@ var UserList = new Lang.Class({
});
},
- _onMemberRenamed: function(room, oldMember, newMember) {
+ _onMemberRenamed(room, oldMember, newMember) {
this._removeMember(oldMember);
this._addMember(newMember);
},
- _onMemberRemoved: function(room, member) {
+ _onMemberRemoved(room, member) {
this._removeMember(member);
},
- _onMemberJoined: function(room, member) {
+ _onMemberJoined(room, member) {
this._addMember(member);
},
- _onMembersChanged: function(room) {
+ _onMembersChanged(room) {
this._counterLabel.label = this.numRows.toString();
},
- _onChannelChanged: function(room) {
+ _onChannelChanged(room) {
this._list.foreach(w => { w.destroy(); });
this._rows = {};
@@ -691,40 +691,40 @@ var UserList = new Lang.Class({
this._addMember(members[i]);
},
- _addMember: function(member) {
+ _addMember(member) {
let row = new UserListRow(member);
this._rows[member] = row;
this._list.add(row);
},
- _removeMember: function(member) {
+ _removeMember(member) {
let row = this._rows[member];
if (row)
row.destroy();
delete this._rows[member];
},
- _setActiveRow: function(row) {
+ _setActiveRow(row) {
if (this._activeRow && this._activeRow != row)
this._activeRow.expand = false;
this._activeRow = row;
},
- _onRowActivated: function(list, row) {
+ _onRowActivated(list, row) {
this._setActiveRow(row);
this._activeRow.expand = !this._activeRow.expand;
},
- _sort: function(row1, row2) {
+ _sort(row1, row2) {
return row1.user.alias.localeCompare(row2.user.alias);
},
- _filterRows: function(row) {
+ _filterRows(row) {
row.setFilter(this._filter);
return row.shouldShow();
},
- _updateHeader: function(row, before) {
+ _updateHeader(row, before) {
if (before) {
row.set_header(null);
return;
diff --git a/src/userTracker.js b/src/userTracker.js
index 4661060..87f9bfe 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -21,7 +21,7 @@ function getUserStatusMonitor() {
var UserStatusMonitor = new Lang.Class({
Name: 'UserStatusMonitor',
- _init: function() {
+ _init() {
this._userTrackers = new Map();
this._accountsMonitor = AccountsMonitor.getDefault();
@@ -34,18 +34,18 @@ var UserStatusMonitor = new Lang.Class({
a => { this._onAccountAdded(this._accountsMonitor, a); });
},
- _onAccountAdded: function(accountsMonitor, account) {
+ _onAccountAdded(accountsMonitor, account) {
if (this._userTrackers.has(account))
return;
this._userTrackers.set(account, new UserTracker(account));
},
- _onAccountRemoved: function(accountsMonitor, account) {
+ _onAccountRemoved(accountsMonitor, account) {
this._userTrackers.delete(account);
},
- getUserTrackerForAccount: function(account) {
+ getUserTrackerForAccount(account) {
return this._userTrackers.get(account);
}
});
@@ -66,7 +66,7 @@ var UserTracker = new Lang.Class({
}
},
- _init: function(account) {
+ _init(account) {
this.parent();
this._account = account;
@@ -83,24 +83,24 @@ var UserTracker = new Lang.Class({
this._roomManager.connect('room-removed', Lang.bind(this, this._onRoomRemoved));
},
- _onShutdown: function() {
+ _onShutdown() {
for (let room of this._roomData.keys())
this._onRoomRemoved(this._roomManager, room);
},
- _getRoomContacts: function(room) {
+ _getRoomContacts(room) {
return this._roomData.get(room).contactMapping;
},
- _getRoomHandlers: function(room) {
+ _getRoomHandlers(room) {
return this._roomData.get(room).handlerMapping;
},
- _getRoomSignals: function(room) {
+ _getRoomSignals(room) {
return this._roomData.get(room).roomSignals;
},
- _onRoomAdded: function(roomManager, room) {
+ _onRoomAdded(roomManager, room) {
if (room.account != this._account)
return;
@@ -129,7 +129,7 @@ var UserTracker = new Lang.Class({
});
},
- _onRoomRemoved: function(roomManager, room) {
+ _onRoomRemoved(roomManager, room) {
if (!this._roomData.has(room))
return;
@@ -138,7 +138,7 @@ var UserTracker = new Lang.Class({
this._roomData.delete(room);
},
- _onChannelChanged: function(room) {
+ _onChannelChanged(room) {
if (!room.channel) {
this._clearUsersFromRoom(room);
return;
@@ -155,13 +155,13 @@ var UserTracker = new Lang.Class({
members.forEach(m => { this._trackMember(m, room); });
},
- _clearUsersFromRoom: function(room) {
+ _clearUsersFromRoom(room) {
let map = this._getRoomContacts(room);
for (let [baseNick, contacts] of map)
contacts.slice().forEach((m) => { this._untrackMember(m, room); });
},
- _ensureRoomMappingForRoom: function(room) {
+ _ensureRoomMappingForRoom(room) {
if (this._roomData.has(room))
return;
this._roomData.set(room, { contactMapping: new Map(),
@@ -169,20 +169,20 @@ var UserTracker = new Lang.Class({
roomSignals: [] });
},
- _onMemberRenamed: function(room, oldMember, newMember) {
+ _onMemberRenamed(room, oldMember, newMember) {
this._untrackMember(oldMember, room);
this._trackMember(newMember, room);
},
- _onMemberJoined: function(room, member) {
+ _onMemberJoined(room, member) {
this._trackMember(member, room);
},
- _onMemberLeft: function(room, member) {
+ _onMemberLeft(room, member) {
this._untrackMember(member, room);
},
- _runHandlers: function(room, member, status) {
+ _runHandlers(room, member, status) {
let baseNick = Polari.util_get_basenick(member.alias);
let roomHandlers = this._getRoomHandlers(room);
for (let [id, info] of roomHandlers)
@@ -190,14 +190,14 @@ var UserTracker = new Lang.Class({
info.handler(baseNick, status);
},
- _pushMember: function(map, baseNick, member) {
+ _pushMember(map, baseNick, member) {
if (!map.has(baseNick))
map.set(baseNick, []);
let contacts = map.get(baseNick);
return contacts.push(member);
},
- _trackMember: function(member, room) {
+ _trackMember(member, room) {
let baseNick = Polari.util_get_basenick(member.alias);
let status = Tp.ConnectionPresenceType.AVAILABLE;
@@ -224,7 +224,7 @@ var UserTracker = new Lang.Class({
this.emit("contacts-changed::" + baseNick, member.alias);
},
- _popMember: function(map, baseNick, member) {
+ _popMember(map, baseNick, member) {
let contacts = map.get(baseNick) || [];
let index = contacts.map(c => c.alias).indexOf(member.alias);
if (index < 0)
@@ -233,7 +233,7 @@ var UserTracker = new Lang.Class({
return [true, contacts.length];
},
- _untrackMember: function(member, room) {
+ _untrackMember(member, room) {
let baseNick = Polari.util_get_basenick(member.alias);
let status = Tp.ConnectionPresenceType.OFFLINE;
@@ -261,7 +261,7 @@ var UserTracker = new Lang.Class({
}
},
- getNickStatus: function(nickName) {
+ getNickStatus(nickName) {
let baseNick = Polari.util_get_basenick(nickName);
let contacts = this._baseNickContacts.get(baseNick) || [];
@@ -269,7 +269,7 @@ var UserTracker = new Lang.Class({
: Tp.ConnectionPresenceType.AVAILABLE;
},
- getNickRoomStatus: function(nickName, room) {
+ getNickRoomStatus(nickName, room) {
let baseNick = Polari.util_get_basenick(nickName);
this._ensureRoomMappingForRoom(room);
@@ -279,7 +279,7 @@ var UserTracker = new Lang.Class({
: Tp.ConnectionPresenceType.AVAILABLE;
},
- lookupContact: function(nickName) {
+ lookupContact(nickName) {
let baseNick = Polari.util_get_basenick(nickName);
let contacts = this._baseNickContacts.get(baseNick) || [];
@@ -293,7 +293,7 @@ var UserTracker = new Lang.Class({
return contacts[0];
},
- watchRoomStatus: function(room, baseNick, callback) {
+ watchRoomStatus(room, baseNick, callback) {
this._ensureRoomMappingForRoom(room);
this._getRoomHandlers(room).set(++this._handlerCounter, {
@@ -304,13 +304,13 @@ var UserTracker = new Lang.Class({
return this._handlerCounter;
},
- unwatchRoomStatus: function(room, handlerID) {
+ unwatchRoomStatus(room, handlerID) {
if (!this._roomData.has(room))
return;
this._getRoomHandlers(room).delete(handlerID);
},
- _notifyNickAvailable: function (member, room) {
+ _notifyNickAvailable (member, room) {
let notification = new Gio.Notification();
notification.set_title(_("User is online"));
notification.set_body(_("User %s is now online.").format(member.alias));
@@ -326,27 +326,27 @@ var UserTracker = new Lang.Class({
let baseNick = Polari.util_get_basenick(member.alias);
},
- _shouldNotifyNick: function(nickName) {
+ _shouldNotifyNick(nickName) {
let actionName = this._getNotifyActionNameInternal(nickName);
let state = this._app.get_action_state(actionName);
return state ? state.get_boolean()
: false;
},
- _setNotifyActionEnabled: function(nickName, enabled) {
+ _setNotifyActionEnabled(nickName, enabled) {
let name = this._getNotifyActionNameInternal(nickName);
let action = this._app.lookup_action(name);
if (action)
action.enabled = enabled;
},
- _getNotifyActionNameInternal: function(nickName) {
+ _getNotifyActionNameInternal(nickName) {
return 'notify-user-' +
this._account.get_path_suffix() + '-' +
Polari.util_get_basenick(nickName);
},
- getNotifyActionName: function(nickName) {
+ getNotifyActionName(nickName) {
let name = this._getNotifyActionNameInternal(nickName);
if (!this._app.lookup_action(name)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]