💾 Archived View for blog.schmidhuberj.de › 2022 › 03 › 14 › gtk-in-one-week captured on 2024-05-12 at 15:10:59. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-04-28)
-=-=-=-=-=-=-
Posted on 2022-03-14
I have decided to write another GTK application in Rust, this time I am progressing extremely fast.
Note that this post goes on for probably way to long, probably including too much unnecessary things. The tldr is: I was busy and very productive this week.
I have a PinePhone, and I really like it. Since I got it, I some day wanted to daily-drive it as my main smartphone, but there was some software still missing:
I already have made a YouTube-Client in the time I had the PinePhone, called Tubefeeder, which I use daily, so this is no problem. I hoped that someone smarted than me would come up with a good Signal-Application, but as far as I saw, there are no perfect candidates yet (yes, I know Axolotl, but I want my application to act as a secondary, not primary device). This lead me to today, where I am currently making a application for railway travel.
Belive it or not, this was actually the hardest part in developing the application, I spend many hours just searching for the right API (and I am still not sure if this is official or not). Just searching for something like "deutsche bahn REST" will lead to something like:
There are only some REST-APIs, none of them really interesting, for example regarding parking spaces. Searching around more, one may find:
The person seems to have reverse-engineered the "DB Navigator" android application. But as it way Python and outdated, it was not really interesting. Looking at one of the issues results in:
Hafas? What is that. It seems to be exactly what I am looking for, giving me real-time data about the trains. But this is JavaScript, so also not really useful. They have to provide some REST-API, where is it? Searching for "Hafas" results in a great list of Hafas endpoints:
Looking at a few URLs in the browser, these are all websites and not APIs. Even trying to CURL them asking explicitly for JSON results in HTML. More searching is required. Digging deeper, I finally found it:
A JavaScript library getting data from:
Finally.
After I finally found what I was looking for, I searched for a crate that would simplify the creation of the REST client. I found one, but it was very much out of date and unmaintained. So I programming my own REST client application that I am totally willing to maintain for the next ten years (sarcasm if you have not notices).
It really was not that hard to implement, and with the help of some macros, the next step will be very easy to implement.
After rrw was at a usable state, I started to implement my not-yet-published client application for the Hafas API. This was, thanks to the previous step, really easy to do.
Now that the basis for the application was finished, the work on the actual GTK-application can begin. This was a little bit harder than the previous steps, but still manageable. Once you get used to GTK (which I already was thanks to afore mentioned YouTube client), it is really easy to actually write the application. Oh, and did I mention that is I also fully translated it already?
Parallel to that, I already started to package it as a Flatpak, which for no reason was way harder and with many more hurdles as it should have been.
I have not yet published the application, it still needs small things like error handling, but it will likely happen within the next few days. This means (depending on how you count) that I made the GTK-application in a week (or maybe a little more than a week).
I was very productive this week. If I keep being so productive, I might even try to write a Signal-GTK client before university continues. But I will not promise anything.