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

gcm-xorg-template.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-xorg-template.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 32 "gcm-xorg-template.gob"

#include <stdlib.h>

#include "xf86Parser.h"

static GMarkupParser GCMXorgTemplateParser = {
      NULL,
      NULL,
      NULL,
      NULL,
      NULL
};

#line 38 "gcm-xorg-template.c"
/* self casting macros */
#define SELF(x) GCM_XORG_TEMPLATE(x)
#define SELF_CONST(x) GCM_XORG_TEMPLATE_CONST(x)
#define IS_SELF(x) GCM_IS_XORG_TEMPLATE(x)
#define TYPE_SELF GCM_TYPE_XORG_TEMPLATE
#define SELF_CLASS(x) GCM_XORG_TEMPLATE_CLASS(x)

#define SELF_GET_CLASS(x) GCM_XORG_TEMPLATE_GET_CLASS(x)

/* self typedefs */
typedef GCMXorgTemplate Self;
typedef GCMXorgTemplateClass SelfClass;

struct _GCMXorgTemplatePrivate {
#line 48 "gcm-xorg-template.gob"
      GMarkupParseContext * context;
#line 50 "gcm-xorg-template.gob"
      gchar * name;
#line 61 "gcm-xorg-template.gob"
      gchar * author;
#line 72 "gcm-xorg-template.gob"
      gchar * email;
#line 83 "gcm-xorg-template.gob"
      GCMXorgConfig * config;
#line 94 "gcm-xorg-template.gob"
      gchar * filename;
#line 105 "gcm-xorg-template.gob"
      gboolean parsed;
#line 115 "gcm-xorg-template.gob"
      gboolean modified;
#line 125 "gcm-xorg-template.gob"
      gchar * identifier;
#line 127 "gcm-xorg-template.gob"
      gboolean xgl;
#line 128 "gcm-xorg-template.gob"
      gboolean aiglx;
#line 75 "gcm-xorg-template.c"
};
/* here are local prototypes */
static void ___object_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void gcm_xorg_template_init (GCMXorgTemplate * o) G_GNUC_UNUSED;
static void gcm_xorg_template_class_init (GCMXorgTemplateClass * c) G_GNUC_UNUSED;
static void gcm_xorg_template_parse_version (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values) G_GNUC_UNUSED;
static void gcm_xorg_template_parse_driver (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values) G_GNUC_UNUSED;
static void gcm_xorg_template_parse_load (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values) G_GNUC_UNUSED;
static void gcm_xorg_template_parse_option (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values) G_GNUC_UNUSED;
static void gcm_xorg_template_parse_display (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values) G_GNUC_UNUSED;
static void gcm_xorg_template_start_element (GMarkupParseContext * context, const gchar * element_name, const gchar ** attribute_names, const gchar ** attribute_values, gpointer user_data, GError ** error) G_GNUC_UNUSED;

/*
 * Signal connection wrapper macro shortcuts
 */
#define self_connect__depth_choice(object,func,data)  gcm_xorg_template_connect__depth_choice((object),(func),(data))
#define self_connect_after__depth_choice(object,func,data)  gcm_xorg_template_connect_after__depth_choice((object),(func),(data))
#define self_connect_data__depth_choice(object,func,data,destroy_data,flags)  gcm_xorg_template_connect_data__depth_choice((object),(func),(data),(destroy_data),(flags))

typedef gint  (*___Sig1) (GCMXorgTemplate *, gpointer , gint , gpointer);

static void
___marshal_Sig1 (GClosure *closure,
      GValue *return_value G_GNUC_UNUSED,
      guint n_param_values,
      const GValue *param_values,
      gpointer invocation_hint G_GNUC_UNUSED,
      gpointer marshal_data)
{
      gint  v_return;
      register ___Sig1 callback;
      register GCClosure *cc = (GCClosure*) closure;
      register gpointer data1, data2;

      g_return_if_fail (n_param_values == 3);

      if (G_CCLOSURE_SWAP_DATA (closure)) {
            data1 = closure->data;
            data2 = g_value_peek_pointer (param_values + 0);
      } else {
            data1 = g_value_peek_pointer (param_values + 0);
            data2 = closure->data;
      }

      callback = (___Sig1) (marshal_data != NULL ? marshal_data : cc->callback);

      v_return = callback ((GCMXorgTemplate *)data1,
            (gpointer ) g_value_get_pointer (param_values + 1),
            (gint ) g_value_get_int (param_values + 2),
            data2);

      g_value_set_int (return_value, v_return);
}


