|
1 | | -const ExtensionUtils = imports.misc.extensionUtils; |
2 | | -const Me = ExtensionUtils.getCurrentExtension(); |
| 1 | +const ExtensionUtils = imports.misc.extensionUtils |
| 2 | +const Me = ExtensionUtils.getCurrentExtension() |
3 | 3 |
|
4 | | -const {Adw, GdkPixbuf, Gio, GLib, GObject, Gtk} = imports.gi; |
| 4 | +const { Adw, GdkPixbuf, Gio, GLib, GObject, Gtk } = imports.gi |
5 | 5 |
|
6 | 6 | const { Settings } = Me.imports.helpers.settings |
7 | 7 | const { Translations } = Me.imports.helpers.translations |
8 | 8 |
|
9 | | -var AboutPage = GObject.registerClass( |
| 9 | +var AboutPage = GObject.registerClass({ |
| 10 | + GTypeName: 'GitlabExtension-AboutPage', |
| 11 | + }, |
10 | 12 | class AboutPagePreferencesPage extends Adw.PreferencesPage { |
11 | | - _init() { |
| 13 | + _init () { |
12 | 14 | super._init({ |
13 | 15 | title: Translations.SETTINGS.TITLE_ABOUT, |
14 | 16 | icon_name: 'help-about-symbolic', |
15 | 17 | name: 'AboutPage' |
16 | | - }); |
| 18 | + }) |
17 | 19 |
|
18 | 20 | //Logo and project description------------------------------------- |
19 | | - let headerPreferencesGroup = new Adw.PreferencesGroup(); |
| 21 | + let headerPreferencesGroup = new Adw.PreferencesGroup() |
20 | 22 |
|
21 | | - let extensionHeaderBox = new Gtk.Box( { |
| 23 | + let extensionHeaderBox = new Gtk.Box({ |
22 | 24 | orientation: Gtk.Orientation.VERTICAL, |
23 | 25 | hexpand: false, |
24 | 26 | vexpand: false |
25 | | - }); |
| 27 | + }) |
26 | 28 |
|
27 | 29 | let extensionTaskbarLabel = new Gtk.Label({ |
28 | 30 | label: `<span size="larger"><b>${Translations.EXTENSION.NAME}</b></span>`, |
29 | 31 | use_markup: true, |
30 | 32 | vexpand: true, |
31 | 33 | valign: Gtk.Align.FILL |
32 | | - }); |
| 34 | + }) |
33 | 35 |
|
34 | 36 | let projectDescriptionLabel = new Gtk.Label({ |
35 | 37 | label: Translations.EXTENSION.DESCRIPTION, |
36 | 38 | hexpand: false, |
37 | 39 | vexpand: false, |
38 | | - }); |
39 | | - extensionHeaderBox.append(extensionTaskbarLabel); |
40 | | - extensionHeaderBox.append(projectDescriptionLabel); |
41 | | - headerPreferencesGroup.add(extensionHeaderBox); |
| 40 | + }) |
| 41 | + extensionHeaderBox.append(extensionTaskbarLabel) |
| 42 | + extensionHeaderBox.append(projectDescriptionLabel) |
| 43 | + headerPreferencesGroup.add(extensionHeaderBox) |
42 | 44 |
|
43 | | - this.add(headerPreferencesGroup); |
| 45 | + this.add(headerPreferencesGroup) |
44 | 46 | //----------------------------------------------------------------------- |
45 | 47 |
|
46 | 48 | //Extension/OS Info Group------------------------------------------------ |
47 | | - let extensionInfoGroup = new Adw.PreferencesGroup(); |
| 49 | + let extensionInfoGroup = new Adw.PreferencesGroup() |
48 | 50 | let extensionTaskbarVersionRow = new Adw.ActionRow({ |
49 | 51 | title: Translations.MISC.EXTENSION_VERSION, |
50 | | - }); |
51 | | - let releaseVersion; |
52 | | - if(Me.metadata.version) |
53 | | - releaseVersion = Me.metadata.version; |
54 | | - else |
55 | | - releaseVersion = 'unknown'; |
| 52 | + }) |
| 53 | + let releaseVersion |
| 54 | + if (Me.metadata.version) { |
| 55 | + releaseVersion = Me.metadata.version |
| 56 | + } else { |
| 57 | + releaseVersion = 'unknown' |
| 58 | + } |
56 | 59 | extensionTaskbarVersionRow.add_suffix(new Gtk.Label({ |
57 | 60 | label: releaseVersion + '' |
58 | | - })); |
59 | | - extensionInfoGroup.add(extensionTaskbarVersionRow); |
| 61 | + })) |
| 62 | + extensionInfoGroup.add(extensionTaskbarVersionRow) |
60 | 63 |
|
61 | 64 | let commitRow = new Adw.ActionRow({ |
62 | 65 | title: Translations.MISC.GIT_COMMIT |
63 | | - }); |
64 | | - let commitVersion; |
65 | | - if(Me.metadata.commit) |
66 | | - commitVersion = Me.metadata.commit; |
| 66 | + }) |
| 67 | + let commitVersion |
| 68 | + if (Me.metadata.commit) { |
| 69 | + commitVersion = Me.metadata.commit |
| 70 | + } |
67 | 71 | commitRow.add_suffix(new Gtk.Label({ |
68 | 72 | label: commitVersion ? commitVersion : '', |
69 | | - })); |
70 | | - if(commitVersion){ |
71 | | - extensionInfoGroup.add(commitRow); |
| 73 | + })) |
| 74 | + if (commitVersion) { |
| 75 | + extensionInfoGroup.add(commitRow) |
72 | 76 | } |
73 | 77 |
|
74 | 78 | let gnomeVersionRow = new Adw.ActionRow({ |
75 | 79 | title: Translations.MISC.GNOME_VERSION, |
76 | | - }); |
| 80 | + }) |
77 | 81 | gnomeVersionRow.add_suffix(new Gtk.Label({ |
78 | 82 | label: imports.misc.config.PACKAGE_VERSION + '', |
79 | | - })); |
80 | | - extensionInfoGroup.add(gnomeVersionRow); |
| 83 | + })) |
| 84 | + extensionInfoGroup.add(gnomeVersionRow) |
81 | 85 |
|
82 | 86 | let osRow = new Adw.ActionRow({ |
83 | 87 | 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; |
| 88 | + }) |
| 89 | + let osInfoText |
| 90 | + let name = GLib.get_os_info('NAME') |
| 91 | + let prettyName = GLib.get_os_info('PRETTY_NAME') |
| 92 | + if (prettyName) { |
| 93 | + osInfoText = prettyName |
| 94 | + } else { |
| 95 | + osInfoText = name |
| 96 | + } |
| 97 | + let versionID = GLib.get_os_info('VERSION_ID') |
| 98 | + if (versionID) { |
| 99 | + osInfoText += '; Version ID: ' + versionID |
| 100 | + } |
| 101 | + let buildID = GLib.get_os_info('BUILD_ID') |
| 102 | + if (buildID) { |
| 103 | + osInfoText += '; ' + 'Build ID: ' + buildID |
| 104 | + } |
98 | 105 | osRow.add_suffix(new Gtk.Label({ |
99 | 106 | label: osInfoText, |
100 | 107 | single_line_mode: false, |
101 | 108 | wrap: true, |
102 | | - })); |
103 | | - extensionInfoGroup.add(osRow); |
| 109 | + })) |
| 110 | + extensionInfoGroup.add(osRow) |
104 | 111 |
|
105 | 112 | let sessionTypeRow = new Adw.ActionRow({ |
106 | 113 | title: Translations.MISC.SESSION_TYPE, |
107 | | - }); |
108 | | - let windowingLabel; |
109 | | - if(Me.metadata.isWayland) |
110 | | - windowingLabel = "Wayland"; |
111 | | - else |
112 | | - windowingLabel = "X11"; |
| 114 | + }) |
| 115 | + let windowingLabel |
| 116 | + if (Me.metadata.isWayland) { |
| 117 | + windowingLabel = 'Wayland' |
| 118 | + } else { |
| 119 | + windowingLabel = 'X11' |
| 120 | + } |
113 | 121 | sessionTypeRow.add_suffix(new Gtk.Label({ |
114 | 122 | label: windowingLabel, |
115 | | - })); |
116 | | - extensionInfoGroup.add(sessionTypeRow); |
| 123 | + })) |
| 124 | + extensionInfoGroup.add(sessionTypeRow) |
117 | 125 |
|
118 | | - this.add(extensionInfoGroup); |
| 126 | + this.add(extensionInfoGroup) |
119 | 127 | //----------------------------------------------------------------------- |
120 | 128 |
|
121 | | - let linksGroup = new Adw.PreferencesGroup(); |
122 | | - let linksBox = new Adw.ActionRow(); |
| 129 | + let linksGroup = new Adw.PreferencesGroup() |
| 130 | + let linksBox = new Adw.ActionRow() |
123 | 131 |
|
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); |
| 132 | + let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(Me.path + '/media/donate-icon.svg', -1, 50, true) |
| 133 | + let donateImage = Gtk.Picture.new_for_pixbuf(pixbuf) |
126 | 134 | let donateLinkButton = new Gtk.LinkButton({ |
127 | 135 | child: donateImage, |
128 | 136 | uri: 'https://www.paypal.com/donate/?hosted_button_id=US78C8SZ6UHHQ', |
129 | | - }); |
| 137 | + }) |
130 | 138 |
|
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; |
| 139 | + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(Me.path + '/media/source-icon.svg', -1, 50, true) |
| 140 | + let sourceCodeImage = Gtk.Picture.new_for_pixbuf(pixbuf) |
| 141 | + let projectUrl = Me.metadata.url |
134 | 142 | let projectLinkButton = new Gtk.LinkButton({ |
135 | 143 | child: sourceCodeImage, |
136 | 144 | uri: projectUrl, |
137 | | - }); |
| 145 | + }) |
138 | 146 |
|
139 | | - linksBox.add_prefix(projectLinkButton); |
140 | | - linksBox.add_suffix(donateLinkButton); |
141 | | - linksGroup.add(linksBox); |
142 | | - this.add(linksGroup); |
| 147 | + linksBox.add_prefix(projectLinkButton) |
| 148 | + linksBox.add_suffix(donateLinkButton) |
| 149 | + linksGroup.add(linksBox) |
| 150 | + this.add(linksGroup) |
143 | 151 |
|
144 | | - let gnuSoftwareGroup = new Adw.PreferencesGroup(); |
| 152 | + let gnuSoftwareGroup = new Adw.PreferencesGroup() |
145 | 153 | let gnuSofwareLabel = new Gtk.Label({ |
146 | 154 | label: GNU_SOFTWARE, |
147 | 155 | use_markup: true, |
148 | 156 | justify: Gtk.Justification.CENTER |
149 | | - }); |
| 157 | + }) |
150 | 158 | let gnuSofwareLabelBox = new Gtk.Box({ |
151 | 159 | orientation: Gtk.Orientation.VERTICAL, |
152 | 160 | valign: Gtk.Align.END, |
153 | 161 | vexpand: true, |
154 | | - }); |
155 | | - gnuSofwareLabelBox.append(gnuSofwareLabel); |
156 | | - gnuSoftwareGroup.add(gnuSofwareLabelBox); |
157 | | - this.add(gnuSoftwareGroup); |
| 162 | + }) |
| 163 | + gnuSofwareLabelBox.append(gnuSofwareLabel) |
| 164 | + gnuSoftwareGroup.add(gnuSofwareLabelBox) |
| 165 | + this.add(gnuSoftwareGroup) |
158 | 166 | } |
159 | | - }); |
| 167 | + }) |
160 | 168 |
|
161 | 169 | var GNU_SOFTWARE = '<span size="small">' + |
162 | 170 | 'This program comes with absolutely no warranty.\n' + |
|
0 commit comments