- dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", buf);
- g_signal_connect(dialog, "response", >k_main_quit, NULL);
- gtk_widget_show_all(dialog);
- }
- else
- gtk_main_quit();
+ gtk_tree_model_get(model, &iter, 1, &device, -1);
+ ret = toggle_device(device, output, sizeof(output));
+ if(ret)
+ {
+ GtkWidget *dialog;
+
+ /* Pmount terminated with nonzero status or a signal. Display an
+ error to the user. */
+ dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", output);
+ g_signal_connect(dialog, "response", >k_main_quit, NULL);
+ gtk_widget_show_all(dialog);
+ return;
+ }
+
+ gtk_main_quit();
+
+ if(post_mount_command && device->mount_point)
+ {
+ if(verbosity>=1)
+ printf("Running %s in %s\n", post_mount_command, device->mount_point);
+
+ pid = fork();
+ if(pid==0)
+ {
+ chdir(device->mount_point);
+ execlp(post_mount_command, post_mount_command, NULL);
+ _exit(1);