enum {
      DEPTH_CHOICE_SIGNAL,
      LAST_SIGNAL
};

enum {
      PROP_0,
      PROP_NAME,
      PROP_AUTHOR,
      PROP_EMAIL,
      PROP_CONFIG,
      PROP_FILENAME,
      PROP_PARSED,
      PROP_MODIFIED
};

static guint object_signals[LAST_SIGNAL] = {0};

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

/* Short form macros */
#define self_get_name gcm_xorg_template_get_name
#define self_get_author gcm_xorg_template_get_author
#define self_get_email gcm_xorg_template_get_email
#define self_get_config gcm_xorg_template_get_config
#define self_get_filename gcm_xorg_template_get_filename
#define self_get_parsed gcm_xorg_template_get_parsed
#define self_get_modified gcm_xorg_template_get_modified
#define self_depth_choice gcm_xorg_template_depth_choice
#define self_new gcm_xorg_template_new
#define self_parse gcm_xorg_template_parse
#define self_parse_version gcm_xorg_template_parse_version
#define self_parse_driver gcm_xorg_template_parse_driver
#define self_parse_load gcm_xorg_template_parse_load
#define self_parse_option gcm_xorg_template_parse_option
#define self_parse_display gcm_xorg_template_parse_display
#define self_start_element gcm_xorg_template_start_element
GType
gcm_xorg_template_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (GCMXorgTemplateClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) gcm_xorg_template_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (GCMXorgTemplate),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) gcm_xorg_template_init,
                  NULL
            };

            type = g_type_register_static (G_TYPE_OBJECT, "GCMXorgTemplate", &info, (GTypeFlags)0);
      }

      return type;
}

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

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


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::finalize"
      GCMXorgTemplate *self G_GNUC_UNUSED = GCM_XORG_TEMPLATE (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 49 "gcm-xorg-template.gob"
      if(self->_priv->context) { g_markup_parse_context_free ((gpointer) self->_priv->context); self->_priv->context = NULL; }
#line 222 "gcm-xorg-template.c"
#line 51 "gcm-xorg-template.gob"
      if(self->_priv->name) { g_free ((gpointer) self->_priv->name); self->_priv->name = NULL; }
#line 225 "gcm-xorg-template.c"
#line 62 "gcm-xorg-template.gob"
      if(self->_priv->author) { g_free ((gpointer) self->_priv->author); self->_priv->author = NULL; }
#line 228 "gcm-xorg-template.c"
#line 73 "gcm-xorg-template.gob"
      if(self->_priv->email) { g_free ((gpointer) self->_priv->email); self->_priv->email = NULL; }
#line 231 "gcm-xorg-template.c"
#line 84 "gcm-xorg-template.gob"
      if(self->_priv->config) { g_object_unref ((gpointer) self->_priv->config); self->_priv->config = NULL; }
#line 234 "gcm-xorg-template.c"
#line 95 "gcm-xorg-template.gob"
      if(self->_priv->filename) { g_free ((gpointer) self->_priv->filename); self->_priv->filename = NULL; }
#line 237 "gcm-xorg-template.c"
#line 126 "gcm-xorg-template.gob"
      if(self->_priv->identifier) { g_free ((gpointer) self->_priv->identifier); self->_priv->identifier = NULL; }
#line 240 "gcm-xorg-template.c"
}
#undef __GOB_FUNCTION__

static void 
gcm_xorg_template_init (GCMXorgTemplate * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::init"
      o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,GCM_TYPE_XORG_TEMPLATE,GCMXorgTemplatePrivate);
