Skip to content

Commit

Permalink
fix: Vala 0.56.11 vapi change & GTK 4.12 deprication
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr committed Aug 17, 2023
1 parent 38aeeb1 commit d2c95fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
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 d2c95fc

Please sign in to comment.