This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a prefs widget with an about page
We use a separate typescript config to isolate the prefs file from the extension files; tsc compiles all files reachable from a single tsconfig into a shared global namespaces whereas the prefs widget is normally entirely indepdent. The prefs widget doesn't do much since we have no settings, but it serves as a place to show an About page, with license information and a link to our Github page. Also split the type decl files, move them to a subdirectory, and move them to a subdirectory, for easier syncing with vscode search provider.
- Loading branch information
Showing
14 changed files
with
757 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (C) Sebastian Wiesner <[email protected]> | ||
|
||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, write to the Free Software Foundation, Inc., | ||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
import ByteArray = imports.byteArray; | ||
import Gtk = imports.gi.Gtk; | ||
|
||
import ExtensionUtils = imports.misc.extensionUtils; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const Self = ExtensionUtils.getCurrentExtension()!; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function,@typescript-eslint/no-unused-vars | ||
function init(): void {} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function buildPrefsWidget(): imports.gi.Gtk.Widget { | ||
// gnome-extensions pack adds the prefs.ui file to the top-level directory | ||
const ui = Self.dir.get_child("prefs.ui").get_path(); | ||
if (!ui) { | ||
throw new Error(`Fatal error, failed to find prefs.ui file!`); | ||
} | ||
|
||
const buildable = Gtk.Builder.new_from_file(ui); | ||
|
||
const version = buildable.get_object<Gtk.Label>("about_version"); | ||
version.set_text(`Version ${Self.metadata.version}`); | ||
|
||
const license = ByteArray.toString( | ||
Self.dir.get_child("COPYING").load_contents(null)[1] | ||
); | ||
const license_buffer = buildable.get_object<Gtk.TextBuffer>( | ||
"about_license_buffer" | ||
); | ||
license_buffer.set_text(license, -1); | ||
|
||
const widget = buildable.get_object<Gtk.Widget>("prefs_widget"); | ||
widget.show_all(); | ||
return widget; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Generated with glade 3.36.0 | ||
jetbrains-search-provider - Jetbrains projects in Gnome Shell search | ||
Copyright (C) Sebastian Wiesner <[email protected]> | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
Author: Sebastian Wiesner <[email protected]> | ||
--> | ||
<interface> | ||
<requires lib="gtk+" version="3.22"/> | ||
<!-- interface-license-type gplv2 --> | ||
<!-- interface-name jetbrains-search-provider --> | ||
<!-- interface-description Jetbrains projects in Gnome Shell search --> | ||
<!-- interface-copyright Sebastian Wiesner <[email protected]> --> | ||
<!-- interface-authors Sebastian Wiesner <[email protected]> --> | ||
<object class="GtkTextBuffer" id="about_license_buffer"/> | ||
<object class="GtkNotebook" id="prefs_widget"> | ||
<property name="width_request">800</property> | ||
<property name="height_request">800</property> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<child> | ||
<object class="GtkBox" id="about_box"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="margin_start">12</property> | ||
<property name="margin_end">12</property> | ||
<property name="margin_top">12</property> | ||
<property name="margin_bottom">12</property> | ||
<property name="orientation">vertical</property> | ||
<property name="spacing">12</property> | ||
<child> | ||
<object class="GtkLabel" id="about_name"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Jetbrains Search Provider</property> | ||
<attributes> | ||
<attribute name="weight" value="bold"/> | ||
</attributes> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLabel" id="about_description"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Add recent projects from JetBrains IDEs to Gnome Shell search</property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLabel" id="about_no_affiliation"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes"><b>Note:</b> This extension is not affiliated with or endorsed by JetBrains.</property> | ||
<property name="use_markup">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">2</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLabel" id="about_version"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Version</property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">3</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLinkButton" id="about_github"> | ||
<property name="label" translatable="yes">GitHub</property> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="receives_default">True</property> | ||
<property name="relief">none</property> | ||
<property name="uri">https://github.com/lunaryorn/jetbrains-search-provider</property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">4</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLinkButton" id="about_issue_tracker"> | ||
<property name="label" translatable="yes">Issue Tracker</property> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="receives_default">True</property> | ||
<property name="relief">none</property> | ||
<property name="uri">https://github.com/lunaryorn/jetbrains-search-provider/issues</property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">5</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkFrame" id="about_license_frame"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="vexpand">True</property> | ||
<property name="label_xalign">0</property> | ||
<property name="shadow_type">in</property> | ||
<child> | ||
<object class="GtkAlignment"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="hexpand">False</property> | ||
<property name="vexpand">False</property> | ||
<property name="left_padding">12</property> | ||
<child> | ||
<object class="GtkScrolledWindow" id="about_license_scrolling"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="margin_start">6</property> | ||
<property name="margin_end">6</property> | ||
<property name="margin_top">6</property> | ||
<property name="margin_bottom">6</property> | ||
<property name="shadow_type">in</property> | ||
<child> | ||
<object class="GtkTextView" id="about_license_text"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="editable">False</property> | ||
<property name="buffer">about_license_buffer</property> | ||
<property name="monospace">True</property> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
<child type="label_item"> | ||
<placeholder/> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">6</property> | ||
</packing> | ||
</child> | ||
</object> | ||
</child> | ||
<child type="tab"> | ||
<object class="GtkLabel" id="about_label"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">About</property> | ||
</object> | ||
<packing> | ||
<property name="tab_fill">False</property> | ||
</packing> | ||
</child> | ||
</object> | ||
</interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017", | ||
// GJS doesn't have modules | ||
"module": "none", | ||
"lib": ["es2017"], | ||
"removeComments": false, | ||
|
||
/* Strict Type-Checking Options */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"compilerOptions": { | ||
"outFile": "./extension.js" | ||
}, | ||
"files": ["./extension.ts"], | ||
"include": ["types/**/*.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017", | ||
// GJS doesn't have modules | ||
"module": "none", | ||
"lib": ["es2017"], | ||
"removeComments": false, | ||
|
||
/* Strict Type-Checking Options */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
} | ||
"files": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.extension.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.prefs.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"compilerOptions": { | ||
"outFile": "./prefs.js" | ||
}, | ||
"files": ["./prefs.ts"], | ||
"include": ["types/**/*.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Sebastian Wiesner <[email protected]> | ||
|
||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
|
||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
declare namespace imports { | ||
class ByteArray { | ||
private constructor(); | ||
} | ||
|
||
namespace byteArray { | ||
function toString(array: ByteArray): string; | ||
} | ||
} |
Oops, something went wrong.