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

AppInfoView: Set banner provider for context, not screen #1692

Merged
merged 8 commits into from
Apr 5, 2022
26 changes: 18 additions & 8 deletions src/Views/AppInfoView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,21 @@ namespace AppCenter.Views {
to_recycle = true;
});

action_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
unowned var action_button_context = action_button.get_style_context ();
action_button_context.add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
action_button_context.add_provider (banner_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

unowned var open_button_context = open_button.get_style_context ();
open_button_context.add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
open_button_context.add_provider (banner_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

unowned var cancel_button_context = cancel_button.get_style_context ();
cancel_button_context.add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
cancel_button_context.add_provider (banner_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

unowned var uninstall_button_context = uninstall_button.get_style_context ();
uninstall_button_context.add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
uninstall_button_context.add_provider (banner_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

var package_component = package.component;

Expand Down Expand Up @@ -623,15 +637,11 @@ namespace AppCenter.Views {
var header_box = new Gtk.Grid () {
hexpand = true
};
header_box.get_style_context ().add_class ("banner");
header_box.add (header_clamp);

// FIXME: should be for context, not for screen
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
banner_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
unowned var header_box_context = header_box.get_style_context ();
header_box_context.add_class ("banner");
header_box_context.add_provider (banner_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

var body_clamp = new Hdy.Clamp () {
margin = 24,
Expand Down
3 changes: 2 additions & 1 deletion src/Widgets/AppContainers/AbstractAppContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace AppCenter {

protected Widgets.HumbleButton action_button;
protected Gtk.Button open_button;
protected Gtk.Button uninstall_button { get; private set; }

protected Gtk.Grid progress_grid;
protected Gtk.Grid button_grid;
Expand Down Expand Up @@ -65,7 +66,7 @@ namespace AppCenter {
}
});

var uninstall_button = new Gtk.Button.with_label (_("Uninstall")) {
uninstall_button = new Gtk.Button.with_label (_("Uninstall")) {
margin_end = 12
};

Expand Down