#line 102 "gcm-xorg-template.gob"
      o->_priv->parsed = FALSE;
#line 251 "gcm-xorg-template.c"
#line 112 "gcm-xorg-template.gob"
      o->_priv->modified = FALSE;
#line 254 "gcm-xorg-template.c"
#line 122 "gcm-xorg-template.gob"
      o->_priv->xgl = FALSE;
#line 257 "gcm-xorg-template.c"
#line 122 "gcm-xorg-template.gob"
      o->_priv->aiglx = FALSE;
#line 260 "gcm-xorg-template.c"
}
#undef __GOB_FUNCTION__
static void 
gcm_xorg_template_class_init (GCMXorgTemplateClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

      g_type_class_add_private(c,sizeof(GCMXorgTemplatePrivate));

      parent_class = g_type_class_ref (G_TYPE_OBJECT);

      object_signals[DEPTH_CHOICE_SIGNAL] =
            g_signal_new ("depth_choice",
                  G_TYPE_FROM_CLASS (g_object_class),
                  (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
                  G_STRUCT_OFFSET (GCMXorgTemplateClass, depth_choice),
                  NULL, NULL,
                  ___marshal_Sig1,
                  G_TYPE_INT, 2,
                  G_TYPE_POINTER,
                  G_TYPE_INT);
      if ___GOB_UNLIKELY(sizeof(gint ) != sizeof(gint ) || sizeof(gchar ** ) != sizeof(gpointer ) || sizeof(gint ) != sizeof(gint ) || parent_class == NULL /* avoid warning */) {
            g_error("gcm-xorg-template.gob line 130: Type mismatch of \"depth_choice\" signal signature");
      }

      c->depth_choice = NULL;
      g_object_class->finalize = ___finalize;
      g_object_class->get_property = ___object_get_property;
    {
      GParamSpec   *param_spec;

      param_spec = g_param_spec_string
            ("name" /* name */,
             "Name" /* nick */,
             "Name of Template" /* blurb */,
             NULL /* default_value */,
             (GParamFlags)(G_PARAM_READABLE));
      g_object_class_install_property (g_object_class,
            PROP_NAME,
            param_spec);
      param_spec = g_param_spec_string
            ("author" /* name */,
             "Author" /* nick */,
             "Author of Template" /* blurb */,
             NULL /* default_value */,
             (GParamFlags)(G_PARAM_READABLE));
      g_object_class_install_property (g_object_class,
            PROP_AUTHOR,
            param_spec);
      param_spec = g_param_spec_string
            ("email" /* name */,
             "EMail" /* nick */,
             "EMail's author" /* blurb */,
             NULL /* default_value */,
             (GParamFlags)(G_PARAM_READABLE));
      g_object_class_install_property (g_object_class,
            PROP_EMAIL,
            param_spec);
      param_spec = g_param_spec_pointer
            ("config" /* name */,
             "Config" /* nick */,
             "Xorg config filename" /* blurb */,
             (GParamFlags)(G_PARAM_READABLE));
      g_object_class_install_property (g_object_class,
            PROP_CONFIG,
            param_spec);
      param_spec = g_param_spec_string
            ("filename" /* name */,
             "Filename" /* nick */,
             "Template filename" /* blurb */,
             NULL /* default_value */,
             (GParamFlags)(G_PARAM_READABLE));
      g_object_class_install_property (g_object_class,
            PROP_FILENAME,
            param_spec);
      param_spec = g_param_spec_boolean
            ("parsed" /* name */,
             "Parsed" /* nick */,
             "File  is parsed" /* blurb */,
             FALSE /* default_value */,
             (GParamFlags)(G_PARAM_READABLE));
      g_object_class_install_property (g_object_class,
            PROP_PARSED,
            param_spec);
      param_spec = g_param_spec_boolean
            ("modified" /* name */,
             "Modified" /* nick */,
             "Xorg is modified" /* blurb */,
             FALSE /* default_value */,
             (GParamFlags)(G_PARAM_READABLE));
      g_object_class_install_property (g_object_class,
            PROP_MODIFIED,
            param_spec);
    }
}
#undef __GOB_FUNCTION__

static void
___object_get_property (GObject *object,
      guint property_id,
      GValue *VAL G_GNUC_UNUSED,
      GParamSpec *pspec G_GNUC_UNUSED)
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_property"
{
      GCMXorgTemplate *self G_GNUC_UNUSED;

      self = GCM_XORG_TEMPLATE (object);

      switch (property_id) {
      case PROP_NAME:
            {
#line 58 "gcm-xorg-template.gob"

                  g_value_set_string(VAL, selfp->name);
            
#line 377 "gcm-xorg-template.c"
            }
            break;
      case PROP_AUTHOR:
            {
#line 69 "gcm-xorg-template.gob"

                  g_value_set_string(VAL, selfp->author);
            
#line 386 "gcm-xorg-template.c"
            }
            break;
      case PROP_EMAIL:
            {
#line 80 "gcm-xorg-template.gob"

                  g_value_set_string(VAL, selfp->email);
            
#line 395 "gcm-xorg-template.c"
            }
            break;
      case PROP_CONFIG:
            {
#line 91 "gcm-xorg-template.gob"

                  g_value_set_pointer(VAL, selfp->config);
            
#line 404 "gcm-xorg-template.c"
            }
            break;
      case PROP_FILENAME:
            {
#line 102 "gcm-xorg-template.gob"

                  g_value_set_string(VAL, selfp->filename);
            
#line 413 "gcm-xorg-template.c"
            }
            break;
      case PROP_PARSED:
            {
#line 112 "gcm-xorg-template.gob"

                  g_value_set_boolean(VAL, selfp->parsed);
            
#line 422 "gcm-xorg-template.c"
            }
            break;
      case PROP_MODIFIED:
            {
#line 122 "gcm-xorg-template.gob"

                  g_value_set_boolean(VAL, selfp->modified);
            
#line 431 "gcm-xorg-template.c"
            }
            break;
      default:
/* Apparently in g++ this is needed, glib is b0rk */
#ifndef __PRETTY_FUNCTION__
#  undef G_STRLOC
#  define G_STRLOC      __FILE__ ":" G_STRINGIFY (__LINE__)
#endif
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}
#undef __GOB_FUNCTION__



#line 58 "gcm-xorg-template.gob"
gchar * 
gcm_xorg_template_get_name (GCMXorgTemplate * self)
#line 451 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_name"
{
#line 52 "gcm-xorg-template.gob"
            gchar* val; g_object_get (G_OBJECT (self), "name", &val, NULL); return val;
}}
#line 458 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 69 "gcm-xorg-template.gob"
gchar * 
gcm_xorg_template_get_author (GCMXorgTemplate * self)
#line 464 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_author"
{
#line 63 "gcm-xorg-template.gob"
            gchar* val; g_object_get (G_OBJECT (self), "author", &val, NULL); return val;
}}
#line 471 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 80 "gcm-xorg-template.gob"
gchar * 
gcm_xorg_template_get_email (GCMXorgTemplate * self)
#line 477 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_email"
{
#line 74 "gcm-xorg-template.gob"
            gchar* val; g_object_get (G_OBJECT (self), "email", &val, NULL); return val;
}}
#line 484 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 91 "gcm-xorg-template.gob"
gpointer 
gcm_xorg_template_get_config (GCMXorgTemplate * self)
#line 490 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_config"
{
#line 85 "gcm-xorg-template.gob"
            gpointer val; g_object_get (G_OBJECT (self), "config", &val, NULL); return val;
}}
#line 497 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 102 "gcm-xorg-template.gob"
gchar * 
gcm_xorg_template_get_filename (GCMXorgTemplate * self)
#line 503 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_filename"
{
#line 96 "gcm-xorg-template.gob"
            gchar* val; g_object_get (G_OBJECT (self), "filename", &val, NULL); return val;
}}
#line 510 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 112 "gcm-xorg-template.gob"
gboolean 
gcm_xorg_template_get_parsed (GCMXorgTemplate * self)
#line 516 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_parsed"
{
#line 106 "gcm-xorg-template.gob"
            gboolean val; g_object_get (G_OBJECT (self), "parsed", &val, NULL); return val;
}}
#line 523 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 122 "gcm-xorg-template.gob"
gboolean 
gcm_xorg_template_get_modified (GCMXorgTemplate * self)
#line 529 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::get_modified"
{
#line 116 "gcm-xorg-template.gob"
            gboolean val; g_object_get (G_OBJECT (self), "modified", &val, NULL); return val;
}}
#line 536 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 130 "gcm-xorg-template.gob"
gint 
gcm_xorg_template_depth_choice (GCMXorgTemplate * self, gchar ** vals, gint def)
#line 542 "gcm-xorg-template.c"
{
      GValue ___param_values[3];
      GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 130 "gcm-xorg-template.gob"
      g_return_val_if_fail (self != NULL, (gint )0);
#line 130 "gcm-xorg-template.gob"
      g_return_val_if_fail (GCM_IS_XORG_TEMPLATE (self), (gint )0);
#line 554 "gcm-xorg-template.c"

      ___param_values[0].g_type = 0;
      g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
      g_value_set_instance (&___param_values[0], (gpointer) self);

      ___param_values[1].g_type = 0;
      g_value_init (&___param_values[1], G_TYPE_POINTER);
      g_value_set_pointer (&___param_values[1], (gpointer ) vals);

      ___param_values[2].g_type = 0;
      g_value_init (&___param_values[2], G_TYPE_INT);
      g_value_set_int (&___param_values[2], (gint ) def);

      g_value_init (&___return_val, G_TYPE_INT);

      g_signal_emitv (___param_values,
            object_signals[DEPTH_CHOICE_SIGNAL],
            0 /* detail */,
            &___return_val);

      g_value_unset (&___param_values[0]);
      g_value_unset (&___param_values[1]);
      g_value_unset (&___param_values[2]);

      {
            gint  ___ret = (gint ) g_value_get_int (&___return_val);
            g_value_unset (&___return_val);
            return ___ret;
      }
}

