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

vtgsymbolcompletion.c

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

/*
 *  vtgsymbolcompletionhelper.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 <afrodite.h>
#include <gedit/gedit-view.h>
#include <gtksourceview/gtksourceview.h>
#include <gtk/gtk.h>
#include <valagee.h>
#include <stdlib.h>
#include <string.h>
#include <gedit/gedit-window.h>
#include <gedit/gedit-document.h>
#include <gedit/gedit-tab.h>
#include <gedit/gedit-statusbar.h>
#include <glib/gi18n-lib.h>


#define VTG_TYPE_SYMBOL_COMPLETION (vtg_symbol_completion_get_type ())
#define VTG_SYMBOL_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletion))
#define VTG_SYMBOL_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletionClass))
#define VTG_IS_SYMBOL_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SYMBOL_COMPLETION))
#define VTG_IS_SYMBOL_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SYMBOL_COMPLETION))
#define VTG_SYMBOL_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletionClass))

typedef struct _VtgSymbolCompletion VtgSymbolCompletion;
typedef struct _VtgSymbolCompletionClass VtgSymbolCompletionClass;
typedef struct _VtgSymbolCompletionPrivate VtgSymbolCompletionPrivate;

#define VTG_TYPE_PLUGIN_INSTANCE (vtg_plugin_instance_get_type ())
#define VTG_PLUGIN_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_PLUGIN_INSTANCE, VtgPluginInstance))
#define VTG_PLUGIN_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_PLUGIN_INSTANCE, VtgPluginInstanceClass))
#define VTG_IS_PLUGIN_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_PLUGIN_INSTANCE))
#define VTG_IS_PLUGIN_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_PLUGIN_INSTANCE))
#define VTG_PLUGIN_INSTANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_PLUGIN_INSTANCE, VtgPluginInstanceClass))

typedef struct _VtgPluginInstance VtgPluginInstance;
typedef struct _VtgPluginInstanceClass VtgPluginInstanceClass;

#define VTG_TYPE_SYMBOL_COMPLETION_PROVIDER (vtg_symbol_completion_provider_get_type ())
#define VTG_SYMBOL_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, VtgSymbolCompletionProvider))
#define VTG_SYMBOL_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, VtgSymbolCompletionProviderClass))
#define VTG_IS_SYMBOL_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER))
#define VTG_IS_SYMBOL_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER))
#define VTG_SYMBOL_COMPLETION_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, VtgSymbolCompletionProviderClass))

typedef struct _VtgSymbolCompletionProvider VtgSymbolCompletionProvider;
typedef struct _VtgSymbolCompletionProviderClass VtgSymbolCompletionProviderClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _afrodite_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_source_reference_unref (var), NULL)))

#define VTG_TYPE_SOURCE_BOOKMARK (vtg_source_bookmark_get_type ())
#define VTG_SOURCE_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmark))
#define VTG_SOURCE_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmarkClass))
#define VTG_IS_SOURCE_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SOURCE_BOOKMARK))
#define VTG_IS_SOURCE_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SOURCE_BOOKMARK))
#define VTG_SOURCE_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmarkClass))

typedef struct _VtgSourceBookmark VtgSourceBookmark;
typedef struct _VtgSourceBookmarkClass VtgSourceBookmarkClass;
#define _vtg_source_bookmark_unref0(var) ((var == NULL) ? NULL : (var = (vtg_source_bookmark_unref (var), NULL)))
typedef struct _VtgSourceBookmarkPrivate VtgSourceBookmarkPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define VTG_TYPE_SOURCE_BOOKMARKS (vtg_source_bookmarks_get_type ())
#define VTG_SOURCE_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SOURCE_BOOKMARKS, VtgSourceBookmarks))
#define VTG_SOURCE_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SOURCE_BOOKMARKS, VtgSourceBookmarksClass))
#define VTG_IS_SOURCE_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SOURCE_BOOKMARKS))
#define VTG_IS_SOURCE_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SOURCE_BOOKMARKS))
#define VTG_SOURCE_BOOKMARKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SOURCE_BOOKMARKS, VtgSourceBookmarksClass))

typedef struct _VtgSourceBookmarks VtgSourceBookmarks;
typedef struct _VtgSourceBookmarksClass VtgSourceBookmarksClass;

00098 struct _VtgSymbolCompletion {
      GObject parent_instance;
      VtgSymbolCompletionPrivate * priv;
};

00103 struct _VtgSymbolCompletionClass {
      GObjectClass parent_class;
};

00107 struct _VtgSymbolCompletionPrivate {
      VtgPluginInstance* _plugin_instance;
      AfroditeCompletionEngine* _completion_engine;
      GeditView* _view;
      VtgSymbolCompletionProvider* _provider;
      GtkSourceCompletion* _manager;
};

struct _VtgSourceBookmark {
      GTypeInstance parent_instance;
      volatile int ref_count;
      VtgSourceBookmarkPrivate * priv;
      char* uri;
      gint line;
      gint column;
};

struct _VtgSourceBookmarkClass {
      GTypeClass parent_class;
      void (*finalize) (VtgSourceBookmark *self);
};


static gpointer vtg_symbol_completion_parent_class = NULL;
static GType vtg_symbol_completion_type_id = 0;

GType vtg_symbol_completion_get_type (void) G_GNUC_CONST;
GType vtg_symbol_completion_register_type (GTypeModule * module);
GType vtg_plugin_instance_get_type (void) G_GNUC_CONST;
GType vtg_plugin_instance_register_type (GTypeModule * module);
GType vtg_symbol_completion_provider_get_type (void) G_GNUC_CONST;
GType vtg_symbol_completion_provider_register_type (GTypeModule * module);
#define VTG_SYMBOL_COMPLETION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletionPrivate))
enum  {
      VTG_SYMBOL_COMPLETION_DUMMY_PROPERTY,
      VTG_SYMBOL_COMPLETION_PLUGIN_INSTANCE,
      VTG_SYMBOL_COMPLETION_VIEW,
      VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE
};
VtgSymbolCompletion* vtg_symbol_completion_new (VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine);
VtgSymbolCompletion* vtg_symbol_completion_construct (GType object_type, VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine);
static void vtg_symbol_completion_on_realized (VtgSymbolCompletion* self, GtkWidget* sender);
static void _vtg_symbol_completion_on_realized_gtk_widget_realize (GtkWidget* _sender, gpointer self);
static void vtg_symbol_completion_setup_gsc_completion (VtgSymbolCompletion* self, GeditView* view);
void vtg_symbol_completion_deactivate (VtgSymbolCompletion* self);
static void vtg_symbol_completion_on_completion_lock_failed (VtgSymbolCompletion* self, VtgSymbolCompletionProvider* sender);
static void _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed (VtgSymbolCompletionProvider* _sender, gpointer self);
VtgSymbolCompletionProvider* vtg_symbol_completion_provider_new (VtgSymbolCompletion* symbol_completion);
VtgSymbolCompletionProvider* vtg_symbol_completion_provider_construct (GType object_type, VtgSymbolCompletion* symbol_completion);
void vtg_symbol_completion_complete_word (VtgSymbolCompletion* self);
void vtg_symbol_completion_goto_definition (VtgSymbolCompletion* self);
AfroditeSymbol* vtg_symbol_completion_provider_get_current_symbol_item (VtgSymbolCompletionProvider* self, gint retry_count);
gpointer vtg_source_bookmark_ref (gpointer instance);
void vtg_source_bookmark_unref (gpointer instance);
GParamSpec* vtg_param_spec_source_bookmark (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vtg_value_set_source_bookmark (GValue* value, gpointer v_object);
void vtg_value_take_source_bookmark (GValue* value, gpointer v_object);
gpointer vtg_value_get_source_bookmark (const GValue* value);
GType vtg_source_bookmark_get_type (void) G_GNUC_CONST;
GType vtg_source_bookmark_register_type (GTypeModule * module);
GeditWindow* vtg_plugin_instance_get_window (VtgPluginInstance* self);
VtgSourceBookmark* vtg_source_bookmark_new (void);
VtgSourceBookmark* vtg_source_bookmark_construct (GType object_type);
GType vtg_source_bookmarks_get_type (void) G_GNUC_CONST;
GType vtg_source_bookmarks_register_type (GTypeModule * module);
VtgSourceBookmarks* vtg_plugin_instance_get_bookmarks (VtgPluginInstance* self);
void vtg_source_bookmarks_add_bookmark (VtgSourceBookmarks* self, VtgSourceBookmark* item, gboolean _auto_);
GeditTab* vtg_plugin_instance_activate_uri (VtgPluginInstance* self, const char* uri, gint line, gint col);
static void vtg_symbol_completion_display_completion_lock_failed_message (VtgSymbolCompletion* self);
VtgPluginInstance* vtg_symbol_completion_get_plugin_instance (VtgSymbolCompletion* self);
static void vtg_symbol_completion_set_plugin_instance (VtgSymbolCompletion* self, VtgPluginInstance* value);
GeditView* vtg_symbol_completion_get_view (VtgSymbolCompletion* self);
static void vtg_symbol_completion_set_view (VtgSymbolCompletion* self, GeditView* value);
AfroditeCompletionEngine* vtg_symbol_completion_get_completion_engine (VtgSymbolCompletion* self);
void vtg_symbol_completion_set_completion_engine (VtgSymbolCompletion* self, AfroditeCompletionEngine* value);
static GObject * vtg_symbol_completion_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void vtg_symbol_completion_finalize (GObject* obj);
static void vtg_symbol_completion_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void vtg_symbol_completion_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);



VtgSymbolCompletion* vtg_symbol_completion_construct (GType object_type, VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine) {
      VtgSymbolCompletion * self;
      g_return_val_if_fail (plugin_instance != NULL, NULL);
      g_return_val_if_fail (view != NULL, NULL);
      g_return_val_if_fail (completion_engine != NULL, NULL);
      self = (VtgSymbolCompletion*) g_object_new (object_type, "plugin-instance", plugin_instance, "view", view, "completion-engine", completion_engine, NULL);
      return self;
}


VtgSymbolCompletion* vtg_symbol_completion_new (VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine) {
      return vtg_symbol_completion_construct (VTG_TYPE_SYMBOL_COMPLETION, plugin_instance, view, completion_engine);
}


static void _vtg_symbol_completion_on_realized_gtk_widget_realize (GtkWidget* _sender, gpointer self) {
      vtg_symbol_completion_on_realized (self, _sender);
}


static void vtg_symbol_completion_on_realized (VtgSymbolCompletion* self, GtkWidget* sender) {
      guint _tmp0_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (sender != NULL);
      g_signal_parse_name ("realize", GTK_TYPE_WIDGET, &_tmp0_, NULL, FALSE);
      g_signal_handlers_disconnect_matched ((GtkWidget*) self->priv->_view, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _vtg_symbol_completion_on_realized_gtk_widget_realize, self);
      vtg_symbol_completion_setup_gsc_completion (self, self->priv->_view);
}


static void _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed (VtgSymbolCompletionProvider* _sender, gpointer self) {
      vtg_symbol_completion_on_completion_lock_failed (self, _sender);
}


void vtg_symbol_completion_deactivate (VtgSymbolCompletion* self) {
      GError * _inner_error_ = NULL;
      g_return_if_fail (self != NULL);
      {
            guint _tmp0_;
            GtkSourceCompletion* _tmp1_;
            g_signal_parse_name ("completion-lock-failed", VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, &_tmp0_, NULL, FALSE);
            g_signal_handlers_disconnect_matched (self->priv->_provider, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed, self);
            gtk_source_completion_remove_provider (self->priv->_manager, (GtkSourceCompletionProvider*) self->priv->_provider, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch1_g_error;
            }
            self->priv->_manager = (_tmp1_ = NULL, _g_object_unref0 (self->priv->_manager), _tmp1_);
      }
      goto __finally1;
      __catch1_g_error:
      {
            GError * err;
            err = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_critical ("vtgsymbolcompletion.vala:78: error: %s", err->message);
                  _g_error_free0 (err);
            }
      }
      __finally1:
      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 gpointer _g_object_ref0 (gpointer self) {
      return self ? g_object_ref (self) : NULL;
}


static void vtg_symbol_completion_setup_gsc_completion (VtgSymbolCompletion* self, GeditView* view) {
      GError * _inner_error_ = NULL;
      g_return_if_fail (self != NULL);
      g_return_if_fail (view != NULL);
      {
            GtkSourceCompletion* _tmp0_;
            VtgSymbolCompletionProvider* _tmp1_;
            self->priv->_manager = (_tmp0_ = _g_object_ref0 (gtk_source_view_get_completion ((GtkSourceView*) view)), _g_object_unref0 (self->priv->_manager), _tmp0_);
            self->priv->_provider = (_tmp1_ = vtg_symbol_completion_provider_new (self), _g_object_unref0 (self->priv->_provider), _tmp1_);
            g_signal_connect_object (self->priv->_provider, "completion-lock-failed", (GCallback) _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed, self, 0);
            g_object_set (self->priv->_manager, "remember-info-visibility", TRUE, NULL);
            g_object_set (self->priv->_manager, "select-on-show", TRUE, NULL);
            gtk_source_completion_add_provider (self->priv->_manager, (GtkSourceCompletionProvider*) self->priv->_provider, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch2_g_error;
            }
      }
      goto __finally2;
      __catch2_g_error:
      {
            GError * err;
            err = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_critical ("vtgsymbolcompletion.vala:92: error: %s", err->message);
                  _g_error_free0 (err);
            }
      }
      __finally2:
      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;
      }
}


void vtg_symbol_completion_complete_word (VtgSymbolCompletion* self) {
      g_return_if_fail (self != NULL);
}


void vtg_symbol_completion_goto_definition (VtgSymbolCompletion* self) {
      AfroditeSymbol* item;
      GError * _inner_error_ = NULL;
      g_return_if_fail (self != NULL);
      item = vtg_symbol_completion_provider_get_current_symbol_item (self->priv->_provider, 500);
      if (item != NULL) {
            if (afrodite_symbol_get_has_source_references (item)) {
                  {
                        AfroditeSourceReference* _tmp0_;
                        char* _tmp1_;
                        char* uri;
                        AfroditeSourceReference* _tmp2_;
                        gint _tmp3_;
                        gint line;
                        AfroditeSourceReference* _tmp4_;
                        gint _tmp5_;
                        gint col;
                        VtgSourceBookmark* bookmark;
                        GeditView* view;
                        VtgSourceBookmark* _tmp8_;
                        char* _tmp9_;
                        GeditTab* _tmp10_;
                        uri = (_tmp1_ = g_filename_to_uri (afrodite_source_file_get_filename (afrodite_source_reference_get_file (_tmp0_ = (AfroditeSourceReference*) vala_list_get (afrodite_symbol_get_source_references (item), 0))), NULL, &_inner_error_), _afrodite_source_reference_unref0 (_tmp0_), _tmp1_);
                        if (_inner_error_ != NULL) {
                              goto __catch3_g_error;
                        }
                        line = (_tmp3_ = afrodite_source_reference_get_first_line (_tmp2_ = (AfroditeSourceReference*) vala_list_get (afrodite_symbol_get_source_references (item), 0)), _afrodite_source_reference_unref0 (_tmp2_), _tmp3_);
                        col = (_tmp5_ = afrodite_source_reference_get_first_column (_tmp4_ = (AfroditeSourceReference*) vala_list_get (afrodite_symbol_get_source_references (item), 0)), _afrodite_source_reference_unref0 (_tmp4_), _tmp5_);
                        bookmark = NULL;
                        view = _g_object_ref0 (gedit_window_get_active_view (vtg_plugin_instance_get_window (self->priv->_plugin_instance)));
                        if (view != NULL) {
                              GeditDocument* doc;
                              GtkTextMark* mark;
                              GtkTextIter start = {0};
                              VtgSourceBookmark* _tmp6_;
                              char* _tmp7_;
                              doc = _g_object_ref0 (GEDIT_DOCUMENT (gtk_text_view_get_buffer ((GtkTextView*) view)));
                              mark = GTK_TEXT_MARK (gtk_text_buffer_get_insert ((GtkTextBuffer*) doc));
                              gtk_text_buffer_get_iter_at_mark ((GtkTextBuffer*) doc, &start, mark);
                              bookmark = (_tmp6_ = vtg_source_bookmark_new (), _vtg_source_bookmark_unref0 (bookmark), _tmp6_);
                              bookmark->uri = (_tmp7_ = g_strdup (gedit_document_get_uri (doc)), _g_free0 (bookmark->uri), _tmp7_);
                              bookmark->line = gtk_text_iter_get_line (&start) + 1;
                              bookmark->column = gtk_text_iter_get_line_offset (&start) + 1;
                              vtg_source_bookmarks_add_bookmark (vtg_plugin_instance_get_bookmarks (self->priv->_plugin_instance), bookmark, FALSE);
                              _g_object_unref0 (doc);
                        }
                        bookmark = (_tmp8_ = vtg_source_bookmark_new (), _vtg_source_bookmark_unref0 (bookmark), _tmp8_);
                        bookmark->uri = (_tmp9_ = g_strdup (uri), _g_free0 (bookmark->uri), _tmp9_);
                        bookmark->line = line + 1;
                        bookmark->column = col + 1;
                        vtg_source_bookmarks_add_bookmark (vtg_plugin_instance_get_bookmarks (self->priv->_plugin_instance), bookmark, FALSE);
                        _tmp10_ = vtg_plugin_instance_activate_uri (self->priv->_plugin_instance, uri, line, col);
                        _g_object_unref0 (_tmp10_);
                        _g_object_unref0 (view);
                        _vtg_source_bookmark_unref0 (bookmark);
                        _g_free0 (uri);
                  }
                  goto __finally3;
                  __catch3_g_error:
                  {
                        GError * e;
                        e = _inner_error_;
                        _inner_error_ = NULL;
                        {
                              AfroditeSourceReference* _tmp11_;
                              g_warning ("vtgsymbolcompletion.vala:135: error %s converting file %s to uri", e->message, afrodite_source_file_get_filename (afrodite_source_reference_get_file (_tmp11_ = (AfroditeSourceReference*) vala_list_get (afrodite_symbol_get_source_references (item), 0))));
                              _afrodite_source_reference_unref0 (_tmp11_);
                              _g_error_free0 (e);
                        }
                  }
                  __finally3:
                  if (_inner_error_ != NULL) {
                        _g_object_unref0 (item);
                        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;
                  }
            }
      } else {
            vtg_symbol_completion_display_completion_lock_failed_message (self);
      }
      _g_object_unref0 (item);
}


static void vtg_symbol_completion_on_completion_lock_failed (VtgSymbolCompletion* self, VtgSymbolCompletionProvider* sender) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (sender != NULL);
      vtg_symbol_completion_display_completion_lock_failed_message (self);
}


static void vtg_symbol_completion_display_completion_lock_failed_message (VtgSymbolCompletion* self) {
      GeditStatusbar* status;
      g_return_if_fail (self != NULL);
      status = _g_object_ref0 (GEDIT_STATUSBAR (gedit_window_get_statusbar (vtg_plugin_instance_get_window (self->priv->_plugin_instance))));
      gedit_statusbar_flash_message (status, (guint) 1, _ ("updating source symbols..."));
      _g_object_unref0 (status);
}


VtgPluginInstance* vtg_symbol_completion_get_plugin_instance (VtgSymbolCompletion* self) {
      VtgPluginInstance* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_plugin_instance;
      return result;
}


static void vtg_symbol_completion_set_plugin_instance (VtgSymbolCompletion* self, VtgPluginInstance* value) {
      g_return_if_fail (self != NULL);
      self->priv->_plugin_instance = value;
      g_object_notify ((GObject *) self, "plugin-instance");
}


GeditView* vtg_symbol_completion_get_view (VtgSymbolCompletion* self) {
      GeditView* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_view;
      return result;
}


static void vtg_symbol_completion_set_view (VtgSymbolCompletion* self, GeditView* value) {
      GeditView* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_view = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_view), _tmp0_);
      g_object_notify ((GObject *) self, "view");
}


AfroditeCompletionEngine* vtg_symbol_completion_get_completion_engine (VtgSymbolCompletion* self) {
      AfroditeCompletionEngine* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_completion_engine;
      return result;
}


void vtg_symbol_completion_set_completion_engine (VtgSymbolCompletion* self, AfroditeCompletionEngine* value) {
      g_return_if_fail (self != NULL);
      self->priv->_completion_engine = value;
      g_object_notify ((GObject *) self, "completion-engine");
}


static GObject * vtg_symbol_completion_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
      GObject * obj;
      GObjectClass * parent_class;
      VtgSymbolCompletion * self;
      parent_class = G_OBJECT_CLASS (vtg_symbol_completion_parent_class);
      obj = parent_class->constructor (type, n_construct_properties, construct_properties);
      self = VTG_SYMBOL_COMPLETION (obj);
      {
            if (GTK_WIDGET_REALIZED ((GtkWidget*) self->priv->_view)) {
                  vtg_symbol_completion_setup_gsc_completion (self, self->priv->_view);
            } else {
                  g_signal_connect_object ((GtkWidget*) vtg_symbol_completion_get_view (self), "realize", (GCallback) _vtg_symbol_completion_on_realized_gtk_widget_realize, self, 0);
            }
      }
      return obj;
}


static void vtg_symbol_completion_class_init (VtgSymbolCompletionClass * klass) {
      vtg_symbol_completion_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (VtgSymbolCompletionPrivate));
      G_OBJECT_CLASS (klass)->get_property = vtg_symbol_completion_get_property;
      G_OBJECT_CLASS (klass)->set_property = vtg_symbol_completion_set_property;
      G_OBJECT_CLASS (klass)->constructor = vtg_symbol_completion_constructor;
      G_OBJECT_CLASS (klass)->finalize = vtg_symbol_completion_finalize;
      g_object_class_install_property (G_OBJECT_CLASS (klass), VTG_SYMBOL_COMPLETION_PLUGIN_INSTANCE, g_param_spec_object ("plugin-instance", "plugin-instance", "plugin-instance", VTG_TYPE_PLUGIN_INSTANCE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
      g_object_class_install_property (G_OBJECT_CLASS (klass), VTG_SYMBOL_COMPLETION_VIEW, g_param_spec_object ("view", "view", "view", GEDIT_TYPE_VIEW, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
      g_object_class_install_property (G_OBJECT_CLASS (klass), VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE, g_param_spec_object ("completion-engine", "completion-engine", "completion-engine", AFRODITE_TYPE_COMPLETION_ENGINE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}


static void vtg_symbol_completion_instance_init (VtgSymbolCompletion * self) {
      self->priv = VTG_SYMBOL_COMPLETION_GET_PRIVATE (self);
      self->priv->_plugin_instance = NULL;
      self->priv->_completion_engine = NULL;
      self->priv->_view = NULL;
}


static void vtg_symbol_completion_finalize (GObject* obj) {
      VtgSymbolCompletion * self;
      self = VTG_SYMBOL_COMPLETION (obj);
      {
            VtgSymbolCompletionProvider* _tmp0_;
            GeditView* _tmp1_;
            if (self->priv->_manager != NULL) {
                  vtg_symbol_completion_deactivate (self);
            }
            self->priv->_provider = (_tmp0_ = NULL, _g_object_unref0 (self->priv->_provider), _tmp0_);
            self->priv->_view = (_tmp1_ = NULL, _g_object_unref0 (self->priv->_view), _tmp1_);
      }
      _g_object_unref0 (self->priv->_view);
      _g_object_unref0 (self->priv->_provider);
      _g_object_unref0 (self->priv->_manager);
      G_OBJECT_CLASS (vtg_symbol_completion_parent_class)->finalize (obj);
}


GType vtg_symbol_completion_get_type (void) {
      return vtg_symbol_completion_type_id;
}


GType vtg_symbol_completion_register_type (GTypeModule * module) {
      static const GTypeInfo g_define_type_info = { sizeof (VtgSymbolCompletionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vtg_symbol_completion_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VtgSymbolCompletion), 0, (GInstanceInitFunc) vtg_symbol_completion_instance_init, NULL };
      vtg_symbol_completion_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "VtgSymbolCompletion", &g_define_type_info, 0);
      return vtg_symbol_completion_type_id;
}


static void vtg_symbol_completion_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
      VtgSymbolCompletion * self;
      self = VTG_SYMBOL_COMPLETION (object);
      switch (property_id) {
            case VTG_SYMBOL_COMPLETION_PLUGIN_INSTANCE:
            g_value_set_object (value, vtg_symbol_completion_get_plugin_instance (self));
            break;
            case VTG_SYMBOL_COMPLETION_VIEW:
            g_value_set_object (value, vtg_symbol_completion_get_view (self));
            break;
            case VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE:
            g_value_set_object (value, vtg_symbol_completion_get_completion_engine (self));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void vtg_symbol_completion_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
      VtgSymbolCompletion * self;
      self = VTG_SYMBOL_COMPLETION (object);
      switch (property_id) {
            case VTG_SYMBOL_COMPLETION_PLUGIN_INSTANCE:
            vtg_symbol_completion_set_plugin_instance (self, g_value_get_object (value));
            break;
            case VTG_SYMBOL_COMPLETION_VIEW:
            vtg_symbol_completion_set_view (self, g_value_get_object (value));
            break;
            case VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE:
            vtg_symbol_completion_set_completion_engine (self, g_value_get_object (value));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}





Generated by  Doxygen 1.6.0   Back to index