Skip to content

Commit

Permalink
🔖 Merge dev into main (v0.2.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vysp3r authored Dec 4, 2022
2 parents 02a1254 + 89ee6c4 commit c318e41
Show file tree
Hide file tree
Showing 28 changed files with 377 additions and 329 deletions.
19 changes: 18 additions & 1 deletion data/com.vysp3r.ProtonPlus.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,24 @@
</screenshots>

<releases>
<release version="0.2.1" date="2022-12-01">
<release version="0.2.2" date="2022-12-03">
<description>
<p>What's Changed:</p>
<ul>
<li>🧑‍💻 Project refactor</li>
<li>🐛 Fix ListBox missing scrollbar</li>
<li>✨ Add launcher cleanup utility</li>
<li>🐛 Fix possible crash scenario</li>
<li>➖ Remove Posix dependency</li>
<li>🐛 Fix button always being active</li>
<li>🧑‍💻 Add new message dialog widget</li>
<li>🐛 Fix useless log showing up</li>
<li>🔨 Update appdata</li>
<li>💬 Update the release notes</li>
</ul>
</description>
</release>
<release version="0.2.1" date="2022-12-01">
<description>
<p>What's Changed:</p>
<ul>
Expand Down
File renamed without changes.
24 changes: 14 additions & 10 deletions src/application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ namespace ProtonPlus {
base.activate ();

preferences = new Stores.Preferences ();
if (Manager.Preferences.Load (ref preferences)) {
Manager.Preferences.Apply (ref preferences);
Manager.Themes.Load ();
if (Manager.Preference.Load (ref preferences)) {
Manager.Preference.Apply (ref preferences);
Manager.Theme.Load ();

new Windows.Home (this);
} else {
Expand All @@ -46,16 +46,20 @@ namespace ProtonPlus {

aboutDialog.set_application_name ("ProtonPlus");
aboutDialog.set_application_icon ("com.vysp3r.ProtonPlus");
aboutDialog.set_version ("v0.2.1");
aboutDialog.set_version ("v0.2.2");
aboutDialog.set_comments ("A simple Wine and Proton-based compatiblity tools manager for GNOME");
aboutDialog.add_link ("Github", "https://github.com/Vysp3r/ProtonPlus");
aboutDialog.set_release_notes ("<ul>
<li>🔨 Update appdata</li>
<li>🐛 Fix tool renaming for nothing</li>
<li>🐛 Fix selector window freezing</li>
<li>🐛 Fix Gtk-Critical errors</li>
<li>🐛 Fix buttons being active by default in selector</li>
<li>💬 Update the release notes</li>
<li>🧑‍💻 Project refactor</li>
<li>🐛 Fix ListBox missing scrollbar</li>
<li>✨ Add launcher cleanup utility</li>
<li>🐛 Fix possible crash scenario</li>
<li>➖ Remove Posix dependency</li>
<li>🐛 Fix button always being active</li>
<li>🧑‍💻 Add new message dialog widget</li>
<li>🐛 Fix useless log showing up</li>
<li>🔨 Update appdata</li>
<li>💬 Update the release notes</li>
</ul>");
aboutDialog.set_issue_url ("https://github.com/Vysp3r/ProtonPlus/issues/new/choose");
aboutDialog.set_copyright ("© 2022 Vysp3r");
Expand Down
5 changes: 5 additions & 0 deletions src/interfaces/IModel.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace ProtonPlus.Interfaces {
public interface IModel : Object {
public abstract string Title { get; set; }
}
}
5 changes: 5 additions & 0 deletions src/interfaces/IView.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace ProtonPlus.Interfaces {
public interface IView {
public abstract Gtk.Box GetBox ();
}
}
49 changes: 36 additions & 13 deletions src/manager/file.vala → src/manager/File.vala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace ProtonPlus.Manager {
public class File {
public static string Extract (string install_location, string tool_name) { // RENAME launcher_name and tool_name correctly see line 117 in selector
public static string Extract (string install_location, string tool_name) {
const int bufferSize = 192000;

Archive.Read archive = new Archive.Read ();
var archive = new Archive.Read ();
archive.support_format_all ();
archive.support_filter_all ();

Expand All @@ -13,7 +13,7 @@ namespace ProtonPlus.Manager {
flags |= Archive.ExtractFlags.TIME;
flags |= Archive.ExtractFlags.FFLAGS;

Archive.WriteDisk ext = new Archive.WriteDisk ();
var ext = new Archive.WriteDisk ();
ext.set_standard_lookup ();
ext.set_options (flags);

Expand Down Expand Up @@ -71,32 +71,55 @@ namespace ProtonPlus.Manager {
}
}

public static void Delete (string sourcePath) {
public static void Delete (string path) {
try {
GLib.File file = GLib.File.new_for_path (sourcePath);
file.delete ();
var file = GLib.File.new_for_path (path);
file.trash ();
} catch (GLib.Error e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
}
}

public static void Rename (string sourcePath, string destinationPath) {
try {
GLib.File fileSource = GLib.File.new_for_path (sourcePath);
GLib.File fileDest = GLib.File.new_for_path (destinationPath);
var fileSource = GLib.File.new_for_path (sourcePath);
var fileDest = GLib.File.new_for_path (destinationPath);
fileSource.move (fileDest, FileCopyFlags.NONE, null, null);
} catch (GLib.Error e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
}
}

public static void Write (string sourcePath, string content) {
public static void Write (string path, string content) {
try {
GLib.File file = GLib.File.new_for_path (GLib.Environment.get_user_config_dir () + "/preferences.json");
var file = GLib.File.new_for_path (path);
FileOutputStream os = file.create (FileCreateFlags.PRIVATE);
os.write (content.data);
} catch (GLib.Error e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
}
}

public static void CreateDirectory (string path) {
try {
var file = GLib.File.new_for_path (path);
file.make_directory ();
} catch (GLib.Error e) {
stderr.printf (e.message + "\n");
}
}

public static bool VerifyDirectoryExist (string path) {
try {
var file = GLib.File.new_for_path (path);
if (file.query_exists ()) {
var info = file.query_info ("standard::*", FileQueryInfoFlags.NONE);
if (info.get_file_type () == FileType.DIRECTORY) return true;
}
return false;
} catch (GLib.Error e) {
stderr.printf (e.message + "\n");
return false;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/manager/preferences.vala → src/manager/Preference.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace ProtonPlus.Manager {
public class Preferences {
public class Preference {
public static bool Load (ref Stores.Preferences preferences) {
try {
GLib.File file = GLib.File.new_for_path (GLib.Environment.get_user_config_dir () + "/preferences.json");
Expand All @@ -15,11 +15,11 @@ namespace ProtonPlus.Manager {

return true;
} catch (GLib.IOError.NOT_FOUND e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
Create (ref preferences, true);
return Load (ref preferences);
} catch (GLib.Error e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
return false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/manager/themes.vala → src/manager/Theme.vala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace ProtonPlus.Manager {
public class Themes {
public class Theme {
public static void Load() {
var provider = new Gtk.CssProvider();
provider.load_from_resource("/com/vysp3r/ProtonPlus/app.css");
provider.load_from_resource("/com/vysp3r/ProtonPlus/application.css");
Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
Expand Down
4 changes: 2 additions & 2 deletions src/manager/http.vala → src/manager/Web.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace ProtonPlus.Manager {
Bytes bytes = session.send_and_read (message);
return (string) bytes.get_data ();
} catch (GLib.Error e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
return "";
}
}
Expand All @@ -23,7 +23,7 @@ namespace ProtonPlus.Manager {
});
return 0;
} catch (GLib.Error e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
return 1;
}
}
Expand Down
49 changes: 25 additions & 24 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
protonplus_sources = [
'main.vala',
'application.vala',
'interfaces/IModel.vala',
'interfaces/IView.vala',

'stores/preferences.vala',
'stores/threads.vala',
'manager/Preference.vala',
'manager/Theme.vala',
'manager/Web.vala',
'manager/File.vala',

'manager/preferences.vala',
'manager/themes.vala',
'manager/http.vala',
'manager/file.vala',
'models/preferences/Style.vala',
'models/Tool.vala',
'models/Launcher.vala',
'models/Release.vala',

'models/preferences/style.vala',
'models/tool.vala',
'models/launcher.vala',
'models/release.vala',
'stores/Preferences.vala',
'stores/Threads.vala',

'views/games.vala',
'views/tools.vala',
'views/notifications.vala',
'views/Games.vala',
'views/Tools.vala',
'views/Notifications.vala',

'windows/home.vala',
'windows/home_info.vala',
'windows/preferences.vala',
'windows/selector.vala',
]
'widgets/ProtonComboRow.vala',
'widgets/ProtonMessageDialog.vala',

#vapi_dir = meson.current_source_dir() / 'vapi'
'windows/Home.vala',
'windows/HomeInfo.vala',
'windows/Preferences.vala',
'windows/Selector.vala',

#add_project_arguments(['--vapidir', vapi_dir], language: 'vala')
'main.vala',
'application.vala',
]

protonplus_deps = [
dependency('libadwaita-1', version: '>= 1.2'),
dependency('json-glib-1.0'),
dependency('libsoup-3.0'),
dependency('libarchive'),
meson.get_compiler('vala').find_library('posix')
dependency('libarchive')
]

gnome = import('gnome')
Expand Down
10 changes: 5 additions & 5 deletions src/models/launcher.vala → src/models/Launcher.vala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace ProtonPlus.Models {
public class Launcher : Object {
public class Launcher : Object, Interfaces.IModel {
string homeDirectory;
string directory;

public string Title;
public string Title { get; set; }
public string Directory {
public owned get { return homeDirectory + directory; }
private set { directory = value; }
Expand Down Expand Up @@ -32,16 +32,16 @@ namespace ProtonPlus.Models {

// Check if any of the given directories exists
foreach (var item in directories) {
if (Posix.opendir (homeDirectory + item) != null) {
if (Manager.File.VerifyDirectoryExist (homeDirectory + item)) {
dir = item + toolDirectory;
break;
}
}

// If a directory exist, it makes sure that the tool directory is created
if (dir.length > 0) {
if (Posix.opendir (homeDirectory + dir) == null) {
Posix.mkdir (homeDirectory + dir, 0777);
if (!Manager.File.VerifyDirectoryExist (homeDirectory + dir)) {
Manager.File.CreateDirectory (homeDirectory + dir);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/models/release.vala → src/models/Release.vala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ProtonPlus.Models {
public class Release : Object {
public string Title;
public class Release : Object, Interfaces.IModel {
public string Title { get; set; }
public string Tag;
public string Download_URL;
public string Page_URL;
Expand Down Expand Up @@ -106,7 +106,7 @@ namespace ProtonPlus.Models {
// Return the Version array
return releases;
} catch (GLib.Error e) {
stderr.printf (e.message);
stderr.printf (e.message + "\n");
return new GLib.List<Release> ();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/models/tool.vala → src/models/Tool.vala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace ProtonPlus.Models {
public class Tool : Object {
public class Tool : Object, Interfaces.IModel {

public string Title;
public string Title { get; set; }
public string Description;
public string Endpoint;
public int AssetPosition; // The position of the .tar.xz file in the json tree of the tool > assets
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ProtonPlus.Models.Preferences {
public class Style : Object {
public string Title;
public class Style : Object, Interfaces.IModel {
public string Title { get; set; }
public Adw.ColorScheme ColorScheme;
public int Position;

Expand Down
2 changes: 1 addition & 1 deletion src/protonplus.gresource.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/vysp3r/ProtonPlus">
<file>app.css</file>
<file>application.css</file>
<file>ProtonPlus.png</file>
</gresource>
</gresources>
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/views/games.vala → src/views/Games.vala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ProtonPlus.Views {
public class Games {
public static Gtk.Box GetBox () {
public class Games : Interfaces.IView {
public Gtk.Box GetBox () {
var boxMain = new Gtk.Box (Gtk.Orientation.VERTICAL, 15);
boxMain.set_margin_bottom (15);
boxMain.set_margin_end (15);
Expand Down
6 changes: 3 additions & 3 deletions src/views/notifications.vala → src/views/Notifications.vala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ProtonPlus.Views {
public class Notifications {
public static Gtk.Box GetBox () {
public class Notifications : Interfaces.IView {
public Gtk.Box GetBox () {
var boxMain = new Gtk.Box (Gtk.Orientation.VERTICAL, 15);
boxMain.set_margin_bottom (15);
boxMain.set_margin_end (15);
Expand All @@ -12,4 +12,4 @@ namespace ProtonPlus.Views {
return boxMain;
}
}
}
}
Loading

0 comments on commit c318e41

Please sign in to comment.