g_object_notify的使用方法
0、注册部分
g_object_class_install_property(gobject_class,
PROP_MODAL,
g_param_spec_boolean("modal", P_("Modal"), P_("if true, the window is modal( other windows are not usable while this one is up)"), FALSE, GTK_PARAM_READWRITE)
);
1、emit部分
g_object_notify(G_OBJECT(window), "modal");
// 0,1 两步骤属于属性的注册和信号发射,放在同一个类里。
2. connect部分
g_signal_connect(window, "notify::modal", G_CALLBACK(notify_modal_received), NULL);
3、回调函数
void notify_modal_received(GtkWidget *window, GParamSpec *pspec)
{
printf("notify modal received");
}
// 2,3 属于信号获取,可以放在需要的类里
转自:http://socol.iteye.com/blog/532484