anjuta r4149 - in trunk: . libanjuta libanjuta/interfaces plugins/symbol-browser plugins/symbol-db
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4149 - in trunk: . libanjuta libanjuta/interfaces plugins/symbol-browser plugins/symbol-db
- Date: Mon, 18 Aug 2008 07:49:10 +0000 (UTC)
Author: jhs
Date: Mon Aug 18 07:49:10 2008
New Revision: 4149
URL: http://svn.gnome.org/viewvc/anjuta?rev=4149&view=rev
Log:
2008-08-16 Massimo Cora\' <maxcvs email it>
* libanjuta/anjuta-launcher.c (anjuta_launcher_send_ptyin):
fixed a crasher, or at least added a warning.
* libanjuta/interfaces/libanjuta.idl:
* plugins/symbol-browser/an_symbol.c (anjuta_symbol_set_tag),
(isymbol_get_id), (isymbol_iface_init):
* plugins/symbol-browser/an_symbol_iter.c (isymbol_iter_first),
(isymbol_iter_next), (isymbol_iter_previous),
(isymbol_iter_foreach), (isymbol_iter_set_position),
(isymbol_iter_get_position), (isymbol_iter_get_length):
* plugins/symbol-browser/plugin.c (isymbol_manager_get_members),
(isymbol_manager_get_class_parents),
(isymbol_manager_get_parent_scope),
(isymbol_manager_get_symbol_more_info),
(isymbol_manager_get_symbol_by_id), (isymbol_manager_iface_init):
* plugins/symbol-db/plugin.c (on_session_load),
(on_importing_project_end), (on_project_root_added),
(isymbol_manager_search), (isymbol_manager_get_members),
(isymbol_manager_get_class_parents),
(isymbol_manager_get_parent_scope),
(isymbol_manager_get_symbol_more_info),
(isymbol_manager_get_symbol_by_id), (isymbol_manager_iface_init):
* plugins/symbol-db/symbol-db-engine-iterator-node.c
(isymbol_get_id), (isymbol_iface_init):
* plugins/symbol-db/symbol-db-engine.c (sdb_engine_clear_caches),
(sdb_engine_get_statement_by_query_id),
(sdb_engine_get_tuple_id_by_unique_name4),
(sdb_engine_udpated_scope_gtree_populate),
(sdb_engine_populate_db_by_tags), (sdb_engine_ctags_output_thread),
(sdb_engine_timeout_trigger_signals), (sdb_engine_thread_monitor),
(sdb_engine_ctags_output_callback_1), (sdb_engine_scan_files_1),
(sdb_engine_init), (sdb_engine_finalize), (symbol_db_engine_new),
(sdb_engine_connect_to_db), (sdb_engine_add_new_sym_type),
(sdb_engine_add_new_symbol), (on_scan_update_buffer_end),
(symbol_db_engine_update_buffer_symbols),
(symbol_db_engine_get_class_parents_by_symbol_id),
(symbol_db_engine_get_scope_members_by_symbol_id),
(symbol_db_engine_find_symbol_by_name_pattern_filtered):
* plugins/symbol-db/symbol-db-engine.h:
many bugfixes, for instance on search queries.
Added some new interface methods to let the use of IAnjutaSymbolManager easier.
* plugins/symbol-db/anjuta-symbol-db.glade:
* plugins/symbol-db/symbol-db-prefs.c
(on_prefs_executable_changed), (on_check_button_toggled),
(sdb_prefs_init1):
added an option on preferences to let user the choice of let autopopulation
work or not on project opening.
* plugins/symbol-db/symbol-db-prefs.h:
* plugins/symbol-db/symbol-db-view-locals.c
(sdb_view_locals_get_iter_from_row_ref),
(symbol_db_view_locals_clear_cache), (sdb_view_locals_init),
(sdb_view_locals_finalize), (traverse_on_scan_end),
(trigger_on_symbol_inserted), (prepare_for_adding),
(consume_symbols_inserted_queue_idle_destroy),
(consume_symbols_inserted_queue_idle), (on_scan_end),
(on_symbol_scope_updated),
(symbol_db_view_locals_recv_signals_from_engine),
(symbol_db_view_locals_update_list):
* plugins/symbol-db/tables.sql:
corrected trigger and added a new index. Fixed a bug that broke locals view
when two structs had the same member name inside.
Modified:
trunk/ChangeLog
trunk/libanjuta/anjuta-launcher.c
trunk/libanjuta/interfaces/libanjuta.idl
trunk/plugins/symbol-browser/an_symbol.c
trunk/plugins/symbol-browser/an_symbol_iter.c
trunk/plugins/symbol-browser/plugin.c
trunk/plugins/symbol-db/anjuta-symbol-db.glade
trunk/plugins/symbol-db/plugin.c
trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
trunk/plugins/symbol-db/symbol-db-engine.c
trunk/plugins/symbol-db/symbol-db-engine.h
trunk/plugins/symbol-db/symbol-db-prefs.c
trunk/plugins/symbol-db/symbol-db-prefs.h
trunk/plugins/symbol-db/symbol-db-view-locals.c
trunk/plugins/symbol-db/tables.sql
Modified: trunk/libanjuta/anjuta-launcher.c
==============================================================================
--- trunk/libanjuta/anjuta-launcher.c (original)
+++ trunk/libanjuta/anjuta-launcher.c Mon Aug 18 07:49:10 2008
@@ -423,7 +423,11 @@
gsize bytes_written;
GError *err = NULL;
- if (!input_str || strlen (input_str) == 0) return;
+ g_return_if_fail (launcher);
+ g_return_if_fail (input_str);
+
+ if (strlen (input_str) == 0)
+ return;
do
{
Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl (original)
+++ trunk/libanjuta/interfaces/libanjuta.idl Mon Aug 18 07:49:10 2008
@@ -4595,6 +4595,13 @@
}
/**
+ * An unique identifier for the symbol: pay attention that when engine re-parse
+ * the files this id may change.
+ * @return 0 on error.
+ */
+ gint get_id ();
+
+ /**
* ianjuta_symbol_get_name:
* The name of the symbol
*/
@@ -4645,8 +4652,7 @@
* You *need* a symbol with FIELD_ACCESS | FIELD_KIND enabled attribute. e.g. use
* ianjuta_symbol_manager_search passing FIELD_ACCESS | FIELD_KIND as info_fields.
*/
- const GdkPixbuf *get_icon ();
-
+ const GdkPixbuf *get_icon ();
}
/**
@@ -4698,7 +4704,7 @@
* Database query. The returned @IAnjutaIterable object must be unrefed after use.
*
*/
- IAnjutaIterable* get_members (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields, gboolean global_search);
+ IAnjutaIterable* get_members (const IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields, gboolean global_search);
/**
* ianjuta_symbol_manager_get_parents:
@@ -4711,7 +4717,7 @@
*
* Returns: fixme
*/
- IAnjutaIterable* get_class_parents (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);
+ IAnjutaIterable* get_class_parents (const IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);
/**
* ianjuta_symbol_manager_get_scope:
@@ -4745,7 +4751,7 @@
* no element or NULL is returned if function went wrong.
* The returned @IAnjutaIterable object must be unrefed after use.
*/
- IAnjutaIterable* get_parent_scope (IAnjutaSymbol *symbol, const gchar *filename, IAnjutaSymbolField info_fields);
+ IAnjutaIterable* get_parent_scope (const IAnjutaSymbol *symbol, const gchar *filename, IAnjutaSymbolField info_fields);
/**
* ianjuta_symbol_manager_get_symbol_more_info:
@@ -4761,7 +4767,19 @@
* It's up to you to see which method is more performant.
*
*/
- IAnjutaIterable* get_symbol_more_info (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);
+ IAnjutaIterable* get_symbol_more_info (const IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);
+
+ /**
+ * ianjuta_symbol_manager_get_symbol_by_id:
+ * @obj: Self
+ * @symbol_id unique id of the symbol you want to know about.
+ * @info_fields: Kind of infos you would like to have available on the resulting Symbols.
+ * @return NULL on error.
+ *
+ * A symbol is identified by an unique id. If you have its id you can also
+ * have its object IAnjutaSymbol.
+ */
+ IAnjutaSymbol* get_symbol_by_id (gint symbol_id, IAnjutaSymbolField info_fields);
}
/**
Modified: trunk/plugins/symbol-browser/an_symbol.c
==============================================================================
--- trunk/plugins/symbol-browser/an_symbol.c (original)
+++ trunk/plugins/symbol-browser/an_symbol.c Mon Aug 18 07:49:10 2008
@@ -96,6 +96,8 @@
anjuta_symbol_set_tag (AnjutaSymbol *symbol, const TMTag *tm_tag)
{
g_return_if_fail (ANJUTA_IS_SYMBOL (symbol));
+ g_return_if_fail (tm_tag != NULL);
+
symbol->priv->tm_tag = NULL;
if (symbol->priv->uri)
{
@@ -260,9 +262,17 @@
return anjuta_symbol_info_get_pixbuf (node_type);
}
+static gint
+isymbol_get_id (IAnjutaSymbol *isymbol, GError **err)
+{
+ g_message ("unimplemented");
+ return 0;
+}
+
static void
isymbol_iface_init (IAnjutaSymbolIface *iface)
{
+ iface->get_id = isymbol_get_id;
iface->get_file = isymbol_get_file;
iface->get_name = isymbol_get_name;
iface->get_line = isymbol_get_line;
Modified: trunk/plugins/symbol-browser/an_symbol_iter.c
==============================================================================
--- trunk/plugins/symbol-browser/an_symbol_iter.c (original)
+++ trunk/plugins/symbol-browser/an_symbol_iter.c Mon Aug 18 07:49:10 2008
@@ -96,6 +96,10 @@
isymbol_iter_first (IAnjutaIterable *iterable, GError **err)
{
AnjutaSymbolIter *si = ANJUTA_SYMBOL_ITER (iterable);
+ g_return_val_if_fail (iterable != NULL, FALSE);
+
+ if (si->priv->tm_tags_array->len <= 0)
+ return FALSE;
si->priv->current_pos = 0;
if (si->priv->tm_tags_array->len <= 0)
@@ -114,6 +118,13 @@
isymbol_iter_next (IAnjutaIterable *iterable, GError **err)
{
AnjutaSymbolIter *si = ANJUTA_SYMBOL_ITER (iterable);
+ g_return_val_if_fail (iterable != NULL, FALSE);
+
+ if (si->priv->tm_tags_array->len <= 0)
+ return FALSE;
+
+ DEBUG_PRINT ("si->priv->tm_tags_array->len %d", si->priv->tm_tags_array->len);
+ DEBUG_PRINT ("si->priv->current_pos %d", si->priv->current_pos);
if (si->priv->current_pos >= (si->priv->tm_tags_array->len - 1))
{
@@ -122,7 +133,7 @@
return FALSE;
}
si->priv->current_pos++;
- /* g_assert (si->priv->tm_tags_array->pdata[si->priv->current_pos]); */
+ /*g_assert (si->priv->tm_tags_array->pdata[si->priv->current_pos]); */
anjuta_symbol_set_tag (ANJUTA_SYMBOL (iterable),
si->priv->tm_tags_array->pdata[si->priv->current_pos]);
return TRUE;
@@ -132,6 +143,10 @@
isymbol_iter_previous (IAnjutaIterable *iterable, GError **err)
{
AnjutaSymbolIter *si = ANJUTA_SYMBOL_ITER (iterable);
+ g_return_val_if_fail (iterable != NULL, FALSE);
+
+ if (si->priv->tm_tags_array->len <= 0)
+ return FALSE;
if (si->priv->current_pos <= 0)
{
@@ -170,6 +185,11 @@
gpointer user_data, GError **err)
{
AnjutaSymbolIter *si = ANJUTA_SYMBOL_ITER (iterable);
+ g_return_if_fail (iterable != NULL);
+
+ if (si->priv->tm_tags_array->len <= 0)
+ return;
+
gint saved_pos = si->priv->current_pos;
isymbol_iter_first (iterable, NULL);
@@ -183,6 +203,11 @@
gint position, GError **err)
{
AnjutaSymbolIter *si = ANJUTA_SYMBOL_ITER (iterable);
+ g_return_val_if_fail (iterable != NULL, FALSE);
+
+ if (si->priv->tm_tags_array->len <= 0)
+ return FALSE;
+
if (position < 0)
return FALSE;
if (position > (si->priv->tm_tags_array->len - 1))
@@ -198,6 +223,11 @@
isymbol_iter_get_position (IAnjutaIterable *iterable, GError **err)
{
AnjutaSymbolIter *si = ANJUTA_SYMBOL_ITER (iterable);
+ g_return_val_if_fail (iterable != NULL, FALSE);
+
+ if (si->priv->tm_tags_array->len <= 0)
+ return -1;
+
return si->priv->current_pos;
}
@@ -205,6 +235,8 @@
isymbol_iter_get_length (IAnjutaIterable *iterable, GError **err)
{
AnjutaSymbolIter *si = ANJUTA_SYMBOL_ITER (iterable);
+ g_return_val_if_fail (iterable != NULL, FALSE);
+
return si->priv->tm_tags_array->len;
}
Modified: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c (original)
+++ trunk/plugins/symbol-browser/plugin.c Mon Aug 18 07:49:10 2008
@@ -1158,7 +1158,7 @@
static IAnjutaIterable*
isymbol_manager_get_members (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
IAnjutaSymbolField info_fields,
gboolean global_search,
GError **err)
@@ -1183,7 +1183,7 @@
static IAnjutaIterable*
isymbol_manager_get_class_parents (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
IAnjutaSymbolField info_fields,
GError **err)
{
@@ -1215,7 +1215,7 @@
static IAnjutaIterable*
isymbol_manager_get_parent_scope (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
const gchar *filename,
IAnjutaSymbolField info_fields,
GError **err)
@@ -1227,7 +1227,7 @@
static IAnjutaIterable*
isymbol_manager_get_symbol_more_info (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
IAnjutaSymbolField info_fields,
GError **err)
{
@@ -1235,6 +1235,16 @@
return NULL;
}
+static IAnjutaSymbol*
+isymbol_manager_get_symbol_by_id (IAnjutaSymbolManager *sm,
+ gint symbol_id,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ DEBUG_PRINT ("isymbol_manager_get_symbol_by_id (): not implemented");
+ return NULL;
+}
+
static void
isymbol_manager_iface_init (IAnjutaSymbolManagerIface *iface)
{
@@ -1244,6 +1254,7 @@
iface->get_scope = isymbol_manager_get_scope;
iface->get_parent_scope = isymbol_manager_get_parent_scope;
iface->get_symbol_more_info = isymbol_manager_get_symbol_more_info;
+ iface->get_symbol_by_id = isymbol_manager_get_symbol_by_id;
}
static void
Modified: trunk/plugins/symbol-db/anjuta-symbol-db.glade
==============================================================================
--- trunk/plugins/symbol-db/anjuta-symbol-db.glade (original)
+++ trunk/plugins/symbol-db/anjuta-symbol-db.glade Mon Aug 18 07:49:10 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Wed Jul 9 23:45:46 2008 -->
+<!--Generated with glade3 3.4.4 on Tue Aug 5 00:24:54 2008 -->
<glade-interface>
<widget class="GtkWindow" id="symbol_db_pref_window">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -21,32 +21,54 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkHBox" id="hbox1">
+ <widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
- <widget class="GtkLabel" id="label2">
+ <widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Ctags executable:</property>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">Ctags executable:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFileChooserButton" id="preferences_file:text:/usr/bin/ctags:0:symboldb.ctags">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="preview_widget_active">False</property>
+ <property name="use_preview_label">False</property>
+ <property name="title" translatable="yes">Choose ctags executable</property>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">5</property>
- </packing>
</child>
<child>
- <widget class="GtkFileChooserButton" id="preferences_file:text:/usr/bin/ctags:0:symboldb.ctags">
+ <widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="preview_widget_active">False</property>
- <property name="use_preview_label">False</property>
- <property name="title" translatable="yes">Choose ctags executable</property>
+ <child>
+ <widget class="GtkCheckButton" id="preferences_toggle:bool:1:1:symboldb.scan_prj_pkgs">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Automatically scan project's packages</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="padding">5</property>
- <property name="pack_type">GTK_PACK_END</property>
<property name="position">1</property>
</packing>
</child>
Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c (original)
+++ trunk/plugins/symbol-db/plugin.c Mon Aug 18 07:49:10 2008
@@ -53,9 +53,7 @@
#define TIMEOUT_INTERVAL_SYMBOLS_UPDATE 10000
#define TIMEOUT_SECONDS_AFTER_LAST_TIP 5
-#define CHOOSER_WIDGET "preferences_folder:text:/:0:symboldb.root"
#define PROJECT_GLOBALS "/"
-#define CTAGS_PREFS_KEY "symboldb.ctags"
#define SESSION_SECTION "SymbolDB"
#define SESSION_KEY "SystemPackages"
@@ -388,11 +386,18 @@
if (session_packages == NULL)
{
- GList *project_default_packages =
- ianjuta_project_manager_get_packages (pm, NULL);
+ /* hey, does user want to import system sources for this project? */
+ gboolean automatic_scan = anjuta_preferences_get_int (sdb_plugin->prefs,
+ PROJECT_AUTOSCAN);
+ /* letting session_packages to NULL won't start the population */
+ if (automatic_scan == TRUE)
+ {
+ GList *project_default_packages =
+ ianjuta_project_manager_get_packages (pm, NULL);
- /* take the project's defaults */
- to_scan_packages = project_default_packages;
+ /* take the project's defaults */
+ to_scan_packages = project_default_packages;
+ }
}
else
{
@@ -826,6 +831,8 @@
on_importing_project_end (SymbolDBEngine *dbe, gpointer data)
{
SymbolDBPlugin *sdb_plugin;
+ GFile* file;
+ gchar *local_path;
g_return_if_fail (data != NULL);
@@ -846,16 +853,47 @@
sdb_plugin->sdbe_project, TRUE);
/* re-active global symbols */
- symbol_db_view_open (SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), sdb_plugin->sdbe_project);
+ symbol_db_view_open (SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree),
+ sdb_plugin->sdbe_project);
/* disconnect this coz it's not important after the process of importing */
- g_signal_handlers_disconnect_by_func (dbe, on_project_single_file_scan_end, data);
+ g_signal_handlers_disconnect_by_func (dbe, on_project_single_file_scan_end,
+ data);
/* disconnect it as we don't need it anymore. */
g_signal_handlers_disconnect_by_func (dbe, on_importing_project_end, data);
sdb_plugin->files_count_project_done = 0;
sdb_plugin->files_count_project = 0;
+
+
+ /* ok, enable local symbols view */
+ if (!IANJUTA_IS_EDITOR (sdb_plugin->current_editor))
+ return;
+
+ file = ianjuta_file_get_file (IANJUTA_FILE (sdb_plugin->current_editor),
+ NULL);
+
+ if (file == NULL)
+ return;
+
+ local_path = g_file_get_path (file);
+ if (local_path == NULL)
+ {
+ g_critical ("FIXME local_path == NULL");
+ return;
+ }
+
+ if (strstr (local_path, "//") != NULL)
+ {
+ 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);
+ g_free (local_path);
}
static void
@@ -1274,21 +1312,22 @@
/* hide it. Default */
- /* system tags thing */
+ /* system tags thing: we'll import after abort even if the preferences says not
+ * to automatically scan the packages.
+ */
gtk_widget_hide (sdb_plugin->progress_bar_system);
GPtrArray *sys_src_array = NULL;
-
sys_src_array =
symbol_db_engine_get_files_with_zero_symbols (sdb_plugin->sdbe_globals);
if (sys_src_array != NULL && sys_src_array->len > 0)
{
do_import_system_src_after_abort (plugin, sys_src_array);
-
+
g_ptr_array_foreach (sys_src_array, (GFunc)g_free, NULL);
g_ptr_array_free (sys_src_array, TRUE);
- }
+ }
}
static void
@@ -1718,23 +1757,42 @@
dbe_project = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
dbe_globals = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_globals);
- if (match_types & IANJUTA_SYMBOL_TYPE_MAX)
+ if (match_types & IANJUTA_SYMBOL_TYPE_UNDEF)
{
filter_array = NULL;
+ DEBUG_PRINT ("filter_array is NULL");
}
else
{
filter_array = symbol_db_engine_fill_type_array (match_types);
+ DEBUG_PRINT ("filter_array filled with %d kinds", filter_array->len);
}
if (exact_match == FALSE)
- pattern = g_strdup_printf ("%s%%", match_name);
+ pattern = g_strdup_printf ("%s%%", match_name == NULL ? "" : match_name);
else
- pattern = g_strdup_printf ("%s", match_name);
+ {
+ if (match_name == NULL)
+ pattern = NULL;
+ else
+ pattern = g_strdup_printf ("%s", match_name);
+ }
/* should we lookup for project of system tags? */
-/* DEBUG_PRINT ("tags scan [%s] [exact_match %d] [global %d]", pattern,
- exact_match, global_symbols_search); */
+ //*/
+ DEBUG_PRINT ("tags scan [%s] [exact_match %d] [global %d]", pattern,
+ exact_match, global_symbols_search);
+ {
+ gint i;
+ if (filter_array)
+ for (i = 0; i < filter_array->len; i++)
+ {
+ DEBUG_PRINT ("filter_array for type [%d] %s", i,
+ (gchar*)g_ptr_array_index (filter_array,
+ i));
+ }
+ }
+ //*/
iterator =
symbol_db_engine_find_symbol_by_name_pattern_filtered (
global_tags_search == FALSE ? dbe_project : dbe_globals,
@@ -1759,7 +1817,7 @@
static IAnjutaIterable*
isymbol_manager_get_members (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
IAnjutaSymbolField info_fields,
gboolean global_search,
GError **err)
@@ -1787,7 +1845,7 @@
static IAnjutaIterable*
isymbol_manager_get_class_parents (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
IAnjutaSymbolField info_fields,
GError **err)
{
@@ -1831,7 +1889,7 @@
static IAnjutaIterable*
isymbol_manager_get_parent_scope (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
const gchar *filename,
IAnjutaSymbolField info_fields,
GError **err)
@@ -1863,7 +1921,7 @@
static IAnjutaIterable*
isymbol_manager_get_symbol_more_info (IAnjutaSymbolManager *sm,
- IAnjutaSymbol *symbol,
+ const IAnjutaSymbol *symbol,
IAnjutaSymbolField info_fields,
GError **err)
{
@@ -1888,6 +1946,31 @@
return IANJUTA_ITERABLE (iterator);
}
+static IAnjutaSymbol*
+isymbol_manager_get_symbol_by_id (IAnjutaSymbolManager *sm,
+ gint symbol_id,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ SymbolDBEngineIteratorNode *node;
+ SymbolDBPlugin *sdb_plugin;
+ SymbolDBEngine *dbe;
+ SymbolDBEngineIterator *iterator;
+
+ g_return_val_if_fail (symbol_id > 0, NULL);
+ sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
+ dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
+
+ iterator = symbol_db_engine_get_symbol_info_by_id (dbe, symbol_id,
+ info_fields);
+
+ if (iterator == NULL)
+ return NULL;
+
+ node = SYMBOL_DB_ENGINE_ITERATOR_NODE (iterator);
+ return IANJUTA_SYMBOL (node);
+}
+
static void
isymbol_manager_iface_init (IAnjutaSymbolManagerIface *iface)
{
@@ -1897,6 +1980,7 @@
iface->get_scope = isymbol_manager_get_scope;
iface->get_parent_scope = isymbol_manager_get_parent_scope;
iface->get_symbol_more_info = isymbol_manager_get_symbol_more_info;
+ iface->get_symbol_by_id = isymbol_manager_get_symbol_by_id;
}
static gint
Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c Mon Aug 18 07:49:10 2008
@@ -390,9 +390,20 @@
return type;
}
+static gint
+isymbol_get_id (IAnjutaSymbol *isymbol, GError **err)
+{
+ SymbolDBEngineIteratorNode *s;
+
+ g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol), 0);
+ s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
+ return symbol_db_engine_iterator_node_get_symbol_id (s);
+}
+
static void
isymbol_iface_init (IAnjutaSymbolIface *iface)
{
+ iface->get_id = isymbol_get_id;
iface->get_file = isymbol_get_file;
iface->get_name = isymbol_get_name;
iface->get_line = isymbol_get_line;
Modified: trunk/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.c (original)
+++ trunk/plugins/symbol-db/symbol-db-engine.c Mon Aug 18 07:49:10 2008
@@ -161,7 +161,7 @@
PREP_QUERY_LANGUAGE_NEW,
PREP_QUERY_GET_LANGUAGE_ID_BY_UNIQUE_NAME,
PREP_QUERY_SYM_TYPE_NEW,
- PREP_QUERY_GET_SYM_TYPE_ID,
+ PREP_QUERY_GET_SYM_TYPE_ID,
PREP_QUERY_SYM_KIND_NEW,
PREP_QUERY_GET_SYM_KIND_BY_UNIQUE_NAME,
PREP_QUERY_SYM_ACCESS_NEW,
@@ -186,6 +186,8 @@
PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID,
PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID_MIXED,
PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY,
+ PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY_EXT,
+ PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY_EXT2,
PREP_QUERY_UPDATE_SYMBOL_ALL,
PREP_QUERY_REMOVE_NON_UPDATED_SYMBOLS,
PREP_QUERY_RESET_UPDATE_FLAG_SYMBOLS,
@@ -302,6 +304,7 @@
GAsyncQueue *scan_queue;
GAsyncQueue *updated_symbols_id;
+ GAsyncQueue *updated_scope_symbols_id;
GAsyncQueue *inserted_symbols_id;
gchar *shared_mem_str;
@@ -309,11 +312,10 @@
gint shared_mem_fd;
AnjutaLauncher *ctags_launcher;
gboolean scanning_status;
- gboolean force_sym_update;
GMutex* mutex;
GAsyncQueue* signals_queue;
- GQueue* thread_list;
+ GQueue* thread_list_data;
gboolean thread_status;
gint concurrent_threads;
@@ -330,7 +332,9 @@
/* Caches */
GHashTable *kind_cache;
GHashTable *access_cache;
- GHashTable *implementation_cache;
+ GHashTable *implementation_cache;
+
+ GTree *file_symbols_cache;
static_query_node *static_query_list[PREP_QUERY_COUNT];
dyn_query_node *dyn_query_list[DYN_PREP_QUERY_COUNT];
@@ -397,6 +401,7 @@
g_hash_table_destroy (priv->access_cache);
if (priv->implementation_cache)
g_hash_table_destroy (priv->implementation_cache);
+
priv->kind_cache = NULL;
priv->access_cache = NULL;
priv->implementation_cache = NULL;
@@ -419,7 +424,7 @@
priv->implementation_cache = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
- NULL);
+ NULL);
}
@@ -529,7 +534,8 @@
* a connection established to db before using this function */
g_return_val_if_fail (priv->db_connection != NULL, NULL);
- node = priv->static_query_list[query_id];
+ if ((node = priv->static_query_list[query_id]) == NULL)
+ return NULL;
if (node->stmt == NULL)
{
@@ -1035,6 +1041,94 @@
return table_id;
}
+static inline gint
+sdb_engine_get_tuple_id_by_unique_name4 (SymbolDBEngine * dbe,
+ static_query_type qtype,
+ gchar * param_key1,
+ const GValue * value1,
+ gchar * param_key2,
+ const GValue * value2,
+ gchar * param_key3,
+ const GValue * value3,
+ gchar * param_key4,
+ const GValue * value4)
+{
+ const GdaSet *plist;
+ const GdaStatement *stmt;
+ GdaHolder *param;
+ GdaDataModel *data_model;
+ const GValue *num;
+ gint table_id;
+ SymbolDBEnginePriv *priv;
+
+ priv = dbe->priv;
+
+ /* get prepared query */
+ if ((stmt = sdb_engine_get_statement_by_query_id (dbe, qtype)) == NULL)
+ {
+ g_warning ("Query is null");
+ return -1;
+ }
+
+ plist = sdb_engine_get_query_parameters_list (dbe, qtype);
+
+ if ((param = gda_set_get_holder ((GdaSet*)plist, param_key1)) == NULL)
+ {
+ g_warning ("sdb_engine_get_tuple_id_by_unique_name: param is NULL "
+ "from pquery!\n");
+ return -1;
+ }
+ gda_holder_set_value (param, value1);
+
+
+ /* ...and the second one */
+ if ((param = gda_set_get_holder ((GdaSet*)plist, param_key2)) == NULL)
+ {
+ g_warning ("sdb_engine_get_tuple_id_by_unique_name2: "
+ "param is NULL from pquery!");
+ return -1;
+ }
+ gda_holder_set_value (param, value2);
+
+ /* ...and the third one */
+ if ((param = gda_set_get_holder ((GdaSet*)plist, param_key3)) == NULL)
+ {
+ g_warning ("sdb_engine_get_tuple_id_by_unique_name2: "
+ "param is NULL from pquery!");
+ return -1;
+ }
+ gda_holder_set_value (param, value3);
+
+ /* ...and the fourth one */
+ if ((param = gda_set_get_holder ((GdaSet*)plist, param_key4)) == NULL)
+ {
+ g_warning ("sdb_engine_get_tuple_id_by_unique_name2: "
+ "param is NULL from pquery!");
+ return -1;
+ }
+ gda_holder_set_value (param, value4);
+
+ /* execute the query with parametes just set */
+ data_model = gda_connection_statement_execute_select (priv->db_connection,
+ (GdaStatement*)stmt,
+ (GdaSet*)plist, NULL);
+
+ if (!GDA_IS_DATA_MODEL (data_model) ||
+ gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model)) <= 0)
+ {
+ if (data_model != NULL)
+ g_object_unref (data_model);
+ return -1;
+ }
+
+ /* get and parse the results. */
+ num = gda_data_model_get_value_at (GDA_DATA_MODEL (data_model), 0, 0);
+
+ table_id = g_value_get_int (num);
+ g_object_unref (data_model);
+ return table_id;
+}
+
static int
sdb_engine_get_file_defined_id (SymbolDBEngine* dbe,
const gchar* base_prj_path,
@@ -1043,7 +1137,7 @@
{
GValue* value = gda_value_new (G_TYPE_STRING);
gint file_defined_id = 0;
- if (base_prj_path != NULL)
+ if (base_prj_path != NULL && g_str_has_prefix (tag_entry->file, base_prj_path))
{
/* in this case fake_file will be ignored. */
@@ -1080,6 +1174,33 @@
return file_defined_id;
}
+static
+gboolean sdb_engine_udpated_scope_gtree_populate (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ SymbolDBEnginePriv *priv;
+ SymbolDBEngine * dbe = data;
+ priv = dbe->priv;
+
+ GList *list;
+ list = value;
+ if (g_list_length (list) > 1)
+ {
+ GList *item = list;
+ while (item != NULL)
+ {
+ g_async_queue_push (priv->updated_scope_symbols_id,
+ (gpointer) item->data);
+ item = item->next;
+ }
+ }
+
+ /* proceed with a freeing of the values */
+ g_list_free (list);
+ return FALSE;
+}
+
static GTimer *sym_timer_DEBUG = NULL;
/**
@@ -1109,11 +1230,6 @@
g_return_if_fail (priv->db_connection != NULL);
g_return_if_fail (fd != NULL);
- if (priv->updated_symbols_id == NULL)
- priv->updated_symbols_id = g_async_queue_new ();
-
- if (priv->inserted_symbols_id == NULL)
- priv->inserted_symbols_id = g_async_queue_new ();
DEBUG_PRINT ("sdb_engine_populate_db_by_tags ()");
if ((tag_file = tagsOpen_1 (fd, &tag_file_info)) == NULL)
@@ -1126,6 +1242,7 @@
else
g_timer_reset (sym_timer_DEBUG);
gint tags_total_DEBUG = 0;
+
while (tagsNext (tag_file, &tag_entry) != TagFailure)
{
gint file_defined_id = 0;
@@ -1144,21 +1261,39 @@
&tag_entry);
file_defined_id_cache = file_defined_id;
g_free (tag_entry_file_cache);
- tag_entry_file_cache = g_strdup(tag_entry.file);
+ tag_entry_file_cache = g_strdup (tag_entry.file);
}
+ /* insert or update a symbol */
sdb_engine_add_new_symbol (dbe, &tag_entry, file_defined_id,
force_sym_update);
tags_total_DEBUG ++;
}
g_free (tag_entry_file_cache);
+
+ if (force_sym_update == TRUE)
+ {
+ /* any scope_updated symbols to the releative queue */
+ g_tree_foreach (priv->file_symbols_cache,
+ sdb_engine_udpated_scope_gtree_populate, dbe);
+ /* destroying the tree and recreating it should be faster than removing each
+ * balanced item inside it */
+ g_tree_destroy (priv->file_symbols_cache);
+ priv->file_symbols_cache = g_tree_new_full ((GCompareDataFunc)>ree_compare_func,
+ NULL,
+ NULL,
+ NULL);
+ }
+
gdouble elapsed_DEBUG = g_timer_elapsed (sym_timer_DEBUG, NULL);
DEBUG_PRINT ("elapsed: %f for (%d) [%f per symbol]", elapsed_DEBUG,
tags_total_DEBUG, elapsed_DEBUG / tags_total_DEBUG);
/* notify listeners that another file has been scanned */
g_async_queue_push (priv->signals_queue, (gpointer)(SINGLE_FILE_SCAN_END +1));
+
+ /* we've done with tag_file but we don't need to tagsClose (tag_file); */
}
static gpointer
@@ -1286,6 +1421,17 @@
g_async_queue_unlock (priv->signals_queue);
}
+ while ((tmp_updated = (int)
+ g_async_queue_try_pop (priv->updated_scope_symbols_id)) > 0)
+ {
+ g_async_queue_lock (priv->signals_queue);
+ g_async_queue_push_unlocked (priv->signals_queue, (gpointer)
+ (SYMBOL_SCOPE_UPDATED + 1));
+ g_async_queue_push_unlocked (priv->signals_queue,
+ (gpointer) tmp_updated);
+ g_async_queue_unlock (priv->signals_queue);
+ }
+
/* emit signal. The end of files-group can be cannot be
* determined by the caller. This is the only way.
@@ -1319,6 +1465,7 @@
priv->thread_status = FALSE;
priv->concurrent_threads--;
+
/* unlock */
if (priv->mutex)
g_mutex_unlock (priv->mutex);
@@ -1394,7 +1541,7 @@
if (priv->thread_status == FALSE &&
priv->trigger_closure_retries > TRIGGER_MAX_CLOSURE_RETRIES &&
- g_queue_get_length (priv->thread_list) <= 0 &&
+ g_queue_get_length (priv->thread_list_data) <= 0 &&
priv->thread_monitor_handler <= 0)
{
DEBUG_PRINT ("removing signals trigger");
@@ -1423,7 +1570,7 @@
return TRUE;
}
- output = g_queue_pop_head (priv->thread_list);
+ output = g_queue_pop_head (priv->thread_list_data);
if (output != NULL)
{
@@ -1438,7 +1585,7 @@
}
if (priv->thread_closure_retries > THREAD_MAX_CLOSURE_RETRIES &&
- g_queue_get_length (priv->thread_list) <= 0)
+ g_queue_get_length (priv->thread_list_data) <= 0)
{
DEBUG_PRINT ("removing thread monitor");
/* remove the thread monitor */
@@ -1468,10 +1615,10 @@
output->chars = g_strdup (chars);
output->user_data = user_data;
- if (priv->thread_list == NULL)
- priv->thread_list = g_queue_new ();
+ if (priv->thread_list_data == NULL)
+ priv->thread_list_data = g_queue_new ();
- g_queue_push_tail (priv->thread_list, output);
+ g_queue_push_tail (priv->thread_list_data, output);
/* thread monitor */
if (priv->thread_monitor_handler <= 0)
@@ -1640,7 +1787,8 @@
/* yes */
g_async_queue_push (priv->scan_queue, (gpointer) DO_UPDATE_SYMS_AND_EXIT);
}
- else {
+ else
+ {
/* no */
g_async_queue_push (priv->scan_queue, (gpointer) DO_UPDATE_SYMS);
}
@@ -1772,6 +1920,12 @@
*/
sdbe->priv->scan_queue = g_async_queue_new ();
+ /* some signals queues */
+ sdbe->priv->signals_queue = g_async_queue_new ();
+ sdbe->priv->updated_symbols_id = g_async_queue_new ();
+ sdbe->priv->updated_scope_symbols_id = g_async_queue_new ();
+ sdbe->priv->inserted_symbols_id = g_async_queue_new ();
+
/*
* STATIC QUERY STRUCTURE INITIALIZE
@@ -2033,8 +2187,23 @@
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY,
"SELECT symbol_id FROM symbol WHERE name = ## /* name:'symname' "
+ "type:gchararray */ AND file_defined_id = ## /* name:'filedefid' "
+ "type:gint */ AND type_id = ## /* name:'typeid' type:gint */ LIMIT 1");
+
+ STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
+ PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY_EXT,
+ "SELECT symbol_id FROM symbol WHERE name = ## /* name:'symname' "
+ "type:gchararray */ AND file_defined_id = ## /* name:'filedefid' "
+ "type:gint */ AND file_position = ## /* name:'filepos' type:gint */ "
+ "AND type_id = ## /* name:'typeid' type:gint */ AND "
+ "update_flag = 0 LIMIT 1");
+
+ STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
+ PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY_EXT2,
+ "SELECT symbol_id FROM symbol WHERE name = ## /* name:'symname' "
"type:gchararray */ AND file_defined_id = ## /* name:'filedefid' "
- "type:gint */ AND type_id = ## /* name:'typeid' type:gint */ LIMIT 1");
+ "type:gint */ AND type_id = ## /* name:'typeid' type:gint */ AND "
+ "update_flag = 0 LIMIT 1");
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
PREP_QUERY_UPDATE_SYMBOL_ALL,
@@ -2121,6 +2290,11 @@
/* init cache hashtables */
sdb_engine_init_caches (sdbe);
+
+ sdbe->priv->file_symbols_cache = g_tree_new_full ((GCompareDataFunc)>ree_compare_func,
+ NULL,
+ NULL,
+ NULL);
}
static void
@@ -2138,11 +2312,27 @@
dbe = SYMBOL_DB_ENGINE (object);
priv = dbe->priv;
+ if (priv->ctags_launcher)
+ {
+ anjuta_launcher_signal (priv->ctags_launcher, SIGINT);
+ g_object_unref (priv->ctags_launcher);
+ priv->ctags_launcher = NULL;
+ }
+
if (priv->timeout_trigger_handler > 0)
g_source_remove (priv->timeout_trigger_handler);
if (priv->thread_monitor_handler > 0)
- g_source_remove (priv->thread_monitor_handler);
+ g_source_remove (priv->thread_monitor_handler);
+
+ if (priv->mutex)
+ {
+ g_mutex_free (priv->mutex);
+ priv->mutex = NULL;
+ }
+
+ if (priv->thread_list_data != NULL)
+ g_queue_free (priv->thread_list_data);
sdb_engine_disconnect_from_db (dbe);
sdb_engine_free_cached_queries (dbe);
@@ -2160,6 +2350,12 @@
priv->updated_symbols_id = NULL;
}
+ if (priv->updated_scope_symbols_id)
+ {
+ g_async_queue_unref (priv->updated_scope_symbols_id);
+ priv->updated_scope_symbols_id = NULL;
+ }
+
if (priv->inserted_symbols_id)
{
g_async_queue_unref (priv->inserted_symbols_id);
@@ -2188,29 +2384,16 @@
g_hash_table_destroy (priv->garbage_shared_mem_files);
}
- if (priv->ctags_launcher)
- {
- anjuta_launcher_signal (priv->ctags_launcher, SIGINT);
- g_object_unref (priv->ctags_launcher);
- priv->ctags_launcher = NULL;
- }
-
- if (priv->mutex)
- {
- g_mutex_free (priv->mutex);
- priv->mutex = NULL;
- }
-
- if (priv->thread_list != NULL)
- g_queue_free (priv->thread_list);
if (priv->sym_type_conversion_hash)
g_hash_table_destroy (priv->sym_type_conversion_hash);
- if (priv->signals_queue != NULL)
+ if (priv->signals_queue)
g_async_queue_unref (priv->signals_queue);
sdb_engine_clear_caches (dbe);
+
+ g_tree_destroy (priv->file_symbols_cache);
g_free (priv);
@@ -2359,9 +2542,9 @@
priv = sdbe->priv;
// FIXME
- //priv->mutex = g_mutex_new ();
+ priv->mutex = g_mutex_new ();
// FIXME
- priv->mutex = NULL;
+ //priv->mutex = NULL;
/* set the mandatory ctags_path */
@@ -2394,10 +2577,7 @@
SymbolDBEnginePriv *priv;
g_return_val_if_fail (dbe != NULL, FALSE);
- priv = dbe->priv;
-
- priv->mutex = g_mutex_new ();
- priv->signals_queue = g_async_queue_new ();
+ priv = dbe->priv;
if (priv->db_connection != NULL)
{
@@ -3089,7 +3269,7 @@
/*
CREATE TABLE sym_type (type_id integer PRIMARY KEY AUTOINCREMENT,
type_type varchar (256) not null ,
- type_name varchar (256) not null ,
+ type_name varchar (256) not null
unique (type_type, type_name)
);
*/
@@ -3157,7 +3337,8 @@
}
gda_value_free (value1);
- gda_value_free (value2);
+ gda_value_free (value2);
+
return table_id;
}
else
@@ -4358,7 +4539,7 @@
GdaSet *last_inserted;
const gchar *tmp_str;
gint table_id, symbol_id;
- char* name;
+ const gchar* name;
gint file_position = 0;
gint is_file_scope = 0;
gchar signature[256];
@@ -4368,10 +4549,10 @@
gint kind_id = 0;
gint access_kind_id = 0;
gint implementation_kind_id = 0;
- GValue *value, *value1, *value2, *value3;
+ GValue *value, *value1, *value2, *value3, *value4;
gboolean sym_was_updated = FALSE;
gint update_flag;
-
+
g_return_val_if_fail (dbe != NULL, -1);
priv = dbe->priv;
@@ -4389,7 +4570,7 @@
g_warning ("tag_entry->name too big for database");
return -1;
}
- name = g_strdup (tag_entry->name);
+ name = tag_entry->name;
file_position = tag_entry->address.lineNumber;
is_file_scope = tag_entry->fileScope;
@@ -4438,27 +4619,68 @@
* also scope_ids and other things.
*/
- value1 = gda_value_new (G_TYPE_STRING);
- g_value_set_string (value1, name);
+
+ if (update_flag == FALSE)
+ {
+ /* FIXME: are we sure to force this to -1? */
+ symbol_id = -1;
+ }
+ else
+ {
+ GList *sym_list;
+ value1 = gda_value_new (G_TYPE_STRING);
+ g_value_set_string (value1, name);
- value2 = gda_value_new (G_TYPE_INT);
- g_value_set_int (value2, file_defined_id);
+ value2 = gda_value_new (G_TYPE_INT);
+ g_value_set_int (value2, file_defined_id);
- value3 = gda_value_new (G_TYPE_INT);
- g_value_set_int (value3, type_id);
+ value3 = gda_value_new (G_TYPE_INT);
+ g_value_set_int (value3, type_id);
+
+ value4 = gda_value_new (G_TYPE_INT);
+ g_value_set_int (value4, file_position);
- if ((symbol_id = sdb_engine_get_tuple_id_by_unique_name3 (dbe,
- PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY,
+ sym_list = g_tree_lookup (priv->file_symbols_cache, (gpointer)type_id);
+
+ symbol_id = sdb_engine_get_tuple_id_by_unique_name4 (dbe,
+ PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY_EXT,
"symname", value1,
"filedefid",value2,
- "typeid", value3)) <= 0)
- {
- /* case 2 and 3 */
- sym_was_updated = FALSE;
+ "typeid", value3,
+ "filepos", value4);
+
+ /* no luck, retry widely */
+ if (symbol_id <= 0)
+ {
+ symbol_id = sdb_engine_get_tuple_id_by_unique_name3 (dbe,
+ PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY_EXT2,
+ "symname", value1,
+ "filedefid",value2,
+ "typeid", value3);
+ }
+
+ if (symbol_id > 0) {
+ /* attach to list the value of symbol: when this will have parsed all its
+ * symbols we'll be ready to check the lists with more than an element:
+ * those for sure will have an high probability for an updated scope.
+ */
+ sym_list = g_list_prepend (sym_list, (gpointer) symbol_id);
+ g_tree_insert (priv->file_symbols_cache, (gpointer)type_id,
+ sym_list);
+ }
gda_value_free (value1);
gda_value_free (value2);
- gda_value_free (value3);
+ gda_value_free (value3);
+ gda_value_free (value4);
+ }
+
+
+ /* ok then, parse the symbol id value */
+ if (symbol_id <= 0)
+ {
+ /* case 2 and 3 */
+ sym_was_updated = FALSE;
/* create specific query for a fresh new symbol */
if ((stmt = sdb_engine_get_statement_by_query_id (dbe, PREP_QUERY_SYMBOL_NEW))
@@ -4504,10 +4726,6 @@
{
/* case 1 */
sym_was_updated = TRUE;
-
- gda_value_free (value1);
- gda_value_free (value2);
- gda_value_free (value3);
/* create specific query for a fresh new symbol */
if ((stmt = sdb_engine_get_statement_by_query_id (dbe,
@@ -4665,11 +4883,6 @@
{
table_id = symbol_id;
- /* This is a wrong place to emit the symbol-updated signal. Infact
- * db is in a inconsistent state, e.g. inheritance references are still
- * *not* calculated.
- * So add the symbol id into a queue that will be parsed once and emitted.
- */
g_async_queue_push (priv->updated_symbols_id, (gpointer) table_id);
}
else
@@ -4678,6 +4891,7 @@
}
}
+
/* before returning the table_id we have to fill some infoz on temporary tables
* so that in a second pass we can parse also the heritage and scope fields.
*/
@@ -5365,17 +5579,9 @@
priv = dbe->priv;
files_to_scan = (GPtrArray *) data;
- DEBUG_PRINT ("files_to_scan->len %d", files_to_scan->len);
-
for (i = 0; i < files_to_scan->len; i++)
{
gchar *node = (gchar *) g_ptr_array_index (files_to_scan, i);
-
- /* FIXME remove DEBUG_PRINT */
- DEBUG_PRINT ("processing updating for file [on disk] %s, "
- "passed to on_scan_update_buffer_end (): %s",
- node, node + strlen (priv->db_directory));
-
gchar *relative_path = symbol_db_engine_get_file_db_path (dbe, node);
if (relative_path != NULL)
{
@@ -5515,9 +5721,6 @@
for (i=0; i < temp_files->len; i++)
g_free (g_ptr_array_index (temp_files, i));
- /* FIXME TODO remove temp files! look at task for details */
-
-
g_ptr_array_free (temp_files, TRUE);
/* and the real_files_on_db too */
@@ -5877,7 +6080,7 @@
/* fill info_data and join data with optional sql */
sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
- query_str = g_strdup_printf("SELECT symbol.symbol_id,AS symbol_id "
+ query_str = g_strdup_printf("SELECT symbol.symbol_id AS symbol_id, "
"symbol.name AS name, symbol.file_position AS file_position, "
"symbol.is_file_scope AS is_file_scope, symbol.signature AS signature "
"%s FROM heritage "
@@ -5901,6 +6104,9 @@
g_mutex_unlock (priv->mutex);
return NULL;
}
+
+ /*DEBUG_PRINT ("symbol_db_engine_get_class_parents_by_symbol_id () query_str is: %s",
+ dyn_node->query_str);*/
if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "childklassid")) == NULL)
{
@@ -6789,6 +6995,9 @@
gda_holder_set_value (param, value);
gda_value_free (value);
+ /*DEBUG_PRINT ("symbol_db_engine_get_scope_members_by_symbol_id (): %s",
+ dyn_node->query_str);*/
+
/* execute the query with parametes just set */
data = gda_connection_statement_execute_select (priv->db_connection,
(GdaStatement*)dyn_node->stmt,
@@ -7818,9 +8027,8 @@
g_string_append_printf (filter_projects,
",## /* name:'prj_filter%d' type:gchararray */", i);
}
+ filter_projects = g_string_append (filter_projects, "))");
}
- filter_projects = g_string_append (filter_projects, "))");
-
query_str = g_strdup_printf ("SELECT symbol.symbol_id AS symbol_id, "
"symbol.name AS name, symbol.file_position AS file_position, "
@@ -7883,20 +8091,24 @@
{
filter_str = g_string_append (filter_str ,
"AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
+ for (i = 1; i < filter_kinds->len; i++)
+ {
+ g_string_append_printf (filter_str ,
+ ",## /* name:'filter%d' type:gchararray */", i);
+ }
+ filter_str = g_string_append (filter_str , ")");
}
else
{
filter_str = g_string_append (filter_str ,
"AND sym_kind.kind_name NOT IN (## /* name:'filter0' type:gchararray */");
- }
-
- for (i = 1; i < filter_kinds->len; i++)
- {
- g_string_append_printf (filter_str ,
- ",## /* name:'filter%d' type:gchararray */", i);
+ for (i = 1; i < filter_kinds->len; i++)
+ {
+ g_string_append_printf (filter_str ,
+ ",## /* name:'filter%d' type:gchararray */", i);
+ }
+ filter_str = g_string_append (filter_str , ")");
}
- filter_str = g_string_append (filter_str , ")");
-
/* build session projects filter string */
filter_projects = g_string_new ("");
@@ -7913,8 +8125,8 @@
g_string_append_printf (filter_projects,
",## /* name:'prj_filter%d' type:gchararray */", i);
}
- }
- filter_projects = g_string_append (filter_projects, "))");
+ filter_projects = g_string_append (filter_projects, "))");
+ }
query_str = g_strdup_printf ("SELECT symbol.symbol_id AS symbol_id, symbol.name AS name, "
"symbol.file_position AS file_position, "
Modified: trunk/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.h (original)
+++ trunk/plugins/symbol-db/symbol-db-engine.h Mon Aug 18 07:49:10 2008
@@ -53,7 +53,7 @@
void (* scan_end) ();
void (* symbol_inserted) (gint symbol_id);
void (* symbol_updated) (gint symbol_id);
- void (* symbol_scope_updated) (gint symbol_id); /* never emitted. */
+ void (* symbol_scope_updated) (gint symbol_id);
void (* symbol_removed) (gint symbol_id);
};
Modified: trunk/plugins/symbol-db/symbol-db-prefs.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-prefs.c (original)
+++ trunk/plugins/symbol-db/symbol-db-prefs.c Mon Aug 18 07:49:10 2008
@@ -37,11 +37,8 @@
#define GLADE_ROOT "symbol_prefs"
#define ICON_FILE "anjuta-symbol-db-plugin-48.png"
-#define CTAGS_PREFS_KEY "ctags.executable"
-#define CHOOSER_WIDGET "preferences_file:text:/usr/bin/ctags:0:symboldb.ctags"
-enum
-{
+enum {
COLUMN_LOAD,
COLUMN_NAME,
COLUMN_MAX
@@ -107,7 +104,7 @@
if (new_file != NULL)
{
GtkWidget *fchooser;
- fchooser = glade_xml_get_widget (priv->prefs_gxml, CHOOSER_WIDGET);
+ fchooser = glade_xml_get_widget (priv->prefs_gxml, CTAGS_PREFS_KEY);
gtk_widget_set_sensitive (fchooser, TRUE);
anjuta_preferences_set (priv->prefs, CTAGS_PREFS_KEY,
@@ -360,15 +357,33 @@
}
static void
+on_check_button_toggled (GtkToggleButton *togglebutton, SymbolDBPrefs *sdbp)
+{
+ SymbolDBPrefsPriv *priv;
+ gboolean check_button_value;
+ priv = sdbp->priv;
+ GtkWidget *check_button;
+
+ check_button = glade_xml_get_widget (priv->prefs_gxml, PROJECT_AUTOSCAN);
+
+ check_button_value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_button));
+ DEBUG_PRINT ("on_check_button_toggled ()");
+ anjuta_preferences_set_int (priv->prefs, PROJECT_AUTOSCAN, check_button_value);
+
+}
+
+static void
sdb_prefs_init1 (SymbolDBPrefs *sdbp)
{
SymbolDBPrefsPriv *priv;
GtkWidget *fchooser;
+ GtkWidget *check_button;
+ gboolean check_button_value;
gchar *ctags_value;
priv = sdbp->priv;
- fchooser = glade_xml_get_widget (priv->prefs_gxml, CHOOSER_WIDGET);
+ fchooser = glade_xml_get_widget (priv->prefs_gxml, CTAGS_PREFS_KEY);
/* we will reactivate it after the listall has been finished */
gtk_widget_set_sensitive (fchooser, FALSE);
@@ -397,6 +412,13 @@
CTAGS_PREFS_KEY,
on_gconf_notify_prefs,
priv->prefs, NULL);
+
+
+ check_button = glade_xml_get_widget (priv->prefs_gxml, PROJECT_AUTOSCAN);
+ g_signal_connect (G_OBJECT (check_button), "toggled",
+ G_CALLBACK (on_check_button_toggled), sdbp);
+ check_button_value = anjuta_preferences_get_int (priv->prefs, PROJECT_AUTOSCAN);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), check_button_value);
g_free (ctags_value);
}
Modified: trunk/plugins/symbol-db/symbol-db-prefs.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-prefs.h (original)
+++ trunk/plugins/symbol-db/symbol-db-prefs.h Mon Aug 18 07:49:10 2008
@@ -39,6 +39,11 @@
#include "plugin.h"
#include "symbol-db-system.h"
+
+#define CTAGS_PREFS_KEY "preferences_file:text:/usr/bin/ctags:0:symboldb.ctags"
+#define PROJECT_AUTOSCAN "preferences_toggle:bool:1:1:symboldb.scan_prj_pkgs"
+
+
struct _SymbolDBPrefsClass
{
GObjectClass parent_class;
Modified: trunk/plugins/symbol-db/symbol-db-view-locals.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-locals.c (original)
+++ trunk/plugins/symbol-db/symbol-db-view-locals.c Mon Aug 18 07:49:10 2008
@@ -71,6 +71,7 @@
gint insert_handler;
gint remove_handler;
gint scan_end_handler;
+ gint scope_update_handler;
gint insertion_idle_handler;
GTree *nodes_displayed;
@@ -166,8 +167,8 @@
path = gtk_tree_row_reference_get_path (row_ref);
if (path == NULL)
{
- DEBUG_PRINT ("sdb_view_locals_get_iter_from_row_ref (): path is null, something "
- "went wrong ?!");
+ /*DEBUG_PRINT ("sdb_view_locals_get_iter_from_row_ref (): path is null, something "
+ "went wrong ?!");*/
return FALSE;
}
@@ -193,13 +194,13 @@
priv = dbvl->priv;
- DEBUG_PRINT ("symbol_db_view_locals_clear_cache ()");
+ /*DEBUG_PRINT ("symbol_db_view_locals_clear_cache ()");*/
/* check whether we already have the view status saved on hash table or not.
* If we saved that then don't remove it, or there may be a memory leak
*/
if (priv->current_db_file != NULL)
{
- DEBUG_PRINT ("priv->current_db_file %s ", priv->current_db_file);
+ /*DEBUG_PRINT ("priv->current_db_file %s ", priv->current_db_file);*/
hash_node = g_hash_table_lookup (priv->files_view_status,
priv->current_db_file);
}
@@ -246,8 +247,7 @@
static void
sdb_view_locals_init (SymbolDBViewLocals *dbvl)
-{
- DEBUG_PRINT ("sdb_view_locals_init ()");
+{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
@@ -255,7 +255,8 @@
SymbolDBViewLocalsPriv *priv;
g_return_if_fail (dbvl != NULL);
-
+
+ DEBUG_PRINT ("sdb_view_locals_init ()");
dbvl->priv = g_new0 (SymbolDBViewLocalsPriv, 1);
priv = dbvl->priv;
@@ -267,6 +268,7 @@
priv->insert_handler = 0;
priv->scan_end_handler = 0;
priv->remove_handler = 0;
+ priv->scope_update_handler = 0;
priv->insertion_idle_handler = 0;
priv->files_view_status = g_hash_table_new_full (g_str_hash,
g_str_equal, g_free, (GDestroyNotify)file_view_status_destroy);
@@ -320,7 +322,7 @@
locals = SYMBOL_DB_VIEW_LOCALS (object);
priv = locals->priv;
- DEBUG_PRINT ("finalizing symbol_db_view_locals ()");
+ /*DEBUG_PRINT ("finalizing symbol_db_view_locals ()");*/
symbol_db_view_locals_clear_cache (locals);
g_hash_table_destroy (priv->files_view_status);
@@ -471,8 +473,8 @@
priv = dbvl->priv;
parent_id = (gint) key;
- DEBUG_PRINT ("traverse_on_scan_end (): something has been left on "
- "waiting_for_tree.. checking for %d", parent_id);
+ /*DEBUG_PRINT ("traverse_on_scan_end (): something has been left on "
+ "waiting_for_tree.. checking for %d", parent_id);*/
iterator = symbol_db_engine_get_symbol_info_by_id (dbe, parent_id,
SYMINFO_SIMPLE |
@@ -501,7 +503,7 @@
grandparent_id = symbol_db_engine_get_parent_scope_id_by_symbol_id (dbe,
parent_id,
priv->current_db_file);
- DEBUG_PRINT ("traverse_on_scan_end (): grandparent_id %d", grandparent_id);
+ /*DEBUG_PRINT ("traverse_on_scan_end (): grandparent_id %d", grandparent_id);*/
if (grandparent_id > 0)
{
@@ -512,9 +514,9 @@
/* hey we have a namespace or something which is the parent of
* our parent.
*/
- DEBUG_PRINT ("traverse_on_scan_end (): adding parent_id %d "
+ /*DEBUG_PRINT ("traverse_on_scan_end (): adding parent_id %d "
"to grandparent %d", parent_id,
- grandparent_id);
+ grandparent_id);*/
row_ref = do_add_child_symbol_to_view (dbvl, grandparent_id, pixbuf,
symbol_name, parent_id);
@@ -583,7 +585,7 @@
priv = dbvl->priv;
-/* DEBUG_PRINT ("trigger_on_symbol_inserted (): triggering %d", symbol_id);*/
+ /*DEBUG_PRINT ("trigger_on_symbol_inserted (): triggering %d", symbol_id);*/
/* try to find a waiting for symbol */
slist = g_tree_lookup (priv->waiting_for, (gpointer)symbol_id);
@@ -591,14 +593,14 @@
if (slist == NULL)
{
/* nothing waiting for us */
-/* DEBUG_PRINT ("trigger_on_symbol_inserted (): no children waiting for us...");*/
+ /*DEBUG_PRINT ("trigger_on_symbol_inserted (): no children waiting for us...");*/
return;
}
else {
gint i;
gint length = g_slist_length (slist);
-/* DEBUG_PRINT ("trigger_on_symbol_inserted (): consuming slist for parent %d",
+ /*DEBUG_PRINT ("trigger_on_symbol_inserted (): consuming slist for parent %d",
symbol_id);*/
for (i=0; i < length-1; i++)
@@ -745,7 +747,7 @@
if (parent_symbol_id <= 0)
{
GtkTreeRowReference *curr_tree_row_ref;
-/* DEBUG_PRINT ("prepare_for_adding(): parent_symbol_id <= 0 root with id [%d]",
+ /*DEBUG_PRINT ("prepare_for_adding(): parent_symbol_id <= 0 root with id [%d]",
symbol_id);*/
/* get the current iter row reference in the just added root gtktreeview
@@ -775,7 +777,7 @@
{
/* hey we found it */
GtkTreeRowReference *child_row_ref;
-/* DEBUG_PRINT ("prepare_for_adding(): found node already displayed %d",
+ /*DEBUG_PRINT ("prepare_for_adding(): found node already displayed %d",
parent_symbol_id);*/
child_row_ref = do_add_child_symbol_to_view (dbvl, parent_symbol_id,
@@ -788,7 +790,7 @@
}
else
{
-/* DEBUG_PRINT ("prepare_for_adding(): gonna pass parent: %d name: %s "
+ /*DEBUG_PRINT ("prepare_for_adding(): gonna pass parent: %d name: %s "
"id: %d to add_new_waiting_for", parent_symbol_id,
symbol_name, symbol_id);*/
@@ -817,7 +819,6 @@
tdata = (TraverseData *)data;
- DEBUG_PRINT ("consume_symbols_inserted_queue_idle_destroy");
priv->insertion_idle_handler = 0;
if (g_queue_get_length (priv->symbols_inserted_ids) <= 0)
@@ -833,8 +834,7 @@
/* we have something left. Search the parent_symbol_id [identified by the
* waiting_for id]
- */
- DEBUG_PRINT ("destroying tdata");
+ */
g_tree_foreach (priv->waiting_for, traverse_on_scan_end, tdata);
}
@@ -866,7 +866,7 @@
queue_length = g_queue_get_length (priv->symbols_inserted_ids);
-/* DEBUG_PRINT ("consume_symbols_inserted_queue_idle [remaining %d]", queue_length);*/
+ /*DEBUG_PRINT ("consume_symbols_inserted_queue_idle [remaining %d]...", queue_length);*/
/* consume a symbol */
if (queue_length > 0)
@@ -877,6 +877,8 @@
return FALSE;
}
+ /*DEBUG_PRINT ("processing %d", consumed_symbol_id);*/
+
store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));
/* again we use a little trick to insert symbols here. First of all forget chars
@@ -900,7 +902,9 @@
parent_symbol_id = symbol_db_engine_get_parent_scope_id_by_symbol_id (dbe,
consumed_symbol_id,
NULL);
-
+ /*DEBUG_PRINT ("parent_symbol_id is %d for symbol %d",
+ parent_symbol_id, consumed_symbol_id);*/
+
/* get the original symbol infos */
iterator = symbol_db_engine_get_symbol_info_by_id (dbe, consumed_symbol_id,
SYMINFO_SIMPLE |
@@ -928,13 +932,15 @@
*/
SymbolDBEngineIterator *iterator_for_children;
iterator_for_children =
- symbol_db_engine_get_scope_members_by_symbol_id (dbe, consumed_symbol_id, -1,
+ symbol_db_engine_get_scope_members_by_symbol_id (dbe, consumed_symbol_id,
+ -1,
-1,
SYMINFO_SIMPLE);
if (iterator_for_children == NULL)
{
/* we don't have children */
- /*DEBUG_PRINT ("on_symbol_inserted (): %d has no children.", symbol_id);*/
+ /*DEBUG_PRINT ("on_symbol_inserted (): %d has no children.",
+ consumed_symbol_id);*/
}
else
{
@@ -1000,7 +1006,7 @@
tdata->dbvl = dbvl;
tdata->dbe = dbe;
- DEBUG_PRINT ("locals: on_scan_end");
+ /*DEBUG_PRINT ("locals: on_scan_end");*/
if (priv->symbols_inserted_ids != NULL)
{
if (g_queue_get_length (priv->symbols_inserted_ids) > 0)
@@ -1085,6 +1091,36 @@
do_recurse_subtree_and_remove (dbvl, &iter);
}
+static void
+on_symbol_scope_updated (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
+{
+ GtkTreeStore *store;
+ SymbolDBViewLocals *dbvl;
+ SymbolDBViewLocalsPriv *priv;
+ GtkTreeIter iter;
+ GtkTreeRowReference *row_ref;
+
+ dbvl = SYMBOL_DB_VIEW_LOCALS (data);
+
+ g_return_if_fail (dbvl != NULL);
+ priv = dbvl->priv;
+
+ store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));
+
+ DEBUG_PRINT ("on_symbol_scope_updated () -local- %d", symbol_id);
+ row_ref = g_tree_lookup (priv->nodes_displayed, (gpointer)symbol_id);
+ if (sdb_view_locals_get_iter_from_row_ref (dbvl, row_ref, &iter) == FALSE)
+ {
+ return;
+ }
+#if 1
+ do_recurse_subtree_and_remove (dbvl, &iter);
+
+ /* save the symbol_id to be added in the queue and just return */
+ g_queue_push_head (priv->symbols_inserted_ids, (gpointer)symbol_id);
+#endif
+}
+
static void
on_symbol_inserted (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
{
@@ -1170,6 +1206,12 @@
priv->scan_end_handler = g_signal_connect (G_OBJECT (dbe), "scan-end",
G_CALLBACK (on_scan_end), dbvl);
}
+
+ if (priv->scope_update_handler <= 0)
+ {
+ priv->scope_update_handler = g_signal_connect (G_OBJECT (dbe), "symbol-scope-updated",
+ G_CALLBACK (on_symbol_scope_updated), dbvl);
+ }
}
else /* disconnect them, if they were ever connected before */
{
@@ -1193,6 +1235,12 @@
g_signal_handler_disconnect (G_OBJECT (dbe), priv->scan_end_handler);
priv->scan_end_handler = 0;
}
+
+ if (priv->scope_update_handler >= 0)
+ {
+ g_signal_handler_disconnect (G_OBJECT (dbe), priv->scope_update_handler);
+ priv->scope_update_handler = 0;
+ }
}
}
@@ -1261,7 +1309,8 @@
fss->waiting_for = priv->waiting_for;
fss->symbols_inserted_ids = priv->symbols_inserted_ids;
- DEBUG_PRINT ("symbol_db_view_locals_update_list (): g_hash_table_insert ");
+ /*DEBUG_PRINT ("symbol_db_view_locals_update_list (): "
+ "g_hash_table_insert ");*/
/* insert it */
g_hash_table_insert (priv->files_view_status,
g_strdup (priv->current_db_file), fss);
@@ -1281,8 +1330,8 @@
symbol_db_engine_get_file_db_path (dbe, filepath);
if (priv->current_db_file == NULL)
{
- DEBUG_PRINT ("symbol_db_view_locals_update_list (): "
- "Warning: priv->current_db_file is NULL");
+ /*DEBUG_PRINT ("symbol_db_view_locals_update_list (): "
+ "Warning: priv->current_db_file is NULL");*/
return;
}
priv->current_local_file_path = g_strdup (filepath);
@@ -1310,8 +1359,8 @@
/* with this set there's no need to re-retrieve the symbols from db,
* speeding up the things.
*/
- DEBUG_PRINT ("symbol_db_view_locals_update_list (): "
- "setting gtk_tree_view_set_model to the saved one");
+ /*DEBUG_PRINT ("symbol_db_view_locals_update_list (): "
+ "setting gtk_tree_view_set_model to the saved one");*/
gtk_tree_view_set_model (GTK_TREE_VIEW (dbvl), GTK_TREE_MODEL (store));
@@ -1344,7 +1393,7 @@
priv->symbols_inserted_ids = g_queue_new ();
- DEBUG_PRINT ("symbol_db_view_locals_update_list (): creating new store");
+ /*DEBUG_PRINT ("symbol_db_view_locals_update_list (): creating new store"); */
store = sdb_view_locals_create_new_store ();
gtk_tree_view_set_model (GTK_TREE_VIEW (dbvl), GTK_TREE_MODEL (store));
Modified: trunk/plugins/symbol-db/tables.sql
==============================================================================
--- trunk/plugins/symbol-db/tables.sql (original)
+++ trunk/plugins/symbol-db/tables.sql Mon Aug 18 07:49:10 2008
@@ -102,6 +102,8 @@
CREATE INDEX symbol_idx_2 ON symbol (name, file_defined_id, file_position);
+CREATE INDEX symbol_idx_3 ON symbol (name, file_defined_id, type_id);
+
CREATE INDEX scope_idx_1 ON scope (scope_name);
CREATE INDEX scope_idx_2 ON scope (scope_name, type_id);
@@ -115,14 +117,15 @@
CREATE TRIGGER delete_file_trg BEFORE DELETE ON file
FOR EACH ROW
BEGIN
- DELETE FROM symbol WHERE file_defined_id = (SELECT file_id FROM file WHERE file_path = old.file_path);
+ DELETE FROM symbol WHERE file_defined_id = (SELECT file_id FROM file WHERE file_path=old.file_path);
END;
CREATE TRIGGER delete_symbol_trg BEFORE DELETE ON symbol
FOR EACH ROW
BEGIN
DELETE FROM scope WHERE scope.scope_id=old.scope_definition_id;
- DELETE FROM sym_type WHERE sym_type.type_id=old.type_id;
+ DELETE FROM sym_type WHERE sym_type.type_id=old.type_id AND (SELECT COUNT(*)
+ FROM symbol WHERE symbol.type_id=old.type_id) <= 1;
UPDATE symbol SET scope_id='-1' WHERE symbol.scope_id=old.scope_definition_id AND symbol.scope_id > 0;
INSERT INTO __tmp_removed (symbol_removed_id) VALUES (old.symbol_id);
END;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]