Revision: 1731 http://geany.svn.sourceforge.net/geany/?rev=1731&view=rev Author: eht16 Date: 2007-07-22 07:38:47 -0700 (Sun, 22 Jul 2007)
Log Message: ----------- 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().
Modified Paths: -------------- trunk/ChangeLog trunk/src/symbols.c trunk/src/treeviews.c trunk/src/treeviews.h trunk/src/utils.c trunk/src/utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-07-21 19:46:32 UTC (rev 1730) +++ trunk/ChangeLog 2007-07-22 14:38:47 UTC (rev 1731) @@ -1,6 +1,17 @@ +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: + * THANKS,po/LINGUAS,po/en_GB.po: Added British English translation (Thanks to Jeff Bailes).
Modified: trunk/src/symbols.c =================================================================== --- trunk/src/symbols.c 2007-07-21 19:46:32 UTC (rev 1730) +++ trunk/src/symbols.c 2007-07-22 14:38:47 UTC (rev 1731) @@ -419,7 +419,16 @@ { 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 @@ 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 @@ } }
- 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);
Modified: trunk/src/treeviews.c =================================================================== --- trunk/src/treeviews.c 2007-07-21 19:46:32 UTC (rev 1730) +++ trunk/src/treeviews.c 2007-07-22 14:38:47 UTC (rev 1731) @@ -155,7 +155,8 @@ { // 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,23 +484,18 @@ { 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); - } + navqueue_append(idx, line); + utils_goto_line(idx, line); } - g_free(string); } return FALSE; }
Modified: trunk/src/treeviews.h =================================================================== --- trunk/src/treeviews.h 2007-07-21 19:46:32 UTC (rev 1730) +++ trunk/src/treeviews.h 2007-07-22 14:38:47 UTC (rev 1731) @@ -39,6 +39,7 @@ { SYMBOLS_COLUMN_ICON, SYMBOLS_COLUMN_NAME, + SYMBOLS_COLUMN_LINE, SYMBOLS_N_COLUMNS, };
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2007-07-21 19:46:32 UTC (rev 1730) +++ trunk/src/utils.c 2007-07-22 14:38:47 UTC (rev 1731) @@ -182,27 +182,6 @@ }
-/* 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) {
Modified: trunk/src/utils.h =================================================================== --- trunk/src/utils.h 2007-07-21 19:46:32 UTC (rev 1730) +++ trunk/src/utils.h 2007-07-22 14:38:47 UTC (rev 1731) @@ -49,8 +49,6 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.