GTK3 on Msys2, deprecated icons removed? - gtk3

The Problem
Hello,
At my job we are developing a GTK3 application using PyGObject. As we (unfortunately) have to use Windows on our workstations, we are using Msys2+MinGW64 to have access to usual Linux libraries and shells.
Recently, after an Msys update that upgraded package mingw-w64-x86_64-adwaita-icon-theme from version 40.0-1 to 42.0-1, some icons we are using have disappeared, and warnings such as the following popped up all over the place:
(app.py:28152): Gtk-WARNING **: 14:15:37.369: Error loading theme icon 'view-refresh' for stock: Icon 'view-refresh' not present in theme Adwaita
What I have tried
I searched for the missing icons (e.g. view-refresh.png in the Adwaita icon directory, and sure enough, they were removed between the old and the new version.
The pieces of code that ran into this problem are all using the Gtk.STOCK_**** symbolic names which have been depreacted since Gtk 3.10, with the GTK documentation suggesting to use literal icon names instead. So, for example, I replaced the following code:
button = Gtk.Button()
button.set_image(Gtk.image_new_from_stock(Gtk.STOCK_REFRESH, Gtk.IconSize.SMALL_TOOLBAR))
With:
button = Gtk.Button()
button.set_image(Gtk.Image.new_from_icon_name("view-refresh", Gtk.IconSize.SMALL_TOOLBAR))
... but it kind of feels like a step backwards. Is there any cleaner way to implement this?

Related

Eclipse toolbar middle alignment (GTK related)

Installed fresh installation of Eclipse on centos.
After restarting suddenly all buttons are aligned middle instead of left.
Where is the setting to change that?
Eclipse version 4.16.0
Build id 20200615-1200
Edit: seem to be a GTK problem, I managed to find those settings in gtk inspector using ctrl+shift+D and change the toolbar elements to GTK_ALIGN_START, and that fixes it.
But no idea why it's like that to begin with? All my other apps works, and all use GTK_ALIGN_FILL, only eclipse is like that.
Also new eclipse installation doesn't help.
Any way to change all gtk aligns for a program and save?

Mouse over in CommanNavigator

In eclipse shrink size of the Package explorer view.
Then keep the mouse over the packages then you can see a tool tip will show the entire package name. I am doing all these things in Winsows OS.
Do the same thing in Ubuntu OS tool tip is not showing. why?
Why i am asking this:
In my product i have created a package explorer view using CommonNavigator. this explorer is showing tool tip in Windows not in Ubuntu. i want to show tool tip in Ubuntu as well.
Note:I don't want to extend the CommonNavigator class.
This tool tip is done by the native code that SWT uses to draws the tree. On some platforms the native code show the tool tip, on others it doesn't. There isn't anything in the tree API to control this.

How to get native windows decorations on GTK3 on Windows 7+ and MSYS2

I am trying to port my application from linux to windows and I have a problem with theming. In linux this works out of a box, just compile it and application is using good theme and looks native.
I have installed gtkmm3 and gtk3 in MSYS2 and I am building it with CMake. This is OK, I had to copy all dlls to directory with binary to be able to execute it. I did not copy anything else. I am trying to create "unzip and execute" package.
My problem is, that application looks out of place. It does not look native at all. There are shadows around the window, which is fine in Windows10, but in Windows 7 it looks not native. Also several icons are missing.
Even gitk3-demo looks non-native in the same way (but it has at least the minimize/maximize/close icons correct).
So the question is: How can I achieve native look of GTK3 application on Windows? Or at least native window decorations?
Thanks
Thera are two sub-problems: missing icons and setting right theme.
Missing icons
For missing icons it was enough to copy these icons
window-close-symbolic.symbolic.png
window-maximize-symbolic.symbolic.png
window-minimize-symbolic.symbolic.png
from: C:\msys64\mingw32\share\icons\Adwaita\22x22\actions
to: "your executable folder"\share\icons\Adwaita\22x22\actions
Theme
Using win32 native theme
There is actually a built-in native-like theme in GTK3. For using native-like theme just create file "your executable folder"\etc\gtk-3.0\settings.ini with this in it
[Settings]
gtk-theme-name=win32
win32 theme is built in into GTK3 and only three icons from previous step seems to be needed.
On windows 7 this looks as following:
The problem is, that the decorations looks the same even on Windows 10 (including window decorations).
From comment from #andlabs : GTK+ 3 uses the uxtheme.dll APIs to get its Windows look and feel, and unfortunately Microsoft has kept those Windows 7-like for window borders. (more in comments)
You can see Windows 10 Gtk3 application with win32 theme here:
Using non default theme
And if you are not happy with default or win32 theme, you can use custom themes (like this Flat-Pat) from the internet. :) In order to do it you need to create config file:
"your executable folder"\etc\gtk-3.0\settings.ini with this in it
[Settings]
gtk-theme-name=Flat-Plat
and you need to copy the theme files to directory in path of your executable
"your executable folder"\share\themes\Flat-Plat
in that folder, the index.theme file and gtk-x.x folders should be present. Obviously gtk-theme-name and folder name should match.
After you run the executable you should be able to get different theme.
EDIT: So there is a win32 theme built-in, thank you #andlabs
EDIT2: Added screenshots
EDIT3: Added Windows 10 screenshot and corrected facts.
You can set GTK_CSD=0 environment variable to disable client-side window decorations and enable Windows native decorations, which gets rid of the ugly win7-like titlebar, as well as Adwaita-like one.
Actually, Gtk+3 been compatible with Windows 10 and you can use the native windows theme by making this your default theme.
gtk-theme-name = MS-Windows
For people like me who use (activestate) perl, the /share and /etc need to be placed one directory above the perl.exe (say in C:\Perl64 if perl.exe is in C:\Perl64\bin).
While GTK_CSD=0 is doing a fine job for windows frame icons, it seams that default Drag-And-Drop (DND) icons are missing too.
Dragging GtkEntry or GtkTreeView contents shows a drag-icon.
I've prepared a button as drag source under Gtk+-3.24.4. When dragging the button, the mouse cursor disappears and no drag icon is shown.
When using gtk_drag_source_set_icon_pixbuf(bt, pixbuf), the pixbuf appears as drag icon. But doing it this way is only half the job done, because move/copy indicators are missing on the icon.

