SF.net SVN: geany:[3288] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sat Nov 29 12:50:52 UTC 2008
Revision: 3288
http://geany.svn.sourceforge.net/geany/?rev=3288&view=rev
Author: eht16
Date: 2008-11-29 12:50:52 +0000 (Sat, 29 Nov 2008)
Log Message:
-----------
Add editor_get_calltip_text().
Add tooltips for the symbol list items.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
trunk/src/editor.h
trunk/src/symbols.c
trunk/src/treeviews.c
trunk/src/treeviews.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-11-29 12:50:27 UTC (rev 3287)
+++ trunk/ChangeLog 2008-11-29 12:50:52 UTC (rev 3288)
@@ -4,6 +4,10 @@
Simplify the tooltips code for the Open Files treeview.
Change the dependency handling for GTK 2.12 for some features
from compile time to run time.
+ * src/editor.c, src/editor.h, src/symbols.c, src/treeviews.c,
+ src/treeviews.h:
+ Add editor_get_calltip_text().
+ Add tooltips for the symbol list items.
2008-11-28 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-11-29 12:50:27 UTC (rev 3287)
+++ trunk/src/editor.c 2008-11-29 12:50:52 UTC (rev 3288)
@@ -1387,6 +1387,20 @@
}
+gchar *editor_get_calltip_text(GeanyEditor *editor, const TMTag *tag)
+{
+ GString *str;
+
+ g_return_val_if_fail(editor != NULL, NULL);
+
+ str = g_string_new(NULL);
+ if (append_calltip(str, tag, FILETYPE_ID(editor->document->file_type)))
+ return g_string_free(str, FALSE);
+ else
+ return g_string_free(str, TRUE);
+}
+
+
static void show_autocomplete(ScintillaObject *sci, gint rootlen, const gchar *words)
{
/* store whether a calltip is showing, so we can reshow it after autocompletion */
Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h 2008-11-29 12:50:27 UTC (rev 3287)
+++ trunk/src/editor.h 2008-11-29 12:50:52 UTC (rev 3288)
@@ -256,4 +256,6 @@
void editor_apply_update_prefs(GeanyEditor *editor);
+gchar *editor_get_calltip_text(GeanyEditor *editor, const TMTag *tag);
+
#endif
Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c 2008-11-29 12:50:27 UTC (rev 3287)
+++ trunk/src/symbols.c 2008-11-29 12:50:52 UTC (rev 3288)
@@ -831,8 +831,7 @@
}
-static const gchar *get_symbol_name(GeanyDocument *doc, const TMTag *tag,
- gboolean found_parent)
+static const gchar *get_symbol_name(GeanyDocument *doc, const TMTag *tag, gboolean found_parent)
{
gchar *utf8_name;
const gchar *scope = tag->atts.entry.scope;
@@ -879,6 +878,22 @@
}
+static gchar *get_symbol_tooltip(GeanyDocument *doc, const TMTag *tag)
+{
+ gchar *utf8_name = editor_get_calltip_text(doc->editor, tag);
+
+ /* encodings_convert_to_utf8_from_charset() fails with charset "None", so skip conversion
+ * for None at this point completely */
+ if (! utils_str_equal(doc->encoding, "UTF-8") && ! utils_str_equal(doc->encoding, "None"))
+ {
+ setptr(utf8_name,
+ encodings_convert_to_utf8_from_charset(utf8_name, -1, doc->encoding, TRUE));
+ }
+
+ return utf8_name;
+}
+
+
/* find the last word in "foo::bar::blah", e.g. "blah" */
const gchar *get_parent_name(const TMTag *tag, filetype_id ft_id)
{
@@ -989,6 +1004,7 @@
{
const gchar *name;
const gchar *parent_name = get_parent_name(tag, ft_id);
+ gchar *tooltip;
GtkTreeIter iter;
GtkTreeIter *icon_iter = NULL, *child = NULL;
GdkPixbuf *icon = NULL;
@@ -1025,11 +1041,15 @@
gtk_tree_store_append(tree_store, child, parent);
name = get_symbol_name(doc, tag, (parent_name != NULL));
+ tooltip = get_symbol_tooltip(doc, tag);
gtk_tree_store_set(tree_store, child,
SYMBOLS_COLUMN_ICON, icon,
SYMBOLS_COLUMN_NAME, name,
- SYMBOLS_COLUMN_TAG, tag, -1);
+ SYMBOLS_COLUMN_TAG, tag,
+ SYMBOLS_COLUMN_TOOLTIP, tooltip,
+ -1);
+ g_free(tooltip);
if (G_LIKELY(G_IS_OBJECT(icon)))
g_object_unref(icon);
}
Modified: trunk/src/treeviews.c
===================================================================
--- trunk/src/treeviews.c 2008-11-29 12:50:27 UTC (rev 3287)
+++ trunk/src/treeviews.c 2008-11-29 12:50:52 UTC (rev 3288)
@@ -122,6 +122,10 @@
g_object_set(tree, "show-expanders", interface_prefs.show_symbol_list_expanders, NULL);
if (! interface_prefs.show_symbol_list_expanders)
g_object_set(tree, "level-indentation", 10, NULL);
+ /* Tooltips */
+ g_object_set(tree,
+ "has-tooltip", TRUE,
+ "tooltip-column", SYMBOLS_COLUMN_TOOLTIP, NULL);
}
/* selection handling */
@@ -180,7 +184,7 @@
if (doc->priv->tag_tree == NULL)
{
doc->priv->tag_store = gtk_tree_store_new(
- SYMBOLS_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER);
+ SYMBOLS_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING);
doc->priv->tag_tree = gtk_tree_view_new();
prepare_taglist(doc->priv->tag_tree, doc->priv->tag_store);
gtk_widget_show(doc->priv->tag_tree);
Modified: trunk/src/treeviews.h
===================================================================
--- trunk/src/treeviews.h 2008-11-29 12:50:27 UTC (rev 3287)
+++ trunk/src/treeviews.h 2008-11-29 12:50:52 UTC (rev 3288)
@@ -42,6 +42,7 @@
SYMBOLS_COLUMN_ICON,
SYMBOLS_COLUMN_NAME,
SYMBOLS_COLUMN_TAG,
+ SYMBOLS_COLUMN_TOOLTIP,
SYMBOLS_N_COLUMNS
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list