据说,在更新天气信息后,libgweather会发出“更新”信号: https://developer.gnome.org/libgweather/stable/GWeatherInfo.html#GWeatherInfo-updated
我无法解决这个问题。当然,我对GTK编程很陌生,所以我可能会遗漏一些明显的东西。这是我的代码:
#include <libgweather/gweather.h>
static void update_finish(GWeatherInfo *info, gpointer data)
{
printf("update finished\n");
}
int main (int argc, char *argv[])
{
GWeatherInfo *info;
gtk_init (&argc, &argv);
info = gweather_info_new(NULL,GWEATHER_FORECAST_ZONE);
g_signal_connect(info, "updated", G_CALLBACK(update_finish), NULL);
gtk_main ();
return 0;
}
似乎永远不会调用update_finish()
函数。有什么建议吗?