geoffreybennett/alsa-scarlett-gui

Deprecated classes in GTK 4.10

Opened this issue · 6 comments

In GTK 4.10 the following API calls are deprecated:

  • gtk_message_dialog_new
  • gtk_widget_show, gtk_widget_hide
  • gtk_file_chooser_add_filter, gtk_file_chooser_get_file, gtk_file_chooser_native_new
  • gtk_widget_get_style_context, gtk_style_context_add_class
  • gtk_combo_box_get_active, gtk_combo_box_set_active, gtk_combo_box_text_new, gtk_combo_box_text_append

This will lead to errors in compilation because of -Wall in the CFLAGS.

Dup of #50.

This is a good list of API calls thay may eventually need to be looked at, perhaps this could be left open for future reference ?

Good point. I'll leave this one open for Gtk 4.10 updates.

I find it strange that there was no transition period? I started just updating the code to use the new functions and remove the deprecation warnings but then found that the new functions were only introduced in 4.10 as well. Am I meant to use #ifdefs?

This is the official statement of GTK: https://blog.gtk.org/2022/10/30/on-deprecations/

I have compiled the list of API calls originally for me, so that I would create a pull request with the new API calls, but my GTK knowledge is rudimentary at best, and my C is only OK, so I abandoned that.

saxa commented

If I am not wrong these deprecations will only be removed in GTK 5 if I remeber well. The anouncement is actually that they deprecated it, but it should work still ok in 4.x series. Not sure althoug.

I have a PR for the easy ones, gtk_widget_show/hide

Some of the others are not obvious fixes :

  • gtk_message_dialog_new , the replacement is GtkAlertDialog class but that is only available since 4.10 (hence we would break systems (are there any ?) with gtk4 < 4.10
  • gtk_file_chooser_* : same idea, replacements were added in 4.10 : GtkFileDialog

[EDIT] I agree with @saxa 's interpretation of the gtk blog post. They state :

You only need to remove all uses of deprecations when you want to port to GTK 5 – which does not exist yet.

So it may be years before this becomes important. Heck I still even have to keep gtk2 for some older software...