我試圖添加一個關於對話框到我的下一個教程代碼,但我無法得到圖標加載出於某種原因。以下是創建和顯示對話框的全部功能。GtkAboutDialog圖標未加載?
static void help_clicked(GtkButton *button, GtkWindow *window)
{
const gchar *authors[] = { "me", NULL };
const gchar *license = "somestuff";
GdkPixbuf *logo = gdk_pixbuf_new_from_file("logo.png", NULL);
gtk_show_about_dialog(window,
"authors", authors, "license", license, "license-type", GTK_LICENSE_CUSTOM,
"logo", logo, "logo-icon-name", "Logo Icon",
"program-name", "Chapter 6, Exercise 1",
"version", "1.0",
"comments", "This is just an exercise from Chapter 6 of the book I'm reading.",
"website", "http://www.google.com", "website-label", "Application Homepage",
"copyright", "(C) 2014 Patrick Meyer",
"wrap-license", TRUE, NULL);
}
這會導致一個關於對話框,每個屬性都成功設置,除了圖標。
奇怪的是,當我將它提供給gtk_window_set_icon()
時,與gdk_pixbuf_new_from_file()
完全相同的呼叫在main()
中工作。這是一個帶有logo.png
的單文件程序,位於執行目錄中。少了什麼東西?