GSoC 2023: Rust and GTK 4 Bustle Rewrite (Final Overview)

  • 28th Aug 2023
  •  • 
  • 8 min read
  •  • 
  • Tags: 
  • GSoC 2023

Card

Over the summer, for 12 weeks, I worked on rewriting Bustle in Rust and GTK 4 as part of the Google Summer of Code (GSoC) 2023 program. This post is an overview of the work done and the future plans for the project.

About Bustle

Bustle is a graphical application used to analyze D-Bus activities. It uses sequence diagrams to present signal emissions and method calls messages.

Old Bustle

Bustle represents these messages using a row-based layout. Each row is dedicated to displaying the following information: the elapsed time since the first message, the message path, and the member, which could be the name of the emitted signal or invoked method. On the other hand, individual columns correspond to distinct D-Bus services. Bustle draws arrows that transverse these columns to visualize the communication between services, while arcs represent method invocations and returns. This visual paradigm is valuable as, for instance, it can be used to see which services a D-Bus application talks to and how often, which can be handy in debugging, enhancing security, and optimizing performance within the application.

Project Goal

The ultimate goal of this project is to port Bustle to GTK 4 and rewrite it in Rust. Although the current implementation of Bustle in Haskell and GTK 3 is functional, there are compelling reasons to consider a rewrite in Rust. This includes enabling the tool to take advantage of a range of ergonomic libraries, including zbus, gtk4-rs, and pcap-file, that would ease the burden in maintenance. Furthermore, the growing Rust community and the availability of the Rust SDK in Flathub would make the tool more accessible to potential contributors and simpler to distribute to users.

Porting the tool to GTK 4, on the other hand, would offer several benefits, such as access to newer and more performant widgets and drawing APIs like GtkListView and GskPath. This would allow Bustle to benefit from the latest developments in the platform and remain current with evolving standards.

Altogether, a rewrite of Bustle in Rust and GTK 4 would provide advantages that can enhance the tool's functionality, maintainability, longevity, accessibility, and possibly efficiency.

Work Done

Most of the tasks in the original proposal have been completed. This includes having an initial MVP, porting GDBus usage to zbus, implementing file loading and saving, completing the recording functionality, and porting the UI, which comprises the diagram, details view, and services filter, to GTK 4.

For more details on the work done, there are also bi-weekly updates on my blog.

Snapshots

Diagram and Details View

Diagram and Details View

Recording and Services Filter

Recording and Services Filter

Code Merged

These are the summary of code that has been merged during the GSoC period.

Bustle

Most of the work done is in the Bustle GNOME GitLab repository, where the following pull requests have been merged:

zbus and gtk4-rs

While the project is focused on Bustle, some changes are necessary to be upstreamed to other projects. This includes changes to zbus and gtk4-rs, where the following pull requests have been merged:

zbus

gtk4-rs

Code to be Merged

Due to time constraints and unexpected issues, some of the pull requests are still pending review:

Future Plans

While most of the tasks in the proposal have been completed, there are still a few things that need to be done, including the following:

  1. Optimizing performance
  2. Hunting and squashing bugs:
    • Improving name owner changed signal handling
    • Drawing method call arc regardless if the row is not drawable
    • Properly killing the dbus-monitor process
  3. Adding more features:
    • Adding a button that scrolls to the method call message of a method return message or vice-versa
    • Adding a way to open multiple diagrams at once via tabs and multiple windows
  4. Fixing regressions and releasing the application on Flathub
  5. Continuous involvement and contribution to open-source

Final Words

I have to say this is, so far, the most challenging part of my software development journey. It felt like a hackathon since I had to understand things and create something that works quickly. While it was challenging, it was also rewarding as I was able to learn a lot of things and create something that I am proud of. There were moments of time pressure and frustration, but with experimentation, collaboration, and a lot of reading, I was able to overcome these challenges and make meaningful progress. The complexity of the project pushed me out of my comfort zone, forcing me to delve into unfamiliar areas of programming and technology.

Lastly, I would like to express my gratitude to my mentors, Bilal Elmoussaoui and Maximiliano Sandoval, for tirelessly reviewing my pull requests and guiding me. I would also like to thank the GNOME Foundation and the community, especially the GNOME GSoC admin, Felipe Borges, for giving me the opportunity to work on this project. I would also like to extend my appreciation to zbus maintainer, Zeeshan Ali Khan, for their help in getting my pull requests merged against zbus and to the original Bustle developer, Will Thompson, for their guidance. Finally, I would like to thank my family and friends for their support and encouragement.