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

gcm-page-loader.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-page-loader.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 */
/* self casting macros */
#define SELF(x) GCM_PAGE_LOADER(x)
#define SELF_CONST(x) GCM_PAGE_LOADER_CONST(x)
#define IS_SELF(x) GCM_IS_PAGE_LOADER(x)
#define TYPE_SELF GCM_TYPE_PAGE_LOADER
#define SELF_CLASS(x) GCM_PAGE_LOADER_CLASS(x)

#define SELF_GET_CLASS(x) GCM_PAGE_LOADER_GET_CLASS(x)

/* self typedefs */
typedef GCMPageLoader Self;
typedef GCMPageLoaderClass SelfClass;

struct _GCMPageLoaderPrivate {
#line 34 "gcm-page-loader.gob"
      GCMGLDesktop * gl_desktop;
#line 36 "gcm-page-loader.gob"
      GSList * pages;
#line 41 "gcm-page-loader.c"
};
/* here are local prototypes */
static void gcm_page_loader_init (GCMPageLoader * o) G_GNUC_UNUSED;
static void gcm_page_loader_class_init (GCMPageLoaderClass * c) G_GNUC_UNUSED;
static void gcm_page_loader_foreach_page (gchar * name, GCMPlugin * plugin, GCMPageLoader * self) G_GNUC_UNUSED;

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

/* Short form macros */
#define self_new gcm_page_loader_new
#define self_get_pages gcm_page_loader_get_pages
#define self_foreach_page gcm_page_loader_foreach_page
GType
gcm_page_loader_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (GCMPageLoaderClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) gcm_page_loader_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (GCMPageLoader),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) gcm_page_loader_init,
                  NULL
            };

            type = g_type_register_static (GCM_TYPE_PLUGIN_LOADER, "GCMPageLoader", &info, (GTypeFlags)0);
      }

      return type;
}

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

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


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "GCM:Page:Loader::finalize"
      GCMPageLoader *self G_GNUC_UNUSED = GCM_PAGE_LOADER (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 35 "gcm-page-loader.gob"
      if(self->_priv->gl_desktop) { g_object_unref ((gpointer) self->_priv->gl_desktop); self->_priv->gl_desktop = NULL; }
#line 108 "gcm-page-loader.c"
#define pages (self->_priv->pages)
#define VAR pages
      {
#line 37 "gcm-page-loader.gob"
      
                  if (pages)
                  {
                        g_slist_foreach(pages, (GFunc)g_object_unref, NULL);
                        g_slist_free(pages);
                  }
            }
#line 120 "gcm-page-loader.c"
      memset(&pages, 0, sizeof(pages));
#undef VAR
#undef pages
}
#undef __GOB_FUNCTION__

static void 
gcm_page_loader_init (GCMPageLoader * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:Page:Loader::init"
      o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,GCM_TYPE_PAGE_LOADER,GCMPageLoaderPrivate);
}
#undef __GOB_FUNCTION__
static void 
gcm_page_loader_class_init (GCMPageLoaderClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:Page:Loader::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

      g_type_class_add_private(c,sizeof(GCMPageLoaderPrivate));

      parent_class = g_type_class_ref (GCM_TYPE_PLUGIN_LOADER);

      g_object_class->finalize = ___finalize;
}
#undef __GOB_FUNCTION__



#line 45 "gcm-page-loader.gob"
GCMPageLoader * 
gcm_page_loader_new (GCMGLDesktop * gl_desktop)
#line 153 "gcm-page-loader.c"
{
#define __GOB_FUNCTION__ "GCM:Page:Loader::new"
#line 45 "gcm-page-loader.gob"
      g_return_val_if_fail (gl_desktop != NULL, (GCMPageLoader * )NULL);
#line 158 "gcm-page-loader.c"
{
#line 47 "gcm-page-loader.gob"
      
            GCMPageLoader * self = GET_NEW;

            if (!gcm_plugin_loader_parse_path(GCM_PLUGIN_LOADER(self), GCM_PLUGIN_PATH))
            {
                  g_object_unref(self);
                  return NULL;
            }
            
            selfp->gl_desktop = g_object_ref(gl_desktop);
            
            return self;
      }}
#line 174 "gcm-page-loader.c"
#undef __GOB_FUNCTION__

#line 61 "gcm-page-loader.gob"
GSList * 
gcm_page_loader_get_pages (GCMPageLoader * self)
#line 180 "gcm-page-loader.c"
{
#define __GOB_FUNCTION__ "GCM:Page:Loader::get_pages"
#line 61 "gcm-page-loader.gob"
      g_return_val_if_fail (self != NULL, (GSList * )NULL);
#line 61 "gcm-page-loader.gob"
      g_return_val_if_fail (GCM_IS_PAGE_LOADER (self), (GSList * )NULL);
#line 187 "gcm-page-loader.c"
{
#line 63 "gcm-page-loader.gob"
      
            g_hash_table_foreach(GCM_PLUGIN_LOADER(self)->plugins, 
                                           (GHFunc)self_foreach_page,
                                           self);
            selfp->pages = g_slist_sort(selfp->pages, (GCompareFunc)gcm_page_compare_pos);
            return selfp->pages;
      }}
#line 197 "gcm-page-loader.c"
#undef __GOB_FUNCTION__

#line 71 "gcm-page-loader.gob"
static void 
gcm_page_loader_foreach_page (gchar * name, GCMPlugin * plugin, GCMPageLoader * self)
#line 203 "gcm-page-loader.c"
{
#define __GOB_FUNCTION__ "GCM:Page:Loader::foreach_page"
{
#line 73 "gcm-page-loader.gob"
      
            GCMPage * page;
            GType page_type;
            
            if ((page_type = gcm_plugin_loader_get_type_plugin(GCM_PLUGIN_LOADER(self), 
                                                                                       plugin->name)) == 0)
                  return;
            
            if (plugin->gl_plugins)
            {
                  gint cpt;
                  
                  for (cpt = 0; plugin->gl_plugins[cpt]; cpt++)
                  {
                        if (!gcm_gl_desktop_register_plugin(selfp->gl_desktop, 
                                                                              plugin->gl_plugins[cpt]))
                              return;
                  }
            }
            
            if ((page = g_object_new(page_type, "gl_desktop", selfp->gl_desktop, NULL)) == NULL)
                  return;
            
            page->label = g_strdup(plugin->label);
            if (plugin->pos) page->tab_num = plugin->pos;
                  
            if (gcm_page_construct(page))
                  selfp->pages = g_slist_append(selfp->pages, page);
            else
                  g_object_unref(page);
      }}
#line 239 "gcm-page-loader.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index