我正在尝试在窗口的标题栏中显示我的图标。该程序编译并运行良好,但该图标仅显示在启动器中。
这是我的主要功能:
int main(int argc, char * argv[])
{
GtkWidget * window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "My Window");
gtk_window_set_default_size(GTK_WINDOW(window), 600, 600);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_icon_from_file(GTK_WINDOW(window), "img/icon.png", NULL);
gtk_widget_show(window);
g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_main();
return 0;
}
提前感谢您的帮助。