diff options
-rw-r--r-- | gtk/src/callbacks.c | 16 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 11 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 2 |
3 files changed, 17 insertions, 12 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 4f1c7e984..03af56480 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -306,13 +306,13 @@ on_quit1_activate(GtkMenuItem *quit, signal_user_data_t *ud) { if (cancel_encode("Closing HandBrake will terminate encoding.\n")) { - ghb_hb_cleanup(); + ghb_hb_cleanup(FALSE); gtk_main_quit(); return; } return; } - ghb_hb_cleanup(); + ghb_hb_cleanup(FALSE); gtk_main_quit(); } @@ -601,6 +601,7 @@ do_scan(signal_user_data_t *ud, const gchar *filename) gtk_progress_bar_set_fraction (progress, 0); gtk_progress_bar_set_text (progress, "Scanning ..."); ud->state |= GHB_STATE_SCANNING; + ghb_hb_cleanup(TRUE); ghb_backend_scan (path, 0); } else @@ -779,7 +780,7 @@ gboolean window_destroy_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *ud) { g_debug("window_destroy_event_cb ()\n"); - ghb_hb_cleanup(); + ghb_hb_cleanup(FALSE); gtk_main_quit(); return FALSE; } @@ -792,13 +793,13 @@ window_delete_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *u { if (cancel_encode("Closing HandBrake will terminate encoding.\n")) { - ghb_hb_cleanup(); + ghb_hb_cleanup(FALSE); gtk_main_quit(); return FALSE; } return TRUE; } - ghb_hb_cleanup(); + ghb_hb_cleanup(FALSE); gtk_main_quit(); return FALSE; } @@ -2655,7 +2656,7 @@ ghb_timer_cb(gpointer data) current_id = -1; if (ghb_autostart) { - ghb_hb_cleanup(); + ghb_hb_cleanup(FALSE); gtk_main_quit(); } } break; @@ -2772,6 +2773,7 @@ ghb_timer_cb(gpointer data) gtk_progress_bar_set_fraction (progress, 0); gtk_progress_bar_set_text (progress, "Scanning ..."); ud->state |= GHB_STATE_SCANNING; + ghb_hb_cleanup(TRUE); ghb_backend_scan (path, 0); } } @@ -3319,11 +3321,13 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud) gtk_progress_bar_set_fraction (progress, 0); update_source_label(ud, device); ud->state |= GHB_STATE_SCANNING; + ghb_hb_cleanup(TRUE); ghb_backend_scan(device, 0); } else { ud->state |= GHB_STATE_SCANNING; + ghb_hb_cleanup(TRUE); ghb_backend_scan("/dev/null", 0); } } diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index f877b984f..cd5497aef 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -409,7 +409,7 @@ static const iso639_lang_t language_table[] = #define LANG_TABLE_SIZE (sizeof(language_table)/ sizeof(iso639_lang_t)) static void -del_tree(const gchar *name) +del_tree(const gchar *name, gboolean del_top) { const gchar *file; @@ -421,11 +421,12 @@ del_tree(const gchar *name) { gchar *path; path = g_strdup_printf("%s/%s", name, file); - del_tree(path); + del_tree(path, TRUE); g_free(path); file = g_dir_read_name(gdir); } - g_rmdir(name); + if (del_top) + g_rmdir(name); } else { @@ -521,12 +522,12 @@ static hb_handle_t * h = NULL; extern void hb_get_tempory_directory(hb_handle_t *h, char path[512]); void -ghb_hb_cleanup() +ghb_hb_cleanup(gboolean partial) { char dir[512]; hb_get_tempory_directory(h, dir); - del_tree(dir); + del_tree(dir, !partial); } static hb_audio_config_t* diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index 9c723b7b6..4f9821322 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -93,6 +93,6 @@ gint ghb_guess_bitrate(GHashTable *settings); gboolean ghb_validate_vquality(GHashTable *settings); gboolean ghb_validate_audio(signal_user_data_t *ud); gboolean ghb_validate_video(signal_user_data_t *ud); -void ghb_hb_cleanup(); +void ghb_hb_cleanup(gboolean partial); #endif // _HBBACKEND_H_ |