Skip to content

Commit

Permalink
Merge pull request #2 from cinatic/v4
Browse files Browse the repository at this point in the history
V4
  • Loading branch information
cinatic authored Apr 17, 2021
2 parents d3be4c4 + 900de1b commit fa6a863
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 44 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,13 @@ $(MO_FILES): $(PO_FILES) $(MO_DIR)
build: $(BUILD_DIR) $(COMPILED_SCHEMAS) $(MO_FILES)
cp -r --parents $(FILES) $<

buildAndReplaceLocal: build
rm -fR ~/.local/share/gnome-shell/extensions/$(UUID)
cp -r $(BUILD_DIR)/${SRC_DIR} ~/.local/share/gnome-shell/extensions/$(UUID)/

package: $(BUILD_DIR)
cd $(BUILD_DIR)/${SRC_DIR} && zip -r ../$(EXTENSION_NAME)-extension.zip *

install: build
rm -rf $(INSTALL_DIR)
mkdir -p $(INSTALL_DIR)
cp -r $(BUILD_DIR)/* $(INSTALL_DIR)
cp -r $(BUILD_DIR)/${SRC_DIR}/* $(INSTALL_DIR)

clean:
rm -f $(COMPILED_SCHEMAS) $(MO_FILES)
Expand Down
9 changes: 7 additions & 2 deletions kubectl@infinicode.de/components/buttons/selectBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const PopupMenu = imports.ui.popupMenu
const ExtensionUtils = imports.misc.extensionUtils
const Me = ExtensionUtils.getCurrentExtension()

const { IconButton } = Me.imports.components.buttons.iconButton
const { isNullOrEmpty } = Me.imports.helpers.data
const { Translations } = Me.imports.helpers.translations


// THX https://gitlab.com/jmiskinis/gnome-shell-extension-task-widget
// the idea with the task select box thingy is super awesome!

Expand Down Expand Up @@ -39,13 +41,16 @@ var SelectBox = GObject.registerClass({

this._buttonLabel = new St.Label({
style_class: 'select-box-button-label',
text: buttonText
text: buttonText,
y_expand: true,
y_align: Clutter.ActorAlign.CENTER
})

const arrowIcon = new St.Icon({
style_class: 'popup-menu-arrow',
style_class: 'popup-menu-arrow select-box-popup-menu-arrow',
icon_name: 'pan-down-symbolic',
accessible_role: Atk.Role.ARROW,
y_expand: true,
y_align: Clutter.ActorAlign.CENTER
})

Expand Down
3 changes: 1 addition & 2 deletions kubectl@infinicode.de/components/cards/defaultCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ var DefaultCard = GObject.registerClass({
super._init({
style_class: 'card message default-card',
can_focus: true,
x_expand: true,
hover: true
x_expand: true
})

this.cardItem = cardItem
Expand Down
3 changes: 1 addition & 2 deletions kubectl@infinicode.de/components/cards/podCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ var PodCard = GObject.registerClass({
super._init({
style_class: 'card message pod-card',
can_focus: true,
x_expand: true,
hover: true
x_expand: true
})

this.cardItem = cardItem
Expand Down
3 changes: 1 addition & 2 deletions kubectl@infinicode.de/components/cards/serviceCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ var ServiceCard = GObject.registerClass({
super._init({
style_class: 'card message service-card',
can_focus: true,
x_expand: true,
hover: true
x_expand: true
})

this.cardItem = cardItem
Expand Down
39 changes: 14 additions & 25 deletions kubectl@infinicode.de/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const MenuPosition = {

let KubectlMenuButton = GObject.registerClass(class KubectlMenuButton extends PanelMenu.Button {
_init () {
this._currentPanelPosition = null
this._previousPanelPosition = null
this._settingsChangedId = null

// Panel menu item - the current class
Expand Down Expand Up @@ -79,7 +79,7 @@ let KubectlMenuButton = GObject.registerClass(class KubectlMenuButton extends Pa
EventHandler.connect('hide-panel', () => this.menu.close())
this._settingsChangedId = Settings.connect('changed', (changedValue, changedKey) => this._sync(changedValue, changedKey))

this.menu.connect('destroy', this._onDestroy.bind(this))
this.menu.connect('destroy', this._destroyExtension.bind(this))
this.menu.connect('open-state-changed', (menu, isOpen) => {
EventHandler.emit('open-state-changed', { isOpen })
})
Expand All @@ -92,48 +92,36 @@ let KubectlMenuButton = GObject.registerClass(class KubectlMenuButton extends Pa
}

checkPositionInPanel () {
const newPosition = Settings.position_in_panel
const container = this.container
const parent = container.get_parent()

if (this._currentPanelPosition === newPosition) {
if (!parent || this._previousPanelPosition === Settings.position_in_panel) {
return
}

this.get_parent().remove_actor(this.actor)

switch (this._currentPanelPosition) {
case MenuPosition.LEFT:
Main.panel._leftBox.remove_actor(this.actor)
break
case MenuPosition.CENTER:
Main.panel._centerBox.remove_actor(this.actor)
break
case MenuPosition.RIGHT:
Main.panel._rightBox.remove_actor(this.actor)
break
}
parent.remove_actor(container)

let children = null
switch (newPosition) {

switch (Settings.position_in_panel) {
case MenuPosition.LEFT:
children = Main.panel._leftBox.get_children()
Main.panel._leftBox.insert_child_at_index(this.actor, children.length)
Main.panel._leftBox.insert_child_at_index(container, children.length)
break
case MenuPosition.CENTER:
children = Main.panel._centerBox.get_children()
Main.panel._centerBox.insert_child_at_index(this.actor, children.length)
Main.panel._centerBox.insert_child_at_index(container, children.length)
break
case MenuPosition.RIGHT:
children = Main.panel._rightBox.get_children()
Main.panel._rightBox.insert_child_at_index(this.actor, 0)
Main.panel._rightBox.insert_child_at_index(container, 0)
break
}

this._currentPanelPosition = newPosition
this._previousPanelPosition = Settings.position_in_panel
}

_onDestroy () {
super._onDestroy()

_destroyExtension () {
if (this._settingsChangedId) {
Settings.disconnect(this._settingsChangedId)
}
Expand All @@ -149,6 +137,7 @@ function init (extensionMeta) {
function enable () {
kubectlMenu = new KubectlMenuButton()
Main.panel.addToStatusArea('kubectlMenu', kubectlMenu)
kubectlMenu.checkPositionInPanel()
}

function disable () {
Expand Down
4 changes: 2 additions & 2 deletions kubectl@infinicode.de/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"3.34",
"3.36",
"3.38",
"40.0"
"40"
],
"url": "https://github.com/cinatic/kubectl-extension",
"uuid": "kubectl@infinicode.de",
"version": 1
"version": 4
}
4 changes: 2 additions & 2 deletions kubectl@infinicode.de/po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: fh@infinicode.de\n"
"POT-Creation-Date: 2021-04-07 15:26+0200\n"
"POT-Creation-Date: 2021-04-17 22:08+0200\n"
"PO-Revision-Date: 2020-11-30 14:42+0100\n"
"Last-Translator: fh@infinicode.de\n"
"Language-Team: German\n"
Expand All @@ -19,7 +19,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.4.1\n"

#: kubectl@infinicode.de/extension.js:56
#: kubectl@infinicode.de/extension.js:55
msgid "Kubectl"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions kubectl@infinicode.de/po/kubectl@infinicode.de.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnome-shell-extension-kubectl\n"
"Report-Msgid-Bugs-To: fh@infinicode.de\n"
"POT-Creation-Date: 2021-04-07 15:26+0200\n"
"POT-Creation-Date: 2021-04-17 22:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: kubectl@infinicode.de/extension.js:56
#: kubectl@infinicode.de/extension.js:55
msgid "Kubectl"
msgstr ""

Expand Down
4 changes: 4 additions & 0 deletions kubectl@infinicode.de/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
margin: 0 4px;
}

.kubectl-extension .select-box-popup-menu-arrow {
margin-top: 2px;
}

.kubectl-extension .search-bar {
height: 40px;
padding: 5px 10px;
Expand Down

0 comments on commit fa6a863

Please sign in to comment.