anjuta r4145 - in trunk: . plugins/message-view plugins/sourceview
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4145 - in trunk: . plugins/message-view plugins/sourceview
- Date: Sat, 16 Aug 2008 10:06:32 +0000 (UTC)
Author: jhs
Date: Sat Aug 16 10:06:32 2008
New Revision: 4145
URL: http://svn.gnome.org/viewvc/anjuta?rev=4145&view=rev
Log:
2008-08-16 Johannes Schmid <jhs gnome org>
* plugins/message-view/plugin.c (activate_plugin),
(ianjuta_msgman_add_view):
Do not show an empty message pane on startup but create the widget on demand.
* plugins/sourceview/sourceview-io.c:
Only convert the full text because it could break otherwise with utf-8
Modified:
trunk/ChangeLog
trunk/plugins/message-view/plugin.c
trunk/plugins/sourceview/sourceview-io.c
Modified: trunk/plugins/message-view/plugin.c
==============================================================================
--- trunk/plugins/message-view/plugin.c (original)
+++ trunk/plugins/message-view/plugin.c Sat Aug 16 10:06:32 2008
@@ -211,10 +211,6 @@
g_object_set (G_OBJECT (action_next), "sensitive", FALSE, NULL);
g_object_set (G_OBJECT (action_prev), "sensitive", FALSE, NULL);
- anjuta_shell_add_widget (plugin->shell, mv_plugin->msgman,
- "AnjutaMessageView", _("Messages"),
- "message-manager-plugin-icon",
- ANJUTA_SHELL_PLACEMENT_BOTTOM, NULL);
#if 0
/* Connect to save and load session */
g_signal_connect (G_OBJECT (plugin->shell), "save-session",
@@ -303,6 +299,13 @@
MessageView* message_view;
AnjutaShell* shell = ANJUTA_PLUGIN(plugin)->shell;
GtkWidget *msgman = ANJUTA_PLUGIN_MESSAGE_VIEW (plugin)->msgman;
+ if (g_list_length (anjuta_msgman_get_all_views(ANJUTA_MSGMAN(msgman))) == 0)
+ {
+ anjuta_shell_add_widget (shell, msgman,
+ "AnjutaMessageView", _("Messages"),
+ "message-manager-plugin-icon",
+ ANJUTA_SHELL_PLACEMENT_BOTTOM, NULL);
+ }
anjuta_shell_present_widget(shell, msgman, NULL);
message_view = anjuta_msgman_add_view (ANJUTA_MSGMAN (msgman), file, icon);
return IANJUTA_MESSAGE_VIEW (message_view);
Modified: trunk/plugins/sourceview/sourceview-io.c
==============================================================================
--- trunk/plugins/sourceview/sourceview-io.c (original)
+++ trunk/plugins/sourceview/sourceview-io.c Sat Aug 16 10:06:32 2008
@@ -340,7 +340,7 @@
gtk_source_buffer_end_not_undoable_action (document);
}
-static void
+static gboolean
append_buffer (SourceviewIO* sio, gsize size)
{
/* Text is utf-8 - good */
@@ -374,17 +374,18 @@
}
if (converted_text == NULL)
{
- g_return_if_fail (conv_error != 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);
- return;
+ return FALSE;
}
sio->last_encoding = enc;
insert_text_in_document (sio, converted_text, new_len);
g_free (converted_text);
}
+ return TRUE;
}
static void
@@ -392,22 +393,26 @@
{
SourceviewIO* sio = SOURCEVIEW_IO(data);
GInputStream* input_stream = G_INPUT_STREAM(input);
- gsize bytes_read;
+ static gsize bytes_read = 0;
+ gsize current_bytes = 0;
GError* err = NULL;
- bytes_read = g_input_stream_read_finish (input_stream, result, &err);
+ current_bytes = g_input_stream_read_finish (input_stream, result, &err);
+ bytes_read += current_bytes;
if (err)
{
g_signal_emit_by_name (sio, "open-failed", err);
g_error_free (err);
g_object_unref (input_stream);
+ g_free (sio->read_buffer);
+ sio->read_buffer = 0;
return;
}
- append_buffer (sio, bytes_read);
- if (bytes_read == READ_SIZE)
+ if (current_bytes == READ_SIZE)
{
+ sio->read_buffer = g_realloc (sio->read_buffer, bytes_read + READ_SIZE);
g_input_stream_read_async (G_INPUT_STREAM (input_stream),
- sio->read_buffer,
+ sio->read_buffer + bytes_read,
READ_SIZE,
G_PRIORITY_LOW,
sio->cancel,
@@ -417,7 +422,9 @@
}
else
{
- g_signal_emit_by_name (sio, "open-finished");
+ if (append_buffer (sio, bytes_read))
+ g_signal_emit_by_name (sio, "open-finished");
+ bytes_read = 0;
g_object_unref (input_stream);
setup_monitor (sio);
g_free (sio->read_buffer);
@@ -446,7 +453,7 @@
g_error_free (err);
return;
}
- sio->read_buffer = g_new(gchar, READ_SIZE);
+ sio->read_buffer = g_realloc (sio->read_buffer, READ_SIZE);
g_input_stream_read_async (G_INPUT_STREAM (input_stream),
sio->read_buffer,
READ_SIZE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]