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

vtgprocesswatchinfo.c

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

/*
 *  vtgprocesswatchinfo.vala - Vala developer toys for GEdit
 *  
 *  Copyright (C) 2008 - Andrea Del Signore <sejerpz@tin.it>
 *  
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *   
 *  This program 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 General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330,
 *  Boston, MA 02111-1307, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include <gobject/gvaluecollector.h>


#define VTG_TYPE_PROCESS_WATCH_INFO (vtg_process_watch_info_get_type ())
#define VTG_PROCESS_WATCH_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_PROCESS_WATCH_INFO, VtgProcessWatchInfo))
#define VTG_PROCESS_WATCH_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_PROCESS_WATCH_INFO, VtgProcessWatchInfoClass))
#define VTG_IS_PROCESS_WATCH_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_PROCESS_WATCH_INFO))
#define VTG_IS_PROCESS_WATCH_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_PROCESS_WATCH_INFO))
#define VTG_PROCESS_WATCH_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_PROCESS_WATCH_INFO, VtgProcessWatchInfoClass))

typedef struct _VtgProcessWatchInfo VtgProcessWatchInfo;
typedef struct _VtgProcessWatchInfoClass VtgProcessWatchInfoClass;
typedef struct _VtgProcessWatchInfoPrivate VtgProcessWatchInfoPrivate;

#define VTG_TYPE_OUTPUT_TYPES (vtg_output_types_get_type ())
#define _g_io_channel_unref0(var) ((var == NULL) ? NULL : (var = (g_io_channel_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _VtgParamSpecProcessWatchInfo VtgParamSpecProcessWatchInfo;

typedef enum  {
      VTG_OUTPUT_TYPES_MESSAGE,
      VTG_OUTPUT_TYPES_ERROR,
      VTG_OUTPUT_TYPES_CHILD_PROCESS,
      VTG_OUTPUT_TYPES_BUILD,
      VTG_OUTPUT_TYPES_SEARCH
} VtgOutputTypes;

struct _VtgProcessWatchInfo {
      GTypeInstance parent_instance;
      volatile int ref_count;
      VtgProcessWatchInfoPrivate * priv;
      guint id;
      GIOChannel* stdin;
      GIOChannel* stdout;
      GIOChannel* stderr;
      guint stdout_watch_id;
      guint stderr_watch_id;
      VtgOutputTypes output_type;
};

struct _VtgProcessWatchInfoClass {
      GTypeClass parent_class;
      void (*finalize) (VtgProcessWatchInfo *self);
};

00072 struct _VtgParamSpecProcessWatchInfo {
      GParamSpec parent_instance;
};


static gpointer vtg_process_watch_info_parent_class = NULL;
static GType vtg_process_watch_info_type_id = 0;

gpointer vtg_process_watch_info_ref (gpointer instance);
void vtg_process_watch_info_unref (gpointer instance);
GParamSpec* vtg_param_spec_process_watch_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vtg_value_set_process_watch_info (GValue* value, gpointer v_object);
void vtg_value_take_process_watch_info (GValue* value, gpointer v_object);
gpointer vtg_value_get_process_watch_info (const GValue* value);
GType vtg_process_watch_info_get_type (void) G_GNUC_CONST;
GType vtg_process_watch_info_register_type (GTypeModule * module);
GType vtg_output_types_get_type (void) G_GNUC_CONST;
enum  {
      VTG_PROCESS_WATCH_INFO_DUMMY_PROPERTY
};
VtgProcessWatchInfo* vtg_process_watch_info_new (guint id);
VtgProcessWatchInfo* vtg_process_watch_info_construct (GType object_type, guint id);
void vtg_process_watch_info_cleanup (VtgProcessWatchInfo* self);
static void vtg_process_watch_info_finalize (VtgProcessWatchInfo* obj);



VtgProcessWatchInfo* vtg_process_watch_info_construct (GType object_type, guint id) {
      VtgProcessWatchInfo* self;
      self = (VtgProcessWatchInfo*) g_type_create_instance (object_type);
      self->id = id;
      return self;
}


VtgProcessWatchInfo* vtg_process_watch_info_new (guint id) {
      return vtg_process_watch_info_construct (VTG_TYPE_PROCESS_WATCH_INFO, id);
}


void vtg_process_watch_info_cleanup (VtgProcessWatchInfo* self) {
      GError * _inner_error_ = NULL;
      g_return_if_fail (self != NULL);
      {
            GIOChannel* _tmp0_;
            GIOChannel* _tmp1_;
            GIOChannel* _tmp2_;
            if (self->stdin != NULL) {
                  g_io_channel_flush (self->stdin, &_inner_error_);
                  if (_inner_error_ != NULL) {
                        goto __catch30_g_error;
                  }
            }
            g_io_channel_flush (self->stdout, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch30_g_error;
            }
            g_io_channel_flush (self->stderr, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch30_g_error;
            }
            if (self->stdout_watch_id != 0) {
                  g_source_remove (self->stdout_watch_id);
            }
            if (self->stderr_watch_id != 0) {
                  g_source_remove (self->stderr_watch_id);
            }
            self->stdin = (_tmp0_ = NULL, _g_io_channel_unref0 (self->stdin), _tmp0_);
            self->stdout = (_tmp1_ = NULL, _g_io_channel_unref0 (self->stdout), _tmp1_);
            self->stderr = (_tmp2_ = NULL, _g_io_channel_unref0 (self->stderr), _tmp2_);
      }
      goto __finally30;
      __catch30_g_error:
      {
            GError * err;
            err = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("vtgprocesswatchinfo.vala:65: cleanup - error: %s", err->message);
                  _g_error_free0 (err);
            }
      }
      __finally30:
      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;
      }
}


static void vtg_value_process_watch_info_init (GValue* value) {
      value->data[0].v_pointer = NULL;
}


static void vtg_value_process_watch_info_free_value (GValue* value) {
      if (value->data[0].v_pointer) {
            vtg_process_watch_info_unref (value->data[0].v_pointer);
      }
}


static void vtg_value_process_watch_info_copy_value (const GValue* src_value, GValue* dest_value) {
      if (src_value->data[0].v_pointer) {
            dest_value->data[0].v_pointer = vtg_process_watch_info_ref (src_value->data[0].v_pointer);
      } else {
            dest_value->data[0].v_pointer = NULL;
      }
}


static gpointer vtg_value_process_watch_info_peek_pointer (const GValue* value) {
      return value->data[0].v_pointer;
}


static gchar* vtg_value_process_watch_info_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      if (collect_values[0].v_pointer) {
            VtgProcessWatchInfo* object;
            object = collect_values[0].v_pointer;
            if (object->parent_instance.g_class == NULL) {
                  return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
            } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
                  return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
            }
            value->data[0].v_pointer = vtg_process_watch_info_ref (object);
      } else {
            value->data[0].v_pointer = NULL;
      }
      return NULL;
}


static gchar* vtg_value_process_watch_info_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      VtgProcessWatchInfo** object_p;
      object_p = collect_values[0].v_pointer;
      if (!object_p) {
            return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
      }
      if (!value->data[0].v_pointer) {
            *object_p = NULL;
      } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
            *object_p = value->data[0].v_pointer;
      } else {
            *object_p = vtg_process_watch_info_ref (value->data[0].v_pointer);
      }
      return NULL;
}


GParamSpec* vtg_param_spec_process_watch_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
      VtgParamSpecProcessWatchInfo* spec;
      g_return_val_if_fail (g_type_is_a (object_type, VTG_TYPE_PROCESS_WATCH_INFO), NULL);
      spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
      G_PARAM_SPEC (spec)->value_type = object_type;
      return G_PARAM_SPEC (spec);
}


gpointer vtg_value_get_process_watch_info (const GValue* value) {
      g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VTG_TYPE_PROCESS_WATCH_INFO), NULL);
      return value->data[0].v_pointer;
}


void vtg_value_set_process_watch_info (GValue* value, gpointer v_object) {
      VtgProcessWatchInfo* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VTG_TYPE_PROCESS_WATCH_INFO));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VTG_TYPE_PROCESS_WATCH_INFO));
            g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
            value->data[0].v_pointer = v_object;
            vtg_process_watch_info_ref (value->data[0].v_pointer);
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            vtg_process_watch_info_unref (old);
      }
}


void vtg_value_take_process_watch_info (GValue* value, gpointer v_object) {
      VtgProcessWatchInfo* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VTG_TYPE_PROCESS_WATCH_INFO));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VTG_TYPE_PROCESS_WATCH_INFO));
            g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
            value->data[0].v_pointer = v_object;
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            vtg_process_watch_info_unref (old);
      }
}


static void vtg_process_watch_info_class_init (VtgProcessWatchInfoClass * klass) {
      vtg_process_watch_info_parent_class = g_type_class_peek_parent (klass);
      VTG_PROCESS_WATCH_INFO_CLASS (klass)->finalize = vtg_process_watch_info_finalize;
}


static void vtg_process_watch_info_instance_init (VtgProcessWatchInfo * self) {
      self->id = (guint) 0;
      self->stdin = NULL;
      self->stdout = NULL;
      self->stderr = NULL;
      self->stdout_watch_id = (guint) 0;
      self->stderr_watch_id = (guint) 0;
      self->output_type = VTG_OUTPUT_TYPES_CHILD_PROCESS;
      self->ref_count = 1;
}


static void vtg_process_watch_info_finalize (VtgProcessWatchInfo* obj) {
      VtgProcessWatchInfo * self;
      self = VTG_PROCESS_WATCH_INFO (obj);
      _g_io_channel_unref0 (self->stdin);
      _g_io_channel_unref0 (self->stdout);
      _g_io_channel_unref0 (self->stderr);
}


GType vtg_process_watch_info_get_type (void) {
      return vtg_process_watch_info_type_id;
}


GType vtg_process_watch_info_register_type (GTypeModule * module) {
      static const GTypeValueTable g_define_type_value_table = { vtg_value_process_watch_info_init, vtg_value_process_watch_info_free_value, vtg_value_process_watch_info_copy_value, vtg_value_process_watch_info_peek_pointer, "p", vtg_value_process_watch_info_collect_value, "p", vtg_value_process_watch_info_lcopy_value };
      static const GTypeInfo g_define_type_info = { sizeof (VtgProcessWatchInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vtg_process_watch_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VtgProcessWatchInfo), 0, (GInstanceInitFunc) vtg_process_watch_info_instance_init, &g_define_type_value_table };
      static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
      vtg_process_watch_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "VtgProcessWatchInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
      return vtg_process_watch_info_type_id;
}


gpointer vtg_process_watch_info_ref (gpointer instance) {
      VtgProcessWatchInfo* self;
      self = instance;
      g_atomic_int_inc (&self->ref_count);
      return instance;
}


void vtg_process_watch_info_unref (gpointer instance) {
      VtgProcessWatchInfo* self;
      self = instance;
      if (g_atomic_int_dec_and_test (&self->ref_count)) {
            VTG_PROCESS_WATCH_INFO_GET_CLASS (self)->finalize (self);
            g_type_free_instance ((GTypeInstance *) self);
      }
}





Generated by  Doxygen 1.6.0   Back to index