Exemplo n.º 1
0
/*! \brief Add a weak reference watcher to an OBJECT.
 * \par Function Description
 * Adds the weak reference callback \a notify_func to \a object.  When
 * \a object is destroyed, \a notify_func will be called with two
 * arguments: the \a object, and the \a user_data.
 *
 * \sa s_object_weak_unref
 *
 * \param [in,out] object     Object to weak-reference.
 * \param [in] notify_func    Weak reference notify function.
 * \param [in] user_data      Data to be passed to \a notify_func.
 */
void
s_object_weak_ref (OBJECT *object,
                   void (*notify_func)(void *, void *),
                   void *user_data)
{
  g_return_if_fail (object != NULL);
  object->weak_refs = s_weakref_add (object->weak_refs, notify_func, user_data);
}
Exemplo n.º 2
0
/*! \brief Add a weak reference watcher to an PAGE.
 * \par Function Description
 * Adds the weak reference callback \a notify_func to \a page.  When
 * \a page is destroyed, \a notify_func will be called with two
 * arguments: the \a page, and the \a user_data.
 *
 * \sa s_page_weak_unref
 *
 * \param [in,out] page       Page to weak-reference.
 * \param [in] notify_func    Weak reference notify function.
 * \param [in] user_data      Data to be passed to \a notify_func.
 */
void
s_page_weak_ref (PAGE *page,
                 void (*notify_func)(void *, void *),
                 void *user_data)
{
  g_return_if_fail (page != NULL);
  page->weak_refs = s_weakref_add (page->weak_refs, notify_func, user_data);
}
Exemplo n.º 3
0
/*! \brief Add a weak reference watcher to an TOPLEVEL.
 * \par Function Description
 * Adds the weak reference callback \a notify_func to \a toplevel.  When
 * \a toplevel is destroyed, \a notify_func will be called with two
 * arguments: the \a toplevel, and the \a user_data.
 *
 * \sa s_toplevel_weak_unref
 *
 * \param [in,out] toplevel   Toplevel to weak-reference.
 * \param [in] notify_func    Weak reference notify function.
 * \param [in] user_data      Data to be passed to \a notify_func.
 */
void
s_toplevel_weak_ref (TOPLEVEL *toplevel,
                     void (*notify_func)(void *, void *),
                     void *user_data)
{
  g_return_if_fail (toplevel != NULL);
  toplevel->weak_refs = s_weakref_add (toplevel->weak_refs,
                                       notify_func, user_data);
}
Exemplo n.º 4
0
/*! \brief Add a weak pointer to a weak ref list.
 * \par Function Description
 * Adds a weak reference for \a weak_pointer_loc to the weak reference
 * list \a weak_refs, returning the new head of \a weak_refs.
 *
 * \param [in,out] weak_refs     List of registered weak references.
 * \param [in] weak_pointer_loc  Memory address of a pointer.
 *
 * \return new head of \a weak_refs list.
 */
GList *
s_weakref_add_ptr (GList *weak_refs, void **weak_pointer_loc)
{
  return s_weakref_add (weak_refs, weak_ptr_notify_func, weak_pointer_loc);
}