Commit ef85dd89 authored by Johannes Schmid's avatar Johannes Schmid Committed by Johannes Schmid

Added new sessions states to avoid loading the local symbols before the

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

svn path=/trunk/; revision=3874
parent 241dcef6
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
2008-04-18 Sébastien Granjoux <seb.sfo@free.fr>
* libanjuta/interfaces/libanjuta.idl,
......
......@@ -37,9 +37,11 @@ typedef struct _AnjutaSessionPriv AnjutaSessionPriv;
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 {
......
......@@ -793,12 +793,16 @@ anjuta_shell_session_load (AnjutaShell *shell, const gchar *session_directory,
g_object_set_data (G_OBJECT (shell), "__session_loading", "1");
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);
......
......@@ -638,13 +638,13 @@ update_document_ui_disable_all (AnjutaPlugin *plugin)
}
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 @@ update_document_ui_save_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
"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 @@ on_document_update_ui (IAnjutaDocument *doc, DocmanPlugin *plugin)
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. */
......
......@@ -1180,6 +1180,7 @@ idocument_redo(IAnjutaDocument* edit, GError** ee)
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 */
......
......@@ -304,8 +304,14 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name,
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 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name,
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);
......@@ -377,6 +383,42 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name,
need_symbols_update = FALSE;
}
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)
{
......@@ -1250,6 +1292,10 @@ symbol_db_activate (AnjutaPlugin *plugin)
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);
......
......@@ -92,6 +92,9 @@ struct _SymbolDBPlugin{
GObject *current_editor;
GHashTable *editor_connected;
/* In session loading? */
gboolean session_loading;
gint files_count;
gint files_count_done;
};
......
......@@ -1667,7 +1667,7 @@ sdb_view_build_and_display_base_tree (SymbolDBView *dbv, SymbolDBEngine *dbe)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment