mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make double-clicking on the dive list bring up the dive editor
Now that the dive info window is read-only, we need to edit the dives some other way. We bring up a dive info edit dialog when you double-click on the dive list entry for that dive. I do want to have an "edit" button or keyboard shortcut or something too, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
842b05415f
commit
1efcf4538b
5 changed files with 128 additions and 71 deletions
15
divelist.c
15
divelist.c
|
|
@ -506,6 +506,20 @@ static void realize_cb(GtkWidget *tree_view, gpointer userdata)
|
|||
gtk_widget_grab_focus(tree_view);
|
||||
}
|
||||
|
||||
static void row_activated_cb(GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
int index;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (!gtk_tree_model_get_iter(model, &iter, path))
|
||||
return;
|
||||
gtk_tree_model_get(model, &iter, DIVE_INDEX, &index, -1);
|
||||
edit_dive_info(get_dive(index));
|
||||
}
|
||||
|
||||
GtkWidget *dive_list_create(void)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
|
|
@ -551,6 +565,7 @@ GtkWidget *dive_list_create(void)
|
|||
NULL);
|
||||
|
||||
g_signal_connect_after(dive_list.tree_view, "realize", G_CALLBACK(realize_cb), NULL);
|
||||
g_signal_connect(dive_list.tree_view, "row-activated", G_CALLBACK(row_activated_cb), dive_list.model);
|
||||
g_signal_connect(selection, "changed", G_CALLBACK(selection_cb), dive_list.model);
|
||||
|
||||
dive_list.container_widget = gtk_scrolled_window_new(NULL, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue