[anjuta] sourceview: Fix a crash with Scintilla
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] sourceview: Fix a crash with Scintilla
- Date: Sat, 3 Dec 2011 14:10:12 +0000 (UTC)
commit 7e4b69f831bd216f75ec9731b2df3df80f8d53d9
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Sat Dec 3 14:56:26 2011 +0100
sourceview: Fix a crash with Scintilla
The implementation of ianjuta_document_get_filename in sourceview was returning
a string that the caller has to free while the documentation specify that
it is a constant string.
It causes a crash when using Scintilla due to this recent commit in the
document manager a0571b23499b308cd9bd02ecf71e30a6672947ef.
plugins/document-manager/anjuta-docman.c | 214 ++++++------
plugins/document-manager/plugin.c | 294 ++++++++---------
plugins/sourceview/sourceview-io.c | 80 +++---
plugins/sourceview/sourceview-io.h | 12 +-
plugins/sourceview/sourceview-print.c | 60 ++--
plugins/sourceview/sourceview.c | 532 +++++++++++++++---------------
6 files changed, 590 insertions(+), 602 deletions(-)
---
diff --git a/plugins/document-manager/anjuta-docman.c b/plugins/document-manager/anjuta-docman.c
index 94d024c..0f3bbba 100644
--- a/plugins/document-manager/anjuta-docman.c
+++ b/plugins/document-manager/anjuta-docman.c
@@ -59,13 +59,13 @@ struct _AnjutaDocmanPriv {
DocmanPlugin *plugin;
GSettings* settings;
GList *pages; /* list of AnjutaDocmanPage's */
-
+
GtkWidget *fileselection;
-
+
GtkWidget *popup_menu; /* shared context-menu for main-notebook pages */
gboolean tab_pressed; /* flag for deferred notebook page re-arrangement */
gboolean shutingdown;
-
+
GSList* radio_group;
GtkActionGroup *documents_action_group;
gint documents_merge_id;
@@ -126,13 +126,13 @@ anjuta_docman_update_documents_menu_status (AnjutaDocman* docman)
gint n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (docman));
gint current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (docman));
gchar *action_name;
-
- action = gtk_ui_manager_get_action (ui,
+
+ action = gtk_ui_manager_get_action (ui,
"/MenuMain/PlaceHolderDocumentsMenus/Documents/PreviousDocument");
g_object_set (action, "sensitive", current_page > 0, NULL);
- action = gtk_ui_manager_get_action (ui,
+ action = gtk_ui_manager_get_action (ui,
"/MenuMain/PlaceHolderDocumentsMenus/Documents/NextDocument");
- g_object_set (action, "sensitive", (current_page + 1) < n_pages, NULL);
+ g_object_set (action, "sensitive", (current_page + 1) < n_pages, NULL);
action_name = g_strdup_printf ("Tab_%d", current_page);
action = gtk_action_group_get_action (docman->priv->documents_action_group, action_name);
g_free (action_name);
@@ -222,17 +222,17 @@ anjuta_docman_update_documents_menu (AnjutaDocman* docman)
action_name, action_name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
-
+
if (i == gtk_notebook_get_current_page (GTK_NOTEBOOK (docman)))
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-
+
g_object_unref (action);
g_free (action_name);
g_free (accel);
}
anjuta_docman_update_documents_menu_status (docman);
- priv->documents_merge_id = id;
+ priv->documents_merge_id = id;
}
static void
@@ -268,7 +268,7 @@ on_notebook_page_close_button_enter (GtkButton *button,
AnjutaDocmanPage *page)
{
g_return_if_fail (page != NULL);
-
+
gtk_widget_set_sensitive (page->close_image, TRUE);
}
@@ -277,7 +277,7 @@ on_notebook_page_close_button_leave (GtkButton* button,
AnjutaDocmanPage *page)
{
g_return_if_fail (page != NULL);
-
+
if (! page->is_current)
gtk_widget_set_sensitive (page->close_image,FALSE);
}
@@ -288,7 +288,7 @@ on_notebook_tab_btnpress (GtkWidget *wid, GdkEventButton *event, AnjutaDocman* d
{
if (event->type == GDK_BUTTON_PRESS && event->button != 3) /* right-click is for menu */
docman->priv->tab_pressed = TRUE;
-
+
return FALSE;
}
@@ -297,7 +297,7 @@ on_notebook_tab_btnrelease (GtkWidget *widget, GdkEventButton *event, AnjutaDocm
{
AnjutaDocmanPage *page;
AnjutaDocmanPage *curr_page = NULL;
-
+
docman->priv->tab_pressed = FALSE;
/* close on middle click */
@@ -319,9 +319,9 @@ on_notebook_tab_btnrelease (GtkWidget *widget, GdkEventButton *event, AnjutaDocm
}
}
if (node == NULL)
- return FALSE;
+ return FALSE;
- if (page != NULL)
+ if (page != NULL)
{
on_close_file_activate (NULL, docman->priv->plugin);
@@ -329,11 +329,11 @@ on_notebook_tab_btnrelease (GtkWidget *widget, GdkEventButton *event, AnjutaDocm
{
/* set the old current page */
anjuta_docman_set_current_document (docman, curr_page->doc);
- }
+ }
}
return FALSE;
- }
+ }
/* normal button click close */
if (g_settings_get_boolean (docman->priv->settings, EDITOR_TABS_RECENT_FIRST))
@@ -357,7 +357,7 @@ on_notebook_tab_btnrelease (GtkWidget *widget, GdkEventButton *event, AnjutaDocm
}
static gboolean
-on_notebook_tab_double_click(GtkWidget *widget, GdkEventButton *event,
+on_notebook_tab_double_click(GtkWidget *widget, GdkEventButton *event,
AnjutaDocman* docman)
{
if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
@@ -379,7 +379,7 @@ on_notebook_page_reordered (GtkNotebook *notebook, GtkWidget *child,
anjuta_docman_update_documents_menu(docman);
}
-static GdkPixbuf*
+static GdkPixbuf*
anjuta_docman_get_pixbuf_for_file (GFile* file)
{
/* add a nice mime-type icon if we can */
@@ -389,9 +389,9 @@ anjuta_docman_get_pixbuf_for_file (GFile* file)
GdkPixbuf* pixbuf;
GFileInfo* file_info;
GError* err = NULL;
-
+
g_return_val_if_fail (file != NULL, NULL);
-
+
file_info = g_file_query_info (file,
"standard::*",
G_FILE_QUERY_INFO_NONE,
@@ -399,7 +399,7 @@ anjuta_docman_get_pixbuf_for_file (GFile* file)
&err);
if (err)
DEBUG_PRINT ("GFile-Error %s", err->message);
-
+
if (file_info != NULL)
{
icon = g_file_info_get_icon (file_info);
@@ -411,7 +411,7 @@ anjuta_docman_get_pixbuf_for_file (GFile* file)
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
gtk_icon_info_free(icon_info);
g_object_unref (icon);
-
+
if (pixbuf != NULL)
{
return pixbuf;
@@ -434,14 +434,14 @@ anjuta_docman_page_init (AnjutaDocman *docman, IAnjutaDocument *doc,
GdkColor color;
const gchar *filename;
gchar *ruri;
-
+
g_return_if_fail (IANJUTA_IS_DOCUMENT (doc));
-
+
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
close_pixmap = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
gtk_widget_show (close_pixmap);
-
+
/* setup close button, zero out {x,y} thickness to get smallest possible size */
close_button = gtk_button_new();
gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
@@ -449,7 +449,7 @@ anjuta_docman_page_init (AnjutaDocman *docman, IAnjutaDocument *doc,
gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE);
gtk_widget_set_name (close_button, "anjuta-tab-close-button");
-
+
gtk_widget_set_size_request (close_button, w, h);
gtk_widget_set_tooltip_text (close_button, _("Close file"));
@@ -463,30 +463,28 @@ anjuta_docman_page_init (AnjutaDocman *docman, IAnjutaDocument *doc,
gtk_widget_show (menu_label);
menu_box = gtk_hbox_new(FALSE, 2);
- g_free (filename);
-
color.red = 0;
color.green = 0;
color.blue = 0;
-
+
gtk_widget_modify_fg (close_button, GTK_STATE_NORMAL, &color);
gtk_widget_modify_fg (close_button, GTK_STATE_INSENSITIVE, &color);
gtk_widget_modify_fg (close_button, GTK_STATE_ACTIVE, &color);
gtk_widget_modify_fg (close_button, GTK_STATE_PRELIGHT, &color);
gtk_widget_modify_fg (close_button, GTK_STATE_SELECTED, &color);
gtk_widget_show(close_button);
-
+
box = gtk_hbox_new (FALSE, 2);
/* create our layout/event boxes */
event_box = gtk_event_box_new();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
- event_hbox = gtk_hbox_new (FALSE, 2);
-
+ event_hbox = gtk_hbox_new (FALSE, 2);
+
page->menu_icon = gtk_image_new();
page->mime_icon = gtk_image_new();
gtk_box_pack_start (GTK_BOX (event_hbox), page->mime_icon, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (menu_box), page->menu_icon, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (menu_box), page->menu_icon, FALSE, FALSE, 0);
if (file != NULL)
{
GdkPixbuf* pixbuf = anjuta_docman_get_pixbuf_for_file (file);
@@ -508,24 +506,24 @@ anjuta_docman_page_init (AnjutaDocman *docman, IAnjutaDocument *doc,
g_free (tip);
}
}
-
+
gtk_box_pack_start (GTK_BOX (event_hbox), label, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (event_hbox), close_button, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (event_box), event_hbox);
-
+
/* setup the data hierarchy */
g_object_set_data (G_OBJECT (box), "event_box", event_box);
-
+
/* pack our top-level layout box */
gtk_box_pack_start (GTK_BOX (box), event_box, TRUE, TRUE, 0);
-
+
/* show the widgets of the tab */
gtk_widget_show_all(box);
-
+
/* menu box */
gtk_box_pack_start (GTK_BOX (menu_box), menu_label, TRUE, TRUE, 0);
gtk_widget_show_all (menu_box);
-
+
/* main box */
g_signal_connect (G_OBJECT (close_button), "clicked",
G_CALLBACK (on_notebook_page_close_button_click),
@@ -562,7 +560,7 @@ static AnjutaDocmanPage *
anjuta_docman_page_new (void)
{
AnjutaDocmanPage *page;
-
+
page = g_new0 (AnjutaDocmanPage, 1); /* don't try to survive a memory-crunch */
return page;
}
@@ -590,7 +588,7 @@ on_open_filesel_response (GtkDialog* dialog, gint id, AnjutaDocman *docman)
gtk_widget_hide (docman->priv->fileselection);
return;
}
-
+
list = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(dialog));
if (list != NULL)
{
@@ -607,7 +605,7 @@ on_open_filesel_response (GtkDialog* dialog, gint id, AnjutaDocman *docman)
}
}
g_slist_free (list);
-
+
/* if (entry_filename)
{
list = g_slist_remove(list, entry_filename);
@@ -620,8 +618,8 @@ on_open_filesel_response (GtkDialog* dialog, gint id, AnjutaDocman *docman)
static GtkWidget*
create_file_open_dialog_gui (GtkWindow* parent, AnjutaDocman* docman)
{
- GtkWidget* dialog =
- gtk_file_chooser_dialog_new (_("Open file"),
+ GtkWidget* dialog =
+ gtk_file_chooser_dialog_new (_("Open file"),
parent,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -639,13 +637,13 @@ create_file_open_dialog_gui (GtkWindow* parent, AnjutaDocman* docman)
static GtkWidget*
create_file_save_dialog_gui (GtkWindow* parent, AnjutaDocman* docman)
{
- GtkWidget* dialog =
- gtk_file_chooser_dialog_new (_("Save file as"),
+ GtkWidget* dialog =
+ gtk_file_chooser_dialog_new (_("Save file as"),
parent,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
+ NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
return dialog;
}
@@ -677,10 +675,10 @@ anjuta_docman_save_document_as (AnjutaDocman *docman, IAnjutaDocument *doc,
GtkWidget *dialog;
gint response;
gboolean file_saved = TRUE;
-
+
g_return_val_if_fail (ANJUTA_IS_DOCMAN (docman), FALSE);
g_return_val_if_fail (IANJUTA_IS_DOCUMENT (doc), FALSE);
-
+
if (parent_window)
{
parent = parent_window;
@@ -689,9 +687,9 @@ anjuta_docman_save_document_as (AnjutaDocman *docman, IAnjutaDocument *doc,
{
parent = gtk_widget_get_toplevel (GTK_WIDGET (docman));
}
-
+
dialog = create_file_save_dialog_gui (GTK_WINDOW (parent), docman);
-
+
if ((file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL)) != NULL)
{
gchar* file_uri = g_file_get_uri (file);
@@ -703,14 +701,14 @@ anjuta_docman_save_document_as (AnjutaDocman *docman, IAnjutaDocument *doc,
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename);
else
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), "");
-
+
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response != GTK_RESPONSE_ACCEPT)
{
gtk_widget_destroy (dialog);
return FALSE;
}
-
+
uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
file = g_file_new_for_uri (uri);
if (g_file_query_exists (file, NULL))
@@ -744,14 +742,14 @@ anjuta_docman_save_document_as (AnjutaDocman *docman, IAnjutaDocument *doc,
{
ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (doc), file, NULL);
}
-
+
if (g_settings_get_boolean (docman->priv->settings,
EDITOR_TABS_ORDERING))
anjuta_docman_order_tabs (docman);
gtk_widget_destroy (dialog);
g_free (uri);
-
+
if (file_saved)
{
/* Update mime icons */
@@ -775,9 +773,9 @@ anjuta_docman_save_document (AnjutaDocman *docman, IAnjutaDocument *doc,
{
GFile* file;
gboolean ret;
-
+
file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
-
+
if (file == NULL)
{
anjuta_docman_set_current_document (docman, doc);
@@ -798,10 +796,10 @@ anjuta_docman_dispose (GObject *obj)
{
AnjutaDocman *docman;
GList *node;
-
+
docman = ANJUTA_DOCMAN (obj);
docman->priv->shutingdown = TRUE;
-
+
DEBUG_PRINT ("%s", "Disposing AnjutaDocman object");
if (docman->priv->popup_menu)
{
@@ -812,7 +810,7 @@ anjuta_docman_dispose (GObject *obj)
{
/* Destroy all page data (more than just the notebook-page-widgets) */
GList *pages;
-
+
g_signal_handlers_disconnect_by_func (G_OBJECT (docman),
(gpointer) on_notebook_switch_page,
(gpointer) docman);
@@ -836,7 +834,7 @@ static void
anjuta_docman_finalize (GObject *obj)
{
AnjutaDocman *docman;
-
+
DEBUG_PRINT ("%s", "Finalising AnjutaDocman object");
docman = ANJUTA_DOCMAN (obj);
if (docman->priv)
@@ -876,11 +874,11 @@ anjuta_docman_class_init (AnjutaDocmanClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = anjuta_docman_finalize;
object_class->dispose = anjuta_docman_dispose;
-
+
if (!initialized)
{
initialized = TRUE;
-
+
/* Signals */
docman_signals [DOC_ADDED] =
g_signal_new ("document-added",
@@ -902,7 +900,7 @@ anjuta_docman_class_init (AnjutaDocmanClass *klass)
G_TYPE_NONE,
1,
G_TYPE_OBJECT);
-
+
}
gtk_rc_parse_string ("style \"anjuta-tab-close-button-style\"\n"
@@ -948,7 +946,7 @@ on_notebook_switch_page (GtkNotebook *notebook,
if (!docman->priv->shutingdown)
{
AnjutaDocmanPage *page;
-
+
page = anjuta_docman_get_nth_page (docman, page_num);
g_signal_handlers_block_by_func (G_OBJECT (docman),
(gpointer) on_notebook_switch_page,
@@ -956,7 +954,7 @@ on_notebook_switch_page (GtkNotebook *notebook,
anjuta_docman_set_current_document (docman, page->doc);
g_signal_handlers_unblock_by_func (G_OBJECT (docman),
(gpointer) on_notebook_switch_page,
- (gpointer) docman);
+ (gpointer) docman);
/* TTimo: reorder so that the most recently used files are
* at the beginning of the tab list
*/
@@ -969,7 +967,7 @@ on_notebook_switch_page (GtkNotebook *notebook,
}
/* activate the right item in the documents menu */
anjuta_docman_update_documents_menu_status (docman);
- g_signal_emit_by_name (G_OBJECT (docman), "document-changed", page->doc);
+ g_signal_emit_by_name (G_OBJECT (docman), "document-changed", page->doc);
}
}
@@ -985,7 +983,7 @@ on_document_destroy (IAnjutaDocument *doc, AnjutaDocman *docman)
{
AnjutaDocmanPage *page;
gint page_num;
-
+
g_signal_handlers_disconnect_by_func (G_OBJECT (doc),
G_CALLBACK (on_document_update_save_ui),
docman);
@@ -995,7 +993,7 @@ on_document_destroy (IAnjutaDocument *doc, AnjutaDocman *docman)
page = anjuta_docman_get_page_for_document (docman, doc);
docman->priv->pages = g_list_remove (docman->priv->pages, page);
-
+
if (!docman->priv->shutingdown)
{
if ((page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (docman))) == -1)
@@ -1027,7 +1025,7 @@ anjuta_docman_add_editor (AnjutaDocman *docman, GFile* file,
{
IAnjutaEditor *te;
IAnjutaEditorFactory* factory;
-
+
factory = anjuta_shell_get_interface (docman->shell, IAnjutaEditorFactory, NULL);
te = ianjuta_editor_factory_new_editor (factory, file, name, NULL);
@@ -1052,19 +1050,19 @@ anjuta_docman_add_document (AnjutaDocman *docman, IAnjutaDocument *doc,
/* list order matches pages in book, initially at least */
docman->priv->pages = g_list_prepend (docman->priv->pages, (gpointer)page);
-
+
gtk_notebook_prepend_page_menu (GTK_NOTEBOOK (docman), page->widget,
page->box, page->menu_box);
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (docman), page->widget,
TRUE);
-
+
g_signal_connect (G_OBJECT (doc), "update-save-ui",
G_CALLBACK (on_document_update_save_ui), docman);
g_signal_connect (G_OBJECT (doc), "destroy",
G_CALLBACK (on_document_destroy), docman);
-
+
g_object_ref (doc);
-
+
anjuta_docman_set_current_document (docman, doc);
anjuta_shell_present_widget (docman->shell, GTK_WIDGET (docman->priv->plugin->vbox), NULL);
anjuta_docman_update_documents_menu (docman);
@@ -1081,7 +1079,7 @@ anjuta_docman_remove_document (AnjutaDocman *docman, IAnjutaDocument *doc)
if (!doc)
return;
-
+
page = anjuta_docman_get_page_for_document (docman, doc);
if (page)
{
@@ -1161,7 +1159,7 @@ anjuta_docman_get_nth_page (AnjutaDocman *docman, gint page_num)
return page;
node = g_list_next (node);
}
-
+
return NULL;
}
@@ -1263,13 +1261,13 @@ anjuta_docman_goto_file_line (AnjutaDocman *docman, GFile* file, gint lineno)
IAnjutaEditor *
anjuta_docman_goto_file_line_mark (AnjutaDocman *docman, GFile* file,
gint line, gboolean mark)
-{
+{
IAnjutaDocument *doc;
IAnjutaEditor *te;
AnjutaDocmanPage *page;
g_return_val_if_fail (file != NULL, NULL);
-
+
if (!g_file_query_exists (file, NULL))
{
return NULL;
@@ -1280,20 +1278,20 @@ anjuta_docman_goto_file_line_mark (AnjutaDocman *docman, GFile* file,
if (page && page->doc && IANJUTA_IS_FILE (page->doc))
{
GFile* file = ianjuta_file_get_file (IANJUTA_FILE (page->doc), NULL);
-
+
if (file)
{
gint line = 0;
-
+
if (IANJUTA_IS_EDITOR (page->doc))
{
line = ianjuta_editor_get_lineno (IANJUTA_EDITOR (page->doc), NULL);
}
-
+
an_file_history_push (file, line);
}
}
-
+
/* if possible, use a document that's already open */
doc = anjuta_docman_get_document_for_file (docman, file);
if (doc == NULL)
@@ -1311,7 +1309,7 @@ anjuta_docman_goto_file_line_mark (AnjutaDocman *docman, GFile* file,
te = NULL;
}
- if (te != NULL)
+ if (te != NULL)
{
if (line >= 0)
{
@@ -1331,7 +1329,7 @@ anjuta_docman_goto_file_line_mark (AnjutaDocman *docman, GFile* file,
anjuta_docman_present_notebook_page (docman, doc);
ianjuta_document_grab_focus (IANJUTA_DOCUMENT (doc), NULL);
}
-
+
return te;
}
@@ -1342,16 +1340,16 @@ anjuta_docman_get_file (AnjutaDocman *docman, const gchar *fn)
GList *node;
gchar *real_path;
gchar *fname;
-
+
g_return_val_if_fail (fn, NULL);
-
- /* If it is full and absolute path, there is no need to
+
+ /* If it is full and absolute path, there is no need to
go further, even if the file is not found*/
if (g_path_is_absolute(fn))
{
return g_file_new_for_path (fn);
}
-
+
/* First, check if we can get the file straightaway */
real_path = anjuta_util_get_real_path (fn);
if (g_file_test (real_path, G_FILE_TEST_IS_REGULAR))
@@ -1362,7 +1360,7 @@ anjuta_docman_get_file (AnjutaDocman *docman, const gchar *fn)
/* Get the name part of the file */
fname = g_path_get_basename (fn);
-
+
/* Next, check if the current text editor buffer matches this name */
if (NULL != (doc = anjuta_docman_get_current_document (docman)))
{
@@ -1430,14 +1428,14 @@ anjuta_docman_update_page_label (AnjutaDocman *docman, IAnjutaDocument *doc)
gchar* dirty_char;
gchar* read_only;
gchar* label;
-
+
if (doc == NULL)
return;
page = anjuta_docman_get_page_for_document (docman, doc);
if (!page || page->label == NULL || page->menu_label == NULL)
return;
-
+
if (!ianjuta_file_savable_is_dirty(IANJUTA_FILE_SAVABLE (doc), NULL))
{
dirty_char = "";
@@ -1454,7 +1452,7 @@ anjuta_docman_update_page_label (AnjutaDocman *docman, IAnjutaDocument *doc)
{
read_only = "";
}
-
+
file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
if (file)
{
@@ -1495,7 +1493,7 @@ anjuta_docman_update_page_label (AnjutaDocman *docman, IAnjutaDocument *doc)
static void
anjuta_docman_grab_text_focus (AnjutaDocman *docman)
{
- anjuta_shell_present_widget (docman->shell,
+ anjuta_shell_present_widget (docman->shell,
GTK_WIDGET (docman->priv->plugin->vbox), NULL);
}
@@ -1538,13 +1536,13 @@ anjuta_docman_delete_all_indicators (AnjutaDocman *docman)
/* Saves a file to keep it synchronized with external programs */
/* CHECKME unused */
-void
+void
anjuta_docman_save_file_if_modified (AnjutaDocman *docman, GFile* file)
{
IAnjutaDocument *doc;
g_return_if_fail (file != NULL);
-
+
doc = anjuta_docman_get_document_for_file (docman, file);
if (doc)
{
@@ -1557,7 +1555,7 @@ anjuta_docman_save_file_if_modified (AnjutaDocman *docman, GFile* file)
/* If an external program changed the file, we must reload it */
/* CHECKME unused */
-void
+void
anjuta_docman_reload_file (AnjutaDocman *docman, GFile* file)
{
IAnjutaDocument *doc;
@@ -1637,16 +1635,16 @@ anjuta_docman_get_document_for_file (AnjutaDocman *docman, GFile* file)
GList *node;
gchar *path;
gchar *local_real_path = NULL;
-
+
g_return_val_if_fail (file != NULL, NULL);
-
+
path = g_file_get_path (file);
if (path)
{
local_real_path = anjuta_util_get_real_path (path);
- if (local_real_path)
- {
+ if (local_real_path)
+ {
g_free (path);
}
else
@@ -1658,23 +1656,23 @@ anjuta_docman_get_document_for_file (AnjutaDocman *docman, GFile* file)
{
return NULL;
}
-
+
for (node = docman->priv->pages; node != NULL; node = g_list_next (node))
{
AnjutaDocmanPage *page;
GFile* doc_file;
-
+
page = (AnjutaDocmanPage *) node->data;
if (page && page->widget && IANJUTA_IS_DOCUMENT (page->doc))
{
IAnjutaDocument *doc;
-
+
doc = page->doc;
doc_file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
if (doc_file)
{
-
+
/* Try exact match first */
if (g_file_equal (file, doc_file))
{
@@ -1682,7 +1680,7 @@ anjuta_docman_get_document_for_file (AnjutaDocman *docman, GFile* file)
file_doc = doc;
break;
}
-
+
/* Try a local file alias */
if ((file_doc == NULL) && (local_real_path))
{
@@ -1719,7 +1717,7 @@ anjuta_docman_get_all_doc_widgets (AnjutaDocman *docman)
{
GList *wids;
GList *node;
-
+
wids = NULL;
for (node = docman->priv->pages; node != NULL; node = g_list_next (node))
{
diff --git a/plugins/document-manager/plugin.c b/plugins/document-manager/plugin.c
index 3d3edde..5cb01d2 100644
--- a/plugins/document-manager/plugin.c
+++ b/plugins/document-manager/plugin.c
@@ -58,8 +58,8 @@
#define ANJUTA_PIXMAP_BOOKMARK_TOGGLE "anjuta-bookmark-toggle"
#define ANJUTA_PIXMAP_BOOKMARK_PREV "anjuta-bookmark-prev"
-#define ANJUTA_PIXMAP_BOOKMARK_NEXT "anjuta-bookmark-next"
-#define ANJUTA_PIXMAP_BOOKMARK_CLEAR "anjuta-bookmark-clear"
+#define ANJUTA_PIXMAP_BOOKMARK_NEXT "anjuta-bookmark-next"
+#define ANJUTA_PIXMAP_BOOKMARK_CLEAR "anjuta-bookmark-clear"
#define ANJUTA_PIXMAP_FOLD_TOGGLE "anjuta-fold-toggle"
#define ANJUTA_PIXMAP_FOLD_CLOSE "anjuta-fold-close"
@@ -93,7 +93,7 @@
#define ANJUTA_STOCK_BOOKMARK_TOGGLE "anjuta-bookmark-toggle"
#define ANJUTA_STOCK_BOOKMARK_PREV "anjuta-bookmark-previous"
#define ANJUTA_STOCK_BOOKMARK_NEXT "anjuta-bookmark-next"
-#define ANJUTA_STOCK_BOOKMARK_CLEAR "anjuta-bookmark-clear"
+#define ANJUTA_STOCK_BOOKMARK_CLEAR "anjuta-bookmark-clear"
#define ANJUTA_STOCK_GOTO_LINE "anjuta-goto-line"
#define ANJUTA_STOCK_HISTORY_NEXT "anjuta-history-next"
#define ANJUTA_STOCK_HISTORY_PREV "anjuta-history-prev"
@@ -164,7 +164,7 @@ static GtkActionEntry actions_file[] = {
G_CALLBACK (on_close_all_file_activate)},
{ "ActionFileCloseOther", GTK_STOCK_CLOSE, N_("Close Others"), "<shift><control>o",
N_("Close other documents"),
- G_CALLBACK (on_close_other_file_activate)},
+ G_CALLBACK (on_close_other_file_activate)},
{ "ActionFileReload", GTK_STOCK_REVERT_TO_SAVED, N_("Reload F_ile"), NULL,
N_("Reload current file"),
G_CALLBACK (on_reload_file_activate)},
@@ -275,19 +275,19 @@ static GtkActionEntry actions_search[] = {
{ "ActionEditSearchFindPrevious", GTK_STOCK_FIND, N_("Find _Previous"),
"<control><shift>g",
N_("Repeat the last Find command"),
- G_CALLBACK (on_search_previous)},
+ G_CALLBACK (on_search_previous)},
{ "ActionSearchboxPopupClearHighlight", GTK_STOCK_FIND, N_("Clear Highlight"),
NULL, N_("Clear all highlighted text"),
G_CALLBACK (on_search_popup_clear_highlight)}
};
static GtkToggleActionEntry actions_searchbox_popup[] = {
- { "ActionSearchboxPopupCaseCheck", GTK_STOCK_FIND,
- N_("Case Sensitive"), NULL,
+ { "ActionSearchboxPopupCaseCheck", GTK_STOCK_FIND,
+ N_("Case Sensitive"), NULL,
N_("Match case in search results."),
G_CALLBACK (on_search_popup_case_sensitive_toggle)},
- { "ActionSearchboxPopupHighlightAll", GTK_STOCK_FIND,
- N_("Highlight All"), NULL,
+ { "ActionSearchboxPopupHighlightAll", GTK_STOCK_FIND,
+ N_("Highlight All"), NULL,
N_("Highlight all occurrences"),
G_CALLBACK (on_search_popup_highlight_toggle)},
{ "ActionSearchboxRegexSearch", GTK_STOCK_FIND,
@@ -416,7 +416,7 @@ static GtkActionEntry actions_bookmarks[] = {
{ "ActionBookmarksClear", ANJUTA_STOCK_BOOKMARK_CLEAR, N_("_Clear All Bookmarks"),
NULL, N_("Clear bookmarks"),
G_CALLBACK (on_bookmarks_clear_activate)},
- };
+ };
struct ActionGroupInfo {
GtkActionEntry *group;
@@ -451,7 +451,7 @@ static struct ActionGroupInfo action_groups[] = {
static struct ActionToggleGroupInfo action_toggle_groups[] = {
{ actions_view, G_N_ELEMENTS (actions_view), "ActionGroupEditorView", N_("Editor view settings") },
- { actions_searchbox_popup, G_N_ELEMENTS(actions_searchbox_popup),
+ { actions_searchbox_popup, G_N_ELEMENTS(actions_searchbox_popup),
"ActionGroupEditorSearchOptions", N_("Toggle search options") }
};
@@ -472,7 +472,7 @@ static void
on_editor_lang_changed (IAnjutaEditor* editor, const gchar* language,
DocmanPlugin* plugin);
-static gchar*
+static gchar*
get_directory_display_name (DocmanPlugin* plugin,
GFile* file)
{
@@ -480,9 +480,9 @@ get_directory_display_name (DocmanPlugin* plugin,
gchar* display_uri = g_file_get_parse_name (file);
gchar* display_dir;
dir = anjuta_util_uri_get_dirname (display_uri);
-
- display_dir = anjuta_util_str_middle_truncate (dir,
- MAX (20, MAX_TITLE_LENGTH));
+
+ display_dir = anjuta_util_str_middle_truncate (dir,
+ MAX (20, MAX_TITLE_LENGTH));
g_free (display_uri);
g_free (dir);
return display_dir;
@@ -521,15 +521,15 @@ update_title (DocmanPlugin* doc_plugin)
}
else
real_filename = g_strdup (filename);
-
+
if (doc_plugin->project_name)
{
if (dir)
- title = g_strdup_printf ("%s (%s) - %s", real_filename, dir,
+ title = g_strdup_printf ("%s (%s) - %s", real_filename, dir,
doc_plugin->project_name);
else
- title = g_strdup_printf ("%s - %s", real_filename,
- doc_plugin->project_name);
+ title = g_strdup_printf ("%s - %s", real_filename,
+ doc_plugin->project_name);
}
else
{
@@ -539,7 +539,6 @@ update_title (DocmanPlugin* doc_plugin)
title = g_strdup_printf ("%s", real_filename);
}
g_free (real_filename);
- g_free (filename);
g_free (dir);
}
else
@@ -560,23 +559,23 @@ value_added_project_root_uri (AnjutaPlugin *plugin, const gchar *name,
const gchar *root_uri;
doc_plugin = ANJUTA_PLUGIN_DOCMAN (plugin);
-
+
DEBUG_PRINT ("%s", "Project added");
-
-
+
+
g_free (doc_plugin->project_name);
- g_free (doc_plugin->project_path);
+ g_free (doc_plugin->project_path);
doc_plugin->project_name = NULL;
-
+
root_uri = g_value_get_string (value);
if (root_uri)
{
GFile* file = g_file_new_for_uri (root_uri);
gchar* path = g_file_get_path (file);
-
+
doc_plugin->project_name = g_file_get_basename (file);
- doc_plugin->project_path = path;
-
+ doc_plugin->project_path = path;
+
if (doc_plugin->project_name)
{
update_title (doc_plugin);
@@ -592,12 +591,12 @@ value_removed_project_root_uri (AnjutaPlugin *plugin, const gchar *name,
DocmanPlugin *doc_plugin;
doc_plugin = ANJUTA_PLUGIN_DOCMAN (plugin);
-
+
DEBUG_PRINT ("%s", "Project removed");
-
+
g_free (doc_plugin->project_name);
doc_plugin->project_name = NULL;
-
+
update_title(doc_plugin);
}
@@ -615,13 +614,13 @@ ui_states_init (AnjutaPlugin *plugin)
VIEW_EOL,
VIEW_LINE_WRAP
};
-
+
eplugin = ANJUTA_PLUGIN_DOCMAN (plugin);
for (i = 0; i < sizeof (actions_view)/sizeof(GtkToggleActionEntry); i++)
{
GtkAction *action;
gboolean state;
-
+
state = g_settings_get_boolean (eplugin->settings, prefs[i]);
action = anjuta_ui_get_action (eplugin->ui, "ActionGroupEditorView",
actions_view[i].name);
@@ -634,7 +633,7 @@ ui_give_shorter_names (AnjutaPlugin *plugin)
{
AnjutaUI *ui;
GtkAction *action;
-
+
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupEditorFile",
"ActionFileSave");
@@ -657,7 +656,7 @@ update_document_ui_enable_all (AnjutaPlugin *plugin)
AnjutaUI *ui;
gint i, j;
GtkAction *action;
-
+
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
for (i = 0; i < G_N_ELEMENTS (action_groups); i++)
{
@@ -679,7 +678,7 @@ update_document_ui_disable_all (AnjutaPlugin *plugin)
AnjutaUI *ui;
gint i, j;
GtkAction *action;
-
+
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
for (i = 0; i < G_N_ELEMENTS (action_groups); i++)
{
@@ -702,12 +701,12 @@ update_document_ui_undo_items (AnjutaPlugin *plugin, IAnjutaDocument* doc)
GtkAction *action;
ui = anjuta_shell_get_ui (plugin->shell, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
"ActionEditUndo");
g_object_set (G_OBJECT (action), "sensitive",
ianjuta_document_can_undo (doc, NULL), NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
"ActionEditRedo");
g_object_set (G_OBJECT (action), "sensitive",
@@ -719,7 +718,7 @@ update_document_ui_save_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
{
AnjutaUI *ui;
GtkAction *action;
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
if (anjuta_docman_get_current_document (ANJUTA_DOCMAN(ANJUTA_PLUGIN_DOCMAN(plugin)->docman)) ==
@@ -738,59 +737,59 @@ update_document_ui_interface_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
AnjutaUI *ui;
GtkAction *action;
gboolean flag;
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
-
+
/* IAnjutaEditorLanguage */
flag = IANJUTA_IS_EDITOR_LANGUAGE (doc);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorStyle",
"ActionMenuFormatStyle");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
/* IAnjutaDocument */
flag = IANJUTA_IS_DOCUMENT (doc);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
"ActionEditCut");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
"ActionEditCopy");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
"ActionEditPaste");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
"ActionEditClear");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorSelection */
flag = IANJUTA_IS_EDITOR_SELECTION (doc);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorSelect",
"ActionEditSelectAll");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorSelect",
"ActionEditSelectBlock");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorConvert */
flag = IANJUTA_IS_EDITOR_CONVERT (doc);
action = anjuta_ui_get_action (ui, "ActionGroupEditorTransform",
"ActionEditMakeSelectionUppercase");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorTransform",
"ActionEditMakeSelectionLowercase");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorLineMode */
flag = IANJUTA_IS_EDITOR_LINE_MODE (doc);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupEditorTransform",
"ActionEditConvertCRLF");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
@@ -803,7 +802,7 @@ update_document_ui_interface_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
action = anjuta_ui_get_action (ui, "ActionGroupEditorTransform",
"ActionEditConvertEOL");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorView */
flag = IANJUTA_IS_EDITOR_VIEW (doc);
action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
@@ -819,34 +818,34 @@ update_document_ui_interface_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
action = anjuta_ui_get_action (ui, "ActionGroupEditorView",
"ActionViewEditorGuides");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorFolds */
flag = IANJUTA_IS_EDITOR_FOLDS (doc);
- action = anjuta_ui_get_action (ui, "ActionGroupEditorFormat",
+ action = anjuta_ui_get_action (ui, "ActionGroupEditorFormat",
"ActionFormatFoldCloseAll");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
flag = IANJUTA_IS_EDITOR_FOLDS (doc);
- action = anjuta_ui_get_action (ui, "ActionGroupEditorFormat",
+ action = anjuta_ui_get_action (ui, "ActionGroupEditorFormat",
"ActionFormatFoldOpenAll");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
flag = IANJUTA_IS_EDITOR_FOLDS (doc);
- action = anjuta_ui_get_action (ui, "ActionGroupEditorFormat",
+ action = anjuta_ui_get_action (ui, "ActionGroupEditorFormat",
"ActionFormatFoldToggle");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
flag = IANJUTA_IS_EDITOR_FOLDS (doc);
- action = anjuta_ui_get_action (ui, "ActionGroupEditorView",
+ action = anjuta_ui_get_action (ui, "ActionGroupEditorView",
"ActionViewEditorFolds");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorComment */
flag = IANJUTA_IS_EDITOR_COMMENT (doc);
action = anjuta_ui_get_action (ui, "ActionGroupEditorComment",
"ActionMenuEditComment");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorZoom */
flag = IANJUTA_IS_EDITOR_ZOOM (doc);
action = anjuta_ui_get_action (ui, "ActionGroupEditorZoom",
@@ -867,11 +866,11 @@ update_document_ui_interface_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
action = anjuta_ui_get_action (ui, "ActionGroupEditorNavigate",
"ActionEditGotoMatchingBrace");
g_object_set (G_OBJECT (action), "visible", flag, "sensitive", flag, NULL);
-
+
/* IAnjutaEditorSearch */
flag = IANJUTA_IS_EDITOR_SEARCH (doc);
action = anjuta_ui_get_action (ui, "ActionGroupEditorSearch",
- "ActionEditSearchQuickSearch");
+ "ActionEditSearchQuickSearch");
g_object_set (G_OBJECT (action), "sensitive", flag, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupEditorSearch",
"ActionEditSearchQuickSearchAgain");
@@ -885,7 +884,7 @@ update_document_ui_interface_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
"ActionSearchboxPopupClearHighlight");
g_object_set (G_OBJECT (action), "sensitive", flag, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupEditorNavigate",
- "ActionEditGotoLine");
+ "ActionEditGotoLine");
g_object_set (G_OBJECT (action), "sensitive", flag, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupEditorSearchOptions",
"ActionSearchboxPopupCaseCheck");
@@ -901,7 +900,7 @@ update_document_ui_interface_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
flag = IANJUTA_IS_EDITOR_ASSIST (doc);
/* Enable autocompletion action */
- action = anjuta_ui_get_action (ui,
+ action = anjuta_ui_get_action (ui,
"ActionGroupEditorEdit",
"ActionEditAutocomplete");
g_object_set (G_OBJECT (action), "visible", flag,
@@ -949,7 +948,7 @@ register_stock_icons (AnjutaPlugin *plugin)
REGISTER_ICON_FULL (ANJUTA_PIXMAP_BOOKMARK_TOGGLE, ANJUTA_STOCK_BOOKMARK_TOGGLE);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_BOOKMARK_PREV, ANJUTA_STOCK_BOOKMARK_PREV);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_BOOKMARK_NEXT, ANJUTA_STOCK_BOOKMARK_NEXT);
- REGISTER_ICON_FULL (ANJUTA_PIXMAP_BOOKMARK_CLEAR, ANJUTA_STOCK_BOOKMARK_CLEAR);
+ REGISTER_ICON_FULL (ANJUTA_PIXMAP_BOOKMARK_CLEAR, ANJUTA_STOCK_BOOKMARK_CLEAR);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_BLOCK_START, ANJUTA_STOCK_BLOCK_START);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_BLOCK_END, ANJUTA_STOCK_BLOCK_END);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_GOTO_LINE, ANJUTA_STOCK_GOTO_LINE);
@@ -965,7 +964,7 @@ static void
update_status (DocmanPlugin *plugin, IAnjutaEditor *te)
{
AnjutaStatus *status;
-
+
if (te)
{
gchar *edit /*, *mode*/;
@@ -974,10 +973,10 @@ update_status (DocmanPlugin *plugin, IAnjutaEditor *te)
status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL);
if (status == NULL)
return;
-
+
line = ianjuta_editor_get_lineno (te, NULL);
col = ianjuta_editor_get_column (te, NULL);
-
+
if (ianjuta_editor_get_overwrite (te, NULL))
{
edit = g_strdup (_("OVR"));
@@ -986,7 +985,7 @@ update_status (DocmanPlugin *plugin, IAnjutaEditor *te)
{
edit = g_strdup (_("INS"));
}
-
+
if (IANJUTA_IS_EDITOR_ZOOM(te))
{
zoom = g_settings_get_int (plugin->settings, TEXT_ZOOM_FACTOR);
@@ -994,12 +993,12 @@ update_status (DocmanPlugin *plugin, IAnjutaEditor *te)
}
else
anjuta_status_set_default (status, _("Zoom"), NULL);
-
+
anjuta_status_set_default (status, _("Line"), "%04d", line);
anjuta_status_set_default (status, _("Col"), "%03d", col);
anjuta_status_set_default (status, _("Mode"), edit);
// anjuta_status_set_default (status, _("EOL"), mode);
-
+
g_free (edit);
/* g_free (mode); */
}
@@ -1017,7 +1016,7 @@ static void
on_document_update_ui (IAnjutaDocument *doc, DocmanPlugin *plugin)
{
IAnjutaDocument *curdoc;
-
+
curdoc = anjuta_docman_get_current_document (ANJUTA_DOCMAN (plugin->docman));
update_document_ui_undo_items (ANJUTA_PLUGIN(plugin), curdoc);
@@ -1066,16 +1065,16 @@ create_highlight_submenu (DocmanPlugin *plugin, IAnjutaEditor *editor)
const GList *languages, *node;
GList *sorted_languages;
GtkWidget *submenu;
- GtkWidget *auto_menuitem;
+ GtkWidget *auto_menuitem;
submenu = gtk_menu_new ();
-
+
if (!editor || !IANJUTA_IS_EDITOR_LANGUAGE (editor))
return NULL;
-
+
languages = ianjuta_editor_language_get_supported_languages (IANJUTA_EDITOR_LANGUAGE (editor), NULL);
if (!languages)
return NULL;
-
+
/* Automatic highlight menu */
auto_menuitem = gtk_radio_menu_item_new_with_mnemonic (NULL, _("Automatic"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(auto_menuitem), TRUE);
@@ -1090,13 +1089,13 @@ create_highlight_submenu (DocmanPlugin *plugin, IAnjutaEditor *editor)
sorted_languages = g_list_copy((GList *) languages);
sorted_languages = g_list_sort_with_data(sorted_languages, (GCompareDataFunc) compare_language_name,
IANJUTA_EDITOR_LANGUAGE (editor));
-
+
node = sorted_languages;
while (node)
{
const gchar *lang = node->data;
const gchar *name = ianjuta_editor_language_get_language_name (IANJUTA_EDITOR_LANGUAGE (editor), lang, NULL);
-
+
/* Should fix #493583 */
if (name != NULL)
{
@@ -1114,7 +1113,7 @@ create_highlight_submenu (DocmanPlugin *plugin, IAnjutaEditor *editor)
node = g_list_next (node);
}
g_list_free(sorted_languages);
-
+
gtk_widget_show_all (submenu);
return submenu;
}
@@ -1140,7 +1139,7 @@ load_new_support_plugins (DocmanPlugin* docman_plugin, GList* new_plugin_ids,
if (!item)
{
DEBUG_PRINT ("Loading plugin: %s", plugin_id);
- g_signal_connect (new_plugin, "deactivated",
+ g_signal_connect (new_plugin, "deactivated",
G_CALLBACK (on_support_plugin_deactivated), docman_plugin);
}
needed_plugins = g_list_append (needed_plugins, new_plugin);
@@ -1149,7 +1148,7 @@ load_new_support_plugins (DocmanPlugin* docman_plugin, GList* new_plugin_ids,
}
static void
-unload_unused_support_plugins (DocmanPlugin* docman_plugin,
+unload_unused_support_plugins (DocmanPlugin* docman_plugin,
GList* needed_plugins)
{
GList* plugins = g_list_copy (docman_plugin->support_plugins);
@@ -1181,7 +1180,7 @@ update_language_plugin (AnjutaDocman *docman, IAnjutaDocument *doc,
IAnjutaLanguage *lang_manager;
GList *new_support_plugins, *support_plugin_descs, *needed_plugins, *node;
const gchar *language;
-
+
lang_manager = anjuta_shell_get_interface (plugin->shell,
IAnjutaLanguage,
NULL);
@@ -1196,7 +1195,7 @@ update_language_plugin (AnjutaDocman *docman, IAnjutaDocument *doc,
IANJUTA_EDITOR_LANGUAGE (doc),
NULL);
g_signal_handlers_unblock_by_func (doc, on_editor_lang_changed, plugin);
-
+
if (!language)
{
unload_unused_support_plugins (docman_plugin, NULL);
@@ -1227,9 +1226,9 @@ update_language_plugin (AnjutaDocman *docman, IAnjutaDocument *doc,
g_list_free (support_plugin_descs);
/* Load new plugins */
- needed_plugins =
+ needed_plugins =
load_new_support_plugins (docman_plugin, new_support_plugins,
- plugin_manager);
+ plugin_manager);
/* Unload unused plugins */
unload_unused_support_plugins (docman_plugin, needed_plugins);
@@ -1269,8 +1268,8 @@ on_document_changed (AnjutaDocman *docman, IAnjutaDocument *doc,
anjuta_shell_remove_value (plugin->shell, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
NULL);
}
-
-
+
+
if (doc && IANJUTA_IS_EDITOR (doc))
{
update_status (docman_plugin, IANJUTA_EDITOR (doc));
@@ -1300,7 +1299,7 @@ on_document_added (AnjutaDocman *docman, IAnjutaDocument *doc,
{
GtkWidget *highlight_submenu, *highlight_menu;
DocmanPlugin *docman_plugin;
-
+
docman_plugin = ANJUTA_PLUGIN_DOCMAN (plugin);
g_signal_connect (G_OBJECT (doc), "update_ui",
G_CALLBACK (on_document_update_ui),
@@ -1308,7 +1307,7 @@ on_document_added (AnjutaDocman *docman, IAnjutaDocument *doc,
g_signal_connect (G_OBJECT (doc), "update-save-ui",
G_CALLBACK (on_document_update_save_ui),
plugin);
-
+
/* Present the vbox as this is the widget that was added to the shell */
anjuta_shell_present_widget (plugin->shell,
GTK_WIDGET (docman_plugin->vbox), NULL);
@@ -1323,10 +1322,10 @@ on_document_added (AnjutaDocman *docman, IAnjutaDocument *doc,
g_signal_connect (G_OBJECT (doc), "language-changed",
G_CALLBACK (on_editor_lang_changed),
docman_plugin);
-
-
+
+
/* Create Highlight submenu */
- highlight_submenu =
+ highlight_submenu =
create_highlight_submenu (docman_plugin, te);
if (highlight_submenu)
{
@@ -1350,7 +1349,7 @@ on_window_key_press_event (AnjutaShell *shell,
g_return_val_if_fail (event != NULL, FALSE);
modifiers = event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK);
-
+
for (i = 0; global_keymap[i].id; i++)
if (event->keyval == global_keymap[i].gdk_key &&
(event->state & global_keymap[i].modifiers) == global_keymap[i].modifiers)
@@ -1429,7 +1428,7 @@ on_window_key_release_event (AnjutaShell *shell,
GtkWidget *widget;
gint cur_page;
plugin->g_tabbing = FALSE;
-
+
if (g_settings_get_boolean (plugin->settings,
EDITOR_TABS_RECENT_FIRST))
{
@@ -1451,7 +1450,7 @@ on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase,
{
if (phase != ANJUTA_SESSION_PHASE_NORMAL)
return;
-
+
anjuta_bookmarks_session_load (ANJUTA_BOOKMARKS (plugin->bookmarks),
session);
}
@@ -1500,7 +1499,7 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
g_list_foreach (files, (GFunc)g_free, NULL);
g_list_free (files);
}
-
+
anjuta_bookmarks_session_save (ANJUTA_BOOKMARKS (plugin->bookmarks),
session);
}
@@ -1510,7 +1509,7 @@ on_save_prompt_save_editor (AnjutaSavePrompt *save_prompt,
gpointer item, gpointer user_data)
{
DocmanPlugin *plugin;
-
+
plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
return anjuta_docman_save_document (ANJUTA_DOCMAN (plugin->docman),
IANJUTA_DOCUMENT (item),
@@ -1522,7 +1521,7 @@ on_save_prompt (AnjutaShell *shell, AnjutaSavePrompt *save_prompt,
DocmanPlugin *plugin)
{
GList *buffers, *node;
-
+
buffers = anjuta_docman_get_all_doc_widgets (ANJUTA_DOCMAN (plugin->docman));
if (buffers)
{
@@ -1534,7 +1533,7 @@ on_save_prompt (AnjutaShell *shell, AnjutaSavePrompt *save_prompt,
const gchar *name;
gchar *uri = NULL;
GFile* file;
-
+
name = ianjuta_document_get_filename (IANJUTA_DOCUMENT (editor), NULL);
file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
if (file)
@@ -1545,7 +1544,6 @@ on_save_prompt (AnjutaShell *shell, AnjutaSavePrompt *save_prompt,
anjuta_save_prompt_add_item (save_prompt, name, uri, editor,
on_save_prompt_save_editor, plugin);
g_free (uri);
- g_free (name);
}
}
g_list_free (buffers);
@@ -1563,10 +1561,10 @@ docman_plugin_set_tab_pos (DocmanPlugin *ep)
{
gchar *tab_pos;
GtkPositionType pos;
-
+
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (ep->docman), TRUE);
tab_pos = g_settings_get_string (ep->settings, EDITOR_TABS_POS);
-
+
pos = GTK_POS_TOP;
if (tab_pos)
{
@@ -1585,7 +1583,7 @@ docman_plugin_set_tab_pos (DocmanPlugin *ep)
}
static void
-on_notify_prefs (AnjutaPreferences* prefs,
+on_notify_prefs (AnjutaPreferences* prefs,
const gchar* key, gpointer user_data)
{
DocmanPlugin *ep = ANJUTA_PLUGIN_DOCMAN (user_data);
@@ -1612,7 +1610,7 @@ on_docman_auto_save (gpointer data)
plugin->autosave_on = FALSE;
return FALSE;
}
-
+
status = anjuta_shell_get_status (docman->shell, NULL);
retval = TRUE;
@@ -1664,13 +1662,13 @@ on_notify_timer (GSettings* settings,
AnjutaDocman *docman;
gint auto_save_timer;
gboolean auto_save;
-
+
plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
docman = ANJUTA_DOCMAN (plugin->docman);
-
+
auto_save_timer = g_settings_get_int(settings, AUTOSAVE_TIMER);
auto_save = g_settings_get_boolean(settings, SAVE_AUTOMATIC);
-
+
if (auto_save)
{
if (plugin->autosave_on)
@@ -1712,7 +1710,7 @@ prefs_init (DocmanPlugin *ep)
G_CALLBACK (on_notify_timer), ep);
g_signal_connect (ep->settings, "changed::" SAVE_AUTOMATIC,
G_CALLBACK (on_notify_timer), ep);
-
+
on_notify_timer(ep->settings, NULL, ep);
}
@@ -1726,16 +1724,16 @@ activate_plugin (AnjutaPlugin *plugin)
gint i;
static gboolean initialized = FALSE;
GList *actions, *act;
-
+
DEBUG_PRINT ("%s", "DocmanPlugin: Activating document manager pluginâ");
-
+
dplugin = ANJUTA_PLUGIN_DOCMAN (plugin);
dplugin->ui = anjuta_shell_get_ui (plugin->shell, NULL);
ui = dplugin->ui;
docman = anjuta_docman_new (dplugin);
dplugin->docman = docman;
-
+
ANJUTA_DOCMAN(docman)->shell = plugin->shell;
g_signal_connect (G_OBJECT (docman), "document-added",
G_CALLBACK (on_document_added), plugin);
@@ -1745,7 +1743,7 @@ activate_plugin (AnjutaPlugin *plugin)
G_CALLBACK (on_window_key_press_event), plugin);
g_signal_connect (G_OBJECT (plugin->shell), "key-release-event",
G_CALLBACK (on_window_key_release_event), plugin);
-
+
if (!initialized)
{
register_stock_icons (plugin);
@@ -1754,7 +1752,7 @@ activate_plugin (AnjutaPlugin *plugin)
/* Add all our editor actions */
for (i = 0; i < G_N_ELEMENTS (action_groups); i++)
{
- group = anjuta_ui_add_action_group_entries (ui,
+ group = anjuta_ui_add_action_group_entries (ui,
action_groups[i].name,
_(action_groups[i].label),
action_groups[i].group,
@@ -1772,7 +1770,7 @@ activate_plugin (AnjutaPlugin *plugin)
}
for (i = 0; i < G_N_ELEMENTS (action_toggle_groups); i++)
{
- group = anjuta_ui_add_toggle_action_group_entries (ui,
+ group = anjuta_ui_add_toggle_action_group_entries (ui,
action_toggle_groups[i].name,
_(action_toggle_groups[i].label),
action_toggle_groups[i].group,
@@ -1787,7 +1785,7 @@ activate_plugin (AnjutaPlugin *plugin)
act = g_list_next (act);
}
}
-
+
/* Add UI */
dplugin->uiid = anjuta_ui_merge (ui, UI_FILE);
dplugin->vbox = gtk_vbox_new (FALSE, 0);
@@ -1795,15 +1793,15 @@ activate_plugin (AnjutaPlugin *plugin)
gtk_box_pack_start (GTK_BOX(dplugin->vbox), docman, TRUE, TRUE, 0);
anjuta_shell_add_widget_full (plugin->shell, dplugin->vbox,
"AnjutaDocumentManager", _("Documents"),
- "editor-plugin-icon",
- ANJUTA_SHELL_PLACEMENT_CENTER,
+ "editor-plugin-icon",
+ ANJUTA_SHELL_PLACEMENT_CENTER,
TRUE, NULL);
- anjuta_shell_present_widget (plugin->shell, dplugin->vbox, NULL);
-
+ anjuta_shell_present_widget (plugin->shell, dplugin->vbox, NULL);
+
ui_states_init(plugin);
ui_give_shorter_names (plugin);
update_document_ui (plugin, NULL);
-
+
/* Create the default searchbox instance, but don't yet put it into
dplugin->vbox, to prevent the box being displayed at session start */
dplugin->search_box = search_box_new (ANJUTA_DOCMAN (docman));
@@ -1823,23 +1821,23 @@ activate_plugin (AnjutaPlugin *plugin)
/* Connect to load session */
g_signal_connect (G_OBJECT (plugin->shell), "load-session",
G_CALLBACK (on_session_load), plugin);
-
+
/* Connect to save prompt */
g_signal_connect (G_OBJECT (plugin->shell), "save-prompt",
G_CALLBACK (on_save_prompt), plugin);
-
+
/* Add bookmarks widget */
dplugin->bookmarks = G_OBJECT(anjuta_bookmarks_new (dplugin));
-
+
dplugin->project_watch_id =
anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
value_added_project_root_uri,
value_removed_project_root_uri, NULL);
dplugin->project_name = NULL;
-
- prefs_init(ANJUTA_PLUGIN_DOCMAN (plugin));
+
+ prefs_init(ANJUTA_PLUGIN_DOCMAN (plugin));
initialized = TRUE;
-
+
return TRUE;
}
@@ -1851,19 +1849,19 @@ deactivate_plugin (AnjutaPlugin *plugin)
AnjutaUI *ui;
AnjutaStatus *status;
GList *node;
-
+
DEBUG_PRINT ("%s", "DocmanPlugin: Deactivating document manager pluginâ");
-
+
eplugin = ANJUTA_PLUGIN_DOCMAN (plugin);
g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->shell),
G_CALLBACK (on_session_save), plugin);
g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->shell),
G_CALLBACK (on_save_prompt), plugin);
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
status = anjuta_shell_get_status (plugin->shell, NULL);
-
+
g_signal_handlers_disconnect_by_func (G_OBJECT (eplugin->docman),
G_CALLBACK (on_document_changed),
plugin);
@@ -1873,9 +1871,9 @@ deactivate_plugin (AnjutaPlugin *plugin)
g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->shell),
G_CALLBACK (on_window_key_release_event),
plugin);
-
+
on_document_changed (ANJUTA_DOCMAN (eplugin->docman), NULL, plugin);
-
+
/* Widget is removed from the container when destroyed */
gtk_widget_destroy (eplugin->docman);
gtk_widget_destroy (eplugin->search_box); /* the default searchbox instance may still be unparented */
@@ -1889,15 +1887,15 @@ deactivate_plugin (AnjutaPlugin *plugin)
node = g_list_next (node);
}
g_list_free (eplugin->action_groups);
-
+
/* FIXME: */
/* Unregister stock icons */
/* Unregister preferences */
-
+
eplugin->docman = NULL;
eplugin->uiid = 0;
eplugin->action_groups = NULL;
-
+
return TRUE;
}
@@ -1907,7 +1905,7 @@ dispose (GObject *obj)
DocmanPlugin *eplugin = ANJUTA_PLUGIN_DOCMAN (obj);
g_object_unref (eplugin->settings);
-
+
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
@@ -1930,7 +1928,7 @@ docman_plugin_instance_init (GObject *obj)
}
static void
-docman_plugin_class_init (GObjectClass *klass)
+docman_plugin_class_init (GObjectClass *klass)
{
AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
@@ -2039,7 +2037,7 @@ ianjuta_docman_add_document (IAnjutaDocumentManager *plugin,
{
AnjutaDocman *docman;
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
-
+
anjuta_docman_add_document(docman, document, NULL);
}
@@ -2052,7 +2050,7 @@ ianjuta_docman_remove_document(IAnjutaDocumentManager *plugin,
AnjutaDocman *docman;
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
-
+
if (save_before)
{
ret_val = anjuta_docman_save_document(docman, doc,
@@ -2063,7 +2061,7 @@ ianjuta_docman_remove_document(IAnjutaDocumentManager *plugin,
if (ret_val)
anjuta_docman_remove_document (docman, doc);
-
+
return ret_val;
}
@@ -2098,7 +2096,7 @@ static void
ifile_open (IAnjutaFile* plugin, GFile* file, GError** e)
{
AnjutaDocman *docman;
-
+
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
anjuta_docman_goto_file_line (docman, file, -1);
}
@@ -2124,7 +2122,7 @@ ifile_iface_init (IAnjutaFileIface *iface)
iface->get_file = ifile_get_file;
}
-/* Implement IAnjutaFileSavable interface */
+/* Implement IAnjutaFileSavable interface */
static void
isaveable_save (IAnjutaFileSavable* plugin, GError** e)
{
@@ -2182,7 +2180,7 @@ isavable_is_dirty (IAnjutaFileSavable* plugin, GError **e)
}
g_list_free (buffers);
}
- return retval;
+ return retval;
}
static void
@@ -2206,7 +2204,7 @@ ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError**
GError* error = NULL;
GtkBuilder* bxml = gtk_builder_new ();
DocmanPlugin* doc_plugin = ANJUTA_PLUGIN_DOCMAN (ipref);
-
+
/* Add preferences */
if (!gtk_builder_add_from_file (bxml, PREFS_BUILDER, &error))
{
@@ -2232,7 +2230,7 @@ static void
ipreferences_iface_init(IAnjutaPreferencesIface* iface)
{
iface->merge = ipreferences_merge;
- iface->unmerge = ipreferences_unmerge;
+ iface->unmerge = ipreferences_unmerge;
}
ANJUTA_PLUGIN_BEGIN (DocmanPlugin, docman_plugin);
diff --git a/plugins/sourceview/sourceview-io.c b/plugins/sourceview/sourceview-io.c
index 91cff97..1d34517 100644
--- a/plugins/sourceview/sourceview-io.c
+++ b/plugins/sourceview/sourceview-io.c
@@ -2,17 +2,17 @@
/*
* anjuta-trunk
* Copyright (C) Johannes Schmid 2008 <jhs gnome org>
- *
+ *
* anjuta-trunk 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 3 of the License, or
* (at your option) any later version.
- *
+ *
* anjuta-trunk 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, see <http://www.gnu.org/licenses/>.
*/
@@ -73,7 +73,7 @@ sourceview_io_finalize (GObject *object)
g_source_remove (sio->monitor_idle);
if (sio->monitor)
g_object_unref (sio->monitor);
-
+
G_OBJECT_CLASS (sourceview_io_parent_class)->finalize (object);
}
@@ -140,7 +140,7 @@ sourceview_io_class_init (SourceviewIOClass *klass)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
-
+
io_signals[FILE_DELETED] =
g_signal_new ("deleted",
G_OBJECT_CLASS_TYPE (klass),
@@ -152,14 +152,14 @@ sourceview_io_class_init (SourceviewIOClass *klass)
NULL);
}
-static void on_file_changed (GFileMonitor* monitor,
+static void on_file_changed (GFileMonitor* monitor,
GFile* file,
GFile* other_file,
GFileMonitorEvent event_type,
gpointer data)
{
SourceviewIO* sio = SOURCEVIEW_IO(data);
-
+
switch (event_type)
{
case G_FILE_MONITOR_EVENT_CREATED:
@@ -187,7 +187,7 @@ setup_monitor_idle(gpointer data)
NULL);
if (sio->monitor)
{
- g_signal_connect (sio->monitor, "changed",
+ g_signal_connect (sio->monitor, "changed",
G_CALLBACK(on_file_changed), sio);
g_file_monitor_set_rate_limit (sio->monitor, RATE_LIMIT);
}
@@ -199,7 +199,7 @@ setup_monitor(SourceviewIO* sio)
{
if (sio->monitor_idle > 0)
g_source_remove (sio->monitor_idle);
-
+
sio->monitor_idle = g_timeout_add_seconds (TIMEOUT,
setup_monitor_idle,
sio);
@@ -267,7 +267,7 @@ sourceview_io_save (SourceviewIO* sio)
if (!sio->file)
{
GError* error = NULL;
- g_set_error (&error, IO_ERROR_QUARK, 0,
+ g_set_error (&error, IO_ERROR_QUARK, 0,
_("Could not save file because filename not yet specified"));
g_signal_emit_by_name (sio, "save-failed", error);
g_error_free(error);
@@ -282,24 +282,24 @@ sourceview_io_save_as (SourceviewIO* sio, GFile* file)
AnjutaShell* shell = ANJUTA_PLUGIN (sio->sv->priv->plugin)->shell;
gboolean backup = TRUE;
gsize len;
-
+
g_return_if_fail (file != NULL);
-
+
cancel_monitor (sio);
-
+
backup = g_settings_get_boolean (sio->sv->priv->settings,
"sourceview-backup");
-
+
if (sio->last_encoding == NULL)
{
- sio->write_buffer = ianjuta_editor_get_text_all (IANJUTA_EDITOR(sio->sv),
+ sio->write_buffer = ianjuta_editor_get_text_all (IANJUTA_EDITOR(sio->sv),
NULL);
len = strlen (sio->write_buffer);
}
else
{
GError* err = NULL;
- gchar* buffer_text = ianjuta_editor_get_text_all (IANJUTA_EDITOR(sio->sv),
+ gchar* buffer_text = ianjuta_editor_get_text_all (IANJUTA_EDITOR(sio->sv),
NULL);
sio->write_buffer = anjuta_convert_from_utf8 (buffer_text,
-1,
@@ -325,7 +325,7 @@ sourceview_io_save_as (SourceviewIO* sio, GFile* file)
on_save_finished,
sio);
anjuta_shell_saving_push (shell);
-
+
if (sio->file != file)
{
if (sio->file)
@@ -342,7 +342,7 @@ static void insert_text_in_document(SourceviewIO* sio, const gchar* text, gsize
gtk_source_buffer_begin_not_undoable_action (GTK_SOURCE_BUFFER (sio->sv->priv->document));
/* Insert text in the buffer */
- gtk_text_buffer_set_text (GTK_TEXT_BUFFER (document),
+ gtk_text_buffer_set_text (GTK_TEXT_BUFFER (document),
text,
len);
@@ -367,13 +367,13 @@ append_buffer (SourceviewIO* sio, gsize size)
gchar *converted_text = NULL;
gsize new_len = size;
const AnjutaEncoding* enc = NULL;
-
+
converted_text = anjuta_convert_to_utf8 (sio->read_buffer,
size,
&enc,
&new_len,
&conv_error);
- if (converted_text == NULL)
+ if (converted_text == NULL)
{
/* Last chance, let's try 8859-15 */
enc = anjuta_encoding_get_from_charset( "ISO-8859-15");
@@ -387,7 +387,7 @@ append_buffer (SourceviewIO* sio, gsize size)
if (converted_text == NULL)
{
g_return_val_if_fail (conv_error != NULL, FALSE);
-
+
g_signal_emit_by_name (sio, "open-failed", conv_error);
g_error_free (conv_error);
g_cancellable_cancel (sio->cancel);
@@ -407,7 +407,7 @@ on_read_finished (GObject* input, GAsyncResult* result, gpointer data)
GInputStream* input_stream = G_INPUT_STREAM(input);
gsize current_bytes = 0;
GError* err = NULL;
-
+
current_bytes = g_input_stream_read_finish (input_stream, result, &err);
if (err)
{
@@ -419,7 +419,7 @@ on_read_finished (GObject* input, GAsyncResult* result, gpointer data)
sio->bytes_read = 0;
return;
}
-
+
sio->bytes_read += current_bytes;
if (current_bytes != 0)
{
@@ -450,15 +450,15 @@ sourceview_io_open (SourceviewIO* sio, GFile* file)
{
GFileInputStream* input_stream;
GError* err = NULL;
-
+
g_return_if_fail (file != NULL);
-
+
if (sio->file)
g_object_unref (sio->file);
sio->file = file;
g_object_ref (sio->file);
set_display_name(sio);
-
+
input_stream = g_file_read (file, NULL, &err);
if (!input_stream)
{
@@ -484,40 +484,38 @@ sourceview_io_get_file (SourceviewIO* sio)
return sio->file;
}
-void
+void
sourceview_io_cancel (SourceviewIO* sio)
{
g_cancellable_cancel (sio->cancel);
}
-gchar*
+const gchar*
sourceview_io_get_filename (SourceviewIO* sio)
{
static gint new_file_count = 1;
- if (sio->filename)
- return g_strdup(sio->filename);
- else /* new file */
+ if (sio->filename == NULL) /* new file */
{
sio->filename = g_strdup_printf (_("New file %d"), new_file_count++);
- return g_strdup (sio->filename);
- }
+ }
+ return sio->filename;
}
-void
+void
sourceview_io_set_filename (SourceviewIO* sio, const gchar* filename)
{
g_free (sio->filename);
sio->filename = g_strdup(filename);
}
-gchar*
+gchar*
sourceview_io_get_mime_type (SourceviewIO* sio)
{
GFileInfo* file_info;
-
+
if (!sio->file)
return NULL;
-
+
file_info = g_file_query_info (sio->file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE,
@@ -531,7 +529,7 @@ sourceview_io_get_mime_type (SourceviewIO* sio)
}
else
return NULL;
-
+
}
gboolean
@@ -539,10 +537,10 @@ sourceview_io_get_read_only (SourceviewIO* sio)
{
GFileInfo* file_info;
gboolean retval;
-
+
if (!sio->file)
return FALSE;
-
+
file_info = g_file_query_info (sio->file,
G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
G_FILE_QUERY_INFO_NONE,
@@ -550,7 +548,7 @@ sourceview_io_get_read_only (SourceviewIO* sio)
NULL);
if (!file_info)
return FALSE;
-
+
retval = !g_file_info_get_attribute_boolean (file_info,
G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
g_object_unref (file_info);
diff --git a/plugins/sourceview/sourceview-io.h b/plugins/sourceview/sourceview-io.h
index 2e505f1..0ea3e0e 100644
--- a/plugins/sourceview/sourceview-io.h
+++ b/plugins/sourceview/sourceview-io.h
@@ -2,17 +2,17 @@
/*
* anjuta-trunk
* Copyright (C) Johannes Schmid 2008 <jhs gnome org>
- *
+ *
* anjuta-trunk 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 3 of the License, or
* (at your option) any later version.
- *
+ *
* anjuta-trunk 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, see <http://www.gnu.org/licenses/>.
*/
@@ -53,7 +53,7 @@ struct _SourceviewIOClass
struct _SourceviewIO
{
GObject parent_instance;
-
+
GFile* file;
gchar* filename;
Sourceview* sv;
@@ -63,7 +63,7 @@ struct _SourceviewIO
GFileMonitor* monitor;
guint monitor_idle;
gssize bytes_read;
-
+
const AnjutaEncoding* last_encoding;
};
@@ -73,7 +73,7 @@ void sourceview_io_save_as (SourceviewIO* sio, GFile* file);
void sourceview_io_open (SourceviewIO* sio, GFile* file);
void sourceview_io_cancel (SourceviewIO* sio);
GFile* sourceview_io_get_file (SourceviewIO* sio);
-gchar* sourceview_io_get_filename (SourceviewIO* sio);
+const gchar* sourceview_io_get_filename (SourceviewIO* sio);
void sourceview_io_set_filename (SourceviewIO* sio, const gchar* filename);
gchar* sourceview_io_get_mime_type (SourceviewIO* sio);
gboolean sourceview_io_get_read_only (SourceviewIO* sio);
diff --git a/plugins/sourceview/sourceview-print.c b/plugins/sourceview/sourceview-print.c
index f55a118..e006cd0 100644
--- a/plugins/sourceview/sourceview-print.c
+++ b/plugins/sourceview/sourceview-print.c
@@ -3,12 +3,12 @@
* 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 Library 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -36,13 +36,13 @@ struct _SourceviewPrinting
static gboolean
-paginate (GtkPrintOperation *operation,
+paginate (GtkPrintOperation *operation,
GtkPrintContext *context,
SourceviewPrinting* printing)
{
if (gtk_source_print_compositor_paginate (printing->compositor, context))
{
- gint n_pages;
+ gint n_pages;
anjuta_status_progress_tick (printing->status, NULL,
_("Preparing pages for printing"));
n_pages = gtk_source_print_compositor_get_n_pages (printing->compositor);
@@ -50,7 +50,7 @@ paginate (GtkPrintOperation *operation,
return TRUE;
}
-
+
return FALSE;
}
@@ -65,7 +65,7 @@ draw_page (GtkPrintOperation *operation,
}
static void
-end_print (GtkPrintOperation *operation,
+end_print (GtkPrintOperation *operation,
GtkPrintContext *context,
SourceviewPrinting* printing)
{
@@ -97,25 +97,25 @@ custom_widget_apply (GtkPrintOperation* operation,
gtk_source_print_compositor_set_print_footer (printing->compositor,
g_settings_get_boolean (printing->sv->priv->settings,
PRINT_FOOTER));
-
+
gtk_source_print_compositor_set_highlight_syntax (printing->compositor,
g_settings_get_boolean (printing->sv->priv->settings,
- PRINT_HIGHLIGHT));
+ PRINT_HIGHLIGHT));
}
static GObject*
create_custom_widget (GtkPrintOperation* operation,
Sourceview* sv)
{
- GtkWidget* toggle_linewrap =
+ GtkWidget* toggle_linewrap =
gtk_check_button_new_with_label (_("Wrap lines"));
- GtkWidget* toggle_linenumbers =
+ GtkWidget* toggle_linenumbers =
gtk_check_button_new_with_label (_("Line numbers"));
- GtkWidget* toggle_header =
+ GtkWidget* toggle_header =
gtk_check_button_new_with_label (_("Header"));
- GtkWidget* toggle_footer =
+ GtkWidget* toggle_footer =
gtk_check_button_new_with_label (_("Footer"));
- GtkWidget* toggle_highlight =
+ GtkWidget* toggle_highlight =
gtk_check_button_new_with_label (_("Highlight source code"));
GtkWidget* vbox = gtk_vbox_new (TRUE, 5);
@@ -151,7 +151,7 @@ print_setup (Sourceview* sv)
SourceviewPrinting* printing = g_slice_new0(SourceviewPrinting);
const gchar *filename;
gchar *basename;
-
+
filename = ianjuta_document_get_filename (IANJUTA_DOCUMENT (sv), NULL);
basename = g_filename_display_basename (filename);
@@ -168,7 +168,7 @@ print_setup (Sourceview* sv)
"%T",
basename,
"Page %N/%Q");
-
+
operation = gtk_print_operation_new ();
gtk_print_operation_set_job_name (operation, basename);
@@ -178,31 +178,31 @@ print_setup (Sourceview* sv)
printing->compositor = compositor;
printing->sv = sv;
printing->status = anjuta_shell_get_status (sv->priv->plugin->shell, NULL);
-
- g_signal_connect (G_OBJECT (operation), "paginate",
+
+ g_signal_connect (G_OBJECT (operation), "paginate",
G_CALLBACK (paginate), printing);
- g_signal_connect (G_OBJECT (operation), "draw-page",
+ g_signal_connect (G_OBJECT (operation), "draw-page",
G_CALLBACK (draw_page), printing);
- g_signal_connect (G_OBJECT (operation), "end-print",
+ g_signal_connect (G_OBJECT (operation), "end-print",
G_CALLBACK (end_print), printing);
- g_signal_connect (G_OBJECT (operation), "create-custom-widget",
+ g_signal_connect (G_OBJECT (operation), "create-custom-widget",
G_CALLBACK (create_custom_widget), sv);
- g_signal_connect (G_OBJECT (operation), "custom-widget-apply",
- G_CALLBACK (custom_widget_apply), printing);
-
+ g_signal_connect (G_OBJECT (operation), "custom-widget-apply",
+ G_CALLBACK (custom_widget_apply), printing);
+
anjuta_status_progress_reset (printing->status);
anjuta_status_progress_add_ticks (printing->status, 100);
g_free (basename);
-
+
return operation;
}
-void
+void
sourceview_print(Sourceview* sv)
{
GtkPrintOperation* operation = print_setup (sv);
-
- gtk_print_operation_run (operation,
+
+ gtk_print_operation_run (operation,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
NULL, NULL);
g_object_unref (operation);
@@ -211,11 +211,11 @@ sourceview_print(Sourceview* sv)
void
sourceview_print_preview(Sourceview* sv)
-{
+{
GtkPrintOperation* operation = print_setup (sv);
- gtk_print_operation_run (operation,
+ gtk_print_operation_run (operation,
GTK_PRINT_OPERATION_ACTION_PREVIEW,
NULL, NULL);
- g_object_unref (operation);
+ g_object_unref (operation);
}
diff --git a/plugins/sourceview/sourceview.c b/plugins/sourceview/sourceview.c
index 6582287..e84e85d 100644
--- a/plugins/sourceview/sourceview.c
+++ b/plugins/sourceview/sourceview.c
@@ -62,7 +62,7 @@
#include "sourceview-cell.h"
#include "sourceview-provider.h"
#include "plugin.h"
-
+
#define FORWARD 0
#define BACKWARD 1
@@ -83,7 +83,7 @@ static GObjectClass *parent_class = NULL;
static gboolean on_sourceview_hover_over (GtkWidget *widget, gint x, gint y,
gboolean keyboard_tip, GtkTooltip *tooltip,
- gpointer data);
+ gpointer data);
/* Utils */
/* Sync with IANJUTA_MARKABLE_MARKER */
@@ -130,7 +130,7 @@ anjuta_message_area_new (const gchar *text,
GtkInfoBar *message_area;
GtkWidget *content_area;
GtkWidget *message_label = gtk_label_new ("");
-
+
message_area = GTK_INFO_BAR (gtk_info_bar_new ());
gtk_info_bar_set_message_type (message_area, type);
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (message_area));
@@ -156,7 +156,7 @@ on_marker_tooltip (GtkSourceMarkAttributes* cat, GtkSourceMark* mark, gpointer d
return NULL;
}
-static void
+static void
sourceview_create_marker_category (Sourceview* sv, const gchar* marker_pixbuf,
IAnjutaMarkableMarker marker_type)
{
@@ -195,27 +195,27 @@ static void sourceview_create_markers(Sourceview* sv)
/* Create tags for highlighting */
static void sourceview_create_highlight_indic(Sourceview* sv)
-{
+{
char* error_color =
g_settings_get_string (sv->priv->msgman_settings,
PREF_COLOR_ERROR);
char* warning_color =
g_settings_get_string (sv->priv->msgman_settings,
PREF_COLOR_WARNING);
- sv->priv->important_indic =
+ sv->priv->important_indic =
gtk_text_buffer_create_tag (GTK_TEXT_BUFFER(sv->priv->document),
IMPORTANT_INDIC,
- "background", "#FFFF00", NULL);
- sv->priv->warning_indic =
+ "background", "#FFFF00", NULL);
+ sv->priv->warning_indic =
gtk_text_buffer_create_tag (GTK_TEXT_BUFFER(sv->priv->document),
WARNING_INDIC,
- "foreground", warning_color,
+ "foreground", warning_color,
"underline", PANGO_UNDERLINE_SINGLE,
- NULL);
- sv->priv->critical_indic =
+ NULL);
+ sv->priv->critical_indic =
gtk_text_buffer_create_tag (GTK_TEXT_BUFFER(sv->priv->document),
CRITICAL_INDIC,
- "foreground", error_color, "underline",
+ "foreground", error_color, "underline",
PANGO_UNDERLINE_ERROR, NULL);
g_free (error_color);
g_free (warning_color);
@@ -226,7 +226,7 @@ goto_line (Sourceview* sv, gint line)
{
GtkTextIter iter;
GtkTextBuffer* buffer = GTK_TEXT_BUFFER (sv->priv->document);
-
+
gtk_text_buffer_get_iter_at_line (buffer,
&iter,
line);
@@ -249,7 +249,7 @@ sourceview_set_message_area (Sourceview* sv, GtkWidget *message_area)
if (sv->priv->message_area == NULL)
return;
-
+
gtk_widget_show (message_area);
gtk_box_pack_start (GTK_BOX (sv),
message_area,
@@ -258,19 +258,19 @@ sourceview_set_message_area (Sourceview* sv, GtkWidget *message_area)
0);
g_object_weak_ref (G_OBJECT (sv->priv->message_area),
(GWeakNotify)on_destroy_message_area, sv);
-
+
g_signal_emit_by_name (G_OBJECT (sv), "update-save-ui");
}
/* Callbacks */
-static void
+static void
on_assist_tip_destroyed (Sourceview* sv, gpointer where_object_was)
{
sv->priv->assist_tip = NULL;
}
-static void
-on_insert_text (GtkTextBuffer *buffer,
+static void
+on_insert_text (GtkTextBuffer *buffer,
GtkTextIter *location,
gchar *text,
gint len,
@@ -283,10 +283,10 @@ on_insert_text (GtkTextBuffer *buffer,
GtkTextMark *mark = gtk_text_buffer_create_mark (buffer, NULL, location, TRUE);
g_object_unref (cell);
- ianjuta_iterable_set_position (iter,
- ianjuta_iterable_get_position (iter, NULL) - len,
+ ianjuta_iterable_set_position (iter,
+ ianjuta_iterable_get_position (iter, NULL) - len,
NULL);
-
+
/* Update the status bar */
g_signal_emit_by_name (G_OBJECT (sv), "update-ui");
@@ -306,7 +306,7 @@ on_insert_text (GtkTextBuffer *buffer,
/* Send the "changed" signal and revalidate the iterator */
g_signal_emit_by_name (G_OBJECT (sv), "changed", iter, TRUE, len, lines, signal_text);
g_free (signal_text);
-
+
gtk_text_buffer_get_iter_at_mark (buffer, location, mark);
}
@@ -337,7 +337,7 @@ on_delete_range_after (GtkTextBuffer *buffer,
SourceviewCell *cell = NULL;
IAnjutaIterable *position = NULL;
gint length = 0, i = 0, lines = 0;
-
+
/* Assertions */
g_return_if_fail (ANJUTA_IS_SOURCEVIEW (user_data));
sv = ANJUTA_SOURCEVIEW (user_data);
@@ -356,7 +356,7 @@ on_delete_range_after (GtkTextBuffer *buffer,
start_mark = gtk_text_buffer_create_mark (buffer, NULL, start_iter, TRUE);
end_mark = gtk_text_buffer_create_mark (buffer, NULL, end_iter, TRUE);
- g_signal_emit_by_name (G_OBJECT (sv), "changed",
+ g_signal_emit_by_name (G_OBJECT (sv), "changed",
position, FALSE, length, lines, sv->priv->deleted_text);
/* Revalidate the iterators */
@@ -369,7 +369,7 @@ on_delete_range_after (GtkTextBuffer *buffer,
}
-static void
+static void
on_cursor_position_changed (GObject *buffer_obj,
GParamSpec *param_spec,
gpointer user_data)
@@ -460,7 +460,7 @@ sourceview_reload_save_markers (Sourceview* sv)
iter, NULL);
source_mark = marks->data;
g_slist_free (marks);
-
+
do
{
MarkerReload* reload = g_new0(MarkerReload, 1);
@@ -475,7 +475,7 @@ sourceview_reload_save_markers (Sourceview* sv)
sv->priv->reload_marks = g_slist_append (sv->priv->reload_marks, reload);
}
while ((source_mark = gtk_source_mark_next (source_mark, NULL)));
-
+
gtk_source_buffer_remove_source_marks (GTK_SOURCE_BUFFER (sv->priv->document), &begin, &end, NULL);
gtk_text_iter_free (iter);
}
@@ -502,7 +502,7 @@ sourceview_reload_restore_markers (Sourceview* sv)
}
/* Callback for dialog below */
-static void
+static void
on_reload_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
{
if (res == GTK_RESPONSE_YES)
@@ -510,7 +510,7 @@ on_reload_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
GFile* file = sourceview_io_get_file (sv->priv->io);
/* Save marks and position */
- sv->priv->goto_line =
+ sv->priv->goto_line =
LOCATION_TO_LINE(ianjuta_editor_get_lineno (IANJUTA_EDITOR(sv), NULL));
sourceview_reload_save_markers (sv);
@@ -527,13 +527,13 @@ on_reload_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
gtk_widget_destroy (message_area);
}
-static void
+static void
on_close_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
{
if (res == GTK_RESPONSE_YES)
{
IAnjutaDocumentManager *docman;
-
+
docman = anjuta_shell_get_interface (sv->priv->plugin->shell, IAnjutaDocumentManager, NULL);
if (docman == NULL) return;
@@ -552,17 +552,15 @@ on_file_changed (SourceviewIO* sio, Sourceview* sv)
{
GtkWidget *message_area;
gchar *buff;
-
- gchar* filename = sourceview_io_get_filename (sio);
-
+
+ const gchar* filename = sourceview_io_get_filename (sio);
+
buff =
g_strdup_printf (_
("The file \"%s\" on the disk is more recent than "
"the current buffer.\nDo you want to reload it?"),
filename);
- g_free (filename);
-
message_area = anjuta_message_area_new (buff, GTK_MESSAGE_WARNING);
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
GTK_STOCK_REFRESH,
@@ -571,13 +569,13 @@ on_file_changed (SourceviewIO* sio, Sourceview* sv)
GTK_STOCK_CANCEL,
GTK_RESPONSE_NO);
g_free (buff);
-
+
g_signal_connect (G_OBJECT(message_area), "response",
G_CALLBACK (on_reload_dialog_response),
sv);
-
+
sourceview_set_message_area (sv, message_area);
-
+
return FALSE;
}
@@ -586,17 +584,15 @@ on_file_deleted (SourceviewIO* sio, Sourceview* sv)
{
GtkWidget *message_area;
gchar *buff;
-
- gchar* filename = sourceview_io_get_filename (sio);
-
+
+ const gchar* filename = sourceview_io_get_filename (sio);
+
buff =
g_strdup_printf (_
("The file \"%s\" has been deleted on the disk.\n"
"Do you want to close it?"),
filename);
- g_free (filename);
-
message_area = anjuta_message_area_new (buff, GTK_MESSAGE_WARNING);
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
GTK_STOCK_DELETE,
@@ -605,13 +601,13 @@ on_file_deleted (SourceviewIO* sio, Sourceview* sv)
GTK_STOCK_CANCEL,
GTK_RESPONSE_NO);
g_free (buff);
-
+
g_signal_connect (G_OBJECT(message_area), "response",
G_CALLBACK (on_close_dialog_response),
sv);
-
+
sourceview_set_message_area (sv, message_area);
-
+
return FALSE;
}
@@ -619,17 +615,17 @@ static void
on_open_failed (SourceviewIO* io, GError* err, Sourceview* sv)
{
AnjutaShell* shell = ANJUTA_PLUGIN (sv->priv->plugin)->shell;
- IAnjutaDocumentManager *docman =
+ IAnjutaDocumentManager *docman =
anjuta_shell_get_interface (shell, IAnjutaDocumentManager, NULL);
g_return_if_fail (docman != NULL);
GList* documents = ianjuta_document_manager_get_doc_widgets (docman, NULL);
GtkWidget* message_area;
-
+
/* Could not open <filename>: <error message> */
gchar* message = g_strdup_printf (_("Could not open %s: %s"),
- sourceview_io_get_filename (sv->priv->io),
+ sourceview_io_get_filename (sv->priv->io),
err->message);
-
+
if (g_list_find (documents, sv))
{
message_area = anjuta_message_area_new (message, GTK_MESSAGE_WARNING);
@@ -637,7 +633,7 @@ on_open_failed (SourceviewIO* io, GError* err, Sourceview* sv)
GTK_STOCK_OK,
GTK_RESPONSE_OK);
g_signal_connect (message_area, "response", G_CALLBACK(gtk_widget_destroy), NULL);
-
+
sourceview_set_message_area (sv, message_area);
}
else
@@ -652,7 +648,7 @@ on_open_failed (SourceviewIO* io, GError* err, Sourceview* sv)
g_free (message);
sv->priv->loading = FALSE;
gtk_text_view_set_editable (GTK_TEXT_VIEW (sv->priv->view), TRUE);
-
+
/* Get rid of reference from ifile_open */
g_object_unref(G_OBJECT(sv));
}
@@ -670,21 +666,20 @@ on_read_only_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
}
/* Called when document is loaded completly */
-static void
+static void
on_open_finish(SourceviewIO* io, Sourceview* sv)
{
const gchar *lang;
-
- gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(sv->priv->document), FALSE);
-
+
+ gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(sv->priv->document), FALSE);
+
if (sourceview_io_get_read_only (io))
{
- gchar* filename = sourceview_io_get_filename (io);
+ const gchar* filename = sourceview_io_get_filename (io);
gchar* buff = g_strdup_printf (_("The file \"%s\" is read-only! Edit anyway?"),
filename);
GtkWidget* message_area;
- g_free (filename);
-
+
message_area = anjuta_message_area_new (buff, GTK_MESSAGE_WARNING);
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
GTK_STOCK_YES,
@@ -693,13 +688,13 @@ on_open_finish(SourceviewIO* io, Sourceview* sv)
GTK_STOCK_NO,
GTK_RESPONSE_NO);
g_free (buff);
-
+
g_signal_connect (G_OBJECT(message_area), "response",
G_CALLBACK (on_read_only_dialog_response),
sv);
-
+
sv->priv->read_only = TRUE;
-
+
sourceview_set_message_area (sv, message_area);
}
else
@@ -708,7 +703,7 @@ on_open_finish(SourceviewIO* io, Sourceview* sv)
g_signal_emit_by_name(G_OBJECT(sv), "update-save-ui");
sourceview_reload_restore_markers (sv);
-
+
if (sv->priv->goto_line > 0)
{
goto_line (sv, sv->priv->goto_line);
@@ -724,7 +719,7 @@ on_open_finish(SourceviewIO* io, Sourceview* sv)
lang = ianjuta_editor_language_get_language(IANJUTA_EDITOR_LANGUAGE(sv), NULL);
g_signal_emit_by_name (sv, "language-changed", lang);
-
+
/* Get rid of reference from ifile_open */
g_object_unref(G_OBJECT(sv));
}
@@ -732,19 +727,19 @@ on_open_finish(SourceviewIO* io, Sourceview* sv)
static void on_save_failed (SourceviewIO* sio, GError* err, Sourceview* sv)
{
AnjutaShell* shell = ANJUTA_PLUGIN (sv->priv->plugin)->shell;
- IAnjutaDocumentManager *docman =
+ IAnjutaDocumentManager *docman =
anjuta_shell_get_interface (shell, IAnjutaDocumentManager, NULL);
g_return_if_fail (docman != NULL);
GList* documents = ianjuta_document_manager_get_doc_widgets (docman, NULL);
GtkWidget* message_area;
-
+
g_signal_emit_by_name(G_OBJECT(sv), "saved", NULL);
-
+
/* Could not open <filename>: <error message> */
gchar* message = g_strdup_printf (_("Could not save %s: %s"),
- sourceview_io_get_filename (sv->priv->io),
+ sourceview_io_get_filename (sv->priv->io),
err->message);
-
+
if (g_list_find (documents, sv))
{
message_area = anjuta_message_area_new (message, GTK_MESSAGE_ERROR);
@@ -752,7 +747,7 @@ static void on_save_failed (SourceviewIO* sio, GError* err, Sourceview* sv)
GTK_STOCK_OK,
GTK_RESPONSE_OK);
g_signal_connect (message_area, "response", G_CALLBACK(gtk_widget_destroy), NULL);
-
+
sourceview_set_message_area (sv, message_area);
}
else
@@ -765,13 +760,13 @@ static void on_save_failed (SourceviewIO* sio, GError* err, Sourceview* sv)
gtk_dialog_run (GTK_DIALOG (dialog));
}
g_free (message);
-
+
g_object_unref (sv);
}
/* Called when document is saved completly */
static void on_save_finish(SourceviewIO* sio, Sourceview* sv)
-{
+{
const gchar* lang;
GFile* file = sourceview_io_get_file(sio);
gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(sv->priv->document), FALSE);
@@ -786,7 +781,7 @@ static void on_save_finish(SourceviewIO* sio, Sourceview* sv)
g_object_unref (sv);
}
-static void
+static void
sourceview_adjustment_changed(GtkAdjustment* ad, Sourceview* sv)
{
/* Hide assistance windows when scrolling vertically */
@@ -796,10 +791,10 @@ sourceview_adjustment_changed(GtkAdjustment* ad, Sourceview* sv)
/* Construction/Deconstruction */
-static void
+static void
sourceview_instance_init(Sourceview* sv)
-{
+{
sv->priv = g_slice_new0 (SourceviewPrivate);
sv->priv->io = sourceview_io_new (sv);
g_signal_connect (sv->priv->io, "changed", G_CALLBACK (on_file_changed), sv);
@@ -812,12 +807,12 @@ sourceview_instance_init(Sourceview* sv)
sv);
g_signal_connect (sv->priv->io, "save-failed", G_CALLBACK (on_save_failed),
sv);
-
+
/* Create buffer */
sv->priv->document = gtk_source_buffer_new(NULL);
- g_signal_connect_after(G_OBJECT(sv->priv->document), "modified-changed",
+ g_signal_connect_after(G_OBJECT(sv->priv->document), "modified-changed",
G_CALLBACK(on_document_modified_changed), sv);
- g_signal_connect_after(G_OBJECT(sv->priv->document), "mark-set",
+ g_signal_connect_after(G_OBJECT(sv->priv->document), "mark-set",
G_CALLBACK(on_mark_set),sv);
g_signal_connect_after (G_OBJECT(sv->priv->document), "insert-text",
G_CALLBACK(on_insert_text), sv);
@@ -827,14 +822,14 @@ sourceview_instance_init(Sourceview* sv)
G_CALLBACK(on_delete_range_after), sv);
g_signal_connect (G_OBJECT (sv->priv->document), "notify::cursor-position",
G_CALLBACK (on_cursor_position_changed), sv);
-
+
/* Create View instance */
sv->priv->view = ANJUTA_VIEW(anjuta_view_new(sv));
- g_signal_connect_after (G_OBJECT(sv->priv->view), "toggle-overwrite",
+ g_signal_connect_after (G_OBJECT(sv->priv->view), "toggle-overwrite",
G_CALLBACK(on_overwrite_toggled), sv);
g_signal_connect (G_OBJECT(sv->priv->view), "query-tooltip",
G_CALLBACK (on_sourceview_hover_over), sv);
- g_signal_connect_after(G_OBJECT(sv->priv->view), "backspace",
+ g_signal_connect_after(G_OBJECT(sv->priv->view), "backspace",
G_CALLBACK(on_backspace),sv);
g_object_set (G_OBJECT (sv->priv->view), "has-tooltip", TRUE, NULL);
@@ -842,7 +837,7 @@ sourceview_instance_init(Sourceview* sv)
/* Apply Preferences */
sourceview_prefs_init(sv);
-
+
/* Create Markers */
sourceview_create_markers(sv);
@@ -854,11 +849,11 @@ static void
sourceview_class_init(SourceviewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
+
parent_class = g_type_class_peek_parent(klass);
object_class->dispose = sourceview_dispose;
object_class->finalize = sourceview_finalize;
-
+
/* Create signals here:
sourceview_signals[SIGNAL_TYPE_EXAMPLE] = g_signal_new(...)
*/
@@ -872,18 +867,18 @@ sourceview_dispose(GObject *object)
if (cobj->priv->assist_tip)
gtk_widget_destroy(GTK_WIDGET(cobj->priv->assist_tip));
g_object_unref (cobj->priv->io);
-
+
if (cobj->priv->tooltip_cell)
g_object_unref (cobj->priv->tooltip_cell);
-
+
for (node = cobj->priv->idle_sources; node != NULL; node = g_slist_next (node))
{
g_source_remove (GPOINTER_TO_UINT (node->data));
}
g_slist_free (cobj->priv->idle_sources);
-
+
sourceview_prefs_destroy(cobj);
-
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -892,7 +887,7 @@ sourceview_finalize(GObject *object)
{
Sourceview *cobj;
cobj = ANJUTA_SOURCEVIEW(object);
-
+
g_slice_free(SourceviewPrivate, cobj->priv);
G_OBJECT_CLASS(parent_class)->finalize(object);
DEBUG_PRINT("%s", "=========== finalise =============");
@@ -905,15 +900,15 @@ Sourceview *
sourceview_new(GFile* file, const gchar* filename, AnjutaPlugin* plugin)
{
GtkAdjustment* v_adj;
-
+
Sourceview *sv = ANJUTA_SOURCEVIEW(g_object_new(ANJUTA_TYPE_SOURCEVIEW, NULL));
-
+
sv->priv->plugin = plugin;
-
+
/* Add View */
sv->priv->window = gtk_scrolled_window_new (NULL, NULL);
gtk_box_pack_end (GTK_BOX (sv), sv->priv->window, TRUE, TRUE, 0);
-
+
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sv->priv->window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
@@ -921,22 +916,22 @@ sourceview_new(GFile* file, const gchar* filename, AnjutaPlugin* plugin)
gtk_widget_show_all(GTK_WIDGET(sv));
v_adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sv->priv->window));
g_signal_connect (v_adj, "value-changed", G_CALLBACK (sourceview_adjustment_changed), sv);
-
+
if (file != NULL)
{
ianjuta_file_open(IANJUTA_FILE(sv), file, NULL);
}
else if (filename != NULL && strlen(filename) > 0)
sourceview_io_set_filename (sv->priv->io, filename);
-
+
DEBUG_PRINT("%s", "============ Creating new editor =============");
-
+
g_signal_emit_by_name (G_OBJECT(sv), "update-ui");
g_signal_connect_after(G_OBJECT(sv->priv->view), "line-mark-activated",
G_CALLBACK(on_line_mark_activated),
G_OBJECT(sv)
);
-
+
return sv;
}
@@ -951,7 +946,7 @@ ifile_open (IAnjutaFile* ifile, GFile* file, GError** e)
g_object_ref(G_OBJECT(sv));
gtk_text_buffer_set_text (GTK_TEXT_BUFFER(sv->priv->document),
"",
- 0);
+ 0);
gtk_text_view_set_editable (GTK_TEXT_VIEW (sv->priv->view),
FALSE);
sv->priv->loading = TRUE;
@@ -970,17 +965,17 @@ ifile_get_file (IAnjutaFile* ifile, GError** e)
/* IAnjutaFileSavable interface */
/* Save file */
-static void
+static void
ifile_savable_save (IAnjutaFileSavable* file, GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(file);
-
+
g_object_ref(G_OBJECT(sv));
sourceview_io_save (sv->priv->io);
}
/* Save file as */
-static void
+static void
ifile_savable_save_as (IAnjutaFileSavable* ifile, GFile* file, GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(ifile);
@@ -989,15 +984,15 @@ ifile_savable_save_as (IAnjutaFileSavable* ifile, GFile* file, GError** e)
sourceview_io_save_as (sv->priv->io, file);
}
-static void
+static void
ifile_savable_set_dirty (IAnjutaFileSavable* file, gboolean dirty, GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(file);
- gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(sv->priv->document),
+ gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(sv->priv->document),
dirty);
}
-static gboolean
+static gboolean
ifile_savable_is_dirty (IAnjutaFileSavable* file, GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(file);
@@ -1064,7 +1059,7 @@ static void
ieditor_set_use_spaces (IAnjutaEditor *editor, gboolean use_spaces, GError **e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
- gtk_source_view_set_insert_spaces_instead_of_tabs(GTK_SOURCE_VIEW(sv->priv->view),
+ gtk_source_view_set_insert_spaces_instead_of_tabs(GTK_SOURCE_VIEW(sv->priv->view),
use_spaces);
}
@@ -1072,7 +1067,7 @@ static void
ieditor_set_auto_indent (IAnjutaEditor *editor, gboolean auto_indent, GError **e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
- gtk_source_view_set_auto_indent(GTK_SOURCE_VIEW(sv->priv->view),
+ gtk_source_view_set_auto_indent(GTK_SOURCE_VIEW(sv->priv->view),
auto_indent);
}
@@ -1106,17 +1101,17 @@ static void ieditor_goto_position(IAnjutaEditor *editor, IAnjutaIterable* icell,
}
/* Return a newly allocated pointer containing the whole text */
-static gchar* ieditor_get_text (IAnjutaEditor* editor,
+static gchar* ieditor_get_text (IAnjutaEditor* editor,
IAnjutaIterable* start,
IAnjutaIterable* end, GError **e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
-
+
GtkTextIter start_iter;
GtkTextIter end_iter;
sourceview_cell_get_iter (SOURCEVIEW_CELL(start), &start_iter);
sourceview_cell_get_iter (SOURCEVIEW_CELL(end), &end_iter);
-
+
return gtk_text_buffer_get_slice(GTK_TEXT_BUFFER(sv->priv->document),
&start_iter, &end_iter, TRUE);
}
@@ -1128,10 +1123,10 @@ ieditor_get_text_all (IAnjutaEditor* edit, GError **e)
GtkTextIter end_iter;
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
GtkTextBuffer* buffer = GTK_TEXT_BUFFER (sv->priv->document);
-
+
gtk_text_buffer_get_iter_at_offset (buffer, &start_iter, 0);
gtk_text_buffer_get_iter_at_offset (buffer, &end_iter, -1);
-
+
return gtk_text_buffer_get_slice(GTK_TEXT_BUFFER(sv->priv->document),
&start_iter, &end_iter, TRUE);
}
@@ -1144,12 +1139,12 @@ ieditor_get_position (IAnjutaEditor* editor, GError **e)
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter iter;
SourceviewCell* cell;
-
- gtk_text_buffer_get_iter_at_mark(buffer, &iter,
+
+ gtk_text_buffer_get_iter_at_mark(buffer, &iter,
gtk_text_buffer_get_insert(buffer));
cell = sourceview_cell_new (&iter, GTK_TEXT_VIEW (sv->priv->view));
-
+
return IANJUTA_ITERABLE (cell);
}
@@ -1159,10 +1154,10 @@ ieditor_get_offset (IAnjutaEditor* editor, GError **e)
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter iter;
-
- gtk_text_buffer_get_iter_at_mark(buffer, &iter,
+
+ gtk_text_buffer_get_iter_at_mark(buffer, &iter,
gtk_text_buffer_get_insert(buffer));
-
+
return gtk_text_iter_get_offset (&iter);
}
@@ -1172,8 +1167,8 @@ static gint ieditor_get_lineno(IAnjutaEditor *editor, GError **e)
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter iter;
-
- gtk_text_buffer_get_iter_at_mark(buffer, &iter,
+
+ gtk_text_buffer_get_iter_at_mark(buffer, &iter,
gtk_text_buffer_get_insert(buffer));
return gtk_text_iter_get_line(&iter) + 1;
}
@@ -1183,13 +1178,13 @@ static gint ieditor_get_length(IAnjutaEditor *editor, GError **e)
{
/* We do not use gtk_text_buffer_get_char_count here because
we need a size in bytes not in characters */
-
+
GtkTextIter start_iter;
GtkTextIter end_iter;
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
gchar* text;
gint length;
-
+
gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(sv->priv->document),
&start_iter);
gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(sv->priv->document),
@@ -1229,7 +1224,7 @@ static void ieditor_insert(IAnjutaEditor *editor, IAnjutaIterable* icell,
g_signal_handlers_block_by_func (sv->priv->document,
on_insert_text,
sv);
-
+
gtk_text_buffer_insert(GTK_TEXT_BUFFER(sv->priv->document),
&iter, text, length);
g_signal_handlers_unblock_by_func (sv->priv->document,
@@ -1258,7 +1253,7 @@ static void ieditor_append(IAnjutaEditor *editor, const gchar* text,
sv);
}
-static void ieditor_erase(IAnjutaEditor* editor, IAnjutaIterable* istart_cell,
+static void ieditor_erase(IAnjutaEditor* editor, IAnjutaIterable* istart_cell,
IAnjutaIterable* iend_cell, GError **e)
{
SourceviewCell* start_cell = SOURCEVIEW_CELL (istart_cell);
@@ -1267,10 +1262,10 @@ static void ieditor_erase(IAnjutaEditor* editor, IAnjutaIterable* istart_cell,
SourceviewCell* end_cell = SOURCEVIEW_CELL (iend_cell);
sourceview_cell_get_iter (end_cell, &end);
sourceview_cell_get_iter (start_cell, &start);
-
+
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
-
+
gtk_text_buffer_delete (buffer, &start, &end);
}
@@ -1286,8 +1281,8 @@ static gint ieditor_get_column(IAnjutaEditor *editor, GError **e)
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter iter;
-
- gtk_text_buffer_get_iter_at_mark(buffer, &iter,
+
+ gtk_text_buffer_get_iter_at_mark(buffer, &iter,
gtk_text_buffer_get_insert(buffer));
return gtk_text_iter_get_line_offset(&iter);
}
@@ -1301,7 +1296,7 @@ static gboolean ieditor_get_overwrite(IAnjutaEditor *editor, GError **e)
/* Set the editor popup menu */
-static void ieditor_set_popup_menu(IAnjutaEditor *editor,
+static void ieditor_set_popup_menu(IAnjutaEditor *editor,
GtkWidget* menu, GError **e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
@@ -1309,7 +1304,7 @@ static void ieditor_set_popup_menu(IAnjutaEditor *editor,
}
/* Convert from position to line */
-static gint ieditor_get_line_from_position(IAnjutaEditor *editor,
+static gint ieditor_get_line_from_position(IAnjutaEditor *editor,
IAnjutaIterable* icell, GError **e)
{
SourceviewCell* cell = SOURCEVIEW_CELL (icell);
@@ -1323,7 +1318,7 @@ static IAnjutaIterable* ieditor_get_line_begin_position(IAnjutaEditor *editor,
{
GtkTextIter iter;
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
-
+
gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER(sv->priv->document),
&iter, LOCATION_TO_LINE (line), 0);
return IANJUTA_ITERABLE (sourceview_cell_new (&iter, GTK_TEXT_VIEW (sv->priv->view)));
@@ -1334,7 +1329,7 @@ static IAnjutaIterable* ieditor_get_line_end_position(IAnjutaEditor *editor,
{
GtkTextIter iter;
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
-
+
gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER(sv->priv->document),
&iter, LOCATION_TO_LINE (line), 0);
/* If iter is not at line end, move it */
@@ -1350,10 +1345,10 @@ ieditor_get_position_from_offset(IAnjutaEditor* edit, gint position, GError** e)
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter iter;
SourceviewCell* cell;
-
+
gtk_text_buffer_get_iter_at_offset(buffer, &iter, position);
cell = sourceview_cell_new(&iter, GTK_TEXT_VIEW(sv->priv->view));
-
+
return IANJUTA_ITERABLE(cell);
}
@@ -1364,10 +1359,10 @@ ieditor_get_start_position (IAnjutaEditor* edit, GError** e)
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter iter;
SourceviewCell* cell;
-
+
gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0);
cell = sourceview_cell_new(&iter, GTK_TEXT_VIEW(sv->priv->view));
-
+
return IANJUTA_ITERABLE(cell);
}
@@ -1378,10 +1373,10 @@ ieditor_get_end_position (IAnjutaEditor* edit, GError** e)
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter iter;
SourceviewCell* cell;
-
+
gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
cell = sourceview_cell_new(&iter, GTK_TEXT_VIEW(sv->priv->view));
-
+
return IANJUTA_ITERABLE(cell);
}
@@ -1394,7 +1389,7 @@ ieditor_goto_start (IAnjutaEditor* edit, GError** e)
&iter, 0);
gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (sv->priv->document), &iter);
gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (sv->priv->view),
- &iter, 0, FALSE, 0, 0);
+ &iter, 0, FALSE, 0, 0);
}
static void
@@ -1406,7 +1401,7 @@ ieditor_goto_end (IAnjutaEditor* edit, GError** e)
&iter, -1);
gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (sv->priv->document), &iter);
gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (sv->priv->view),
- &iter, 0, FALSE, 0, 0);
+ &iter, 0, FALSE, 0, 0);
}
static void
@@ -1453,40 +1448,40 @@ static gboolean idocument_can_redo(IAnjutaDocument *editor, GError **e)
/* Return true if editor can undo */
static gboolean idocument_can_undo(IAnjutaDocument *editor, GError **e)
{
- Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
+ Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
return gtk_source_buffer_can_undo(GTK_SOURCE_BUFFER(sv->priv->document));
}
/* Return true if editor can undo */
static void idocument_begin_undo_action (IAnjutaDocument *editor, GError **e)
{
- Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
+ Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER(sv->priv->document));
}
/* Return true if editor can undo */
static void idocument_end_undo_action (IAnjutaDocument *editor, GError **e)
{
- Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
+ Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER(sv->priv->document));
}
-static void
+static void
idocument_undo(IAnjutaDocument* edit, GError** ee)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
- if (idocument_can_undo(edit, NULL))
+ if (idocument_can_undo(edit, NULL))
gtk_source_buffer_undo(GTK_SOURCE_BUFFER(sv->priv->document));
anjuta_view_scroll_to_cursor(sv->priv->view);
- g_signal_emit_by_name(G_OBJECT(sv), "update_ui", sv);
+ g_signal_emit_by_name(G_OBJECT(sv), "update_ui", sv);
}
-static void
+static void
idocument_redo(IAnjutaDocument* edit, GError** ee)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
- if (idocument_can_redo(edit, NULL))
+ if (idocument_can_redo(edit, NULL))
gtk_source_buffer_redo(GTK_SOURCE_BUFFER(sv->priv->document));
anjuta_view_scroll_to_cursor(sv->priv->view);
g_signal_emit_by_name(G_OBJECT(sv), "update_ui", sv);
@@ -1505,17 +1500,17 @@ static const gchar* idocument_get_filename(IAnjutaDocument *editor, GError **e)
return sourceview_io_get_filename (sv->priv->io);
}
-static void
+static void
idocument_cut(IAnjutaDocument* edit, GError** ee)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
-
+
g_signal_handlers_block_by_func (sv->priv->document, on_insert_text, sv);
anjuta_view_cut_clipboard(sv->priv->view);
g_signal_handlers_unblock_by_func (sv->priv->document, on_insert_text, sv);
}
-static void
+static void
idocument_copy(IAnjutaDocument* edit, GError** ee)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
@@ -1524,7 +1519,7 @@ idocument_copy(IAnjutaDocument* edit, GError** ee)
g_signal_handlers_unblock_by_func (sv->priv->document, on_insert_text, sv);
}
-static void
+static void
idocument_paste(IAnjutaDocument* edit, GError** ee)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
@@ -1533,7 +1528,7 @@ idocument_paste(IAnjutaDocument* edit, GError** ee)
g_signal_handlers_unblock_by_func (sv->priv->document, on_insert_text, sv);
}
-static void
+static void
idocument_clear(IAnjutaDocument* edit, GError** ee)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
@@ -1544,7 +1539,7 @@ idocument_clear(IAnjutaDocument* edit, GError** ee)
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
GtkTextIter cursor;
gtk_text_buffer_get_iter_at_mark(buffer, &cursor, gtk_text_buffer_get_insert(buffer));
-
+
/* Fix #388731 */
gtk_text_iter_forward_char(&cursor);
gtk_text_buffer_backspace(buffer, &cursor, TRUE, TRUE);
@@ -1589,7 +1584,7 @@ set_select(Sourceview* sv, GtkTextIter* start_iter, GtkTextIter* end_iter, gbool
static gboolean find_open_bracket(GtkTextIter *iter)
{
int level = 1;
-
+
while (gtk_text_iter_backward_char (iter))
{
switch (gtk_text_iter_get_char (iter))
@@ -1603,7 +1598,7 @@ static gboolean find_open_bracket(GtkTextIter *iter)
break;
}
}
-
+
return FALSE;
}
@@ -1611,30 +1606,30 @@ static gboolean find_open_bracket(GtkTextIter *iter)
static gboolean find_close_bracket(GtkTextIter *iter)
{
int level = 1;
-
+
while (gtk_text_iter_forward_char (iter))
{
switch (gtk_text_iter_get_char (iter))
{
case '{':
++level;
- break;
+ break;
case '}':
if (!--level)
return TRUE;
break;
}
}
-
+
return FALSE;
}
-static void
+static void
iselect_block(IAnjutaEditorSelection* edit, GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(sv->priv->document);
-
+
GtkTextIter iter;
gtk_text_buffer_get_iter_at_mark (buffer, &iter,
gtk_text_buffer_get_insert(buffer));
@@ -1653,7 +1648,7 @@ iselect_block(IAnjutaEditorSelection* edit, GError** e)
}
static void
-iselect_set (IAnjutaEditorSelection* edit,
+iselect_set (IAnjutaEditorSelection* edit,
IAnjutaIterable* istart,
IAnjutaIterable* iend,
gboolean scroll,
@@ -1668,11 +1663,11 @@ iselect_set (IAnjutaEditorSelection* edit,
&end,
scroll);
}
-
+
static void
iselect_all(IAnjutaEditorSelection* edit, GError** e)
-{
+{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
anjuta_view_select_all(sv->priv->view);
}
@@ -1681,7 +1676,7 @@ static gboolean
iselect_has_selection (IAnjutaEditorSelection *editor, GError **e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
-
+
return gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER(sv->priv->document));
}
@@ -1692,7 +1687,7 @@ static gchar* iselect_get(IAnjutaEditorSelection* editor, GError **e)
GtkTextIter start_iter;
GtkTextIter end_iter;
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
-
+
if (gtk_text_buffer_get_selection_bounds(GTK_TEXT_BUFFER(sv->priv->document),
&start_iter, &end_iter))
{
@@ -1701,7 +1696,7 @@ static gchar* iselect_get(IAnjutaEditorSelection* editor, GError **e)
}
else
return NULL;
-
+
}
static IAnjutaIterable*
@@ -1737,7 +1732,7 @@ static void iselect_function(IAnjutaEditorSelection *editor, GError **e)
}
/* If text is selected, replace with given text */
-static void iselect_replace(IAnjutaEditorSelection* editor,
+static void iselect_replace(IAnjutaEditorSelection* editor,
const gchar* text, gint length, GError **e)
{
GtkTextIter start_iter;
@@ -1745,17 +1740,17 @@ static void iselect_replace(IAnjutaEditorSelection* editor,
GtkTextIter iter;
Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
gint position;
-
+
if (gtk_text_buffer_get_selection_bounds(GTK_TEXT_BUFFER(sv->priv->document),
&start_iter, &end_iter))
{
position = gtk_text_iter_get_offset(&start_iter);
gtk_text_buffer_delete_selection(GTK_TEXT_BUFFER(sv->priv->document),
- FALSE, TRUE);
+ FALSE, TRUE);
gtk_text_buffer_get_iter_at_offset(GTK_TEXT_BUFFER(sv->priv->document),
- &iter, position);
+ &iter, position);
gtk_text_buffer_insert(GTK_TEXT_BUFFER(sv->priv->document),
- &iter, text, length);
+ &iter, text, length);
}
}
@@ -1804,7 +1799,7 @@ iconvert_to_lower(IAnjutaEditorConvert* edit, IAnjutaIterable *start_position,
GtkTextIter start, end;
sourceview_cell_get_iter (SOURCEVIEW_CELL (end_position), &end);
sourceview_cell_get_iter (SOURCEVIEW_CELL (start_position), &start);
-
+
gchar* text_buffer = gtk_text_buffer_get_text (buffer,
&start, &end, TRUE);
gtk_text_buffer_begin_user_action (buffer);
@@ -1844,27 +1839,27 @@ static gboolean mark_real (gpointer data)
gchar* tooltip = svmark->tooltip;
IAnjutaMarkableMarker marker = svmark->marker;
gchar* name;
-
+
if (sv->priv->loading)
{
/* Wait until loading is finished */
return TRUE;
}
-
+
gtk_text_buffer_get_iter_at_line(GTK_TEXT_BUFFER(sv->priv->document),
&iter, LOCATION_TO_LINE (location));
-
+
category = marker_types[marker];
name = CREATE_MARK_NAME (marker_count);
-
-
- source_mark = gtk_source_buffer_create_source_mark(GTK_SOURCE_BUFFER(sv->priv->document),
+
+
+ source_mark = gtk_source_buffer_create_source_mark(GTK_SOURCE_BUFFER(sv->priv->document),
name, category, &iter);
g_object_set_data_full (G_OBJECT (source_mark), MARKER_TOOLTIP_DATA, tooltip,
(GDestroyNotify) g_free);
-
+
g_source_remove (svmark->source);
-
+
g_free (name);
g_slice_free (SVMark, svmark);
return FALSE;
@@ -1883,21 +1878,21 @@ imark_mark(IAnjutaMarkable* mark, gint location, IAnjutaMarkableMarker marker,
"Invalid marker location: %d!", location);
return -1;
}
-
+
static gint marker_count = 0;
-
+
marker_count++;
-
+
svmark->sv = sv;
svmark->location = location;
svmark->handle = marker_count;
svmark->marker = marker;
svmark->tooltip = tooltip ? g_strdup (tooltip) : NULL;
svmark->source = g_idle_add (mark_real, svmark);
-
+
sv->priv->idle_sources = g_slist_prepend (sv->priv->idle_sources,
GUINT_TO_POINTER (svmark->source));
-
+
return marker_count;
}
@@ -1909,29 +1904,29 @@ imark_unmark(IAnjutaMarkable* mark, gint location, IAnjutaMarkableMarker marker,
GtkSourceBuffer* buffer = GTK_SOURCE_BUFFER(sv->priv->document);
GtkTextIter begin;
GtkTextIter end;
-
+
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buffer), &begin, LOCATION_TO_LINE (location));
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buffer), &end, LOCATION_TO_LINE (location));
-
+
gtk_source_buffer_remove_source_marks (buffer, &begin, &end, marker_types[marker]);
-
+
}
static gboolean
-imark_is_marker_set(IAnjutaMarkable* mark, gint location,
+imark_is_marker_set(IAnjutaMarkable* mark, gint location,
IAnjutaMarkableMarker marker, GError **e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(mark);
GtkSourceBuffer* buffer = GTK_SOURCE_BUFFER(sv->priv->document);
GSList* markers;
gboolean retval;
-
- markers = gtk_source_buffer_get_source_marks_at_line (buffer,
- LOCATION_TO_LINE (location),
- marker_types[marker]);
-
+
+ markers = gtk_source_buffer_get_source_marks_at_line (buffer,
+ LOCATION_TO_LINE (location),
+ marker_types[marker]);
+
retval = (markers != NULL);
-
+
g_slist_free (markers);
return retval;
}
@@ -1945,7 +1940,7 @@ imark_location_from_handle(IAnjutaMarkable* imark, gint handle, GError **e)
GtkTextIter iter;
gint location;
gchar* name = CREATE_MARK_NAME (handle);
-
+
mark = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (buffer), name);
if (mark)
{
@@ -1954,9 +1949,9 @@ imark_location_from_handle(IAnjutaMarkable* imark, gint handle, GError **e)
}
else
location = -1;
-
+
g_free (name);
-
+
return location;
}
@@ -1968,10 +1963,10 @@ imark_delete_all_markers(IAnjutaMarkable* imark, IAnjutaMarkableMarker marker,
GtkSourceBuffer* buffer = GTK_SOURCE_BUFFER(sv->priv->document);
GtkTextIter begin;
GtkTextIter end;
-
+
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &begin, 0);
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &end, -1);
-
+
gtk_source_buffer_remove_source_marks (buffer, &begin, &end, marker_types[marker]);
}
@@ -1993,10 +1988,10 @@ iindic_clear (IAnjutaIndicable *indic, GError **e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(indic);
GtkTextIter start, end;
-
- gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER(sv->priv->document),
+
+ gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER(sv->priv->document),
&start, 0);
- gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER(sv->priv->document),
+ gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER(sv->priv->document),
&end, -1);
gtk_text_buffer_remove_tag_by_name (GTK_TEXT_BUFFER(sv->priv->document),
IMPORTANT_INDIC,
@@ -2010,16 +2005,16 @@ iindic_clear (IAnjutaIndicable *indic, GError **e)
}
static void
-iindic_set (IAnjutaIndicable *indic, IAnjutaIterable* ibegin, IAnjutaIterable *iend,
+iindic_set (IAnjutaIndicable *indic, IAnjutaIterable* ibegin, IAnjutaIterable *iend,
IAnjutaIndicableIndicator indicator, GError **e)
{
GtkTextTag *tag = NULL;
Sourceview* sv = ANJUTA_SOURCEVIEW(indic);
GtkTextIter start, end;
-
+
switch (indicator)
{
- case IANJUTA_INDICABLE_IMPORTANT :
+ case IANJUTA_INDICABLE_IMPORTANT :
tag = sv->priv->important_indic;
break;
case IANJUTA_INDICABLE_WARNING :
@@ -2033,7 +2028,7 @@ iindic_set (IAnjutaIndicable *indic, IAnjutaIterable* ibegin, IAnjutaIterable *i
}
sourceview_cell_get_iter (SOURCEVIEW_CELL (ibegin), &start);
sourceview_cell_get_iter (SOURCEVIEW_CELL (iend), &end);
- gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER(sv->priv->document), tag,
+ gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER(sv->priv->document), tag,
&start,
&end);
}
@@ -2075,11 +2070,11 @@ ilanguage_get_supported_languages (IAnjutaEditorLanguage *ilanguage,
static GList* languages = NULL;
if (!languages)
{
- const gchar* const * langs = gtk_source_language_manager_get_language_ids (gtk_source_language_manager_get_default());
+ const gchar* const * langs = gtk_source_language_manager_get_language_ids (gtk_source_language_manager_get_default());
if (langs)
{
const gchar* const * lang;
-
+
for (lang = langs; *lang != NULL; lang++)
{
languages = g_list_append (languages, (gpointer)*lang);
@@ -2092,7 +2087,7 @@ ilanguage_get_supported_languages (IAnjutaEditorLanguage *ilanguage,
static const gchar*
ilanguage_get_language_name (IAnjutaEditorLanguage *ilanguage,
const gchar *language, GError **err)
-{
+{
return language;
}
@@ -2100,26 +2095,25 @@ static const gchar*
autodetect_language (Sourceview* sv)
{
gchar* io_mime_type = sourceview_io_get_mime_type (sv->priv->io);
- gchar* filename = sourceview_io_get_filename (sv->priv->io);
+ const gchar* filename = sourceview_io_get_filename (sv->priv->io);
GtkSourceLanguage *language;
const gchar* detected_language = NULL;
-
+
language = gtk_source_language_manager_guess_language (gtk_source_language_manager_get_default (), filename, io_mime_type);
if (!language)
{
goto out;
}
-
- detected_language = gtk_source_language_get_id (language);
-
+
+ detected_language = gtk_source_language_get_id (language);
+
g_signal_emit_by_name (sv, "language-changed", detected_language);
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (sv->priv->document), language);
-
+
out:
if (io_mime_type)
g_free (io_mime_type);
- g_free (filename);
-
+
return detected_language;
}
@@ -2133,14 +2127,14 @@ ilanguage_set_language (IAnjutaEditorLanguage *ilanguage,
const GList* cur_lang;
for (cur_lang = languages; cur_lang != NULL && language != NULL; cur_lang = g_list_next (cur_lang))
{
- GtkSourceLanguage* source_language =
+ GtkSourceLanguage* source_language =
gtk_source_language_manager_get_language (gtk_source_language_manager_get_default(),
cur_lang->data);
const gchar* id = gtk_source_language_get_id (source_language);
-
+
if (g_str_equal (language, id))
{
- g_signal_emit_by_name (G_OBJECT(sv), "language-changed",
+ g_signal_emit_by_name (G_OBJECT(sv), "language-changed",
id);
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (sv->priv->document),
source_language);
@@ -2180,7 +2174,7 @@ ilanguage_iface_init (IAnjutaEditorLanguageIface *iface)
iface->set_language = ilanguage_set_language;
}
-static void
+static void
itips_show (IAnjutaEditorTip *iassist, GList* tips, IAnjutaIterable* ipos,
GError **err)
{
@@ -2188,14 +2182,14 @@ itips_show (IAnjutaEditorTip *iassist, GList* tips, IAnjutaIterable* ipos,
SourceviewCell* cell = SOURCEVIEW_CELL (ipos);
GtkTextIter iter;
sourceview_cell_get_iter(cell, &iter);
-
+
g_return_if_fail (tips != NULL);
-
+
if (!sv->priv->assist_tip)
{
- sv->priv->assist_tip =
+ sv->priv->assist_tip =
ASSIST_TIP (assist_tip_new (GTK_TEXT_VIEW (sv->priv->view), tips));
-
+
g_object_weak_ref (G_OBJECT(sv->priv->assist_tip),
(GWeakNotify) on_assist_tip_destroyed,
sv);
@@ -2233,36 +2227,36 @@ itip_iface_init(IAnjutaEditorTipIface* iface)
}
static void
-iassist_add(IAnjutaEditorAssist* iassist,
+iassist_add(IAnjutaEditorAssist* iassist,
IAnjutaProvider* provider,
GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(iassist);
GtkSourceCompletion* completion = gtk_source_view_get_completion(GTK_SOURCE_VIEW(sv->priv->view));
- gtk_source_completion_add_provider(completion,
+ gtk_source_completion_add_provider(completion,
GTK_SOURCE_COMPLETION_PROVIDER(sourceview_provider_new(sv, provider)),
NULL);
DEBUG_PRINT("Adding provider: %s", ianjuta_provider_get_name(provider, NULL));
}
static void
-iassist_remove(IAnjutaEditorAssist* iassist,
+iassist_remove(IAnjutaEditorAssist* iassist,
IAnjutaProvider* provider,
GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(iassist);
GtkSourceCompletion* completion = gtk_source_view_get_completion(GTK_SOURCE_VIEW(sv->priv->view));
- GList* node;
+ GList* node;
for (node = gtk_source_completion_get_providers(completion); node != NULL; node = g_list_next(node))
{
- SourceviewProvider* prov;
+ SourceviewProvider* prov;
if (!SOURCEVIEW_IS_PROVIDER(node->data))
continue;
prov = SOURCEVIEW_PROVIDER(node->data);
if (prov->iprov == provider)
{
DEBUG_PRINT("Removing provider: %s", ianjuta_provider_get_name(provider, NULL));
- gtk_source_completion_remove_provider(completion,
+ gtk_source_completion_remove_provider(completion,
GTK_SOURCE_COMPLETION_PROVIDER(prov),
NULL);
}
@@ -2270,7 +2264,7 @@ iassist_remove(IAnjutaEditorAssist* iassist,
}
static void
-iassist_invoke(IAnjutaEditorAssist* iassist,
+iassist_invoke(IAnjutaEditorAssist* iassist,
IAnjutaProvider* provider,
GError** e)
{
@@ -2281,7 +2275,7 @@ iassist_invoke(IAnjutaEditorAssist* iassist,
GList* providers = NULL;
GtkTextIter iter;
GtkSourceCompletionContext* context;
-
+
for (node = gtk_source_completion_get_providers(completion); node != NULL; node = g_list_next(node))
{
if (provider == NULL)
@@ -2296,12 +2290,12 @@ iassist_invoke(IAnjutaEditorAssist* iassist,
{
providers = g_list_append (providers, prov);
}
-
+
}
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (sv->priv->document),
&iter,
gtk_text_buffer_get_insert(GTK_TEXT_BUFFER(sv->priv->document)));
- context =
+ context =
gtk_source_completion_create_context(completion, &iter);
gtk_source_completion_show(completion, providers, context);
@@ -2309,7 +2303,7 @@ iassist_invoke(IAnjutaEditorAssist* iassist,
}
static void
-iassist_proposals(IAnjutaEditorAssist* iassist,
+iassist_proposals(IAnjutaEditorAssist* iassist,
IAnjutaProvider* provider,
GList* proposals,
gboolean finished,
@@ -2323,7 +2317,7 @@ iassist_proposals(IAnjutaEditorAssist* iassist,
SourceviewProvider* prov;
if (!SOURCEVIEW_IS_PROVIDER (node->data))
continue;
-
+
prov = SOURCEVIEW_PROVIDER(node->data);
if (prov->iprov == provider)
{
@@ -2358,7 +2352,7 @@ iassist_proposals(IAnjutaEditorAssist* iassist,
}
}
}
-
+
static void iassist_iface_init(IAnjutaEditorAssistIface* iface)
{
iface->add = iassist_add;
@@ -2372,34 +2366,34 @@ static gboolean
isearch_forward (IAnjutaEditorSearch* isearch,
const gchar* search,
gboolean case_sensitive,
- IAnjutaEditorCell* istart,
+ IAnjutaEditorCell* istart,
IAnjutaEditorCell* iend,
IAnjutaEditorCell** iresult_start,
IAnjutaEditorCell** iresult_end,
GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW (isearch);
-
+
SourceviewCell* start = SOURCEVIEW_CELL (istart);
SourceviewCell* end = SOURCEVIEW_CELL (iend);
-
+
GtkTextIter start_iter;
GtkTextIter end_iter;
-
+
GtkTextIter result_start, result_end;
-
+
GtkTextSearchFlags flags = 0;
sourceview_cell_get_iter (start, &start_iter);
sourceview_cell_get_iter (end, &end_iter);
-
+
if (!case_sensitive)
{
flags = GTK_TEXT_SEARCH_CASE_INSENSITIVE;
}
-
- gboolean result =
+
+ gboolean result =
gtk_text_iter_forward_search (&start_iter, search, flags, &result_start, &result_end,
&end_iter);
@@ -2413,10 +2407,10 @@ isearch_forward (IAnjutaEditorSearch* isearch,
if (iresult_end)
{
*iresult_end = IANJUTA_EDITOR_CELL (sourceview_cell_new (&result_end,
- GTK_TEXT_VIEW (sv->priv->view)));
+ GTK_TEXT_VIEW (sv->priv->view)));
}
}
-
+
return result;
}
@@ -2424,33 +2418,33 @@ static gboolean
isearch_backward (IAnjutaEditorSearch* isearch,
const gchar* search,
gboolean case_sensitive,
- IAnjutaEditorCell* istart,
+ IAnjutaEditorCell* istart,
IAnjutaEditorCell* iend,
IAnjutaEditorCell** iresult_start,
IAnjutaEditorCell** iresult_end,
GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW (isearch);
-
+
SourceviewCell* start = SOURCEVIEW_CELL (istart);
SourceviewCell* end = SOURCEVIEW_CELL (iend);
-
+
GtkTextIter start_iter;
- GtkTextIter end_iter;
+ GtkTextIter end_iter;
GtkTextIter result_start, result_end;
-
+
GtkTextSearchFlags flags = 0;
-
+
sourceview_cell_get_iter (start, &start_iter);
sourceview_cell_get_iter (end, &end_iter);
-
+
if (!case_sensitive)
{
flags = GTK_TEXT_SEARCH_CASE_INSENSITIVE;
}
-
- gboolean result =
+
+ gboolean result =
gtk_text_iter_backward_search (&start_iter, search, flags, &result_start, &result_end,
&end_iter);
@@ -2464,10 +2458,10 @@ isearch_backward (IAnjutaEditorSearch* isearch,
if (iresult_end)
{
*iresult_end = IANJUTA_EDITOR_CELL (sourceview_cell_new (&result_end,
- GTK_TEXT_VIEW (sv->priv->view)));
+ GTK_TEXT_VIEW (sv->priv->view)));
}
}
-
+
return result;
}
@@ -2484,7 +2478,7 @@ static void
on_sourceview_hover_leave(gpointer data, GObject* where_the_data_was)
{
Sourceview* sv = ANJUTA_SOURCEVIEW (data);
-
+
if (sv->priv->tooltip_cell)
{
g_signal_emit_by_name (G_OBJECT (sv), "hover-leave", sv->priv->tooltip_cell);
@@ -2501,7 +2495,7 @@ on_sourceview_hover_destroy (gpointer data, GObject* where_the_data_was)
}
-static gboolean
+static gboolean
on_sourceview_hover_over (GtkWidget *widget, gint x, gint y,
gboolean keyboard_tip, GtkTooltip *tooltip,
gpointer data)
@@ -2511,16 +2505,16 @@ on_sourceview_hover_over (GtkWidget *widget, gint x, gint y,
GtkTextIter iter;
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
gint bx, by;
-
+
gtk_text_view_window_to_buffer_coords (text_view, GTK_TEXT_WINDOW_WIDGET,
x, y, &bx, &by);
gtk_text_view_get_iter_at_location (text_view, &iter, bx, by);
-
+
cell = sourceview_cell_new (&iter, text_view);
-
+
/* This should call ianjuta_hover_display() */
g_signal_emit_by_name (G_OBJECT (sv), "hover-over", cell);
-
+
if (sv->priv->tooltip)
{
gtk_tooltip_set_text (tooltip, sv->priv->tooltip);
@@ -2531,8 +2525,8 @@ on_sourceview_hover_over (GtkWidget *widget, gint x, gint y,
sv->priv->tooltip_cell = cell;
return TRUE;
}
-
- return FALSE;
+
+ return FALSE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]