#line 133 "gcm-xorg-template.gob"
GCMXorgTemplate * 
gcm_xorg_template_new (gchar * filename, gboolean xgl, gboolean aiglx)
#line 589 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::new"
#line 133 "gcm-xorg-template.gob"
      g_return_val_if_fail (filename != NULL, (GCMXorgTemplate * )NULL);
#line 594 "gcm-xorg-template.c"
{
#line 136 "gcm-xorg-template.gob"
      
            GCMXorgTemplate * self = GET_NEW;
            
            if (!g_file_test(filename, G_FILE_TEST_EXISTS))
            {
                  g_object_unref(self);
                  return NULL;
            }
            
            selfp->xgl = xgl;
            selfp->aiglx = aiglx;
            selfp->config = gcm_xorg_config_new();
            selfp->filename = g_strdup(filename);
            GCMXorgTemplateParser.start_element = self_start_element;
            selfp->context = g_markup_parse_context_new((const GMarkupParser*)&GCMXorgTemplateParser,
                                                   G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG,
                                                   self,
                                                   NULL);
            
            
            return self;
      }}
#line 619 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 159 "gcm-xorg-template.gob"
gboolean 
gcm_xorg_template_parse (GCMXorgTemplate * self)
#line 625 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::parse"
#line 159 "gcm-xorg-template.gob"
      g_return_val_if_fail (self != NULL, (gboolean )0);
