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

Port to Gtk 4 #1896

Merged
merged 133 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
f7d03ab
Initial build attempt
danirabbit Aug 27, 2022
e2d6f7d
solve appinfoview
danirabbit Aug 27, 2022
ff42225
CategoryView: don't subclass Gtk.FlowBox
danirabbit Aug 27, 2022
64c62e7
CategoryFlowBox: subclass box
danirabbit Aug 27, 2022
195df46
CategoryFlowBox: subclass Gtk.Box
danirabbit Aug 27, 2022
c2e16ef
Homepage: absorb categoryflowbox
danirabbit Aug 27, 2022
ecd3302
less diff
danirabbit Aug 27, 2022
5f343ab
scope down
danirabbit Aug 27, 2022
c571530
POTFILES
danirabbit Aug 27, 2022
7d3b2a5
CategoryView: don't subclass stack
danirabbit Aug 27, 2022
f8d6d30
AppInfoView: absorb ReleaseListBox
danirabbit Aug 27, 2022
cf709a3
Merge categoryflowbox branch
danirabbit Aug 27, 2022
49d6ff3
Merge release listbox branch
danirabbit Aug 27, 2022
63fff7f
CategoryView: merge subcategoryflowbox branch
danirabbit Aug 27, 2022
1325b38
Don't use Adw.Window
danirabbit Aug 27, 2022
6b96a6e
Avoid invalid casts
danirabbit Aug 27, 2022
bd49a0b
Fix headerbar
danirabbit Aug 27, 2022
194a4d9
misc fixes
danirabbit Aug 27, 2022
2813a63
Back button handling is built in
danirabbit Aug 27, 2022
232cc2d
Fix header button style
danirabbit Aug 27, 2022
9deaff2
Fix menuitem styles
danirabbit Aug 27, 2022
d15b469
style fixes
danirabbit Aug 28, 2022
e4aa986
fix number of packages on homepage
danirabbit Aug 28, 2022
971066c
Fix revealer clipping
danirabbit Aug 28, 2022
fab127b
Fix share button style
danirabbit Aug 28, 2022
a8e0100
merge master
danirabbit Aug 28, 2022
94fb3ff
SharePopover: code style and DRY
danirabbit Aug 28, 2022
a39525f
Merge popover codestyle branch and simplify
danirabbit Aug 28, 2022
6c1a369
Rewrite state save/restore
danirabbit Aug 29, 2022
aa13f27
merge master
danirabbit Aug 29, 2022
5787b62
remove unreachable catch
danirabbit Aug 29, 2022
c600c90
merge master
danirabbit Aug 30, 2022
d652e32
Remove unreachable catch
danirabbit Aug 30, 2022
452f8ca
MainWindow: search entry grab focus
danirabbit Aug 30, 2022
0074161
Add search entry key controller
danirabbit Aug 30, 2022
6a7f375
MainWindow: set updates revealer can_target false
danirabbit Aug 30, 2022
62d0e2e
remove dead eventbox signal
danirabbit Aug 30, 2022
20ad6ff
StripeDialog: set_default_widget
danirabbit Aug 30, 2022
e79b5f5
MainWindow: connect to close request instead of delete
danirabbit Aug 30, 2022
345295f
other direction
danirabbit Aug 30, 2022
71b9d52
MainWindow: look for installed view by name
danirabbit Aug 30, 2022
e3c8816
merge master
danirabbit Aug 31, 2022
1508b8a
merge master
danirabbit Aug 31, 2022
9086404
Application: replace destroy connect with close_request
danirabbit Aug 31, 2022
b573433
Application: fix focus checking for installed toast
danirabbit Aug 31, 2022
54ec038
Homepage: theoretically add focus controller
danirabbit Aug 31, 2022
11ace14
Entry fuckery
danirabbit Aug 31, 2022
988007d
Force icon back into spinbutton
danirabbit Aug 31, 2022
810db19
Leave margin to system stylesheet
danirabbit Aug 31, 2022
4257577
Motion controllers
danirabbit Aug 31, 2022
e34564d
Rename
danirabbit Aug 31, 2022
f36129f
Don't show arrows for single screenshot
danirabbit Aug 31, 2022
95ff0b3
Remove comment
danirabbit Aug 31, 2022
4056543
Code style
danirabbit Aug 31, 2022
5d7b162
Always remove leaflet child
danirabbit Aug 31, 2022
4e59eee
MainWindow: Use large-icons class
danirabbit Sep 1, 2022
2b38d79
Fix style issues with category cards
danirabbit Sep 1, 2022
4a0d263
merge master
danirabbit Sep 1, 2022
8dea363
Merge master
danirabbit Sep 2, 2022
f81c139
Merge master
danirabbit Sep 2, 2022
bb3f05c
AppInfoView: use Gtk.Picture
danirabbit Sep 4, 2022
0e3894b
merge master
danirabbit Sep 4, 2022
5c80eab
CategoryView: expand spinner
danirabbit Sep 4, 2022
d562b0c
We have a problem with remote icons
danirabbit Sep 4, 2022
5ab6463
Minor list fixes
danirabbit Sep 4, 2022
09c4d69
Fix row clears
danirabbit Sep 4, 2022
ed9bcf4
Fix most crashes
danirabbit Sep 4, 2022
7e14dac
StripeDialog: fix visiblity on focus out
danirabbit Sep 4, 2022
ab77716
CardNumberEntry: solve pos and crash
danirabbit Sep 5, 2022
09a8b95
StripeDialog: add keyrelease handler to spinbutton
danirabbit Sep 5, 2022
5b04a03
Fix symbolic icon coloring
danirabbit Sep 5, 2022
9bdfebb
Package: copy remote icons
danirabbit Sep 5, 2022
fba3792
AppInfoView: fix style classes
danirabbit Sep 5, 2022
e58f1ff
ArrowButton: set icon size in CSS
danirabbit Sep 5, 2022
9ecc88b
Categories.css: Fix writing and lang background
danirabbit Sep 5, 2022
f69cf4a
StripeDialog: Use granite title label class
danirabbit Sep 5, 2022
fdfa3d5
MainWindow: now unused name
danirabbit Sep 5, 2022
02f2b61
Merge master
danirabbit Sep 8, 2022
48647b6
lint
danirabbit Sep 8, 2022
29ac061
merge master
danirabbit Sep 29, 2022
e0eaf02
Update main.yml
danirabbit Oct 3, 2022
dbf46d8
Merge branch 'master' into gtk4
danirabbit Oct 3, 2022
83b2e99
Merge branch 'master' into gtk4
danirabbit Oct 3, 2022
2efd684
Update src/Dialogs/StripeDialog.vala
danirabbit Oct 5, 2022
c98e58b
Merge branch 'master' into gtk4
danirabbit Oct 8, 2022
69a5982
Require Granite 7.1.0
danirabbit Oct 11, 2022
770a217
Update README
danirabbit Oct 11, 2022
220a3cb
Merge branch 'master' into gtk4
danirabbit Oct 11, 2022
c6dae86
Remove extra line
danirabbit Oct 11, 2022
b94b1da
SharePopover: large-icons on container
danirabbit Oct 11, 2022
4ef60bd
Merge branch 'master' into gtk4
danirabbit Oct 12, 2022
9174ed8
Merge branch 'master' into gtk4
zeebok Oct 19, 2022
2c10cb2
Merge branch 'master' into gtk4
zeebok Oct 20, 2022
6fd5edf
AppInfoView: action button grab focus on realize
danirabbit Oct 27, 2022
47da620
Merge branch 'master' into gtk4
danirabbit Oct 27, 2022
cca2d05
Merge branch 'master' into gtk4
danirabbit Oct 28, 2022
99433b4
Merge branch 'master' into gtk4
danirabbit Nov 1, 2022
ffd4b3f
Merge branch 'master' into gtk4
meisenzahl Nov 3, 2022
fd18ad7
Merge branch 'master' into gtk4
zeebok Nov 7, 2022
27aaed1
Merge branch 'master' into gtk4
zeebok Nov 12, 2022
a8240b7
merge master
danirabbit Nov 30, 2022
1c5992f
Merge master
danirabbit Aug 18, 2023
84ee254
merge master
danirabbit Aug 19, 2023
7777d66
Merge master
danirabbit Aug 20, 2023
ccddde7
Fix headerbar issue
danirabbit Aug 20, 2023
473aef4
merge master
danirabbit Aug 22, 2023
6071bd1
Merge master
danirabbit Aug 23, 2023
5c57cd7
Merge branch 'master' into gtk4
danirabbit Aug 23, 2023
36a6353
Fix infinite loop
danirabbit Aug 23, 2023
71ccee2
load application.css automatically
danirabbit Aug 23, 2023
ee207aa
Palette fallbacks now in Granite
danirabbit Aug 23, 2023
51927fc
Avoid loop/crash
danirabbit Aug 23, 2023
68ab561
Reduce diff slightly
danirabbit Aug 23, 2023
1845a9e
Fix broken screenshot arrows
danirabbit Aug 23, 2023
5ccda25
Fix share button frame
danirabbit Aug 23, 2023
28ecc62
fix missing web browser icon
danirabbit Aug 23, 2023
29d7c17
Merge master
danirabbit Aug 24, 2023
093334e
bump granite requirement
danirabbit Aug 24, 2023
67e2268
Merge master
danirabbit Aug 25, 2023
cef03bc
Merge branch 'master' into gtk4
danirabbit Aug 25, 2023
725a551
Merge branch 'master' into gtk4
danirabbit Sep 15, 2023
8634643
Merge master
danirabbit Oct 9, 2023
be85ad1
Merge branch 'master' into gtk4
tintou Nov 8, 2023
2141ff6
Merge branch 'master' into gtk4
danirabbit Feb 6, 2024
5ab9f76
Merge branch 'master' into gtk4
danirabbit Feb 7, 2024
10605af
Remove problematic remote icon code
danirabbit Feb 7, 2024
abb6828
Fix uninstall button style
danirabbit Feb 7, 2024
053f17d
Merge branch 'master' into gtk4
leolost2605 Feb 11, 2024
247c275
Merge branch 'master' into gtk4
danirabbit Feb 12, 2024
45b9cf2
Merge branch 'master' into gtk4
leolost2605 Feb 14, 2024
7f1dc77
Remove restart infobar
danirabbit Feb 14, 2024
f180dc0
move request_background to close_request override
danirabbit Feb 14, 2024
bb7190f
Use remove
danirabbit Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y gettext libappstream-dev libflatpak-dev libportal-dev libportal-gtk3-dev libgee-0.8-dev libgranite-dev libgtk-3-dev libhandy-1-dev libjson-glib-dev libpackagekit-glib2-dev libsoup-3.0-dev libxml2-dev libxml2-utils libpolkit-gobject-1-dev meson valac
apt install -y gettext libadwaita-1-dev libappstream-dev libflatpak-dev libgee-0.8-dev libgranite-7-dev libgtk-4-dev libjson-glib-dev libpackagekit-glib2-dev libportal-dev libportal-gtk4-dev libsoup-3.0-dev libxml2-dev libxml2-utils libpolkit-gobject-1-dev meson valac
- name: Build and Test
env:
DESTDIR: out
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ An open, pay-what-you-want app store for indie developers.

