我想更改我的C/gtk +应用程序的主窗口的标题。我有代码:更改窗口标题 - 'GTK_IS_WINDOW(窗口)'失败
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(窗口)”失败
有什么不对?
谢谢。