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 761098 - [PATCH] Update theming
[PATCH] Update theming
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
3.19.x
Other Linux
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-01-25 17:19 UTC by horst3180
Modified: 2016-01-28 09:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nautilus-list-view: set a css name (1.30 KB, patch)
2016-01-25 17:19 UTC, horst3180
none Details | Review
css: update button selector (606 bytes, patch)
2016-01-25 17:19 UTC, horst3180
none Details | Review
nautilus-window: set a widget name (757 bytes, patch)
2016-01-25 17:20 UTC, horst3180
none Details | Review
nautilus-list-view: add a styleclass (1.25 KB, patch)
2016-01-27 11:51 UTC, horst3180
committed Details | Review
css: update button selector (606 bytes, patch)
2016-01-27 11:52 UTC, horst3180
committed Details | Review
nautilus-window: add a styleclass (806 bytes, patch)
2016-01-27 11:53 UTC, horst3180
none Details | Review
nautilus-window: add a styleclass (1.08 KB, patch)
2016-01-27 16:11 UTC, horst3180
none Details | Review
nautilus-window: add a styleclass (1.27 KB, patch)
2016-01-27 18:23 UTC, horst3180
reviewed Details | Review
nautilus-window: add a styleclass (1.28 KB, patch)
2016-01-27 18:28 UTC, horst3180
committed Details | Review

Description horst3180 2016-01-25 17:19:25 UTC
Created attachment 319693 [details] [review]
nautilus-list-view: set a css name

These patches update some aspects of the nautilus theming.

The first patch re-enables the borders in the list view, as the "NautilusListView" selector no longer works with the latest GTK+. This was done by setting a custom css name and updating the Adwaita.css stylesheet accordingly.

Here is a comparison
Screenshot without patch: http://ibin.co/2UhCbMhbvnMg
Screenshot with patch: http://ibin.co/2UhCLRT8WIvo

The second patch just updates the button css selector from ".button" to "button".

The third patch sets a name for NautilusWindow, since the "NautilusWindow" selector no longer works.
This way themes can provide their own nautilus specific theming by using the "#nautilus-window" selector without affecting other applications.
Comment 1 horst3180 2016-01-25 17:19:56 UTC
Created attachment 319694 [details] [review]
css: update button selector
Comment 2 horst3180 2016-01-25 17:20:21 UTC
Created attachment 319695 [details] [review]
nautilus-window: set a widget name
Comment 3 Carlos Soriano 2016-01-26 10:04:35 UTC
Review of attachment 319693 [details] [review]:

LGTM
Comment 4 Carlos Soriano 2016-01-26 10:05:06 UTC
Review of attachment 319694 [details] [review]:

