OSDN Git Service

LinGui: delete key now deletes items in the queue
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 21 Sep 2008 20:08:07 +0000 (20:08 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 21 Sep 2008 20:08:07 +0000 (20:08 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@1741 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/callbacks.c
gtk/src/ghb.ui
gtk/src/hb-backend.c
gtk/src/resource_data.h
gtk/src/resources.plist

index f93cd13..eb0e428 100644 (file)
@@ -4453,3 +4453,60 @@ ghb_reload_queue(signal_user_data_t *ud)
        return FALSE;
 }
 
+gboolean queue_key_press_cb(
+       GtkWidget *widget, 
+       GdkEventKey *event,
+       signal_user_data_t *ud)
+{
+       GtkTreeView *treeview;
+       GtkTreeSelection *selection;
+       GtkTreeModel *store;
+       GtkTreeIter iter;
+       gint row;
+       gint *indices;
+       gint unique_id;
+       GValue *settings;
+       gint status;
+
+       g_message("queue_key_press_cb ()");
+       treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+       store = gtk_tree_view_get_model(treeview);
+
+       selection = gtk_tree_view_get_selection (treeview);
+       if (gtk_tree_selection_get_selected(selection, &store, &iter))
+       {
+               GtkTreePath *treepath;
+
+               treepath = gtk_tree_model_get_path (store, &iter);
+               // Find the entry in the queue
+               indices = gtk_tree_path_get_indices (treepath);
+               row = indices[0];
+               // Can only free the treepath After getting what I need from
+               // indices since this points into treepath somewhere.
+               gtk_tree_path_free (treepath);
+               if (row < 0) return FALSE;
+               if (row >= ghb_array_len(ud->queue))
+                       return FALSE;
+               settings = ghb_array_get_nth(ud->queue, row);
+               status = ghb_settings_get_int(settings, "job_status");
+               if (status == GHB_QUEUE_RUNNING)
+               {
+                       // Ask if wants to stop encode.
+                       if (!cancel_encode(NULL))
+                       {
+                               return FALSE;
+                       }
+                       unique_id = ghb_settings_get_int(settings, "job_unique_id");
+                       ghb_remove_job(unique_id);
+               }
+               // Remove the selected item
+               gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
+               // Remove the corresponding item from the queue list
+               GValue *old = ghb_array_get_nth(ud->queue, row);
+               ghb_value_free(old);
+               ghb_array_remove(ud->queue, row);
+               ghb_save_queue(ud->queue);
+       }
+       return FALSE;
+}
+
index c28d2e1..473b2a1 100644 (file)
@@ -3965,6 +3965,7 @@ this setting.</property>
                 <property name="headers_visible">False</property>
                 <property name="headers_clickable">False</property>
                 <property name="hover_expand">False</property>
+                <signal handler="queue_key_press_cb" name="key-press-event"/>
               </object>
             </child>
           </object>
index c25f028..b05c249 100644 (file)
@@ -3652,7 +3652,6 @@ ghb_get_preview_image(
        gboolean anamorphic = ghb_settings_get_boolean(settings, "anamorphic");
        if (anamorphic)
        {
-               title->job->modulus = 1;
                hb_set_anamorphic_size( title->job, &width, &height, &par_width, &par_height );
                if (par_width > par_height)
                        dstWidth = dstWidth * par_width / par_height;
index 19a7d47..3a793fd 100644 (file)
 "e&lt;/property&gt;\n"
 "                &lt;property name=&quot;hover_expand&quot;&gt;False&lt;"
 "/property&gt;\n"
+"                &lt;signal handler=&quot;queue_key_press_cb&quot; name="
+"&quot;key-press-event&quot;/&gt;\n"
 "              &lt;/object&gt;\n"
 "            &lt;/child&gt;\n"
 "          &lt;/object&gt;\n"
index 8710bb6..671bb9f 100644 (file)
@@ -3970,6 +3970,7 @@ this setting.&lt;/property&gt;
                 &lt;property name=&quot;headers_visible&quot;&gt;False&lt;/property&gt;
                 &lt;property name=&quot;headers_clickable&quot;&gt;False&lt;/property&gt;
                 &lt;property name=&quot;hover_expand&quot;&gt;False&lt;/property&gt;
+                &lt;signal handler=&quot;queue_key_press_cb&quot; name=&quot;key-press-event&quot;/&gt;
               &lt;/object&gt;
             &lt;/child&gt;
           &lt;/object&gt;