summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2008-07-25 17:08:46 +0000
committerjstebbins <[email protected]>2008-07-25 17:08:46 +0000
commitb263182274a17eac13ca13a06e58492b99dce717 (patch)
treed6ea9dbbb4177a8ad728be9ffa94e12b2f14b0b8 /gtk
parentd39c867a4e26e3d4eba715afc40cbc68023389ba (diff)
LinGui: Clean up temp files between scans instead of all at once when exiting.
There was too much of a lag when doing them all at once. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1577 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c16
-rw-r--r--gtk/src/hb-backend.c11
-rw-r--r--gtk/src/hb-backend.h2
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_