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

Port to Gtk 4 #172

Merged
merged 38 commits into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f4c109d
Initial Gtk 4 porting
danirabbit Feb 2, 2023
605b0f0
Merge main
danirabbit Feb 2, 2023
cdbbb6d
Application focus
danirabbit Feb 2, 2023
5750499
more porting
danirabbit Feb 2, 2023
0036062
Merge branch 'main' into gtk4
danirabbit Feb 2, 2023
1803746
list row stuff
danirabbit Feb 2, 2023
ce1ab11
Merge main
danirabbit Feb 3, 2023
bf27f40
Smaller diff
danirabbit Feb 3, 2023
9abef88
add → append
danirabbit Feb 3, 2023
02c5f7f
Merge main
danirabbit Feb 3, 2023
9897f26
Maybe do clipboard things?
danirabbit Feb 3, 2023
c9849c4
Merge main
danirabbit Feb 3, 2023
43a2772
Rewrite saved state
danirabbit Feb 3, 2023
6078828
delete → close_request
danirabbit Feb 3, 2023
a03d4e9
hide on close
danirabbit Feb 3, 2023
2a9899c
it's a property
danirabbit Feb 3, 2023
0f8015d
MainWindow: add_files takes SList<File>
danirabbit Feb 3, 2023
1c52a52
Remove redundant check while here
danirabbit Feb 3, 2023
7140b8e
MultiInfoBar: subclass box
danirabbit Feb 3, 2023
4b227d3
TorrentListBox: subclass box
danirabbit Feb 3, 2023
c840839
GObject
danirabbit Feb 3, 2023
2e0fb89
Merge #186
danirabbit Feb 3, 2023
eb0bbdc
Merge #184
danirabbit Feb 3, 2023
84ea35e
Merge branch 'add-files' into gtk4
danirabbit Feb 3, 2023
d1662e6
Replace ListBox foreach
danirabbit Feb 4, 2023
45b1f7a
Nearly finish port
danirabbit Feb 4, 2023
6056cc3
merge main
danirabbit Feb 4, 2023
bb342e2
merge main
danirabbit Feb 4, 2023
8f99575
Add zlib dep
davidmhewitt Feb 4, 2023
954b5a8
Fix lots of little bugs
danirabbit Feb 4, 2023
51895ac
Fix context menu
danirabbit Feb 4, 2023
6128aaf
Fix icon size
danirabbit Feb 4, 2023
98859bc
ListBox: margin from css, pixel size
danirabbit Feb 4, 2023
4f56c97
Add a null check for clicked row
danirabbit Feb 4, 2023
67bf884
Rewrite clipboard stuff
danirabbit Feb 4, 2023
542c2fe
Fix quit
danirabbit Feb 4, 2023
5bd72ea
Fix FileChooser API
danirabbit Feb 4, 2023
57a3952
Fix seeding style
danirabbit Feb 4, 2023
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
12 changes: 4 additions & 8 deletions data/com.github.davidmhewitt.torrential.gschema.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<enum id="com.github.davidmhewitt.torrential.windowstate">
<value value="0" nick="normal"/>
<value value="1" nick="maximized"/>
</enum>
<schema path="/com/github/davidmhewitt/torrential/settings/" id="com.github.davidmhewitt.torrential.settings">
<key type="i" name="window-width">
<default>1100</default>
Expand All @@ -15,10 +11,10 @@
<summary>Window height</summary>
<description>Window height</description>
</key>
<key enum="com.github.davidmhewitt.torrential.windowstate" name="window-state">
<default>'normal'</default>
<summary>The saved state of the window</summary>
<description>The saved state of the window</description>
<key name="window-maximized" type="b">
<default>false</default>
<summary>Open window maximized.</summary>
<description>Whether the main window of the application should open maximized or not.</description>
</key>
<key type="s" name="download-folder">
<default>""</default>
Expand Down
5 changes: 3 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ vapi_dir = join_paths(meson.current_source_dir(), 'vapi')
add_project_arguments(['--vapidir', vapi_dir], language: 'vala')

dependencies = [
dependency('gtk+-3.0'),
dependency('gtk4'),
dependency('gee-0.8'),
dependency('granite'),
dependency('granite-7'),
dependency('threads'),
meson.get_compiler('vala').find_library('posix'),
meson.get_compiler('vala').find_library('transmission-2.0', dirs: vapi_dir),
Expand All @@ -28,6 +28,7 @@ dependencies = [
meson.get_compiler('c').find_library('curl'),
meson.get_compiler('c').find_library('ssl'),
meson.get_compiler('c').find_library('crypto'),
meson.get_compiler('c').find_library('z'),
]

subdir('data')
Expand Down
24 changes: 20 additions & 4 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Torrential.Application : Gtk.Application {
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
Intl.textdomain (GETTEXT_PACKAGE);

Gtk.IconTheme.get_default ().add_resource_path ("/com/github/davidmhewitt/torrential");
Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).add_resource_path ("/com/github/davidmhewitt/torrential");

var granite_settings = Granite.Settings.get_default ();
var gtk_settings = Gtk.Settings.get_default ();
Expand All @@ -69,7 +69,7 @@ public class Torrential.Application : Gtk.Application {
return;
}

var file_list = new SList<File> ();
var file_list = new ListStore (typeof (File));
foreach (unowned var file in files) {
file_list.append (file);
}
Expand All @@ -82,9 +82,24 @@ public class Torrential.Application : Gtk.Application {
if (active_window == null) {
var window = new MainWindow (this, torrent_manager);
add_window (window);
} else {
active_window.present ();

/*
* This is very finicky. Bind size after present else set_titlebar gives us bad sizes
* Set maximize after height/width else window is min size on unmaximize
* Bind maximize as SET else get get bad sizes
*/
var settings = new Settings ("com.github.davidmhewitt.torrential.settings");
settings.bind ("window-height", window, "default-height", SettingsBindFlags.DEFAULT);
settings.bind ("window-width", window, "default-width", SettingsBindFlags.DEFAULT);

if (settings.get_boolean ("window-maximized")) {
window.maximize ();
}

settings.bind ("window-maximized", window, "maximized", SettingsBindFlags.SET);
}

active_window.present ();
}

public override int command_line (GLib.ApplicationCommandLine command_line) {
Expand All @@ -93,6 +108,7 @@ public class Torrential.Application : Gtk.Application {
if (options.contains ("quit")) {
if (active_window != null) {
((MainWindow) active_window).quit ();
return Posix.EXIT_SUCCESS;
}
}

Expand Down
9 changes: 4 additions & 5 deletions src/Dialogs/FileSelectDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@ public class Torrential.Dialogs.FileSelectDialog : Granite.Dialog {

var view = new Widgets.FileSelectTreeView (torrent);

var scrolled = new Gtk.ScrolledWindow (null, null) {
var scrolled = new Gtk.ScrolledWindow () {
child = view,
hexpand = true,
vexpand = true,
margin_end = 10,
margin_bottom = 9,
margin_start = 10
};
scrolled.add (view);
scrolled.get_style_context ().add_class (Gtk.STYLE_CLASS_FRAME);
scrolled.show_all ();
scrolled.add_css_class (Granite.STYLE_CLASS_FRAME);

get_content_area ().add (scrolled);
get_content_area ().append (scrolled);

add_button (_("Close"), 0);

Expand Down
Loading