Skip to content

Commit

Permalink
Revert "Use UI file directly"
Browse files Browse the repository at this point in the history
This reverts commit 76a9b23.
  • Loading branch information
swsnr committed Sep 5, 2024
1 parent 469b684 commit 083c837
Show file tree
Hide file tree
Showing 7 changed files with 250 additions and 49 deletions.
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ XGETTEXT_METADATA = \
--copyright-holder "Sebastian Wiesner <[email protected]>"

DIST-EXTRA-SRC = README.md LICENSE-GPL2 LICENSE-MPL2 icons/
UIDEFS = $(wildcard ui/*.ui)
BLUEPRINTS = $(wildcard ui/*.blp)
UIDEFS = $(addsuffix .ui,$(basename $(BLUEPRINTS)))
CATALOGS = $(wildcard po/*.po)

BLUEPRINT-COMPILER = "blueprint-compiler"

.PHONY: dist
dist: compile
mkdir -p ./dist/
Expand Down Expand Up @@ -66,15 +69,17 @@ clean:
compile: $(UIDEFS)
pnpm compile

# For Gtk builder the Gtk development package needs to be installed;
# otherwise xgettext uses its built-in fallback rule and fails to extract messages.
# For blueprint, see https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/translations.html
# The language doesn't really matter for blueprint, but xgettext warns if we don't set it
.PHONY: pot
pot:
find src -name '*.ts' | \
xargs xgettext $(XGETTEXT_METADATA) \
--from-code=UTF-8 --language=JavaScript --output=po/$(UUID).pot
xgettext $(XGETTEXT_METADATA) --from-code=UTF-8 --join-existing --output=po/$(UUID).pot \
--add-comments $(UIDEFS)
xgettext $(XGETTEXT_METADATA) --from-code=UTF-8 --language=C \
--join-existing --output=po/$(UUID).pot \
--add-comments --keyword=_ --keyword=C_:1c,2 \
$(wildcard ui/*.blp)

.PHONY: messages
messages: $(CATALOGS)
Expand All @@ -99,5 +104,8 @@ check: lint check-types
fix: format
pnpm lint --fix

$(UIDEFS): %.ui: %.blp
$(BLUEPRINT-COMPILER) compile --output $@ $<

$(CATALOGS): %.po: pot
msgmerge --update --backup=none --lang=$(notdir $(basename $@)) $@ po/[email protected]
71 changes: 41 additions & 30 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-29 22:11+0200\n"
"PO-Revision-Date: 2024-08-29 22:15+0200\n"
"POT-Creation-Date: 2024-09-05 10:59+0200\n"
"PO-Revision-Date: 2024-09-05 10:59+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
Expand Down Expand Up @@ -216,6 +216,10 @@ msgctxt "Error Dialog"
msgid "Close"
msgstr "Schließen"

#: src/extension.ts:148
msgid "Picture of the Day"
msgstr "Bild des Tages"

#: src/prefs.ts:123
msgid "XDG State directory"
msgstr "XDG Zustandsverzeichnis"
Expand All @@ -224,41 +228,48 @@ msgstr "XDG Zustandsverzeichnis"
msgid "Select download folder"
msgstr "Download-Ordner auswählen"

#: src/extension.ts:148
msgid "Picture of the Day"
msgstr "Bild des Tages"

#~ msgid "About"
#~ msgstr "Über"
#: ui/AboutPage.blp:7
msgid "About"
msgstr "Über"

#~ msgid "Get a picture of the day as desktop background."
#~ msgstr "Bilder des Tages als Desktop-Hintergrund."
#: ui/AboutPage.blp:37
msgid "Get a picture of the day as desktop background."
msgstr "Bilder des Tages als Desktop-Hintergrund."

#~ msgctxt "about link"
#~ msgid "Github"
#~ msgstr "Github"
#: ui/AboutPage.blp:46
msgctxt "about link"
msgid "Github"
msgstr "Github"

#~ msgctxt "about link"
#~ msgid "Issue tracker"
#~ msgstr "Issue tracker"
#: ui/AboutPage.blp:51
msgctxt "about link"
msgid "Issue tracker"
msgstr "Issue tracker"

#~ msgid "Picture Sources"
#~ msgstr "Bildquellen"
#: ui/SourcesPage.blp:7
msgid "Picture Sources"
msgstr "Bildquellen"

#~ msgid "Configure sources for the Picture of the Day."
#~ msgstr "Quellen für das Bild des Tages einrichten."
#: ui/SourcesPage.blp:8
msgid "Configure sources for the Picture of the Day."
msgstr "Quellen für das Bild des Tages einrichten."

#~ msgid "Selected source"
#~ msgstr "Bildquellen"
#: ui/SourcesPage.blp:13
msgid "Selected source"
msgstr "Bildquellen"

#~ msgid "Refresh automatically"
#~ msgstr "Automatisch aktualisieren"
#: ui/SourcesPage.blp:18
msgid "Refresh automatically"
msgstr "Automatisch aktualisieren"

#~ msgid "Custom download folder"
#~ msgstr "Benutzerdefinierter Download-Ordner"
#: ui/SourcesPage.blp:24
msgid "Custom download folder"
msgstr "Benutzerdefinierter Download-Ordner"

#~ msgid "API key"
#~ msgstr "API Schlüssel"
#: ui/SourcesPage.blp:43
msgid "API key"
msgstr "API Schlüssel"

#~ msgid "Get API key"
#~ msgstr "API Schlüssel erhalten"
#: ui/SourcesPage.blp:47
msgid "Get API key"
msgstr "API Schlüssel erhalten"
52 changes: 49 additions & 3 deletions po/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: [email protected]\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-29 22:11+0200\n"
"POT-Creation-Date: 2024-09-05 10:59+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -192,6 +192,10 @@ msgctxt "Error Dialog"
msgid "Close"
msgstr ""

#: src/extension.ts:148
msgid "Picture of the Day"
msgstr ""

#: src/prefs.ts:123
msgid "XDG State directory"
msgstr ""
Expand All @@ -200,6 +204,48 @@ msgstr ""
msgid "Select download folder"
msgstr ""

#: src/extension.ts:148
msgid "Picture of the Day"
#: ui/AboutPage.blp:7
msgid "About"
msgstr ""

#: ui/AboutPage.blp:37
msgid "Get a picture of the day as desktop background."
msgstr ""

#: ui/AboutPage.blp:46
msgctxt "about link"
msgid "Github"
msgstr ""

#: ui/AboutPage.blp:51
msgctxt "about link"
msgid "Issue tracker"
msgstr ""

#: ui/SourcesPage.blp:7
msgid "Picture Sources"
msgstr ""

#: ui/SourcesPage.blp:8
msgid "Configure sources for the Picture of the Day."
msgstr ""

#: ui/SourcesPage.blp:13
msgid "Selected source"
msgstr ""

#: ui/SourcesPage.blp:18
msgid "Refresh automatically"
msgstr ""

#: ui/SourcesPage.blp:24
msgid "Custom download folder"
msgstr ""

#: ui/SourcesPage.blp:43
msgid "API key"
msgstr ""

#: ui/SourcesPage.blp:47
msgid "Get API key"
msgstr ""
74 changes: 74 additions & 0 deletions ui/AboutPage.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using Gtk 4.0;
using Adw 1;

translation-domain "[email protected]";

template $PictureOfTheDayAboutPage : Adw.PreferencesPage {
title: _("About");
icon-name: "dialog-information-symbolic";

Adw.PreferencesGroup {
valign: fill;
halign: fill;

Box {
orientation: vertical;
halign: center;
margin-bottom: 15;

Label extensionName {
label: "The name of this extension";
margin-bottom: 5;
styles ["title-1"]
}

Label extensionVersion {
label: "0.0.0";
styles ["caption"]
}
}

Box {
orientation: vertical;
halign: center;
margin-bottom: 5;

Label extensionDescription {
label: _("Get a picture of the day as desktop background.");
justify: center;
}
}

Box {
halign: center;

LinkButton linkGithub {
label: C_("about link", "Github");

}

LinkButton linkIssues {
label: C_("about link", "Issue tracker");
}
}

Box {
orientation: vertical;
vexpand: true;
hexpand: true;

ScrolledWindow {
margin-top: 24;
vexpand: true;
hexpand: true;

TextView extensionLicense {
editable: false;
cursor-visible: false;
wrap-mode: word;
justification: center;
}
}
}
}
}
13 changes: 9 additions & 4 deletions ui/AboutPage.ui
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT EDIT!
This file was @generated by blueprint-compiler. Instead, edit the
corresponding .blp file and regenerate this file with blueprint-compiler.
-->
<interface domain="[email protected]">
<requires lib="gtk" version="4.0"/>
<template class="PictureOfTheDayAboutPage" parent="AdwPreferencesPage">
<property name="title" translatable="true">About</property>
<property name="title" translatable="yes">About</property>
<property name="icon-name">dialog-information-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
Expand Down Expand Up @@ -39,7 +44,7 @@
<property name="margin-bottom">5</property>
<child>
<object class="GtkLabel" id="extensionDescription">
<property name="label" translatable="true">Get a picture of the day as desktop background.</property>
<property name="label" translatable="yes">Get a picture of the day as desktop background.</property>
<property name="justify">2</property>
</object>
</child>
Expand All @@ -50,12 +55,12 @@
<property name="halign">3</property>
<child>
<object class="GtkLinkButton" id="linkGithub">
<property name="label" translatable="true" context="about link">Github</property>
<property name="label" translatable="yes" context="about link">Github</property>
</object>
</child>
<child>
<object class="GtkLinkButton" id="linkIssues">
<property name="label" translatable="true" context="about link">Issue tracker</property>
<property name="label" translatable="yes" context="about link">Issue tracker</property>
</object>
</child>
</object>
Expand Down
52 changes: 52 additions & 0 deletions ui/SourcesPage.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Gtk 4.0;
using Adw 1;

translation-domain "[email protected]";

template $PictureOfTheDaySourcesPage: Adw.PreferencesPage {
title: _("Picture Sources");
description: _("Configure sources for the Picture of the Day.");
icon-name: "picture-of-the-day-symbolic";

Adw.PreferencesGroup {
Adw.ExpanderRow sourcesRow {
title: _("Selected source");
styles ["property"]
}

Adw.SwitchRow refreshAutomatically {
title: _("Refresh automatically");
}
}

Adw.PreferencesGroup {
Adw.ActionRow downloadFolder {
title: _("Custom download folder");
styles ["property"]

[suffix]
Gtk.Button selectDownloadFolder {
icon-name: "folder-open-symbolic";
styles ["flat"]
}

[suffix]
Gtk.Button resetDownloadFolder {
icon-name: "edit-clear-symbolic";
styles ["flat"]
}
}
}

Adw.PreferencesGroup apodGroup {
Adw.EntryRow apodApiKey {
title: _("API key");

[suffix]
Gtk.LinkButton {
label: _("Get API key");
uri: "https://api.nasa.gov/";
}
}
}
}
Loading

0 comments on commit 083c837

Please sign in to comment.