[anjuta-extras] scintilla: Fix compiler warnings



commit 764c85e811e97f6fd27e0b7c70786c80def484d1
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Mon Jan 7 21:32:06 2013 +0100

    scintilla: Fix compiler warnings

 plugins/scintilla/aneditor.cxx           |   21 ++++++++-------------
 plugins/scintilla/print.c                |    6 ------
 plugins/scintilla/style-editor.c         |   10 +---------
 plugins/scintilla/text-editor-iterable.c |    2 --
 plugins/scintilla/text_editor.c          |   16 +++++++++++++---
 plugins/scintilla/text_editor.h          |    4 ++--
 6 files changed, 24 insertions(+), 35 deletions(-)
---
diff --git a/plugins/scintilla/aneditor.cxx b/plugins/scintilla/aneditor.cxx
index 8e956ad..0fa9acc 100644
--- a/plugins/scintilla/aneditor.cxx
+++ b/plugins/scintilla/aneditor.cxx
@@ -797,7 +797,6 @@ bool AnEditor::GetCurrentWord(char* buffer, int length) {
 
 bool AnEditor::StartBlockComment() {
 	SString fileNameForExtension = ExtensionFileName();
-	SString language = props->GetNewExpand("lexer.", fileNameForExtension.c_str());
 	SString base("comment.block.");
 	SString comment_at_line_start("comment.block.at.line.start.");
 	base += language;
@@ -891,7 +890,6 @@ bool AnEditor::StartBlockComment() {
 //
 bool AnEditor::CanBeCommented(bool box_stream) {
 	SString fileNameForExtension = ExtensionFileName();
-	SString language = props->GetNewExpand("lexer.", fileNameForExtension.c_str());
 	SString start_base("comment.box.start.");
 	SString middle_base("comment.box.middle.");
 	SString end_base("comment.box.end.");
@@ -952,15 +950,15 @@ bool AnEditor::CanBeCommented(bool box_stream) {
 
 		for (index = lineEnd1-lineStart1; index >= 0; index--)
 		{
-			if (end1= ((end_comment_length > 1 && !memcmp(linebuf+index,
+			if ((end1= ((end_comment_length > 1 && !memcmp(linebuf+index,
 				end_comment.c_str(), end_comment_length ))
 			    || (end_comment_stream_length > 0 && !memcmp(linebuf+index,
-			    end_comment_stream.c_str(), end_comment_stream_length))))
+			    end_comment_stream.c_str(), end_comment_stream_length)))))
 				break;
-			if (start1=((start_comment_length > 1 && !memcmp(linebuf+index,
+			if ((start1=((start_comment_length > 1 && !memcmp(linebuf+index,
 				start_comment.c_str(), start_comment_length))
 				|| (start_comment_stream_length > 0 && !memcmp(linebuf+index,
-			    start_comment_stream.c_str(), start_comment_stream_length))))
+			    start_comment_stream.c_str(), start_comment_stream_length)))))
 				break;
 		}
 		line --;
@@ -980,15 +978,15 @@ bool AnEditor::CanBeCommented(bool box_stream) {
 		GetRange(wEditor, lineStart1, lineEnd1, linebuf);
 		for (index = 0; index <= (lineEnd1-lineStart1); index++)
 		{
-			if (start2= ((start_comment_length > 1 && !memcmp(linebuf+index,
+			if ((start2= ((start_comment_length > 1 && !memcmp(linebuf+index,
 				start_comment.c_str(), start_comment_length))
 				|| (start_comment_stream_length > 0 && !memcmp(linebuf+index,
-			    start_comment_stream.c_str(), start_comment_stream_length))))
+			    start_comment_stream.c_str(), start_comment_stream_length)))))
 				break;
-			if (end2= ((end_comment_length > 1 && !memcmp(linebuf+index,
+			if ((end2= ((end_comment_length > 1 && !memcmp(linebuf+index,
 				end_comment.c_str(), end_comment_length ))
 				|| (end_comment_stream_length > 0 && !memcmp(linebuf+index,
-			    end_comment_stream.c_str(), end_comment_stream_length))))
+			    end_comment_stream.c_str(), end_comment_stream_length)))))
 				break;
 		}
 		line ++;
@@ -1043,7 +1041,6 @@ bool AnEditor::CanBeCommented(bool box_stream) {
 
 bool AnEditor::StartBoxComment() {
 	SString fileNameForExtension = ExtensionFileName();
-	SString language = props->GetNewExpand("lexer.", fileNameForExtension.c_str());
 	SString start_base("comment.box.start.");
 	SString middle_base("comment.box.middle.");
 	SString end_base("comment.box.end.");
@@ -1125,7 +1122,6 @@ bool AnEditor::StartBoxComment() {
 
 bool AnEditor::StartStreamComment() {
 	SString fileNameForExtension = ExtensionFileName();
-	SString language = props->GetNewExpand("lexer.", fileNameForExtension.c_str());
 	SString start_base("comment.stream.start.");
 	SString end_base("comment.stream.end.");
 	SString white_space(" ");
@@ -1228,7 +1224,6 @@ bool AnEditor::InsertCustomIndent() {
 	#define MAXBUF 1000
 
 	SString fileNameForExtension = ExtensionFileName();
-	SString language = props->GetNewExpand("lexer.", fileNameForExtension.c_str());
 	SString start_box_base("comment.box.start.");
 	start_box_base += language;
 	SString start_stream_base("comment.stream.start.");
diff --git a/plugins/scintilla/print.c b/plugins/scintilla/print.c
index 5705109..ba4c260 100644
--- a/plugins/scintilla/print.c
+++ b/plugins/scintilla/print.c
@@ -183,7 +183,6 @@ static void
 anjuta_print_job_info_style_load_font (PrintJobInfoStyle *pis)
 {
 	gchar *font_desc, *tmp;
-	gint size = 12;
 
 	g_return_if_fail (pis->font_name);
 
@@ -191,7 +190,6 @@ anjuta_print_job_info_style_load_font (PrintJobInfoStyle *pis)
 	font_desc = g_strdup (pis->font_name);
 	if (pis->size > 0)
 	{
-		size = pis->size;
 		tmp = font_desc;
 		font_desc = g_strdup_printf ("%s %d", tmp, pis->size);
 		g_free (tmp);
@@ -705,7 +703,6 @@ static void
 anjuta_draw_linenum (PrintJobInfo * pji, cairo_t *cr)
 {
 	gchar *text = g_strdup_printf ("%d", pji->current_line);
-	gdouble baseline;
 	gdouble layout_width;
 	PangoLayoutIter *iter;
 	PangoRectangle rect;
@@ -716,7 +713,6 @@ anjuta_draw_linenum (PrintJobInfo * pji, cairo_t *cr)
 	/* Print line number on right */
 	pango_layout_set_text (pji->line_numbers_layout, text, -1);
 	iter = pango_layout_get_iter (pji->line_numbers_layout);
-	baseline = (gdouble) pango_layout_iter_get_baseline (iter) / (gdouble) PANGO_SCALE;
 	pango_layout_iter_free (iter);
 
 	pango_layout_get_extents (pji->line_numbers_layout, NULL, &rect);
@@ -784,7 +780,6 @@ anjuta_draw_page (GtkPrintOperation        *operation,
 	{
 		PangoRectangle rect;
 		gdouble height;
-		guint start;
 
 		/* Draw line number */
 		if (pji->print_line_numbers)
@@ -793,7 +788,6 @@ anjuta_draw_page (GtkPrintOperation        *operation,
 		}
 
 		/* Layout one line */
-		start = pji->current_pos;
 		anjuta_print_layout_line (pji);
 
 		/* Draw line */
diff --git a/plugins/scintilla/style-editor.c b/plugins/scintilla/style-editor.c
index 57b0b9f..b51a5c9 100644
--- a/plugins/scintilla/style-editor.c
+++ b/plugins/scintilla/style-editor.c
@@ -367,7 +367,7 @@ style_data_destroy (StyleData * sdata)
 	g_free (sdata);
 }
 
-void
+static void
 style_data_parse (StyleData *style_data, gchar * style_string)
 {
 	gchar *val, *opt;
@@ -451,7 +451,6 @@ style_data_parse (StyleData *style_data, gchar * style_string)
 	}
 	if (val)
 		g_free (val);
-	return style_data;
 }
 
 static void
@@ -868,8 +867,6 @@ save_props (StyleEditor *se)
 
 	for (i = 0;; i += 2)
 	{
-		StyleData *sdata;
-
 		if (hilite_style[i] == NULL)
 			break;
 		str = sci_prop_get_expanded (se->props, hilite_style[i + 1]);
@@ -900,8 +897,6 @@ restore_props (StyleEditor *se)
 	str = g_list_first (se->priv->saved_props);
 	for (i = 0;; i += 2)
 	{
-		StyleData *sdata;
-
 		if (hilite_style[i] == NULL)
 			break;
 
@@ -948,9 +943,6 @@ apply_styles (StyleEditor *se)
 static void
 cancel_styles (StyleEditor *se)
 {
-	FILE *ofile;
-	gchar *filename;
-
 	restore_props (se);
 	g_signal_emit_by_name (se->plugin, "style-changed");
 }
diff --git a/plugins/scintilla/text-editor-iterable.c b/plugins/scintilla/text-editor-iterable.c
index 1b8c784..fe7ad6f 100644
--- a/plugins/scintilla/text-editor-iterable.c
+++ b/plugins/scintilla/text-editor-iterable.c
@@ -122,7 +122,6 @@ static void
 cell_style_load_font (CellStyle *pis)
 {
 	gchar *font_desc, *tmp;
-	gint size = 12;
 	
 	g_return_if_fail (pis->font_name);
 	
@@ -141,7 +140,6 @@ cell_style_load_font (CellStyle *pis)
 	}
 	if (pis->size > 0)
 	{
-		size = pis->size;
 		tmp = font_desc;
 		font_desc = g_strdup_printf ("%s %d", tmp, pis->size);
 		g_free (tmp);
diff --git a/plugins/scintilla/text_editor.c b/plugins/scintilla/text_editor.c
index 0717520..b37d0dc 100644
--- a/plugins/scintilla/text_editor.c
+++ b/plugins/scintilla/text_editor.c
@@ -116,7 +116,7 @@ static void text_editor_finalize (GObject *obj);
 static void text_editor_dispose (GObject *obj);
 static void text_editor_hilite_one (TextEditor * te, AnEditorID editor);
 
-static GtkVBoxClass *parent_class;
+static GtkBoxClass *parent_class;
 
 
 static void
@@ -151,6 +151,8 @@ text_editor_instance_init (TextEditor *te)
 	te->docman_settings = g_settings_new (DOCMAN_PREF_SCHEMA);
 	te->msgman_settings = g_settings_new (MSGMAN_PREF_SCHEMA);
 	te->editor_settings = g_settings_new (ANJUTA_PREF_SCHEMA_PREFIX IANJUTA_EDITOR_PREF_SCHEMA);
+
+	gtk_orientable_set_orientation (GTK_ORIENTABLE (te), GTK_ORIENTATION_VERTICAL);
 }
 
 static GtkWidget *
@@ -668,7 +670,7 @@ text_editor_new (AnjutaPlugin *plugin, const gchar *uri, const gchar *name)
 	}
 
 	/* Create primary view */
-	te->vbox = gtk_vbox_new (TRUE, 3);
+	te->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
 	gtk_box_pack_end (GTK_BOX (te), te->vbox, TRUE, TRUE, 0);
 	text_editor_add_view (te);
 
@@ -3400,12 +3402,20 @@ iassist_invoke(IAnjutaEditorAssist* iassist, IAnjutaProvider* provider, GError**
 
 static void
 iassist_proposals(IAnjutaEditorAssist* iassist, IAnjutaProvider* provider,
-    GList* proposals, gboolean finished, GError** err)
+    GList* proposals, const gchar *pre_word, gboolean finished, GError** err)
 {
 	TextEditor *te = TEXT_EDITOR (iassist);
 	GList *node;
 	glong length;
 
+	/* Hide if the only suggetions is exactly the typed word */
+	if (pre_word && proposals && g_list_length (proposals) == 1)
+	{
+		IAnjutaEditorAssistProposal* prop = proposals->data;
+		if (g_str_equal (pre_word, prop->label))
+			proposals = NULL;
+	}
+
 	if (proposals == NULL)
 	{
 		te->completion_count = 0;
diff --git a/plugins/scintilla/text_editor.h b/plugins/scintilla/text_editor.h
index 06b56f2..09ec868 100644
--- a/plugins/scintilla/text_editor.h
+++ b/plugins/scintilla/text_editor.h
@@ -68,7 +68,7 @@ struct _ScintillaCompletion
 
 struct _TextEditor
 {
-	GtkVBox parent;
+	GtkBox parent;
 
 	gchar *filename;
 	gchar *uri;
@@ -140,7 +140,7 @@ struct _TextEditor
 
 struct _TextEditorClass
 {
-	GtkVBoxClass parent_class;
+	GtkBoxClass parent_class;
 };
 
 GType text_editor_get_type (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]