From c67ea3a149967d9fee1b7b6f06769a438800de01 Mon Sep 17 00:00:00 2001 From: sgranjoux Date: Mon, 4 Feb 2008 20:45:51 +0000 Subject: [PATCH] * plugins/profiler/gprof-view.c, plugins/class-inheritance/class-callbacks.c, plugins/class-inheritance/class-inherit.c, plugins/symbol-browser/an_symbol.c, plugins/symbol-db/symbol-db-engine-iterator-node.c, libanjuta/interfaces/libanjuta.idl: Change ianjuta_symbol_file function to ianjuta_symbol_uri git-svn-id: http://svn.gnome.org/svn/anjuta/trunk@3598 1dbfb86a-d425-0410-a06b-cb591aac69f6 --- ChangeLog | 10 ++++++++++ libanjuta/interfaces/libanjuta.idl | 2 +- plugins/class-inheritance/class-callbacks.c | 22 +++++++++++----------- plugins/class-inheritance/class-inherit.c | 22 +++++++++++----------- plugins/profiler/gprof-view.c | 6 +++--- plugins/symbol-browser/an_symbol.c | 21 ++++++++++++++++++--- plugins/symbol-db/symbol-db-engine-iterator-node.c | 22 +++++++++++++++++++--- 7 files changed, 73 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19fdd8bf..79fb360c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-02-04 Sébastien Granjoux + + * plugins/profiler/gprof-view.c, + plugins/class-inheritance/class-callbacks.c, + plugins/class-inheritance/class-inherit.c, + plugins/symbol-browser/an_symbol.c, + plugins/symbol-db/symbol-db-engine-iterator-node.c, + libanjuta/interfaces/libanjuta.idl: + Change ianjuta_symbol_file function to ianjuta_symbol_uri + 2008-02-04 Johannes Schmid * plugins/search/anjuta-search.glade: Fixed typo diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl index 2782d241..60502cce 100644 --- a/libanjuta/interfaces/libanjuta.idl +++ b/libanjuta/interfaces/libanjuta.idl @@ -4366,7 +4366,7 @@ interface IAnjutaSymbol const gchar *var_type (); // Variable type (maps to struct for typedefs) const gchar *access (); // Access type (public/protected/private/etc.) const gchar *impl (); // Implementation (e.g. virtual) - const gchar *file (); // File in which the symbol occurs + const gchar *uri (); // URI in which the symbol occurs gulong line (); // Line number of the symbol gboolean is_local (); // Is the symbol of local scope diff --git a/plugins/class-inheritance/class-callbacks.c b/plugins/class-inheritance/class-callbacks.c index 158ce582..0a5b2f39 100644 --- a/plugins/class-inheritance/class-callbacks.c +++ b/plugins/class-inheritance/class-callbacks.c @@ -93,21 +93,21 @@ void on_member_menuitem_clicked (GtkMenuItem *menuitem, gpointer data) { NodeData *node; - const gchar *file; + const gchar *uri; gint line; node = (NodeData*)data; - file = g_object_get_data (G_OBJECT (menuitem), "__file"); + uri = g_object_get_data (G_OBJECT (menuitem), "__uri"); line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), "__line")); - if (file) + if (uri) { - /* Goto file line */ + /* Goto uri line */ IAnjutaDocumentManager *dm; dm = anjuta_shell_get_interface (ANJUTA_PLUGIN (node->plugin)->shell, IAnjutaDocumentManager, NULL); if (dm) { - ianjuta_document_manager_goto_uri_line (dm, file, line, NULL); + ianjuta_document_manager_goto_uri_line (dm, uri, line, NULL); } } } @@ -142,20 +142,20 @@ on_nodedata_expanded_event (GnomeCanvasItem *item, GdkEvent *event, gpointer dat g_hash_table_remove (plugin->expansion_node_list, nodedata->name); class_inheritance_update_graph (plugin); } - else { /* it's a class member. Take line && file of definition + else { /* it's a class member. Take line && uri of definition * and reach them */ - const gchar* file; + const gchar* uri; gint line; - file = g_object_get_data (G_OBJECT (item), "__file"); + uri = g_object_get_data (G_OBJECT (item), "__uri"); line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "__line")); - if (file) { - /* Goto file line */ + if (uri) { + /* Goto uri line */ IAnjutaDocumentManager *dm; dm = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell, IAnjutaDocumentManager, NULL); if (dm) { - ianjuta_document_manager_goto_uri_line (dm, file, line, NULL); + ianjuta_document_manager_goto_uri_line (dm, uri, line, NULL); } } } diff --git a/plugins/class-inheritance/class-inherit.c b/plugins/class-inheritance/class-inherit.c index 52a118ca..62584664 100644 --- a/plugins/class-inheritance/class-inherit.c +++ b/plugins/class-inheritance/class-inherit.c @@ -94,13 +94,13 @@ class_inheritance_show_dynamic_class_popup_menu (GdkEvent *event, IAnjutaSymbol *symbol = IANJUTA_SYMBOL (iter); do { - const gchar *name, *file; + const gchar *name, *uri; GdkPixbuf *pixbuf; gint line; name = ianjuta_symbol_name (symbol, NULL); pixbuf = ianjuta_symbol_icon (symbol, NULL); - file = ianjuta_symbol_file (symbol, NULL); + uri = ianjuta_symbol_uri (symbol, NULL); line = ianjuta_symbol_line (symbol, NULL); item = gtk_image_menu_item_new_with_label (name); @@ -108,10 +108,10 @@ class_inheritance_show_dynamic_class_popup_menu (GdkEvent *event, gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); - if (file) + if (uri) { - g_object_set_data_full (G_OBJECT (item), "__file", - g_strdup (file), g_free); + g_object_set_data_full (G_OBJECT (item), "__uri", + g_strdup (uri), g_free); g_object_set_data (G_OBJECT (item), "__line", GINT_TO_POINTER (line)); } @@ -449,7 +449,7 @@ cls_inherit_draw_expanded_node (AnjutaClassInheritance *plugin, Agnode_t *node, &plugin->canvas->style->base[GTK_STATE_ACTIVE], NULL); - /* add to the nodelist: we'll set the __file and __line properites later + /* add to the nodelist: we'll set the __uri and __line properites later * on this loop, when we'll parse symbols. */ plugin->node_list = g_list_prepend (plugin->node_list, node_data); @@ -506,11 +506,11 @@ cls_inherit_draw_expanded_node (AnjutaClassInheritance *plugin, Agnode_t *node, /* go on with the icons */ if (symbol_iter && ianjuta_iterable_get_length (symbol_iter, NULL) > 0) { GdkPixbuf *pixbuf; - const gchar* file; + const gchar* uri; gint line; IAnjutaSymbol *symbol = IANJUTA_SYMBOL (symbol_iter); - file = ianjuta_symbol_file (symbol, NULL); + uri = ianjuta_symbol_uri (symbol, NULL); line = ianjuta_symbol_line (symbol, NULL); pixbuf = ianjuta_symbol_icon (symbol, NULL); @@ -528,9 +528,9 @@ cls_inherit_draw_expanded_node (AnjutaClassInheritance *plugin, Agnode_t *node, /* set now the object properties on node_data. We still have a * reference to it so we can access its canvas_item */ - if (file) { - g_object_set_data_full (G_OBJECT (node_data->canvas_item), "__file", - g_strdup (file), g_free); + if (uri) { + g_object_set_data_full (G_OBJECT (node_data->canvas_item), "__uri", + g_strdup (uri), g_free); g_object_set_data (G_OBJECT (node_data->canvas_item), "__line", GINT_TO_POINTER (line)); } diff --git a/plugins/profiler/gprof-view.c b/plugins/profiler/gprof-view.c index e594af92..7e60386a 100644 --- a/plugins/profiler/gprof-view.c +++ b/plugins/profiler/gprof-view.c @@ -117,7 +117,7 @@ gprof_view_show_symbol_in_editor (GProfView *self, { IAnjutaIterable *symbol_iter; IAnjutaSymbol *symbol; - const gchar *file; + const gchar *uri; guint line; if (self->priv->symbol_manager && @@ -134,11 +134,11 @@ gprof_view_show_symbol_in_editor (GProfView *self, ianjuta_iterable_get_length (symbol_iter, NULL) > 0) { symbol = IANJUTA_SYMBOL (symbol_iter); - file = ianjuta_symbol_file (symbol, NULL); + uri = ianjuta_symbol_uri (symbol, NULL); line = ianjuta_symbol_line (symbol, NULL); ianjuta_document_manager_goto_uri_line (self->priv->document_manager, - file, line, NULL); + uri, line, NULL); g_object_unref (symbol_iter); } diff --git a/plugins/symbol-browser/an_symbol.c b/plugins/symbol-browser/an_symbol.c index 44a46057..421a685b 100644 --- a/plugins/symbol-browser/an_symbol.c +++ b/plugins/symbol-browser/an_symbol.c @@ -28,6 +28,7 @@ struct _AnjutaSymbolPriv { const TMTag *tm_tag; + gchar* uri; }; static gpointer parent_class; @@ -39,6 +40,8 @@ anjuta_symbol_finalize (GObject * obj) { AnjutaSymbol *s = ANJUTA_SYMBOL (obj); + if (s->priv->uri) + g_free (s->priv->uri); g_free (s->priv); GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (obj)); } @@ -75,6 +78,7 @@ anjuta_symbol_new (const TMTag *tm_tag) s = g_object_new (ANJUTA_TYPE_SYMBOL, NULL); s->priv->tm_tag = tm_tag; + s->priv->uri = NULL; return s; } @@ -83,6 +87,11 @@ anjuta_symbol_set_tag (AnjutaSymbol *symbol, const TMTag *tm_tag) { g_return_if_fail (ANJUTA_IS_SYMBOL (symbol)); symbol->priv->tm_tag = NULL; + if (symbol->priv->uri) + { + g_free(symbol->priv->uri); + symbol->priv->uri = NULL; + } if (tm_tag != NULL) { g_return_if_fail (tm_tag->type < tm_tag_max_t); @@ -197,7 +206,7 @@ isymbol_impl (IAnjutaSymbol *isymbol, GError **err) } static const gchar* -isymbol_file (IAnjutaSymbol *isymbol, GError **err) +isymbol_uri (IAnjutaSymbol *isymbol, GError **err) { AnjutaSymbol *s; @@ -206,7 +215,13 @@ isymbol_file (IAnjutaSymbol *isymbol, GError **err) g_return_val_if_fail (s->priv->tm_tag != NULL, NULL); if (s->priv->tm_tag->atts.entry.file == NULL) return NULL; - return s->priv->tm_tag->atts.entry.file->work_object.file_name; + if (s->priv->uri == NULL) + { + const gchar *file_path; + file_path = s->priv->tm_tag->atts.entry.file->work_object.file_name; + s->priv->uri = gnome_vfs_get_uri_from_local_path (file_path); + } + return s->priv->uri; } static gulong @@ -256,7 +271,7 @@ isymbol_iface_init (IAnjutaSymbolIface *iface) iface->inheritance = isymbol_inheritance; iface->access = isymbol_access; iface->impl = isymbol_impl; - iface->file = isymbol_file; + iface->uri = isymbol_uri; iface->line = isymbol_line; iface->is_local = isymbol_is_local; iface->icon = isymbol_icon; diff --git a/plugins/symbol-db/symbol-db-engine-iterator-node.c b/plugins/symbol-db/symbol-db-engine-iterator-node.c index 6c0f58c9..63e8e433 100644 --- a/plugins/symbol-db/symbol-db-engine-iterator-node.c +++ b/plugins/symbol-db/symbol-db-engine-iterator-node.c @@ -34,6 +34,7 @@ struct _SymbolDBEngineIteratorNodePriv { GdaDataModelIter *data_iter; const GHashTable *sym_type_conversion_hash; + gchar *uri; }; static GObjectClass* parent_class = NULL; @@ -46,6 +47,7 @@ symbol_db_engine_iterator_node_new (const GdaDataModelIter *data) SymbolDBEngineIteratorNode *s; s = g_object_new (SYMBOL_TYPE_DB_ENGINE_ITERATOR_NODE, NULL); s->priv->data_iter = (GdaDataModelIter *)data; + s->priv->uri = NULL; return s; } @@ -60,6 +62,7 @@ sdb_engine_iterator_node_instance_init (SymbolDBEngineIteratorNode *object) sdbin->priv = g_new0 (SymbolDBEngineIteratorNodePriv, 1); sdbin->priv->sym_type_conversion_hash = NULL; + sdbin->priv->uri = NULL; } static void @@ -73,6 +76,8 @@ sdb_engine_iterator_node_finalize (GObject *object) dbin = SYMBOL_DB_ENGINE_ITERATOR_NODE (object); priv = dbin->priv; + if (priv->uri) + g_free (priv->uri); g_free (priv); @@ -303,6 +308,11 @@ symbol_db_engine_iterator_node_set_data (SymbolDBEngineIteratorNode *dbin, priv = dbin->priv; priv->data_iter = GDA_DATA_MODEL_ITER (data); + if (priv->uri != NULL) + { + g_free (priv->uri); + priv->uri = NULL; + } } @@ -431,14 +441,20 @@ isymbol_impl (IAnjutaSymbol *isymbol, GError **err) } static const gchar* -isymbol_file (IAnjutaSymbol *isymbol, GError **err) +isymbol_uri (IAnjutaSymbol *isymbol, GError **err) { SymbolDBEngineIteratorNode *s; g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol), NULL); s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol); - return symbol_db_engine_iterator_node_get_symbol_extra_string (s, + if (s->priv->uri == NULL) + { + const cgchar* file_path; + file_path = symbol_db_engine_iterator_node_get_symbol_extra_string (s, SYMINFO_FILE_PATH); + s->priv->uri = gnome_vfs_get_uri_from_local_path (file_path); + } + return s->priv->uri; } static gulong @@ -488,7 +504,7 @@ isymbol_iface_init (IAnjutaSymbolIface *iface) iface->inheritance = isymbol_inheritance; iface->access = isymbol_access; iface->impl = isymbol_impl; - iface->file = isymbol_file; + iface->uri = isymbol_uri; iface->line = isymbol_line; iface->is_local = isymbol_is_local; iface->icon = isymbol_icon; -- 2.11.4.GIT