From 43a906e0745b03b92eb13367f97d931c634c917b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 29 Aug 2015 19:01:20 +0300 Subject: [PATCH] Use te device mounted flag to decide what to do --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index ae08cbb..26dbca3 100644 --- a/main.c +++ b/main.c @@ -621,7 +621,7 @@ void row_activated(GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *colu { GtkTreeModel *model; GtkTreeIter iter; - int umount = *(int *)user_data; + int umount; char buf[1024]; int pos = 0; int status = 0; @@ -637,6 +637,7 @@ void row_activated(GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *colu return; gtk_tree_model_get(model, &iter, 1, &device, -1); + umount = !!device->mounted; pipe(pipe_fd); @@ -749,6 +750,7 @@ void row_activated(GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *colu } (void)column; + (void)user_data; } /** @@ -850,7 +852,7 @@ int main(int argc, char **argv) list = gtk_tree_view_new(); gtk_container_add(GTK_CONTAINER(viewport), list); - g_signal_connect(list, "row-activated", G_CALLBACK(&row_activated), &umount); + g_signal_connect(list, "row-activated", G_CALLBACK(&row_activated), NULL); store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); gtk_tree_view_set_model(GTK_TREE_VIEW(list), GTK_TREE_MODEL(store)); -- 2.45.2