Extend icon search path to get symbol list icons working when using a non-standard installation prefix.
Query default icon theme only once to improve startup speed. Store the line number separately in the tree store. Remove utils_get_local_tag(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1731 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
9f7ee051c3
commit
a7975ccc93
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-07-22 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
|
||||
* src/symbols.c, src/treeviews.c, src/treeviews.h, src/utils.c,
|
||||
src/utils.h:
|
||||
Extend icon search path to get symbol list icons working when using
|
||||
a non-standard installation prefix.
|
||||
Query default icon theme only once to improve startup speed.
|
||||
Store the line number separately in the tree store.
|
||||
Remove utils_get_local_tag().
|
||||
|
||||
|
||||
2007-07-20 Frank Lanitz <frank@frank.uvena.de>
|
||||
|
||||
* THANKS,po/LINGUAS,po/en_GB.po:
|
||||
|
@ -419,6 +419,15 @@ tag_list_add_groups(GtkTreeStore *tree_store, ...)
|
||||
{
|
||||
va_list args;
|
||||
GtkTreeIter *iter;
|
||||
static GtkIconTheme *icon_theme = NULL;
|
||||
static gint x, y;
|
||||
|
||||
if (icon_theme == NULL)
|
||||
{
|
||||
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &x, &y);
|
||||
icon_theme = gtk_icon_theme_get_default();
|
||||
gtk_icon_theme_append_search_path(icon_theme, PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "icons");
|
||||
}
|
||||
|
||||
va_start(args, tree_store);
|
||||
for (; iter = va_arg(args, GtkTreeIter*), iter != NULL;)
|
||||
@ -427,22 +436,18 @@ tag_list_add_groups(GtkTreeStore *tree_store, ...)
|
||||
gchar *icon_name = va_arg(args, gchar *);
|
||||
GdkPixbuf *icon = NULL;
|
||||
|
||||
if (icon_name) {
|
||||
GtkIconTheme *icon_theme;
|
||||
gint x, y;
|
||||
|
||||
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &x, &y);
|
||||
icon_theme = gtk_icon_theme_get_default();
|
||||
icon = gtk_icon_theme_load_icon (icon_theme, icon_name, x, 0, NULL);
|
||||
if (icon_name)
|
||||
{
|
||||
icon = gtk_icon_theme_load_icon(icon_theme, icon_name, x, 0, NULL);
|
||||
}
|
||||
|
||||
g_assert(title != NULL);
|
||||
gtk_tree_store_append(tree_store, iter, NULL);
|
||||
|
||||
if (G_IS_OBJECT (icon)) {
|
||||
if (G_IS_OBJECT(icon)) {
|
||||
gtk_tree_store_set(tree_store, iter, SYMBOLS_COLUMN_ICON, icon,
|
||||
SYMBOLS_COLUMN_NAME, title, -1);
|
||||
g_object_unref (icon);
|
||||
g_object_unref(icon);
|
||||
} else
|
||||
gtk_tree_store_set(tree_store, iter, SYMBOLS_COLUMN_NAME, title, -1);
|
||||
}
|
||||
@ -708,13 +713,15 @@ gboolean symbols_recreate_tag_list(gint idx)
|
||||
}
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
if (parent)
|
||||
{
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(doc_list[idx].tag_store), parent,
|
||||
SYMBOLS_COLUMN_ICON, &icon, -1);
|
||||
gtk_tree_store_append(doc_list[idx].tag_store, &iter, parent);
|
||||
gtk_tree_store_set(doc_list[idx].tag_store, &iter,
|
||||
SYMBOLS_COLUMN_ICON, icon,
|
||||
SYMBOLS_COLUMN_NAME, buf, -1);
|
||||
SYMBOLS_COLUMN_NAME, buf,
|
||||
SYMBOLS_COLUMN_LINE, symbol->line, -1);
|
||||
|
||||
if (G_LIKELY(G_IS_OBJECT(icon)))
|
||||
g_object_unref(icon);
|
||||
|
@ -155,7 +155,8 @@ void treeviews_update_tag_list(gint idx, gboolean update)
|
||||
{ // updating the tag list in the left tag window
|
||||
if (doc_list[idx].tag_tree == NULL)
|
||||
{
|
||||
doc_list[idx].tag_store = gtk_tree_store_new(SYMBOLS_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||
doc_list[idx].tag_store = gtk_tree_store_new(
|
||||
SYMBOLS_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
|
||||
doc_list[idx].tag_tree = gtk_tree_view_new();
|
||||
prepare_taglist(doc_list[idx].tag_tree, doc_list[idx].tag_store);
|
||||
gtk_widget_show(doc_list[idx].tag_tree);
|
||||
@ -483,24 +484,19 @@ static gboolean on_taglist_tree_selection_changed(GtkTreeSelection *selection)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
gchar *string;
|
||||
gint line = 0;
|
||||
|
||||
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||
{
|
||||
gtk_tree_model_get(model, &iter, SYMBOLS_COLUMN_NAME, &string, -1);
|
||||
if (NZV(string))
|
||||
gtk_tree_model_get(model, &iter, SYMBOLS_COLUMN_LINE, &line, -1);
|
||||
if (line > 0)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
gint line = utils_get_local_tag(idx, string);
|
||||
|
||||
if (line != -1)
|
||||
{
|
||||
navqueue_append(idx, line);
|
||||
utils_goto_line(idx, line);
|
||||
}
|
||||
}
|
||||
g_free(string);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ enum
|
||||
{
|
||||
SYMBOLS_COLUMN_ICON,
|
||||
SYMBOLS_COLUMN_NAME,
|
||||
SYMBOLS_COLUMN_LINE,
|
||||
SYMBOLS_N_COLUMNS,
|
||||
};
|
||||
|
||||
|
21
src/utils.c
21
src/utils.c
@ -182,27 +182,6 @@ gboolean utils_is_opening_brace(gchar c)
|
||||
}
|
||||
|
||||
|
||||
/* returns the line of the given tag */
|
||||
gint utils_get_local_tag(gint idx, const gchar *qual_name)
|
||||
{
|
||||
guint line;
|
||||
gchar *spos;
|
||||
|
||||
g_return_val_if_fail((doc_list[idx].sci && qual_name), -1);
|
||||
|
||||
spos = strchr(qual_name, '[');
|
||||
if (spos && strchr(spos+1, ']'))
|
||||
{
|
||||
line = atol(spos + 1);
|
||||
if (line > 0)
|
||||
{
|
||||
return line;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// line is counted with 1 as the first line, not 0
|
||||
gboolean utils_goto_file_line(const gchar *file, gboolean is_tm_filename, gint line)
|
||||
{
|
||||
|
@ -49,8 +49,6 @@ gboolean utils_isbrace(gchar c);
|
||||
|
||||
gboolean utils_is_opening_brace(gchar c);
|
||||
|
||||
gint utils_get_local_tag(gint idx, const gchar *qual_name);
|
||||
|
||||
gboolean utils_goto_file_line(const gchar *file, gboolean is_tm_filename, gint line);
|
||||
|
||||
gboolean utils_goto_line(gint idx, gint line);
|
||||
|
Loading…
x
Reference in New Issue
Block a user