GNOME Bugzilla – Bug 722227
Use a GtkHeaderBar
Last modified: 2014-01-15 17:15:06 UTC
We should use a GtkHeaderBar for the title bar. This should be very easy, as Tali does not have a menu bar or a toolbar, so no additional effort is required. This is part of the games modernization effort. [1] https://wiki.gnome.org/Initiatives/GnomeGoals/HeaderBars [2] https://wiki.gnome.org/Apps/Games/ModernisationPartDeux
Created attachment 266369 [details] Screenshot of current build Done. Fixed in master.
Yay! I'll update the two wiki pages. We might want to use a header bar subtitle to display messages, for bug #666504.
I thought about that as well but I am not sure. GTK_MESSSAGE_OTHER of the Info bars looks quite allright as well. But I'll look into that.
Now there's no way you could have been expected to notice this in the stream of deprecation warnings, but when you're coding in C you have to be careful about casting pointers to GtkWidgets and its subclasses. I'm not sure if an error here can actually break anything in practice, but it does cause a bunch of warnings: gyahtzee.c: In function ‘GyahtzeeCreateMainWindow’: gyahtzee.c:765:3: warning: passing argument 1 of ‘gtk_header_bar_set_show_close_button’ from incompatible pointer type [enabled by default] gtk_header_bar_set_show_close_button (hbar, TRUE); ^ In file included from /home/mcatanzaro/jhbuild/install/include/gtk-3.0/gtk/gtk.h:110:0, from gyahtzee.c:45: /home/mcatanzaro/jhbuild/install/include/gtk-3.0/gtk/gtkheaderbar.h:90:14: note: expected ‘struct GtkHeaderBar *’ but argument is of type ‘struct GtkWidget *’ void gtk_header_bar_set_show_close_button (GtkHeaderBar *bar, ^ gyahtzee.c:766:3: warning: passing argument 1 of ‘gtk_header_bar_set_title’ from incompatible pointer type [enabled by default] gtk_header_bar_set_title (hbar, _(appName)); ^ In file included from /home/mcatanzaro/jhbuild/install/include/gtk-3.0/gtk/gtk.h:110:0, from gyahtzee.c:45: /home/mcatanzaro/jhbuild/install/include/gtk-3.0/gtk/gtkheaderbar.h:63:14: note: expected ‘struct GtkHeaderBar *’ but argument is of type ‘struct GtkWidget *’ void gtk_header_bar_set_title (GtkHeaderBar *bar, The two ways to fix this are (1) use a pointer to a GtkHeaderBar instead and cast it to a GtkHeaderBar when creating it, or (2) cast it to a GtkHeaderBar whenever using it as a GtkHeaderBar. (2) is more likely to be the style used in games code. (2) would look like: GtkWidget *hbar; hbar = gtk_header_bar_new (); gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (hbar), TRUE); gtk_header_bar_set_title (GTK_HEADER_BAR (hbar), _(appName)); gtk_widget_show (hbar); gtk_window_set_titlebar (GTK_WINDOW (window), hbar); (1) would look like: GtkHeaderBar *hbar; hbar = GTK_HEADER_BAR (gtk_header_bar_new ()); gtk_header_bar_set_show_close_button (hbar, TRUE); gtk_header_bar_set_title (hbar, _(appName)); gtk_widget_show (GTK_WIDGET (hbar)); gtk_window_set_titlebar (GTK_WINDOW (window), GTK_WIDGET (hbar));
(In reply to comment #3) > I thought about that as well but I am not sure. GTK_MESSSAGE_OTHER of the Info > bars looks quite allright as well. But I'll look into that. We've been transitioning away from info bars with Chess and Iagno, since they cause the game field to resize. (A bigger issue for Chess, where the info bar was bigger.) I don't think we want to use an info bar for Tali, since they're fairly distracting, but the status bar in Tali is mostly supplementary/nonessential information that the user doesn't really need to read. Arguably, it could be deleted without replacement, but that'd make it a bit harder to learn how to play. I'm not sure a headerbar subtitle is the best replacement, but I can't think of anything better.
Can somebody please port that one to vala already? :D Anyways, thanks for the info. Changed that.