Skip to content

Commit

Permalink
fix: Vala 0.56.11 vapi change & GTK 4.12 deprecation (#447)
Browse files Browse the repository at this point in the history
* fix: Vala 0.56.11 vapi change  & GTK 4.12 deprication

* fix(ci): remove vala sdk

it has to be added back on 45 but for now it messes up the vala versions
  • Loading branch information
GeopJr authored Aug 22, 2023
1 parent 38aeeb1 commit 4f034ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 0 additions & 5 deletions build-aux/dev.geopjr.Tuba.Devel.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
"runtime": "org.gnome.Platform",
"runtime-version": "44",
"sdk": "org.gnome.Sdk",
"sdk-extensions" : ["org.freedesktop.Sdk.Extension.vala"],
"build-options" : {
"prepend-path" : "/usr/lib/sdk/vala/bin/",
"prepend-ld-library-path" : "/usr/lib/sdk/vala/lib"
},
"command": "dev.geopjr.Tuba",
"finish-args": [
"--device=dri",
Expand Down
8 changes: 8 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ if libgtk_dep.version().version_compare('>=4.10.0')
add_project_arguments(['--define=GTK_4_10'], language: 'vala')
endif

if libgtk_dep.version().version_compare('>=4.12.0')
add_project_arguments(['--define=GTK_4_12'], language: 'vala')
endif

if meson.get_compiler('vala').version().version_compare('>=0.56.11')
add_project_arguments(['--define=VALAC_05611'], language: 'vala')
endif

if libspelling.found ()
add_project_arguments(['--define=LIBSPELLING'], language: 'vala')
endif
Expand Down
12 changes: 11 additions & 1 deletion src/Widgets/VoteBox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,17 @@ public class Tuba.Widgets.VoteBox: Box {
var percentage = poll.votes_count > 0 ? ((double)p.votes_count / poll.votes_count) * 100 : 0.0;

var provider = new Gtk.CssProvider ();
provider.load_from_data (generate_css_style ((int) percentage).data);

#if GTK_4_12
provider.load_from_string (generate_css_style ((int) percentage));
#else
#if VALAC_05611
provider.load_from_data (generate_css_style ((int) percentage), -1);
#else
provider.load_from_data (generate_css_style ((int) percentage).data);
#endif
#endif

row.get_style_context ().add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
row.add_css_class (@"ttl-poll-$((int) percentage)");

Expand Down

0 comments on commit 4f034ca

Please sign in to comment.