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

vtgprojectexecuterdialog.c

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

/*
 *  vtgprojectexecuterdialog.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 <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <valagee.h>
#include <vbf.h>
#include <gdk/gdkkeysyms.h>
#include <float.h>
#include <math.h>
#include <gobject/gvaluecollector.h>


#define VTG_TYPE_PROJECT_EXECUTER_DIALOG (vtg_project_executer_dialog_get_type ())
#define VTG_PROJECT_EXECUTER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_PROJECT_EXECUTER_DIALOG, VtgProjectExecuterDialog))
#define VTG_PROJECT_EXECUTER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_PROJECT_EXECUTER_DIALOG, VtgProjectExecuterDialogClass))
#define VTG_IS_PROJECT_EXECUTER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_PROJECT_EXECUTER_DIALOG))
#define VTG_IS_PROJECT_EXECUTER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_PROJECT_EXECUTER_DIALOG))
#define VTG_PROJECT_EXECUTER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_PROJECT_EXECUTER_DIALOG, VtgProjectExecuterDialogClass))

typedef struct _VtgProjectExecuterDialog VtgProjectExecuterDialog;
typedef struct _VtgProjectExecuterDialogClass VtgProjectExecuterDialogClass;
typedef struct _VtgProjectExecuterDialogPrivate VtgProjectExecuterDialogPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define VTG_TYPE_PROJECT_MANAGER (vtg_project_manager_get_type ())
#define VTG_PROJECT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_PROJECT_MANAGER, VtgProjectManager))
#define VTG_PROJECT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_PROJECT_MANAGER, VtgProjectManagerClass))
#define VTG_IS_PROJECT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_PROJECT_MANAGER))
#define VTG_IS_PROJECT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_PROJECT_MANAGER))
#define VTG_PROJECT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_PROJECT_MANAGER, VtgProjectManagerClass))

typedef struct _VtgProjectManager VtgProjectManager;
typedef struct _VtgProjectManagerClass VtgProjectManagerClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _VtgProjectManagerPrivate VtgProjectManagerPrivate;

#define VTG_TYPE_VCS_TYPES (vtg_vcs_types_get_type ())
#define _vala_collection_object_unref0(var) ((var == NULL) ? NULL : (var = (vala_collection_object_unref (var), NULL)))
#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))
typedef struct _VtgParamSpecProjectExecuterDialog VtgParamSpecProjectExecuterDialog;

00069 struct _VtgProjectExecuterDialog {
      GTypeInstance parent_instance;
      volatile int ref_count;
      VtgProjectExecuterDialogPrivate * priv;
};

00075 struct _VtgProjectExecuterDialogClass {
      GTypeClass parent_class;
      void (*finalize) (VtgProjectExecuterDialog *self);
};

00080 struct _VtgProjectExecuterDialogPrivate {
      GtkEntryCompletion* _completion;
      GtkDialog* _dialog;
      GtkTreeView* _tree;
      GtkButton* _button_exec;
};

typedef enum  {
      VTG_VCS_TYPES_NONE,
      VTG_VCS_TYPES_GIT,
      VTG_VCS_TYPES_BZR,
      VTG_VCS_TYPES_SVN
} VtgVcsTypes;

struct _VtgProjectManager {
      GObject parent_instance;
      VtgProjectManagerPrivate * priv;
      char* filename;
      gboolean is_default;
      ValaList* exec_targets;
      ValaList* all_vala_sources;
      VtgVcsTypes vcs_type;
      char* changelog_uri;
};

struct _VtgProjectManagerClass {
      GObjectClass parent_class;
};

00109 struct _VtgParamSpecProjectExecuterDialog {
      GParamSpec parent_instance;
};


static gpointer vtg_project_executer_dialog_parent_class = NULL;
static GType vtg_project_executer_dialog_type_id = 0;

gpointer vtg_project_executer_dialog_ref (gpointer instance);
void vtg_project_executer_dialog_unref (gpointer instance);
GParamSpec* vtg_param_spec_project_executer_dialog (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vtg_value_set_project_executer_dialog (GValue* value, gpointer v_object);
void vtg_value_take_project_executer_dialog (GValue* value, gpointer v_object);
gpointer vtg_value_get_project_executer_dialog (const GValue* value);
GType vtg_project_executer_dialog_get_type (void) G_GNUC_CONST;
GType vtg_project_executer_dialog_register_type (GTypeModule * module);
#define VTG_PROJECT_EXECUTER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VTG_TYPE_PROJECT_EXECUTER_DIALOG, VtgProjectExecuterDialogPrivate))
enum  {
      VTG_PROJECT_EXECUTER_DIALOG_DUMMY_PROPERTY
};
GType vtg_project_manager_get_type (void) G_GNUC_CONST;
GType vtg_project_manager_register_type (GTypeModule * module);
VtgProjectExecuterDialog* vtg_project_executer_dialog_new (GtkWindow* parent, VtgProjectManager* project);
VtgProjectExecuterDialog* vtg_project_executer_dialog_construct (GType object_type, GtkWindow* parent, VtgProjectManager* project);
static void vtg_project_executer_dialog_initialize_ui (VtgProjectExecuterDialog* self, GtkWindow* parent, VtgProjectManager* project);
GtkListStore* vtg_caches_get_executer_cache (void);
char* vtg_utils_get_ui_path (const char* id);
static gboolean vtg_project_executer_dialog_on_entry_key_press (VtgProjectExecuterDialog* self, GtkWidget* sender, GdkEventKey* evt);
static gboolean _vtg_project_executer_dialog_on_entry_key_press_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
static void vtg_project_executer_dialog_on_command_line_changed (VtgProjectExecuterDialog* self, GObject* pspec, GParamSpec* gobject);
static void _vtg_project_executer_dialog_on_command_line_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void vtg_project_executer_dialog_on_tree_selection_changed (VtgProjectExecuterDialog* self, GtkTreeSelection* treeselection);
static void _vtg_project_executer_dialog_on_tree_selection_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self);
GType vtg_vcs_types_get_type (void) G_GNUC_CONST;
gint vtg_project_executer_dialog_run (VtgProjectExecuterDialog* self);
const char* vtg_project_executer_dialog_get_command_line (VtgProjectExecuterDialog* self);
gboolean vtg_string_utils_is_null_or_empty (const char* data);
gboolean vtg_caches_cache_contains (GtkListStore* cache, const char* data);
void vtg_caches_cache_add (GtkListStore* cache, const char* data);
static void vtg_project_executer_dialog_finalize (VtgProjectExecuterDialog* obj);



VtgProjectExecuterDialog* vtg_project_executer_dialog_construct (GType object_type, GtkWindow* parent, VtgProjectManager* project) {
      VtgProjectExecuterDialog* self;
      g_return_val_if_fail (parent != NULL, NULL);
      g_return_val_if_fail (project != NULL, NULL);
      self = (VtgProjectExecuterDialog*) g_type_create_instance (object_type);
      vtg_project_executer_dialog_initialize_ui (self, parent, project);
      return self;
}


VtgProjectExecuterDialog* vtg_project_executer_dialog_new (GtkWindow* parent, VtgProjectManager* project) {
      return vtg_project_executer_dialog_construct (VTG_TYPE_PROJECT_EXECUTER_DIALOG, parent, project);
}


static gpointer _g_object_ref0 (gpointer self) {
      return self ? g_object_ref (self) : NULL;
}


static gboolean _vtg_project_executer_dialog_on_entry_key_press_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
      gboolean result;
      result = vtg_project_executer_dialog_on_entry_key_press (self, _sender, event);
      return result;
}


static void _vtg_project_executer_dialog_on_command_line_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
      vtg_project_executer_dialog_on_command_line_changed (self, _sender, pspec);
}


static void _vtg_project_executer_dialog_on_tree_selection_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self) {
      vtg_project_executer_dialog_on_tree_selection_changed (self, _sender);
}


static gpointer _vala_collection_object_ref0 (gpointer self) {
      return self ? vala_collection_object_ref (self) : NULL;
}


static glong string_get_length (const char* self) {
      glong result;
      g_return_val_if_fail (self != NULL, 0L);
      result = g_utf8_strlen (self, (gssize) (-1));
      return result;
}


static char* string_substring (const char* self, glong offset, glong len) {
      char* result = NULL;
      glong string_length;
      const char* start;
      g_return_val_if_fail (self != NULL, NULL);
      string_length = string_get_length (self);
      if (offset < 0) {
            offset = string_length + offset;
            g_return_val_if_fail (offset >= 0, NULL);
      } else {
            g_return_val_if_fail (offset <= string_length, NULL);
      }
      if (len < 0) {
            len = string_length - offset;
      }
      g_return_val_if_fail ((offset + len) <= string_length, NULL);
      start = g_utf8_offset_to_pointer (self, offset);
      result = g_strndup (start, ((gchar*) g_utf8_offset_to_pointer (start, len)) - ((gchar*) start));
      return result;
}


static void vtg_project_executer_dialog_initialize_ui (VtgProjectExecuterDialog* self, GtkWindow* parent, VtgProjectManager* project) {
      GtkListStore* completions;
      GtkBuilder* builder;
      GtkDialog* _tmp1_;
      GtkEntryCompletion* _tmp2_;
      GtkEntry* entry;
      GtkButton* _tmp3_;
      GtkTreeView* _tmp4_;
      GtkTreeViewColumn* column;
      GtkCellRendererText* renderer;
      ValaList* targets;
      GtkTreeIter iter = {0};
      GtkListStore* list;
      GError * _inner_error_ = NULL;
      g_return_if_fail (self != NULL);
      g_return_if_fail (parent != NULL);
      g_return_if_fail (project != NULL);
      completions = vtg_caches_get_executer_cache ();
      builder = gtk_builder_new ();
      {
            char* _tmp0_;
            gtk_builder_add_from_file (builder, _tmp0_ = vtg_utils_get_ui_path ("vtg.ui"), &_inner_error_);
            _g_free0 (_tmp0_);
            if (_inner_error_ != NULL) {
                  goto __catch25_g_error;
            }
      }
      goto __finally25;
      __catch25_g_error:
      {
            GError * err;
            err = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("vtgprojectexecuterdialog.vala:54: initialize_ui: %s", err->message);
                  _g_error_free0 (err);
            }
      }
      __finally25:
      if (_inner_error_ != NULL) {
            _g_object_unref0 (builder);
            _g_object_unref0 (completions);
            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;
      }
      self->priv->_dialog = (_tmp1_ = _g_object_ref0 (GTK_DIALOG (gtk_builder_get_object (builder, "dialog-run"))), _g_object_unref0 (self->priv->_dialog), _tmp1_);
      g_assert (self->priv->_dialog != NULL);
      gtk_window_set_transient_for ((GtkWindow*) self->priv->_dialog, parent);
      self->priv->_completion = (_tmp2_ = gtk_entry_completion_new (), _g_object_unref0 (self->priv->_completion), _tmp2_);
      gtk_entry_completion_set_model (self->priv->_completion, (GtkTreeModel*) completions);
      gtk_entry_completion_set_text_column (self->priv->_completion, 0);
      entry = _g_object_ref0 (GTK_ENTRY (gtk_builder_get_object (builder, "entry-command-line")));
      g_assert (entry != NULL);
      gtk_entry_set_completion (entry, self->priv->_completion);
      g_signal_connect ((GtkWidget*) entry, "key-press-event", (GCallback) _vtg_project_executer_dialog_on_entry_key_press_gtk_widget_key_press_event, self);
      g_signal_connect ((GObject*) entry, "notify::text", (GCallback) _vtg_project_executer_dialog_on_command_line_changed_g_object_notify, self);
      self->priv->_button_exec = (_tmp3_ = _g_object_ref0 (GTK_BUTTON (gtk_builder_get_object (builder, "button-run-execute"))), _g_object_unref0 (self->priv->_button_exec), _tmp3_);
      g_assert (self->priv->_button_exec != NULL);
      self->priv->_tree = (_tmp4_ = _g_object_ref0 (GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview-executables"))), _g_object_unref0 (self->priv->_tree), _tmp4_);
      g_assert (self->priv->_tree != NULL);
      column = g_object_ref_sink (gtk_tree_view_column_new ());
      renderer = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ());
      gtk_cell_layout_pack_start ((GtkCellLayout*) column, (GtkCellRenderer*) renderer, TRUE);
      gtk_cell_layout_add_attribute ((GtkCellLayout*) column, (GtkCellRenderer*) renderer, "text", 0);
      gtk_tree_view_append_column (self->priv->_tree, column);
      gtk_tree_selection_set_mode (gtk_tree_view_get_selection (self->priv->_tree), GTK_SELECTION_SINGLE);
      g_signal_connect (gtk_tree_view_get_selection (self->priv->_tree), "changed", (GCallback) _vtg_project_executer_dialog_on_tree_selection_changed_gtk_tree_selection_changed, self);
      targets = _vala_collection_object_ref0 (project->exec_targets);
      list = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
      {
            ValaIterator* _target_it;
            _target_it = vala_iterable_iterator ((ValaIterable*) targets);
            while (TRUE) {
                  VbfTarget* target;
                  char* _tmp5_;
                  char* _tmp6_;
                  char* path;
                  if (!vala_iterator_next (_target_it)) {
                        break;
                  }
                  target = (VbfTarget*) vala_iterator_get (_target_it);
                  gtk_list_store_append (list, &iter);
                  path = (_tmp6_ = string_substring (_tmp5_ = g_build_filename (target->group->id, target->name, NULL), string_get_length (target->group->project->id) + 1, -1), _g_free0 (_tmp5_), _tmp6_);
                  gtk_list_store_set (list, &iter, 0, target->name, 1, path, -1);
                  _g_free0 (path);
                  _g_object_unref0 (target);
            }
            _vala_collection_object_unref0 (_target_it);
      }
      gtk_tree_view_set_model (self->priv->_tree, (GtkTreeModel*) list);
      if (gtk_tree_model_get_iter_first ((GtkTreeModel*) completions, &iter)) {
            char* val;
            val = NULL;
            gtk_tree_model_get ((GtkTreeModel*) completions, &iter, 0, &val, -1);
            gtk_entry_set_text (entry, val);
            gtk_editable_set_position ((GtkEditable*) entry, -1);
            _g_free0 (val);
      } else {
            if (gtk_tree_model_get_iter_first ((GtkTreeModel*) list, &iter)) {
                  char* program;
                  program = NULL;
                  gtk_tree_model_get ((GtkTreeModel*) list, &iter, 1, &program, -1);
                  gtk_entry_set_text (entry, program);
                  gtk_editable_set_position ((GtkEditable*) entry, -1);
                  _g_free0 (program);
            }
      }
      _g_object_unref0 (list);
      _vala_collection_object_unref0 (targets);
      _g_object_unref0 (renderer);
      _g_object_unref0 (column);
      _g_object_unref0 (entry);
      _g_object_unref0 (builder);
      _g_object_unref0 (completions);
}


gint vtg_project_executer_dialog_run (VtgProjectExecuterDialog* self) {
      gint result = 0;
      gint res;
      char* cmd;
      GtkListStore* cache;
      gboolean _tmp0_ = FALSE;
      g_return_val_if_fail (self != NULL, 0);
      res = gtk_dialog_run (self->priv->_dialog);
      cmd = g_strdup (vtg_project_executer_dialog_get_command_line (self));
      cache = vtg_caches_get_executer_cache ();
      if (!vtg_string_utils_is_null_or_empty (cmd)) {
            _tmp0_ = !vtg_caches_cache_contains (cache, cmd);
      } else {
            _tmp0_ = FALSE;
      }
      if (_tmp0_) {
            vtg_caches_cache_add (cache, cmd);
      }
      result = res;
      _g_object_unref0 (cache);
      _g_free0 (cmd);
      return result;
}


static void vtg_project_executer_dialog_on_tree_selection_changed (VtgProjectExecuterDialog* self, GtkTreeSelection* treeselection) {
      GtkTreeIter iter = {0};
      GtkTreeModel* m;
      GtkTreeModel* _tmp0_ = NULL;
      gboolean _tmp1_;
      GtkTreeModel* _tmp2_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (treeselection != NULL);
      m = NULL;
      if ((_tmp1_ = gtk_tree_selection_get_selected (treeselection, &_tmp0_, &iter), m = (_tmp2_ = _g_object_ref0 (_tmp0_), _g_object_unref0 (m), _tmp2_), _tmp1_)) {
            GtkListStore* model;
            char* program;
            GtkEntry* entry;
            model = _g_object_ref0 (GTK_LIST_STORE (m));
            program = NULL;
            gtk_tree_model_get ((GtkTreeModel*) model, &iter, 1, &program, -1);
            entry = _g_object_ref0 (GTK_ENTRY (gtk_entry_completion_get_entry (self->priv->_completion)));
            gtk_entry_set_text (entry, program);
            gtk_editable_set_position ((GtkEditable*) entry, -1);
            _g_object_unref0 (entry);
            _g_free0 (program);
            _g_object_unref0 (model);
      }
      _g_object_unref0 (m);
}


static void vtg_project_executer_dialog_on_command_line_changed (VtgProjectExecuterDialog* self, GObject* pspec, GParamSpec* gobject) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (pspec != NULL);
      g_return_if_fail (gobject != NULL);
      gtk_widget_set_sensitive ((GtkWidget*) self->priv->_button_exec, !vtg_string_utils_is_null_or_empty (gtk_entry_get_text (GTK_ENTRY (gtk_entry_completion_get_entry (self->priv->_completion)))));
}


static gboolean vtg_project_executer_dialog_on_entry_key_press (VtgProjectExecuterDialog* self, GtkWidget* sender, GdkEventKey* evt) {
      gboolean result = FALSE;
      gboolean _tmp0_ = FALSE;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (sender != NULL, FALSE);
      if ((*evt).keyval == GDK_Down) {
            _tmp0_ = TRUE;
      } else {
            _tmp0_ = (*evt).keyval == GDK_Up;
      }
      if (_tmp0_) {
            GtkTreeIter sel = {0};
            GtkTreeModel* model;
            GtkTreePath* path;
            GtkTreeModel* _tmp1_ = NULL;
            gboolean _tmp2_;
            GtkTreeModel* _tmp3_;
            GtkTreePath* _tmp6_;
            model = NULL;
            path = NULL;
            if ((_tmp2_ = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (self->priv->_tree), &_tmp1_, &sel), model = (_tmp3_ = _g_object_ref0 (_tmp1_), _g_object_unref0 (model), _tmp3_), _tmp2_)) {
                  if ((*evt).keyval == GDK_Down) {
                        gtk_tree_model_iter_next (model, &sel);
                  } else {
                        GtkTreePath* _tmp4_;
                        path = (_tmp4_ = gtk_tree_model_get_path (model, &sel), _gtk_tree_path_free0 (path), _tmp4_);
                        if (gtk_tree_path_prev (path)) {
                              gtk_tree_model_get_iter (model, &sel, path);
                        } else {
                              gtk_tree_selection_select_iter (gtk_tree_view_get_selection (self->priv->_tree), &sel);
                        }
                  }
            } else {
                  GtkTreeModel* _tmp5_;
                  model = (_tmp5_ = _g_object_ref0 (gtk_tree_view_get_model (self->priv->_tree)), _g_object_unref0 (model), _tmp5_);
                  gtk_tree_model_get_iter_first (model, &sel);
            }
            path = (_tmp6_ = gtk_tree_model_get_path (model, &sel), _gtk_tree_path_free0 (path), _tmp6_);
            gtk_tree_selection_select_iter (gtk_tree_view_get_selection (self->priv->_tree), &sel);
            gtk_tree_view_scroll_to_cell (self->priv->_tree, path, NULL, FALSE, (float) 0, (float) 0);
            result = TRUE;
            _gtk_tree_path_free0 (path);
            _g_object_unref0 (model);
            return result;
      }
      result = FALSE;
      return result;
}


const char* vtg_project_executer_dialog_get_command_line (VtgProjectExecuterDialog* self) {
      const char* result;
      GtkEntry* en;
      g_return_val_if_fail (self != NULL, NULL);
      en = _g_object_ref0 (GTK_ENTRY (gtk_entry_completion_get_entry (self->priv->_completion)));
      result = gtk_entry_get_text (en);
      _g_object_unref0 (en);
      return result;
}


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


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


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


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


static gchar* vtg_value_project_executer_dialog_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      if (collect_values[0].v_pointer) {
            VtgProjectExecuterDialog* 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_project_executer_dialog_ref (object);
      } else {
            value->data[0].v_pointer = NULL;
      }
      return NULL;
}


static gchar* vtg_value_project_executer_dialog_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      VtgProjectExecuterDialog** 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_project_executer_dialog_ref (value->data[0].v_pointer);
      }
      return NULL;
}


GParamSpec* vtg_param_spec_project_executer_dialog (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
      VtgParamSpecProjectExecuterDialog* spec;
      g_return_val_if_fail (g_type_is_a (object_type, VTG_TYPE_PROJECT_EXECUTER_DIALOG), 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_project_executer_dialog (const GValue* value) {
      g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VTG_TYPE_PROJECT_EXECUTER_DIALOG), NULL);
      return value->data[0].v_pointer;
}


void vtg_value_set_project_executer_dialog (GValue* value, gpointer v_object) {
      VtgProjectExecuterDialog* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VTG_TYPE_PROJECT_EXECUTER_DIALOG));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VTG_TYPE_PROJECT_EXECUTER_DIALOG));
            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_project_executer_dialog_ref (value->data[0].v_pointer);
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            vtg_project_executer_dialog_unref (old);
      }
}


void vtg_value_take_project_executer_dialog (GValue* value, gpointer v_object) {
      VtgProjectExecuterDialog* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VTG_TYPE_PROJECT_EXECUTER_DIALOG));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VTG_TYPE_PROJECT_EXECUTER_DIALOG));
            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_project_executer_dialog_unref (old);
      }
}


static void vtg_project_executer_dialog_class_init (VtgProjectExecuterDialogClass * klass) {
      vtg_project_executer_dialog_parent_class = g_type_class_peek_parent (klass);
      VTG_PROJECT_EXECUTER_DIALOG_CLASS (klass)->finalize = vtg_project_executer_dialog_finalize;
      g_type_class_add_private (klass, sizeof (VtgProjectExecuterDialogPrivate));
}


static void vtg_project_executer_dialog_instance_init (VtgProjectExecuterDialog * self) {
      self->priv = VTG_PROJECT_EXECUTER_DIALOG_GET_PRIVATE (self);
      self->ref_count = 1;
}


static void vtg_project_executer_dialog_finalize (VtgProjectExecuterDialog* obj) {
      VtgProjectExecuterDialog * self;
      self = VTG_PROJECT_EXECUTER_DIALOG (obj);
      {
            gtk_object_destroy ((GtkObject*) self->priv->_dialog);
      }
      _g_object_unref0 (self->priv->_completion);
      _g_object_unref0 (self->priv->_dialog);
      _g_object_unref0 (self->priv->_tree);
      _g_object_unref0 (self->priv->_button_exec);
}


GType vtg_project_executer_dialog_get_type (void) {
      return vtg_project_executer_dialog_type_id;
}


GType vtg_project_executer_dialog_register_type (GTypeModule * module) {
      static const GTypeValueTable g_define_type_value_table = { vtg_value_project_executer_dialog_init, vtg_value_project_executer_dialog_free_value, vtg_value_project_executer_dialog_copy_value, vtg_value_project_executer_dialog_peek_pointer, "p", vtg_value_project_executer_dialog_collect_value, "p", vtg_value_project_executer_dialog_lcopy_value };
      static const GTypeInfo g_define_type_info = { sizeof (VtgProjectExecuterDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vtg_project_executer_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VtgProjectExecuterDialog), 0, (GInstanceInitFunc) vtg_project_executer_dialog_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_project_executer_dialog_type_id = g_type_register_fundamental (g_type_fundamental_next (), "VtgProjectExecuterDialog", &g_define_type_info, &g_define_type_fundamental_info, 0);
      return vtg_project_executer_dialog_type_id;
}


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


void vtg_project_executer_dialog_unref (gpointer instance) {
      VtgProjectExecuterDialog* self;
      self = instance;
      if (g_atomic_int_dec_and_test (&self->ref_count)) {
            VTG_PROJECT_EXECUTER_DIALOG_GET_CLASS (self)->finalize (self);
            g_type_free_instance ((GTypeInstance *) self);
      }
}





Generated by  Doxygen 1.6.0   Back to index