Skip to content

Commit

Permalink
Fix build with newer Vala (#637)
Browse files Browse the repository at this point in the history
Gtk.CssProvider.load_from_data() takes a string instead of uint8[] now.
  • Loading branch information
alice-mkh committed Mar 3, 2023
1 parent 6da7211 commit 9065ac6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions demo/Views/UtilsView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public class UtilsView : Gtk.Grid {
Granite.contrasting_foreground_color (bg_color).to_string ()
);

#if VALA_0_58
provider.load_from_data (css);
#else
provider.load_from_data ((uint8[])css);
#endif
demo_label_style_context.add_provider (
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
Expand Down
4 changes: 4 additions & 0 deletions lib/Widgets/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ namespace Granite.Widgets.Utils {
var css = "@define-color color_primary %s;".printf (color.to_string ());

var css_provider = new Gtk.CssProvider ();
#if VALA_0_58
css_provider.load_from_data (css);
#else
css_provider.load_from_data (css.data);
#endif

Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), css_provider, priority);

Expand Down

0 comments on commit 9065ac6

Please sign in to comment.