Skip to content

Commit

Permalink
Merge branch 'main' into leolost/fix-more-mem-leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Jun 24, 2024
2 parents f987626 + 5e891cf commit 6cfd4c7
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 88 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You'll need the following dependencies:
* libjson-glib-dev
* libpolkit-gobject-1-dev
* libportal-dev
* libportal-gtk3-dev
* libportal-gtk4-dev
* libsoup-3.0-dev
* libxml2-dev
* libxml2-utils
Expand Down
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
16 changes: 8 additions & 8 deletions src/Views/AppListUpdateView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ namespace AppCenter.Views {
});

list_box.row_activated.connect ((row) => {
if (row is Widgets.PackageRow) {
show_app (((Widgets.PackageRow) row).get_package ());
if (row.get_child () is Widgets.InstalledPackageRowGrid) {
show_app (((Widgets.InstalledPackageRowGrid) row.get_child ()).package);
}
});

Expand Down Expand Up @@ -309,7 +309,7 @@ namespace AppCenter.Views {

private Gtk.Widget create_row_from_package (Object object) {
unowned var package = (AppCenterCore.Package) object;
return new Widgets.PackageRow.installed (package, action_button_group);
return new Widgets.InstalledPackageRowGrid (package, action_button_group);
}

private Gtk.Widget create_installed_from_package (Object object) {
Expand All @@ -329,13 +329,13 @@ namespace AppCenter.Views {
update_all_button.sensitive = false;
updating_all_apps = true;

var child = list_box.get_first_child ();
while (child != null) {
if (child is Widgets.PackageRow) {
((Widgets.PackageRow) child).set_action_sensitive (false);
var row = list_box.get_first_child ();
while (row != null) {
if (row is Gtk.ListBoxRow) {
((Widgets.InstalledPackageRowGrid) row.get_child ()).action_sensitive = false;
}

child = child.get_next_sibling ();
row = row.get_next_sibling ();
}

unowned var update_manager = AppCenterCore.UpdateManager.get_default ();
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
8 changes: 0 additions & 8 deletions src/Widgets/PackageRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ namespace AppCenter.Widgets {
public class PackageRow : Gtk.ListBoxRow {
AbstractPackageRowGrid grid;

public PackageRow.installed (AppCenterCore.Package package, Gtk.SizeGroup? action_size_group) {
grid = new InstalledPackageRowGrid (package, action_size_group);
child = grid;
((InstalledPackageRowGrid) grid).changed.connect (() => {
changed ();
});
}

public PackageRow.list (AppCenterCore.Package package) {
grid = new ListPackageRowGrid (package);
child = grid;
Expand Down

0 comments on commit 6cfd4c7

Please sign in to comment.