Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add about dialog #159

Merged
merged 7 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ You'll need the following dependencies:
* libgranite-7-dev (>= 7.2.0, required only when you build with `granite` feature enabled)
* libgtk4-dev
* libgtksourceview-5-dev
* meson (>= 0.57.0)
* meson (>= 0.58.0)
* valac

Run `meson setup` to configure the build environment and run `meson compile` to build:
Expand Down
2 changes: 2 additions & 0 deletions build-aux/appcenter/com.github.ryonakano.konbucase.Devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ modules:
path: ../../
- type: patch
path: ../../patches/0001-chore-metainfo-Use-screenshots-taken-on-Pantheon.patch
- type: patch
path: ../../patches/0002-chore-MainWindow-Remove-about-dialog.patch
2 changes: 2 additions & 0 deletions com.github.ryonakano.konbucase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ modules:
path: .
- type: patch
path: patches/0001-chore-metainfo-Use-screenshots-taken-on-Pantheon.patch
- type: patch
path: patches/0002-chore-MainWindow-Remove-about-dialog.patch
2 changes: 1 addition & 1 deletion data/konbucase.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<launchable type="desktop-id">@APP_ID@.desktop</launchable>
<translation type="gettext">@GETTEXT_PACKAGE@</translation>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<project_license>GPL-3.0-or-later</project_license>

<name translate="no">KonbuCase</name>
<summary>Convert case in your text</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
<gresource prefix="/com/github/ryonakano/konbucase">
<file preprocess="xml-stripblanks">ui/text-pane.ui</file>
<file preprocess="xml-stripblanks">ui/main-window.ui</file>

<file preprocess="xml-stripblanks" alias="@APP_ID@.metainfo.xml">../@APP_ID@.metainfo.xml</file>
</gresource>
</gresources>
10 changes: 9 additions & 1 deletion data/resources/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ blueprints = custom_target('blueprints',
]
)

gresource_conf = configuration_data()
gresource_conf.set('APP_ID', app_id)
gresource_file_in = configure_file(
input: 'konbucase.gresource.xml.in',
output: '@0@.gresource.xml'.format(app_id),
configuration: gresource_conf
)

asresources = gnome.compile_resources(
'as-resources',
'konbucase.gresource.xml',
gresource_file_in,
dependencies: blueprints,
c_name: 'as'
)
6 changes: 6 additions & 0 deletions data/resources/ui/main-window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ menu main_menu {
target: "force-dark";
}
}

item {
///TRANSLATORS: Do NOT translate the phrase "KonbuCase"; it's the name of the app which is a proper noun.
label: _("_About KonbuCase");
action: "app.about";
}
}

$TextPaneModel source_model {
Expand Down
12 changes: 11 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
project('com.github.ryonakano.konbucase',
'vala', 'c',
version: '4.2.0',
meson_version: '>=0.57.0'
meson_version: '>=0.58.0'
)

app_name = 'KonbuCase'
app_id = meson.project_name()
app_version = meson.project_version()
if get_option('development')
app_name += ' (Development)'
app_id += '.Devel'

ret = run_command('git', 'rev-parse', '--short', 'HEAD', check: false)
if ret.returncode() != 0
version_suffix = '-devel'
else
version_suffix = '-@0@'.format(ret.stdout().strip())
endif

app_version += version_suffix
endif

i18n = import('i18n')
Expand Down
32 changes: 32 additions & 0 deletions patches/0002-chore-MainWindow-Remove-about-dialog.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 5d53c63427f6daf9930e48a8ff8466979a66b891 Mon Sep 17 00:00:00 2001
From: Ryo Nakano <ryonakaknock3@gmail.com>
Date: Sat, 4 May 2024 23:15:42 +0900
Subject: [PATCH] chore: MainWindow: Remove about dialog

A patch for Pantheon build. Pantheon prefers AppCenter instead of
an about dialog to show app details. So, apply this patch and prevent
it from being shown on Pantheon in case of build for Pantheon.
---
data/resources/ui/main-window.blp | 6 ------
1 file changed, 6 deletions(-)

diff --git a/data/resources/ui/main-window.blp b/data/resources/ui/main-window.blp
index a181172..2248e8c 100644
--- a/data/resources/ui/main-window.blp
+++ b/data/resources/ui/main-window.blp
@@ -24,12 +24,6 @@ menu main_menu {
target: "force-dark";
}
}
-
- item {
- ///TRANSLATORS: Do NOT translate the phrase "KonbuCase"; it's the name of the app which is a proper noun.
- label: _("_About KonbuCase");
- action: "app.about";
- }
}

$TextPaneModel source_model {
--
2.45.0

1 change: 1 addition & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ data/konbucase.desktop.in.in
data/konbucase.metainfo.xml.in.in
data/resources/ui/main-window.blp
data/resources/ui/text-pane.blp
src/Application.vala
src/Model/TextPaneModel.vala
src/View/MainWindow.vala
34 changes: 34 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class Application : Adw.Application {

private const ActionEntry[] ACTION_ENTRIES = {
{ "quit", on_quit_activate },
{ "about", on_about_activate },
};
private MainWindow window;

Expand Down Expand Up @@ -96,6 +97,39 @@ public class Application : Adw.Application {
}
}

private void on_about_activate () {
// List of maintainers
const string[] DEVELOPERS = {
"Ryo Nakano https://github.com/ryonakano",
};
// List of icon authors
const string[] ARTISTS = {
"Ryo Nakano https://github.com/ryonakano",
"Nararyans R.I. https://github.com/Fatih20",
"Leo https://github.com/lenemter",
};

var about_window = new Adw.AboutWindow.from_appdata (
"%s/%s.metainfo.xml".printf (Config.RESOURCE_PREFIX, Config.APP_ID),
null
) {
transient_for = get_active_window (),
modal = true,
version = Config.APP_VERSION,
copyright = "© 2020-2024 Ryo Nakano",
developers = DEVELOPERS,
artists = ARTISTS,
///TRANSLATORS: A newline-separated list of translators. Don't translate literally.
///You can optionally add your name if you want, plus you may add your email address or website.
///e.g.:
///John Doe
///John Doe <john-doe@example.com>
///John Doe https://example.com
translator_credits = _("translator-credits")
};
about_window.present ();
}

public static int main (string[] args) {
return new Application ().run ();
}
Expand Down
2 changes: 2 additions & 0 deletions src/Config.vala.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ namespace Config {
public const string LOCALEDIR = @LOCALEDIR@;
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string APP_ID = @APP_ID@;
public const string APP_VERSION = @APP_VERSION@;
public const string RESOURCE_PREFIX = @RESOURCE_PREFIX@;
}
2 changes: 2 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ config_data = configuration_data()
config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_data.set_quoted('APP_ID', app_id)
config_data.set_quoted('APP_VERSION', app_version)
config_data.set_quoted('RESOURCE_PREFIX', '/' + meson.project_name().replace('.', '/'))
config_file = configure_file(
input: 'Config.vala.in',
output: '@BASENAME@',
Expand Down