#line 159 "gcm-xorg-template.gob"
      g_return_val_if_fail (GCM_IS_XORG_TEMPLATE (self), (gboolean )0);
#line 632 "gcm-xorg-template.c"
{
#line 161 "gcm-xorg-template.gob"
      
            gchar * buffer;
            gsize len;
            gboolean result = FALSE;
            
            selfp->parsed = FALSE;
            selfp->modified = FALSE;
            if (g_file_get_contents(selfp->filename, &buffer, &len, NULL))
            {
                  result = g_markup_parse_context_parse(selfp->context, buffer, len, NULL);
                  g_free(buffer);
            }
            
            return result;
      }}
#line 650 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 177 "gcm-xorg-template.gob"
static void 
gcm_xorg_template_parse_version (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values)
#line 656 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::parse_version"
#line 177 "gcm-xorg-template.gob"
      g_return_if_fail (self != NULL);
#line 177 "gcm-xorg-template.gob"
      g_return_if_fail (GCM_IS_XORG_TEMPLATE (self));
#line 663 "gcm-xorg-template.c"
{
#line 180 "gcm-xorg-template.gob"
      
            gint cpt;
            
            for (cpt = 0; attribute_names[cpt]; cpt++)
            {
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "name"))
                        selfp->name = g_strdup(attribute_values[cpt]);
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "author"))
                        selfp->author = g_strdup(attribute_values[cpt]);
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "email"))
                        selfp->email = g_strdup(attribute_values[cpt]);
            }
      }}
