Commit f4519d57 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

Init using GTK+Rust template

parent fe0001fa
Pipeline #96601 failed with stages
in 2 minutes and 27 seconds
root = true
[*]
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
[*.build]
indent_size = 2
[*.{json,py}]
indent_size = 4
target/
build/
_build/
build-aux/app
build-aux/.flatpak-builder/
src/config.rs
src/static_resources.rs
*.ui.in~
*.ui~
stages:
- lint
- test
- review
variables:
BUNDLE: "icons-finder-nightly.flatpak"
flatpak:
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
stage: "test"
variables:
MANIFEST_PATH: "build-aux/com.bilelmoussaoui.IconsFinderDevel.json"
FLATPAK_MODULE: "icons-finder"
MESON_ARGS: "-Dprofile=development"
APP_ID: "com.bilelmoussaoui.IconsFinderDevel"
script:
- flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
# Build the flatpak repo
- flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app ${MESON_ARGS} _build
- flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
# Create a flatpak bundle
- flatpak-builder --finish-only app ${MANIFEST_PATH}
- flatpak build-export repo app
- flatpak build-bundle repo ${BUNDLE} ${APP_ID}
artifacts:
paths:
- $BUNDLE
expire_in: 5 days
cache:
key: "flatpak"
paths:
- .flatpak-builder/downloads/
- .flatpak-builder/git/
- target/
- target_test/
review:
stage: review
dependencies:
- flatpak
script:
- echo "Generating flatpak deployment"
artifacts:
paths:
- $BUNDLE
expire_in: 30 days
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE}
on_stop: stop_review
stop_review:
stage: review
script:
- echo "Stopping flatpak deployment"
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
# Configure and run rustfmt
# Exits and builds fails if on bad format
rustfmt:
image: "rust:slim"
stage: "lint"
script:
- rustup component add rustfmt
# Create blank versions of our configured files
# so rustfmt does not yell about non-existent files or completely empty files
- echo -e "" >> src/config.rs
- echo -e "" >> src/static_resources.rs
- rustc -Vv && cargo -Vv
- cargo fmt --version
- cargo fmt --all -- --color=always --check
This diff is collapsed.
[package]
name = "icons-finder"
version = "0.1.0"
authors = ["Bilal Elmoussaoui <bil.elmoussaoui@gmail.com>"]
edition = "2018"
[dependencies]
gtk = { version = "0.6.0", features = ["v3_22"] }
glib = "0.7"
gio = { version = "0.6.0", features = ["v2_46"] }
gdk = "0.10.0"
log = "0.4"
gettext-rs= { version = "0.4.1", features = ["gettext-system"] }
This diff is collapsed.
# Icons Finder
Easily find the available icons on Adwaita.
\ No newline at end of file
#!/bin/sh
export MESON_BUILD_ROOT="$1"
export MESON_SOURCE_ROOT="$2"
export CARGO_TARGET_DIR="$MESON_BUILD_ROOT"/target
export CARGO_HOME="$CARGO_TARGET_DIR"/cargo-home
export SHORTWAVE_LOCALEDIR="$4"
if [[ $5 = "Devel" ]]
then
echo "DEBUG MODE"
cargo build --manifest-path \
"$MESON_SOURCE_ROOT"/Cargo.toml --verbose && \
cp "$CARGO_TARGET_DIR"/debug/icons-finder $3
else
echo "RELEASE MODE"
cargo build --manifest-path \
"$MESON_SOURCE_ROOT"/Cargo.toml --release && \
cp "$CARGO_TARGET_DIR"/release/icons-finder $3
fi
{
"app-id": "com.bilelmoussaoui.IconsFinder",
"runtime" : "org.gnome.Platform",
"runtime-version" : "3.32",
"sdk" : "org.gnome.Sdk",
"sdk-extensions" : [
"org.freedesktop.Sdk.Extension.rust-stable"
],
"command" : "icons-finder",
"finish-args" : [
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--filesystem=xdg-music",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--device=dri"
],
"build-options" : {
"append-path" : "/usr/lib/sdk/rust-stable/bin",
"build-args" : [
"--share=network"
],
"env" : {
"RUSTFLAGS" : "--remap-path-prefix =../ --error-format=short",
"CARGO_HOME" : "/run/build/icons-finder/cargo",
"RUST_BACKTRACE" : "1",
"RUST_LOG" : "icons-finder=debug"
}
},
"modules" : [
{
"name" : "icons-finder",
"buildsystem" : "meson",
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/bilelmoussaoui/icons-finder.git"
}
]
}
]
}
{
"app-id": "com.bilelmoussaoui.IconsFinderDevel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"sdk-extensions" : [
"org.freedesktop.Sdk.Extension.rust-stable"
],
"command" : "icons-finder",
"tags" : [
"nightly"
],
"desktop-file-name-suffix" : " (Devel)",
"finish-args" : [
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--filesystem=xdg-music",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--device=dri"
],
"build-options" : {
"append-path" : "/usr/lib/sdk/rust-stable/bin",
"build-args" : [
"--share=network"
],
"env" : {
"RUSTFLAGS" : "--remap-path-prefix =../ --error-format=human",
"CARGO_HOME" : "/run/build/icons-finder/cargo",
"RUST_BACKTRACE" : "1",
"RUST_LOG" : "icons-finder=debug"
}
},
"modules" : [
{
"name" : "gtk-rust-template",
"buildsystem" : "meson",
"config-opts" : [
"-Dprofile=development"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/bilelmoussaoui/gtk-rust-template.git"
}
]
}
]
}
#!/bin/sh
export DIST="$1"
export SOURCE_ROOT="$2"
cd "$SOURCE_ROOT"
mkdir "$DIST"/.cargo
cargo vendor | sed 's/^directory = ".*"/directory = "vendor"/g' > $DIST/.cargo/config
# Move vendor into dist tarball directory
mv vendor "$DIST"
#!/usr/bin/env python3
from os import environ, path
from subprocess import call
if not environ.get('DESTDIR', ''):
PREFIX = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
DATA_DIR = path.join(PREFIX, 'share')
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')])
print("Compiling new schemas...")
call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0/schemas')])
print("Updating desktop database...")
call(["update-desktop-database", path.join(DATA_DIR, 'applications')])
<?xml version="1.0" encoding="UTF-8"?>
<!-- Bilal Elmoussaoui 2019 <bilal.elmoussaoui@gnome.org> -->
<component type="desktop-application">
<id>@app-id@</id>
<metadata_license>CC0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>GTK Rust Template</name>
<summary>A GTK + Rust application template.</summary>
<description>
<p>A boilerplate template for GTK + Rust. It uses Meson as a build system and has flatpak support by default.</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://gitlab.gnome.org/bilelmoussaoui/icons-finder/raw/master/data/resources/screenshots/screenshot1.png</image>
<caption>Main Window</caption>
</screenshot>
</screenshots>
<url type="homepage">https://gitlab.gnome.org/bilelmoussaoui/icons-finder</url>
<url type="bugtracker">https://gitlab.gnome.org/bilelmoussaoui/icons-finder/issues</url>
<url type="donation">https://liberapay.com/bielmoussaoui</url>
<content_rating type="oars-1.0" />
<releases>
<release version="0.0.1" date="2019-07-11" />
</releases>
<kudos>
<!--
GNOME Software kudos:
https://gitlab.gnome.org/GNOME/gnome-software/blob/master/doc/kudos.md
-->
<kudo>ModernToolkit</kudo>
<kudo>HiDpiIcon</kudo>
</kudos>
<developer_name>Bilal Elmoussaoui</developer_name>
<update_contact>bilal.elmoussaoui@gnome.org</update_contact>
<translation type="gettext">@gettext-package@</translation>
<launchable type="desktop-id">@app-id@.desktop</launchable>
</component>
[Desktop Entry]
Name=GTK Rust Template
GenericName=GTK Rust Template
Comment=A GTK + Rust application boilerplate template
Type=Application
Exec=icons-finder
Terminal=false
Categories=GNOME;GTK;
Keywords=Gnome;GTK;
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=@icon@
StartupNotify=true
<?xml version="1.0" encoding="utf-8"?>
<schemalist>
<schema path="/com/bilelmoussaoui/IconsFinder/" id="@app-id@" gettext-domain="@gettext-package@">
<key name="window-width" type="i">
<default>-1</default>
<summary>Default window width</summary>
<description>Default window width</description>
</key>
<key name="window-height" type="i">
<default>-1</default>
<summary>Default window height</summary>
<description>Default window height</description>
</key>
<key name="window-x" type="i">
<default>-1</default>
<summary>Default window x position</summary>
<description>Default window x position</description>
</key>
<key name="window-y" type="i">
<default>-1</default>
<summary>Default window y position</summary>
<description>Default window y position</description>
</key>
<key name="is-maximized" type="b">
<default>false</default>
<summary>Default window maximized behaviour</summary>
<description></description>
</key>
</schema>
</schemalist>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="23.283333mm"
height="29.633333mm"
viewBox="0 0 23.283333 29.633333"
version="1.1"
id="svg644"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="com.bilelmoussaoui.GtkRustTemplate.svg">
<defs
id="defs638">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1154"
id="linearGradient1140"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.19642829,0,0,0.34210528,-365.40268,445.74005)"
x1="88.595886"
y1="-449.39401"
x2="536.59589"
y2="-449.39401" />
<linearGradient
id="linearGradient1154"
inkscape:collect="always">
<stop
id="stop1142"
offset="0"
style="stop-color:#77767b;stop-opacity:1" />
<stop
style="stop-color:#c0bfbc;stop-opacity:1"
offset="0.05000014"
id="stop1144" />
<stop
id="stop1146"
offset="0.09980702"
style="stop-color:#9a9996;stop-opacity:1" />
<stop
style="stop-color:#9a9996;stop-opacity:1"
offset="0.90000081"
id="stop1148" />
<stop
id="stop1150"
offset="0.95000082"
style="stop-color:#c0bfbc;stop-opacity:1" />
<stop
id="stop1152"
offset="1"
style="stop-color:#77767b;stop-opacity:1" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="-158.85716"
inkscape:cy="81.714285"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata641">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-147.86429,-140.82024)">
<g
style="display:inline;enable-background:new"
id="g1138"
transform="matrix(0.26458333,0,0,0.26458333,239.93928,93.195239)">
<rect
ry="8"
rx="7.999999"
y="188"
x="-347.99994"
height="104"
width="87.999878"
id="rect1134"
style="display:inline;opacity:1;vector-effect:none;fill:url(#linearGradient1140);fill-opacity:1;stroke:none;stroke-width:0.24999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new" />
<rect
style="display:inline;opacity:1;vector-effect:none;fill:#deddda;fill-opacity:1;stroke:none;stroke-width:0.24999996;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new"
id="rect1136"
width="88"
height="107.99999"
x="-347.99997"
y="180"
rx="7.9999967"
ry="8" />
</g>
</g>
</svg>
install_data(
'com.bilelmoussaoui.IconsFinder.svg',
install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps',
rename: '@0@.svg'.format(application_id)
)
install_data(
'com.bilelmoussaoui.IconsFinder-symbolic.svg',
install_dir: iconsdir / 'hicolor' / 'symbolic' / 'apps',
rename: '@0@-symbolic.svg'.format(application_id)
)
subdir('icons')
# Desktop file
desktop_conf = configuration_data()
desktop_conf.set('icon', application_id)
desktop_file = i18n.merge_file (
type: 'desktop',
input: configure_file(
input: 'com.bilelmoussaoui.IconsFinder.desktop.in.in',
output: '@BASENAME@',
configuration: desktop_conf
),
output: '@0@.desktop'.format(application_id),
po_dir: podir,
install: true,
install_dir: datadir / 'applications'
)
# Validate Desktop file
desktop_file_validate = find_program('desktop-file-validate', required: false)
if desktop_file_validate.found()
test(
'validate-desktop',
desktop_file_validate,
args: [
desktop_file.full_path()
]
)
endif
# Appdata
appdata_conf = configuration_data()
appdata_conf.set('app-id', application_id)
appdata_conf.set('gettext-package', gettext_package)
appdata_file = i18n.merge_file (
input: configure_file(
input: 'com.bilelmoussaoui.IconsFinder.appdata.xml.in.in',
output: '@BASENAME@',
configuration: appdata_conf
),
output: '@0@.appdata.xml'.format(application_id),
po_dir: podir,
install: true,
install_dir: datadir / 'metainfo'
)
# Validate Appdata
appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test(
'validate-appdata', appstream_util,
args: [
'validate-relax', '--nonet', appdata_file.full_path()
]
)
endif
# GSchema
gschema_conf = configuration_data()
gschema_conf.set('app-id', application_id)
gschema_conf.set('gettext-package', gettext_package)
configure_file(
input: 'com.bilelmoussaoui.IconsFinder.gschema.xml.in',
output: '@0@.gschema.xml'.format(application_id),
configuration: gschema_conf,
install: true,
install_dir: datadir / 'glib-2.0' / 'schemas'
)
# Resources
ui_config = configuration_data()
ui_config.set('app-id', application_id)
ui_config.set('version', meson.project_version() + version_suffix)
ui_preconfigured_files = files(
'resources/ui/about_dialog.ui.in',
'resources/ui/window.ui.in',
)
ui_dependencies = []
foreach ui_file: ui_preconfigured_files
ui_dependencies += configure_file(
input: ui_file,
output: '@BASENAME@',
configuration: ui_config
)
endforeach
resources = gnome.compile_resources(
'resources',
'resources.gresource.xml',
gresource_bundle: true,
source_dir: meson.current_build_dir(),
dependencies: ui_dependencies
)
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/bilelmoussaoui/GtkRustTemplate/">
<file compressed="true" preprocess="xml-stripblanks">about_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="shortcuts.ui">resources/ui/shortcuts.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="menu.ui">resources/ui/menu.ui</file>
<file compressed="true" preprocess="xml-stripblanks">window.ui</file>
<file compressed="true" alias="style.css">resources/style.css</file>
</gresource>
</gresources>
.title-header{
font-size: 36px;
font-weight: bold;
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkAboutDialog" id="about_dialog">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<property name="program_name">GTK Rust Template</property>
<property name="version">@version@</property>
<property name="website">https://gitlab.gnome.org/bilelmoussaoui/gtk-rust-template/</property>
<property name="authors">Bilal Elmoussaoui</property>
<property name="translator_credits" translatable="yes">translator-credits</property>
<property name="logo_icon_name">@app-id@</property>
<property name="license_type">mit-x11</property>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkPopoverMenu" id="popover_menu">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="action_name">app.preferences</property>
<property name="text" translatable="yes">Preferences</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="action_name">win.show-help-overlay</property>
<property name="text" translatable="yes">Keyboard Shortcuts</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="action_name">app.about</property>
<property name="text" translatable="yes">About GTK Rust Template</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="submenu">main</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>