anjuta r3881 - in trunk: . plugins/search



Author: jhs
Date: Tue Apr 22 11:57:43 2008
New Revision: 3881
URL: http://svn.gnome.org/viewvc/anjuta?rev=3881&view=rev

Log:
2008-04-22  Johannes Schmid  <jhs gnome org>

	* plugins/search/search-replace.c (search_and_replace),
	(on_message_view_destroyed):
	Don\'t spit out two many warnings when the message view is destroyed
	
	* plugins/search/search-replace_backend.c
	(file_buffer_new_from_path):
	Only use first 500 characters for validation

Modified:
   trunk/ChangeLog
   trunk/plugins/search/search-replace.c
   trunk/plugins/search/search-replace_backend.c

Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c	(original)
+++ trunk/plugins/search/search-replace.c	Tue Apr 22 11:57:43 2008
@@ -228,6 +228,7 @@
 static void
 write_message_pane(IAnjutaMessageView* view, FileBuffer *fb, SearchEntry *se, MatchInfo *mi);
 static gboolean on_message_clicked (GObject* object, gchar* message, gpointer data);
+static void on_message_view_destroyed (gpointer unused, GObject* where_the_object_was);
 static void on_message_buffer_flush (IAnjutaMessageView *view, const gchar *one_line, gpointer data);
 static void save_not_opened_files(FileBuffer *fb);
 static gboolean replace_in_not_opened_files(FileBuffer *fb, MatchInfo *mi, gchar *repl_str);
@@ -326,7 +327,6 @@
 		view = ianjuta_message_manager_get_view_by_name(msgman, name, NULL);
 		if (view == NULL)	
 		{
-			// FIXME: Put a nice icon here:
 			view = ianjuta_message_manager_add_view(msgman, name,
 													GTK_STOCK_FIND_AND_REPLACE, NULL);	
 			g_return_if_fail(view != NULL);
@@ -334,6 +334,7 @@
 			                  G_CALLBACK (on_message_buffer_flush), NULL);
 			g_signal_connect (G_OBJECT(view), "message_clicked",
 			                  G_CALLBACK (on_message_clicked), NULL);
+			g_object_weak_ref (G_OBJECT(view), on_message_view_destroyed, NULL);
 		}
 		else
 			ianjuta_message_view_clear(view, NULL);
@@ -674,6 +675,12 @@
 }
 
 static void
+on_message_view_destroyed (gpointer unused, GObject* where_the_object_was)
+{
+	end_activity = TRUE;
+}
+
+static void
 on_message_buffer_flush (IAnjutaMessageView *view, const gchar *one_line,
 						 gpointer data)
 {

Modified: trunk/plugins/search/search-replace_backend.c
==============================================================================
--- trunk/plugins/search/search-replace_backend.c	(original)
+++ trunk/plugins/search/search-replace_backend.c	Tue Apr 22 11:57:43 2008
@@ -145,6 +145,9 @@
 	return fb;
 }
 
+/* Only use the first 500 chars for validating (yes, I feel lucky...) */
+#define MAX_VALIDATE 500
+
 FileBuffer *
 file_buffer_new_from_path (const char *path, const char *buf, int len, int pos)
 {
@@ -219,7 +222,7 @@
 			}
 		}
 	}
-	if (!g_utf8_validate (fb->buf, fb->len, NULL))
+	if (!g_utf8_validate (fb->buf, MIN(MAX_VALIDATE, fb->len), NULL))
 	{
 		const AnjutaEncoding *encoding_used = NULL;
 		gchar* converted_text;



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