You'll need the following dependencies:
* gettext
* libappstream-dev (>= 0.10)
* libflatpak-dev
* libadwaita-1-dev
* libappstream-dev (>= 0.15.2)
* libflatpak-dev (>= 1.0.7)
* libgee-0.8-dev
* libgranite-dev (>=5.2.5)
* libgtk-3-dev
* libhandy-1-dev (>=1.3.0)
* libgranite-7-dev (>=7.1.0)
* libgtk-4-dev
* libjson-glib-dev
* libpackagekit-glib2-dev
* libpolkit-gobject-1-dev
Expand Down
3 changes: 1 addition & 2 deletions data/io.elementary.appcenter.gresource.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/io/elementary/appcenter">
<file alias="application.css" compressed="true">styles/application.css</file>
<file alias="Application.css" compressed="true">styles/application.css</file>
<file alias="AppInfoView.css" compressed="true">styles/AppInfoView.css</file>
<file alias="AppListUpdateView.css" compressed="true">styles/AppListUpdateView.css</file>
<file alias="arrow.css" compressed="true">styles/arrow.css</file>
<file alias="badge.css" compressed="true">styles/badge.css</file>
<file alias="banner.css" compressed="true">styles/banner.css</file>
<file alias="categories.css" compressed="true">styles/categories.css</file>
<file alias="fallback.css" compressed="true">styles/fallback.css</file>
<file alias="loading.css" compressed="true">styles/loading.css</file>
<file alias="ProgressButton.css" compressed="true">styles/ProgressButton.css</file>
</gresource>
Expand Down
1 change: 1 addition & 0 deletions data/styles/arrow.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
margin: 12px;
padding: 6px;
color: @text_color;
-gtk-icon-size: 24px;
}