#line 679 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 194 "gcm-xorg-template.gob"
static void 
gcm_xorg_template_parse_driver (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values)
#line 685 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::parse_driver"
#line 194 "gcm-xorg-template.gob"
      g_return_if_fail (self != NULL);
#line 194 "gcm-xorg-template.gob"
      g_return_if_fail (GCM_IS_XORG_TEMPLATE (self));
#line 692 "gcm-xorg-template.c"
{
#line 197 "gcm-xorg-template.gob"
      
            gint cpt;
            gboolean aiglx = FALSE, xgl = FALSE;
            
            for (cpt = 0; attribute_names[cpt]; cpt++)
            {
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "name"))
                  {
                        XF86ConfDevicePtr device = gcm_xorg_config_get_devices(selfp->config);
                        
                        for (;device; device = (XF86ConfDevicePtr)((GenericListPtr)device)->next)
                        {
                              if (!g_ascii_strcasecmp(device->dev_driver, attribute_values[cpt]))
                                    selfp->identifier = g_strdup(device->dev_identifier);
                        }
                  }
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "xgl"))
                        xgl = !g_ascii_strcasecmp(attribute_values[cpt], "true") ? TRUE : FALSE;
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "aiglx"))
                        aiglx = !g_ascii_strcasecmp(attribute_values[cpt], "true") ? TRUE : FALSE;
            }
            if (selfp->identifier && xgl == selfp->xgl && aiglx == selfp->aiglx)
                  selfp->parsed = TRUE;
      }}
#line 719 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 222 "gcm-xorg-template.gob"
static void 
gcm_xorg_template_parse_load (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values)
#line 725 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::parse_load"
#line 222 "gcm-xorg-template.gob"
      g_return_if_fail (self != NULL);
#line 222 "gcm-xorg-template.gob"
      g_return_if_fail (GCM_IS_XORG_TEMPLATE (self));
