Skip to content

Commit fa53800

Browse files
authored
blog: add GSoC '26 week 09 progress report by Dev (#997)
1 parent c0644e6 commit fa53800

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
title: "GSoC '26 Week 09 Update by Dev"
3+
excerpt: "Running a deep post-migration API audit across all three repositories, fixing GTK4 window destruction patterns and popover lifecycle issues, and pushing theme contrast improvements in sugar-artwork."
4+
category: "DEVELOPER NEWS"
5+
date: "2026-07-26"
6+
slug: "2026-07-26-gsoc-26-dev-week09"
7+
author: "@/constants/MarkdownFiles/authors/dev.md"
8+
tags: "gsoc26,sugarlabs,week09,dev,gtk4-port,Sugar shell"
9+
image: "assets/Images/GSOC.webp"
10+
---
11+
12+
<!-- markdownlint-disable -->
13+
14+
# Week 09 Progress Report by Dev
15+
16+
**Project:** [GTK4 Transition Part 2: Sugar Shell](https://github.com/sugarlabs/GSoC/blob/master/Ideas-2026.md#gtk4-transition-part-2-sugar-shell)
17+
**Mentors:** [Krish Pandya](https://github.com/MostlyKIGuess), [Ibiam Chihurumnaya](https://github.com/chimosky)
18+
**Assisting Mentors:** [Walter Bender](https://github.com/walterbender), [Juan Pablo Ugarte](https://github.com/xjuan)
19+
**Organization:** [Sugar Labs](https://sugarlabs.org)
20+
**Reporting Period:** 2026-07-19 - 2026-07-25
21+
22+
---
23+
24+
## Goals for This Week
25+
26+
- **Goal 1:** Perform a comprehensive post-migration audit across `sugar` and `sugar-toolkit-gtk4` to catch any remaining GTK3 API violations.
27+
- **Goal 2:** Fix all identified window destruction patterns and popover lifecycle regressions across the Sugar shell.
28+
- **Goal 3:** Push GTK4 theme contrast and dropdown color improvements in `sugar-artwork`.
29+
30+
---
31+
32+
## This Week's Achievements
33+
34+
With the main PR bodies in reasonable shape from last week's audit round, I spent this week doing a thorough second pass across all three repositories to catch any patterns that slipped through.
35+
36+
1. **Deep API Audit and Window Destruction Fixes (`sugar`)**
37+
- I scanned every Python file under `src/jarabe` for GTK3 patterns that would crash silently or raise `AttributeError` at runtime on GTK4. The main findings were around `Gtk.Window.destroy()` which was removed in GTK4.
38+
- Replaced `self.destroy()` calls in `ActivityChooser` and `ViewHelp` with `self.close()`. Fixed the `close_window()` helper inside `shell.py` to always call `close()` before falling back to `unparent()` so the priority is correct.
39+
- Cleaned up redundant comment blocks in `favoritesview.py` around palette teardown logic, setting `self.palette = None` directly after `popdown()`.
40+
- Verified that all `unparent()` calls introduced in Week 08 are working correctly and there are no leftover `container.remove()` calls in the journal or frame modules.
41+
- Commit: [gtk4: resolve Wayland runtime behavior, window destruction, and UI styling](https://github.com/sugarlabs/sugar/pull/1106/commits/88d70d96)
42+
43+
2. **Popover Lifecycle and Layout Allocation Fixes (`sugar-toolkit-gtk4`)**
44+
- After the Week 08 popover work, there were still some edge cases around widget layout measurement and memory cleanup that I addressed.
45+
- Replaced remaining `destroy()` calls in `PaletteWindow.detach()` with `popdown()` followed by `unparent()`. This prevents widget hierarchy crashes when a popover is torn down while still attached.
46+
- Replaced all deprecated `get_allocation()` calls in `Tray`, `ToolbarBox`, and `PaletteWindow` with GTK4 native `measure()`, `get_width()`, and `translate_coordinates()`.
47+
- Replaced `Gdk.cairo_set_source_pixbuf` usage inside `Icon` and `IconEntry` with `Gdk.MemoryTexture` and `GdkPixbuf` stream decoding since the old function was removed in GTK4.
48+
- Fixed a property setter in `Alert` that was constructing a new pixbuf icon on every property update without releasing the old reference.
49+
- Fixed a disposal order issue in `HTray` and `VTray` where buttons were being removed from the layout after the tray itself was already detached, causing `Gtk.Widget.unparent()` to be called on an already-freed widget.
50+
- Commit: [graphics: fix widget lifecycle, layout allocation, and popover management](https://github.com/sugarlabs/sugar-toolkit-gtk4/pull/33/commits/05f06778)
51+
52+
3. **GTK4 Theme Contrast and Dropdown Styles (`sugar-artwork`)**
53+
- I worked on the GTK4 CSS stylesheet inside the `gtk4/theme` directory to fix visual issues that were visible during local testing.
54+
- Added explicit background and text color rules for GTK4 `GtkDropDown` and `GtkComboBox` popover menus. Without these, the popover menu text was inheriting a dark-on-dark color combination that made items unreadable after clicking.
55+
- Updated row selection background and text colors in `GtkTreeView` to match the Sugar color palette properly under GTK4 since the old GTK3 selector names no longer apply.
56+
- Tuned button state padding for the Control Panel section tiles so hover and pressed states render with consistent spacing.
57+
- PR: [sugar-artwork #131](https://github.com/sugarlabs/sugar-artwork/pull/131) · Commit: [gtk4/theme: update dropdown menu contrast and treeview selection styles](https://github.com/sugarlabs/sugar-artwork/pull/131/commits/3667413)
58+
59+
---
60+
61+
## Challenges & How I Overcame Them
62+
63+
- **Challenge:** Tracking down `Gtk.Window.destroy()` calls that failed silently without throwing immediate errors.
64+
**Solution:** In GTK4, calling `destroy()` on a window doesn't raise an exception immediately in all code paths—it either crashes on the next frame render or silently corrupts the widget tree. I ran a full text scan across all Python files and cross-referenced the class hierarchy for every call site to confirm whether the receiver was a `Gtk.Window` subclass or a data object.
65+
66+
- **Challenge:** Adapting to GTK4 CSS node name changes for dropdown menus and popovers.
67+
**Solution:** GTK4 renamed many internal CSS node names. The `GtkComboBox` drop-down list used to be styled with `.combo .popup`, but in GTK4 it renders as a `GtkPopover` with `popover.menu` node hierarchy. I used the GTK Inspector during local runs to inspect the exact node names applied by the runtime and wrote target rules accordingly.
68+
69+
---
70+
71+
## Key Learnings
72+
73+
- GTK4 removed `Gtk.Window.destroy()` entirely. The correct replacement is `Gtk.Window.close()` which sends the delete event through the normal lifecycle and allows the window to clean up.
74+
- `GtkDropDown` in GTK4 does not share CSS node names with `GtkComboBox` from GTK3. Both require separate selector rules in a GTK4 theme stylesheet.
75+
76+
---
77+
78+
## Next Week's Roadmap
79+
80+
- Run extensive end-to-end testing across all shell views (Home Screen, Journal, Control Panel, Frame) under Casilda to find any remaining regressions.
81+
- Prepare a video walkthrough of the new GTK4 shell running natively on Wayland to share progress with the community.
82+
83+
---
84+
85+
## Resources & References
86+
87+
- Sugar Shell Repository - [sugar](https://github.com/sugarlabs/sugar)
88+
- GTK4 Toolkit Library - [sugar-toolkit-gtk4](https://github.com/sugarlabs/sugar-toolkit-gtk4)
89+
- Documentation - [Read the Docs](https://sugar-toolkit-gtk4.readthedocs.io/en/latest/)
90+
- GTK4 Migration Guide - [GNOME Docs](https://docs.gtk.org/gtk4/migrating-3to4.html)
91+
- PyPI Package - [sugar-toolkit-gtk4](https://pypi.org/project/sugar-toolkit-gtk4/)
92+
- Sugar Ext Repository - [sugar-ext](https://github.com/sugarlabs/sugar-ext)
93+
- Casilda Compositor - [Casilda](https://gitlab.gnome.org/jpu/casilda/-/tree/main?ref_type=heads)
94+
- Sugar Artwork Repository - [sugar-artwork](https://github.com/sugarlabs/sugar-artwork)
95+
96+
---
97+
98+
## Acknowledgments
99+
100+
Special thanks to my mentors Krish Pandya, Ibiam Chihurumnaya, Walter Bender, and Juan Pablo Ugarte for their continued guidance and support!

0 commit comments

Comments
 (0)