Logo Search packages:      
Sourcecode: gnome-compiz-manager version File versions

gcm-plugin.c

/* Generated by GOB (v2.0.14)   (do not edit directly) */

/* End world hunger, donate to the World Food Programme, http://www.wfp.org */

#define GOB_VERSION_MAJOR 2
#define GOB_VERSION_MINOR 0
#define GOB_VERSION_PATCHLEVEL 14

#define selfp (self->_priv)

#include <string.h> /* memset() */

#include "gcm-plugin.h"

#ifdef G_LIKELY
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
#else /* ! G_LIKELY */
#define ___GOB_LIKELY(expr) (expr)
#define ___GOB_UNLIKELY(expr) (expr)
#endif /* G_LIKELY */

#line 63 "gcm-plugin.gob"

#define PLUGIN_SECTION "Gnome Compiz Manager Plugin"

#line 28 "gcm-plugin.c"
/* self casting macros */
#define SELF(x) GCM_PLUGIN(x)
#define SELF_CONST(x) GCM_PLUGIN_CONST(x)
#define IS_SELF(x) GCM_IS_PLUGIN(x)
#define TYPE_SELF GCM_TYPE_PLUGIN
#define SELF_CLASS(x) GCM_PLUGIN_CLASS(x)

#define SELF_GET_CLASS(x) GCM_PLUGIN_GET_CLASS(x)

/* self typedefs */
typedef GCMPlugin Self;
typedef GCMPluginClass SelfClass;

struct _GCMPluginPrivate {
#line 79 "gcm-plugin.gob"
      gchar * filename;
#line 81 "gcm-plugin.gob"
      GModule * module;
#line 85 "gcm-plugin.gob"
      GCMPluginGetType get_type;
#line 49 "gcm-plugin.c"
};
/* here are local prototypes */
static void gcm_plugin_init (GCMPlugin * o) G_GNUC_UNUSED;
static void gcm_plugin_class_init (GCMPluginClass * c) G_GNUC_UNUSED;
static gboolean ___2_gcm_plugin_load (GTypeModule * module) G_GNUC_UNUSED;
static void ___3_gcm_plugin_unload (GTypeModule * module) G_GNUC_UNUSED;

/* pointer to the class of our parent */
static GTypeModuleClass *parent_class = NULL;

/* Short form macros */
#define self_new gcm_plugin_new
#define self_get_type_object gcm_plugin_get_type_object
GType
gcm_plugin_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (GCMPluginClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) gcm_plugin_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (GCMPlugin),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) gcm_plugin_init,
                  NULL
            };

            type = g_type_register_static (G_TYPE_TYPE_MODULE, "GCMPlugin", &info, (GTypeFlags)0);
      }

      return type;
}

/* a macro for creating a new object of our type */
#define GET_NEW ((GCMPlugin *)g_object_new(gcm_plugin_get_type(), NULL))

/* a function for creating a new object of our type */
#include <stdarg.h>
static GCMPlugin * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
static GCMPlugin *
GET_NEW_VARG (const char *first, ...)
{
      GCMPlugin *ret;
      va_list ap;
      va_start (ap, first);
      ret = (GCMPlugin *)g_object_new_valist (gcm_plugin_get_type (), first, ap);
      va_end (ap);
      return ret;
}


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "GCM:Plugin::finalize"
      GCMPlugin *self G_GNUC_UNUSED = GCM_PLUGIN (obj_self);
      gpointer priv G_GNUC_UNUSED = self->_priv;
      if(G_OBJECT_CLASS(parent_class)->finalize) \
            (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
#line 70 "gcm-plugin.gob"
      if(self->name) { g_free ((gpointer) self->name); self->name = NULL; }
#line 116 "gcm-plugin.c"
#line 72 "gcm-plugin.gob"
      if(self->label) { g_free ((gpointer) self->label); self->label = NULL; }
#line 119 "gcm-plugin.c"
#line 74 "gcm-plugin.gob"
      if(self->description) { g_free ((gpointer) self->description); self->description = NULL; }
#line 122 "gcm-plugin.c"
#line 76 "gcm-plugin.gob"
      if(self->gl_plugins) { g_strfreev ((gpointer) self->gl_plugins); self->gl_plugins = NULL; }
#line 125 "gcm-plugin.c"
#line 80 "gcm-plugin.gob"
      if(self->_priv->filename) { g_free ((gpointer) self->_priv->filename); self->_priv->filename = NULL; }
#line 128 "gcm-plugin.c"
#define module (self->_priv->module)
#define VAR module
      {
#line 82 "gcm-plugin.gob"
      
                  g_type_module_unuse(G_TYPE_MODULE(self));
            }
#line 136 "gcm-plugin.c"
      memset(&module, 0, sizeof(module));
#undef VAR
#undef module
}
#undef __GOB_FUNCTION__

static void 
gcm_plugin_init (GCMPlugin * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:Plugin::init"
      o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,GCM_TYPE_PLUGIN,GCMPluginPrivate);
}
#undef __GOB_FUNCTION__
static void 
gcm_plugin_class_init (GCMPluginClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:Plugin::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;
      GTypeModuleClass *g_type_module_class = (GTypeModuleClass *)c;

      g_type_class_add_private(c,sizeof(GCMPluginPrivate));

      parent_class = g_type_class_ref (G_TYPE_TYPE_MODULE);

#line 138 "gcm-plugin.gob"
      g_type_module_class->load = ___2_gcm_plugin_load;
#line 160 "gcm-plugin.gob"
      g_type_module_class->unload = ___3_gcm_plugin_unload;
#line 165 "gcm-plugin.c"
      g_object_class->finalize = ___finalize;
}
#undef __GOB_FUNCTION__



