Skip to content

Commit 30b1fea

Browse files
authored
Merge pull request #13 from cinatic/v5
V5
2 parents f76dd3b + b8ca015 commit 30b1fea

25 files changed

+1360
-1562
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/make -f
22

33
# Copyright (C) 2020 Florijan Hamzic <fh[at]infinicode.de>
4-
# This file is distributed under the same license as the stocks-extension package.
4+
# This file is distributed under the same license as the gitlab-extension package.
55

66
.PHONY: clean mrproper
77

@@ -17,8 +17,8 @@ PO_DIR := $(SRC_DIR)/po
1717
LOCALE_DIR := $(SRC_DIR)/locale
1818

1919
JS_FILES := $(wildcard $(SRC_DIR)/*.js)
20-
UI_FILES := $(wildcard $(SRC_DIR)/*.ui)
2120
CSS_FILES := $(wildcard $(SRC_DIR)/*.css)
21+
MEDIA_FILES := $(wildcard $(SRC_DIR)/media)
2222
ICON_DIR := $(SRC_DIR)/icons
2323

2424
JS_COMPONENTS := $(SRC_DIR)/components $(SRC_DIR)/helpers $(SRC_DIR)/services
@@ -31,8 +31,8 @@ PO_FILES := $(wildcard $(PO_DIR)/*.po)
3131
MO_FILES := $(PO_FILES:$(PO_DIR)/%.po=$(LOCALE_DIR)/%/LC_MESSAGES/$(UUID).mo)
3232
MO_DIR := $(PO_FILES:$(PO_DIR)/%.po=$(LOCALE_DIR)/%/LC_MESSAGES)
3333

34-
TOLOCALIZE := $(JS_FILES) $(UI_FILES) $(SRC_DIR)/helpers/translations.js
35-
FILES := $(JS_FILES) $(JS_COMPONENTS) $(COMPILED_SCHEMAS) $(UI_FILES) $(CSS_FILES) $(ICON_DIR) $(SRC_DIR)/metadata.json $(MO_FILES)
34+
TOLOCALIZE := $(JS_FILES) $(SRC_DIR)/helpers/translations.js
35+
FILES := $(JS_FILES) $(JS_COMPONENTS) $(COMPILED_SCHEMAS) $(MEDIA_FILES) $(CSS_FILES) $(ICON_DIR) $(SRC_DIR)/metadata.json $(MO_FILES)
3636

3737
ifeq ($(strip $(DESTDIR)),)
3838
INSTALLBASE := $(HOME)/.local

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
const { Clutter, GObject, Graphene, St, Gtk } = imports.gi
1+
const { Clutter, GObject, St, Gtk } = imports.gi
22

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

66
const { ScaleLayout } = Me.imports.components.scaleLayout.scaleLayout
77
const { Translations } = Me.imports.helpers.translations
88

9+
let Graphene
10+
11+
try {
12+
Graphene = imports.gi.Graphene
13+
} catch (e) {
14+
// no graphene older gnome
15+
}
16+
917
var MESSAGE_ANIMATION_TIME = 100
1018

1119
var FlatList = GObject.registerClass({
@@ -81,10 +89,13 @@ var FlatList = GObject.registerClass({
8189

8290
const listItem = new St.Bin({
8391
child: item,
84-
layout_manager: new ScaleLayout(),
85-
pivot_point: new Graphene.Point({ x: .5, y: .5 })
92+
layout_manager: new ScaleLayout()
8693
})
8794

95+
if (Graphene) {
96+
listItem.pivot_point = new Graphene.Point({ x: .5, y: .5 })
97+
}
98+
8899
this._content.insert_child_at_index(listItem, index)
89100

90101
if (animate) {

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var ScreenWrapper = GObject.registerClass(
1313
style_class: 'screen-wrapper'
1414
})
1515

16-
EventHandler.connect('show-screen', (sender, { screen, additionalData }) => this.showScreen(screen, additionalData))
16+
this._showScreenConnectId = EventHandler.connect('show-screen', (sender, { screen, additionalData }) => this.showScreen(screen, additionalData))
1717

1818
this.showScreen()
1919
}
@@ -33,7 +33,13 @@ var ScreenWrapper = GObject.registerClass(
3333
}
3434

3535
this.destroy_all_children()
36-
this.add_actor(screen)
36+
this.add_child(screen)
37+
}
38+
39+
_onDestroy () {
40+
if (this._showScreenConnectId) {
41+
EventHandler.disconnect(this._showScreenConnectId)
42+
}
3743
}
3844
}
3945
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ var ProjectsScreen = GObject.registerClass({}, class ProjectsScreen extends St.B
120120
latestPipeline = (pipelinesResponse.json() || [])[0]
121121
}
122122

123-
this._list.addItem(new ProjectCard(project, latestPipeline))
123+
this._list.addItem(new ProjectCard(project, latestPipeline), true)
124124
})
125125
}
126126

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
const ExtensionUtils = imports.misc.extensionUtils;
2+
const Me = ExtensionUtils.getCurrentExtension();
3+
4+
const {Adw, GdkPixbuf, Gio, GLib, GObject, Gtk} = imports.gi;
5+
6+
const { Settings } = Me.imports.helpers.settings
7+
const { Translations } = Me.imports.helpers.translations
8+
9+
var AboutPage = GObject.registerClass(
10+
class AboutPagePreferencesPage extends Adw.PreferencesPage {
11+
_init() {
12+
super._init({
13+
title: Translations.SETTINGS.TITLE_ABOUT,
14+
icon_name: 'help-about-symbolic',
15+
name: 'AboutPage'
16+
});
17+
18+
//Logo and project description-------------------------------------
19+
let headerPreferencesGroup = new Adw.PreferencesGroup();
20+
21+
let extensionHeaderBox = new Gtk.Box( {
22+
orientation: Gtk.Orientation.VERTICAL,
23+
hexpand: false,
24+
vexpand: false
25+
});
26+
27+
let extensionTaskbarLabel = new Gtk.Label({
28+
label: `<span size="larger"><b>${Translations.EXTENSION.NAME}</b></span>`,
29+
use_markup: true,
30+
vexpand: true,
31+
valign: Gtk.Align.FILL
32+
});
33+
34+
let projectDescriptionLabel = new Gtk.Label({
35+
label: Translations.EXTENSION.DESCRIPTION,
36+
hexpand: false,
37+
vexpand: false,
38+
});
39+
extensionHeaderBox.append(extensionTaskbarLabel);
40+
extensionHeaderBox.append(projectDescriptionLabel);
41+
headerPreferencesGroup.add(extensionHeaderBox);
42+
43+
this.add(headerPreferencesGroup);
44+
//-----------------------------------------------------------------------
45+
46+
//Extension/OS Info Group------------------------------------------------
47+
let extensionInfoGroup = new Adw.PreferencesGroup();
48+
let extensionTaskbarVersionRow = new Adw.ActionRow({
49+
title: Translations.MISC.EXTENSION_VERSION,
50+
});
51+
let releaseVersion;
52+
if(Me.metadata.version)
53+
releaseVersion = Me.metadata.version;
54+
else
55+
releaseVersion = 'unknown';
56+
extensionTaskbarVersionRow.add_suffix(new Gtk.Label({
57+
label: releaseVersion + ''
58+
}));
59+
extensionInfoGroup.add(extensionTaskbarVersionRow);
60+
61+
let commitRow = new Adw.ActionRow({
62+
title: Translations.MISC.GIT_COMMIT
63+
});
64+
let commitVersion;
65+
if(Me.metadata.commit)
66+
commitVersion = Me.metadata.commit;
67+
commitRow.add_suffix(new Gtk.Label({
68+
label: commitVersion ? commitVersion : '',
69+
}));
70+
if(commitVersion){
71+
extensionInfoGroup.add(commitRow);
72+
}
73+
74+
let gnomeVersionRow = new Adw.ActionRow({
75+
title: Translations.MISC.GNOME_VERSION,
76+
});
77+
gnomeVersionRow.add_suffix(new Gtk.Label({
78+
label: imports.misc.config.PACKAGE_VERSION + '',
79+
}));
80+
extensionInfoGroup.add(gnomeVersionRow);
81+
82+
let osRow = new Adw.ActionRow({
83+
title: Translations.MISC.OS,
84+
});
85+
let osInfoText;
86+
let name = GLib.get_os_info("NAME");
87+
let prettyName = GLib.get_os_info("PRETTY_NAME");
88+
if(prettyName)
89+
osInfoText = prettyName;
90+
else
91+
osInfoText = name;
92+
let versionID = GLib.get_os_info("VERSION_ID");
93+
if(versionID)
94+
osInfoText += "; Version ID: " + versionID;
95+
let buildID = GLib.get_os_info("BUILD_ID");
96+
if(buildID)
97+
osInfoText += "; " + "Build ID: " +buildID;
98+
osRow.add_suffix(new Gtk.Label({
99+
label: osInfoText,
100+
single_line_mode: false,
101+
wrap: true,
102+
}));
103+
extensionInfoGroup.add(osRow);
104+
105+
let sessionTypeRow = new Adw.ActionRow({
106+
title: Translations.MISC.SESSION_TYPE,
107+
});
108+
let windowingLabel;
109+
if(Me.metadata.isWayland)
110+
windowingLabel = "Wayland";
111+
else
112+
windowingLabel = "X11";
113+
sessionTypeRow.add_suffix(new Gtk.Label({
114+
label: windowingLabel,
115+
}));
116+
extensionInfoGroup.add(sessionTypeRow);
117+
118+
this.add(extensionInfoGroup);
119+
//-----------------------------------------------------------------------
120+
121+
let linksGroup = new Adw.PreferencesGroup();
122+
let linksBox = new Adw.ActionRow();
123+
124+
let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(Me.path + '/media/donate-icon.svg', -1, 50, true);
125+
let donateImage = Gtk.Picture.new_for_pixbuf(pixbuf);
126+
let donateLinkButton = new Gtk.LinkButton({
127+
child: donateImage,
128+
uri: 'https://www.paypal.com/donate/?hosted_button_id=US78C8SZ6UHHQ',
129+
});
130+
131+
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(Me.path + '/media/source-icon.svg', -1, 50, true);
132+
let sourceCodeImage = Gtk.Picture.new_for_pixbuf(pixbuf);
133+
let projectUrl = Me.metadata.url;
134+
let projectLinkButton = new Gtk.LinkButton({
135+
child: sourceCodeImage,
136+
uri: projectUrl,
137+
});
138+
139+
linksBox.add_prefix(projectLinkButton);
140+
linksBox.add_suffix(donateLinkButton);
141+
linksGroup.add(linksBox);
142+
this.add(linksGroup);
143+
144+
let gnuSoftwareGroup = new Adw.PreferencesGroup();
145+
let gnuSofwareLabel = new Gtk.Label({
146+
label: GNU_SOFTWARE,
147+
use_markup: true,
148+
justify: Gtk.Justification.CENTER
149+
});
150+
let gnuSofwareLabelBox = new Gtk.Box({
151+
orientation: Gtk.Orientation.VERTICAL,
152+
valign: Gtk.Align.END,
153+
vexpand: true,
154+
});
155+
gnuSofwareLabelBox.append(gnuSofwareLabel);
156+
gnuSoftwareGroup.add(gnuSofwareLabelBox);
157+
this.add(gnuSoftwareGroup);
158+
}
159+
});
160+
161+
var GNU_SOFTWARE = '<span size="small">' +
162+
'This program comes with absolutely no warranty.\n' +
163+
'See the <a href="https://gnu.org/licenses/old-licenses/gpl-2.0.html">' +
164+
'GNU General Public License, version 2 or later</a> for details.' +
165+
'</span>';
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const ExtensionUtils = imports.misc.extensionUtils
2+
const Me = ExtensionUtils.getCurrentExtension()
3+
4+
const { Adw, Gio, GObject, Gtk } = imports.gi
5+
6+
const { Settings } = Me.imports.helpers.settings
7+
const { Translations } = Me.imports.helpers.translations
8+
9+
const { NewItemModel } = Me.imports.components.settings.subcomponents.newItemModel
10+
const { NewGitlabAccountRow } = Me.imports.components.settings.subcomponents.newGitlabAccountRow
11+
const { GitlabAccountModelList } = Me.imports.components.settings.subcomponents.gitlabAccountModelList
12+
const { GitlabAccountRow } = Me.imports.components.settings.subcomponents.gitlabAccountRow
13+
14+
var GitlabAccountListPage = GObject.registerClass(
15+
class GitlabAccountListPreferencePage extends Adw.PreferencesPage {
16+
_init () {
17+
super._init({
18+
title: Translations.SETTINGS.TITLE_ACCOUNTS,
19+
icon_name: 'view-list-symbolic',
20+
name: 'GitlabAccountListPage'
21+
})
22+
23+
const preferenceGroup = new GitlabAccountListPreferenceGroup()
24+
this.add(preferenceGroup)
25+
}
26+
})
27+
28+
class GitlabAccountListPreferenceGroup extends Adw.PreferencesGroup {
29+
static {
30+
GObject.registerClass(this)
31+
32+
this.install_action('account.add', null, self => self._gitlabAccountModelList.append())
33+
this.install_action('account.remove', 's', (self, name, param) => self._gitlabAccountModelList.remove(param.unpack()))
34+
this.install_action('account.edit', '(ss)', (self, name, param) => {
35+
const data = param.deepUnpack()
36+
37+
self._gitlabAccountModelList.edit(...data)
38+
})
39+
}
40+
41+
constructor () {
42+
super({
43+
title: Translations.SETTINGS.TITLE_ACCOUNT_LIST,
44+
})
45+
46+
this._gitlabAccountModelList = new GitlabAccountModelList()
47+
48+
const store = new Gio.ListStore({ item_type: Gio.ListModel })
49+
const listModel = new Gtk.FlattenListModel({ model: store })
50+
store.append(this._gitlabAccountModelList)
51+
store.append(new NewItemModel())
52+
53+
this._list = new Gtk.ListBox({
54+
selection_mode: Gtk.SelectionMode.NONE,
55+
css_classes: ['boxed-list'],
56+
})
57+
this._list.connect('row-activated', (l, row) => row.edit())
58+
this.add(this._list)
59+
60+
this._list.bind_model(listModel, item => {
61+
return !item.id
62+
? new NewGitlabAccountRow()
63+
: new GitlabAccountRow(item, this._gitlabAccountModelList)
64+
})
65+
}
66+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const ExtensionUtils = imports.misc.extensionUtils
2+
const Me = ExtensionUtils.getCurrentExtension()
3+
4+
const { Adw, Gio, GObject, Gtk } = imports.gi
5+
6+
const { Settings } = Me.imports.helpers.settings
7+
const { Translations } = Me.imports.helpers.translations
8+
9+
var SettingsPage = GObject.registerClass(
10+
class GitlabSettingsPreferencePage extends Adw.PreferencesPage {
11+
_init () {
12+
super._init({
13+
title: Translations.SETTINGS.TITLE_SETTINGS,
14+
icon_name: 'view-list-symbolic',
15+
name: 'SettingsPage'
16+
})
17+
18+
const preferenceGroup = new GeneralPreferenceGroup()
19+
this.add(preferenceGroup)
20+
}
21+
})
22+
23+
class GeneralPreferenceGroup extends Adw.PreferencesGroup {
24+
static {
25+
GObject.registerClass(this)
26+
}
27+
28+
constructor () {
29+
super({
30+
title: Translations.SETTINGS.TITLE_GENERAL
31+
})
32+
33+
const panelPositions = new Gtk.StringList()
34+
panelPositions.append(Translations.SETTINGS.POSITION_IN_PANEL_LEFT)
35+
panelPositions.append(Translations.SETTINGS.POSITION_IN_PANEL_CENTER)
36+
panelPositions.append(Translations.SETTINGS.POSITION_IN_PANEL_RIGHT)
37+
38+
const panelPositionRow = new Adw.ComboRow({
39+
title: Translations.SETTINGS.POSITION_IN_PANEL,
40+
model: panelPositions,
41+
selected: Settings.position_in_panel
42+
})
43+
44+
panelPositionRow.connect('notify::selected', (widget) => {
45+
Settings.position_in_panel = widget.selected
46+
})
47+
this.add(panelPositionRow)
48+
}
49+
}

0 commit comments

Comments
 (0)