/** * go_combo_popup_reparent * @popup: Popup * @new_parent: New parent * @unrealize: Unrealize popup if TRUE. * * Reparent the popup, taking care of the refcounting * * Compare with gtk_menu_reparent in gtk/gtkmenu.c */ static void go_combo_popup_reparent (GtkWidget *popup, GtkWidget *new_parent, gboolean unrealize) { #if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14) gboolean was_floating = g_object_is_floating (popup); g_object_ref_sink (popup); #else gboolean was_floating = GTK_OBJECT_FLOATING (popup); g_object_ref (popup); gtk_object_sink (GTK_OBJECT (popup)); #endif if (unrealize) { g_object_ref (popup); gtk_container_remove (GTK_CONTAINER (popup->parent), popup); gtk_container_add (GTK_CONTAINER (new_parent), popup); g_object_unref (popup); } else gtk_widget_reparent (GTK_WIDGET (popup), new_parent); gtk_widget_set_size_request (new_parent, -1, -1); if (was_floating) { #if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14) g_object_force_floating (G_OBJECT (popup)); #else GTK_OBJECT_SET_FLAGS (GTK_OBJECT (popup), GTK_FLOATING); #endif } else g_object_unref (popup); }
static void object_new(lua_State* L, gpointer ptr, gboolean constructor) { lua_pushliteral(L, "lgobObjectNew"); lua_rawget(L, LUA_REGISTRYINDEX); lua_pushlightuserdata(L, ptr); #if GLIB_MINOR_VERSION >= 10 lua_pushboolean(L, constructor); #else g_object_ref(ptr); if( GTK_IS_OBJECT(ptr) && GTK_OBJECT_FLOATING(ptr) ) { lua_pushboolean(L, FALSE); gtk_object_sink(ptr); } else { lua_pushboolean(L, constructor); } #endif lua_call(L, 2, 1); }