#line 87 "gcm-plugin.gob"
GCMPlugin * 
gcm_plugin_new (gchar * filename)
#line 175 "gcm-plugin.c"
{
#define __GOB_FUNCTION__ "GCM:Plugin::new"
#line 87 "gcm-plugin.gob"
      g_return_val_if_fail (filename != NULL, (GCMPlugin * )NULL);
#line 180 "gcm-plugin.c"
{
#line 89 "gcm-plugin.gob"
      
            GCMPlugin * self = GET_NEW;
            GKeyFile * plugin_file = g_key_file_new();
            gint cpt;
            
            /* Load plugin configuration file */
            if (!g_key_file_load_from_file(plugin_file, filename, G_KEY_FILE_NONE, NULL))
            {
                  g_warning("Error on load %s", filename);
                  g_object_unref(self);
                  return NULL;
            }
            
            /* Get plugin name */
            if ((self->name = g_key_file_get_string(plugin_file, PLUGIN_SECTION,
                                                                        "Plugin", NULL)) == NULL)
            {
                  g_warning("Error on get plugin name in %s", filename);
                  g_object_unref(self);
                  return NULL;
            }
            for (cpt = 0; self->name[cpt];  cpt++)
            {
                  if (self->name[cpt] == '-')
                        self->name[cpt] = '_';
            }
            g_type_module_set_name(G_TYPE_MODULE(self), self->name);
            
            /* Get Label */
            self->label = g_key_file_get_locale_string(plugin_file, PLUGIN_SECTION,
                                                                           "Name", NULL, NULL);
            
            /* Get description */
            self->description = g_key_file_get_locale_string(plugin_file, PLUGIN_SECTION,
                                                                           "Description", NULL, NULL);
            /* Get gl plugins */
            self->gl_plugins = g_key_file_get_string_list(plugin_file, PLUGIN_SECTION,
                                                                          "GLPlugins", NULL, NULL);
            /* Get tab position */
            self->pos = g_key_file_get_integer(plugin_file, PLUGIN_SECTION,
                                                                "TabPosition", NULL);
            
            g_key_file_free(plugin_file);
            
            selfp->filename = g_module_build_path(GCM_PLUGIN_PATH, G_TYPE_MODULE(self)->name);
            
            return self;
      }}
#line 231 "gcm-plugin.c"
#undef __GOB_FUNCTION__

#line 138 "gcm-plugin.gob"
static gboolean 
___2_gcm_plugin_load (GTypeModule * module G_GNUC_UNUSED)
#line 237 "gcm-plugin.c"
#define PARENT_HANDLER(___module) \
      ((G_TYPE_MODULE_CLASS(parent_class)->load)? \
            (* G_TYPE_MODULE_CLASS(parent_class)->load)(___module): \
            ((gboolean )0))
{
#define __GOB_FUNCTION__ "GCM:Plugin::load"
{
#line 140 "gcm-plugin.gob"
      
            GCMPlugin * self = SELF(module);
            gchar * get_type_func_name;
            
            if ((selfp->module = g_module_open(selfp->filename, 0)) == NULL)
            {
                  return FALSE;                 
            }
            
            get_type_func_name = g_strdup_printf("%s_get_plugin_type", G_TYPE_MODULE(self)->name);
            if (!g_module_symbol(selfp->module, get_type_func_name, (gpointer)&selfp->get_type))
            {
                  g_free(get_type_func_name);
                  return 0;               
            }
            g_free(get_type_func_name);
      
            return TRUE;
      }}
#line 265 "gcm-plugin.c"
#undef __GOB_FUNCTION__
#undef PARENT_HANDLER

#line 160 "gcm-plugin.gob"
static void 
___3_gcm_plugin_unload (GTypeModule * module G_GNUC_UNUSED)
#line 272 "gcm-plugin.c"
#define PARENT_HANDLER(___module) \
      { if(G_TYPE_MODULE_CLASS(parent_class)->unload) \
            (* G_TYPE_MODULE_CLASS(parent_class)->unload)(___module); }
{
#define __GOB_FUNCTION__ "GCM:Plugin::unload"
{
#line 162 "gcm-plugin.gob"
      
            GCMPlugin * self = SELF(module);

            if (selfp->module)
                  g_module_close(selfp->module);
            
            selfp->get_type = NULL;
      }}
#line 288 "gcm-plugin.c"
#undef __GOB_FUNCTION__
#undef PARENT_HANDLER

#line 171 "gcm-plugin.gob"
GType 
gcm_plugin_get_type_object (GCMPlugin * self)
#line 295 "gcm-plugin.c"
{
#define __GOB_FUNCTION__ "GCM:Plugin::get_type_object"
#line 171 "gcm-plugin.gob"
      g_return_val_if_fail (self != NULL, (GType )0);
#line 171 "gcm-plugin.gob"
      g_return_val_if_fail (GCM_IS_PLUGIN (self), (GType )0);
#line 302 "gcm-plugin.c"
{
#line 173 "gcm-plugin.gob"
      
            g_type_module_use(G_TYPE_MODULE(self));
            
            return selfp->get_type ? selfp->get_type(G_TYPE_MODULE(self)) : 0;
      }}
#line 310 "gcm-plugin.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index