Skip to content

Commit

Permalink
feat: refactor settings and add extension placement and position
Browse files Browse the repository at this point in the history
  • Loading branch information
c84c committed Jan 22, 2023
1 parent 17375b3 commit 376ec0c
Show file tree
Hide file tree
Showing 20 changed files with 919 additions and 709 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
"description": "Displays Internet Speed",
"name": "NetSpeed",
"original-author": "[email protected]",
"shell-version": [ "40", "41", "42" ],
"shell-version": [
"40",
"41",
"42",
"43"
],
"url": "https://github.com/hedayaty/NetSpeed",
"uuid": "[email protected]",
"version": 32
}
}
26 changes: 23 additions & 3 deletions net_speed.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,24 @@ var NetSpeed = class NetSpeed {
}
}

_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
Expand Down Expand Up @@ -368,10 +386,12 @@ var NetSpeed = class NetSpeed {
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);
this._updateDefaultGw();

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();
}

/**
Expand Down
90 changes: 51 additions & 39 deletions po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: \n"
Expand All @@ -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 ""

Expand Down
Loading

0 comments on commit 376ec0c

Please sign in to comment.