您尚未登录。

#1 2014-03-02 10:11:32

otakuchiyan
宅醬
注册时间: 2014-03-02
帖子: 10
个人网站

關於gtk_image_get_stock沒有匹配的函數

版本仍然停留在gtk2.0,源碼:
void NLUI::GetRoll(GtkImage *i){
  gtk_image_get_stock(i, GTK_IMAGE_EMPTY, 24);
}
clang++編譯給了個note:
/usr/include/gtk-2.0/gtk/gtkimage.h:246:12: note: candidate function not viable: no known conversion from 'GtkImageType' to 'gchar **' (aka 'char **') for 2nd argument
void gtk_image_get_stock (GtkImage *image,
^
我觉得不是参数传错了的问题,毕竟是参考文档照猫画虎的。
嘛最終目的就是給i取得一個圖標。當然是應用的。問題在於SF被某牆擋住了。沒辦法借lxlauncher來照貓畫虎。

离线

#2 2014-03-02 11:45:24

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,384
个人网站

Re: 關於gtk_image_get_stock沒有匹配的函數

void                gtk_image_get_stock                 (GtkImage *image,
                                                         gchar **stock_id,
                                                         GtkIconSize *size);

Gets the stock icon name and size being displayed by the GtkImage. The storage type of the image must be GTK_IMAGE_EMPTY or GTK_IMAGE_STOCK (see gtk_image_get_storage_type()). The returned string is owned by the GtkImage and should not be freed.

image :
    a GtkImage

stock_id :
    place to store a stock icon name, or NULL. [out][transfer none][allow-none]

size :
    place to store a stock icon size, or NULL. [out][allow-none][type int]

所以, gtk_image_get_stock 的第一个参数需要是 GTK_IMAGE_EMPTY 或者 GTK_IMAGE_STOCK 类型,第二个参数是一个用于存放图标名称的 gchar** 指针,或者 NULL,不是 GtkImage 的类型。

另外参见: https://wiki.archlinux.org/index.php/Go … 6%96%87%29

最近编辑记录 依云 (2014-03-02 11:46:02)

离线

#3 2014-03-02 17:59:49

otakuchiyan
宅醬
注册时间: 2014-03-02
帖子: 10
个人网站

Re: 關於gtk_image_get_stock沒有匹配的函數

百合仙子 说:

void                gtk_image_get_stock                 (GtkImage *image,
                                                         gchar **stock_id,
                                                         GtkIconSize *size);

Gets the stock icon name and size being displayed by the GtkImage. The storage type of the image must be GTK_IMAGE_EMPTY or GTK_IMAGE_STOCK (see gtk_image_get_storage_type()). The returned string is owned by the GtkImage and should not be freed.

image :
    a GtkImage

stock_id :
    place to store a stock icon name, or NULL. [out][transfer none][allow-none]

size :
    place to store a stock icon size, or NULL. [out][allow-none][type int]

所以, gtk_image_get_stock 的第一个参数需要是 GTK_IMAGE_EMPTY 或者 GTK_IMAGE_STOCK 类型,第二个参数是一个用于存放图标名称的 gchar** 指针,或者 NULL,不是 GtkImage 的类型。

另外参见: https://wiki.archlinux.org/index.php/Go … 6%96%87%29



不會英語真的很抱歉啦…於是還是多謝了。

离线

页脚