Skip to content

Commit 3bbca26

Browse files
authored
V4 (#8)
* disconnect signals on destroy * fetch: add missing JSON.parse error handling * remove 'hover' flag on buttons * bump compatible shell version * rename onDestroy to something more unique * fix deprecated byte array usage * avoid storing global Soup Client * make icon buttons more stylish * fix version checker for v40 * code cleanup * Make: fix local installation * make settings gtk 4 compatible * update translations * set refresh keys array instead single string comparisons * validate gitlab account config, add onlyOwnedProjects flag * gitlab api: use onlyOwned from settings * settings: add onlyOwnedProjects and use CellRendererToggle * update translations * bumped version * updated readme
1 parent eabc44f commit 3bbca26

File tree

22 files changed

+884
-282
lines changed

22 files changed

+884
-282
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ package: $(BUILD_DIR)
7575
install: build
7676
rm -rf $(INSTALL_DIR)
7777
mkdir -p $(INSTALL_DIR)
78-
cp -r $(BUILD_DIR)/* $(INSTALL_DIR)
78+
cp -r $(BUILD_DIR)/${SRC_DIR}/* $(INSTALL_DIR)
7979

8080
clean:
8181
rm -f $(COMPILED_SCHEMAS) $(MO_FILES)

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Either install it:
1515
- via EGS https://extensions.gnome.org/extension/3535/gitlab-extension/
1616
- Or download latest release: https://github.com/cinatic/gitlab-extension/releases/latest
1717

18+
### Quick Start
19+
Create a ***Profile access token*** in your profile settings https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
20+
and use it to create a new account entry in gitlab extension settings `Account Grid`.
21+
22+
1823
## Data Source
1924
The data is fetched from the official GitLab API https://docs.gitlab.com/ee/api/.
2025
The API has some *limitions*, e.g. it only returns domain specific data.

[email protected]/components/buttons/iconButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var IconButton = GObject.registerClass({}, class IconButton extends St.Button {
1010
reactive: true,
1111
can_focus: true,
1212
track_hover: true,
13-
style_class: 'icon-button ' + (style_class || ''),
13+
style_class: 'icon-button button ' + (style_class || ''),
1414
y_align: Clutter.ActorAlign.CENTER,
1515
...props
1616
})

[email protected]/components/cards/commitCard.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ var CommitCard = GObject.registerClass({}, class CommitCard extends St.Button {
1414
super._init({
1515
style_class: 'card message commit-card',
1616
can_focus: true,
17-
x_expand: true,
18-
hover: true
17+
x_expand: true
1918
})
2019

2120
this.cardItem = commitItem

[email protected]/components/cards/pipelineCard.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ var PipelineCard = GObject.registerClass({}, class PipelineCard extends St.Butto
1414
super._init({
1515
style_class: 'card message pipeline-card',
1616
can_focus: true,
17-
x_expand: true,
18-
hover: true
17+
x_expand: true
1918
})
2019

2120
this.cardItem = pipelineItem

[email protected]/components/cards/projectCard.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ var ProjectCard = GObject.registerClass({}, class ProjectCard extends St.Button
1414
super._init({
1515
style_class: 'card message project-card',
1616
can_focus: true,
17-
x_expand: true,
18-
hover: true
17+
x_expand: true
1918
})
2019

2120
this.cardItem = projectItem

[email protected]/components/gitlab/projectSelectButtons.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ var ProjectSelectButtons = GObject.registerClass({}, class ProjectSelectButtons
1111
style_class: 'project-select-buttons'
1212
})
1313

14-
Settings.connect('changed', (value, key) => {
14+
this._settingsChangedId = Settings.connect('changed', (value, key) => {
1515
if (key === 'gitlab-accounts' || key === 'selected-gitlab-account-index') {
1616
this._sync()
1717
}
1818
})
1919

20+
this.connect('destroy', this._onDestroy.bind(this))
21+
2022
this._sync()
2123
}
2224

@@ -34,7 +36,7 @@ var ProjectSelectButtons = GObject.registerClass({}, class ProjectSelectButtons
3436

3537
const gitlabAccountButton = new St.Button({
3638
style_class: `message button ${additionalStyleClasses}`,
37-
label: gitlabAccount.name,
39+
label: gitlabAccount.name
3840
})
3941

4042
gitlabAccountButton.connect('clicked', () => {
@@ -44,4 +46,10 @@ var ProjectSelectButtons = GObject.registerClass({}, class ProjectSelectButtons
4446
this.add_child(gitlabAccountButton)
4547
})
4648
}
49+
50+
_onDestroy () {
51+
if (this._settingsChangedId) {
52+
Settings.disconnect(this._settingsChangedId)
53+
}
54+
}
4755
})

[email protected]/components/screenWrapper/screenWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { Clutter, GObject, St } = imports.gi
1+
const { GObject, St } = imports.gi
22

33
const ExtensionUtils = imports.misc.extensionUtils
44
const Me = ExtensionUtils.getCurrentExtension()

[email protected]/components/screens/projectsScreen/projectsScreen.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,31 @@ const { FlatList } = Me.imports.components.flatList.flatList
99
const { ProjectSelectButtons } = Me.imports.components.gitlab.projectSelectButtons
1010
const { ProjectCard } = Me.imports.components.cards.projectCard
1111
const { SearchBar } = Me.imports.components.searchBar.searchBar
12-
const { Settings } = Me.imports.helpers.settings
12+
13+
const {
14+
Settings,
15+
GITLAB_ACCOUNTS,
16+
SELECTED_GITLAB_ACCOUNT_INDEX
17+
} = Me.imports.helpers.settings
18+
1319
const { Translations } = Me.imports.helpers.translations
1420

1521
const GitLabService = Me.imports.services.gitlab
1622

23+
const SETTINGS_KEYS_TO_REFRESH = [
24+
GITLAB_ACCOUNTS,
25+
SELECTED_GITLAB_ACCOUNT_INDEX
26+
]
27+
1728
var ProjectsScreen = GObject.registerClass({}, class ProjectsScreen extends St.BoxLayout {
1829
_init () {
1930
super._init({
2031
style_class: 'screen projects-screen',
2132
vertical: true
2233
})
2334

35+
this._settingsChangedId = null
36+
2437
const searchBar = new SearchBar()
2538
this._list = new FlatList()
2639

@@ -39,8 +52,8 @@ var ProjectsScreen = GObject.registerClass({}, class ProjectsScreen extends St.B
3952

4053
searchBar.connect('text-change', (sender, searchText) => this._filter_results(searchText))
4154

42-
Settings.connect('changed', (value, key) => {
43-
if (key === 'gitlab-accounts' || key === 'selected-gitlab-account-index') {
55+
this._settingsChangedId = Settings.connect('changed', (value, key) => {
56+
if (SETTINGS_KEYS_TO_REFRESH.includes(key)) {
4457
this._loadData()
4558
}
4659

@@ -54,6 +67,8 @@ var ProjectsScreen = GObject.registerClass({}, class ProjectsScreen extends St.B
5467
}
5568
}))
5669

70+
this.connect('destroy', this._onDestroy.bind(this))
71+
5772
this._loadData()
5873
}
5974

@@ -108,4 +123,10 @@ var ProjectsScreen = GObject.registerClass({}, class ProjectsScreen extends St.B
108123
this._list.addItem(new ProjectCard(project, latestPipeline))
109124
})
110125
}
126+
127+
_onDestroy () {
128+
if (this._settingsChangedId) {
129+
Settings.disconnect(this._settingsChangedId)
130+
}
131+
}
111132
})

[email protected]/components/searchBar/searchBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var SearchBar = GObject.registerClass({
7878
}
7979

8080
_createButtonBox () {
81-
let buttonBox = new St.BoxLayout({
81+
const buttonBox = new St.BoxLayout({
8282
style_class: 'button-box',
8383
x_align: St.Align.END
8484
})

0 commit comments

Comments
 (0)