【问题标题】:Why doesn't IconTheme resource path get listed on get_search_path为什么 IconTheme 资源路径未在 get_search_path 上列出
【发布时间】:2020-08-27 18:54:07
【问题描述】:

在 Gtk::IconTheme 的 GTKMM 参考文档中,add_resource_path() 部分说

void Gtk::IconTheme::add_resource_path ( const std::string & path )

添加在查找图标时将查看的资源路径, 类似于搜索路径。

这个函数应该用于制作特定于应用程序的图标 可作为图标主题的一部分。

资源被视为 hicolor 图标主题的一部分,并且 必须位于在 hicolor 图标中定义的子目录中 主题,例如@a path/16x16/actions/run.png。直接的图标 放置在资源路径而不是子目录中也 被视为最终后备。

自 gtkmm 3.14:

参数

       path 资源路径。

我为此创建了一个变量,下面是我的示例代码:

Glib::RefPtr<Gtk::IconTheme> window_icon_theme = Gtk::IconTheme::create();
window_icon_theme->add_resource_path("/home/keyikedalube/Source/basic-calc/icons")

// get the path lists
std::vector<Glib::ustring> path_lists = window_icon_theme->get_search_path();
for (auto i : path_lists)
        std::cout << i << endl;

输出产量:

/home/keyikedalube/.local/share/icons
/home/keyikedalube/.icons
/usr/share/xfce4/icons
/home/keyikedalube/.local/share/flatpak/exports/share/icons
/var/lib/flatpak/exports/share/icons
/usr/local/share/icons
/usr/share/icons
/usr/share/icons
/usr/share/xfce4/pixmaps
/home/keyikedalube/.local/share/flatpak/exports/share/pixmaps
/var/lib/flatpak/exports/share/pixmaps
/usr/local/share/pixmaps
/usr/share/pixmaps
/usr/share/pixmaps

我的资源路径/home/keyikedalube/Source/basic-calc/icons 没有出现在列表中

我错过了什么?

【问题讨论】:

    标签: c++ gtkmm3


    【解决方案1】:

    引用“资源”路径的 API 指的是 GResources 内部的路径,而不是文件系统上的路径。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-12
      • 2023-03-18
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 2019-05-06
      相关资源
      最近更新 更多