Set the "ellipsize" property of GtkCellRendererText to automatically shorten the path and file names in the Documents list.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3731 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-04-24 19:30:07 +00:00
parent e4dfd09d7c
commit 52e733e305
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,9 @@
When the editor menu is opened by the Menu key, use the text cursor When the editor menu is opened by the Menu key, use the text cursor
position for retrieving the current word. This fixes disabled position for retrieving the current word. This fixes disabled
Go to Tag items in the menu (#2780044). Go to Tag items in the menu (#2780044).
* src/treeviews.c:
Set the "ellipsize" property of GtkCellRendererText to automatically
shorten the path and file names in the Documents list.
2009-04-21 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2009-04-21 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -241,6 +241,7 @@ static void prepare_openfiles(void)
icon_renderer = gtk_cell_renderer_pixbuf_new(); icon_renderer = gtk_cell_renderer_pixbuf_new();
text_renderer = gtk_cell_renderer_text_new(); text_renderer = gtk_cell_renderer_text_new();
g_object_set(text_renderer, "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL);
column = gtk_tree_view_column_new(); column = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start(column, icon_renderer, FALSE); gtk_tree_view_column_pack_start(column, icon_renderer, FALSE);
gtk_tree_view_column_set_attributes(column, icon_renderer, "stock-id", DOCUMENTS_ICON, NULL); gtk_tree_view_column_set_attributes(column, icon_renderer, "stock-id", DOCUMENTS_ICON, NULL);
@ -368,7 +369,7 @@ void treeviews_openfiles_add(GeanyDocument *doc)
gtk_tree_view_expand_row(GTK_TREE_VIEW(tv.tree_openfiles), path, TRUE); gtk_tree_view_expand_row(GTK_TREE_VIEW(tv.tree_openfiles), path, TRUE);
gtk_tree_path_free(path); gtk_tree_path_free(path);
} }
basename = document_get_basename_for_display(doc, 30); basename = g_path_get_basename(DOC_FILENAME(doc));
gtk_tree_store_set(store_openfiles, iter, DOCUMENTS_ICON, GTK_STOCK_FILE, gtk_tree_store_set(store_openfiles, iter, DOCUMENTS_ICON, GTK_STOCK_FILE,
DOCUMENTS_SHORTNAME, basename, DOCUMENTS_DOCUMENT, doc, DOCUMENTS_COLOR, color, DOCUMENTS_SHORTNAME, basename, DOCUMENTS_DOCUMENT, doc, DOCUMENTS_COLOR, color,
DOCUMENTS_FILENAME, DOC_FILENAME(doc), -1); DOCUMENTS_FILENAME, DOC_FILENAME(doc), -1);