anjuta r4240 - in trunk: . plugins/sourceview
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4240 - in trunk: . plugins/sourceview
- Date: Wed, 10 Sep 2008 12:57:01 +0000 (UTC)
Author: jhs
Date: Wed Sep 10 12:57:01 2008
New Revision: 4240
URL: http://svn.gnome.org/viewvc/anjuta?rev=4240&view=rev
Log:
2008-09-10 Johannes Schmid <jhs gnome org>
* plugins/sourceview/sourceview-io.c (sourceview_io_init),
(on_read_finished):
* plugins/sourceview/sourceview-io.h:
Fixed a problem with async file loading. (Remember never to use
static variables in method that could be used by different objects...)
* plugins/sourceview/sourceview.c (on_open_failed),
(on_save_failed):
Fixed some (new) warnings
Modified:
trunk/ChangeLog
trunk/plugins/sourceview/sourceview-io.c
trunk/plugins/sourceview/sourceview-io.h
trunk/plugins/sourceview/sourceview.c
Modified: trunk/plugins/sourceview/sourceview-io.c
==============================================================================
--- trunk/plugins/sourceview/sourceview-io.c (original)
+++ trunk/plugins/sourceview/sourceview-io.c Wed Sep 10 12:57:01 2008
@@ -55,6 +55,7 @@
object->cancel = g_cancellable_new();
object->monitor = NULL;
object->last_encoding = NULL;
+ object->bytes_read = 0;
}
static void
@@ -392,7 +393,6 @@
{
SourceviewIO* sio = SOURCEVIEW_IO(data);
GInputStream* input_stream = G_INPUT_STREAM(input);
- static gsize bytes_read = 0;
gsize current_bytes = 0;
GError* err = NULL;
@@ -403,16 +403,17 @@
g_error_free (err);
g_object_unref (input_stream);
g_free (sio->read_buffer);
- sio->read_buffer = 0;
+ sio->read_buffer = NULL;
+ sio->bytes_read = 0;
return;
}
- bytes_read += current_bytes;
- if (current_bytes > 0)
+ sio->bytes_read += current_bytes;
+ if (current_bytes != 0)
{
- sio->read_buffer = g_realloc (sio->read_buffer, bytes_read + READ_SIZE);
+ sio->read_buffer = g_realloc (sio->read_buffer, sio->bytes_read + READ_SIZE);
g_input_stream_read_async (G_INPUT_STREAM (input_stream),
- sio->read_buffer + bytes_read,
+ sio->read_buffer + sio->bytes_read,
READ_SIZE,
G_PRIORITY_LOW,
sio->cancel,
@@ -422,9 +423,9 @@
}
else
{
- if (append_buffer (sio, bytes_read))
+ if (append_buffer (sio, sio->bytes_read))
g_signal_emit_by_name (sio, "open-finished");
- bytes_read = 0;
+ sio->bytes_read = 0;
g_object_unref (input_stream);
setup_monitor (sio);
g_free (sio->read_buffer);
Modified: trunk/plugins/sourceview/sourceview-io.h
==============================================================================
--- trunk/plugins/sourceview/sourceview-io.h (original)
+++ trunk/plugins/sourceview/sourceview-io.h Wed Sep 10 12:57:01 2008
@@ -61,6 +61,7 @@
GCancellable* cancel;
GFileMonitor* monitor;
guint monitor_idle;
+ gssize bytes_read;
const AnjutaEncoding* last_encoding;
};
Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c (original)
+++ trunk/plugins/sourceview/sourceview.c Wed Sep 10 12:57:01 2008
@@ -364,7 +364,7 @@
GtkWidget* dialog = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
- message);
+ "%s", message);
g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_dialog_run (GTK_DIALOG (dialog));
}
@@ -484,7 +484,7 @@
GtkWidget* dialog = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
- message);
+ "%s", message);
g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_dialog_run (GTK_DIALOG (dialog));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]