在MS Windows中运行时缺少gtk +图标 [英] Gtk+ icon missing when running in MS Windows

查看:262
本文介绍了在MS Windows中运行时缺少gtk +图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Ubuntu上开发的C / GTK +应用程序,我想对其进行交叉编译,使其可以在MS Windows上运行。



我关注了


I have a C/GTK+ application developed on Ubuntu, and I want to cross-compile it so that it runs on MS Windows.

I followed this guide to set up the compiler, and the program was compiled successfully, and it runs on MS Windows.

However, the icons on a Search Entry were missing.

This is what I get when I'm on Ubuntu:

This is what I get when I run the program in MS Windows (or Wine):

In addition, the terminal shows the following:

(main.exe:8): Gtk-WARNING **: Could not find the icon 'edit-find-symbolic'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
    http://icon-theme.freedesktop.org/releases

Question: Is it possible to have the icons showing up in Windows, without the need to install anything on the Windows box? My application aims at being able to run from a USB flash drive without installing anything.

The relevant part of the Glade file I used to create the application, in case it's useful:

          <object class="GtkSearchEntry" id="searchentry1">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="primary_icon_name">edit-find-symbolic</property>
            <property name="primary_icon_activatable">False</property>
            <property name="primary_icon_sensitive">False</property>
          </object>

Things I've tried so far: copying edit-find-symbolic.svg to the directory containing main.exe (i.e. together with the dlls); copying the whole directory /usr/share/icons/gnome there. None of these worked.


Update:

In the directory containing main.exe I added a subdirectory share, and in it another subdirectory icons. I placed edit-find-symbolic.svg in this subdirectory. The search icon still looks the same (doesn't work), but the terminal output this time is different:

(main.exe:8): GLib-GIO-CRITICAL **: g_loadable_icon_load: assertion `G_IS_LOADABLE_ICON (icon)' failed

If edit-find-symbolic.svg is not present in this folder, but a folder named hicolor is present, the icon still doesn't work, and this time there isn't any output in the terminal at all.

解决方案

This is a late reply but I encountered this issue and I have solved it with the following steps:

SVG icons of the default theme (adwaita) needs to be copyed to a share directory relative to the bin directory bin../share/icons/Adwaita/scalable/* also bin../share/icons/Adwaita/icon-theme.cache and bin../share/icons/Adwaita/index.theme

After several test, it appears that the following files are also required:

lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll
lib/gdk-pixbuf-2.0/2.10.0/loaders/loaders.cache

The first line of this loaders.cache file also needs to be edited to "../lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll"

The file tree looks like this:

bin/gtkapplication.exe
bin/*.dll
share/loader.cache
share/glib-2.0/gschemas.compiled
share/icons/Adwaita/scalable/*
share/icons/Adwaita/icon-theme.cache
share/icons/Adwaita/index.theme
lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll
lib/gdk-pixbuf-2.0/2.10.0/loaders/loaders.cache

Most up-to-date repository containing GTK+3 Runtime files for Windows (as of 5-23-2019): https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer

这篇关于在MS Windows中运行时缺少gtk +图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