[anjuta] build-basic-autotools: Show error message as tooltip in the editor



commit 45223c95bd104900a9add0be1ad81a1f7df99484
Author: Johannes Schmid <jhs gnome org>
Date:   Wed Nov 24 16:55:38 2010 +0100

    build-basic-autotools: Show error message as tooltip in the editor
    
    Also enable the highlighting in the editor by default - it's a neat feature.

 .../anjuta-build-basic-autotools-plugin.ui         |    4 +-
 plugins/build-basic-autotools/plugin.c             |   30 ++++++++++++--------
 2 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.ui b/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.ui
index 8062aba..8af9c9a 100644
--- a/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.ui
+++ b/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.ui
@@ -254,8 +254,8 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:build-indicators-automatic">
-                        <property name="label" translatable="yes">Highlight message locations in editor</property>
+                      <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:build-indicators-automatic">
+                        <property name="label" translatable="yes">Highlight build warnings and errors in editor</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c
index 4b17f66..6c31ad1 100644
--- a/plugins/build-basic-autotools/plugin.c
+++ b/plugins/build-basic-autotools/plugin.c
@@ -41,6 +41,7 @@
 #include <libanjuta/interfaces/ianjuta-language.h>
 #include <libanjuta/interfaces/ianjuta-file-savable.h>
 #include <libanjuta/interfaces/ianjuta-indicable.h>
+#include <libanjuta/interfaces/ianjuta-markable.h>
 #include <libanjuta/interfaces/ianjuta-preferences.h>
 
 #include "plugin.h"
@@ -112,6 +113,7 @@ typedef struct
 typedef struct
 {
 	gchar *filename;
+	gchar *tooltip;
 	gint line;
 	IAnjutaIndicableIndicator indicator;
 } BuildIndicatorLocation;
@@ -324,12 +326,14 @@ shell_quotef (const gchar *format,...)
 
 static BuildIndicatorLocation*
 build_indicator_location_new (const gchar *filename, gint line,
-							  IAnjutaIndicableIndicator indicator)
+							  IAnjutaIndicableIndicator indicator,
+                              const gchar* tooltip)
 {
 	BuildIndicatorLocation *loc = g_new0 (BuildIndicatorLocation, 1);
 	loc->filename = g_strdup (filename);
 	loc->line = line;
 	loc->indicator = indicator;
+	loc->tooltip = g_strdup (tooltip);
 	return loc;
 }
 
@@ -359,12 +363,20 @@ build_indicator_location_set (BuildIndicatorLocation *loc,
 		g_object_unref (line_start);
 		g_object_unref (line_end);
 	}
+	if (editor && editor_filename &&
+	    IANJUTA_IS_MARKABLE (editor))
+	{
+		ianjuta_markable_mark (IANJUTA_MARKABLE (editor),
+		                       loc->line, IANJUTA_MARKABLE_MESSAGE,
+		                       loc->tooltip, NULL);
+	}
 }
 
 static void
 build_indicator_location_free (BuildIndicatorLocation *loc)
 {
 	g_free (loc->filename);
+	g_free (loc->tooltip);
 	g_free (loc);
 }
 
@@ -981,7 +993,7 @@ on_build_mesg_format (IAnjutaMessageView *view, const gchar *one_line,
 			DEBUG_PRINT ("dummy int: %d", dummy_int);
 			
 			loc = build_indicator_location_new (mid_str, dummy_int,
-												indicator);
+												indicator, line);
 			context->locations = g_slist_prepend (context->locations, loc);
 			
 			/* If current editor file is same as indicator file, set indicator */
@@ -1148,12 +1160,6 @@ on_message_view_destroyed (BuildContext *context, GtkWidget *view)
 	build_context_destroy_view (context);
 }
 
-static gboolean
-g_hashtable_foreach_true (gpointer key, gpointer value, gpointer user_data)
-{
-	return TRUE;
-}
-
 static void
 build_set_animation (IAnjutaMessageManager* mesg_manager, BuildContext* context)
 {
@@ -1270,11 +1276,11 @@ build_get_context_with_message(BasicAutotoolsPlugin *plugin, const gchar *dir)
 	if (IANJUTA_IS_INDICABLE (plugin->current_editor))
 		ianjuta_indicable_clear (IANJUTA_INDICABLE (plugin->current_editor),
 								 NULL);
-	/* This is only since glib 2.12.
+	if (IANJUTA_IS_MARKABLE (plugin->current_editor))
+		ianjuta_markable_delete_all_markers (IANJUTA_MARKABLE (plugin->current_editor),
+		                                     IANJUTA_MARKABLE_MESSAGE, NULL);
 	g_hash_table_remove_all (context->indicators_updated_editors);
-	*/
-	g_hash_table_foreach_remove (context->indicators_updated_editors,
-								 g_hashtable_foreach_true, NULL);
+
 	
 	return context;
 }



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