diff options
author | jstebbins <[email protected]> | 2010-11-01 18:06:08 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2010-11-01 18:06:08 +0000 |
commit | 315bdf4070eddf039b24f338b70562f6d5d04682 (patch) | |
tree | 0f91f364712947c69e6015b7ba55ed39ab1bda14 | |
parent | e7844b5c338d587d24aa32187134f6d33e0d2d8b (diff) |
LinGui: allow specifying file to scan on command line
The gui will immediately scan this file at startup.
Makes 'Open with' nautilus options behave as expected.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3636 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | gtk/src/callbacks.c | 16 | ||||
-rw-r--r-- | gtk/src/callbacks.h | 1 | ||||
-rw-r--r-- | gtk/src/main.c | 8 |
3 files changed, 24 insertions, 1 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index a964cf843..91f4f1f49 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -888,6 +888,22 @@ start_scan( 90000L * ghb_settings_get_int64(ud->settings, "MinTitleDuration")); } +gboolean +ghb_idle_scan(signal_user_data_t *ud) +{ + gchar *path; + gint preview_count; + + show_scan_progress(ud); + path = ghb_settings_get_string( ud->settings, "scan_source"); + prune_logs(ud); + + preview_count = ghb_settings_get_int(ud->settings, "preview_count"); + start_scan(ud, path, 0, preview_count); + g_free(path); + return FALSE; +} + void ghb_do_scan( signal_user_data_t *ud, diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h index f873c871f..38fafdf06 100644 --- a/gtk/src/callbacks.h +++ b/gtk/src/callbacks.h @@ -66,6 +66,7 @@ gpointer ghb_cache_volnames(signal_user_data_t *ud); void ghb_volname_cache_init(void); void ghb_update_destination_extension(signal_user_data_t *ud); void ghb_update_pending(signal_user_data_t *ud); +gboolean ghb_idle_scan(signal_user_data_t *ud); #endif // _CALLBACKS_H_ diff --git a/gtk/src/main.c b/gtk/src/main.c index 4fde5d69d..50cc5e455 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -777,6 +777,11 @@ main (int argc, char *argv[]) #endif g_option_context_parse (context, &argc, &argv, &error); g_option_context_free(context); + + if (argc > 1 && dvd_device == NULL && argv[1][0] != '-') + { + dvd_device = argv[1]; + } gtk_set_locale (); gtk_init (&argc, &argv); @@ -913,7 +918,8 @@ main (int argc, char *argv[]) if (dvd_device != NULL) { // Source overridden from command line option - ghb_settings_set_string(ud->settings, "source", dvd_device); + ghb_settings_set_string(ud->settings, "scan_source", dvd_device); + g_idle_add((GSourceFunc)ghb_idle_scan, ud); } // Reload and check status of the last saved queue g_idle_add((GSourceFunc)ghb_reload_queue, ud); |