anjuta r4492 - in trunk: . plugins/symbol-db
- From: mcora svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4492 - in trunk: . plugins/symbol-db
- Date: Sat, 27 Dec 2008 17:02:45 +0000 (UTC)
Author: mcora
Date: Sat Dec 27 17:02:45 2008
New Revision: 4492
URL: http://svn.gnome.org/viewvc/anjuta?rev=4492&view=rev
Log:
* plugins/symbol-db/anjuta-symbol-db-plugin.ui:
* plugins/symbol-db/Makefile.am:
* plugins/symbol-db/plugin.c (goto_file_line), (goto_file_tag),
(on_goto_file_tag_def_activate), (on_goto_file_tag_decl_activate),
(do_import_system_sources_after_abort), (do_import_system_sources),
(symbol_db_activate), (symbol_db_deactivate):
* plugins/symbol-db/plugin.h:
* plugins/symbol-db/symbol-db-engine-iterator-node.c
(isymbol_get_icon):
* plugins/symbol-db/symbol-db-engine-priv.h:
* plugins/symbol-db/symbol-db-engine-queries.c
(symbol_db_engine_find_symbol_by_name_pattern):
* plugins/symbol-db/symbol-db-engine-utils.c
(sdb_util_load_symbol_pixbufs), (symbol_db_util_get_pixbuf):
* plugins/symbol-db/symbol-db-engine-utils.h:
* plugins/symbol-db/symbol-db-view-locals.c
(sdb_view_locals_create_new_store), (traverse_on_scan_end),
(consume_symbols_inserted_queue_idle):
* plugins/symbol-db/symbol-db-view-search.c
(sdb_view_search_model_filter):
* plugins/symbol-db/symbol-db-view.c (on_symbol_inserted),
(sdb_view_row_expanded_idle), (symbol_db_view_row_expanded),
(sdb_view_build_and_display_base_tree):
* plugins/symbol-db/symbol-db-view.h:
moved symbol_db_util_get_pixbuf () into symbol-db-engine-utils.c.
Fixed #565691 â no Goto Definition command in symbol-db.
Added:
trunk/plugins/symbol-db/anjuta-symbol-db-plugin.ui
Modified:
trunk/ChangeLog
trunk/plugins/symbol-db/Makefile.am
trunk/plugins/symbol-db/plugin.c
trunk/plugins/symbol-db/plugin.h
trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
trunk/plugins/symbol-db/symbol-db-engine-priv.h
trunk/plugins/symbol-db/symbol-db-engine-queries.c
trunk/plugins/symbol-db/symbol-db-engine-utils.c
trunk/plugins/symbol-db/symbol-db-engine-utils.h
trunk/plugins/symbol-db/symbol-db-view-locals.c
trunk/plugins/symbol-db/symbol-db-view-search.c
trunk/plugins/symbol-db/symbol-db-view.c
trunk/plugins/symbol-db/symbol-db-view.h
Modified: trunk/plugins/symbol-db/Makefile.am
==============================================================================
--- trunk/plugins/symbol-db/Makefile.am (original)
+++ trunk/plugins/symbol-db/Makefile.am Sat Dec 27 17:02:45 2008
@@ -3,6 +3,10 @@
symbol_db_datadir = $(anjuta_data_dir)
symbol_db_data_DATA = tables.sql
+# Plugin UI file
+symbol_db_uidir = $(anjuta_ui_dir)
+symbol_db_ui_DATA = anjuta-symbol-db-plugin.ui
+
# Plugin Glade file
symbol_db_gladedir = $(anjuta_glade_dir)
symbol_db_glade_DATA = anjuta-symbol-db.glade
@@ -78,7 +82,8 @@
$(symbol_db_plugin_DATA) \
$(symbol_db_glade_DATA) \
$(symbol_db_pixmaps_DATA) \
- $(symbol_db_data_DATA)
+ $(symbol_db_data_DATA) \
+ $(symbol_db_ui_DATA)
Added: trunk/plugins/symbol-db/anjuta-symbol-db-plugin.ui
==============================================================================
--- (empty file)
+++ trunk/plugins/symbol-db/anjuta-symbol-db-plugin.ui Sat Dec 27 17:02:45 2008
@@ -0,0 +1,9 @@
+<!--*- xml -*-->
+<ui>
+ <popup name="PopupDocumentManager">
+ <menu name="Goto" action="ActionMenuGoto">
+ <menuitem name="TagDef" action="ActionSymbolDBGotoDef" />
+ <menuitem name="TagDecl" action="ActionSymbolDBGotoDecl" />
+ </menu>
+ </popup>
+</ui>
Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c (original)
+++ trunk/plugins/symbol-db/plugin.c Sat Dec 27 17:02:45 2008
@@ -48,6 +48,7 @@
#include "symbol-db-prefs.h"
#define ICON_FILE "anjuta-symbol-db-plugin-48.png"
+#define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta-symbol-db-plugin.ui"
#define TIMEOUT_INTERVAL_SYMBOLS_UPDATE 10
#define TIMEOUT_SECONDS_AFTER_LAST_TIP 5
@@ -63,7 +64,7 @@
{
PROJECT_IMPORT_END,
GLOBALS_IMPORT_END,
- LAST_SIGNAL
+ LAST_SIGNAL
};
typedef enum
@@ -94,6 +95,131 @@
}
static void
+goto_file_line (AnjutaPlugin *plugin, const gchar *filename, gint lineno)
+{
+ IAnjutaDocumentManager *docman;
+ GFile* file;
+
+ g_return_if_fail (filename != NULL);
+
+ DEBUG_PRINT ("going to: file %s, line %d", filename, lineno);
+
+ /* Go to file and line number */
+ docman = anjuta_shell_get_interface (plugin->shell, IAnjutaDocumentManager,
+ NULL);
+ file = g_file_new_for_path (filename);
+ ianjuta_document_manager_goto_file_line (docman, file, lineno, NULL);
+
+ g_object_unref (file);
+}
+
+static void
+goto_file_tag (SymbolDBPlugin *sdb_plugin, const char *word,
+ gboolean prefer_definition)
+{
+ SymbolDBEngineIterator *iterator;
+ iterator = symbol_db_engine_find_symbol_by_name_pattern (sdb_plugin->sdbe_project,
+ word,
+ SYMINFO_SIMPLE |
+ SYMINFO_KIND |
+ SYMINFO_FILE_PATH);
+ do {
+ const gchar *symbol_kind;
+ SymbolDBEngineIteratorNode *iter_node;
+ iter_node = SYMBOL_DB_ENGINE_ITERATOR_NODE (iterator);
+
+ /* not found or some error occurred */
+ if (iter_node == NULL)
+ break;
+
+ symbol_kind = symbol_db_engine_iterator_node_get_symbol_extra_string (
+ iter_node, SYMINFO_KIND);
+
+ if (prefer_definition == FALSE && g_strcmp0 (symbol_kind, "prototype") == 0)
+ {
+ gint line =
+ symbol_db_engine_iterator_node_get_symbol_file_pos (iter_node);
+ const gchar* file =
+ symbol_db_engine_iterator_node_get_symbol_extra_string (iter_node,
+ SYMINFO_FILE_PATH);
+ goto_file_line (ANJUTA_PLUGIN (sdb_plugin), file, line);
+ break;
+ }
+ else if (prefer_definition == TRUE && g_strcmp0 (symbol_kind, "function") == 0)
+ {
+ gint line =
+ symbol_db_engine_iterator_node_get_symbol_file_pos (iter_node);
+ const gchar* file =
+ symbol_db_engine_iterator_node_get_symbol_extra_string (iter_node,
+ SYMINFO_FILE_PATH);
+ goto_file_line (ANJUTA_PLUGIN (sdb_plugin), file, line);
+ break;
+ }
+
+ } while (symbol_db_engine_iterator_move_next (iterator) == TRUE);
+
+ if (iterator)
+ g_object_unref (iterator);
+}
+
+static void
+on_goto_file_tag_def_activate (GtkAction *action, SymbolDBPlugin *sdb_plugin)
+{
+ IAnjutaEditor *ed;
+ gchar *word;
+
+ if (sdb_plugin->current_editor)
+ {
+ ed = IANJUTA_EDITOR (sdb_plugin->current_editor);
+ word = ianjuta_editor_get_current_word (ed, NULL);
+ if (word)
+ {
+ goto_file_tag (sdb_plugin, word, TRUE);
+ g_free (word);
+ }
+ }
+}
+
+static void
+on_goto_file_tag_decl_activate (GtkAction *action, SymbolDBPlugin *sdb_plugin)
+{
+ IAnjutaEditor *ed;
+ gchar *word;
+
+ if (sdb_plugin->current_editor)
+ {
+ ed = IANJUTA_EDITOR (sdb_plugin->current_editor);
+ word = ianjuta_editor_get_current_word (ed, NULL);
+ if (word)
+ {
+ goto_file_tag (sdb_plugin, word, FALSE);
+ g_free (word);
+ }
+ }
+}
+
+static GtkActionEntry actions[] =
+{
+ { "ActionMenuGoto", NULL, N_("_Goto"), NULL, NULL, NULL},
+ {
+ "ActionSymbolDBGotoDef",
+ NULL,
+ N_("Tag _Definition"),
+ "<control>d",
+ N_("Goto symbol definition"),
+ G_CALLBACK (on_goto_file_tag_def_activate)
+ },
+ {
+ "ActionSymbolDBGotoDecl",
+ NULL,
+ N_("Tag De_claration"),
+ "<shift><control>d",
+ N_("Goto symbol declaration"),
+ G_CALLBACK (on_goto_file_tag_decl_activate)
+ }
+};
+
+static void
on_editor_buffer_symbol_update_scan_end (SymbolDBEngine *dbe, gint process_id,
gpointer data)
{
@@ -526,24 +652,6 @@
}
static void
-goto_file_line (AnjutaPlugin *plugin, const gchar *filename, gint lineno)
-{
- IAnjutaDocumentManager *docman;
- GFile* file;
-
- g_return_if_fail (filename != NULL);
-
- /* Go to file and line number */
- docman = anjuta_shell_get_interface (plugin->shell, IAnjutaDocumentManager,
- NULL);
- file = g_file_new_for_path (filename);
- ianjuta_document_manager_goto_file_line (docman, file, lineno, NULL);
-
- g_object_unref (file);
-}
-
-
-static void
goto_local_tree_iter (SymbolDBPlugin *sdb_plugin, GtkTreeIter *iter)
{
gint line;
@@ -1072,7 +1180,7 @@
/* note the *system* word in the function */
static void
-do_import_system_src_after_abort (SymbolDBPlugin *sdb_plugin,
+do_import_system_sources_after_abort (SymbolDBPlugin *sdb_plugin,
const GPtrArray *sources_array)
{
AnjutaPlugin *plugin;
@@ -1086,7 +1194,7 @@
lang_manager = anjuta_shell_get_interface (plugin->shell, IAnjutaLanguage,
NULL);
- DEBUG_PRINT ("do_import_system_src_after_abort %d", sources_array->len);
+ DEBUG_PRINT ("array length %d", sources_array->len);
/* create array of languages */
languages_array = g_ptr_array_new ();
to_scan_array = g_ptr_array_new ();
@@ -1322,7 +1430,7 @@
if (sys_src_array != NULL && sys_src_array->len > 0)
{
- do_import_system_src_after_abort (sdb_plugin, sys_src_array);
+ do_import_system_sources_after_abort (sdb_plugin, sys_src_array);
g_ptr_array_foreach (sys_src_array, (GFunc)g_free, NULL);
g_ptr_array_free (sys_src_array, TRUE);
@@ -2000,6 +2108,19 @@
"symbol-db-plugin-icon",
ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
+ /* Add action group */
+ symbol_db->popup_action_group =
+ anjuta_ui_add_action_group_entries (symbol_db->ui,
+ "ActionGroupPopupSymbolDB",
+ _("Symbol db popup actions"),
+ actions,
+ G_N_ELEMENTS (actions),
+ GETTEXT_PACKAGE, FALSE, plugin);
+
+ /* Add UI */
+ symbol_db->merge_id =
+ anjuta_ui_merge (symbol_db->ui, UI_FILE);
+
/* set up project directory watch */
symbol_db->root_watch_id = anjuta_plugin_add_watch (plugin,
IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
@@ -2132,6 +2253,9 @@
/* Remove watches */
anjuta_plugin_remove_watch (plugin, sdb_plugin->root_watch_id, FALSE);
anjuta_plugin_remove_watch (plugin, sdb_plugin->editor_watch_id, TRUE);
+
+ /* Remove UI */
+ anjuta_ui_unmerge (sdb_plugin->ui, sdb_plugin->merge_id);
/* Remove widgets: Widgets will be destroyed when dbv_main is removed */
g_object_unref (sdb_plugin->progress_bar_project);
@@ -2140,6 +2264,7 @@
sdb_plugin->root_watch_id = 0;
sdb_plugin->editor_watch_id = 0;
+ sdb_plugin->merge_id = 0;
sdb_plugin->dbv_notebook = NULL;
sdb_plugin->scrolled_global = NULL;
sdb_plugin->scrolled_locals = NULL;
Modified: trunk/plugins/symbol-db/plugin.h
==============================================================================
--- trunk/plugins/symbol-db/plugin.h (original)
+++ trunk/plugins/symbol-db/plugin.h Sat Dec 27 17:02:45 2008
@@ -58,7 +58,11 @@
/* project monitor */
guint root_watch_id;
-
+
+ /* ui merge */
+ GtkActionGroup *popup_action_group;
+ gint merge_id;
+
/* editor monitor */
guint buf_update_timeout_id;
gboolean need_symbols_update;
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 Sat Dec 27 17:02:45 2008
@@ -402,7 +402,7 @@
g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol), FALSE);
s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
- return symbol_db_view_get_pixbuf (
+ return symbol_db_util_get_pixbuf (
symbol_db_engine_iterator_node_get_symbol_extra_string (s,
SYMINFO_TYPE),
symbol_db_engine_iterator_node_get_symbol_extra_string (s,
Modified: trunk/plugins/symbol-db/symbol-db-engine-priv.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-priv.h (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-priv.h Sat Dec 27 17:02:45 2008
@@ -28,6 +28,9 @@
#include <glib-object.h>
#include <glib.h>
#include <libanjuta/anjuta-launcher.h>
+#include <libgda/libgda.h>
+#include <sql-parser/gda-sql-parser.h>
+
/* file should be specified without the ".db" extension. */
#define ANJUTA_DB_FILE ".anjuta_sym_db"
Modified: trunk/plugins/symbol-db/symbol-db-engine-queries.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-queries.c (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-queries.c Sat Dec 27 17:02:45 2008
@@ -1765,14 +1765,14 @@
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 symbol "
- "%s WHERE symbol.name %s", info_data->str, join_data->str, match_str);
+ "%s FROM symbol %s "
+ "WHERE symbol.name %s", info_data->str, join_data->str, match_str);
dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_FIND_SYMBOL_NAME_BY_PATTERN,
sym_info, other_parameters,
query_str);
-
+ /* DEBUG_PRINT ("query %s", query_str);*/
g_free (query_str);
g_string_free (info_data, TRUE);
g_string_free (join_data, TRUE);
Modified: trunk/plugins/symbol-db/symbol-db-engine-utils.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-utils.c (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-utils.c Sat Dec 27 17:02:45 2008
@@ -24,8 +24,11 @@
#include <libanjuta/anjuta-debug.h>
-#include "symbol-db-engine-queries.h"
-#include "symbol-db-engine-priv.h"
+#include <libanjuta/resources.h>
+#include "symbol-db-engine-utils.h"
+
+
+static GHashTable *pixbufs_hash = NULL;
/*
* extern declarations
@@ -180,3 +183,114 @@
return files_to_scan;
}
+
+#define CREATE_SYM_ICON(N, F) \
+ pix_file = anjuta_res_get_pixmap_file (F); \
+ g_hash_table_insert (pixbufs_hash, \
+ N, \
+ gdk_pixbuf_new_from_file (pix_file, NULL)); \
+ g_free (pix_file);
+
+static void
+sdb_util_load_symbol_pixbufs ()
+{
+ gchar *pix_file;
+
+ if (pixbufs_hash != NULL)
+ {
+ /* we already have loaded it */
+ return;
+ }
+
+ pixbufs_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+ CREATE_SYM_ICON ("class", "element-class-16.png");
+ CREATE_SYM_ICON ("enum", "element-enumeration-16.png");
+ CREATE_SYM_ICON ("enumerator", "element-enumeration-16.png");
+ CREATE_SYM_ICON ("function", "element-method-16.png");
+ CREATE_SYM_ICON ("interface", "element-interface-16.png");
+ CREATE_SYM_ICON ("macro", "element-event-16.png");
+ CREATE_SYM_ICON ("namespace", "element-namespace-16.png");
+ CREATE_SYM_ICON ("none", "element-literal-16.png");
+ CREATE_SYM_ICON ("struct", "element-structure-16.png");
+ CREATE_SYM_ICON ("typedef", "element-literal-16.png");
+ CREATE_SYM_ICON ("union", "element-structure-16.png");
+ CREATE_SYM_ICON ("variable", "element-literal-16.png");
+ CREATE_SYM_ICON ("prototype", "element-interface-16.png");
+
+ CREATE_SYM_ICON ("privateclass", "element-class-16.png");
+ CREATE_SYM_ICON ("privateenum", "element-enumeration-16.png");
+ CREATE_SYM_ICON ("privatefield", "element-event-16.png");
+ CREATE_SYM_ICON ("privatefunction", "element-method-16.png");
+ CREATE_SYM_ICON ("privateinterface", "element-interface-16.png");
+ CREATE_SYM_ICON ("privatemember", "element-property-16.png");
+ CREATE_SYM_ICON ("privatemethod", "element-method-16.png");
+ CREATE_SYM_ICON ("privateproperty", "element-property-16.png");
+ CREATE_SYM_ICON ("privatestruct", "element-structure-16.png");
+ CREATE_SYM_ICON ("privateprototype", "element-interface-16.png");
+
+ CREATE_SYM_ICON ("protectedclass", "element-class-16.png");
+ CREATE_SYM_ICON ("protectedenum", "element-enumeration-16.png");
+ CREATE_SYM_ICON ("protectedfield", "element-event-16.png");
+ CREATE_SYM_ICON ("protectedmember", "element-property-16.png");
+ CREATE_SYM_ICON ("protectedmethod", "element-method-16.png");
+ CREATE_SYM_ICON ("protectedproperty", "element-property-16.png");
+ CREATE_SYM_ICON ("publicprototype", "element-interface-16.png");
+
+ CREATE_SYM_ICON ("publicclass", "element-class-16.png");
+ CREATE_SYM_ICON ("publicenum", "element-enumeration-16.png");
+ CREATE_SYM_ICON ("publicfunction", "element-method-16.png");
+ CREATE_SYM_ICON ("publicmember", "element-method-16.png");
+ CREATE_SYM_ICON ("publicproperty", "element-property-16.png");
+ CREATE_SYM_ICON ("publicstruct", "element-structure-16.png");
+ CREATE_SYM_ICON ("publicprototype", "element-interface-16.png");
+
+ /* special icon */
+ CREATE_SYM_ICON ("othersvars", "element-event-16.png");
+ CREATE_SYM_ICON ("globalglobal", "element-event-16.png");
+}
+
+/**
+ * @return The pixbufs. It will initialize pixbufs first if they weren't before
+ * @param node_access can be NULL.
+ */
+const GdkPixbuf*
+symbol_db_util_get_pixbuf (const gchar *node_type, const gchar *node_access)
+{
+ gchar *search_node;
+ GdkPixbuf *pix;
+ if (!pixbufs_hash)
+ {
+ sdb_util_load_symbol_pixbufs ();
+ }
+
+ /*DEBUG_PRINT ("symbol_db_view_get_pixbuf: node_type %s node_access %s",
+ node_type, node_access);*/
+
+ g_return_val_if_fail (node_type != NULL, NULL);
+
+ /* is there a better/quicker method to retrieve pixbufs? */
+ if (node_access != NULL)
+ {
+ search_node = g_strdup_printf ("%s%s", node_access, node_type);
+ }
+ else
+ {
+ /* we will not free search_node gchar, so casting here is ok. */
+ search_node = (gchar*)node_type;
+ }
+ pix = GDK_PIXBUF (g_hash_table_lookup (pixbufs_hash, search_node));
+
+ if (node_access)
+ {
+ g_free (search_node);
+ }
+
+ if (pix == NULL)
+ {
+ DEBUG_PRINT ("symbol_db_view_get_pixbuf (): no pixbuf for %s %s",
+ node_type, node_access);
+ }
+
+ return pix;
+}
Modified: trunk/plugins/symbol-db/symbol-db-engine-utils.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-utils.h (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-utils.h Sat Dec 27 17:02:45 2008
@@ -28,6 +28,9 @@
#include <glib-object.h>
#include <glib.h>
+#include "symbol-db-engine-priv.h"
+#include "symbol-db-engine.h"
+
/**
* Simple compare function for GTree(s)
@@ -41,7 +44,6 @@
gint
symbol_db_glist_compare_func (gconstpointer a, gconstpointer b);
-
/**
* Return full_local_path given a relative-to-db file path.
* User must care to free the returned string.
@@ -50,7 +52,6 @@
gchar*
symbol_db_engine_get_full_local_path (SymbolDBEngine *dbe, const gchar* db_file);
-
/**
* Return a db-relativ file path. Es. given the full_local_file_path
* /home/user/foo_project/src/foo.c returned file should be /src/foo.c.
@@ -81,6 +82,10 @@
GPtrArray *
symbol_db_engine_get_files_with_zero_symbols (SymbolDBEngine *dbe);
-
+/* return the pixbufs. It will initialize pixbufs first if they weren't before
+ * node_access: can be NULL.
+ */
+const GdkPixbuf*
+symbol_db_util_get_pixbuf (const gchar *node_type, const gchar *node_access);
#endif
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 Dec 27 17:02:45 2008
@@ -129,7 +129,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);
@@ -489,7 +489,7 @@
iter_node = SYMBOL_DB_ENGINE_ITERATOR_NODE (iterator);
- pixbuf = symbol_db_view_get_pixbuf (
+ pixbuf = symbol_db_util_get_pixbuf (
symbol_db_engine_iterator_node_get_symbol_extra_string (
iter_node, SYMINFO_KIND),
symbol_db_engine_iterator_node_get_symbol_extra_string (
@@ -922,7 +922,7 @@
iter_node = SYMBOL_DB_ENGINE_ITERATOR_NODE (iterator);
- pixbuf = symbol_db_view_get_pixbuf (
+ pixbuf = symbol_db_util_get_pixbuf (
symbol_db_engine_iterator_node_get_symbol_extra_string (
iter_node, SYMINFO_KIND),
symbol_db_engine_iterator_node_get_symbol_extra_string (
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 Dec 27 17:02:45 2008
@@ -157,7 +157,7 @@
gtk_tree_store_set (GTK_TREE_STORE (store), &iter,
- COLUMN_PIXBUF, symbol_db_view_get_pixbuf (
+ COLUMN_PIXBUF, symbol_db_util_get_pixbuf (
symbol_db_engine_iterator_node_get_symbol_extra_string (
iter_node, SYMINFO_KIND),
symbol_db_engine_iterator_node_get_symbol_extra_string (
Modified: trunk/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.c (original)
+++ trunk/plugins/symbol-db/symbol-db-view.c Sat Dec 27 17:02:45 2008
@@ -73,7 +73,6 @@
static GtkTreeViewClass *parent_class = NULL;
-static GHashTable *pixbufs_hash = NULL;
static void
trigger_on_symbol_inserted (SymbolDBView *dbv, gint symbol_id);
@@ -640,7 +639,7 @@
symbol_access = symbol_db_engine_iterator_node_get_symbol_extra_string (
iter_node, SYMINFO_ACCESS);
- pixbuf = symbol_db_view_get_pixbuf (symbol_kind, symbol_access);
+ pixbuf = symbol_db_util_get_pixbuf (symbol_kind, symbol_access);
symbol_name = symbol_db_engine_iterator_node_get_symbol_name (iter_node);
/* check if one of the children [if they exist] of symbol_id are already
@@ -875,7 +874,7 @@
SYMINFO_KIND);
symbol_access = symbol_db_engine_iterator_node_get_symbol_extra_string (iter_node,
SYMINFO_ACCESS);
- pixbuf = symbol_db_view_get_pixbuf (symbol_kind, symbol_access);
+ pixbuf = symbol_db_util_get_pixbuf (symbol_kind, symbol_access);
curr_tree_row_ref = do_add_child_symbol_to_view (dbv,
node_expand->expanded_symbol_id, pixbuf,
@@ -917,7 +916,7 @@
GtkTreeIter others_dummy_node;
others_row_ref = do_add_child_symbol_to_view (dbv,
node_expand->expanded_symbol_id,
- symbol_db_view_get_pixbuf ("vars", "others"),
+ symbol_db_util_get_pixbuf ("vars", "others"),
"Vars/Others",
-node_expand->expanded_symbol_id);
@@ -1284,7 +1283,7 @@
/* Step 3 */
/* ok we must display this symbol */
- pixbuf = symbol_db_view_get_pixbuf (
+ pixbuf = symbol_db_util_get_pixbuf (
symbol_db_engine_iterator_node_get_symbol_extra_string (
iter_node, SYMINFO_KIND),
symbol_db_engine_iterator_node_get_symbol_extra_string (
@@ -1498,118 +1497,6 @@
}
-#define CREATE_SYM_ICON(N, F) \
- pix_file = anjuta_res_get_pixmap_file (F); \
- g_hash_table_insert (pixbufs_hash, \
- N, \
- gdk_pixbuf_new_from_file (pix_file, NULL)); \
- g_free (pix_file);
-
-static void
-sdb_view_load_symbol_pixbufs ()
-{
- gchar *pix_file;
-
- if (pixbufs_hash != NULL)
- {
- /* we already have loaded it */
- return;
- }
-
- pixbufs_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- CREATE_SYM_ICON ("class", "element-class-16.png");
- CREATE_SYM_ICON ("enum", "element-enumeration-16.png");
- CREATE_SYM_ICON ("enumerator", "element-enumeration-16.png");
- CREATE_SYM_ICON ("function", "element-method-16.png");
- CREATE_SYM_ICON ("interface", "element-interface-16.png");
- CREATE_SYM_ICON ("macro", "element-event-16.png");
- CREATE_SYM_ICON ("namespace", "element-namespace-16.png");
- CREATE_SYM_ICON ("none", "element-literal-16.png");
- CREATE_SYM_ICON ("struct", "element-structure-16.png");
- CREATE_SYM_ICON ("typedef", "element-literal-16.png");
- CREATE_SYM_ICON ("union", "element-structure-16.png");
- CREATE_SYM_ICON ("variable", "element-literal-16.png");
- CREATE_SYM_ICON ("prototype", "element-interface-16.png");
-
- CREATE_SYM_ICON ("privateclass", "element-class-16.png");
- CREATE_SYM_ICON ("privateenum", "element-enumeration-16.png");
- CREATE_SYM_ICON ("privatefield", "element-event-16.png");
- CREATE_SYM_ICON ("privatefunction", "element-method-16.png");
- CREATE_SYM_ICON ("privateinterface", "element-interface-16.png");
- CREATE_SYM_ICON ("privatemember", "element-property-16.png");
- CREATE_SYM_ICON ("privatemethod", "element-method-16.png");
- CREATE_SYM_ICON ("privateproperty", "element-property-16.png");
- CREATE_SYM_ICON ("privatestruct", "element-structure-16.png");
- CREATE_SYM_ICON ("privateprototype", "element-interface-16.png");
-
- CREATE_SYM_ICON ("protectedclass", "element-class-16.png");
- CREATE_SYM_ICON ("protectedenum", "element-enumeration-16.png");
- CREATE_SYM_ICON ("protectedfield", "element-event-16.png");
- CREATE_SYM_ICON ("protectedmember", "element-property-16.png");
- CREATE_SYM_ICON ("protectedmethod", "element-method-16.png");
- CREATE_SYM_ICON ("protectedproperty", "element-property-16.png");
- CREATE_SYM_ICON ("publicprototype", "element-interface-16.png");
-
- CREATE_SYM_ICON ("publicclass", "element-class-16.png");
- CREATE_SYM_ICON ("publicenum", "element-enumeration-16.png");
- CREATE_SYM_ICON ("publicfunction", "element-method-16.png");
- CREATE_SYM_ICON ("publicmember", "element-method-16.png");
- CREATE_SYM_ICON ("publicproperty", "element-property-16.png");
- CREATE_SYM_ICON ("publicstruct", "element-structure-16.png");
- CREATE_SYM_ICON ("publicprototype", "element-interface-16.png");
-
- /* special icon */
- CREATE_SYM_ICON ("othersvars", "element-event-16.png");
- CREATE_SYM_ICON ("globalglobal", "element-event-16.png");
-}
-
-/**
- * @return The pixbufs. It will initialize pixbufs first if they weren't before
- * @param node_access can be NULL.
- */
-inline const GdkPixbuf*
-symbol_db_view_get_pixbuf (const gchar *node_type, const gchar *node_access)
-{
- gchar *search_node;
- GdkPixbuf *pix;
- if (!pixbufs_hash)
- {
- sdb_view_load_symbol_pixbufs ();
- }
-
- /*DEBUG_PRINT ("symbol_db_view_get_pixbuf: node_type %s node_access %s",
- node_type, node_access);*/
-
- g_return_val_if_fail (node_type != NULL, NULL);
-
- /* is there a better/quicker method to retrieve pixbufs? */
- if (node_access != NULL)
- {
- search_node = g_strdup_printf ("%s%s", node_access, node_type);
- }
- else
- {
- /* we will not free search_node gchar, so casting here is ok. */
- search_node = (gchar*)node_type;
- }
- pix = GDK_PIXBUF (g_hash_table_lookup (pixbufs_hash, search_node));
-
- if (node_access)
- {
- g_free (search_node);
- }
-
- if (pix == NULL)
- {
- DEBUG_PRINT ("symbol_db_view_get_pixbuf (): no pixbuf for %s %s",
- node_type, node_access);
- }
-
- return pix;
-}
-
-
GtkWidget*
symbol_db_view_new (void)
{
@@ -1710,7 +1597,7 @@
curr_symbol_id = symbol_db_engine_iterator_node_get_symbol_id (iter_node);
- pixbuf = symbol_db_view_get_pixbuf (
+ pixbuf = symbol_db_util_get_pixbuf (
symbol_db_engine_iterator_node_get_symbol_extra_string (
iter_node, SYMINFO_KIND),
symbol_db_engine_iterator_node_get_symbol_extra_string (
@@ -1748,7 +1635,7 @@
/*
* Good. Add a 'Global' node to the store.
*/
- global_pixbuf = symbol_db_view_get_pixbuf ("global", "global");
+ global_pixbuf = symbol_db_util_get_pixbuf ("global", "global");
global_tree_row_ref = do_add_root_symbol_to_view (dbv, global_pixbuf,
"Global", ROOT_GLOBAL);
Modified: trunk/plugins/symbol-db/symbol-db-view.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.h (original)
+++ trunk/plugins/symbol-db/symbol-db-view.h Sat Dec 27 17:02:45 2008
@@ -59,12 +59,6 @@
GtkWidget*
symbol_db_view_new (void);
-/* return the pixbufs. It will initialize pixbufs first if they weren't before
- * node_access: can be NULL.
- */
-inline const GdkPixbuf*
-symbol_db_view_get_pixbuf (const gchar *node_type, const gchar *node_access);
-
void
symbol_db_view_open (SymbolDBView *dbv, SymbolDBEngine *dbe);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]