From 0c51366114423e3674160f4a6bfd5c9ad0109fae Mon Sep 17 00:00:00 2001 From: jhs Date: Sun, 20 Apr 2008 11:35:57 +0000 Subject: [PATCH] 2008-04-20 Johannes Schmid MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * 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 git-svn-id: http://svn.gnome.org/svn/anjuta/trunk@3874 1dbfb86a-d425-0410-a06b-cb591aac69f6 --- ChangeLog | 18 +++++++++++++ libanjuta/anjuta-session.h | 4 ++- libanjuta/anjuta-shell.c | 4 +++ plugins/document-manager/plugin.c | 19 +++++++++++--- plugins/sourceview/sourceview.c | 1 + plugins/symbol-db/plugin.c | 52 +++++++++++++++++++++++++++++++++++--- plugins/symbol-db/plugin.h | 3 +++ plugins/symbol-db/symbol-db-view.c | 2 +- 8 files changed, 95 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d85e72c..293fa165 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2008-04-20 Johannes Schmid + + * 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 * libanjuta/interfaces/libanjuta.idl, diff --git a/libanjuta/anjuta-session.h b/libanjuta/anjuta-session.h index 4c67417e..b07749c6 100644 --- a/libanjuta/anjuta-session.h +++ b/libanjuta/anjuta-session.h @@ -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 { diff --git a/libanjuta/anjuta-shell.c b/libanjuta/anjuta-shell.c index 2f594e8d..459d5462 100644 --- a/libanjuta/anjuta-shell.c +++ b/libanjuta/anjuta-shell.c @@ -794,11 +794,15 @@ anjuta_shell_session_load (AnjutaShell *shell, const gchar *session_directory, 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); diff --git a/plugins/document-manager/plugin.c b/plugins/document-manager/plugin.c index a19b32c9..70ebcb31 100644 --- a/plugins/document-manager/plugin.c +++ b/plugins/document-manager/plugin.c @@ -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. */ diff --git a/plugins/sourceview/sourceview.c b/plugins/sourceview/sourceview.c index 4a6282fc..16061e0c 100644 --- a/plugins/sourceview/sourceview.c +++ b/plugins/sourceview/sourceview.c @@ -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 */ diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c index 4d34763d..590f87d9 100644 --- a/plugins/symbol-db/plugin.c +++ b/plugins/symbol-db/plugin.c @@ -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); @@ -378,6 +384,42 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name, } 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 @@ 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); diff --git a/plugins/symbol-db/plugin.h b/plugins/symbol-db/plugin.h index fecf2af8..eebe581d 100644 --- a/plugins/symbol-db/plugin.h +++ b/plugins/symbol-db/plugin.h @@ -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; }; diff --git a/plugins/symbol-db/symbol-db-view.c b/plugins/symbol-db/symbol-db-view.c index 58268867..8b646314 100644 --- a/plugins/symbol-db/symbol-db-view.c +++ b/plugins/symbol-db/symbol-db-view.c @@ -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); -- 2.11.4.GIT