Re: MidgardConnection (Was: [midgard-cvs] CVS update: /midgard/src/core/midgard/midgard/)

Piotras <pp-VVDi8QVAvoBWk0Htik3J/[email protected]> Mon, 6 Mar 2006 11:19:54 +0100
Newsgroups gmane.comp.web.midgard.devel
Message-ID <[email protected]>
"Jukka Zitting" <[email protected]> wrote:

> Hi,

Hi,
 
> > I would like to propose a simple convention.
> > What's GObject in core is designed for language binding, while what isn't GObject
> > should be used only in core.
> 
> I wouldn't be that strict. Use what best suits the requirements. Using
> GObjects is no magic dust to make language bindings easy, GObjects
> just provide a standard set of features 

Yes, and thus we should provide Midgard standards.

>(properties, signals, data
> attachments, inheritance, introspection, etc.) that is well supported
> in a variety of environments. Using GObjects for stuff that doesn't
> need those features (for example MidgardConnection doesn't really need
> generic properties or introspection, but signals and data attachments
> might be nice) is just extra work.

MidgardConnection has no properties , and that part of GObject code requires 
much work. The rest must be written anyway. 
midgard_connection_close may be replaced with g_object_unref then without 
any need to provide another API function. 

MidgardConfig has plenty of properties instead,  but my point is that it should be 
easier to maintain in a long run. As Apache related structure's member and as 
future tools like datagard written in PHP or maybe perl. 
 
> > > a) use g_log_set_default_handler() to handle log messages from
> > > *all* log domains, or
> >
> > Yeah, but this is GLib 2.6 :/
> 
> You're already using it in src/config.c. In any case we shouldn't be
> using either of the g_log_set functions in midgard-core. If an
> application wants to use g_log_set_default_handler(), it should
> require GLib 2.6.

damn me...
 
> > OK, help me with real issue now.
> > While you use repligard in HEAD you use "repligard" G_LOG_DOMAIN , while core
> > has "midgard-core" and "midgard-lib" defined.
> > What should I do to make core "silent"  instead of logging *everything* ?
> > Without g_log_set_default_handler().
> 
> Simple mechanism to silence midgard-core:
> 
>     static void null_log_handler(
>                     const gchar *domain, GLogLevelFlags log_level,
>                     const gchar *message, gpointer data) {
>             /* do nothing */
>     }
> 
>     g_log_set_handler(
>             MIDGARD_LOG_HANDLER, G_LOG_LEVEL_MASK,
>             null_log_handler, NULL);

That doesn't work :/ 
Or I missed some little detail :/
 
> We should replace all explicit "midgard-lib" and "midgard-core" log
> domains strings in midgard-core with G_LOG_DOMAIN.

What about "repligard" domain?
 
> > Coming back to lang and sitegroup GValues issue.
> > What do you think about such changes:
> > extern void midgard_connection_sitegroup_set(MidgardConnection *mgd, GValue *value);
> > to
> > extern void midgard_connection_sitegroup_set(MidgardConnection *mgd, MidgardSitegroup *sitegroup);
> > and similiar:
> > extern gboolean midgard_connection_set_lang(MidgardConnection *connection, MidgardLanguage *language);
> 
> Depends on what MidgardSitegroup and MidgardLanguage are...

GObjects. My point is still the same. Implement API which may be used in 1.8.x and in 1.9/2.0.

Piotras