ok
Comment 5 Carlos Soriano 2016-01-26 10:32:00 UTC
(In reply to horst3180 from comment #2)
> Created attachment 319695 [details] [review] [review]
> nautilus-window: set a widget name

I cannot find this "name" property, only in GladeWidget. If you want to use it for css, why don't set a css_name?
Comment 6 horst3180 2016-01-26 13:02:01 UTC
Sorry, I'm not very experienced with GTK/GObject, but I think it's this property: https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget--name

It does the same as gtk_widget_set_name (https://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c#n3707).

I didn't use gtk_widget_class_set_css_name, because it would change the "window" node name to "nautilus-window". Themes may expect the "window" node to be part of every window.
In fact, Adwaita does this at one point (https://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita/_common.scss#n1344)
Although it doesn't affect nautilus, I thought it wouldn't be a good idea to change it.
Comment 7 Carlos Soriano 2016-01-27 09:00:51 UTC
(In reply to horst3180 from comment #6)
> Sorry, I'm not very experienced with GTK/GObject, but I think it's this
> property:
> https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget--name
> 
> It does the same as gtk_widget_set_name
> (https://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c#n3707).
> 
> I didn't use gtk_widget_class_set_css_name, because it would change the
> "window" node name to "nautilus-window". Themes may expect the "window" node
> to be part of every window.
> In fact, Adwaita does this at one point
> (https://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita/_common.scss#n1344)
> Although it doesn't affect nautilus, I thought it wouldn't be a good idea to
> change it.

Thanks for taking a deeper look.

I asked to a gtk+ developer and I understand what you mean.
However, for this case seems it's better to just set a style class rather than use "names" because it's simpler to understand and setting a name doesn't provide us any benefit in this case.

Also, could you try the same thing with the nautilus-list-view patch?
So you will have .nautilus-list-view .view {} and use gtk_style_context_add_class?
Comment 8 horst3180 2016-01-27 11:51:58 UTC
Created attachment 319813 [details] [review]
nautilus-list-view: add a styleclass
Comment 9 horst3180 2016-01-27 11:52:32 UTC
Created attachment 319814 [details] [review]
css: update button selector
Comment 10 horst3180 2016-01-27 11:53:05 UTC
Created attachment 319815 [details] [review]
nautilus-window: add a styleclass
Comment 11 horst3180 2016-01-27 11:54:32 UTC
You're right, styleclasses seem like a better solution. I changed my patches accordingly.
Comment 12 Carlos Soriano 2016-01-27 15:33:31 UTC
Review of attachment 319813 [details] [review]:

yes
Comment 13 Carlos Soriano 2016-01-27 15:33:47 UTC
Review of attachment 319814 [details] [review]:

yep
Comment 14 Carlos Soriano 2016-01-27 15:35:23 UTC
Review of attachment 319815 [details] [review]:

and the css change? is not here.
Also, provide a better commit message, why we need these changes etc.
Comment 15 Carlos Soriano 2016-01-27 15:35:24 UTC
Review of attachment 319815 [details] [review]:

and the css change? is not here.
Also, provide a better commit message, why we need these changes etc.
Comment 16 horst3180 2016-01-27 15:52:56 UTC
(In reply to Carlos Soriano from comment #15)
> Review of attachment 319815 [details] [review] [review]:
> 
> and the css change? is not here.
> Also, provide a better commit message, why we need these changes etc.

This patch is meant to give themes that are not Adwaita a way to add styling that specifically targets Nautilus. Adwaita.css doesn't need any modifications.

So the css change, i.e. changing the NautilusWindow selector to .nautilus-window, needs to happen in third party themes.
Comment 17 horst3180 2016-01-27 16:11:24 UTC
Created attachment 319848 [details] [review]
nautilus-window: add a styleclass

I added a more in-depth explanation in the commit message.
Comment 18 Carlos Soriano 2016-01-27 18:12:09 UTC
(In reply to horst3180 from comment #16)
> (In reply to Carlos Soriano from comment #15)
> > Review of attachment 319815 [details] [review] [review] [review]:
> > 
> > and the css change? is not here.
> > Also, provide a better commit message, why we need these changes etc.
> 
> This patch is meant to give themes that are not Adwaita a way to add styling
> that specifically targets Nautilus. Adwaita.css doesn't need any
> modifications.
> 
> So the css change, i.e. changing the NautilusWindow selector to
> .nautilus-window, needs to happen in third party themes.

Ah now I get your comment 0 in the bug report.

However, why would a theme provide some specific styling in nautilus window?

Anyway, I'm fine with it. But add a comment to that line, if not I will probably remove it on the future for being unused :)

Something like:
/* Allow third party themes to match nautilus windows specifically to provide different styling to nautilus than other gtk+ applications. This was a request by some theme authors */

With a good indentation etc.

Otherwise looks good.
Comment 19 horst3180 2016-01-27 18:23:32 UTC
Created attachment 319871 [details] [review]
nautilus-window: add a styleclass

Okay, thanks. I added a comment.
Comment 20 horst3180 2016-01-27 18:28:40 UTC
Created attachment 319872 [details] [review]
nautilus-window: add a styleclass

Sorry, I used the wrong comment style. Should be fine now.
Comment 21 Carlos Soriano 2016-01-27 18:29:00 UTC
Review of attachment 319871 [details] [review]:

::: src/nautilus-window.c
@@ +2445,3 @@
+	/* Allow third party themes to match nautilus windows to provide
+	specific styling for nautilus without affecting other gtk+ applications.
+	This was a request by some theme authors */

one nitpick: when I said good indentation etc I mean the format as well. Looks how is done in other multiline comments. I cannot format it correctly on bugzilla.

Feel free to commit with that fixed. (do you have gnome git rights access?)
Comment 22 Carlos Soriano 2016-01-27 18:30:27 UTC
Review of attachment 319872 [details] [review]:

aha! you realized it :)

Now looks fine.

Thanks for the patches!
Comment 23 horst3180 2016-01-27 18:51:07 UTC
No, I don't have access to gnome git.
Comment 24 Carlos Soriano 2016-01-28 09:42:54 UTC
Pushed to master

Attachment 319813 [details] pushed as c3555a5 - nautilus-list-view: add a styleclass
Attachment 319814 [details] pushed as af40f7b - css: update button selector
Attachment 319872 [details] pushed as 87193d7 - nautilus-window: add a styleclass