about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2012-06-19 13:52:36 -0400
committerJosh Rickmar <jrick@devio.us>2012-06-28 15:36:30 -0400
commitea1e0272a711e3b4b76c86b983d92ea01cf762f5 (patch)
tree525acf6cb67337cf89ccbf739f7a8003bdeda53d
parent708b5e49dca962e66b774416aefdd377040bc55c (diff)
downloadxombrero-ea1e0272a711e3b4b76c86b983d92ea01cf762f5.tar.gz
Focus and highlight the current tab when viewing the buffers/ls list.
Fixes FS#304.
-rw-r--r--xombrero.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/xombrero.c b/xombrero.c
index 88fab6d..3adc30f 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -537,10 +537,23 @@ buffers_make_list(void)
 void
 show_buffers(struct tab *t)
 {
+	GtkTreeIter		iter;
+	GtkTreeSelection	*sel;
+	GtkTreePath		*path;
+	int			index;
+
 	if (gtk_widget_get_visible(GTK_WIDGET(t->buffers)))
 		return;
 
 	buffers_make_list();
+
+	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(t->buffers));
+	index = gtk_notebook_get_current_page(notebook);
+	path = gtk_tree_path_new_from_indices(index, -1);
+	if (gtk_tree_model_get_iter(GTK_TREE_MODEL(buffers_store), &iter, path))
+		gtk_tree_selection_select_iter(sel, &iter);
+	gtk_tree_path_free(path);
+
 	gtk_widget_show(t->buffers);
 	gtk_widget_grab_focus(GTK_WIDGET(t->buffers));
 }