diff options
author | jstebbins <[email protected]> | 2009-07-29 15:48:26 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-07-29 15:48:26 +0000 |
commit | 5b3a5c11ce43920031574c5d993e2b31ce3d6423 (patch) | |
tree | 4ed44b82c12902c5dcb572e069e3ef781a8975ad /gtk/src | |
parent | 2d41542b7c4f0e4132f4c55a991ec98aecb4f4f3 (diff) |
LinGui: prevent initiation of another scan while a scan is in progress
attempting to start a scan while already scanning usually resulted in a
crash, and shouldn't be allowed anyway.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2735 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/callbacks.c | 44 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 14 |
2 files changed, 46 insertions, 12 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 0daa2573c..f25e6e563 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -873,6 +873,30 @@ show_scan_progress(signal_user_data_t *ud) gtk_label_set_text( label, "Scanning ..." ); } +static void +start_scan( + signal_user_data_t *ud, + const gchar *path, + gint titlenum, + gint preview_count) +{ + GtkWidget *widget; + GtkAction *action; + ghb_status_t status; + + ghb_get_status(&status); + if (status.scan.state != GHB_STATE_IDLE) + return; + + widget = GHB_WIDGET(ud->builder, "sourcetoolbutton"); + gtk_widget_set_sensitive(widget, FALSE); + action = GHB_ACTION(ud->builder, "source_action"); + gtk_action_set_sensitive(action, FALSE); + action = GHB_ACTION(ud->builder, "source_single_action"); + gtk_action_set_sensitive(action, FALSE); + ghb_backend_scan(path, titlenum, preview_count); +} + void ghb_do_scan( signal_user_data_t *ud, @@ -917,7 +941,7 @@ ghb_do_scan( prune_logs(ud); preview_count = ghb_settings_get_int(ud->settings, "preview_count"); - ghb_backend_scan(path, titlenum, preview_count); + start_scan(ud, path, titlenum, preview_count); g_free(path); } else @@ -2374,6 +2398,16 @@ ghb_backend_events(signal_user_data_t *ud) GtkProgressBar *scan_prog; GtkLabel *label; + GtkWidget *widget; + GtkAction *action; + + widget = GHB_WIDGET(ud->builder, "sourcetoolbutton"); + gtk_widget_set_sensitive(widget, TRUE); + action = GHB_ACTION(ud->builder, "source_action"); + gtk_action_set_sensitive(action, TRUE); + action = GHB_ACTION(ud->builder, "source_single_action"); + gtk_action_set_sensitive(action, TRUE); + source = ghb_settings_get_string(ud->settings, "source"); update_source_label(ud, source, FALSE); @@ -3422,7 +3456,7 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud update_source_label(ud, device, TRUE); gint preview_count; preview_count = ghb_settings_get_int(ud->settings, "preview_count"); - ghb_backend_scan(device, 0, preview_count); + start_scan(ud, device, 0, preview_count); } } } @@ -3439,7 +3473,7 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud ghb_hb_cleanup(TRUE); prune_logs(ud); ghb_settings_set_string(ud->settings, "source", "/dev/null"); - ghb_backend_scan("/dev/null", 0, 1); + start_scan(ud, "/dev/null", 0, 1); } } } @@ -3525,7 +3559,7 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud) update_source_label(ud, device, TRUE); gint preview_count; preview_count = ghb_settings_get_int(ud->settings, "preview_count"); - ghb_backend_scan(device, 0, preview_count); + start_scan(ud, device, 0, preview_count); } } else @@ -3533,7 +3567,7 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud) ghb_hb_cleanup(TRUE); prune_logs(ud); ghb_settings_set_string(ud->settings, "source", "/dev/null"); - ghb_backend_scan("/dev/null", 0, 1); + start_scan(ud, "/dev/null", 0, 1); } } #endif diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index c0967c66b..e7eed9cfd 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -284,17 +284,17 @@ </object> </child> <child> - <object class="GtkAction" id="source1"> + <object class="GtkAction" id="source_action"> <property name="stock_id">gtk-open</property> - <property name="name">source1</property> + <property name="name">source_action</property> <property name="label">_Source</property> <signal handler="source_button_clicked_cb" name="activate"/> </object> </child> <child> - <object class="GtkAction" id="source_single"> + <object class="GtkAction" id="source_single_action"> <property name="icon-name">gtk-open</property> - <property name="name">source_single</property> + <property name="name">source_single_action</property> <property name="label">Single _Title</property> <signal handler="single_title_source_cb" name="activate"/> </object> @@ -426,8 +426,8 @@ <ui> <menubar name="menubar1"> <menu action="menuitem1"> - <menuitem action="source1"/> - <menuitem action="source_single"/> + <menuitem action="source_action"/> + <menuitem action="source_single_action"/> <menuitem action="destination1"/> <separator/> <menuitem action="preferences"/> @@ -542,7 +542,7 @@ <property name="visible">True</property> <property name="icon_size">5</property> <child> - <object class="GtkToolButton" id="toolbutton1"> + <object class="GtkToolButton" id="sourcetoolbutton"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="tooltip-text" translatable="yes">Choose Video Source</property> |