Logo Search packages:      
Sourcecode: valatoys version File versions  Download package

templatedefinition.c

/* templatedefinition.c generated by valac 0.10.0, the Vala compiler
 * generated from templatedefinition.vala, do not modify */

/* templatedefinition.vala
 *
 * Copyright (C) 2007-2010  Andrea Del Signore
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 *    Andrea Del Signore <sejerpz@tin.it>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gstdio.h>


#define GEN_PROJECT_TYPE_TEMPLATE_DEFINITION (gen_project_template_definition_get_type ())
#define GEN_PROJECT_TEMPLATE_DEFINITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION, GenProjectTemplateDefinition))
#define GEN_PROJECT_TEMPLATE_DEFINITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION, GenProjectTemplateDefinitionClass))
#define GEN_PROJECT_IS_TEMPLATE_DEFINITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION))
#define GEN_PROJECT_IS_TEMPLATE_DEFINITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION))
#define GEN_PROJECT_TEMPLATE_DEFINITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION, GenProjectTemplateDefinitionClass))

typedef struct _GenProjectTemplateDefinition GenProjectTemplateDefinition;
typedef struct _GenProjectTemplateDefinitionClass GenProjectTemplateDefinitionClass;
typedef struct _GenProjectTemplateDefinitionPrivate GenProjectTemplateDefinitionPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define __g_list_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_free (var), NULL)))
#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GenProjectTemplateDefinition {
      GObject parent_instance;
      GenProjectTemplateDefinitionPrivate * priv;
};

struct _GenProjectTemplateDefinitionClass {
      GObjectClass parent_class;
};

00059 struct _GenProjectTemplateDefinitionPrivate {
      gint _id;
      char* _version;
      char* _name;
      char* _description;
      char* _details;
      char* _language;
      char* _build_system;
      char* _icon_filename;
      char* _archive_filename;
      char* _filename;
      GList* _tags;
};


static gpointer gen_project_template_definition_parent_class = NULL;

GType gen_project_template_definition_get_type (void) G_GNUC_CONST;
#define GEN_PROJECT_TEMPLATE_DEFINITION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION, GenProjectTemplateDefinitionPrivate))
enum  {
      GEN_PROJECT_TEMPLATE_DEFINITION_DUMMY_PROPERTY,
      GEN_PROJECT_TEMPLATE_DEFINITION_ID,
      GEN_PROJECT_TEMPLATE_DEFINITION_VERSION,
      GEN_PROJECT_TEMPLATE_DEFINITION_NAME,
      GEN_PROJECT_TEMPLATE_DEFINITION_DESCRIPTION,
      GEN_PROJECT_TEMPLATE_DEFINITION_DETAILS,
      GEN_PROJECT_TEMPLATE_DEFINITION_LANGUAGE,
      GEN_PROJECT_TEMPLATE_DEFINITION_BUILD_SYSTEM,
      GEN_PROJECT_TEMPLATE_DEFINITION_TAGS,
      GEN_PROJECT_TEMPLATE_DEFINITION_ICON_FILENAME,
      GEN_PROJECT_TEMPLATE_DEFINITION_ARCHIVE_FILENAME
};
static void _g_list_free_g_free (GList* self);
static GenProjectTemplateDefinition* gen_project_template_definition_new (void);
static GenProjectTemplateDefinition* gen_project_template_definition_construct (GType object_type);
GenProjectTemplateDefinition* gen_project_template_definition_load (const char* filename);
static char* gen_project_template_definition_read_key (GKeyFile* file, const char* key_name, const char* default_value, GError** error);
static void gen_project_template_definition_set_version (GenProjectTemplateDefinition* self, const char* value);
static void gen_project_template_definition_set_name (GenProjectTemplateDefinition* self, const char* value);
static void gen_project_template_definition_set_description (GenProjectTemplateDefinition* self, const char* value);
static void gen_project_template_definition_set_details (GenProjectTemplateDefinition* self, const char* value);
static void gen_project_template_definition_set_language (GenProjectTemplateDefinition* self, const char* value);
static void gen_project_template_definition_set_build_system (GenProjectTemplateDefinition* self, const char* value);
static void gen_project_template_definition_set_icon_filename (GenProjectTemplateDefinition* self, const char* value);
const char* gen_project_template_definition_get_icon_filename (GenProjectTemplateDefinition* self);
static void gen_project_template_definition_set_archive_filename (GenProjectTemplateDefinition* self, const char* value);
const char* gen_project_template_definition_get_archive_filename (GenProjectTemplateDefinition* self);
gint gen_project_template_definition_get_id (GenProjectTemplateDefinition* self);
void gen_project_template_definition_set_id (GenProjectTemplateDefinition* self, gint value);
const char* gen_project_template_definition_get_version (GenProjectTemplateDefinition* self);
const char* gen_project_template_definition_get_name (GenProjectTemplateDefinition* self);
const char* gen_project_template_definition_get_description (GenProjectTemplateDefinition* self);
const char* gen_project_template_definition_get_details (GenProjectTemplateDefinition* self);
const char* gen_project_template_definition_get_language (GenProjectTemplateDefinition* self);
const char* gen_project_template_definition_get_build_system (GenProjectTemplateDefinition* self);
GList* gen_project_template_definition_get_tags (GenProjectTemplateDefinition* self);
static void gen_project_template_definition_finalize (GObject* obj);
static void gen_project_template_definition_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void gen_project_template_definition_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);



static void _g_list_free_g_free (GList* self) {
      g_list_foreach (self, (GFunc) g_free, NULL);
      g_list_free (self);
}


static GenProjectTemplateDefinition* gen_project_template_definition_construct (GType object_type) {
      GenProjectTemplateDefinition * self;
      self = (GenProjectTemplateDefinition*) g_object_new (object_type, NULL);
      return self;
}


static GenProjectTemplateDefinition* gen_project_template_definition_new (void) {
      return gen_project_template_definition_construct (GEN_PROJECT_TYPE_TEMPLATE_DEFINITION);
}


static char* string_strip (const char* self) {
      char* result = NULL;
      char* _result_;
      g_return_val_if_fail (self != NULL, NULL);
      _result_ = g_strdup (self);
      g_strstrip (_result_);
      result = _result_;
      return result;
}


static char* string_replace (const char* self, const char* old, const char* replacement) {
      char* result = NULL;
      GError * _inner_error_ = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (old != NULL, NULL);
      g_return_val_if_fail (replacement != NULL, NULL);
      {
            char* _tmp0_;
            GRegex* _tmp1_;
            GRegex* regex;
            char* _tmp2_;
            regex = (_tmp1_ = g_regex_new (_tmp0_ = g_regex_escape_string (old, -1), 0, 0, &_inner_error_), _g_free0 (_tmp0_), _tmp1_);
            if (_inner_error_ != NULL) {
                  if (_inner_error_->domain == G_REGEX_ERROR) {
                        goto __catch4_g_regex_error;
                  }
                  g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
                  g_clear_error (&_inner_error_);
                  return NULL;
            }
            _tmp2_ = g_regex_replace_literal (regex, self, (gssize) (-1), 0, replacement, 0, &_inner_error_);
            if (_inner_error_ != NULL) {
                  _g_regex_unref0 (regex);
                  if (_inner_error_->domain == G_REGEX_ERROR) {
                        goto __catch4_g_regex_error;
                  }
                  _g_regex_unref0 (regex);
                  g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
                  g_clear_error (&_inner_error_);
                  return NULL;
            }
            result = _tmp2_;
            _g_regex_unref0 (regex);
            return result;
      }
      goto __finally4;
      __catch4_g_regex_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_assert_not_reached ();
                  _g_error_free0 (e);
            }
      }
      __finally4:
      if (_inner_error_ != NULL) {
            g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
            g_clear_error (&_inner_error_);
            return NULL;
      }
}


GenProjectTemplateDefinition* gen_project_template_definition_load (const char* filename) {
      GenProjectTemplateDefinition* result = NULL;
      GenProjectTemplateDefinition* _result_;
      GError * _inner_error_ = NULL;
      g_return_val_if_fail (filename != NULL, NULL);
      _result_ = NULL;
      {
            GKeyFile* file;
            gboolean _tmp0_ = FALSE;
            file = g_key_file_new ();
            g_key_file_load_from_file (file, filename, G_KEY_FILE_NONE, &_inner_error_);
            if (_inner_error_ != NULL) {
                  _g_key_file_free0 (file);
                  goto __catch3_g_error;
            }
            if (g_key_file_has_group (file, "Template")) {
                  gboolean _tmp1_;
                  _tmp1_ = g_key_file_has_key (file, "Template", "name", &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  _tmp0_ = _tmp1_;
            } else {
                  _tmp0_ = FALSE;
            }
            if (_tmp0_) {
                  GenProjectTemplateDefinition* _tmp2_;
                  char* _tmp3_;
                  char* _tmp4_;
                  char* _tmp5_;
                  char* _tmp6_;
                  char* _tmp7_;
                  char* _tmp8_;
                  char* _tmp9_;
                  char* _tmp10_;
                  char* _tmp11_;
                  char* _tmp12_;
                  char* _tmp13_;
                  char* _tmp14_;
                  char* _tmp15_;
                  char* _tmp16_;
                  gint tmp_length1;
                  gint _tmp_size_;
                  char** _tmp20_;
                  char* _tmp17_;
                  char** _tmp18_;
                  char** _tmp19_;
                  char** tmp;
                  char* _tmp21_;
                  char* _tmp22_;
                  char* _tmp23_;
                  char* _tmp24_;
                  char* _tmp25_;
                  char* _tmp26_;
                  char* _tmp27_;
                  char* _tmp28_;
                  _result_ = (_tmp2_ = gen_project_template_definition_new (), _g_object_unref0 (_result_), _tmp2_);
                  _result_->priv->_filename = (_tmp3_ = g_strdup (filename), _g_free0 (_result_->priv->_filename), _tmp3_);
                  _tmp4_ = gen_project_template_definition_read_key (file, "version", NULL, &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  gen_project_template_definition_set_version (_result_, _tmp5_ = _tmp4_);
                  _g_free0 (_tmp5_);
                  _tmp6_ = gen_project_template_definition_read_key (file, "name", NULL, &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  gen_project_template_definition_set_name (_result_, _tmp7_ = _tmp6_);
                  _g_free0 (_tmp7_);
                  _tmp8_ = gen_project_template_definition_read_key (file, "description", "", &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  gen_project_template_definition_set_description (_result_, _tmp9_ = _tmp8_);
                  _g_free0 (_tmp9_);
                  _tmp10_ = gen_project_template_definition_read_key (file, "details", "", &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  gen_project_template_definition_set_details (_result_, _tmp11_ = _tmp10_);
                  _g_free0 (_tmp11_);
                  _tmp12_ = gen_project_template_definition_read_key (file, "language", "", &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  gen_project_template_definition_set_language (_result_, _tmp13_ = _tmp12_);
                  _g_free0 (_tmp13_);
                  _tmp14_ = gen_project_template_definition_read_key (file, "build-system", "", &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  gen_project_template_definition_set_build_system (_result_, _tmp15_ = _tmp14_);
                  _g_free0 (_tmp15_);
                  _tmp16_ = gen_project_template_definition_read_key (file, "tags", "", &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (file);
                        goto __catch3_g_error;
                  }
                  tmp = (_tmp20_ = (_tmp19_ = _tmp18_ = g_strsplit (_tmp17_ = _tmp16_, ",", 0), _g_free0 (_tmp17_), _tmp19_), tmp_length1 = _vala_array_length (_tmp18_), _tmp_size_ = tmp_length1, _tmp20_);
                  {
                        char** tag_collection;
                        int tag_collection_length1;
                        int tag_it;
                        tag_collection = tmp;
                        tag_collection_length1 = tmp_length1;
                        for (tag_it = 0; tag_it < tmp_length1; tag_it = tag_it + 1) {
                              char* tag;
                              tag = g_strdup (tag_collection[tag_it]);
                              {
                                    _result_->priv->_tags = g_list_append (_result_->priv->_tags, string_strip (tag));
                                    _g_free0 (tag);
                              }
                        }
                  }
                  gen_project_template_definition_set_icon_filename (_result_, _tmp24_ = g_build_filename (_tmp21_ = g_path_get_dirname (filename), _tmp23_ = string_replace (_tmp22_ = g_path_get_basename (filename), ".ini", ".png"), NULL));
                  _g_free0 (_tmp24_);
                  _g_free0 (_tmp23_);
                  _g_free0 (_tmp22_);
                  _g_free0 (_tmp21_);
                  if (!g_file_test (_result_->priv->_icon_filename, G_FILE_TEST_IS_REGULAR)) {
                        g_message ("templatedefinition.vala:70: no icon found for project: %s", _result_->priv->_icon_filename);
                        gen_project_template_definition_set_icon_filename (_result_, NULL);
                  }
                  gen_project_template_definition_set_archive_filename (_result_, _tmp28_ = g_build_filename (_tmp25_ = g_path_get_dirname (filename), _tmp27_ = string_replace (_tmp26_ = g_path_get_basename (filename), ".ini", ".tar.gz"), NULL));
                  _g_free0 (_tmp28_);
                  _g_free0 (_tmp27_);
                  _g_free0 (_tmp26_);
                  _g_free0 (_tmp25_);
                  if (!g_file_test (_result_->priv->_archive_filename, G_FILE_TEST_IS_REGULAR)) {
                        g_critical ("templatedefinition.vala:75: no archive found for project: %s", _result_->priv->_archive_filename);
                        gen_project_template_definition_set_archive_filename (_result_, NULL);
                  }
                  tmp = (_vala_array_free (tmp, tmp_length1, (GDestroyNotify) g_free), NULL);
            }
            _g_key_file_free0 (file);
      }
      goto __finally3;
      __catch3_g_error:
      {
            GError * err;
            err = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("templatedefinition.vala:80: error loading keyfile %s: %s", filename, err->message);
                  _g_error_free0 (err);
            }
      }
      __finally3:
      if (_inner_error_ != NULL) {
            _g_object_unref0 (_result_);
            g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
            g_clear_error (&_inner_error_);
            return NULL;
      }
      result = _result_;
      return result;
}


static char* gen_project_template_definition_read_key (GKeyFile* file, const char* key_name, const char* default_value, GError** error) {
      char* result = NULL;
      gboolean _tmp0_;
      GError * _inner_error_ = NULL;
      g_return_val_if_fail (file != NULL, NULL);
      g_return_val_if_fail (key_name != NULL, NULL);
      _tmp0_ = g_key_file_has_key (file, "Template", key_name, &_inner_error_);
      if (_inner_error_ != NULL) {
            if (_inner_error_->domain == G_KEY_FILE_ERROR) {
                  g_propagate_error (error, _inner_error_);
                  return NULL;
            } else {
                  g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
                  g_clear_error (&_inner_error_);
                  return NULL;
            }
      }
      if (_tmp0_) {
            char* _tmp1_;
            char* _tmp2_;
            char* _tmp3_;
            _tmp1_ = g_key_file_get_string (file, "Template", key_name, &_inner_error_);
            if (_inner_error_ != NULL) {
                  if (_inner_error_->domain == G_KEY_FILE_ERROR) {
                        g_propagate_error (error, _inner_error_);
                        return NULL;
                  } else {
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
                        g_clear_error (&_inner_error_);
                        return NULL;
                  }
            }
            result = (_tmp3_ = string_strip (_tmp2_ = _tmp1_), _g_free0 (_tmp2_), _tmp3_);
            return result;
      } else {
            result = g_strdup (default_value);
            return result;
      }
}


gint gen_project_template_definition_get_id (GenProjectTemplateDefinition* self) {
      gint result;
      g_return_val_if_fail (self != NULL, 0);
      result = self->priv->_id;
      return result;
}


void gen_project_template_definition_set_id (GenProjectTemplateDefinition* self, gint value) {
      g_return_if_fail (self != NULL);
      self->priv->_id = value;
      g_object_notify ((GObject *) self, "id");
}


const char* gen_project_template_definition_get_version (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_version;
      return result;
}


static void gen_project_template_definition_set_version (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_version = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_version), _tmp0_);
      g_object_notify ((GObject *) self, "version");
}


const char* gen_project_template_definition_get_name (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_name;
      return result;
}


static void gen_project_template_definition_set_name (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_name), _tmp0_);
      g_object_notify ((GObject *) self, "name");
}


const char* gen_project_template_definition_get_description (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_description;
      return result;
}


static void gen_project_template_definition_set_description (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_description = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_description), _tmp0_);
      g_object_notify ((GObject *) self, "description");
}


const char* gen_project_template_definition_get_details (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_details;
      return result;
}


static void gen_project_template_definition_set_details (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_details = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_details), _tmp0_);
      g_object_notify ((GObject *) self, "details");
}


const char* gen_project_template_definition_get_language (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_language;
      return result;
}


static void gen_project_template_definition_set_language (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_language = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_language), _tmp0_);
      g_object_notify ((GObject *) self, "language");
}


const char* gen_project_template_definition_get_build_system (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_build_system;
      return result;
}


static void gen_project_template_definition_set_build_system (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_build_system = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_build_system), _tmp0_);
      g_object_notify ((GObject *) self, "build-system");
}


GList* gen_project_template_definition_get_tags (GenProjectTemplateDefinition* self) {
      GList* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_tags;
      return result;
}


const char* gen_project_template_definition_get_icon_filename (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_icon_filename;
      return result;
}


static void gen_project_template_definition_set_icon_filename (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_icon_filename = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_icon_filename), _tmp0_);
      g_object_notify ((GObject *) self, "icon-filename");
}


const char* gen_project_template_definition_get_archive_filename (GenProjectTemplateDefinition* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_archive_filename;
      return result;
}


static void gen_project_template_definition_set_archive_filename (GenProjectTemplateDefinition* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_archive_filename = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_archive_filename), _tmp0_);
      g_object_notify ((GObject *) self, "archive-filename");
}


static void gen_project_template_definition_class_init (GenProjectTemplateDefinitionClass * klass) {
      gen_project_template_definition_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (GenProjectTemplateDefinitionPrivate));
      G_OBJECT_CLASS (klass)->get_property = gen_project_template_definition_get_property;
      G_OBJECT_CLASS (klass)->set_property = gen_project_template_definition_set_property;
      G_OBJECT_CLASS (klass)->finalize = gen_project_template_definition_finalize;
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_ID, g_param_spec_int ("id", "id", "id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_VERSION, g_param_spec_string ("version", "version", "version", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_DETAILS, g_param_spec_string ("details", "details", "details", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_LANGUAGE, g_param_spec_string ("language", "language", "language", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_BUILD_SYSTEM, g_param_spec_string ("build-system", "build-system", "build-system", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_TAGS, g_param_spec_pointer ("tags", "tags", "tags", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_ICON_FILENAME, g_param_spec_string ("icon-filename", "icon-filename", "icon-filename", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
      g_object_class_install_property (G_OBJECT_CLASS (klass), GEN_PROJECT_TEMPLATE_DEFINITION_ARCHIVE_FILENAME, g_param_spec_string ("archive-filename", "archive-filename", "archive-filename", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void gen_project_template_definition_instance_init (GenProjectTemplateDefinition * self) {
      self->priv = GEN_PROJECT_TEMPLATE_DEFINITION_GET_PRIVATE (self);
      self->priv->_name = NULL;
      self->priv->_icon_filename = NULL;
      self->priv->_archive_filename = NULL;
      self->priv->_tags = NULL;
}


static void gen_project_template_definition_finalize (GObject* obj) {
      GenProjectTemplateDefinition * self;
      self = GEN_PROJECT_TEMPLATE_DEFINITION (obj);
      _g_free0 (self->priv->_version);
      _g_free0 (self->priv->_name);
      _g_free0 (self->priv->_description);
      _g_free0 (self->priv->_details);
      _g_free0 (self->priv->_language);
      _g_free0 (self->priv->_build_system);
      _g_free0 (self->priv->_icon_filename);
      _g_free0 (self->priv->_archive_filename);
      _g_free0 (self->priv->_filename);
      __g_list_free_g_free0 (self->priv->_tags);
      G_OBJECT_CLASS (gen_project_template_definition_parent_class)->finalize (obj);
}


GType gen_project_template_definition_get_type (void) {
      static volatile gsize gen_project_template_definition_type_id__volatile = 0;
      if (g_once_init_enter (&gen_project_template_definition_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (GenProjectTemplateDefinitionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gen_project_template_definition_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GenProjectTemplateDefinition), 0, (GInstanceInitFunc) gen_project_template_definition_instance_init, NULL };
            GType gen_project_template_definition_type_id;
            gen_project_template_definition_type_id = g_type_register_static (G_TYPE_OBJECT, "GenProjectTemplateDefinition", &g_define_type_info, 0);
            g_once_init_leave (&gen_project_template_definition_type_id__volatile, gen_project_template_definition_type_id);
      }
      return gen_project_template_definition_type_id__volatile;
}


static void gen_project_template_definition_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
      GenProjectTemplateDefinition * self;
      self = GEN_PROJECT_TEMPLATE_DEFINITION (object);
      switch (property_id) {
            case GEN_PROJECT_TEMPLATE_DEFINITION_ID:
            g_value_set_int (value, gen_project_template_definition_get_id (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_VERSION:
            g_value_set_string (value, gen_project_template_definition_get_version (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_NAME:
            g_value_set_string (value, gen_project_template_definition_get_name (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_DESCRIPTION:
            g_value_set_string (value, gen_project_template_definition_get_description (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_DETAILS:
            g_value_set_string (value, gen_project_template_definition_get_details (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_LANGUAGE:
            g_value_set_string (value, gen_project_template_definition_get_language (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_BUILD_SYSTEM:
            g_value_set_string (value, gen_project_template_definition_get_build_system (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_TAGS:
            g_value_set_pointer (value, gen_project_template_definition_get_tags (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_ICON_FILENAME:
            g_value_set_string (value, gen_project_template_definition_get_icon_filename (self));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_ARCHIVE_FILENAME:
            g_value_set_string (value, gen_project_template_definition_get_archive_filename (self));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void gen_project_template_definition_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
      GenProjectTemplateDefinition * self;
      self = GEN_PROJECT_TEMPLATE_DEFINITION (object);
      switch (property_id) {
            case GEN_PROJECT_TEMPLATE_DEFINITION_ID:
            gen_project_template_definition_set_id (self, g_value_get_int (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_VERSION:
            gen_project_template_definition_set_version (self, g_value_get_string (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_NAME:
            gen_project_template_definition_set_name (self, g_value_get_string (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_DESCRIPTION:
            gen_project_template_definition_set_description (self, g_value_get_string (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_DETAILS:
            gen_project_template_definition_set_details (self, g_value_get_string (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_LANGUAGE:
            gen_project_template_definition_set_language (self, g_value_get_string (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_BUILD_SYSTEM:
            gen_project_template_definition_set_build_system (self, g_value_get_string (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_ICON_FILENAME:
            gen_project_template_definition_set_icon_filename (self, g_value_get_string (value));
            break;
            case GEN_PROJECT_TEMPLATE_DEFINITION_ARCHIVE_FILENAME:
            gen_project_template_definition_set_archive_filename (self, g_value_get_string (value));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      if ((array != NULL) && (destroy_func != NULL)) {
            int i;
            for (i = 0; i < array_length; i = i + 1) {
                  if (((gpointer*) array)[i] != NULL) {
                        destroy_func (((gpointer*) array)[i]);
                  }
            }
      }
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      _vala_array_destroy (array, array_length, destroy_func);
      g_free (array);
}


static gint _vala_array_length (gpointer array) {
      int length;
      length = 0;
      if (array) {
            while (((gpointer*) array)[length]) {
                  length++;
            }
      }
      return length;
}





Generated by  Doxygen 1.6.0   Back to index