diff options
author | jstebbins <[email protected]> | 2008-10-04 01:22:11 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-10-04 01:22:11 +0000 |
commit | 8383924c732d022f1aabe477fd825836feb56320 (patch) | |
tree | 8601c850bd583ac38bf75e6ae05ab74a049efd18 /gtk/src/queuehandler.c | |
parent | 19d1f541a0ea4c502ca063607a17a38288bcc037 (diff) |
LinGui: queue item editing
editing a pending item loads the item's settings and deletes it from the queue
editing a finished or running item just loads it's settings
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1806 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/queuehandler.c')
-rw-r--r-- | gtk/src/queuehandler.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index e92ecf3c3..724ef8fe0 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -36,6 +36,8 @@ queue_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t // This is purely cosmetic. if (gtk_tree_selection_get_selected(selection, &store, &iter)) { + GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit"); + gtk_widget_set_sensitive (widget, TRUE); if (gtk_tree_model_iter_parent (store, &piter, &iter)) { GtkTreePath *path; @@ -49,6 +51,11 @@ queue_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t gtk_tree_path_free(path); } } + else + { + GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit"); + gtk_widget_set_sensitive (widget, FALSE); + } } static void @@ -1058,7 +1065,8 @@ ghb_reload_queue(signal_user_data_t *ud) return FALSE; } -gboolean queue_key_press_cb( +gboolean +queue_key_press_cb( GtkWidget *widget, GdkEventKey *event, signal_user_data_t *ud) @@ -1118,3 +1126,51 @@ gboolean queue_key_press_cb( return FALSE; } +GValue *ghb_queue_edit_settings = NULL; + +void +queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +{ + GtkTreeView *treeview; + GtkTreeSelection *selection; + GtkTreeModel *store; + GtkTreeIter iter; + gint row; + gint *indices; + gint status; + + g_debug("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; + if (row >= ghb_array_len(ud->queue)) + return; + ghb_queue_edit_settings = ghb_array_get_nth(ud->queue, row); + status = ghb_settings_get_int(ghb_queue_edit_settings, "job_status"); + if (status == GHB_QUEUE_PENDING) + { + // Remove the selected item + gtk_tree_store_remove(GTK_TREE_STORE(store), &iter); + // Remove the corresponding item from the queue list + ghb_array_remove(ud->queue, row); + } + gchar *source; + source = ghb_settings_get_string(ghb_queue_edit_settings, "source"); + ghb_do_scan(ud, source, FALSE); + g_free(source); + } +} + |