#line 732 "gcm-xorg-template.c"
{
#line 225 "gcm-xorg-template.gob"
      
            gchar * section = NULL, * name = NULL, * before = NULL;
            gboolean remove = FALSE;
            gint cpt;
                  
            for (cpt = 0; attribute_names[cpt]; cpt++)
            {
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "section"))
                        section = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "name"))
                        name = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "before"))
                        before = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "remove"))
                        remove = !g_ascii_strcasecmp(attribute_values[cpt], "true") ? TRUE : FALSE;
            }
            
            if (section && !g_ascii_strcasecmp(section, "Module") && name)
            {
                  XF86ConfModulePtr module = gcm_xorg_config_get_modules(selfp->config);
                  XF86LoadPtr item;
                  gboolean found = FALSE;
                  
                  for (item = module->mod_load_lst; item; item = (XF86LoadPtr)((GenericListPtr)item)->next)
                  {
                        if (!g_ascii_strcasecmp(item->load_name, name))
                        {
                              found = TRUE;
                              break;
                        }
                  }
                  
                  if (!found && !remove)
                  {
                        module->mod_load_lst = xf86addNewLoadDirective(module->mod_load_lst, 
                                                                                             g_strdup(name),
                                                                                           XF86_LOAD_MODULE,
                                                                                           NULL);
                        selfp->modified = TRUE;
                  }
                  if (found && remove)
                  {
                        module->mod_load_lst = xf86RemoveLoadDirective(module->mod_load_lst,
                                                                                           item);
                        selfp->modified = TRUE;
                  }
                  if (before)
                  {
                        XF86LoadPtr prev = NULL;
                        XF86LoadPtr cur = NULL;
                        gboolean already_before = TRUE;
                        
                        for (item = module->mod_load_lst; item; item = (XF86LoadPtr)((glp)item)->next)
                        {
                              if (!g_ascii_strcasecmp(item->load_name, before))
                                    already_before = FALSE;
                              
                              if (!g_ascii_strcasecmp(item->load_name, name))
                              {
                                    cur = item;
                                    break;
                              }
                        }
                        if (!already_before)
                        {
                              for (item = module->mod_load_lst; item; item = (XF86LoadPtr)((glp)item)->next)
                              {
                                    if (!g_ascii_strcasecmp(item->load_name, before))
                                    {
                                          module->mod_load_lst = (XF86LoadPtr)
                                                xf86ReOrderItem((GenericListPtr)module->mod_load_lst,
                                                                     (GenericListPtr)prev,
                                                                     (GenericListPtr)cur);
                                          selfp->modified = TRUE;
                                          break;
                                    }
                                    prev=item;
                              }
                        }
                  }
            }
            if (section) g_free(section);
            if (name) g_free(name);
            if (before) g_free(before);
      }}
#line 820 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 311 "gcm-xorg-template.gob"
static void 
gcm_xorg_template_parse_option (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values)
#line 826 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::parse_option"
#line 311 "gcm-xorg-template.gob"
      g_return_if_fail (self != NULL);
#line 311 "gcm-xorg-template.gob"
      g_return_if_fail (GCM_IS_XORG_TEMPLATE (self));
#line 833 "gcm-xorg-template.c"
{
#line 314 "gcm-xorg-template.gob"
      
            gchar * section = NULL, * name = NULL, * value = NULL;
            gboolean remove = FALSE;
            gint cpt;
                  
            for (cpt = 0; attribute_names[cpt]; cpt++)
            {
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "section"))
                        section = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "name"))
                        name = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "value"))
                        value = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "remove"))
                        remove = !g_ascii_strcasecmp(attribute_values[cpt], "true") ? TRUE : FALSE;
            }
            
            if (section && name)
            {
                  XF86OptionPtr item;
                  gboolean found = FALSE;
                  
                  if (!g_ascii_strcasecmp(section, "Extensions"))
                  {
                        XF86ConfExtensionsPtr extensions = 
                                                gcm_xorg_config_get_extensions(selfp->config);
                        for (item = extensions->ext_option_lst; item; item = (XF86OptionPtr)((glp)item)->next)
                        {
                              if (!g_ascii_strcasecmp(item->opt_name, name))
                              {
                                    found = TRUE;
                                    break;
                              }
                        }
                        
                        if (!found && !remove)
                        {
                              extensions->ext_option_lst = 
                                    xf86addNewOption(extensions->ext_option_lst, 
                                                             g_strdup(name), g_strdup(value));
                              selfp->modified = TRUE;
                        }
                        
                        if (found && remove)
                        {
                              extensions->ext_option_lst = 
                                    xf86removeOption(extensions->ext_option_lst, item);
                              selfp->modified = TRUE;
                        }
                  }
                  if (!g_ascii_strcasecmp(section, "Device"))
                  {
                        XF86ConfDevicePtr devices = 
                                                gcm_xorg_config_get_devices(selfp->config);
                        
                        for (item = devices->dev_option_lst; item; item = (XF86OptionPtr)((glp)item)->next)
                        {
                              if (!g_ascii_strcasecmp(item->opt_name, name))
                              {
                                    found = TRUE;
                                    break;
                              }
                        }
                        
                        if (!found && !remove)
                        {
                              devices->dev_option_lst = 
                                    xf86addNewOption(devices->dev_option_lst,
                                                             g_strdup(name), g_strdup(value));
                              selfp->modified = TRUE;
                        }
                        
                        if (found && remove)
                        {
                              devices->dev_option_lst = 
                                    xf86removeOption(devices->dev_option_lst, item);
                              selfp->modified = TRUE;
                        }
                  }
            }
            
            if (section) g_free(section);
            if (name) g_free(name);
            if (value) g_free(value);
      }}
