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 屬於信號獲取,可以放在需要的類裏