Permalink
Browse files

Use of GtkTextView instead of GtkSourceView

We have not a real dependency on GtkSourceView, we will use
GtkTextView instead.
  • Loading branch information...
1 parent 7f43414 commit 48eb979db56557a0f96b0e195424789f64a1f429 @chuchiperriman committed Sep 11, 2009
@@ -1,32 +0,0 @@
-/*
- * gsc-private.h
- * This file is part of gsc
- *
- * Copyright (C) 2009 - Jesse van den Kieboom
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef __GSC_COMPLETION_PIVATE_H__
-#define __GSC_COMPLETION_PIVATE_H__
-
-#include <gtk/gtk.h>
-#include "gsc-completion.h"
-
-GscCompletion*gsc_completion_new (struct _GtkSourceView *source_view);
-
-#endif /* __GSC_COMPLETION_PIVATE_H__ */
-
@@ -36,7 +36,6 @@
#include "gsc-model.h"
#include "gsc-context.h"
#include <string.h>
-#include <gtksourceview/gtksourceview.h>
#include <stdarg.h>
#define WINDOW_WIDTH 350
@@ -97,7 +96,7 @@ struct _GscCompletionPrivate
gboolean select_on_show;
/* Completion management */
- GtkSourceView *view;
+ GtkTextView *view;
GList *providers;
GHashTable *capability_map;
@@ -126,8 +125,6 @@ G_DEFINE_TYPE(GscCompletion, gsc_completion, G_TYPE_OBJECT);
* call twice to gsc_proposal_new, the second time it returns
* the previous created GscCompletion, not creates a new one
*
- * FIXME We will remove this functions when we will integrate
- * Gsc in GtkSourceView
*/
static GHashTable *gsccompletion_map = NULL;
@@ -298,7 +295,7 @@ activate_current_proposal (GscCompletion *completion)
if (!activated)
{
text = gsc_proposal_get_text (proposal);
- gsc_utils_replace_current_word (GTK_SOURCE_BUFFER (buffer),
+ gsc_utils_replace_current_word (buffer,
text ? text : NULL,
-1);
}
@@ -1007,7 +1004,7 @@ gsc_completion_user_request (GscCompletion *completion)
}
static gboolean
-view_key_press_event_cb (GtkSourceView *view,
+view_key_press_event_cb (GtkTextView *view,
GdkEventKey *event,
GscCompletion *completion)
{
@@ -1117,7 +1114,7 @@ update_typing_offsets (GscCompletion *completion)
gchar *word;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (completion->priv->view));
- word = gsc_utils_get_word_iter (GTK_SOURCE_BUFFER (buffer),
+ word = gsc_utils_get_word_iter (buffer,
NULL,
&start,
&end);
@@ -1157,7 +1154,7 @@ show_auto_completion (GscCompletion *completion)
return FALSE;
}
- word = gsc_utils_get_word_iter (GTK_SOURCE_BUFFER (buffer),
+ word = gsc_utils_get_word_iter (buffer,
&iter,
&start,
&end);
@@ -1461,15 +1458,15 @@ gsc_completion_class_init (GscCompletionClass *klass)
/**
* Gsc:view:
*
- * The #GtkSourceView bound to the completion object.
+ * The #GtkTextView bound to the completion object.
*
*/
g_object_class_install_property (object_class,
PROP_VIEW,
g_param_spec_object ("view",
_("View"),
- _("The GtkSourceView bound to the completion"),
- GTK_TYPE_SOURCE_VIEW,
+ _("The GtkTextView bound to the completion"),
+ GTK_TYPE_TEXT_VIEW,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
@@ -2079,12 +2076,12 @@ gsc_completion_show (GscCompletion *completion,
if (place == NULL)
{
gsc_utils_move_to_cursor (GTK_WINDOW (completion->priv->window),
- GTK_SOURCE_VIEW (completion->priv->view));
+ completion->priv->view);
}
else
{
gsc_utils_move_to_iter (GTK_WINDOW (completion->priv->window),
- GTK_SOURCE_VIEW (completion->priv->view),
+ completion->priv->view,
place);
}
@@ -2155,16 +2152,16 @@ gsc_completion_error_quark (void)
/**
* gsc_completion_new:
- * @view: A #GtkSourceView
+ * @view: A #GtkTextView
*
* Create a new #GscCompletion associated with @view.
*
* Returns: The new #Gsc.
*/
GscCompletion *
-gsc_completion_new (GtkSourceView *view)
+gsc_completion_new (GtkTextView *view)
{
- g_return_val_if_fail (GTK_IS_SOURCE_VIEW (view), NULL);
+ g_return_val_if_fail (GTK_IS_TEXT_VIEW (view), NULL);
GscCompletion *self = g_object_new (GSC_TYPE_COMPLETION,
"view", view,
@@ -2310,11 +2307,11 @@ gsc_completion_get_info_window (GscCompletion *completion)
* gsc_completion_get_view:
* @completion: A #Gsc
*
- * The #GtkSourceView associated with @completion.
+ * The #GtkTextView associated with @completion.
*
- * Returns: The #GtkSourceView associated with @completion.
+ * Returns: The #GtkTextView associated with @completion.
*/
-GtkSourceView *
+GtkTextView *
gsc_completion_get_view (GscCompletion *completion)
{
g_return_val_if_fail (GSC_IS_COMPLETION (completion), NULL);
@@ -24,7 +24,6 @@
#define GSC_COMPLETION_H
#include <gtk/gtk.h>
-#include <gtksourceview/gtksourceview.h>
#include "gsc-info.h"
#include "gsc-provider.h"
@@ -52,9 +51,6 @@ typedef enum
GSC_COMPLETION_ERROR_NOT_BOUND,
} GscCompletionError;
-/* Forward declaration of GtkSourceView */
-struct _GtkSourceView;
-
struct _GscCompletion
{
GObject parent;
@@ -79,7 +75,7 @@ GType gsc_completion_get_type (void) G_GNUC_CONST;
GQuark gsc_completion_error_quark (void);
-GscCompletion *gsc_completion_new (GtkSourceView *source_view);
+GscCompletion *gsc_completion_new (GtkTextView *source_view);
gboolean gsc_completion_add_provider (GscCompletion *completion,
GscProvider *provider,
@@ -100,7 +96,7 @@ void gsc_completion_hide (GscCompletion *completion);
GscInfo *
gsc_completion_get_info_window (GscCompletion *completion);
-GtkSourceView *gsc_completion_get_view (GscCompletion *completion);
+GtkTextView *gsc_completion_get_view (GscCompletion *completion);
G_END_DECLS
@@ -151,7 +151,7 @@ update_criteria (GscContext *context)
g_free (context->priv->criteria);
context->priv->criteria =
- gsc_utils_get_word (GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (context->priv->view)));
+ gsc_utils_get_word (gtk_text_view_get_buffer (context->priv->view));
}
GscContext*
@@ -411,7 +411,7 @@ gsc_completion_info_move_to_iter (GscInfo *info,
GtkTextIter start;
g_return_if_fail (GSC_IS_INFO (info));
- g_return_if_fail (GTK_IS_SOURCE_VIEW (view));
+ g_return_if_fail (GTK_IS_TEXT_VIEW (view));
if (iter == NULL)
{
@@ -425,7 +425,7 @@ gsc_completion_info_move_to_iter (GscInfo *info,
}
gsc_utils_move_to_iter (GTK_WINDOW (info),
- GTK_SOURCE_VIEW (view),
+ view,
&start);
}
@@ -303,7 +303,6 @@ tree_model_iter_n_children (GtkTreeModel *tree_model,
if (iter == NULL)
{
- g_debug ("n children num: %i", GSC_MODEL (tree_model)->priv->num);
return GSC_MODEL (tree_model)->priv->num;
}
else
@@ -796,8 +795,6 @@ gsc_model_set_proposals (GscModel *model,
g_hash_table_destroy (rinfo.proposals);
}
- g_debug ("%s> %i",gsc_provider_get_name (info->provider), info->num);
-
if (info->num == 0)
{
remove_node (model, info->header_node,
@@ -890,7 +887,6 @@ gsc_model_is_empty (GscModel *model,
gboolean invisible)
{
g_return_val_if_fail (GSC_IS_MODEL (model), FALSE);
- g_debug ("is empty num: %i", model->priv->num);
if (invisible)
{
return model->priv->num == 0;
@@ -911,8 +907,6 @@ gsc_model_n_proposals (GscModel *model,
g_return_val_if_fail (GSC_IS_MODEL (model), 0);
g_return_val_if_fail (GSC_IS_PROVIDER (provider), 0);
- g_debug ("n proposals num: %i", model->priv->num);
-
info = g_hash_table_lookup (model->priv->providers_info, provider);
if (info == NULL)
Oops, something went wrong.

0 comments on commit 48eb979

Please sign in to comment.