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 706376 - Set the top bar as our titlebar and add a close button
Set the top bar as our titlebar and add a close button
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Main Toolbar
3.9.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-20 09:58 UTC by Yosef Or Boczko
Modified: 2013-08-20 17:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
toolbar: port GtkToolbar to GtkBox and add close button (11.09 KB, patch)
2013-08-20 09:59 UTC, Yosef Or Boczko
reviewed Details | Review
window: make the top bar as titlebar (2.31 KB, patch)
2013-08-20 09:59 UTC, Yosef Or Boczko
reviewed Details | Review
Screenshot (933.50 KB, image/png)
2013-08-20 10:00 UTC, Yosef Or Boczko
  Details
build: bump GTK requirement (934 bytes, patch)
2013-08-20 12:50 UTC, Yosef Or Boczko
committed Details | Review
toolbar: port GtkToolbar to GtkBox and add close button (11.35 KB, patch)
2013-08-20 14:05 UTC, Yosef Or Boczko
reviewed Details | Review
Test patch (13.20 KB, patch)
2013-08-20 15:01 UTC, Yosef Or Boczko
committed Details | Review
screenshot (95.40 KB, image/png)
2013-08-20 17:33 UTC, Allan Day
  Details

Description Yosef Or Boczko 2013-08-20 09:58:14 UTC
See patches.
Comment 1 Yosef Or Boczko 2013-08-20 09:59:34 UTC
Created attachment 252365 [details] [review]
toolbar: port GtkToolbar to GtkBox and add close button
Comment 2 Yosef Or Boczko 2013-08-20 09:59:52 UTC
Created attachment 252366 [details] [review]
window: make the top bar as titlebar
Comment 3 Yosef Or Boczko 2013-08-20 10:00:42 UTC
Created attachment 252367 [details]
Screenshot
Comment 4 Allan Day 2013-08-20 10:04:33 UTC
The screenshots look great to me, and this will bring nautilus in line with the other core apps we've ported to the headerbar style for 3.10.
Comment 5 Yosef Or Boczko 2013-08-20 12:50:21 UTC
Created attachment 252412 [details] [review]
build: bump GTK requirement
Comment 6 Cosimo Cecchi 2013-08-20 13:02:36 UTC
Review of attachment 252365 [details] [review]:

Looks mostly good - some coding style comments.

::: src/nautilus-toolbar.c
@@ +455,1 @@
+	if (rtl)

Curly brace should be on the same line as the if here.

@@ +476,3 @@
+	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+	gtk_container_add (GTK_CONTAINER (toolbar), button);
+	if (rtl)

Same here.

@@ +478,3 @@
+	if (rtl)
+	{
+		gtk_widget_set_margin_right (button, 76);

Why 76? Shouldn't you use the same 12px margin as before?

@@ +521,3 @@
 
+	gtk_container_add (GTK_CONTAINER (toolbar), button);
+	if (rtl)

Coding style

@@ +532,3 @@
+	gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (separator));
+
+		gtk_widget_set_margin_left (button, 12);

You can re-use the existing "rtl" variable here...

@@ +546,3 @@
+	gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+
+	if (gtk_widget_get_direction (GTK_WIDGET (separator)) == GTK_TEXT_DIR_RTL)

...and here.
Comment 7 Cosimo Cecchi 2013-08-20 13:05:08 UTC
Review of attachment 252366 [details] [review]:

::: src/nautilus-window.c
@@ +1489,3 @@
 			 G_CALLBACK (nautilus_window_load_extension_menus), window, G_CONNECT_SWAPPED);
+
+	event_box = gtk_event_box_new ();

Hmm - I'd rather you created the event box as part of NautilusToolbar, taking the place of the previously existing GtkToolbar.
Actually, thinking about it, why do you need to port away from GtkToolbar at all? Can you just use that as titlebar instead of rewriting it as a GtkBox?

@@ +1497,3 @@
+	gtk_container_add (GTK_CONTAINER (event_box), window->details->toolbar);
+	gtk_window_set_titlebar (GTK_WINDOW (window), event_box);
+	gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), TRUE);

The event box is visible by default, so you shouldn't need this.
Comment 8 Cosimo Cecchi 2013-08-20 13:05:39 UTC
Review of attachment 252412 [details] [review]:

This is fine, pending the comments on the previous patches.
Comment 9 Cosimo Cecchi 2013-08-20 13:07:01 UTC
Review of attachment 252365 [details] [review]:

::: src/nautilus-toolbar.c
@@ +87,3 @@
 	gint toolbar_size_px, menu_size_px;
 
+	g_object_get (gtk_settings_get_default (), "gtk-toolbar-icon-size", &toolbar_size, NULL);

