After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722227 - Use a GtkHeaderBar
Use a GtkHeaderBar
Status: RESOLVED FIXED
Product: tali
Classification: Applications
Component: general
3.10.x
Other Linux
: Normal enhancement
: ---
Assigned To: Tali maintainer(s)
Tali maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-01-15 01:40 UTC by Michael Catanzaro
Modified: 2014-01-15 17:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of current build (70.30 KB, image/png)
2014-01-15 16:44 UTC, Mario Wenzel
Details

Description Michael Catanzaro 2014-01-15 01:40:15 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
Comment 1 Mario Wenzel 2014-01-15 16:44:14 UTC
Created attachment 266369 [details]
Screenshot of current build

Done. Fixed in master.
Comment 2 Michael Catanzaro 2014-01-15 16:55:07 UTC
Yay! I'll update the two wiki pages.

We might want to use a header bar subtitle to display messages, for bug #666504.
Comment 3 Mario Wenzel 2014-01-15 17:00:20 UTC
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.
Comment 4 Michael Catanzaro 2014-01-15 17:07:28 UTC
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));
Comment 5 Michael Catanzaro 2014-01-15 17:13:28 UTC
(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.
Comment 6 Mario Wenzel 2014-01-15 17:15:06 UTC
Can somebody please port that one to vala already? :D

Anyways, thanks for the info. Changed that.