我想更改我的C / gtk +应用程序的主窗口的titlie。我有代码:
void update_title(const char *filename, MainWin* mw )
{
GtkButton* btn = gtk_button_new();
static int wid, hei;
static char fname[50];
char buf[100];
if(filename != NULL)
{
strncpy(fname, filename, 49);
wid = gdk_pixbuf_get_width( gtk_image_view_get_pixbuf (GTK_IMAGE_VIEW(aview)) );
hei = gdk_pixbuf_get_height( gtk_image_view_get_pixbuf ( GTK_IMAGE_VIEW(aview)) );
fname[49] = '\0';
}
snprintf(buf, 100, "%s (%dx%d) %d%%", fname, wid, hei, (int)(mw->scale * 100));
gtk_window_set_title(mw, buf);
}
当我尝试调用此函数时,我看到错误: Gtk-CRITICAL **:gtk_window_set_title:断言`GTK_IS_WINDOW(窗口)'失败
怎么了?
谢谢。