Bug 501665 - Add a property for the current GTK theme being used
Summary: Add a property for the current GTK theme being used
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 4.7 M3   Edit
Assignee: Marc-André Laperle CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2016-09-19 01:20 EDT by Marc-André Laperle CLA
Modified: 2016-09-28 23:43 EDT (History)
3 users (show)

See Also:


Attachments
Screenshot of gtk inspector. (30.30 KB, image/png)
2016-09-19 10:17 EDT, Leo Ufimtsev CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-André Laperle CLA 2016-09-19 01:20:39 EDT
Sometimes, it would be useful to know which GTK theme is used during an Eclipse session for troubleshooting purposes. For example, when running tests remotely or when helping someone who doesn't know which theme is used, etc. 
This could be similar to org.eclipse.swt.internal.gtk.version. I suggest org.eclipse.swt.internal.gtk.theme. I think all the native hooks are there already because I can see the name of the theme being retrieved in Display.gtk_css_default_theme_values. Let me know if you think that's a acceptable idea and if so, I'll start working on a patch!
Comment 1 Andrey Loskutov CLA 2016-09-19 01:30:07 EDT
I'm not SWT committer, but I think this is great idea because we always have trouble to understand what user is running. I wondering if we can made those properties even more prominent in the about dialog.
Comment 2 Leo Ufimtsev CLA 2016-09-19 10:17:19 EDT
Just as an FYI:
You can enable gtk inspector:
https://wiki.gnome.org/Projects/GTK+/Inspector

gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true

Then open GTK inspector via ctrl+shift+i, 
then you can see which theme is used on any gtk3 application in the 'visual' tab.
Comment 3 Leo Ufimtsev CLA 2016-09-19 10:17:43 EDT
Created attachment 264254 [details]
Screenshot of gtk inspector.
Comment 4 Marc-André Laperle CLA 2016-09-19 10:24:29 EDT
(In reply to Leo Ufimtsev from comment #2)
> Just as an FYI:
> You can enable gtk inspector:
> https://wiki.gnome.org/Projects/GTK+/Inspector
> 
> gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true
> 
> Then open GTK inspector via ctrl+shift+i, 
> then you can see which theme is used on any gtk3 application in the 'visual'
> tab.

That's quite useful, thanks! I'm thinking the property is still useful for builds that no one interacts with and people using older GTKs. It's also nice to ask for the "Configuration" output of a user and see the versions, theme, etc.
Comment 5 Leo Ufimtsev CLA 2016-09-19 10:30:22 EDT
(In reply to Marc-Andre Laperle from comment #4)
> (In reply to Leo Ufimtsev from comment #2)
> > Just as an FYI:
> > You can enable gtk inspector:
> > https://wiki.gnome.org/Projects/GTK+/Inspector
> > 
> > gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true
> > 
> > Then open GTK inspector via ctrl+shift+i, 
> > then you can see which theme is used on any gtk3 application in the 'visual'
> > tab.
> 
> That's quite useful, thanks! I'm thinking the property is still useful for
> builds that no one interacts with and people using older GTKs. It's also
> nice to ask for the "Configuration" output of a user and see the versions,
> theme, etc.

+1. Yea, I agree, having the property in the logs would be very useful.
Comment 6 Eclipse Genie CLA 2016-09-19 11:10:41 EDT
New Gerrit change created: https://git.eclipse.org/r/81356
Comment 8 Alexander Kurtakov CLA 2016-09-19 11:53:28 EDT
Thanks for the patch. Pushed.
Comment 9 Marc-André Laperle CLA 2016-09-19 12:00:48 EDT
(In reply to Alexander Kurtakov from comment #8)
> Thanks for the patch. Pushed.

So fast! Thank you!
Comment 10 Andrey Loskutov CLA 2016-09-19 12:14:42 EDT
schouldn't we add some notes to the N&N section for M3 and to the swt wiki?
Comment 11 Marc-André Laperle CLA 2016-09-19 12:48:33 EDT
(In reply to Andrey Loskutov from comment #10)
> schouldn't we add some notes to the N&N section for M3 and to the swt wiki?

I can do that, where is it located? I couldn't find it.
Comment 12 Marc-André Laperle CLA 2016-09-19 14:22:52 EDT
Uh, I get this error now when starting a UI test. Any hint of what could be wrong?
(process:17052): GLib-GObject-CRITICAL **: g_object_get: assertion 'G_IS_OBJECT (object)' failed

Calling gtk_settings_get_default too soon perhaps?
Comment 13 Eclipse Genie CLA 2016-09-20 03:33:06 EDT
New Gerrit change created: https://git.eclipse.org/r/81411
Comment 15 Alexander Kurtakov CLA 2016-09-20 03:38:18 EDT
(In reply to Marc-Andre Laperle from comment #12)
> Uh, I get this error now when starting a UI test. Any hint of what could be
> wrong?
> (process:17052): GLib-GObject-CRITICAL **: g_object_get: assertion
> 'G_IS_OBJECT (object)' failed
> 
> Calling gtk_settings_get_default too soon perhaps?

Fixed with the additional commit. In short gtk_* functions (except for few) have to be called only after gtk_init_check is called so I moved to registration of the system property after init.
Comment 16 Marc-André Laperle CLA 2016-09-20 10:21:32 EDT
(In reply to Alexander Kurtakov from comment #15)
> (In reply to Marc-Andre Laperle from comment #12)
> > Uh, I get this error now when starting a UI test. Any hint of what could be
> > wrong?
> > (process:17052): GLib-GObject-CRITICAL **: g_object_get: assertion
> > 'G_IS_OBJECT (object)' failed
> > 
> > Calling gtk_settings_get_default too soon perhaps?
> 
> Fixed with the additional commit. In short gtk_* functions (except for few)
> have to be called only after gtk_init_check is called so I moved to
> registration of the system property after init.

Makes perfect sense. Thanks for the quick fix! I tested it and it works well in all situations from what I can tell.
Comment 17 Marc-André Laperle CLA 2016-09-20 10:33:16 EDT
Would it be OK to cherry-pick this to 4.6?
Comment 18 Marc-André Laperle CLA 2016-09-28 23:43:05 EDT
(In reply to Andrey Loskutov from comment #10)
> schouldn't we add some notes to the N&N section for M3 and to the swt wiki?

https://git.eclipse.org/r/#/c/82129/