diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-02 19:03:46 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-02 19:03:46 -0700 |
commit | 23c2b43c1042713cc4c394c3d08ec0016e41eb1a (patch) | |
tree | 7ce899d5c7a593c8ee1d0d3b1314ed360c0b7dac /equipment.c | |
parent | d51f40bdcff32b1a5d5dedea054db8de06de5e07 (diff) | |
download | subsurface-23c2b43c1042713cc4c394c3d08ec0016e41eb1a.tar.gz |
Make cylinders editable with a double-click
You can still just select them and click the "Edit" button too, but now
you can double-click them (or select them and press "enter") for editing
too.
It seems to be the natural interface.
Also, remove the index column (that was there for debugging), and add
grid lines.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'equipment.c')
-rw-r--r-- | equipment.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/equipment.c b/equipment.c index 54ac5e8da..32f45da5b 100644 --- a/equipment.c +++ b/equipment.c @@ -655,6 +655,14 @@ static void selection_cb(GtkTreeSelection *selection, GtkTreeModel *model) gtk_widget_set_sensitive(cylinder_list.del, selected); } +static void row_activated_cb(GtkTreeView *tree_view, + GtkTreePath *path, + GtkTreeViewColumn *column, + GtkTreeModel *model) +{ + edit_cb(NULL, NULL); +} + static GtkWidget *cylinder_list_create(void) { GtkWidget *tree_view; @@ -673,12 +681,16 @@ static GtkWidget *cylinder_list_create(void) ); cylinder_list.model = model; tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); + g_signal_connect(tree_view, "row-activated", G_CALLBACK(row_activated_cb), model); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_BROWSE); g_signal_connect(selection, "changed", G_CALLBACK(selection_cb), model); - tree_view_column(tree_view, CYL_INDEX, "Nr", NULL, PANGO_ALIGN_LEFT, TRUE); + g_object_set(G_OBJECT(tree_view), "headers-visible", TRUE, + "enable-grid-lines", GTK_TREE_VIEW_GRID_LINES_BOTH, + NULL); + cylinder_list.desc = tree_view_column(tree_view, CYL_DESC, "Type", NULL, PANGO_ALIGN_LEFT, TRUE); cylinder_list.size = tree_view_column(tree_view, CYL_SIZE, "Size", size_data_func, PANGO_ALIGN_RIGHT, TRUE); cylinder_list.workp = tree_view_column(tree_view, CYL_WORKP, "MaxPress", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE); |