g_object_notify的使用方法

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章