diff --git a/Makefile b/Makefile index 86bbc3a..4109b20 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ EXTENSION_FILES=stylesheet.css metadata.json OUTPUT=$(DOC_FILES) $(SRC_FILES) $(MO_FILES) $(SCHEMA_FILES) $(EXTENSION_FILES) POT_FILE=po/$(GETTEXT_PACKAGE).pot LOCAL_INSTALL=~/.local/share/gnome-shell/extensions/$(UUID) -pack: $(OUTPUT) +pack: update-po schemas/gschemas.compiled $(OUTPUT) zip $(UUID).zip $(OUTPUT) $(POT_FILE): $(SRC_FILES) diff --git a/metadata.json b/metadata.json index e3488fa..83a7f43 100644 --- a/metadata.json +++ b/metadata.json @@ -3,8 +3,14 @@ "description": "Displays Internet Speed", "name": "NetSpeed", "original-author": "hedayaty@gmail.com", - "shell-version": [ "40", "41", "42", "43", "44" ], + "shell-version": [ + "40", + "41", + "42", + "43", + "44" + ], "url": "https://github.com/hedayaty/NetSpeed", "uuid": "netspeed@hedayaty.gmail.com", "version": 32 -} +} \ No newline at end of file diff --git a/net_speed.js b/net_speed.js index 848e386..53ae990 100644 --- a/net_speed.js +++ b/net_speed.js @@ -39,500 +39,520 @@ const Logger = Lib.getLogger(); * The extension */ var NetSpeed = class NetSpeed { - /** - * NetSpeed: _init - * Constructor - */ - constructor() { - let localeDir = Extension.dir.get_child('locale'); - if (localeDir.query_exists(null)) { - Gettext.bindtextdomain('netspeed', localeDir.get_path()); - } + /** + * NetSpeed: _init + * Constructor + */ + constructor() { + let localeDir = Extension.dir.get_child('locale'); + if (localeDir.query_exists(null)) { + Gettext.bindtextdomain('netspeed', localeDir.get_path()); } - - /** - * NetSpeed: _is_up2date - */ - _is_up2date() { - if (this._devices.length != this._olddevices.length) { - return 0; - } - for (let i = 0; i < this._devices.length; ++i) { - if (this._devices[i] != this._olddevices[i]) - return 0; - } - return 1; + } + + /** + * NetSpeed: _is_up2date + */ + _is_up2date() { + if (this._devices.length != this._olddevices.length) { + return 0; } - - /** - * NetSpeed: get_device_type - */ - get_device_type(device) { - let devices = this._client.get_devices() || []; - - for (let dev of devices) { - if (dev.interface == device) { - switch (dev.device_type) { - case NetworkManager.DeviceType.ETHERNET: - return "ethernet"; - case NetworkManager.DeviceType.WIFI: - return "wifi"; - case NetworkManager.DeviceType.BT: - return "bt"; - case NetworkManager.DeviceType.OLPC_MESH: - return "olpcmesh"; - case NetworkManager.DeviceType.WIMAX: - return "wimax"; - case NetworkManager.DeviceType.MODEM: - return "modem"; - default: - return "none"; - } - } - } - - return "none"; + for (let i = 0; i < this._devices.length; ++i) { + if (this._devices[i] != this._olddevices[i]) + return 0; } - - /** - * NetSpeed: _speed_to_string - */ - _speed_to_string(amount) { - let m_digits = this.digits; - let divider, byte_speed_map, bit_speed_map; - if (this.bin_prefixes) { - divider = 1024; // 1MiB = 1024kiB - byte_speed_map = [_("B/s"), _("kiB/s"), _("MiB/s"), _("GiB/s")]; - bit_speed_map = [_("b/s"), _("kib/s"), _("Mib/s"), _("Gib/s")]; - } else { - divider = 1000; // 1MB = 1000kB - byte_speed_map = [_("B/s"), _("kB/s"), _("MB/s"), _("GB/s")]; - bit_speed_map = [_("b/s"), _("kb/s"), _("Mb/s"), _("Gb/s")]; - } - if (amount == 0) - return { text: "0", unit: _(this.use_bytes ? "B/s" : "b/s") }; - if (m_digits < 3) - m_digits = 3; - amount *= 1000 * (this.use_bytes ? 1 : 8); - let unit = 0; - while (amount >= divider && unit < 3) { // 1M=1024K, 1MB/s=1000MB/s - amount /= divider; - ++unit; + return 1; + } + + /** + * NetSpeed: get_device_type + */ + get_device_type(device) { + let devices = this._client.get_devices() || []; + + for (let dev of devices) { + if (dev.interface == device) { + switch (dev.device_type) { + case NetworkManager.DeviceType.ETHERNET: + return "ethernet"; + case NetworkManager.DeviceType.WIFI: + return "wifi"; + case NetworkManager.DeviceType.BT: + return "bt"; + case NetworkManager.DeviceType.OLPC_MESH: + return "olpcmesh"; + case NetworkManager.DeviceType.WIMAX: + return "wimax"; + case NetworkManager.DeviceType.MODEM: + return "modem"; + default: + return "none"; } - - if (amount >= 100) - m_digits -= 2; - else if (amount >= 10) - m_digits -= 1; - - return { - text: amount.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: m_digits - 1 }), - unit: (this.use_bytes ? byte_speed_map : bit_speed_map)[unit] - }; + } } - /** - * NetSpeed: _set_labels - */ - _set_labels(sum, up, down) { - this._status_icon.set_labels(sum, up, down); + return "none"; + } + + /** + * NetSpeed: _speed_to_string + */ + _speed_to_string(amount) { + let m_digits = this.digits; + let divider, byte_speed_map, bit_speed_map; + if (this.bin_prefixes) { + divider = 1024; // 1MiB = 1024kiB + byte_speed_map = [_("B/s"), _("kiB/s"), _("MiB/s"), _("GiB/s")]; + bit_speed_map = [_("b/s"), _("kib/s"), _("Mib/s"), _("Gib/s")]; + } else { + divider = 1000; // 1MB = 1000kB + byte_speed_map = [_("B/s"), _("kB/s"), _("MB/s"), _("GB/s")]; + bit_speed_map = [_("b/s"), _("kb/s"), _("Mb/s"), _("Gb/s")]; } - - /** - * NetSpeed: _update_speeds - */ - _update_speeds() { - this._status_icon.update_speeds(this._speeds); - - // fix #131 by forcing a delayed redraw - GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1, () => { - this._status_icon.queue_redraw(); - return GLib.SOURCE_REMOVE; - }); + if (amount == 0) + return { text: "0", unit: _(this.use_bytes ? "B/s" : "b/s") }; + if (m_digits < 3) + m_digits = 3; + amount *= 1000 * (this.use_bytes ? 1 : 8); + let unit = 0; + while (amount >= divider && unit < 3) { // 1M=1024K, 1MB/s=1000MB/s + amount /= divider; + ++unit; } - /** - * NetSpeed: _update_ips - */ - _update_ips() { - this._status_icon.update_ips(this._ips); + if (amount >= 100) + m_digits -= 2; + else if (amount >= 10) + m_digits -= 1; + + return { + text: amount.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: m_digits - 1 }), + unit: (this.use_bytes ? byte_speed_map : bit_speed_map)[unit] + }; + } + + /** + * NetSpeed: _set_labels + */ + _set_labels(sum, up, down) { + this._status_icon.set_labels(sum, up, down); + } + + /** + * NetSpeed: _update_speeds + */ + _update_speeds() { + this._status_icon.update_speeds(this._speeds); + + // fix #131 by forcing a delayed redraw + GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1, () => { + this._status_icon.queue_redraw(); + return GLib.SOURCE_REMOVE; + }); + } + + /** + * NetSpeed: _update_ips + */ + _update_ips() { + this._status_icon.update_ips(this._ips); + } + + /** + * NetSpeed: _create_menu + */ + _create_menu() { + let types = new Array(); + let devices_text = new Array(); + for (let dev of this._devices) { + types.push(this.get_device_type(dev)); + let wifi_ssid = this._retrieve_wifi_ssid(dev); + //Logger.info(`wifi_ssid is '${wifi_ssid}' for dev '${dev}'`); + if (wifi_ssid != null) { + devices_text.push(dev + `\n${wifi_ssid}`) + continue; + } + devices_text.push(dev); } - - /** - * NetSpeed: _create_menu - */ - _create_menu() { - let types = new Array(); - let devices_text = new Array(); - for (let dev of this._devices) { - types.push(this.get_device_type(dev)); - let wifi_ssid = this._retrieve_wifi_ssid(dev); - //Logger.info(`wifi_ssid is '${wifi_ssid}' for dev '${dev}'`); - if (wifi_ssid != null) { - devices_text.push(dev + `\n${wifi_ssid}`) - continue; - } - devices_text.push(dev); - } - this._status_icon.create_menu(devices_text, types); + this._status_icon.create_menu(devices_text, types); + } + + /** + * NetSpeed: _updateDefaultGw + */ + _updateDefaultGw() { + let flines = GLib.file_get_contents('/proc/net/route'); // Read the file + let nlines = ByteArray.toString(flines[1]).split("\n"); // Break to lines + for (let nline of nlines) { //first 2 lines are for header + let line = nline.replace(/^ */g, ""); + let params = line.split("\t"); + if (params.length != 11) // ignore empty lines + continue; + // So store up/down values + if (params[1] == "00000000") { + this._defaultGw = params[0]; + } } - - /** - * NetSpeed: _updateDefaultGw - */ - _updateDefaultGw() { - let flines = GLib.file_get_contents('/proc/net/route'); // Read the file - let nlines = ByteArray.toString(flines[1]).split("\n"); // Break to lines - for (let nline of nlines) { //first 2 lines are for header - let line = nline.replace(/^ */g, ""); - let params = line.split("\t"); - if (params.length != 11) // ignore empty lines - continue; - // So store up/down values - if (params[1] == "00000000") { - this._defaultGw = params[0]; - } - } + } + + /** + * NetSpeed: _update + */ + _update() { + this._updateDefaultGw(); + let flines = GLib.file_get_contents('/proc/net/dev'); // Read the file + let nlines = ByteArray.toString(flines[1]).split("\n"); // Break to lines + + let up = 0; // set initial + let down = 0; + this._oldvalues = this._values; + this._values = new Array(); + this._speeds = new Array(); + this._ips = new Array(); + this._olddevices = this._devices; + this._devices = new Array(); + + let time = GLib.get_monotonic_time() / 1000; // current time 1000 is not the net_speed.timer! + let delta = time - this._last_time; // Here the difference is evaluated + this._last_time = time; + + // parse the file + for (let i = 2; i < nlines.length - 1; ++i) { //first 2 lines are for header + let line = nlines[i].replace(/ +/g, " ").replace(/^ */g, ""); + let params = line.split(" "); + if (params[0].replace(":", "") == "lo") // ignore local device + continue; + // So store up/down values + this._values.push([parseInt(params[9]), parseInt(params[1])]); + this._devices.push(params[0].replace(":", "")); } - /** - * NetSpeed: _update - */ - _update() { - this._updateDefaultGw(); - let flines = GLib.file_get_contents('/proc/net/dev'); // Read the file - let nlines = ByteArray.toString(flines[1]).split("\n"); // Break to lines - - let up = 0; // set initial - let down = 0; - this._oldvalues = this._values; - this._values = new Array(); - this._speeds = new Array(); - this._ips = new Array(); - this._olddevices = this._devices; - this._devices = new Array(); - - let time = GLib.get_monotonic_time() / 1000; // current time 1000 is not the net_speed.timer! - let delta = time - this._last_time; // Here the difference is evaluated - this._last_time = time; - - // parse the file - for (let i = 2; i < nlines.length - 1; ++i) { //first 2 lines are for header - let line = nlines[i].replace(/ +/g, " ").replace(/^ */g, ""); - let params = line.split(" "); - if (params[0].replace(":", "") == "lo") // ignore local device - continue; - // So store up/down values - this._values.push([parseInt(params[9]), parseInt(params[1])]); - this._devices.push(params[0].replace(":", "")); - } - - //log("[netspeed] Devices: " + this._devices); - - var total = 0; - var total_speed = null; - var up_speed = null; - var down_speed = null; - - if (this._is_up2date() == 1 && !this._device_state_changed) { - for (let i = 0; i < this._values.length; ++i) { - let _up = this._values[i][0] - this._oldvalues[i][0]; - let _down = this._values[i][1] - this._oldvalues[i][1]; - - // Avoid negetive speed in case of device going down, when device goes down, - if (_up < 0) - _up = 0; - if (_down < 0) - _down = 0; - - let _up_speed = this._speed_to_string(_up / delta); - let _down_speed = this._speed_to_string(_down / delta); - this._speeds.push({ - up: _up_speed.text + " " + _up_speed.unit, - down: _down_speed.text + " " + _down_speed.unit - }); - - total += _down + _up; - up += _up; - down += _down; - if (this.getDevice() == this._devices[i]) { - total_speed = this._speed_to_string((_up + _down) / delta); - up_speed = this._speed_to_string(_up / delta); - down_speed = this._speed_to_string(_down / delta); - } - } - if (total_speed == null) { - total_speed = this._speed_to_string(total / delta); - up_speed = this._speed_to_string(up / delta); - down_speed = this._speed_to_string(down / delta); - } - - this._set_labels(total_speed, up_speed, down_speed); - this._update_speeds(); - } else { - this._create_menu(); - } + //log("[netspeed] Devices: " + this._devices); + + var total = 0; + var total_speed = null; + var up_speed = null; + var down_speed = null; + + if (this._is_up2date() == 1 && !this._device_state_changed) { + for (let i = 0; i < this._values.length; ++i) { + let _up = this._values[i][0] - this._oldvalues[i][0]; + let _down = this._values[i][1] - this._oldvalues[i][1]; + + // Avoid negetive speed in case of device going down, when device goes down, + if (_up < 0) + _up = 0; + if (_down < 0) + _down = 0; + + let _up_speed = this._speed_to_string(_up / delta); + let _down_speed = this._speed_to_string(_down / delta); + this._speeds.push({ + up: _up_speed.text + " " + _up_speed.unit, + down: _down_speed.text + " " + _down_speed.unit + }); - if (this._device_state_changed && this.show_ips) { - this._retrieve_ips(); - this._update_ips(); - Logger.debug("Retrieved ips"); + total += _down + _up; + up += _up; + down += _down; + if (this.getDevice() == this._devices[i]) { + total_speed = this._speed_to_string((_up + _down) / delta); + up_speed = this._speed_to_string(_up / delta); + down_speed = this._speed_to_string(_down / delta); } - - // reset state - this._device_state_changed = false; - - return true; + } + if (total_speed == null) { + total_speed = this._speed_to_string(total / delta); + up_speed = this._speed_to_string(up / delta); + down_speed = this._speed_to_string(down / delta); + } + + this._set_labels(total_speed, up_speed, down_speed); + this._update_speeds(); + } else { + this._create_menu(); } - /** - * NetSpeed: _load - */ - _load() { - if (this._saving == 1) { - return; - } - this.showsum = this._setting.get_boolean('show-sum'); - this.use_icon = this._setting.get_boolean('icon-display'); - this.digits = this._setting.get_int('digits'); - this._device = this._setting.get_string('device'); - this.timer = this._setting.get_int('timer'); - this.label_size = this._setting.get_int('label-size'); - this.unit_label_size = this._setting.get_int('unit-label-size'); - this.menu_label_size = this._setting.get_int('menu-label-size'); - this.use_bytes = this._setting.get_boolean('use-bytes'); - this.bin_prefixes = this._setting.get_boolean('bin-prefixes'); - this.show_ips = this._setting.get_boolean('show-ips'); - this.vert_align = this._setting.get_boolean('vert-align'); + if (this._device_state_changed && this.show_ips) { + this._retrieve_ips(); + this._update_ips(); + Logger.debug("Retrieved ips"); } - /** - * NetSpeed: save - */ - save() { - this._saving = 1; // Disable Load - this._setting.set_boolean('show-sum', this.showsum); - this._setting.set_string('device', this._device); - this._setting.set_boolean('show-ips', this.show_ips); - this._saving = 0; // Enable Load - } - - /** - * NetSpeed: _reload - */ - _reload() { - if (this._setting !== null) { - let m_timer = this._setting.get_int('timer'); - if (m_timer !== this.timer) { - Mainloop.source_remove(this._timerid); - this._timerid = Mainloop.timeout_add(m_timer, Lang.bind(this, this._update)); - // this.timer will be updated within this._load, so no need to update it here - } - this._load(); - this._status_icon.updateui(); - } - } - - /** - * NetSpeed: enable - * exported to enable the extension - */ - enable() { - this._last_up = 0; // size of upload in previous snapshot - this._last_down = 0; // size of download in previous snapshot - this._last_time = 0; // time of the latest snapshot - this._device_state_changed = true; // flag to trigger menu refreshing - - this._values = new Array(); - this._devices = new Array(); - this._client = NetworkManager.Client.new(null); - this._nm_signals = new Array(); - this._nm_signals.push(this._client.connect('any-device-added', Lang.bind(this, this._nm_device_changed))); - this._nm_signals.push(this._client.connect('any-device-removed', Lang.bind(this, this._nm_device_changed))); - this._nm_signals.push(this._client.connect('connection-added', Lang.bind(this, this._nm_connection_changed))); - this._nm_signals.push(this._client.connect('connection-removed', Lang.bind(this, this._nm_connection_changed))); - this._nm_signals.push(this._client.connect('active-connection-added', Lang.bind(this, this._nm_connection_changed))); - this._nm_signals.push(this._client.connect('active-connection-removed', Lang.bind(this, this._nm_connection_changed))); - - // store NM Device 'state-changed' signal bindings to disconnect on disable - this._nm_devices_signals_map = new Map(); - - let schemaDir = Extension.dir.get_child('schemas'); - let schemaSource = schemaDir.query_exists(null) ? - Gio.SettingsSchemaSource.new_from_directory(schemaDir.get_path(), Gio.SettingsSchemaSource.get_default(), false) : - Gio.SettingsSchemaSource.get_default(); - let schema = schemaSource.lookup('org.gnome.shell.extensions.netspeed', false); - this._setting = new Gio.Settings({ settings_schema: schema }); - this._saving = 0; - this._load(); - - this._updateDefaultGw(); - - this._changed = this._setting.connect('changed', Lang.bind(this, this._reload)); - this._timerid = Mainloop.timeout_add(this.timer, Lang.bind(this, this._update)); - this._status_icon = new NetSpeedStatusIcon.NetSpeedStatusIcon(this); - let placement = this._setting.get_string('placement'); - Panel.addToStatusArea('netspeed', this._status_icon, 0, placement); + // reset state + this._device_state_changed = false; + return true; + } + /** + * NetSpeed: _load + */ + _load() { + if (this._saving == 1) { + return; } - - /** - * NetSpeed: disable - * exported to disable the extension - */ - disable() { - if (this._timerid != 0) { - Mainloop.source_remove(this._timerid); - this._timerid = 0; - } - this._devices = null; - this._values = null; - this._olddevices = null; - this._oldvalues = null; - this._setting = null; - - this._nm_signals.forEach(sig_id => { - this._client.disconnect(sig_id); - }); - - this._disconnect_all_nm_device_state_changed(); - this._client = null; - this._status_icon.destroy(); - this._status_icon = null; + this.showsum = this._setting.get_boolean('show-sum'); + this.use_icon = this._setting.get_boolean('icon-display'); + this.digits = this._setting.get_int('digits'); + this._device = this._setting.get_string('device'); + this.timer = this._setting.get_int('timer'); + this.label_size = this._setting.get_int('label-size'); + this.unit_label_size = this._setting.get_int('unit-label-size'); + this.menu_label_size = this._setting.get_int('menu-label-size'); + this.use_bytes = this._setting.get_boolean('use-bytes'); + this.bin_prefixes = this._setting.get_boolean('bin-prefixes'); + this.show_ips = this._setting.get_boolean('show-ips'); + this.vert_align = this._setting.get_boolean('vert-align'); + } + + /** + * NetSpeed: save + */ + save() { + this._saving = 1; // Disable Load + this._setting.set_boolean('show-sum', this.showsum); + this._setting.set_string('device', this._device); + this._setting.set_boolean('show-ips', this.show_ips); + this._saving = 0; // Enable Load + } + + /** + * NetSpeed: _reload + */ + _reload() { + if (this._setting !== null) { + let m_timer = this._setting.get_int('timer'); + if (m_timer !== this.timer) { + Mainloop.source_remove(this._timerid); + this._timerid = Mainloop.timeout_add(m_timer, Lang.bind(this, this._update)); + // this.timer will be updated within this._load, so no need to update it here + } + this._load(); + this._status_icon.updateui(); } - - getDevice() { - if (this._device == "defaultGW") { - return this._defaultGw; - } else { - return this._device; - } + } + + _positionInPanelChanged() { + this._status_icon.get_parent().remove_actor(this._status_icon); + + // small HACK with private boxes :) + let boxes = { + left: Panel._leftBox, + center: Panel._centerBox, + right: Panel._rightBox + }; + + let p = this._setting.get_string('placement'); + let i = this._setting.get_int('placement-index'); + + Logger.debug(`_positionInPanelChanged: ${p} at index ${i}`); + + boxes[p].insert_child_at_index(this._status_icon, i); + } + + /** + * NetSpeed: enable + * exported to enable the extension + */ + enable() { + this._last_up = 0; // size of upload in previous snapshot + this._last_down = 0; // size of download in previous snapshot + this._last_time = 0; // time of the latest snapshot + this._device_state_changed = true; // flag to trigger menu refreshing + + this._values = new Array(); + this._devices = new Array(); + this._client = NetworkManager.Client.new(null); + this._nm_signals = new Array(); + this._nm_signals.push(this._client.connect('any-device-added', Lang.bind(this, this._nm_device_changed))); + this._nm_signals.push(this._client.connect('any-device-removed', Lang.bind(this, this._nm_device_changed))); + this._nm_signals.push(this._client.connect('connection-added', Lang.bind(this, this._nm_connection_changed))); + this._nm_signals.push(this._client.connect('connection-removed', Lang.bind(this, this._nm_connection_changed))); + this._nm_signals.push(this._client.connect('active-connection-added', Lang.bind(this, this._nm_connection_changed))); + this._nm_signals.push(this._client.connect('active-connection-removed', Lang.bind(this, this._nm_connection_changed))); + + // store NM Device 'state-changed' signal bindings to disconnect on disable + this._nm_devices_signals_map = new Map(); + + let schemaDir = Extension.dir.get_child('schemas'); + let schemaSource = schemaDir.query_exists(null) ? + Gio.SettingsSchemaSource.new_from_directory(schemaDir.get_path(), Gio.SettingsSchemaSource.get_default(), false) : + Gio.SettingsSchemaSource.get_default(); + let schema = schemaSource.lookup('org.gnome.shell.extensions.netspeed', false); + this._setting = new Gio.Settings({ settings_schema: schema }); + this._saving = 0; + this._load(); + + this._updateDefaultGw(); + + this._changed = this._setting.connect('changed', Lang.bind(this, this._reload)); + this._timerid = Mainloop.timeout_add(this.timer, Lang.bind(this, this._update)); + this._status_icon = new NetSpeedStatusIcon.NetSpeedStatusIcon(this); + + this._positionInPanelChanged(); + this._placement_changed_id = this._setting.connect('changed::placement', this._positionInPanelChanged.bind(this)); + this._placement_index_changed_id = this._setting.connect('changed::placement-index', this._positionInPanelChanged.bind(this)); + + this._updateDefaultGw(); + } + + /** + * NetSpeed: disable + * exported to disable the extension + */ + disable() { + if (this._timerid != 0) { + Mainloop.source_remove(this._timerid); + this._timerid = 0; } - - setDevice(device) { - this._device = device; + this._devices = null; + this._values = null; + this._olddevices = null; + this._oldvalues = null; + this._setting = null; + + this._nm_signals.forEach(sig_id => { + this._client.disconnect(sig_id); + }); + + this._disconnect_all_nm_device_state_changed(); + this._client = null; + this._status_icon.destroy(); + this._status_icon = null; + } + + getDevice() { + if (this._device == "defaultGW") { + return this._defaultGw; + } else { + return this._device; } - - /** - * NetSpeed: _nm_device_changed - */ - _nm_device_changed(client, device) { - this._trigger_ips_reload(); + } + + setDevice(device) { + this._device = device; + } + + /** + * NetSpeed: _nm_device_changed + */ + _nm_device_changed(client, device) { + this._trigger_ips_reload(); + } + + /** + * NetSpeed: _nm_connection_changed + */ + _nm_connection_changed(client, connection) { + this._trigger_ips_reload(); + } + + /** + * NetSpeed: _trigger_ips_reload + */ + _trigger_ips_reload() { + this._device_state_changed = true; + } + + /** + * NetSpeed: _retrieve_ips + * get ips v4 + */ + _retrieve_ips() { + // remove previous connects + this._disconnect_all_nm_device_state_changed(); + + for (let dev of this._devices) { + let nm_dev = this._client.get_device_by_iface(dev); + let addresses = this._getAddresses(nm_dev, GLib.SYSDEF_AF_INET); + this._ips.push(addresses); + this._connect_nm_device_state_changed(nm_dev); } - - /** - * NetSpeed: _nm_connection_changed - */ - _nm_connection_changed(client, connection) { - this._trigger_ips_reload(); + } + + /** + * NetSpeed: _retrieve_wifi_ssid + * Retrieve access point name (SSID) for wifi device interface + */ + _retrieve_wifi_ssid(iface) { + let nm_dev = this._client.get_device_by_iface(iface); + if (nm_dev.get_device_type() == NetworkManager.DeviceType.WIFI) { + let active_ap = nm_dev.get_active_access_point(); + if (active_ap != null) { + return ByteArray.toString(ByteArray.fromGBytes(active_ap.get_ssid()), 'UTF-8'); + } } - - /** - * NetSpeed: _trigger_ips_reload - */ - _trigger_ips_reload() { - this._device_state_changed = true; + return null; + } + + /** + * NetSpeed: _connect_nm_device_state_changed + * @param {NM.Device} nm_device: NetworkManager Device instance + */ + _connect_nm_device_state_changed(nm_device) { + if (!this._nm_devices_signals_map.has(nm_device.get_iface())) { + let signal_id = nm_device.connect('state-changed', Lang.bind(this, this._nm_device_state_changed)); + this._nm_devices_signals_map.set(nm_device.get_iface(), [nm_device, signal_id]); } - - /** - * NetSpeed: _retrieve_ips - * get ips v4 - */ - _retrieve_ips() { - // remove previous connects - this._disconnect_all_nm_device_state_changed(); - - for (let dev of this._devices) { - let nm_dev = this._client.get_device_by_iface(dev); - let addresses = this._getAddresses(nm_dev, GLib.SYSDEF_AF_INET); - this._ips.push(addresses); - this._connect_nm_device_state_changed(nm_dev); - } + } + + /** + * NetSpeed: _disconnect_nm_device_state_changed + * Use GObject.signal_handler_disconnect to avoid override of disconnect + * due ot introspection on NM.Device . + */ + _disconnect_all_nm_device_state_changed() { + for (let [nm_device, signal_id] of this._nm_devices_signals_map.values()) { + GObject.signal_handler_disconnect(nm_device, signal_id); } - - /** - * NetSpeed: _retrieve_wifi_ssid - * Retrieve access point name (SSID) for wifi device interface - */ - _retrieve_wifi_ssid(iface) { - let nm_dev = this._client.get_device_by_iface(iface); - if (nm_dev.get_device_type() == NetworkManager.DeviceType.WIFI) { - let active_ap = nm_dev.get_active_access_point(); - if (active_ap != null) { - return ByteArray.toString(ByteArray.fromGBytes(active_ap.get_ssid()), 'UTF-8'); - } - } - return null; + this._nm_devices_signals_map.clear(); + } + + /** + * NetSpeed: _nm_device_state_changed + * Handler for NM.Device 'state-changed' signal + * See https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMDeviceState for states + * See https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMDeviceStateReason for reasons + */ + _nm_device_state_changed(nm_device, old_state, new_state, reason) { + //Logger.info(`${nm_device.get_iface()} move from ${old_state} to ${new_state}: reason ${reason}`); + this._trigger_ips_reload(); + } + + /** + * NetSpeed: _getAddresses + * function from https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/master/examples/js/get_ips.js#L16 + * @param {NM.Device}: NetWorkManager Device + * @param {Glib.SYSDEF_AF_INET}: family - Glib.SYSDEF_AF_INET or Glib.SYSDEF_AF_INET6 + * @returns {string[]}: Array of 'address/prefix' string + */ + _getAddresses(nm_device, family) { + let ip_cfg; + if (family == GLib.SYSDEF_AF_INET) + ip_cfg = nm_device.get_ip4_config(); + else + ip_cfg = nm_device.get_ip6_config(); + + if (ip_cfg == null) { + //Logger.info(`No config for device '${nm_device.get_iface()}'`); + return new Array(); } - /** - * NetSpeed: _connect_nm_device_state_changed - * @param {NM.Device} nm_device: NetworkManager Device instance - */ - _connect_nm_device_state_changed(nm_device) { - if (!this._nm_devices_signals_map.has(nm_device.get_iface())) { - let signal_id = nm_device.connect('state-changed', Lang.bind(this, this._nm_device_state_changed)); - this._nm_devices_signals_map.set(nm_device.get_iface(), [nm_device, signal_id]); - } + let nm_addresses = ip_cfg.get_addresses(); + if (nm_addresses.length == 0) { + //Logger.info(`No IP addresses for device '${nm_device.get_iface()}'`); + return new Array(); } - /** - * NetSpeed: _disconnect_nm_device_state_changed - * Use GObject.signal_handler_disconnect to avoid override of disconnect - * due ot introspection on NM.Device . - */ - _disconnect_all_nm_device_state_changed() { - for (let [nm_device, signal_id] of this._nm_devices_signals_map.values()) { - GObject.signal_handler_disconnect(nm_device, signal_id); - } - this._nm_devices_signals_map.clear(); + let addresses = new Array(); + for (let nm_address of nm_addresses) { + let addr = nm_address.get_address(); + let prefix = nm_address.get_prefix(); + addresses.push(addr + "/" + prefix); } - /** - * NetSpeed: _nm_device_state_changed - * Handler for NM.Device 'state-changed' signal - * See https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMDeviceState for states - * See https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMDeviceStateReason for reasons - */ - _nm_device_state_changed(nm_device, old_state, new_state, reason) { - //Logger.info(`${nm_device.get_iface()} move from ${old_state} to ${new_state}: reason ${reason}`); - this._trigger_ips_reload(); - } - - /** - * NetSpeed: _getAddresses - * function from https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/master/examples/js/get_ips.js#L16 - * @param {NM.Device}: NetWorkManager Device - * @param {Glib.SYSDEF_AF_INET}: family - Glib.SYSDEF_AF_INET or Glib.SYSDEF_AF_INET6 - * @returns {string[]}: Array of 'address/prefix' string - */ - _getAddresses(nm_device, family) { - let ip_cfg; - if (family == GLib.SYSDEF_AF_INET) - ip_cfg = nm_device.get_ip4_config(); - else - ip_cfg = nm_device.get_ip6_config(); - - if (ip_cfg == null) { - //Logger.info(`No config for device '${nm_device.get_iface()}'`); - return new Array(); - } - - let nm_addresses = ip_cfg.get_addresses(); - if (nm_addresses.length == 0) { - //Logger.info(`No IP addresses for device '${nm_device.get_iface()}'`); - return new Array(); - } - - let addresses = new Array(); - for (let nm_address of nm_addresses) { - let addr = nm_address.get_address(); - let prefix = nm_address.get_prefix(); - addresses.push(addr + "/" + prefix); - } - - return addresses; - } + return addresses; + } }; diff --git a/po/ca.po b/po/ca.po index 81abd82..a499b57 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Netspeed Gnome-Shell Extension\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2019-07-28 13:37+0200\n" "Last-Translator: Jordi Mas i Hernandez \n" "Language-Team: \n" @@ -16,133 +16,145 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.2.1\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "Tots" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "Passarel·la per defecte" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Dispositiu a fer seguiment" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Temporitzador (mil·lisegons)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Dígits" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Mida de l'etiqueta" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "Mida de l'etiqueta de la unitat" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Mida de l'etiqueta del menú" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Mostra la suma (pujada + baixada)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Mostra la icona" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "Usa múltiples de byte" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "Usa prefixos binaris" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/de.po b/po/de.po index 58e3e36..62a09fc 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Netspeed Gnome-Shell Extension\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2013-11-13 20:39+0100\n" "Last-Translator: Jonatan Zeidler \n" "Language-Team: GERMAN \n" @@ -18,134 +18,146 @@ msgstr "" "X-Generator: Poedit 1.5.4\n" "X-Poedit-SourceCharset: UTF-8\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "ALLE" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Gerät zur Überwachung" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Anzeigeinterval (Millisekunden)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Ziffern" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Anzeigegröße" -#: prefs.js:204 +#: prefs.js:247 #, fuzzy msgid "Unit Label Size" msgstr "Menügröße" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Menügröße" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Als Summe anzeigen (Hoch+Runter)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Symbol anzeigen" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/en_CA.po b/po/en_CA.po index b307865..ce8e57b 100644 --- a/po/en_CA.po +++ b/po/en_CA.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: netspeed\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2014-05-25 19:36-0700\n" "Last-Translator: Amir Hedayaty \n" "Language-Team: English\n" @@ -17,134 +17,146 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "ALL" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Device to monitor" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Timer (milisec)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Digits" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Label Size" -#: prefs.js:204 +#: prefs.js:247 #, fuzzy msgid "Unit Label Size" msgstr "Menu Label Size" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Menu Label Size" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Show sum(UP+Down)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Show the Icon" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/es_ES.po b/po/es_ES.po index 21facc8..af9c255 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Netspeed Gnome-Shell Extension\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2016-10-12 20:53+0200\n" "Last-Translator: Javier Junquera \n" "Language-Team: Español; Castellano <>\n" @@ -19,133 +19,145 @@ msgstr "" "X-Generator: Gtranslator 2.91.7\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "Todos" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "Puerta de enlace predeterminadas" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Dispositivo a monitorizar" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Temporizados (ms)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Digitos" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Tamaño de etiqueta" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "Tamaño de etiqueta de unidades" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Tamaño de etiqueta de menú" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Mostrar suma (subida+bajada)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Mostrar icono" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/fa.po b/po/fa.po index a6e43e1..a5f772e 100644 --- a/po/fa.po +++ b/po/fa.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: netspeed\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2014-05-25 19:38-0700\n" "Last-Translator: Amir Hedayaty \n" "Language-Team: Persian\n" @@ -16,132 +16,144 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "همه" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "تجهیزات تحت نظارت" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "زمان‌سنج)بر حسب میلی‌ثانیه(" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "تعداد رقم‌ها" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "اندازه برچسب‌ها" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "اندازه واحدها در منو" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "اندازه برچسب‌ها در منو" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "راست" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "چپ" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "نمایش مجموع)دریافت و ارسال(" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "نمایش نمایه" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "راست" - -#: prefs.js:268 -msgid "Left" -msgstr "چپ" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 msgid "b/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/fr.po b/po/fr.po index 37923e9..bb8aee2 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: netspeed\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2014-05-25 19:36-0700\n" "Last-Translator: Lucien Aubert \n" "Language-Team: French\n" @@ -17,134 +17,146 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "TOUS" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Périphérique(s) à prendre en compte" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Rafraîchissement (milisecondes)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Chiffres" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Taille des champs" -#: prefs.js:204 +#: prefs.js:247 #, fuzzy msgid "Unit Label Size" msgstr "Taille des champs du menu" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Taille des champs du menu" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Afficher la somme (reçu+envoyé)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Afficher l'icône" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/it.po b/po/it.po index fdc81be..e1ce6c4 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: netspeed\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2017-04-17 15:58+0200\n" "Last-Translator: l3nn4rt \n" "Language-Team: Italian\n" @@ -18,133 +18,145 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.0.1\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "Tutte" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "Gateway di default" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Interfaccia da monitorare" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "Impostazioni" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Frequenza di aggiornamento (ms)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Numero di cifre da mostrare" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Larghezza per le cifre" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "Larghezza per le unità di misura" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Larghezza per le colonne del menu" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" -msgstr "" +msgstr "Posizione" + +#: prefs.js:261 +msgid "Right" +msgstr "Destra" + +#: prefs.js:262 +msgid "Center" +msgstr "Centro" + +#: prefs.js:263 +msgid "Left" +msgstr "Sinistra" -#: prefs.js:211 +#: prefs.js:267 +msgid "Placement Index" +msgstr "Posizione Relativa" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Mostra la velocità complessiva (upload + download)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Mostra l'icona" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "Usa multipli del byte" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "Usa prefissi binari" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "Allinea verticalmente" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "Mostra indirizzi IP" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/netspeed.pot b/po/netspeed.pot index 0bf109e..861b8a1 100644 --- a/po/netspeed.pot +++ b/po/netspeed.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-22 13:41+0100\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,131 +17,143 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 msgid "Timer (milliseconds)" msgstr "" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 msgid "b/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/nl_NL.po b/po/nl_NL.po index 10dc090..9113fca 100644 --- a/po/nl_NL.po +++ b/po/nl_NL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: netspeed\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-22 13:41+0100\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2021-09-13 19:16+0200\n" "Last-Translator: Heimen Stoffels \n" "Language-Team: Dutch \n" @@ -26,138 +26,151 @@ msgstr "ALLES" msgid "Default Gateway" msgstr "Standaard toegangspoort" -#: prefs.js:198 +#: prefs.js:221 msgid "Device to monitor" msgstr "Te monitoren apparaat" -#: prefs.js:199 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 msgid "Timer (milliseconds)" msgstr "Tijdklok (milliseconden)" -#: prefs.js:200 +#: prefs.js:239 msgid "Digits" msgstr "Getallen" -#: prefs.js:201 +#: prefs.js:243 msgid "Label Size" msgstr "Labelgrootte" -#: prefs.js:202 +#: prefs.js:247 msgid "Unit Label Size" msgstr "Labelgrootte van eenheid" -#: prefs.js:203 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Labelgrootte van menu" -#: prefs.js:204 +#: prefs.js:255 msgid "HiDPI factor" msgstr "HiDPI-factor" -#: prefs.js:205 +#: prefs.js:259 msgid "Placement" msgstr "Locatie" -#: prefs.js:209 +#: prefs.js:261 +msgid "Right" +msgstr "Rechts" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "Links" + +#: prefs.js:267 +#, fuzzy +msgid "Placement Index" +msgstr "Locatie" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Som tonen (OMHOOG+omlaag)" -#: prefs.js:210 +#: prefs.js:278 msgid "Show the Icon" msgstr "Pictogram tonen" -#: prefs.js:253 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "Bytevermeerdering gebruiken" -#: prefs.js:254 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "Binaire voorvoegsels tonen" -#: prefs.js:255 +#: prefs.js:290 msgid "Align vertically" msgstr "Verticaal uitlijnen" -#: prefs.js:265 -msgid "Right" -msgstr "Rechts" - -#: prefs.js:266 -msgid "Left" -msgstr "Links" - -#: prefs.js:269 +#: prefs.js:297 msgid "Show IPs" msgstr "IP-adressen tonen" -#: net_speed.js:104 net_speed.js:108 net_speed.js:112 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:104 +#: net_speed.js:105 msgid "kiB/s" msgstr "kiB/s" -#: net_speed.js:104 +#: net_speed.js:105 msgid "MiB/s" msgstr "MiB/s" -#: net_speed.js:104 +#: net_speed.js:105 msgid "GiB/s" msgstr "GiB/s" -#: net_speed.js:105 net_speed.js:109 +#: net_speed.js:106 net_speed.js:110 msgid "b/s" msgstr "b/s" -#: net_speed.js:105 +#: net_speed.js:106 msgid "kib/s" msgstr "kib/s" -#: net_speed.js:105 +#: net_speed.js:106 msgid "Mib/s" msgstr "Mib/s" -#: net_speed.js:105 +#: net_speed.js:106 msgid "Gib/s" msgstr "Gib/s" -#: net_speed.js:108 +#: net_speed.js:109 msgid "kB/s" msgstr "kB/s" -#: net_speed.js:108 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:108 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:109 +#: net_speed.js:110 msgid "kb/s" msgstr "kb/s" -#: net_speed.js:109 +#: net_speed.js:110 msgid "Mb/s" msgstr "Mb/s" -#: net_speed.js:109 +#: net_speed.js:110 msgid "Gb/s" msgstr "Gb/s" -#: net_speed_status_icon.js:96 +#: net_speed_status_icon.js:97 msgid "Device" msgstr "Apparaat" -#: net_speed_status_icon.js:98 +#: net_speed_status_icon.js:99 msgid "Up" msgstr "Omhoog" -#: net_speed_status_icon.js:98 +#: net_speed_status_icon.js:99 msgid "Down" msgstr "Omlaag" -#: net_speed_status_icon.js:99 +#: net_speed_status_icon.js:100 msgid "IP" msgstr "IP-adres" diff --git a/po/pt_BR.po b/po/pt_BR.po index a786f2a..ace255b 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2016-02-04 17:44-0300\n" "Last-Translator: Fábio Nogueira \n" "Language-Team: \n" @@ -18,133 +18,145 @@ msgstr "" "X-Generator: Poedit 1.8.6\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "TUDO" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "Gateway padrão" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Dispositivo para monitorar" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Temporizador (miliseg)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Dígitos" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Tamanho do rótulo" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "Tamanho do rótulo de unidade" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Tamanho do rótulo do menu" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Exibir somatório (UP+Down)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Exibir o ícone" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/ru.po b/po/ru.po index 863a5fa..1a76217 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: netspeed\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2019-04-23 11:19+0500\n" "Last-Translator: Руслан Нигматьянов \n" "Language-Team: Russian\n" @@ -14,137 +14,149 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" "X-Generator: Gtranslator 3.32.0\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "Все" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "Шлюз по умолчанию" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "Интерфейс отображения" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Интервал обновления (милисек)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Цифр" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Длина текста" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "Длина единиц измерения" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Длина заголовка меню" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Показывать общую сумму передачи" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Показывать иконку" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "Б/с" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "Б/с" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "МБ/с" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "ГБ/с" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/tr.po b/po/tr.po index 876e85f..db60d28 100644 --- a/po/tr.po +++ b/po/tr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: netspeed\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2019-03-21 09:18+0300\n" "Last-Translator: Serdar Sağlam \n" "Language-Team: Türkçe \n" @@ -18,133 +18,145 @@ msgstr "" "X-Generator: Poedit 2.2.1\n" "X-Poedit-SourceCharset: UTF-8\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "Tümü" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "Öntanımlı Ağ Geçidi" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "İzlenecek Aygıt" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "Zaman (millisaniye)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "Basamak" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "Etiket Boyutu" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "Birim Etiketi Boyutu" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "Menü Etiket Boyutu" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "Toplamı Göster (Yükleme+İndirme)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "Simgeyi Göster" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 1c030ad..f245934 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2016-02-20 20:55+0800\n" "Last-Translator: Dingzhong Chen \n" "Language-Team: \n" @@ -18,133 +18,145 @@ msgstr "" "X-Generator: Poedit 1.8.7\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "全部" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "默认网关" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "监控的设备" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "定时(毫秒)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "位数" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "标签大小" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "单位标签大小" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "菜单标签大小" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "显示总和(上传+下载)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "显示图标" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/po/zh_TW.po b/po/zh_TW.po index 9179879..6cf945b 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-30 15:48-0700\n" +"POT-Creation-Date: 2023-01-22 16:08+0100\n" "PO-Revision-Date: 2016-02-20 20:55+0800\n" "Last-Translator: Dingzhong Chen \n" "Language-Team: \n" @@ -18,133 +18,145 @@ msgstr "" "X-Generator: Poedit 1.8.7\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: prefs.js:61 +#: prefs.js:59 msgid "ALL" msgstr "全部" -#: prefs.js:65 +#: prefs.js:63 msgid "Default Gateway" msgstr "默認網關" -#: prefs.js:200 +#: prefs.js:221 msgid "Device to monitor" msgstr "監控的設備" -#: prefs.js:201 +#: prefs.js:231 +msgid "Settings" +msgstr "" + +#: prefs.js:235 #, fuzzy msgid "Timer (milliseconds)" msgstr "定時(毫秒)" -#: prefs.js:202 +#: prefs.js:239 msgid "Digits" msgstr "位數" -#: prefs.js:203 +#: prefs.js:243 msgid "Label Size" msgstr "標籤大小" -#: prefs.js:204 +#: prefs.js:247 msgid "Unit Label Size" msgstr "單位標籤大小" -#: prefs.js:205 +#: prefs.js:251 msgid "Menu Label Size" msgstr "菜單標籤大小" -#: prefs.js:206 +#: prefs.js:255 msgid "HiDPI factor" msgstr "" -#: prefs.js:207 +#: prefs.js:259 msgid "Placement" msgstr "" -#: prefs.js:211 +#: prefs.js:261 +msgid "Right" +msgstr "" + +#: prefs.js:262 +msgid "Center" +msgstr "" + +#: prefs.js:263 +msgid "Left" +msgstr "" + +#: prefs.js:267 +msgid "Placement Index" +msgstr "" + +#: prefs.js:274 msgid "Show sum(UP+Down)" msgstr "顯示總和(上傳+下載)" -#: prefs.js:212 +#: prefs.js:278 msgid "Show the Icon" msgstr "顯示圖標" -#: prefs.js:255 +#: prefs.js:282 msgid "Use multiples of byte" msgstr "" -#: prefs.js:256 +#: prefs.js:286 msgid "Use binary prefixes" msgstr "" -#: prefs.js:257 +#: prefs.js:290 msgid "Align vertically" msgstr "" -#: prefs.js:267 -msgid "Right" -msgstr "" - -#: prefs.js:268 -msgid "Left" -msgstr "" - -#: prefs.js:271 +#: prefs.js:297 msgid "Show IPs" msgstr "" -#: net_speed.js:106 net_speed.js:110 net_speed.js:114 +#: net_speed.js:105 net_speed.js:109 net_speed.js:113 msgid "B/s" msgstr "B/s" -#: net_speed.js:106 +#: net_speed.js:105 msgid "kiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "MiB/s" msgstr "" -#: net_speed.js:106 +#: net_speed.js:105 msgid "GiB/s" msgstr "" -#: net_speed.js:107 net_speed.js:111 +#: net_speed.js:106 net_speed.js:110 #, fuzzy msgid "b/s" msgstr "B/s" -#: net_speed.js:107 +#: net_speed.js:106 msgid "kib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Mib/s" msgstr "" -#: net_speed.js:107 +#: net_speed.js:106 msgid "Gib/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "kB/s" msgstr "" -#: net_speed.js:110 +#: net_speed.js:109 msgid "MB/s" msgstr "MB/s" -#: net_speed.js:110 +#: net_speed.js:109 msgid "GB/s" msgstr "GB/s" -#: net_speed.js:111 +#: net_speed.js:110 msgid "kb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Mb/s" msgstr "" -#: net_speed.js:111 +#: net_speed.js:110 msgid "Gb/s" msgstr "" diff --git a/prefs.js b/prefs.js index 74330aa..24dc7c5 100644 --- a/prefs.js +++ b/prefs.js @@ -1,20 +1,19 @@ - /* - * Copyright 2011-2019 Amir Hedayaty < hedayaty AT gmail DOT com > - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - +/* + * Copyright 2011-2019 Amir Hedayaty < hedayaty AT gmail DOT com > + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ const Extension = imports.misc.extensionUtils.getCurrentExtension(); const Lib = Extension.imports.lib; @@ -25,14 +24,13 @@ const Gdk = imports.gi.Gdk; const Gettext = imports.gettext; const Gio = imports.gi.Gio; const Gtk = imports.gi.Gtk; -const Lang = imports.lang; const NM = imports.gi.NM; const _ = Gettext.domain('netspeed').gettext; let schemaDir = Extension.dir.get_child('schemas'); -let schemaSource = schemaDir.query_exists(null)? - Gio.SettingsSchemaSource.new_from_directory(schemaDir.get_path(), Gio.SettingsSchemaSource.get_default(), false): - Gio.SettingsSchemaSource.get_default(); +let schemaSource = schemaDir.query_exists(null) ? + Gio.SettingsSchemaSource.new_from_directory(schemaDir.get_path(), Gio.SettingsSchemaSource.get_default(), false) : + Gio.SettingsSchemaSource.get_default(); let schema = schemaSource.lookup(Lib.SCHEMA, false); let Schema = new Gio.Settings({ settings_schema: schema }); @@ -45,7 +43,7 @@ function init() { Gettext.bindtextdomain('netspeed', localeDir.get_path()); } - if (!Lib.canShowIPs()){ + if (!Lib.canShowIPs()) { // Force to false at startup // FIXME: hide Schema key Schema.set_boolean('show-ips', false); @@ -55,18 +53,18 @@ function init() { const App = class NetSpeed_App { _get_dev_combo() { let listStore = new Gtk.ListStore(); - listStore.set_column_types ([GObject.TYPE_STRING, GObject.TYPE_STRING]); + listStore.set_column_types([GObject.TYPE_STRING, GObject.TYPE_STRING]); let all = listStore.append(); - listStore.set (all, [0], [_("ALL")]); - listStore.set (all, [1], ["network-workgroup-symbolic"]); + listStore.set(all, [0], [_("ALL")]); + listStore.set(all, [1], ["network-workgroup-symbolic"]); let defaultGw = listStore.append(); - listStore.set (defaultGw, [0], [_("Default Gateway")]); - listStore.set (defaultGw, [1], ["network-workgroup-symbolic"]); + listStore.set(defaultGw, [0], [_("Default Gateway")]); + listStore.set(defaultGw, [1], ["network-workgroup-symbolic"]); let nmc = NM.Client.new(null); - let devices = nmc.get_devices() || [ ]; + let devices = nmc.get_devices() || []; this._devices = []; for (let dev of devices) { @@ -95,41 +93,38 @@ const App = class NetSpeed_App { } this._devices.push(dev.interface); let iter = listStore.append(); - listStore.set (iter, [0], [dev.interface]); - listStore.set (iter, [1], [iconname]); + listStore.set(iter, [0], [dev.interface]); + listStore.set(iter, [1], [iconname]); } - let combo = new Gtk.ComboBox({model: listStore}); + let combo = new Gtk.ComboBox({ model: listStore }); let rendererPixbuf = new Gtk.CellRendererPixbuf(); let rendererText = new Gtk.CellRendererText(); // Pack the renderers into the combobox in the order we want to see - combo.pack_start (rendererPixbuf, false); - combo.pack_start (rendererText, false); + combo.pack_start(rendererPixbuf, false); + combo.pack_start(rendererText, false); // Set the renderers to use the information from our listStore - combo.add_attribute (rendererText, "text", 0); - combo.add_attribute (rendererPixbuf, "icon_name", 1); + combo.add_attribute(rendererText, "text", 0); + combo.add_attribute(rendererPixbuf, "icon_name", 1); return combo; } - _put_dev() { - let active = this.dev.get_active(); - if (active == -1){ - return; - } - switch (active) { - case 0: - Schema.set_string ('device', "all"); - break; - case 1: - Schema.set_string ('device', "defaultGW"); - break; - default: - Schema.set_string ('device', this._devices[active - 2]); + _pick_changement() { + var active = -1; + switch (Schema.get_string('placement')) { + case 'right': + active = 0; + break; + case 'center': + active = 1; + break; + case 'left': + active = 2; + break; } - - Logger.debug("device <- " + Schema.get_string('device')) + this.placement.set_active(active); } _change_placement() { @@ -141,12 +136,16 @@ const App = class NetSpeed_App { } switch (active) { case 0: - Schema.set_string('placement', 'right') - Logger.debug("placement <- right") + Schema.set_string('placement', 'right'); + Logger.debug("placement <- right"); break; case 1: - Schema.set_string('placement', 'left') - Logger.debug("placement <- left") + Schema.set_string('placement', 'center'); + Logger.debug("placement <- center"); + break; + case 2: + Schema.set_string('placement', 'left'); + Logger.debug("placement <- left"); break; } } @@ -158,6 +157,25 @@ const App = class NetSpeed_App { } } + _put_dev() { + let active = this.dev.get_active(); + if (active == -1) { + return; + } + switch (active) { + case 0: + Schema.set_string('device', "all"); + break; + case 1: + Schema.set_string('device', "defaultGW"); + break; + default: + Schema.set_string('device', this._devices[active - 2]); + } + + Logger.debug("device <- " + Schema.get_string('device')); + } + _pick_dev() { let activeDev = Schema.get_string('device'); this._device = activeDev; @@ -196,93 +214,96 @@ const App = class NetSpeed_App { constructor() { this._factor = Schema.get_int('hi-dpi-factor'); - this.main = new Gtk.Grid({row_spacing: 10, column_spacing: 20, column_homogeneous: false, row_homogeneous: true}); - this.main.attach (new Gtk.Label({label: _("Device to monitor")}), 1, 1, 1, 1); - this.main.attach (new Gtk.Label({label: _("Timer (milliseconds)")}), 1, 4, 1, 1); - this.main.attach (new Gtk.Label({label: _("Digits")}), 1, 5, 1, 1); - this.main.attach (new Gtk.Label({label: _("Label Size")}), 1, 6, 1, 1); - this.main.attach (new Gtk.Label({label: _("Unit Label Size")}), 1, 7, 1, 1); - this.main.attach (new Gtk.Label({label: _("Menu Label Size")}), 1, 8, 1, 1); - this.main.attach (new Gtk.Label({label: _("HiDPI factor")}), 1, 11, 1, 1); - this.main.attach (new Gtk.Label({label: _("Placement")}), 1, 13, 1, 1); - - //this.dev = new Gtk.Entry(); + + this.main = new Gtk.Grid({ row_spacing: 10, column_spacing: 20, column_homogeneous: false, row_homogeneous: true }); + + // Header: device selection + this.main.attach(new Gtk.Label({ label: _("Device to monitor") }), 2, 1, 1, 1); this.dev = this._get_dev_combo(); - this.sum = new Gtk.CheckButton({ label: _("Show sum(UP+Down)") }); - this.icon = new Gtk.CheckButton({ label: _("Show the Icon") }); - this.timer = new Gtk.SpinButton({ - adjustment: new Gtk.Adjustment({ - lower: 100, - upper: 10000, - step_increment: 100 - }) - }); - this.digits = new Gtk.SpinButton({ - adjustment: new Gtk.Adjustment({ - lower: 3, - upper: 10, - step_increment: 1 - }) - }); - - this._label_adjustment = new Gtk.Adjustment({ - lower: 1, - upper: 100 * this._factor, - step_increment: this._factor - }); - this.label_size = new Gtk.SpinButton({ - adjustment: this._label_adjustment - }); - - this._unit_label_adjustment = new Gtk.Adjustment({ - lower: 1, - upper: 100 * this._factor, - step_increment: this._factor - }); - this.unit_label_size = new Gtk.SpinButton({ - adjustment: this._unit_label_adjustment - }); - - this._menu_label_adjustment = new Gtk.Adjustment({ - lower: 1, - upper: 100 * this._factor, - step_increment: this._factor - }); - this.menu_label_size = new Gtk.SpinButton({ - adjustment: this._menu_label_adjustment - }); - - this.use_bytes = new Gtk.CheckButton({ label: _("Use multiples of byte") }); - this.bin_prefixes = new Gtk.CheckButton({ label: _("Use binary prefixes") }); - this.vert_align = new Gtk.CheckButton({ label: _("Align vertically") }); - this.hi_dpi_factor = new Gtk.SpinButton({ - adjustment: new Gtk.Adjustment({ - lower: 1, - upper: 100, - step_increment: 1 - }) - }); - - this.placement = new Gtk.ComboBoxText() - this.placement.append_text(_("Right")); - this.placement.append_text(_("Left")); - this.placement.set_active(0); + this.main.attach(this.dev, 3, 1, 1, 1); + + // Separator + let separator = new Gtk.Separator({ orientation: Gtk.Orientation.HORIZONTAL, valign: Gtk.Align.CENTER }); + separator.set_vexpand(false); + this.main.attach(separator, 1, 2, 4, 1); - this.show_ip = new Gtk.CheckButton({ label: _("Show IPs") }); + // Title + this.main.attach(new Gtk.Label({ label: `${_("Settings")}`, use_markup: true }), 2, 3, 2, 1); - this.main.attach(this.dev, 2, 1, 1, 1); - this.main.attach(this.sum, 1, 2, 2, 1); - this.main.attach(this.icon, 1, 3, 2, 1); + // Display options + + this.main.attach(new Gtk.Label({ label: _("Timer (milliseconds)") }), 1, 4, 1, 1); + this.timer = Gtk.SpinButton.new_with_range(100, 10000, 100); this.main.attach(this.timer, 2, 4, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Digits") }), 1, 5, 1, 1); + this.digits = Gtk.SpinButton.new_with_range(3, 10, 1); this.main.attach(this.digits, 2, 5, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Label Size") }), 1, 6, 1, 1); + this.label_size = Gtk.SpinButton.new_with_range(1, 100 * this._factor, this._factor); this.main.attach(this.label_size, 2, 6, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Unit Label Size") }), 1, 7, 1, 1); + this.unit_label_size = Gtk.SpinButton.new_with_range(1, 100 * this._factor, this._factor); this.main.attach(this.unit_label_size, 2, 7, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Menu Label Size") }), 1, 8, 1, 1); + this.menu_label_size = Gtk.SpinButton.new_with_range(1, 100 * this._factor, this._factor); this.main.attach(this.menu_label_size, 2, 8, 1, 1); - this.main.attach(this.use_bytes, 1, 9, 1, 1); - this.main.attach(this.bin_prefixes, 1, 10, 1, 1); - this.main.attach(this.hi_dpi_factor, 2, 11, 2, 1); - this.main.attach(this.vert_align, 1, 12, 1, 1); - this.main.attach(this.placement, 2, 13, 2, 1); + + this.main.attach(new Gtk.Label({ label: _("HiDPI factor") }), 1, 9, 1, 1); + this.hi_dpi_factor = Gtk.SpinButton.new_with_range(1, 100, 1); + this.main.attach(this.hi_dpi_factor, 2, 9, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Placement") }), 1, 10, 1, 1); + this.placement = new Gtk.ComboBoxText(); + this.placement.append_text(_("Right")); + this.placement.append_text(_("Center")); + this.placement.append_text(_("Left")); + this.placement.set_active(0); + this.main.attach(this.placement, 2, 10, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Placement Index") }), 1, 11, 1, 1); + this.placement_index = Gtk.SpinButton.new_with_range(-1, 20, 1); + this.main.attach(this.placement_index, 2, 11, 1, 1); + + + // Extension Settings + + this.main.attach(new Gtk.Label({ label: _("Show sum(UP+Down)") }), 3, 4, 1, 1); + this.sum = new Gtk.Switch({ halign: Gtk.Align.START, valign: Gtk.Align.CENTER }); + this.main.attach(this.sum, 4, 4, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Show the Icon") }), 3, 5, 1, 1); + this.icon = new Gtk.Switch({ halign: Gtk.Align.START, valign: Gtk.Align.CENTER }); + this.main.attach(this.icon, 4, 5, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Use multiples of byte") }), 3, 6, 1, 1); + this.use_bytes = new Gtk.Switch({ halign: Gtk.Align.START, valign: Gtk.Align.CENTER }); + this.main.attach(this.use_bytes, 4, 6, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Use binary prefixes") }), 3, 7, 1, 1); + this.bin_prefixes = new Gtk.Switch({ halign: Gtk.Align.START, valign: Gtk.Align.CENTER }); + this.main.attach(this.bin_prefixes, 4, 7, 1, 1); + + this.main.attach(new Gtk.Label({ label: _("Align vertically") }), 3, 8, 1, 1); + this.vert_align = new Gtk.Switch({ halign: Gtk.Align.START, valign: Gtk.Align.CENTER }); + this.main.attach(this.vert_align, 4, 8, 1, 1); + + + this.show_ip = new Gtk.Switch({ halign: Gtk.Align.START, valign: Gtk.Align.CENTER }); + if (Lib.canShowIPs()) { + this.main.attach(new Gtk.Label({ label: _("Show IPs") }), 3, 9, 1, 1); + this.main.attach(this.show_ip, 4, 9, 1, 1); + this.show_ip.show(); + } else { + this.show_ip.hide(); + } + + // Initialize values + this._pick_dev(); + this.dev.connect('changed', this._put_dev.bind(this)); Schema.bind('show-sum', this.sum, 'active', Gio.SettingsBindFlags.DEFAULT); Schema.bind('icon-display', this.icon, 'active', Gio.SettingsBindFlags.DEFAULT); @@ -298,26 +319,17 @@ const App = class NetSpeed_App { Schema.bind('show-ips', this.show_ip, 'active', Gio.SettingsBindFlags.DEFAULT); Schema.bind_writable('show-ips', this.show_ip, 'visible', false); - if (Lib.canShowIPs()) { - this.main.attach(this.show_ip, 1, 14, 2, 1); - this.show_ip.show(); - } else { - this.show_ip.hide(); - } - - - this._pick_dev(); - this._factor = Schema.get_int('hi-dpi-factor'); - - this.dev.connect('changed', Lang.bind(this, this._put_dev)); - Schema.connect('changed', Lang.bind(this, this._dpi_changed)); + Schema.connect('changed', this._dpi_changed.bind(this)); + this._dpi_changed(); - this.placement.connect('changed', Lang.bind(this, this._change_placement)) + this._pick_changement(); + this.placement.connect('changed', this._change_placement.bind(this)); + Schema.bind('placement-index', this.placement_index, 'value', Gio.SettingsBindFlags.DEFAULT); } }; function buildPrefsWidget() { let widget = new App(); return widget.main; -}; +} diff --git a/schemas/org.gnome.shell.extensions.netspeed.gschema.xml b/schemas/org.gnome.shell.extensions.netspeed.gschema.xml index 8b007eb..3d3ddc6 100644 --- a/schemas/org.gnome.shell.extensions.netspeed.gschema.xml +++ b/schemas/org.gnome.shell.extensions.netspeed.gschema.xml @@ -63,7 +63,12 @@ 'right' Where to place the UI - You can use left/right to place the items. + You can use left/center/right to place the items. + + + 0 + Index in panel box + Index within the selected panel box (0: first, 1: second, ..., -1: last) false diff --git a/stylesheet.css b/stylesheet.css index 1661b23..fb9d5dd 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -36,5 +36,4 @@ * menu items */ -.ns-menuitem { -} +.ns-menuitem {} \ No newline at end of file