]> granicus.if.org Git - handbrake/commitdiff
LinGui: Allow scanning new source when work is in progress
authorjstebbins <jstebbins.hb@gmail.com>
Mon, 23 Jun 2008 15:48:13 +0000 (15:48 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Mon, 23 Jun 2008 15:48:13 +0000 (15:48 +0000)
and allow stacking up jobs from multiple sources in the queue.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1534 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/callbacks.c
gtk/src/settings.h

index 58d3562487e76a79158884cc73344afa68afbb9e..582c930d185d913b8ee361af379771bdb7667c24 100644 (file)
@@ -299,7 +299,7 @@ void
 on_quit1_activate(GtkMenuItem *quit, signal_user_data_t *ud)
 {
        g_debug("on_quit1_activate ()\n");
-    if (ud->state == GHB_STATE_WORKING)
+    if (ud->state & GHB_STATE_WORKING)
     {
         if (cancel_encode("Closing HandBrake will terminate encoding.\n"))
         {
@@ -592,15 +592,7 @@ source_button_clicked_cb(GtkButton *button, signal_user_data_t *ud)
        gboolean checkbutton_active;
 
        g_debug("source_browse_clicked_cb ()\n");
-    if (ud->state == GHB_STATE_WORKING)
-    {
-        if (!cancel_encode("Opening a new source will cancel the current encode.\n"))
-        {
-               return;
-        }
-    }
        sourcename = ghb_settings_get_string(ud->settings, "source");
-
        checkbutton_active = FALSE;
        if (g_file_test(sourcename, G_FILE_TEST_IS_DIR))
        {
@@ -637,7 +629,7 @@ source_button_clicked_cb(GtkButton *button, signal_user_data_t *ud)
                                const gchar *path = ghb_settings_get_string( ud->settings, "source");
                                gtk_progress_bar_set_fraction (progress, 0);
                                gtk_progress_bar_set_text (progress, "Scanning ...");
-                               ud->state = GHB_STATE_SCANNING;
+                               ud->state |= GHB_STATE_SCANNING;
                                ghb_backend_scan (path, 0);
                        }
                        else
@@ -763,7 +755,7 @@ gboolean
 window_delete_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *ud)
 {
        g_debug("window_delete_event_cb ()\n");
-    if (ud->state == GHB_STATE_WORKING)
+    if (ud->state & GHB_STATE_WORKING)
     {
         if (cancel_encode("Closing HandBrake will terminate encoding.\n"))
         {
@@ -2575,7 +2567,7 @@ ghb_timer_cb(gpointer data)
                } break;
         case GHB_EVENT_WORK_DONE:
         {
-                       ud->state = GHB_STATE_IDLE;
+                       ud->state &= ~GHB_STATE_WORKING;
                        work_started = FALSE;
                        queue_buttons_grey(ud, FALSE);
                        index = find_queue_item(ud->queue, current_id, &js);
@@ -2620,7 +2612,7 @@ ghb_timer_cb(gpointer data)
                {
                        ghb_title_info_t tinfo;
                        
-                       ud->state = GHB_STATE_IDLE;
+                       ud->state &= ~GHB_STATE_SCANNING;
                        ghb_update_ui_combo_box(ud->builder, "title", 0, FALSE);
                        titleindex = ghb_longest_title();
                        ghb_ui_update_int(ud, "title", titleindex);
@@ -2709,7 +2701,7 @@ ghb_timer_cb(gpointer data)
                        const gchar *path = ghb_settings_get_string( ud->settings, "source");
                        gtk_progress_bar_set_fraction (progress, 0);
                        gtk_progress_bar_set_text (progress, "Scanning ...");
-                       ud->state = GHB_STATE_SCANNING;
+                       ud->state |= GHB_STATE_SCANNING;
                        ghb_backend_scan (path, 0);
                }
        }
@@ -3024,7 +3016,7 @@ queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
                if (!queue_add(ud))
                        return;
        }
-       ud->state = GHB_STATE_WORKING;
+       ud->state |= GHB_STATE_WORKING;
        ghb_start_queue();
 }
 
@@ -3179,12 +3171,12 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud)
                        gtk_progress_bar_set_text (progress, "Scanning ...");
                        gtk_progress_bar_set_fraction (progress, 0);
                        update_source_label(ud, device);
-                       ud->state = GHB_STATE_SCANNING;
+                       ud->state |= GHB_STATE_SCANNING;
                        ghb_backend_scan(device, 0);
                }
                else
                {
-                       ud->state = GHB_STATE_SCANNING;
+                       ud->state |= GHB_STATE_SCANNING;
                        ghb_backend_scan("/dev/null", 0);
                }
        }
index af653dbf9cd94397af39f8eb1126f10af75fa31b..c831c0fa8ce1d4e734f4d58341cc663293734b16 100644 (file)
@@ -30,10 +30,10 @@ GObject* debug_get_object(GtkBuilder *b, const gchar *n);
 
 enum
 {
-       GHB_STATE_START,
-       GHB_STATE_SCANNING,
-       GHB_STATE_WORKING,
-       GHB_STATE_IDLE
+       GHB_STATE_IDLE = 0x00,
+       GHB_STATE_START = 0x01,
+       GHB_STATE_SCANNING = 0x02,
+       GHB_STATE_WORKING = 0x04
 };
 
 typedef struct