Skip to content

Commit 77e8ec9

Browse files
cinaticVistaus
andauthored
V11 (#19)
* make extension great again * code cleanup * Updated Dutch translation (#15) Co-authored-by: Florijan Hamzic <[email protected]> * code review I * code review II --------- Co-authored-by: Heimen Stoffels <[email protected]>
1 parent 33f4573 commit 77e8ec9

33 files changed

+338
-353
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const { GObject, St, Clutter } = imports.gi
1+
import Clutter from 'gi://Clutter'
2+
import GObject from 'gi://GObject'
3+
import St from 'gi://St'
24

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
5-
const ComponentsHelper = Me.imports.helpers.components
5+
import * as ComponentsHelper from '../../helpers/components.js'
66

7-
var IconButton = GObject.registerClass({}, class IconButton extends St.Button {
7+
export const IconButton = GObject.registerClass({}, class IconButton extends St.Button {
88
_init ({ icon_name, isCustomIcon, onClick, icon_size = 18, text, style_class, ...props }) {
99
super._init({
1010
reactive: true,

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
const { Gio, GObject, St } = imports.gi
1+
import Clutter from 'gi://Clutter'
2+
import Gio from 'gi://Gio'
3+
import GObject from 'gi://GObject'
4+
import St from 'gi://St'
25

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
6+
import { IconButton } from '../buttons/iconButton.js'
7+
import { Icon } from '../icon/icon.js'
8+
import { Translations } from '../../helpers/translations.js'
59

6-
const { IconButton } = Me.imports.components.buttons.iconButton
7-
const { Icon } = Me.imports.components.icon.icon
8-
const { Translations } = Me.imports.helpers.translations
10+
import * as DataHelper from '../../helpers/data.js'
911

10-
const DataHelper = Me.imports.helpers.data
11-
12-
var CommitCard = GObject.registerClass({}, class CommitCard extends St.Button {
12+
export const CommitCard = GObject.registerClass({}, class CommitCard extends St.Button {
1313
_init (commitItem, pipeline) {
1414
super._init({
1515
style_class: 'card message commit-card',
@@ -67,7 +67,7 @@ var CommitCard = GObject.registerClass({}, class CommitCard extends St.Button {
6767
_createHeaderInfoSection () {
6868
let headerInfoSection = new St.BoxLayout({
6969
style_class: 'info-section-box',
70-
x_align: St.Align.END
70+
x_align: Clutter.ActorAlign.END
7171
})
7272

7373
const lastModifiedLabel = new St.Label({
@@ -122,7 +122,7 @@ var CommitCard = GObject.registerClass({}, class CommitCard extends St.Button {
122122
_createLinkIcon () {
123123
const linkIconBin = new St.Bin({
124124
style_class: 'link-icon-bin',
125-
x_align: St.Align.END,
125+
x_align: Clutter.ActorAlign.END,
126126
child: new IconButton({
127127
icon_name: 'open-link-symbolic',
128128
isCustomIcon: true,

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
const { Gio, GObject, St } = imports.gi
1+
import Clutter from 'gi://Clutter'
2+
import Gio from 'gi://Gio'
3+
import GObject from 'gi://GObject'
4+
import St from 'gi://St'
25

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
6+
import { IconButton } from '../buttons/iconButton.js'
7+
import { Icon } from '../icon/icon.js'
8+
import { Translations } from '../../helpers/translations.js'
59

6-
const { IconButton } = Me.imports.components.buttons.iconButton
7-
const { Icon } = Me.imports.components.icon.icon
8-
const { Translations } = Me.imports.helpers.translations
10+
import * as DataHelper from '../../helpers/data.js'
911

10-
const DataHelper = Me.imports.helpers.data
11-
12-
var PipelineCard = GObject.registerClass({}, class PipelineCard extends St.Button {
12+
export const PipelineCard = GObject.registerClass({}, class PipelineCard extends St.Button {
1313
_init (pipelineItem, commit) {
1414
super._init({
1515
style_class: 'card message pipeline-card',
@@ -66,7 +66,7 @@ var PipelineCard = GObject.registerClass({}, class PipelineCard extends St.Butto
6666
_createHeaderInfoSection () {
6767
let headerInfoSection = new St.BoxLayout({
6868
style_class: 'info-section-box',
69-
x_align: St.Align.END
69+
x_align: Clutter.ActorAlign.END
7070
})
7171

7272
const lastModifiedLabel = new St.Label({
@@ -121,7 +121,7 @@ var PipelineCard = GObject.registerClass({}, class PipelineCard extends St.Butto
121121
_createLinkIcon () {
122122
const linkIconBin = new St.Bin({
123123
style_class: 'link-icon-bin',
124-
x_align: St.Align.END,
124+
x_align: Clutter.ActorAlign.END,
125125
child: new IconButton({
126126
icon_name: 'open-link-symbolic',
127127
isCustomIcon: true,

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
const { Gio, GObject, St } = imports.gi
1+
import Clutter from 'gi://Clutter'
2+
import Gio from 'gi://Gio'
3+
import GObject from 'gi://GObject'
4+
import St from 'gi://St'
25

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
6+
import { IconButton } from '../buttons/iconButton.js'
7+
import { Icon } from '../icon/icon.js'
8+
import { Translations } from '../../helpers/translations.js'
59

6-
const { IconButton } = Me.imports.components.buttons.iconButton
7-
const { Icon } = Me.imports.components.icon.icon
8-
const { Translations } = Me.imports.helpers.translations
10+
import * as DataHelper from '../../helpers/data.js'
911

10-
const DataHelper = Me.imports.helpers.data
11-
12-
var ProjectCard = GObject.registerClass({}, class ProjectCard extends St.Button {
12+
export const ProjectCard = GObject.registerClass({}, class ProjectCard extends St.Button {
1313
_init (projectItem, pipeline) {
1414
super._init({
1515
style_class: 'card message project-card',
@@ -64,8 +64,8 @@ var ProjectCard = GObject.registerClass({}, class ProjectCard extends St.Button
6464
let headerInfoSection = new St.BoxLayout({
6565
style_class: 'info-section-box',
6666
x_expand: false,
67-
x_align: St.Align.END,
68-
y_align: St.Align.MIDDLE
67+
x_align: Clutter.ActorAlign.END,
68+
y_align: Clutter.ActorAlign.CENTER
6969
})
7070

7171
const lastModifiedLabel = new St.Label({
@@ -118,7 +118,7 @@ var ProjectCard = GObject.registerClass({}, class ProjectCard extends St.Button
118118
const linkIconBin = new St.Bin({
119119
style_class: 'link-icon-bin',
120120
x_expand: false,
121-
x_align: St.Align.END,
121+
x_align: Clutter.ActorAlign.END,
122122
child: new IconButton({
123123
icon_name: 'open-link-symbolic',
124124
isCustomIcon: true,

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

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
const { Clutter, GObject, St, Gtk } = imports.gi
1+
import Clutter from 'gi://Clutter'
2+
import GObject from 'gi://GObject'
3+
import St from 'gi://St'
4+
import Graphene from 'gi://Graphene'
25

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
6+
import { ScaleLayout } from '../scaleLayout/scaleLayout.js'
7+
import { Translations } from '../../helpers/translations.js'
58

6-
const { ScaleLayout } = Me.imports.components.scaleLayout.scaleLayout
7-
const { Translations } = Me.imports.helpers.translations
89

9-
let Graphene
10+
export const MESSAGE_ANIMATION_TIME = 100
1011

11-
try {
12-
Graphene = imports.gi.Graphene
13-
} catch (e) {
14-
// no graphene older gnome
15-
}
16-
17-
var MESSAGE_ANIMATION_TIME = 100
18-
19-
var FlatList = GObject.registerClass({
12+
export const FlatList = GObject.registerClass({
2013
Signals: {
2114
'clicked-item': {
2215
param_types: [GObject.TYPE_OBJECT]
@@ -30,8 +23,8 @@ var FlatList = GObject.registerClass({
3023
x_expand: true,
3124
y_expand: true,
3225
clip_to_allocation: true,
33-
hscrollbar_policy: Gtk.PolicyType.NEVER,
34-
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC
26+
hscrollbar_policy: St.PolicyType.NEVER,
27+
vscrollbar_policy: St.PolicyType.AUTOMATIC
3528
})
3629

3730
this._content = new St.BoxLayout({

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
const { GObject, St } = imports.gi
1+
import GObject from 'gi://GObject'
2+
import St from 'gi://St'
23

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
4+
import { SettingsHandler } from '../../helpers/settings.js'
55

6-
const { SettingsHandler } = Me.imports.helpers.settings
7-
8-
var ProjectSelectButtons = GObject.registerClass({}, class ProjectSelectButtons extends St.BoxLayout {
6+
export const ProjectSelectButtons = GObject.registerClass({}, class ProjectSelectButtons extends St.BoxLayout {
97
_init () {
108
super._init({
119
style_class: 'project-select-buttons'

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
const { GObject, St } = imports.gi
1+
import GObject from 'gi://GObject'
2+
import St from 'gi://St'
23

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
4+
import * as ComponentsHelper from '../../helpers/components.js'
55

6-
const ComponentsHelper = Me.imports.helpers.components
7-
8-
var Icon = GObject.registerClass({}, class Icon extends St.Icon {
6+
export const Icon = GObject.registerClass({}, class Icon extends St.Icon {
97
_init ({ icon_name, isCustomIcon, ...props }) {
108
const iconOptions = { }
119

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
const { Clutter, GObject } = imports.gi;
1+
import Clutter from 'gi://Clutter'
2+
import GObject from 'gi://GObject'
23

3-
var ScaleLayout = GObject.registerClass(
4+
export const ScaleLayout = GObject.registerClass(
45
class ScaleLayout extends Clutter.BinLayout {
56
_init (params) {
67
this._container = null

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
const { GObject, St } = imports.gi
1+
import GObject from 'gi://GObject'
2+
import St from 'gi://St'
23

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
5-
const { ProjectsScreen } = Me.imports.components.screens.projectsScreen.projectsScreen
6-
const { ProjectDetailsScreen } = Me.imports.components.screens.projectDetailsScreen.projectDetailsScreen
4+
import { ProjectDetailsScreen } from '../screens/projectDetailsScreen/projectDetailsScreen.js'
5+
import { ProjectsScreen } from '../screens/projectsScreen/projectsScreen.js'
76

8-
var ScreenWrapper = GObject.registerClass(
7+
export const ScreenWrapper = GObject.registerClass(
98
class ScreenWrapper extends St.Widget {
109
_init (mainEventHandler) {
1110
super._init({

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
const { Clutter, GObject, St } = imports.gi
1+
import Clutter from 'gi://Clutter'
2+
import GObject from 'gi://GObject'
3+
import St from 'gi://St'
24

3-
const ExtensionUtils = imports.misc.extensionUtils
4-
const Me = ExtensionUtils.getCurrentExtension()
5+
import { CommitCard } from '../../cards/commitCard.js'
6+
import { FlatList } from '../../flatList/flatList.js'
7+
import { PipelineCard } from '../../cards/pipelineCard.js'
8+
import { ProjectCard } from '../../cards/projectCard.js'
9+
import { SearchBar } from '../../searchBar/searchBar.js'
10+
import { Translations } from '../../../helpers/translations.js'
511

6-
const { CommitCard } = Me.imports.components.cards.commitCard
7-
const { FlatList } = Me.imports.components.flatList.flatList
8-
const { PipelineCard } = Me.imports.components.cards.pipelineCard
9-
const { ProjectCard } = Me.imports.components.cards.projectCard
10-
const { SearchBar } = Me.imports.components.searchBar.searchBar
11-
const { Translations } = Me.imports.helpers.translations
12-
13-
const GitLabService = Me.imports.services.gitlab
12+
import * as GitLabService from '../../../services/gitlab.js'
1413

1514
const TABS = {
1615
COMMITS: 'commits',
1716
PIPELINES: 'pipelines'
1817
}
1918

20-
var ProjectDetailsScreen = GObject.registerClass({}, class ProjectDetailsScreen extends St.BoxLayout {
19+
export const ProjectDetailsScreen = GObject.registerClass({}, class ProjectDetailsScreen extends St.BoxLayout {
2120
_init (projectItem, mainEventHandler) {
2221
super._init({
2322
style_class: 'screen project-details-screen',
@@ -101,7 +100,7 @@ var ProjectDetailsScreen = GObject.registerClass({}, class ProjectDetailsScreen
101100
// vertical: false
102101
// })
103102
//
104-
// this.scroll.add_actor(this.box, { expand: false, x_fill: false, x_align: St.Align.LEFT })
103+
// this.scroll.add_actor(this.box, { expand: false, x_fill: false, x_align: Clutter.ActorAlign.LEFT })
105104
// }
106105

107106
_extract_filterable_search_text (commit, pipeline) {
@@ -212,9 +211,9 @@ var ProjectDetailsScreen = GObject.registerClass({}, class ProjectDetailsScreen
212211

213212
// refresh data
214213
if (this._selectedTab === TABS.COMMITS) {
215-
this._loadCommits()
214+
this._loadCommits().catch(e => log(e))
216215
} else if (this._selectedTab === TABS.PIPELINES) {
217-
this._loadPipelines()
216+
this._loadPipelines().catch(e => log(e))
218217
}
219218
}
220219
})

0 commit comments

Comments
 (0)