#line 921 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 400 "gcm-xorg-template.gob"
static void 
gcm_xorg_template_parse_display (GCMXorgTemplate * self, const gchar ** attribute_names, const gchar ** attribute_values)
#line 927 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::parse_display"
#line 400 "gcm-xorg-template.gob"
      g_return_if_fail (self != NULL);
#line 400 "gcm-xorg-template.gob"
      g_return_if_fail (GCM_IS_XORG_TEMPLATE (self));
#line 934 "gcm-xorg-template.c"
{
#line 403 "gcm-xorg-template.gob"
      
            gchar * name = NULL, * value = NULL;
            gboolean remove = FALSE;
            gint cpt;
                  
            for (cpt = 0; attribute_names[cpt]; cpt++)
            {
                  if (!g_ascii_strcasecmp(attribute_names[cpt], "name"))
                        name = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "value"))
                        value = g_strdup(attribute_values[cpt]);
                  else if (!g_ascii_strcasecmp(attribute_names[cpt], "remove"))
                        remove = !g_ascii_strcasecmp(attribute_values[cpt], "true") ? TRUE : FALSE;
            }
            
            if (name && value && !g_ascii_strcasecmp(name, "Depth"))
            {
                  gchar ** vals = g_strsplit(value, "|", -1);
                  gint cpt, choice;
                  gboolean found = FALSE;
                  XF86ConfScreenPtr screens = gcm_xorg_config_get_screens(selfp->config);
                  
                  for (cpt = 0; vals[cpt]; cpt++)
                  {
                        gint depth = atoi(vals[cpt]);
                        
                        if (screens->scrn_defaultdepth == depth)
                        {
                              found = TRUE;
                              break;
                        }
                  }
                  choice = self_depth_choice(self, vals, found ? cpt : -1);
                  if (!choice)
                  {
                        screens->scrn_defaultdepth = found ? atoi(vals[cpt]) : atoi(vals[0]);
                        selfp->modified = !found;
                  }
                  else
                  {
                        screens->scrn_defaultdepth = choice;
                        selfp->modified = TRUE;
                  }
                  g_strfreev(vals);
            }
            
            if (name) g_free(name);
            if (value) g_free(value);
      }}
#line 986 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

#line 453 "gcm-xorg-template.gob"
static void 
gcm_xorg_template_start_element (GMarkupParseContext * context, const gchar * element_name, const gchar ** attribute_names, const gchar ** attribute_values, gpointer user_data, GError ** error)
#line 992 "gcm-xorg-template.c"
{
#define __GOB_FUNCTION__ "GCM:Xorg:Template::start_element"
{
#line 460 "gcm-xorg-template.gob"
      
            GCMXorgTemplate * self = SELF(user_data);
            
            if (!g_ascii_strcasecmp(element_name, "driver"))
            {
                  self_parse_driver(self, attribute_names, attribute_values);
            }
            else if (!g_ascii_strcasecmp(element_name, "version"))
            {
                  self_parse_version(self, attribute_names, attribute_values);
            }
            else if (selfp->parsed)
            {
                  if (!g_ascii_strcasecmp(element_name, "load"))
                        self_parse_load(self, attribute_names, attribute_values);
                  if (!g_ascii_strcasecmp(element_name, "option"))
                        self_parse_option(self, attribute_names, attribute_values);
                  if (!g_ascii_strcasecmp(element_name, "display"))
                        self_parse_display(self, attribute_names, attribute_values);
            }
      }}
#line 1018 "gcm-xorg-template.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index