anjuta r3874 - in trunk: . libanjuta plugins/document-manager plugins/sourceview plugins/symbol-db



Author: jhs
Date: Sun Apr 20 11:35:57 2008
New Revision: 3874
URL: http://svn.gnome.org/viewvc/anjuta?rev=3874&view=rev

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

	* libanjuta/anjuta-session.h:
	* libanjuta/anjuta-shell.c (anjuta_shell_session_load):
	* plugins/symbol-db/plugin.c (value_added_current_editor),
	(on_session_load), (symbol_db_activate):
	* plugins/symbol-db/plugin.h:
	* plugins/symbol-db/symbol-db-view.c
	(sdb_view_build_and_display_base_tree):
	Added new sessions states to avoid loading the local symbols before
	the session is loaded (speeds up start-up).
	
	* plugins/document-manager/plugin.c
	(update_document_ui_undo_items), (update_document_ui_save_items),
	(on_document_update_ui):
	* plugins/sourceview/sourceview.c (idocument_redo):
	Fixed #528705 â There is no Redo

Modified:
   trunk/ChangeLog
   trunk/libanjuta/anjuta-session.h
   trunk/libanjuta/anjuta-shell.c
   trunk/plugins/document-manager/plugin.c
   trunk/plugins/sourceview/sourceview.c
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/plugin.h
   trunk/plugins/symbol-db/symbol-db-view.c

Modified: trunk/libanjuta/anjuta-session.h
==============================================================================
--- trunk/libanjuta/anjuta-session.h	(original)
+++ trunk/libanjuta/anjuta-session.h	Sun Apr 20 11:35:57 2008
@@ -37,9 +37,11 @@
 
 typedef enum
 {
+	ANJUTA_SESSION_PHASE_START,
 	ANJUTA_SESSION_PHASE_FIRST,
 	ANJUTA_SESSION_PHASE_NORMAL,
-	ANJUTA_SESSION_PHASE_LAST
+	ANJUTA_SESSION_PHASE_LAST,
+	ANJUTA_SESSION_PHASE_END,
 } AnjutaSessionPhase;
 
 typedef struct {

Modified: trunk/libanjuta/anjuta-shell.c
==============================================================================
--- trunk/libanjuta/anjuta-shell.c	(original)
+++ trunk/libanjuta/anjuta-shell.c	Sun Apr 20 11:35:57 2008
@@ -794,11 +794,15 @@
 
 	session = anjuta_session_new (session_directory);
 	g_signal_emit_by_name (G_OBJECT (shell), "load_session",
+						   ANJUTA_SESSION_PHASE_START, session);
+	g_signal_emit_by_name (G_OBJECT (shell), "load_session",
 						   ANJUTA_SESSION_PHASE_FIRST, session);
 	g_signal_emit_by_name (G_OBJECT (shell), "load_session",
 						   ANJUTA_SESSION_PHASE_NORMAL, session);
 	g_signal_emit_by_name (G_OBJECT (shell), "load_session",
 						   ANJUTA_SESSION_PHASE_LAST, session);
+	g_signal_emit_by_name (G_OBJECT (shell), "load_session",
+						   ANJUTA_SESSION_PHASE_END, session);
 	g_object_unref (session);
 
 	g_object_set_data (G_OBJECT (shell), "__session_loading", NULL);

Modified: trunk/plugins/document-manager/plugin.c
==============================================================================
--- trunk/plugins/document-manager/plugin.c	(original)
+++ trunk/plugins/document-manager/plugin.c	Sun Apr 20 11:35:57 2008
@@ -638,13 +638,13 @@
 }
 
 static void
-update_document_ui_save_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
+update_document_ui_undo_items (AnjutaPlugin *plugin, IAnjutaDocument* doc)
 {
 	AnjutaUI *ui;
 	GtkAction *action;
-	
-	ui = anjuta_shell_get_ui (plugin->shell, NULL);
 
+	ui = anjuta_shell_get_ui (plugin->shell, NULL);
+	
 	action = anjuta_ui_get_action (ui, "ActionGroupEditorEdit",
 								   "ActionEditUndo");
 	g_object_set (G_OBJECT (action), "sensitive",
@@ -654,6 +654,15 @@
 								   "ActionEditRedo");
 	g_object_set (G_OBJECT (action), "sensitive",
 				  ianjuta_document_can_redo (doc, NULL), NULL);
+}
+
+static void
+update_document_ui_save_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
+{
+	AnjutaUI *ui;
+	GtkAction *action;
+	
+	ui = anjuta_shell_get_ui (plugin->shell, NULL);
 	
 	action = anjuta_ui_get_action (ui, "ActionGroupEditorFile",
 								   "ActionFileSave");
@@ -954,8 +963,12 @@
 	IAnjutaDocument *curdoc;
 		
 	curdoc = anjuta_docman_get_current_document (ANJUTA_DOCMAN (plugin->docman));
+	update_document_ui_undo_items (plugin, curdoc);
+
 	if (IANJUTA_IS_EDITOR (curdoc) && curdoc == doc)
+	{
 		update_status (plugin, IANJUTA_EDITOR (curdoc));
+	}
 }
 
 /* Remove all instances of c from the string s. */

Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c	(original)
+++ trunk/plugins/sourceview/sourceview.c	Sun Apr 20 11:35:57 2008
@@ -1180,6 +1180,7 @@
 	if (idocument_can_redo(edit, NULL))	
 		gtk_source_buffer_redo(GTK_SOURCE_BUFFER(sv->priv->document));
 	anjuta_view_scroll_to_cursor(sv->priv->view);
