summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-04-22 17:31:01 +0000
committerjstebbins <[email protected]>2015-04-22 17:31:01 +0000
commitdc7d80524cddd8024ece09a799152133128eafb5 (patch)
tree916d67019cbb9e9daa22ab2df251549c2c93fc18
parent7b402b36a87aa44e1fd23d9fdefa4af4a5af4158 (diff)
LinGui: Remove "reload queue" dialog. The queue is always reloaded.
And add a new "Delete All" button to the queue to simplify clearing the queue. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7114 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--gtk/src/ghb-3.12.ui17
-rw-r--r--gtk/src/ghb-3.14.ui17
-rw-r--r--gtk/src/ghb.ui17
-rw-r--r--gtk/src/queuehandler.c131
4 files changed, 125 insertions, 57 deletions
diff --git a/gtk/src/ghb-3.12.ui b/gtk/src/ghb-3.12.ui
index 48b5b4c08..f7026f58e 100644
--- a/gtk/src/ghb-3.12.ui
+++ b/gtk/src/ghb-3.12.ui
@@ -6563,6 +6563,23 @@ Resets all queue jobs to pending and ready to run again.</property>
</packing>
</child>
<child>
+ <object class="GtkToolButton" id="queue_delete_all">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="is_important">True</property>
+ <property name="label" translatable="yes">Delete All</property>
+ <property name="icon_name">edit-delete</property>
+ <property name="tooltip_text" translatable="yes">Delete all items in the queue.</property>
+ <signal name="clicked" handler="queue_delete_all_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkToolButton" id="queue_save">
<property name="visible">True</property>
<property name="sensitive">True</property>
diff --git a/gtk/src/ghb-3.14.ui b/gtk/src/ghb-3.14.ui
index 7243319d1..67c1a6c23 100644
--- a/gtk/src/ghb-3.14.ui
+++ b/gtk/src/ghb-3.14.ui
@@ -6567,6 +6567,23 @@ Resets all queue jobs to pending and ready to run again.</property>
</packing>
</child>
<child>
+ <object class="GtkToolButton" id="queue_delete_all">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="is_important">True</property>
+ <property name="label" translatable="yes">Delete All</property>
+ <property name="icon_name">edit-delete</property>
+ <property name="tooltip_text" translatable="yes">Delete all items in the queue.</property>
+ <signal name="clicked" handler="queue_delete_all_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkToolButton" id="queue_save">
<property name="visible">True</property>
<property name="sensitive">True</property>
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 36bde5287..c2b35fd1d 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -6563,6 +6563,23 @@ Resets all queue jobs to pending and ready to run again.</property>
</packing>
</child>
<child>
+ <object class="GtkToolButton" id="queue_delete_all">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="is_important">True</property>
+ <property name="label" translatable="yes">Delete All</property>
+ <property name="icon_name">edit-delete</property>
+ <property name="tooltip_text" translatable="yes">Delete all items in the queue.</property>
+ <signal name="clicked" handler="queue_delete_all_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkToolButton" id="queue_save">
<property name="visible">True</property>
<property name="sensitive">True</property>
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index de3bf72d8..7b90a1644 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -1627,6 +1627,63 @@ queue_add_multiple_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_container_empty(GTK_CONTAINER(list));
}
+static void
+ghb_queue_remove_row_internal(signal_user_data_t *ud, int row)
+{
+ GtkTreeView *treeview;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+
+ if (row < 0) return;
+ if (row >= ghb_array_len(ud->queue))
+ return;
+
+ GhbValue *settings = ghb_array_get(ud->queue, row);
+ int status = ghb_dict_get_int(settings, "job_status");
+ if (status == GHB_QUEUE_RUNNING)
+ {
+ // Ask if wants to stop encode.
+ if (!ghb_cancel_encode2(ud, NULL))
+ {
+ return;
+ }
+ int unique_id = ghb_dict_get_int(settings, "job_unique_id");
+ ghb_remove_job(unique_id);
+ }
+
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = gtk_tree_view_get_model(treeview);
+
+ gchar *path = g_strdup_printf ("%d", row);
+ if (gtk_tree_model_get_iter_from_string(store, &iter, path))
+ {
+ gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
+ }
+ g_free(path);
+
+ ghb_array_remove(ud->queue, row);
+}
+
+void
+ghb_queue_remove_row(signal_user_data_t *ud, int row)
+{
+ ghb_queue_remove_row_internal(ud, row);
+ ghb_save_queue(ud->queue);
+}
+
+G_MODULE_EXPORT void
+queue_delete_all_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ int ii, count;
+
+ count = ghb_array_len(ud->queue);
+ for (ii = count - 1; ii >= 0; ii--)
+ {
+ ghb_queue_remove_row_internal(ud, ii);
+ }
+ ghb_save_queue(ud->queue);
+}
+
G_MODULE_EXPORT void
queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
{
@@ -2067,7 +2124,6 @@ ghb_reload_queue(signal_user_data_t *ud)
gint pid;
gint status;
GhbValue *settings;
- gchar *message;
g_debug("ghb_reload_queue");
@@ -2096,72 +2152,33 @@ find_pid:
}
else
{
- GtkWindow *hb_window;
- hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window"));
- message = g_strdup_printf(
- _("You have %d unfinished job(s) in a saved queue.\n\n"
- "Would you like to reload them?"), unfinished);
- if (ghb_message_dialog(hb_window, GTK_MESSAGE_QUESTION,
- message, _("No"), _("Yes")))
+ GtkWidget *widget = GHB_WIDGET(ud->builder, "show_queue");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
+ ud->queue = queue;
+ // First get rid of any old items we don't want
+ for (ii = count-1; ii >= 0; ii--)
{
- GtkWidget *widget = GHB_WIDGET(ud->builder, "show_queue");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
- ud->queue = queue;
- // First get rid of any old items we don't want
- for (ii = count-1; ii >= 0; ii--)
+ settings = ghb_array_get(queue, ii);
+ status = ghb_dict_get_int(settings, "job_status");
+ if (status == GHB_QUEUE_DONE || status == GHB_QUEUE_CANCELED)
{
- settings = ghb_array_get(queue, ii);
- status = ghb_dict_get_int(settings, "job_status");
- if (status == GHB_QUEUE_DONE || status == GHB_QUEUE_CANCELED)
- {
- ghb_array_remove(queue, ii);
- }
+ ghb_array_remove(queue, ii);
}
- count = ghb_array_len(queue);
- for (ii = 0; ii < count; ii++)
- {
- settings = ghb_array_get(queue, ii);
- ghb_dict_set_int(settings, "job_unique_id", 0);
- ghb_dict_set_int(settings, "job_status", GHB_QUEUE_PENDING);
- add_to_queue_list(ud, settings, NULL);
- }
- ghb_queue_buttons_grey(ud);
- ghb_save_queue(ud->queue);
}
- else
+ count = ghb_array_len(queue);
+ for (ii = 0; ii < count; ii++)
{
- ghb_value_free(&queue);
+ settings = ghb_array_get(queue, ii);
+ ghb_dict_set_int(settings, "job_unique_id", 0);
+ ghb_dict_set_int(settings, "job_status", GHB_QUEUE_PENDING);
+ add_to_queue_list(ud, settings, NULL);
}
- g_free(message);
+ ghb_queue_buttons_grey(ud);
+ ghb_save_queue(ud->queue);
}
return FALSE;
}
-void
-ghb_queue_remove_row(signal_user_data_t *ud, int row)
-{
- GtkTreeView *treeview;
- GtkTreeModel *store;
- GtkTreeIter iter;
-
- if (row < 0) return;
- if (row >= ghb_array_len(ud->queue))
- return;
-
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = gtk_tree_view_get_model(treeview);
-
- gchar *path = g_strdup_printf ("%d", row);
- if (gtk_tree_model_get_iter_from_string(store, &iter, path))
- {
- gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
- }
- g_free(path);
-
- ghb_array_remove(ud->queue, row);
- ghb_save_queue(ud->queue);
-}
-
G_MODULE_EXPORT gboolean
queue_key_press_cb(
GtkWidget *widget,