I wonder if we couldn't get rid of this icon margin hack and just rely on gtk_button_new_from_icon_name() setting the right style class and the theme applying the right padding instead.
Comment 10 Yosef Or Boczko 2013-08-20 13:43:23 UTC
(In reply to comment #7)
> Review of attachment 252366 [details] [review]:
> 
> ::: src/nautilus-window.c
> @@ +1489,3 @@
>               G_CALLBACK (nautilus_window_load_extension_menus), window,
> G_CONNECT_SWAPPED);
> +
> +    event_box = gtk_event_box_new ();
> 
> Hmm - I'd rather you created the event box as part of NautilusToolbar, taking
> the place of the previously existing GtkToolbar.
> Actually, thinking about it, why do you need to port away from GtkToolbar at
> all? Can you just use that as titlebar instead of rewriting it as a GtkBox?

Maybe move this to create_toolbar ()?
And realy, I don't remember why I ported GtkToolbar to GtkBox.
I remember have reason. maybe because bug #706050.

> 
> @@ +1497,3 @@
> +    gtk_container_add (GTK_CONTAINER (event_box), window->details->toolbar);
> +    gtk_window_set_titlebar (GTK_WINDOW (window), event_box);
> +    gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), TRUE);
> 
> The event box is visible by default, so you shouldn't need this.

ok.
Comment 11 Yosef Or Boczko 2013-08-20 14:05:13 UTC
Created attachment 252426 [details] [review]
toolbar: port GtkToolbar to GtkBox and add close button

The margin is change to 76px after comment from Allan Day.
I removed the function get_icon_margin (), for nautilus
will consistent with the other apps.
Comment 12 Cosimo Cecchi 2013-08-20 14:40:51 UTC
(In reply to comment #10)

> Maybe move this to create_toolbar ()?
> And realy, I don't remember why I ported GtkToolbar to GtkBox.
> I remember have reason. maybe because bug #706050.

I think you should be able to make the eventbox part of NautilusToolbar directly instead.
Comment 13 Yosef Or Boczko 2013-08-20 14:41:31 UTC
(In reply to comment #12)
> (In reply to comment #10)
> 
> > Maybe move this to create_toolbar ()?
> > And realy, I don't remember why I ported GtkToolbar to GtkBox.
> > I remember have reason. maybe because bug #706050.
> 
> I think you should be able to make the eventbox part of NautilusToolbar
> directly instead.

ok.
Comment 14 Cosimo Cecchi 2013-08-20 14:48:06 UTC
Review of attachment 252426 [details] [review]:

::: src/nautilus-toolbar.c
@@ +385,3 @@
+
+  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
+  gtk_window_close (GTK_WINDOW (toplevel));

Indentation here should follow the rest of the file.
Also, instead of using gtk_widget_get_toplevel(), you should use the window stored in the toolbar's private structure.
Comment 15 Cosimo Cecchi 2013-08-20 14:49:21 UTC
Allan, why the 76px margin on the search icon? Shouldn't it be the same as the space between search and the next icon?
Comment 16 Allan Day 2013-08-20 14:51:16 UTC
(In reply to comment #15)
> Allan, why the 76px margin on the search icon? Shouldn't it be the same as the
> space between search and the next icon?

We need to leave some header bar exposed so you can drag the window...
Comment 17 Cosimo Cecchi 2013-08-20 14:52:47 UTC
(In reply to comment #16)

> We need to leave some header bar exposed so you can drag the window...

Oh hmm, good point, I guess it's fine then. In most cases, the pathbar won't extend that far towards the icon anyway.
Comment 18 Yosef Or Boczko 2013-08-20 15:01:44 UTC
Created attachment 252439 [details] [review]
Test patch

The patch for tested - the top bar is not opacity!
Comment 19 Yosef Or Boczko 2013-08-20 15:02:55 UTC
(In reply to comment #17)
> (In reply to comment #16)
> 
> > We need to leave some header bar exposed so you can drag the window...
> 
> Oh hmm, good point, I guess it's fine then. In most cases, the pathbar won't
> extend that far towards the icon anyway.

Have location-entry...
Comment 20 Cosimo Cecchi 2013-08-20 17:14:51 UTC
As we're approaching UI freeze and I have to release a tarball before tonight, I reworked your last patch to use a GtkFrame, together with some small cleanups, and pushed it to master.
FWIW, your test patch wasn't working because you forgot to change the parent GType inside the G_DEFINE_TYPE macro, in nautilus-toolbar.c.

Eventually, I would like this toolbar to be a propert GtkHeaderBar subclass, but that's for a separate cleanup, as it doesn't require UI changes.
Thanks for your work.
Comment 21 Allan Day 2013-08-20 17:33:16 UTC
Created attachment 252458 [details]
screenshot

Thanks Cosimo and Yosef! I'm really happy to have this in for 3.10.

I just tested it and saw some visual glitches: the HeaderBar has a 2px border running around it, the buttons seem to be slightly less tall than before, and the button icons don't seem to be quite vertically centered. Not sure if it's something to do with my JHBuild or not (I have reverted the gnome-themes-standard commit that's mentioned in bug 706418), but I thought I'd let you know.
Comment 22 Cosimo Cecchi 2013-08-20 17:41:45 UTC
I don't see those issues here... except for buttons being slightly less tall - I just pushed a fix for the buttons to git master (unfortunately I just released 3.9.90 without it...).