Issue with editor highlighting in Eclipse

I have an issue after switching to running Ubuntu when developing instead of Windows.
When I ran Eclipse in Windows, I could find the software market thing and get good and easy-to-use color themes from there to install. Since I couldn't find anything of this on my Ubuntu version, I decided to edit it all manually.
Here is my issue: I was able to adjust the color of the 'mark occurrences'-function that highlights all the all the places where a code piece occurs, but my program does something else to the place where variables are first declared. I took a simple screen shot that displays the problem:
http://www.freeimagehosting.net/19e90
When I disable 'mark occurrences', the super-bright highlighting on variable declarations do not go away, so it's not part of the same setting. I also can't find where I change the color of this, because it's quite annoying not to be able to read what's written due to the coloring of that highlight.
Do you know how I can disable this extra-marking of declarations? Or at least change the color of it? I can't find anything when googling it, but maybe I'm just searching for the wrong things.
Thanks in advance and sorry for this very long post!
I would recommend installing a new version of Eclipse on Ubuntu.
I'm developing on Kubuntu and have no issues. Make sure you delete all previous settings before reinstalling. Default settings should have them enabled.

Why are eclipse views sometimes empty?

I have to use eclipse 3.1. I'm using it in an Ubuntu 11.04 VM (VMWare). It seems that every view I use is initially blank/empty until I close and reopen it. This is annoying but I can deal with it.
The problem is this trick doesn't work with the view for source code files.
Has anyone ever seen a similar issue? Are there any work-arounds?
I don't know if it is related. But the main menu is also initially missing. If I resize the application window, the main menu reappears.
This is a known issue with newer Linux desktops when using older versions of Eclipse.
The GTK widget set changed the default way it renders widgets. This causes versions of Eclipse that were compiled against the old GTK library to experience empty views like you saw as well as problems with ignoring some mouse clicks on buttons.
If you set this environment variable before launching Workbench then it should resolve the problem:
export GDK_NATIVE_WINDOWS=1
I verified this on Ubuntu 11.04 with Workbench 2.6 and the problem went away after I set the variable.
Best regards,
Rob