.arrow:active,
Expand Down
2 changes: 1 addition & 1 deletion data/styles/banner.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

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

.banner button:not(.suggested-action) {
Expand Down
20 changes: 10 additions & 10 deletions data/styles/categories.css
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
radial-gradient(
circle,
alpha(@STRAWBERRY_900, 0) 65%,
alpha(shade(@STRAWBERRY_900, 0.6), 0.35) 4%
alpha(shade(@STRAWBERRY_900, 0.6), 0.35) 66%
),
linear-gradient(
to bottom,
Expand Down Expand Up @@ -651,19 +651,19 @@
background-image:
linear-gradient(
to right,
transparent 42px,
alpha(@STRAWBERRY_100, 0.25) 42px,
alpha(@STRAWBERRY_100, 0.25) 44px,
transparent 44px
transparent 1.3em,
alpha(@STRAWBERRY_100, 0.25) 1.3em,
alpha(@STRAWBERRY_100, 0.25) calc(1.3em + 2px),
transparent calc(1.3em + 2px)
),
linear-gradient(
to bottom,
white 90%,
alpha(@BLUEBERRY_100, 0.2) 90%
transparent 0.9em,
alpha(@BLUEBERRY_100, 0.2) 0.9em
);
background-position: center center;
background-repeat: repeat-y;
background-size: 100% 1em;
background-position: center center, center 0.7em;
background-repeat: no-repeat, repeat-y;
background-size: auto auto, 110% 1em; /* Gtk.CSS bug requiring over 100% width maybe? */
color: @BLACK_300;
font-size: 24px;
}
81 changes: 0 additions & 81 deletions data/styles/fallback.css

This file was deleted.

13 changes: 6 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ i18n = import('i18n')

add_project_arguments(
'-DGETTEXT_PACKAGE="@0@"'.format(gettext_name),
'-DHANDY_USE_UNSTABLE_API',
'-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE',
language:'c'
)
Expand All @@ -23,17 +22,17 @@ glib = dependency ('glib-2.0')
gobject = dependency ('gobject-2.0')
gio = dependency ('gio-2.0')
gee = dependency ('gee-0.8')
gtk = dependency ('gtk+-3.0', version: '>=3.10')
granite = dependency ('granite', version: '>=6.0.0')
handy = dependency('libhandy-1', version: '>=1.4.0')
gtk = dependency ('gtk4')
granite = dependency ('granite-7', version: '>=7.3.0')
adwaita = dependency('libadwaita-1')
appstream = dependency ('appstream', version: '>=0.15.2')
libsoup = dependency ('libsoup-3.0')
json = dependency ('json-glib-1.0')
flatpak = dependency ('flatpak')
xml = dependency ('libxml-2.0')
polkit = dependency ('polkit-gobject-1')
portal = dependency('libportal')
portal_gtk3 = dependency('libportal-gtk3')
portal_gtk4 = dependency('libportal-gtk4')
posix = meson.get_compiler('vala').find_library('posix')

dbus = dependency ('dbus-1')
Expand All @@ -49,13 +48,13 @@ core_deps = [
dependencies = core_deps + [
gtk,
granite,
handy,
adwaita,
appstream,
flatpak,
xml,
polkit,
portal,
portal_gtk3,
portal_gtk4,
posix
]

Expand Down
44 changes: 15 additions & 29 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public class AppCenter.App : Gtk.Application {
protected override void startup () {
base.startup ();

Hdy.init ();
Granite.init ();

var granite_settings = Granite.Settings.get_default ();
var gtk_settings = Gtk.Settings.get_default ();
Expand All @@ -127,22 +127,6 @@ public class AppCenter.App : Gtk.Application {
gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
});

var provider = new Gtk.CssProvider ();
provider.load_from_resource ("io/elementary/appcenter/application.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);

var fallback_provider = new Gtk.CssProvider ();
fallback_provider.load_from_resource ("io/elementary/appcenter/fallback.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
fallback_provider,
Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK
);

var quit_action = new SimpleAction ("quit", null);
quit_action.activate.connect (() => {
if (active_window != null) {
Expand Down Expand Up @@ -250,13 +234,19 @@ public class AppCenter.App : Gtk.Application {
var main_window = new MainWindow (this);
add_window (main_window);

var window_height = App.settings.get_int ("window-height");
var window_width = App.settings.get_int ("window-width");
main_window.resize (window_width, window_height);
/*
* This is very finicky. Bind size after present else set_titlebar gives us bad sizes
* Set maximize after height/width else window is min size on unmaximize
* Bind maximize as SET else get get bad sizes
*/
settings.bind ("window-height", main_window, "default-height", SettingsBindFlags.DEFAULT);
settings.bind ("window-width", main_window, "default-width", SettingsBindFlags.DEFAULT);

if (settings.get_boolean ("window-maximized")) {
main_window.maximize ();
}

settings.bind ("window-maximized", main_window, "maximized", SettingsBindFlags.SET);
}

if (show_updates) {
Expand Down Expand Up @@ -356,14 +346,9 @@ public class AppCenter.App : Gtk.Application {
if (error == null) {
if (package.get_can_launch ()) {
// Check if window is focused
if (active_window != null) {
var main_window = (MainWindow) active_window;
var win = main_window.get_window ();
if (win != null && (win.get_state () & Gdk.WindowState.FOCUSED) != 0) {
main_window.send_installed_toast (package);

break;
}
if (active_window != null && active_window.is_active) {
((MainWindow) active_window).send_installed_toast (package);
break;
}

var notification = new Notification (_("The app has been installed"));
Expand Down Expand Up @@ -406,8 +391,9 @@ public class AppCenter.App : Gtk.Application {
transient_for = active_window
};

update_fail_dialog.destroy.connect (() => {
update_fail_dialog.close_request.connect (() => {
update_fail_dialog = null;
return Gdk.EVENT_PROPAGATE;
});
}

Expand Down
20 changes: 3 additions & 17 deletions src/Core/Package.vala
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,12 @@ public class AppCenterCore.Package : Object {
uint current_scale = 0;
uint pixel_size = size * scale_factor;

weak GenericArray<AppStream.Icon> icons = component.get_icons ();
for (int i = 0; i < icons.length; i++) {
weak AppStream.Icon _icon = icons[i];
unowned var icons = component.get_icons ();
foreach (unowned var _icon in icons) {
switch (_icon.get_kind ()) {
case AppStream.IconKind.STOCK:
unowned string icon_name = _icon.get_name ();
if (Gtk.IconTheme.get_default ().has_icon (icon_name)) {
if (Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).has_icon (icon_name)) {
return new ThemedIcon (icon_name);
}

Expand All @@ -742,19 +741,6 @@ public class AppCenterCore.Package : Object {
current_scale = icon_scale;
}

break;
case AppStream.IconKind.REMOTE:
var icon_scale = _icon.get_scale ();
var icon_width = _icon.get_width () * icon_scale;
bool is_bigger = (icon_width > current_size && current_size < pixel_size);
bool has_better_dpi = (icon_width == current_size && current_scale < icon_scale && scale_factor <= icon_scale);
if (is_bigger || has_better_dpi) {
var file = File.new_for_uri (_icon.get_url ());
icon = new FileIcon (file);
current_size = icon_width;
current_scale = icon_scale;
}

break;

case AppStream.IconKind.UNKNOWN:
Expand Down
2 changes: 1 addition & 1 deletion src/Dialogs/InstallFailDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class InstallFailDialog : Granite.MessageDialog {

if (package.is_flatpak) {
var repair_button = add_button (_("Repair"), REPAIR_RESPONSE_ID);
repair_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
repair_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
}

response.connect ((response) => {
Expand Down
Loading