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: keep action buttons in headerbar #2186

Merged
merged 7 commits into from
Jun 24, 2024
Merged
35 changes: 0 additions & 35 deletions data/styles/AppInfoView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,6 @@ appinfoview {
background-color: #{'@bg_color'};
}
}

button.text-button,
button.image-button {
background-color: #{'@banner_fg_color'};
background-image: none;
border: none;
box-shadow: none;
color: #{'@banner_bg_color'};
font-size: 11pt;
font-weight: 600;

/*Hack to make the button square-ish*/
&.raised {
padding: 0 0.333em;
}

&:active,
&:checked {
opacity: 0.9;
}

&:disabled {
opacity: 0.33;
}

&:not(.suggested-action) {
opacity: 0.8;
}

label,
image {
color: inherit;
font-weight: inherit;
}
}
}

.content-warning-box {
Expand Down
62 changes: 26 additions & 36 deletions src/Views/AppInfoView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,32 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {
};
search_button.add_css_class (Granite.STYLE_CLASS_LARGE_ICONS);

var uninstall_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic") {
tooltip_text = _("Uninstall"),
valign = CENTER
};
uninstall_button.add_css_class ("raised");

uninstall_button_revealer = new Gtk.Revealer () {
child = uninstall_button,
transition_type = SLIDE_LEFT,
overflow = VISIBLE
};

action_stack = new ActionStack (package) {
hexpand = false
};

action_stack.action_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
action_stack.open_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);

var headerbar = new Gtk.HeaderBar () {
title_widget = title_revealer
};
headerbar.pack_start (new BackButton ());
headerbar.pack_end (search_button);
headerbar.pack_end (action_stack);
headerbar.pack_end (uninstall_button_revealer);

accent_provider = new Gtk.CssProvider ();
try {
Expand Down Expand Up @@ -197,45 +218,22 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {
transition_type = SLIDE_DOWN
};

var uninstall_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic") {
tooltip_text = _("Uninstall"),
margin_end = 12
};
uninstall_button.add_css_class ("raised");
uninstall_button.get_style_context ().add_provider (accent_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

uninstall_button_revealer = new Gtk.Revealer () {
child = uninstall_button,
transition_type = Gtk.RevealerTransitionType.SLIDE_LEFT,
overflow = VISIBLE
};

action_stack = new ActionStack (package);

var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
halign = Gtk.Align.END,
valign = Gtk.Align.CENTER,
hexpand = true
};
button_box.append (uninstall_button_revealer);
button_box.append (action_stack);

var header_grid = new Gtk.Grid () {
column_spacing = 12,
valign = Gtk.Align.CENTER
};
header_grid.attach (app_title, 0, 0);
header_grid.attach (app_subtitle, 0, 1);
header_grid.attach (app_subtitle, 0, 1, 2);
header_grid.attach (origin_combo_revealer, 0, 2, 2);
header_grid.attach (button_box, 1, 0);

if (!package.is_local) {
size_label = new Widgets.SizeLabel () {
halign = Gtk.Align.END
halign = Gtk.Align.END,
hexpand = true
};
size_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);

header_grid.attach (size_label, 1, 1);
header_grid.attach (size_label, 1, 0);
}

var header_box = new Gtk.Box (HORIZONTAL, 6);
Expand All @@ -244,6 +242,7 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {

var header_clamp = new Adw.Clamp () {
child = header_box,
hexpand = true,
maximum_size = MAX_WIDTH
};

Expand All @@ -255,15 +254,6 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {
header.add_css_class ("banner");
header.get_style_context ().add_provider (accent_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

action_stack.action_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
action_stack.action_button.get_style_context ().add_provider (accent_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

action_stack.open_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
action_stack.open_button.get_style_context ().add_provider (accent_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

action_stack.cancel_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
action_stack.cancel_button.get_style_context ().add_provider (accent_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

var package_component = package.component;

var drugs = new ContentType (
Expand Down
1 change: 1 addition & 0 deletions src/Widgets/ActionStack.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class AppCenter.ActionStack : Gtk.Box {

open_button_revealer = new Gtk.Revealer () {
child = open_button,
overflow = VISIBLE,
transition_type = SLIDE_LEFT
};

Expand Down
Loading