Skip to content

Commit

Permalink
Revert "Add header bar and use libadwaita"
Browse files Browse the repository at this point in the history
This reverts commit 5bff26d.
  • Loading branch information
sonnyp committed Oct 24, 2021
1 parent 1745beb commit f138149
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 135 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test:
./node_modules/.bin/eslint --cache .
flatpak run org.freedesktop.appstream-glib validate data/re.sonny.Junction.metainfo.xml
flatpak run --command="desktop-file-validate" --file-forwarding org.gnome.Sdk//41 --no-hints @@ data/re.sonny.Junction.desktop @@
# gtk4-builder-tool validate src/*.ui
gtk4-builder-tool validate src/*.ui
# gjs -m test/*.test.js
flatpak-builder --show-manifest re.sonny.Junction.json
find po/ -type f -name "*.po" -print0 | xargs -0 -n1 msgfmt -o /dev/null --check
Expand Down
2 changes: 1 addition & 1 deletion notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Help welcome! Feel free to open an issue and I'd be happy to assist.
- Remember application for file type
- Replace home dir path with ~
- Replace `file:///` with `/`
- Open file read only (or copy)
- Open file read only
- For URLs
- HTTPS Everywhere / hsts support
- Removes tracking elements from URLs
Expand Down
1 change: 1 addition & 0 deletions src/Entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default function Entry({ entry, value, scheme, copyToClipboard }) {
// const entry = builder.get_object("entry");

entry.set_text(value);
entry.set_tooltip_text(value);

// Maybe an elipsis in the middle in "view" mode
// would be best
Expand Down
4 changes: 2 additions & 2 deletions src/application.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Adw from "gi://Adw";
import Gtk from "gi://Gtk";
import Gio from "gi://Gio";

import Window from "./window.js";
Expand All @@ -7,7 +7,7 @@ import About from "./about.js";
import ShortcutsWindow from "./ShortcutsWindow.js";

export default function Application({ version }) {
const application = new Adw.Application({
const application = new Gtk.Application({
application_id: "re.sonny.Junction",
flags: Gio.ApplicationFlags.HANDLES_OPEN,
});
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import "./setup.js";

import Gio from "gi://Gio";
import GLib from "gi://GLib";
import { programInvocationName } from "system";
import { bindtextdomain, textdomain } from "gettext";
import Adw from "gi://Adw";

import Application from "./application.js";

Expand All @@ -18,7 +19,6 @@ export default function main(argv, { version, datadir }) {
textdomain("re.sonny.Junction");

const application = Application({ version });
Adw.StyleManager.get_default().color_scheme = Adw.ColorScheme.FORCE_DARK;

log("argv " + argv.join(" "));
log(`programInvocationName: ${programInvocationName}`);
Expand Down
8 changes: 8 additions & 0 deletions src/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// GLib, GObject, and Gio are required by GJS so no version is necessary.
// https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/ESModules.md
// import "gi://Gio";
// import "gi://GLib";
import Gtk from "gi://Gtk?version=4.0";
import "gi://Gdk?version=4.0";

Gtk.init();
77 changes: 34 additions & 43 deletions src/welcome.ui
Original file line number Diff line number Diff line change
@@ -1,62 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?>
<interface>
<object class="AdwApplicationWindow" id="welcome">
<object class="GtkApplicationWindow" id="welcome">
<property name="title">Junction</property>
<property name="default-width">480</property>
<property name="default-height">480</property>
<property name="content">
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkMenuButton" id="button_menu">
<property name="menu-model">menu_app</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property name="spacing">14</property>
<child>
<object class="AdwHeaderBar" id="headerbar">
<child type="end">
<object class="GtkMenuButton" id="button_menu">
<property name="menu-model">menu_app</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
<object class="GtkImage">
<property name="icon-name">emblem-default-symbolic</property>
<property name="pixel-size">128</property>
</object>

</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<object class="GtkLabel">
<property
name="label"
translatable="yes"
>Junction has been set as default application for Web</property>
</object>
</child>
<child>
<object class="GtkLinkButton" id="test_button">
<property
name="label"
translatable="yes"
>Click here to test</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property name="spacing">14</property>
<property name="vexpand">true</property>
<child>
<object class="GtkImage">
<property name="icon-name">emblem-default-symbolic</property>
<property name="pixel-size">128</property>
</object>

</child>
<child>
<object class="GtkLabel">
<property
name="label"
translatable="yes"
>Junction has been set as default application for Web</property>
</object>
</child>
<child>
<object class="GtkLinkButton" id="test_button">
<property
name="label"
translatable="yes"
>Click here to test</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property
name="uri"
>https://github.com/sonnyp/Junction</property>
</object>
</child>
<property name="uri">https://github.com/sonnyp/Junction</property>
</object>
</child>
</object>
</property>

</child>
<style>
<class name="welcome" />
</style>
Expand Down
11 changes: 1 addition & 10 deletions src/window.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ window.main {
.list {
background: none;
margin: 12px;
margin-bottom: 0;
}

.list button {
Expand Down Expand Up @@ -38,13 +39,3 @@ entry.uri {
color: white;
border: solid 1px black;
}

headerbar {
border: none;
background: none;
}

entry {
background: none;
border: none;
}
103 changes: 27 additions & 76 deletions src/window.ui
Original file line number Diff line number Diff line change
@@ -1,95 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<interface>
<object class="AdwApplicationWindow" id="window">
<property name="title">Junction</property>
<object class="GtkApplicationWindow" id="window">
<property name="resizable">False</property>
<property name="decorated">True</property>
<property name="content">
<property name="decorated">False</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwHeaderBar" id="headerbar">
<property name="decoration-layout">:close</property>
<child type="start">
<object class="GtkMenuButton">
<property name="menu-model">menu_app</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
<child type="title">
<object class="GtkEntry" id="entry">
<property name="input-purpose">url</property>
<property name="xalign">0.5</property>
<property name="hexpand">true</property>
<!-- TODO: file a bug - does not seem to be working -->
<property name="primary-icon-activatable">false</property>
<!-- TRANSLATORS: You will find this string in https://gitlab.gnome.org/search?search=This+site+has+no+security&project_id=1906 -->
<property
name="primary-icon-tooltip-text"
translatable="yes"
>This site has no security. An attacker could see any information you send, or control the content that you see.</property>
<property
name="secondary-icon-name"
>edit-copy-symbolic</property>
<property
name="secondary-icon-tooltip-text"
translatable="yes"
>Copy to Clipboard</property>
<style>
<class name="uri" />
</style>
</object>
</child>
<object class="GtkBox" id="list">
<style>
<class name="flat" />
<class name="list" />
</style>
<property name="orientation">horizontal</property>
<property name="homogeneous">True</property>
<property name="spacing">18</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="list">
<style>
<class name="list" />
</style>
<property name="orientation">horizontal</property>
<property name="homogeneous">True</property>
<property name="spacing">18</property>
</object>
</child>
<object class="GtkEntry" id="entry">
<property name="input-purpose">url</property>
<property name="xalign">0.5</property>
<!-- TODO: file a bug - does not seem to be working -->
<property name="primary-icon-activatable">False</property>
<!-- TRANSLATORS: You will find this string in https://gitlab.gnome.org/search?search=This+site+has+no+security&project_id=1906 -->
<property
name="primary-icon-tooltip-text"
translatable="yes"
>This site has no security. An attacker could see any information you send, or control the content that you see.</property>
<property name="secondary-icon-name">edit-copy-symbolic</property>
<property
name="secondary-icon-tooltip-text"
translatable="yes"
>Copy to Clipboard</property>
<style>
<class name="uri" />
</style>
</object>
</child>
</object>
</property>
</child>
<style>
<class name="main" />
</style>
</object>

<menu id="menu_app">
<section>
<item>
<attribute
name="label"
translatable="yes"
>Keyboard Shortcuts</attribute>
<attribute name="action">app.shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">About Junction</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
<menu id="menu_remember">
<section>
<item>
<attribute name="label">github.com</attribute>
</item>
<item>
<attribute name="label">github.com/sonnyp</attribute>
</item>
</section>
</menu>
</interface>

0 comments on commit f138149

Please sign in to comment.