+	g_signal_emit_by_name(G_OBJECT(sv), "update_ui", sv);
 }
 
 /* Grab focus */

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Sun Apr 20 11:35:57 2008
@@ -304,8 +304,14 @@
 	editor = g_value_get_object (value);	
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 	
-	DEBUG_PRINT ("value_removed_current_editor ()");
-		
+	if (sdb_plugin->session_loading)
+	{
+		DEBUG_PRINT ("session_loading");
+		return;
+	}
+	else
+		DEBUG_PRINT ("Updating symbols");
+	
 	if (!sdb_plugin->editor_connected)
 	{
 		sdb_plugin->editor_connected = g_hash_table_new_full (g_direct_hash,
@@ -336,7 +342,7 @@
 		g_critical ("WARNING FIXME: bad file uri passed to symbol-db from editor. There's "
 				   "a trailing slash left. Please fix this at editor side");
 	}
-	 
+				
 	symbol_db_view_locals_update_list (
 				SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals),
 				 sdb_plugin->sdbe_project, local_path);
@@ -378,6 +384,42 @@
 }
 
 static void
+on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase,
+				 AnjutaSession *session,
+				 SymbolDBPlugin *sdb_plugin)
+{
+	if (phase == ANJUTA_SESSION_PHASE_START)
+	{
+		sdb_plugin->session_loading = TRUE;
+		DEBUG_PRINT ("session_loading started");
+	}
+	else if (phase == ANJUTA_SESSION_PHASE_END)
+	{
+		IAnjutaDocumentManager* docman;
+		sdb_plugin->session_loading = FALSE;
+		DEBUG_PRINT ("session_loading finished");
+		
+		/* Show the symbols for the current editor */
+		docman = anjuta_shell_get_interface (shell, IAnjutaDocumentManager, NULL);
+		if (docman)
+		{
+			IAnjutaDocument* cur_doc = 
+				ianjuta_document_manager_get_current_document (docman, NULL);
+			if (cur_doc)
+			{
+				GValue value = {0, };
+				g_value_init (&value, G_TYPE_OBJECT);
+				g_value_set_object (&value, cur_doc);
+				value_added_current_editor (ANJUTA_PLUGIN (sdb_plugin),
+											"document_manager_current_editor",
+											&value, NULL);
+				g_value_unset(&value);
+			}
+		}
+	}	
+}
+
+static void
 on_editor_foreach_disconnect (gpointer key, gpointer value, gpointer user_data)
 {	
 	g_signal_handlers_disconnect_by_func (G_OBJECT(key),
@@ -1250,6 +1292,10 @@
 									project_root_removed, NULL);
 
 	
+	/* Determine session state */
+	g_signal_connect (plugin->shell, "load_session", 
+					  G_CALLBACK (on_session_load), plugin);
+	
 	/* FIXME: get path from preferences */
 	anjuta_util_prog_is_installed ("ctags", TRUE);
 	

Modified: trunk/plugins/symbol-db/plugin.h
==============================================================================
--- trunk/plugins/symbol-db/plugin.h	(original)
+++ trunk/plugins/symbol-db/plugin.h	Sun Apr 20 11:35:57 2008
@@ -92,6 +92,9 @@
 	GObject *current_editor;
 	GHashTable *editor_connected;	
 	
+	/* In session loading? */
+	gboolean session_loading;
+	
 	gint files_count;
 	gint files_count_done;
 };

Modified: trunk/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view.c	Sun Apr 20 11:35:57 2008
@@ -1667,7 +1667,7 @@
 	GPtrArray *filter_array;
 	GtkTreeRowReference *global_tree_row_ref;
 	GtkTreeIter global_child_iter;
-	GdkPixbuf *global_pixbuf;
+	const GdkPixbuf *global_pixbuf;
 	
 	g_return_if_fail (dbv != NULL);
 	



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