![]() | ![]() | ![]() | Libmergeant Reference Manual | ![]() |
---|
MgBaseMgBase — The base class for many of the library'objects |
MgBase; guint mg_base_get_type (void); GObject* mg_base_new (void); void mg_base_set_conf (MgBase *base, MgConf *conf); MgConf* mg_base_get_conf (MgBase *base); void mg_base_set_id (MgBase *base, guint id); void mg_base_set_name (MgBase *base, const gchar *name); void mg_base_set_description (MgBase *base, const gchar *descr); void mg_base_set_owner (MgBase *base, const gchar *owner); guint mg_base_get_id (MgBase *base); const gchar* mg_base_get_name (MgBase *base); const gchar* mg_base_get_description (MgBase *base); const gchar* mg_base_get_owner (MgBase *base); void mg_base_nullify (MgBase *base); void mg_base_nullify_check (MgBase *base); void mg_base_changed (MgBase *base); void mg_base_block_changed (MgBase *base); void mg_base_unblock_changed (MgBase *base); void mg_base_dump (MgBase *base, guint offset);
GObject +----MgBase +----MgCondition +----MgContext +----MgDatabase +----MgDbConstraint +----MgDbField +----MgDbTable +----MgGraphviz +----MgHandlerBoolean +----MgHandlerCidr +----MgHandlerNone +----MgHandlerNumerical +----MgHandlerPassmd5 +----MgHandlerString +----MgHandlerTime +----MgHandlerText +----MgJoin +----MgParameter +----MgQfield +----MgQuery +----MgRefBase +----MgResultSet +----MgServerAggregate +----MgServerDataType +----MgServerFunction +----MgTarget +----MgWorkCore +----MgGraph +----MgGraphItem
"changed" void user_function (MgBase *mgbase, gpointer user_data); "descr-changed" void user_function (MgBase *mgbase, gpointer user_data); "id-changed" void user_function (MgBase *mgbase, gpointer user_data); "name-changed" void user_function (MgBase *mgbase, gpointer user_data); "nullified" void user_function (MgBase *mgbase, gpointer user_data); "owner-changed" void user_function (MgBase *mgbase, gpointer user_data);
This class defines a common behaviour for most of the objects of this library. As the data dictionnary is quite dynamic,
the default way by which GObjects are managed (referenced and unreferenced when not needed anymore using g_object_[un]ref()
)
is not enough: sometimes this behaviour should be kept, and sometimes an object's destruction should be forced and
all the other reference holders of that object should take appropriate actions and drop their reference on that object.
Just an example to illustrate this: suppose a data type has been removed from the database itself, then the corresponding
MgServerDataType must be destroyed since it does not represent a valid data type anymore. MgServerDataType object are all
managed by the corresponding MgServer (it has a reference on them); so the mg_base_nullify()
method is called on that
object which will tell all the other users of that object (MgDbField, MgParameter, etc) to drop their reference on it
(if they had one) and take the appropriate actions (both MgDbField and MgParameter will destroy themselves in the same way).
GObject* mg_base_new (void);
Creates a new MgBase object. This object class is normally not instantiated directly but through child classes objects' intantiation
Returns : | the newly created object |
void mg_base_set_conf (MgBase *base, MgConf *conf);
Sets the MgConf to which base
is attached to. It has no other
action than to store it to easily be able to retreive it.
void mg_base_set_id (MgBase *base, guint id);
Sets the id of the object. The id is set to 0 by default (which means the object does not use the id at all). WARNING: the id is not checked which means no search is made to see if the id is already used
base : | a MgBase object |
id : |
void mg_base_set_name (MgBase *base, const gchar *name);
Sets the name of the MgBase object. If the name is changed, then the "name_changed" signal is emitted.
base : | a MgBase object |
name : |
void mg_base_set_description (MgBase *base, const gchar *descr);
Sets the description of the MgBase object. If the description is changed, then the "descr_changed" signal is emitted.
base : | a MgBase object |
descr : |
void mg_base_set_owner (MgBase *base, const gchar *owner);
Sets the owner of the MgBase object. If the owner is changed, then the "owner_changed" signal is emitted.
base : | a MgBase object |
owner : |
guint mg_base_get_id (MgBase *base);
Fetch the id of the MgBase object.
base : | a MgBase object |
Returns : | the id. |
const gchar* mg_base_get_name (MgBase *base);
Fetch the name of the MgBase object.
base : | a MgBase object |
Returns : | the object's name. |
const gchar* mg_base_get_description (MgBase *base);
Fetch the description of the MgBase object.
base : | a MgBase object |
Returns : | the object's description. |
const gchar* mg_base_get_owner (MgBase *base);
Fetch the owner of the MgBase object.
base : | a MgBase object |
Returns : | the object's owner. |
void mg_base_nullify (MgBase *base);
Force the base
object to be destroyed, even if we don't have a reference on it
(we can't call g_object_unref()
then) and even if the object is referenced
multiple times by other objects.
The "nullified" signal is then emitted to tell the other reference holders that the object
must be destroyed and that they should give back their reference (using g_object_unref()
).
However if a reference is still present, the object will not actually be destroyed and will
still be alive, but its state may not be deterministic.
This is usefull because sometimes objects need to disappear even if they are referenced by other
objects. This usage is the same as with the gtk_widget_destroy()
function on widgets.
base : | a MgBase object |
void mg_base_nullify_check (MgBase *base);
Checks that the object has been nullified, and if not, then calls mg_base_nullify()
on it.
This is usefull for objects inheriting the MGBase object to be called first line in their
dispose()
method.
base : | a MgBase object |
void mg_base_changed (MgBase *base);
Force emission of the "changed" signal, except if mg_base_block_changed()
has
been called.
base : | a MgBase object |
void mg_base_block_changed (MgBase *base);
No "changed" signal will be emitted.
base : | a MgBase object |
void mg_base_unblock_changed (MgBase *base);
The "changed" signal will again be emitted.
base : | a MgBase object |
void mg_base_dump (MgBase *base, guint offset);
Writes a textual description of the object to STDOUT. This function only exists if libergeant is compiled with the "--enable-debug" option. This is a virtual function.
base : | a MgBase object |
offset : | the offset (in caracters) at which the dump will start |
void user_function (MgBase *mgbase, gpointer user_data);
mgbase : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (MgBase *mgbase, gpointer user_data);
mgbase : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (MgBase *mgbase, gpointer user_data);
mgbase : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (MgBase *mgbase, gpointer user_data);
mgbase : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (MgBase *mgbase, gpointer user_data);
mgbase : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
<< Non instantiable objects and widgets | MgEntryShell >> |