Verified Commit d0b91f9b authored by Maximiliano's avatar Maximiliano 🥑
Browse files

Initial port to rust & GTK 4 commit

At this point the only stuff working is settings, filechoosers, and the welcome page.

- Added a setting to remember window size
- Used meson & skeleton from Souk
- Backported !54
- Backported !82
- Removed Vala code
parent b25cf525
......@@ -7,3 +7,4 @@ build
submodules/libtransmission
.buildconfig
*.po~
target
This diff is collapsed.
This diff is collapsed.
[package]
name = "fragments"
version = "0.0.0"
authors = ["Felix Häcker <haeckerfelix@gnome.org>"]
edition = "2018"
license = "GPL-3.0-or-later"
[dependencies]
async-process = "0.1.3"
async-std = "1.4.0"
futures-util = "0.3.1"
gettext-rs= { version = "0.4", features = ["gettext-system"] }
gtk-macros = "0.2.0"
lazy_static = "1.4.0"
log = "0.4.8"
once_cell = "1.4.1"
pretty_env_logger = "0.4"
regex = "1.3.9"
serde = "1"
serde_json = "1"
serde_derive = "1"
serde_urlencoded = "0.6.1"
strum = "0.19"
strum_macros = "0.19"
thiserror = "1.0.20"
url = "2.1.1"
[dependencies.gdk]
git = "https://github.com/gtk-rs/gtk4-rs/"
package = "gdk4"
[dependencies.gio]
git = "https://github.com/gtk-rs/gtk-rs/"
features = ["v2_64"]
[dependencies.glib]
git = "https://github.com/gtk-rs/gtk-rs/"
features = ["v2_64"]
[dependencies.gtk]
git = "https://github.com/gtk-rs/gtk4-rs"
package = "gtk4"
[dependencies.libhandy]
git = "https://gitlab.gnome.org/bilelmoussaoui/libhandy4-rs"
package = "libhandy4"
#!/bin/sh
export MESON_BUILD_ROOT="$1"
export MESON_SOURCE_ROOT="$2"
export APP_OUTPUT="$3"
export APP_LOCALEDIR="$4"
export APP_PROFILE="$5"
export CARGO_TARGET_DIR="$MESON_BUILD_ROOT"/target
export CARGO_HOME="$CARGO_TARGET_DIR"/cargo-home
echo "** RUST VERSION **"
rustc --version
if test "$APP_PROFILE" != "default"
then
echo "** DEBUG MODE **"
cargo build --manifest-path \
"$MESON_SOURCE_ROOT"/Cargo.toml --message-format=human && \
cp "$CARGO_TARGET_DIR"/debug/fragments $APP_OUTPUT
else
echo "** RELEASE MODE **"
cargo build --manifest-path \
"$MESON_SOURCE_ROOT"/Cargo.toml --message-format=short --release && \
cp "$CARGO_TARGET_DIR"/release/fragments $APP_OUTPUT
fi
{
"app-id" : "de.haeckerfelix.Fragments",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "fragments",
"finish-args" : [
"app-id": "de.haeckerfelix.Fragments.Devel",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"sdk-extensions" : [
"org.freedesktop.Sdk.Extension.rust-stable"
],
"command": "fragments",
"finish-args": [
"--filesystem=xdg-download",
"--device=dri",
"--share=network",
"--share=ipc",
"--socket=x11",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.freedesktop.FileManager1",
"--metadata=X-DConf=migrate-path=/de/haeckerfelix/Fragments/"
"--metadata=X-DConf=migrate-path=/de/haeckerfelix/Fragments/",
"--talk-name=org.a11y.Bus",
"--env=G_MESSAGES_DEBUG=none"
],
"cleanup" : [
"build-options": {
"append-path" : "/usr/lib/sdk/rust-stable/bin",
"build-args" : [
"--share=network"
],
"env" : {
"RUSTFLAGS" : "--remap-path-prefix =../",
"CARGO_HOME" : "/run/build/fragments/cargo",
"RUST_BACKTRACE" : "1",
"MOUNT_FUSE_PATH" : "../tmp/"
}
},
"cleanup": [
"/include",
"/lib/pkgconfig",
"/man",
......@@ -22,106 +39,57 @@
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"/share/vala",
"*.la",
"*.a"
],
"modules" : [
"modules": [
{
"name": "libtransmission",
"buildsystem": "cmake-ninja",
"config-opts":[
"-DINSTALL_LIB=ON",
"-DENABLE_DAEMON=OFF",
"-DENABLE_UTILS=OFF",
"-DENABLE_TESTS=OFF",
"-DENABLE_GTK=OFF",
"-DENABLE_QT=OFF",
"-DINSTALL_DOC=OFF"
],
"sources": [{
"type": "git",
"url": "https://github.com/transmission/transmission.git",
"commit": "3d9fd25269ccfc1dacf9c5cd23a3d232e0085150"
}],
"modules": [
{
"name": "libnatpmp",
"buildsystem": "cmake-ninja",
"sources": [{
"type": "git",
"url": "https://github.com/transmission/libnatpmp",
"commit": "4d3b9d87bbe7549830c212ce840600619abcf887"
}]
},
{
"name": "libevent",
"sources": [{
"type": "archive",
"url": "https://github.com/transmission/libevent/archive/release-2.1.8-stable.tar.gz",
"sha256": "316ddb401745ac5d222d7c529ef1eada12f58f6376a66c1118eee803cb70f83d"
}]
},
"name": "intltool",
"cleanup": [ "*" ],
"sources": [
{
"name": "libb64",
"buildsystem": "cmake-ninja",
"sources": [{
"type": "git",
"url": "https://github.com/transmission/libb64",
"commit": "8456a5b5c99ef4544a2ed8e8f20a2fb673dd4192"
}]
},
{
"name": "dht",
"buildsystem": "cmake-ninja",
"sources": [{
"type": "git",
"url": "https://github.com/transmission/dht",
"commit": "25e12bb39eea3d433602de6390796fec8a8f3620"
}]
},
{
"name": "miniupnpc",
"buildsystem": "cmake-ninja",
"sources": [{
"type": "git",
"url": "https://github.com/transmission/miniupnpc",
"commit": "e37cde82e8673a5e71bae43086828704fd5eeac1"
}]
},
{
"name": "libutp",
"buildsystem": "cmake-ninja",
"sources": [{
"type": "git",
"url": "https://github.com/transmission/libutp",
"commit": "fda9f4b3db97ccb243fcbed2ce280eb4135d705b"
}]
"type": "archive",
"url": "https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz",
"sha256": "67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd"
}
]
},
{
"name" : "libhandy",
"buildsystem" : "meson",
"config-opts": [
"-Dglade_catalog=disabled",
"-Dintrospection=enabled",
"-Dexamples=false",
"-Dtests=false"
"config-opts" : [
"-Dintrospection=enabled",
"-Dtests=false",
"-Dexamples=false",
"-Dvapi=false",
"-Dglade_catalog=disabled"
],
"cleanup" : [
"/include",
"/lib/pkgconfig"
],
"sources" : [{
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/libhandy",
"tag": "1.0.3"
}]
"url" : "https://gitlab.gnome.org/exalm/libhandy",
"branch" : "gtk4"
}
]
},
{
"name" : "fragments",
"buildsystem" : "meson",
"sources" : [{
"type" : "git",
"name": "fragments",
"builddir": true,
"buildsystem": "meson",
"config-opts" : [
"-Dprofile=development"
],
"sources": [
{
"type": "git",
"url" : "https://gitlab.gnome.org/World/Fragments.git"
}]
}
]
}
]
}
#!/bin/sh
export SOURCE_ROOT="$1"
export DIST="$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
prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = path.join(prefix, 'share')
destdir = environ.get('DESTDIR', '')
# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
print('Updating desktop database...')
call(['update-desktop-database', '-q', path.join(datadir, 'applications')])
print('Compiling GSettings schemas...')
call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])
echo "## Checking style ##"
cargo fmt --all -- --check
if test $? != 0; then
echo "## Checking style fail ##"
echo "Please fix the above issues, either manually or by running: cargo fmt --all"
exit -1
else
echo "## Checking style pass ##"
fi
[Desktop Entry]
Name=Fractal
Comment=Fractal is a decentralized, secure messaging client for collaborative group communication.
GenericName=Fractal group messaging
Exec=fractal
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=@icon@
Type=Application
StartupNotify=true
X-GNOME-UsesNotifications=true
Categories=GNOME;GTK;Network;InstantMessaging;
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Matrix;matrix.org;chat;irc;communications;talk;riot;element;
# Translators: Do NOT translate or transliterate this text (these are enum types)!
X-Purism-FormFactor=Workstation;Mobile;
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/de/haeckerfelix/Fragments/">
<file>ui/window.ui</file>
<file>ui/settings-window.ui</file>
<file>ui/torrent-row.ui</file>
<file>ui/torrent-group.ui</file>
<file>interface/adwaita.css</file>
<file>icons/welcome.svg</file>
<gresource prefix="/de/haeckerfelix/Fragments">
<file>gtk/app_menu.ui</file>
<file>gtk/preferences_window.ui</file>
<file>gtk/window.ui</file>
<file>gtk/style.css</file>
</gresource>
</gresources>
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="fragments">
<schema id="de.haeckerfelix.Fragments" path="/de/haeckerfelix/Fragments/">
<key name="enable-dark-theme" type="b">
<key name="dark-mode" type="b">
<default>false</default>
</key>
<key name="download-folder" type="s">
<default>""</default>
</key>
<key name="incomplete-folder" type="s">
<default>""</default>
</key>
<key name="max-downloads" type="i">
<default>3</default>
</key>
<key name="enable-notifications-downloaded" type="b">
<default>true</default>
</key>
<key name="enable-notifications-new-torrent" type="b">
<default>true</default>
</key>
<key name="encryption-mode" type="i">
<default>1</default>
</key>
<key name="incomplete-folder" type="s">
<default>""</default>
</key>
<key name="max-downloads" type="i">
<default>3</default>
</key>
<key name="window-width" type="i">
<default>450</default>
</key>
<key name="window-height" type="i">
<default>700</default>
</key>
</schema>
</schemalist>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2020 Felix Häcker -->
<component type="desktop-application">
<id>de.haeckerfelix.Fragments</id>
<name>Fragments</name>
<summary>A BitTorrent Client</summary>
<translation type="gettext">fragments</translation>
<developer_name>Felix Häcker</developer_name>
<update_contact>haeckerfelix@gnome.org</update_contact>
<metadata_license>CC0</metadata_license>
<project_license>GPL-3.0+</project_license>
<description>
<p>
Fragments is an easy to use BitTorrent client for the GNOME desktop
environment. It is usable for receiving files using the BitTorrent
protocol, which enables you to transmit huge files, like videos or
installation images for Linux distributions.
</p>
</description>
<screenshots>
<screenshot type="default">
<image width="745" height="480">https://raw.githubusercontent.com/haecker-felix/Fragments/master/data/screenshots/1.png</image>
</screenshot>
<screenshot>
<image width="745" height="480">https://raw.githubusercontent.com/haecker-felix/Fragments/master/data/screenshots/2.png</image>
</screenshot>
<screenshot>
<image width="745" height="480">https://raw.githubusercontent.com/haecker-felix/Fragments/master/data/screenshots/3.png</image>
</screenshot>
</screenshots>
<launchable type="desktop-id">de.haeckerfelix.Fragments.desktop</launchable>
<url type="homepage">https://gitlab.gnome.org/World/Fragments</url>
<url type="bugtracker">https://gitlab.gnome.org/World/Fragments/issues</url>
<url type="donation">https://de.liberapay.com/haecker-felix</url>
<url type="translate">https://l10n.gnome.org/module/Fragments/</url>
<content_rating type="oars-1.0" />
<kudos>
<kudo>HiDpiIcon</kudo>
<kudo>ModernToolkit</kudo>
<kudo>Notifications</kudo>
</kudos>
<custom>
<value key="Purism::form_factor">workstation</value>
<value key="Purism::form_factor">mobile</value>
</custom>
<releases>
<release version="1.5" date="2020-09-13">
<description>
<p>
New features / changes:
</p>
<ul>
<li>Show notifications when a new torrent is added, or when a download is complete</li>
<li>The encryption mode can now be configured (Forced, Optional, Disabled)</li>
<li>New menu entry to remove all downloaded torrents</li>
<li>Refreshed user interface / Updated application icon</li>
<li>Updated translations</li>
</ul>
</description>
</release>
<release version="1.4" date="2019-03-24">
<description>
<p>
New features / changes:
</p>
<ul>
<li>New application icon + theme</li>
<li>New 'Open' button to open downloaded torrents faster</li>
<li>Updated translations</li>
<li>Several bug fixes</li>
</ul>
</description>
</release>
<release version="1.3" date="2018-12-31">
<description>
<p>
New features / changes:
</p>
<ul>
<li>New adaptive settings dialog</li>
<li>Small interface improvements</li>
<li>Update libtransmission backend to 3.00</li>
<li>Updated translations</li>
</ul>
</description>
</release>
<release version="1.2" date="2018-09-16">
<description>
<p>
New features / changes:
</p>
<ul>
<li>Adaptive interface (Ready for Librem5!)</li>
<li>Move AppMenu to headerbar</li>
<li>Added translations: cs, de, fr, nb_NO, nl, tr</li>
</ul>
</description>
</release>
<release version="1.1" date="2018-04-22">
<description>
<p>
This version contains minor technical changes.
</p>
<ul>
<li>Fix blurry welcome image</li>
<li>Updated transmission submodule</li>
</ul>
</description>
</release>
<release version="1.0" date="2018-04-06">
<description>
<p>
This is the first stable release of Fragments.
</p>
<ul>
<li>Support for torrent files</li>
<li>Support for magnet links</li>
<li>Automatically detects magnet links in your clipboard</li>
<li>Simple queue management. Torrents can be reordered using drag and drop.</li>
<li>Clean and structured user interface</li>
</ul>
</description>
</release>
</releases>
</component>
[D-BUS Service]
Name=@appid@
Exec=@bindir@/fragments --gapplication-service
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="app_menu_model">
<section>
<item>
<attribute name="label" translatable="yes">_Remove Completed Torrents</attribute>
<attribute name="action">win.remove-torrents</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">win.show-preferences</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-keyboard-shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Fragments</attribute>
<attribute name="action">win.show-about</attribute>
</item>
</section>
</menu>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="libhandy" version="0.0"/>
<requires lib="gtk+" version="3.0"/>
<template class="FragmentsSettingsWindow" parent="HdyPreferencesWindow">
<object class="HdyPreferencesWindow" id="preferences_window">
<property name="default_height">400</property>
<property name="default_width">600</property>
<property name="width_request">300</property>
......@@ -11,21 +9,17 @@
<object class="HdyPreferencesPage">
<property name="icon_name">emblem-system-symbolic</property>
<property name="title" translatable="yes">General</property>
<property name="visible">True</property>
<child>
<object class="HdyPreferencesGroup">
<property name="title" translatable="yes">Appearance</property>
<property name="visible">True</property>
<child>
<object class="HdyActionRow">
<property name="title" translatable="yes">Dark Mode</property>
<property name="subtitle" translatable="yes">Whether Fragments should use a dark theme</property>
<property name="title" translatable="yes">_Dark Theme</property>
<property name="use_underline">True</property>
<property name="subtitle" translatable="yes">Whether Fragments should use a dark theme.</property>
<property name="activatable_widget">dark_theme_switch</property>
<property name="visible">True</property>
<child>
<object class="GtkSwitch" id="dark_theme_switch">
<property name="can_focus">True</property>
<property name="visible">True</property>
<property name="valign">center</property>
</object>
</child>
......@@ -35,48 +29,29 @@
</child>
<child>
<object class="HdyPreferencesGroup">
<property name="title">Behaviour</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Behaviour</property>
<child>
<object class="HdyActionRow" id="download_row">
<property name="title" translatable="yes">Download directory</property>
<property name="subtitle" translatable="yes">Where to store downloaded torrents</property>
<property name="title" translatable="yes">D_ownload Directory</property>
<property name="subtitle" translatable="yes">_Where to store downloaded torrents.</property>
<property name="use_underline">True</property>
<property name="activatable_widget">download_folder_button</property>
<property name="visible">True</