anjuta r4144 - in trunk: . plugins/build-basic-autotools plugins/symbol-db
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4144 - in trunk: . plugins/build-basic-autotools plugins/symbol-db
- Date: Sat, 16 Aug 2008 09:15:29 +0000 (UTC)
Author: jhs
Date: Sat Aug 16 09:15:29 2008
New Revision: 4144
URL: http://svn.gnome.org/viewvc/anjuta?rev=4144&view=rev
Log:
2008-08-16 Massimo Cora\' <maxcvs email it>
* plugins/symbol-db/plugin.c (on_system_scan_package_start),
(do_import_system_src_after_abort), (on_project_root_added),
(symbol_db_activate), (symbol_db_deactivate),
(isymbol_manager_search):
disconnected signals and re-enabled do_import_system_src_after_abort ().
* plugins/symbol-db/symbol-db-engine.c
(sdb_engine_get_dyn_query_node_by_id),
(sdb_engine_insert_dyn_query_node_by_id),
(sdb_engine_free_cached_queries),
(sdb_engine_free_cached_dynamic_queries),
(sdb_engine_disconnect_from_db), (sdb_engine_init),
(symbol_db_engine_new), (symbol_db_engine_open_db),
(symbol_db_engine_add_new_files),
(symbol_db_engine_get_global_members_filtered),
(symbol_db_engine_get_scope_members_by_symbol_id_filtered),
(symbol_db_engine_get_file_symbols),
(symbol_db_engine_get_parent_scope_id_by_symbol_id),
(symbol_db_engine_find_symbol_by_name_pattern_filtered):
test: removed mutex (actually set it to NULL). Libgda rev 3186 have
sqlite 3.6.0beta compiled inside, which has thread support. More: GdaLockable
interface has been written and implemented for GdaConnection and GdaSqlParser.
Actually symbol-db-engine works without mutexes, but before removing all the
code associated this need some more wide tests.
Completed implementation of searching symbols through session-enabled packages.
A new feature on dynamic queries permits to filter up to 255 symbol kinds
and up to 255 session packages. Was used a internal integer mapping.
* plugins/symbol-db/symbol-db-engine.h:
* plugins/symbol-db/symbol-db-system.c
(on_engine_package_single_file_scan_end), (sdb_system_finalize),
(sdb_system_do_engine_scan), (on_pkg_config_exit):
* plugins/symbol-db/symbol-db-view-locals.c
(sdb_view_locals_create_new_store):
* plugins/symbol-db/symbol-db-view-locals.h:
* plugins/symbol-db/symbol-db-view-search.c
(sdb_view_search_dispose):
disconnected signals
Modified:
trunk/ChangeLog
trunk/plugins/build-basic-autotools/plugin.c
trunk/plugins/symbol-db/plugin.c
trunk/plugins/symbol-db/symbol-db-engine.c
trunk/plugins/symbol-db/symbol-db-engine.h
trunk/plugins/symbol-db/symbol-db-system.c
trunk/plugins/symbol-db/symbol-db-view-locals.c
trunk/plugins/symbol-db/symbol-db-view-locals.h
trunk/plugins/symbol-db/symbol-db-view-search.c
Modified: trunk/plugins/build-basic-autotools/plugin.c
==============================================================================
--- trunk/plugins/build-basic-autotools/plugin.c (original)
+++ trunk/plugins/build-basic-autotools/plugin.c Sat Aug 16 09:15:29 2008
@@ -693,7 +693,7 @@
0,
&match_info);
if (matched) break;
- g_match_info_free (match_info);
+ g_match_info_free (match_info);
}
if (matched)
{
Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c (original)
+++ trunk/plugins/symbol-db/plugin.c Sat Aug 16 09:15:29 2008
@@ -736,7 +736,6 @@
/* show the global bar */
gtk_widget_show (sdb_plugin->progress_bar_system);
-
if (sdb_plugin->current_scanned_package != NULL)
g_free (sdb_plugin->current_scanned_package);
sdb_plugin->current_scanned_package = g_strdup (package);
@@ -863,7 +862,6 @@
do_import_system_src_after_abort (AnjutaPlugin *plugin,
const GPtrArray *sources_array)
{
-#if 0
SymbolDBPlugin *sdb_plugin;
GPtrArray* languages_array = NULL;
GPtrArray *to_scan_array = NULL;
@@ -922,7 +920,6 @@
/* no need to free the GPtrArray, Huston. They'll be auto-destroyed in that
* function
*/
-#endif
}
/* we assume that sources_array has already unique elements */
@@ -1168,6 +1165,7 @@
/* FIXME: where's the project name itself? */
DEBUG_PRINT ("FIXME: where's the project name itself? ");
sdb_plugin->project_opened = g_strdup (root_dir);
+ DEBUG_PRINT ("FIXME: setting project opened to %s", root_dir);
if (root_dir)
{
@@ -1367,11 +1365,22 @@
*/
symbol_db->session_packages = NULL;
+ DEBUG_PRINT ("SymbolDBPlugin: Initializing engines with %s", ctags_path);
/* create SymbolDBEngine(s) */
symbol_db->sdbe_project = symbol_db_engine_new (ctags_path);
-
+ if (symbol_db->sdbe_project == NULL)
+ {
+ g_critical ("sdbe_project == NULL");
+ return FALSE;
+ }
+
/* the globals one too */
symbol_db->sdbe_globals = symbol_db_engine_new (ctags_path);
+ if (symbol_db->sdbe_globals == NULL)
+ {
+ g_critical ("sdbe_globals == NULL");
+ return FALSE;
+ }
g_free (ctags_path);
@@ -1538,14 +1547,63 @@
sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
DEBUG_PRINT ("SymbolDBPlugin: Dectivating SymbolDBPlugin plugin ...");
- DEBUG_PRINT ("SymbolDBPlugin: destroying engine ...");
- g_object_unref (sdb_plugin->sdbe_project);
+
+ /* disconnect some signals */
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree_locals),
+ on_local_treeview_row_activated,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree_search),
+ on_treesearch_symbol_selected_event,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->shell),
+ on_session_load,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->shell),
+ on_session_save,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree),
+ on_global_treeview_row_activated,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree),
+ on_global_treeview_row_expanded,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree),
+ on_global_treeview_row_collapsed,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree_locals),
+ on_local_treeview_row_activated,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->sdbs),
+ on_system_scan_package_start,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->sdbs),
+ on_system_scan_package_end,
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->sdbs),
+ on_system_single_file_scan_end,
+ plugin);
+
+ /* destroy objects */
+ if (sdb_plugin->sdbe_project)
+ g_object_unref (sdb_plugin->sdbe_project);
sdb_plugin->sdbe_project = NULL;
/* this must be done *bedore* destroying sdbe_globals */
g_object_unref (sdb_plugin->sdbs);
sdb_plugin->sdbs = NULL;
+
g_free (sdb_plugin->current_scanned_package);
+ sdb_plugin->current_scanned_package = NULL;
g_object_unref (sdb_plugin->sdbe_globals);
sdb_plugin->sdbe_globals = NULL;
@@ -1560,15 +1618,6 @@
sdb_plugin->session_packages = NULL;
}
- /* disconnect some signals */
- g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree_locals),
- on_local_treeview_row_activated,
- plugin);
-
- g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree_search),
- on_treesearch_symbol_selected_event,
- plugin);
-
/* Ensure all editor cached info are released */
if (sdb_plugin->editor_connected)
{
@@ -1694,7 +1743,7 @@
filter_array,
include_types,
global_symbols_search,
- NULL,
+ global_tags_search == FALSE ? NULL : sdb_plugin->session_packages,
results_limit,
results_offset,
info_fields);
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 Sat Aug 16 09:15:29 2008
@@ -230,7 +230,28 @@
} dyn_query_type;
-
+/**
+ * dyn_query_node's possible structures
+ *
+ * sym_extra_info_gtree with has_gtree_child = FALSE
+ * |
+ * ... +-------+-------+ ...
+ * | | | <======== keys = sym_info
+ * CDQN CDQN CDQN values = ChildDynQueryNode
+ *
+ *
+ *
+ * sym_extra_info_gtree with has_gtree_child = TRUE
+ * |
+ * ... +-------+-------+ ...
+ * | | | <======== keys = sym_info, values = GTree
+ * GTree GTree GTree
+ * / | \ | | <======== keys = other_parameters, values = ChildDynQueryNode
+ * / | \ ... ...
+ * CDQN CDQN CDQN
+ *
+ *
+ */
typedef struct _dyn_query_node {
dyn_query_type dyn_query_id;
GTree * sym_extra_info_gtree;
@@ -340,7 +361,6 @@
int file_defined_id,
gboolean sym_update);
-
static inline gint
sdb_engine_cache_lookup (GHashTable* hash_table, const gchar* lookup)
{
@@ -563,16 +583,15 @@
}
else {
GTree *child_gtree;
-
+ DynChildQueryNode *result;
+
child_gtree = g_tree_lookup (node->sym_extra_info_gtree, (gpointer)sym_info);
- if (child_gtree == NULL) {
- DEBUG_PRINT ("child_gtree is null");
+ if (child_gtree == NULL)
+ {
return NULL;
}
- DynChildQueryNode *result;
- result = g_tree_lookup (child_gtree, (gpointer)other_parameters);
-
+ result = g_tree_lookup (child_gtree, (gpointer)other_parameters);
return result;
}
}
@@ -627,7 +646,8 @@
}
else
{
- node->sym_extra_info_gtree = g_tree_new_full ((GCompareDataFunc)>ree_compare_func,
+ node->sym_extra_info_gtree =
+ g_tree_new_full ((GCompareDataFunc)>ree_compare_func,
NULL,
NULL,
(GDestroyNotify)g_tree_destroy);
@@ -663,7 +683,8 @@
/* return it */
return dyn_node;
}
- else {
+ else
+ {
/* ok, this is a slightly more complex case */
GTree *child_gtree;
DynChildQueryNode *dyn_node;
@@ -699,8 +720,7 @@
/* return it */
return dyn_node;
- }
-
+ }
}
/**
@@ -747,6 +767,10 @@
g_object_unref (node->plist);
node->plist = NULL;
}
+
+ /* last but not the least free the node itself */
+ g_free (node);
+ priv->static_query_list[i] = NULL;
}
}
@@ -762,13 +786,16 @@
for (i = 0; i < DYN_PREP_QUERY_COUNT; i++)
{
node = priv->dyn_query_list[i];
-
if (node != NULL && node->sym_extra_info_gtree != NULL)
- {
- g_object_unref (node->sym_extra_info_gtree );
+ {
+ g_tree_destroy (node->sym_extra_info_gtree);
node->sym_extra_info_gtree = NULL;
}
+
+ /* last but not the least free the node itself */
+ g_free (node);
+ priv->dyn_query_list[i] = NULL;
}
}
@@ -786,6 +813,7 @@
if (priv->sql_parser != NULL)
g_object_unref (priv->sql_parser);
+ priv->sql_parser = NULL;
g_free (priv->db_directory);
priv->db_directory = NULL;
@@ -1914,19 +1942,19 @@
PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID_BY_SYMBOL_ID,
"SELECT symbol.scope_definition_id FROM symbol WHERE "
"file_defined_id = (SELECT file_defined_id FROM symbol WHERE symbol_id = "
- "/* name:'scopedsymid' type:gint */) "
+ "## /* name:'scopedsymid' type:gint */) "
"AND file_position < (SELECT file_position FROM symbol WHERE symbol_id = "
- "/* name:'scopedsymid' type:gint */) "
+ "## /* name:'scopedsymid' type:gint */) "
"ORDER BY file_position DESC");
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
PREP_QUERY_GET_SCOPE_DEFINITION_ID_BY_WALK_DOWN_SCOPE_PATH,
"SELECT scope_definition_id FROM symbol "
- "WHERE scope_id = /* name:'scopeid' type:gint */ AND scope_definition_id = ("
+ "WHERE scope_id = ## /* name:'scopeid' type:gint */ AND scope_definition_id = ("
"SELECT scope.scope_id FROM scope "
"INNER JOIN sym_type ON scope.type_id = sym_type.type_id "
- "WHERE sym_type.type_type = /* name:'symtype' type:gchararray */ "
- "AND scope.scope_name = /* name:'scopename' type:gchararray */) LIMIT 1");
+ "WHERE sym_type.type_type = ## /* name:'symtype' type:gchararray */ "
+ "AND scope.scope_name = ## /* name:'scopename' type:gchararray */) LIMIT 1");
/* -- tmp heritage -- */
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
@@ -2109,13 +2137,13 @@
dbe = SYMBOL_DB_ENGINE (object);
priv = dbe->priv;
-
+
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);
+
sdb_engine_disconnect_from_db (dbe);
sdb_engine_free_cached_queries (dbe);
sdb_engine_free_cached_dynamic_queries (dbe);
@@ -2330,8 +2358,12 @@
sdbe = g_object_new (SYMBOL_TYPE_DB_ENGINE, NULL);
priv = sdbe->priv;
- priv->mutex = g_mutex_new ();
+ // FIXME
+ //priv->mutex = g_mutex_new ();
+ // FIXME
+ priv->mutex = NULL;
+
/* set the mandatory ctags_path */
symbol_db_engine_set_ctags_path (sdbe, ctags_path);
@@ -2537,6 +2569,9 @@
gboolean needs_tables_creation = FALSE;
gchar *cnc_string;
+ DEBUG_PRINT ("SymbolDBEngine: opening project %s with base dir %s",
+ prj_directory, base_db_path);
+
g_return_val_if_fail (dbe != NULL, FALSE);
g_return_val_if_fail (base_db_path != NULL, FALSE);
@@ -2562,15 +2597,6 @@
cnc_string = g_strdup_printf ("DB_DIR=%s;DB_NAME=%s", base_db_path,
ANJUTA_DB_FILE);
-/*
- FIXME: do we really need to save the datasource?
- if (gda_config_save_data_source (base_db_path, "SQLite",
- cnc_string, "Anjuta Project",
- "", "", FALSE) == FALSE)
- {
- return FALSE;
- }
-*/
DEBUG_PRINT ("symbol_db_engine_open_db (): opening/connecting to database...");
sdb_engine_connect_to_db (dbe, cnc_string);
@@ -2996,8 +3022,9 @@
GPtrArray * filtered_files_path;
GPtrArray * filtered_languages;
gboolean ret_code;
+
g_return_val_if_fail (dbe != NULL, FALSE);
- g_return_val_if_fail (project_name != NULL, FALSE);
+/* g_return_val_if_fail (project_name != NULL, FALSE);*/
g_return_val_if_fail (files_path != NULL, FALSE);
g_return_val_if_fail (languages != NULL, FALSE);
priv = dbe->priv;
@@ -6066,20 +6093,27 @@
/**
- * A maximum of 5 filter_kinds are admitted.
- */
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_LIMIT 1
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_OFFSET 2
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_YES 4
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_NO 8
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES 16
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO 32
+ * Personalized GTree mapping:
+ * Considering that a gint on a x86 is 4 bytes: we'll reserve:
+ * 3 bytes to map the main parameters.
+ * 1 byte is for filter_kinds number, so you'll be able to filter up to 255 parameters.
+ * |--------------------------------|-------------|
+ * main parameters [3 bytes] extra [1 byte]
+ */
+#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_LIMIT 0x0100
+#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_OFFSET 0x0200
+#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_YES 0x0400
+#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_NO 0x0800
+#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES 0x1000
+#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO 0x2000
SymbolDBEngineIterator *
symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe,
const GPtrArray *filter_kinds,
- gboolean include_kinds, gboolean group_them,
- gint results_limit, gint results_offset,
+ gboolean include_kinds,
+ gboolean group_them,
+ gint results_limit,
+ gint results_offset,
SymExtraInfo sym_info)
{
SymbolDBEnginePriv *priv;
@@ -6137,7 +6171,10 @@
offset_free = TRUE;
}
- if (filter_kinds == NULL)
+ /* test if user gave an array with more than 255 filter_kinds. In that case
+ * we'll not be able to save/handle it, so consider it as a NULL array
+ */
+ if (filter_kinds == NULL || filter_kinds->len > 255 || filter_kinds->len <= 0)
{
if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_GET_CLASS_PARENTS, sym_info,
@@ -6175,28 +6212,25 @@
}
else
{
- filter_str = g_string_new ("");
- /* build filter string */
- gint i;
if (include_kinds == TRUE)
{
other_parameters |=
DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES;
- filter_str = g_string_append (filter_str ,
- "AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
}
else
{
other_parameters |=
DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO;
- filter_str = g_string_append (filter_str ,
- "AND sym_kind.kind_name NOT IN (## /* name:'filter0' type:gchararray */");
}
-
+
+ /* set the number of parameters in the less important byte */
+ other_parameters |= filter_kinds->len;
+
if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_GET_CLASS_PARENTS, sym_info,
other_parameters)) == NULL)
- {
+ {
+ gint i;
/* info_data contains the stuff after SELECT and befor FROM */
info_data = g_string_new ("");
@@ -6208,13 +6242,27 @@
/* fill info_data and join data with optional sql */
sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
- for (i = 1; i < 5; i++)
+ /* prepare the dynamic filter string before the final query */
+ filter_str = g_string_new ("");
+
+ if (include_kinds == TRUE)
+ {
+ filter_str = g_string_append (filter_str ,
+ "AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
+ }
+ 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);
}
filter_str = g_string_append (filter_str , ")");
-
+
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, "
@@ -6229,13 +6277,12 @@
sym_info, other_parameters,
query_str);
- g_free (query_str);
+ g_free (query_str);
g_string_free (join_data, TRUE);
- g_string_free (info_data, TRUE);
- }
- g_string_free (filter_str, TRUE);
- }
-
+ g_string_free (info_data, TRUE);
+ g_string_free (filter_str, TRUE);
+ }
+ }
if (limit_free)
g_free (limit);
@@ -6286,36 +6333,15 @@
if (other_parameters & DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES ||
other_parameters & DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO)
{
- /* bad hardcode but it saves strings alloc/dealloc. */
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter0");
- if (filter_kinds->len > 0)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter1");
- if (filter_kinds->len > 1)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 1));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter2");
- if (filter_kinds->len > 2)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 2));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter3");
- if (filter_kinds->len > 3)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 3));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter4");
- if (filter_kinds->len > 4)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 4));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
- }
-
+ gint i;
+ for (i = 0; i < filter_kinds->len; i++)
+ {
+ gchar *curr_str = g_strdup_printf ("filter%d", i);
+ param = gda_set_get_holder ((GdaSet*)dyn_node->plist, curr_str);
+ gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, i));
+ g_free (curr_str);
+ }
+ }
/* execute the query with parametes just set */
data = gda_connection_statement_execute_select (priv->db_connection,
@@ -6347,11 +6373,19 @@
* @param filter_kinds cannot be NULL.
* @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
* @param results_offset Skip results_offset results. -1 If you don't want to use this par.
- */
-#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_LIMIT 1
-#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_OFFSET 2
-#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES 4
-#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO 8
+ *
+ *
+ * Personalized GTree mapping:
+ * Considering that a gint on a x86 is 4 bytes: we'll reserve:
+ * 3 bytes to map the main parameters.
+ * 1 byte is for filter_kinds number, so you'll be able to filter up to 255 parameters.
+ * |--------------------------------|-------------|
+ * main parameters [3 bytes] extra [1 byte]
+ */
+#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_LIMIT 0x0100
+#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_OFFSET 0x0200
+#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES 0x0400
+#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO 0x0800
SymbolDBEngineIterator *
symbol_db_engine_get_scope_members_by_symbol_id_filtered (SymbolDBEngine *dbe,
@@ -6412,30 +6446,35 @@
other_parameters |=
DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_OFFSET;
}
-
- filter_str = g_string_new ("");
+
/* build filter string */
- gint i;
if (include_kinds == TRUE)
{
other_parameters |=
DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES;
- filter_str = g_string_append (filter_str ,
- "AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
}
else
{
other_parameters |=
DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO;
- filter_str = g_string_append (filter_str ,
- "AND sym_kind.kind_name NOT IN (## /* name:'filter0' type:gchararray */");
}
-
+
+ /* we'll take into consideration the number of filter_kinds only it the number
+ * is fillable in a byte.
+ */
+ if (filter_kinds != NULL && filter_kinds->len < 255
+ && filter_kinds->len > 0)
+ {
+ /* set the number of parameters in the less important byte */
+ other_parameters |= filter_kinds->len;
+ }
if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED, sym_info,
other_parameters)) == NULL)
- {
+ {
+ gint i;
+
/* info_data contains the stuff after SELECT and befor FROM */
info_data = g_string_new ("");
@@ -6446,14 +6485,26 @@
/* fill info_data and join data with optional sql */
sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
+
+ filter_str = g_string_new ("");
+ if (include_kinds == TRUE)
+ {
+ filter_str = g_string_append (filter_str ,
+ "AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
+ }
+ else
+ {
+ filter_str = g_string_append (filter_str ,
+ "AND sym_kind.kind_name NOT IN (## /* name:'filter0' type:gchararray */");
+ }
- for (i = 1; i < 5; 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 , ")");
-
+
/* ok, beware that we use an 'alias hack' to accomplish compatibility with
* sdb_engine_prepare_symbol_info_sql () function. In particular we called
* the first joining table 'a', the second one 'symbol', where there is the info we
@@ -6479,9 +6530,8 @@
g_free (query_str);
g_string_free (join_data, TRUE);
g_string_free (info_data, TRUE);
- }
-
- g_string_free (filter_str, TRUE);
+ g_string_free (filter_str, TRUE);
+ }
if (limit_free)
g_free (limit);
@@ -6533,37 +6583,16 @@
other_parameters &
DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO)
{
- /* bad hardcode but it saves strings alloc/dealloc. */
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter0");
- if (filter_kinds->len > 0)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter1");
- if (filter_kinds->len > 1)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 1));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter2");
- if (filter_kinds->len > 2)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 2));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter3");
- if (filter_kinds->len > 3)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 3));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter4");
- if (filter_kinds->len > 4)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 4));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
+ gint i;
+ for (i = 0; i < filter_kinds->len; i++)
+ {
+ gchar *curr_str = g_strdup_printf ("filter%d", i);
+ param = gda_set_get_holder ((GdaSet*)dyn_node->plist, curr_str);
+ gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, i));
+ g_free (curr_str);
+ }
}
-
GValue *value;
if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "scopeparentsymid")) == NULL)
{
@@ -7048,7 +7077,8 @@
*/
SymbolDBEngineIterator *
symbol_db_engine_get_file_symbols (SymbolDBEngine *dbe,
- const gchar *file_path, SymExtraInfo sym_info)
+ const gchar *file_path,
+ SymExtraInfo sym_info)
{
SymbolDBEnginePriv *priv;
gchar *query_str;
@@ -7518,7 +7548,7 @@
/* step 2 */
if ((stmt2 = sdb_engine_get_statement_by_query_id (dbe,
- PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID_NO_FILE)) == NULL)
+ PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID_BY_SYMBOL_ID)) == NULL)
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
@@ -7526,7 +7556,7 @@
}
plist = sdb_engine_get_query_parameters_list (dbe,
- PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID_NO_FILE);
+ PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID_BY_SYMBOL_ID);
/* scoped symbol id */
if ((param = gda_set_get_holder ((GdaSet*)plist, "scopedsymid")) == NULL)
@@ -7628,17 +7658,24 @@
* @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
* @param results_offset Skip results_offset results. -1 If you don't want to use this par.
* @param sym_info Infos about symbols you want to know.
- */
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_YES 1
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_NO 2
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES 4
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO 8
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_YES 16
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_NO 32
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_LIMIT 64
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_OFFSET 128
+ *
+ * Personalized GTree mapping:
+ * Considering that a gint on a x86 is 4 bytes: we'll reserve:
+ * 2 bytes to map the main parameters.
+ * 1 byte is for session number.
+ * 1 byte is for filter_kinds number, so you'll be able to filter up to 255 parameters.
+ * |--------------------------|-------------|-------------|
+ * main parameters [2 bytes] sessions [1] filter [1]
+ */
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_YES 0x010000
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_NO 0x020000
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES 0x040000
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO 0x080000
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_YES 0x100000
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_NO 0x200000
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_LIMIT 0x400000
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_OFFSET 0x800000
-// FIXME handle session_projects
SymbolDBEngineIterator *
symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
const gchar *pattern,
@@ -7730,13 +7767,31 @@
offset = g_strdup_printf ("OFFSET ## /* name:'offset' type:gint */");
offset_free = TRUE;
}
+
+ if (session_projects != NULL)
+ {
+ gint list_length = g_list_length (session_projects);
+ if (list_length < 255 && list_length > 0)
+ {
+ /* shift the bits. We want to put the result on the third byte */
+ list_length <<= 8;
+ other_parameters |= list_length;
+ }
+ else
+ {
+ g_warning ("symbol_db_engine_find_symbol_by_name_pattern_filtered (): "
+ "session_projects has 0 length.");
+ }
+ }
- if (filter_kinds == NULL)
+ if (filter_kinds == NULL || filter_kinds->len > 255 || filter_kinds->len <= 0)
{
if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED, sym_info,
other_parameters)) == NULL)
{
+ gint i;
+ GString *filter_projects;
/* info_data contains the stuff after SELECT and befor FROM */
info_data = g_string_new ("");
@@ -7744,10 +7799,28 @@
* tables.
*/
join_data = g_string_new ("");
-
/* fill info_data and join data with optional sql */
sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
+
+ /* build session projects filter string */
+ filter_projects = g_string_new ("");
+ if (session_projects != NULL)
+ {
+ filter_projects = g_string_append (filter_projects,
+ "AND symbol.file_defined_id IN "
+ "(SELECT file.file_id FROM file JOIN project ON file.prj_id = "
+ "project.project_id WHERE project.project_name IN ( "
+ "## /* name:'prj_filter0' type:gchararray */");
+
+ for (i = 1; i < g_list_length (session_projects); i++)
+ {
+ g_string_append_printf (filter_projects,
+ ",## /* name:'prj_filter%d' type:gchararray */", i);
+ }
+ }
+ 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, "
@@ -7755,8 +7828,9 @@
"sym_kind.kind_name AS kind_name "
"%s FROM symbol %s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
"WHERE symbol.name %s AND symbol.is_file_scope = "
- "## /* name:'globalsearch' type:gint */ %s %s",
- info_data->str, join_data->str, match_str, limit, offset);
+ "## /* name:'globalsearch' type:gint */ %s %s %s",
+ info_data->str, join_data->str, match_str, filter_projects->str,
+ limit, offset);
dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED,
@@ -7766,77 +7840,104 @@
g_free (query_str);
g_string_free (info_data, TRUE);
g_string_free (join_data, TRUE);
+ g_string_free (filter_projects, TRUE);
}
}
else
- {
- filter_str = g_string_new ("");
- /* build filter string */
- if (filter_kinds->len > 0)
+ {
+ if (include_kinds == TRUE)
{
+ other_parameters |=
+ DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES;
+ }
+ else
+ {
+ other_parameters |=
+ DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO;
+ }
+
+ /* set the number of parameters in the less important byte */
+ other_parameters |= filter_kinds->len;
+
+ if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
+ DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED, sym_info,
+ other_parameters)) == NULL)
+ {
+ gint i;
+ GString *filter_projects;
+
+ /* info_data contains the stuff after SELECT and before FROM */
+ info_data = g_string_new ("");
+
+ /* join_data contains the optionals joins to do to retrieve new
+ * data on other tables.
+ */
+ join_data = g_string_new ("");
+
+ /* fill info_data and join data with optional sql */
+ sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
+ /* prepare the dynamic filter string before the final query */
+ filter_str = g_string_new ("");
+
if (include_kinds == TRUE)
- {
- other_parameters |=
- DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES;
-
- filter_str = g_string_append (filter_str,
- "AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
+ {
+ filter_str = g_string_append (filter_str ,
+ "AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
}
else
{
- other_parameters |=
- DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO;
-
- filter_str = g_string_append (filter_str,
+ 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);
}
+ filter_str = g_string_append (filter_str , ")");
- if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED, sym_info,
- other_parameters)) == NULL)
- {
- gint i;
- /* info_data contains the stuff after SELECT and before FROM */
- info_data = g_string_new ("");
-
- /* join_data contains the optionals joins to do to retrieve new
- * data on other tables.
- */
- join_data = g_string_new ("");
-
- /* fill info_data and join data with optional sql */
- sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
+
+ /* build session projects filter string */
+ filter_projects = g_string_new ("");
+ if (session_projects != NULL)
+ {
+ filter_projects = g_string_append (filter_projects,
+ "AND symbol.file_defined_id IN "
+ "(SELECT file.file_id FROM file JOIN project ON file.prj_id = "
+ "project.project_id WHERE project.project_name IN ( "
+ "## /* name:'prj_filter0' type:gchararray */");
- for (i = 1; i < 5; i++)
+ for (i = 1; i < g_list_length (session_projects); i++)
{
- g_string_append_printf (filter_str ,
- ",## /* name:'filter%d' type:gchararray */", i);
- }
- filter_str = g_string_append (filter_str , ")");
-
- 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, "
- "sym_kind.kind_name AS kind_name "
- "%s FROM symbol %s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
- "WHERE symbol.name %s AND symbol.is_file_scope = "
- "## /* name:'globalsearch' type:gint */ %s GROUP BY symbol.name %s %s",
- info_data->str, join_data->str, match_str,
- filter_str->str, limit, offset);
-
- dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED,
- sym_info, other_parameters,
- query_str);
-
- g_free (query_str);
- g_string_free (info_data, TRUE);
- g_string_free (join_data, TRUE);
+ g_string_append_printf (filter_projects,
+ ",## /* name:'prj_filter%d' type:gchararray */", i);
+ }
}
+ 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, "
+ "symbol.is_file_scope AS is_file_scope, symbol.signature AS signature, "
+ "sym_kind.kind_name AS kind_name "
+ "%s FROM symbol %s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
+ "WHERE symbol.name %s AND symbol.is_file_scope = "
+ "## /* name:'globalsearch' type:gint */ %s %s GROUP BY symbol.name %s %s",
+ info_data->str, join_data->str, match_str,
+ filter_str->str, filter_projects->str, limit, offset);
+
+ dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
+ DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED,
+ sym_info, other_parameters,
+ query_str);
+ g_free (query_str);
+ g_string_free (info_data, TRUE);
+ g_string_free (join_data, TRUE);
+ g_string_free (filter_str, TRUE);
+ g_string_free (filter_projects, TRUE);
}
-
- g_string_free (filter_str, TRUE);
- }
+ }
+
if (limit_free)
g_free (limit);
@@ -7883,39 +7984,38 @@
gda_value_free (value);
}
+ /* fill parameters for filter kinds */
if (other_parameters & DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES ||
other_parameters & DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO)
{
- /* bad hardcode but it saves strings alloc/dealloc. */
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter0");
- if (filter_kinds->len > 0)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter1");
- if (filter_kinds->len > 1)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 1));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter2");
- if (filter_kinds->len > 2)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 2));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter3");
- if (filter_kinds->len > 3)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 3));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
-
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filter4");
- if (filter_kinds->len > 4)
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 4));
- else
- gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, 0));
+ gint i;
+ for (i = 0; i < filter_kinds->len; i++)
+ {
+ gchar *curr_str = g_strdup_printf ("filter%d", i);
+ param = gda_set_get_holder ((GdaSet*)dyn_node->plist, curr_str);
+ gda_holder_set_value_str (param, NULL, g_ptr_array_index (filter_kinds, i));
+ g_free (curr_str);
+ }
}
+ /* fill parameters for filter projects (packages) */
+ if (session_projects != NULL)
+ {
+ gint i = 0;
+ GList *item;
+ item = session_projects;
+ while (item != NULL)
+ {
+ gchar *curr_str = g_strdup_printf ("prj_filter%d", i);
+ param = gda_set_get_holder ((GdaSet*)dyn_node->plist, curr_str);
+ gda_holder_set_value_str (param, NULL, item->data);
+ g_free (curr_str);
+
+ item = item->next;
+ i++;
+ }
+ }
+
if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "globalsearch")) == NULL)
{
if (priv->mutex)
@@ -7938,7 +8038,7 @@
gda_holder_set_value_str (param, NULL, pattern);
-/* DEBUG_PRINT ("symbol_db_engine_find_symbol_by_name_pattern_filtered query: %s",
+ /*DEBUG_PRINT ("symbol_db_engine_find_symbol_by_name_pattern_filtered query: %s",
dyn_node->query_str);*/
/* execute the query with parametes just set */
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 Sat Aug 16 09:15:29 2008
@@ -169,6 +169,8 @@
* for example when you're populating after abort.
* @param project_directory something like the base path '/home/user/projects/foo_project/'
* Be sure not to exchange the db_directory with project_directory! they're different!
+ * It can be NULL but ONLY if you're doing an 'import_after_abort' scan, i.e.
+ * files entries have already a connection with the parent project.
* @param files_path requires full path to files on disk. Ctags itself requires that.
* it must be something like "/home/path/to/my/foo/file.xyz". Also it requires
* a language string to represent the file.
Modified: trunk/plugins/symbol-db/symbol-db-system.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-system.c (original)
+++ trunk/plugins/symbol-db/symbol-db-system.c Sat Aug 16 09:15:29 2008
@@ -119,6 +119,15 @@
g_free (es_data);
}
+static void
+on_engine_package_single_file_scan_end (SymbolDBEngine *dbe, gpointer user_data)
+{
+ SymbolDBSystem *sdbs;
+
+ sdbs = SYMBOL_DB_SYSTEM (user_data);
+
+ g_signal_emit (sdbs, signals[SINGLE_FILE_SCAN_END], 0);
+}
static void
sdb_system_init (SymbolDBSystem *object)
@@ -160,7 +169,11 @@
priv->sscan_queue = NULL;
/* FIXME: missing engine queue */
- /* FIXME: disconnect signals */
+ /* disconnect signals */
+ g_signal_handlers_disconnect_by_func (G_OBJECT (priv->sdbe_globals),
+ on_engine_package_single_file_scan_end,
+ sdbs);
+
G_OBJECT_CLASS (sdb_system_parent_class)->finalize (object);
@@ -242,15 +255,6 @@
return good_flags;
}
-static void
-on_engine_package_single_file_scan_end (SymbolDBEngine *dbe, gpointer user_data)
-{
- SymbolDBSystem *sdbs;
-
- sdbs = SYMBOL_DB_SYSTEM (user_data);
-
- g_signal_emit (sdbs, signals[SINGLE_FILE_SCAN_END], 0);
-}
SymbolDBSystem *
symbol_db_system_new (SymbolDBPlugin *sdb_plugin,
@@ -437,7 +441,8 @@
GPtrArray *languages_array;
priv = sdbs->priv;
-
+
+ /* will be disconnected automatically when callback is called. */
g_signal_connect (G_OBJECT (priv->sdbe_globals), "scan-end",
G_CALLBACK (on_engine_package_scan_end), es_data);
@@ -649,6 +654,7 @@
else
{
/* push the tail to signal a 'working engine' */
+ DEBUG_PRINT ("scanning with engine queue %s", es_data->package_name);
g_queue_push_tail (priv->engine_queue, es_data);
sdb_system_do_engine_scan (sdbs, es_data);
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 Sat Aug 16 09:15:29 2008
@@ -135,6 +135,7 @@
GtkTreeStore *store;
store = gtk_tree_store_new (COLUMN_MAX, GDK_TYPE_PIXBUF,
G_TYPE_STRING, G_TYPE_INT);
+ // FIXME?
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
COLUMN_NAME,
GTK_SORT_ASCENDING);
Modified: trunk/plugins/symbol-db/symbol-db-view-locals.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-locals.h (original)
+++ trunk/plugins/symbol-db/symbol-db-view-locals.h Sat Aug 16 09:15:29 2008
@@ -58,7 +58,7 @@
GtkWidget *
symbol_db_view_locals_new (void);
-/*
+/**
* filepath: db-relative file path, e.g. /src/file.c
*/
void
@@ -77,7 +77,6 @@
symbol_db_view_locals_recv_signals_from_engine (SymbolDBViewLocals *dbvl,
SymbolDBEngine *dbe, gboolean enable_status);
-
/**
* Clear cache like GTree(s) and GtkTreeStore(s).
*/
Modified: trunk/plugins/symbol-db/symbol-db-view-search.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-search.c (original)
+++ trunk/plugins/symbol-db/symbol-db-view-search.c Sat Aug 16 09:15:29 2008
@@ -517,6 +517,31 @@
SymbolDBViewSearchPriv *priv = search->priv;
DEBUG_PRINT("Destroying symbolsearch");
+
+ if (priv->entry)
+ g_signal_handlers_disconnect_by_func (G_OBJECT(priv->entry),
+ G_CALLBACK (sdb_view_search_on_entry_key_press_event),
+ search);
+
+ if (priv->hitlist)
+ g_signal_handlers_disconnect_by_func (G_OBJECT(priv->hitlist),
+ G_CALLBACK (sdb_view_search_on_tree_row_activate),
+ search);
+
+ if (priv->entry)
+ g_signal_handlers_disconnect_by_func (G_OBJECT(priv->entry),
+ G_CALLBACK (sdb_view_search_on_entry_changed),
+ search);
+
+ if (priv->entry)
+ g_signal_handlers_disconnect_by_func (G_OBJECT(priv->entry),
+ G_CALLBACK (sdb_view_search_on_entry_activated),
+ search);
+
+ if (priv->entry)
+ g_signal_handlers_disconnect_by_func (G_OBJECT(priv->entry),
+ G_CALLBACK (sdb_view_search_on_entry_text_inserted),
+ search);
/* anjuta_symbol_view's dispose should manage it's freeing */
if (priv->model)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]