summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/ghb.m47
-rw-r--r--gtk/src/main.c6
-rw-r--r--gtk/src/queuehandler.c91
3 files changed, 71 insertions, 33 deletions
diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4
index d4a8bea78..da02b276e 100644
--- a/gtk/src/ghb.m4
+++ b/gtk/src/ghb.m4
@@ -1037,7 +1037,7 @@ Resets the queue job to pending and ready to run again.</property>
<property name="row-spacing">12</property>
<child>
<object class="GtkLabel" id="queue_stats_pass_label">
- <property name="visible">True</property>
+ <property name="visible">False</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
@@ -1054,7 +1054,7 @@ Resets the queue job to pending and ready to run again.</property>
</child>
<child>
<object class="GtkLabel" id="queue_stats_pass">
- <property name="visible">True</property>
+ <property name="visible">False</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="halign">start</property>
@@ -1312,7 +1312,7 @@ Resets the queue job to pending and ready to run again.</property>
<child>
<object class="GtkBox" id="queue_log_tab">
<property name="orientation">vertical</property>
- <property name="visible">False</property>
+ <property name="visible">True</property>
<property name="expand">True</property>
<property name="margin-top">12</property>
<property name="can_focus">False</property>
@@ -1346,6 +1346,7 @@ Resets the queue job to pending and ready to run again.</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="shadow_type">in</property>
<property name="vexpand">True</property>
+ <property name="margin-bottom">6</property>
<property name="valign">GTK_ALIGN_FILL</property>
<child>
<object class="GtkTextView" id="queue_activity_view">
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 7515f2728..3df99f574 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -1024,9 +1024,9 @@ ghb_activate_cb(GApplication * app, signal_user_data_t * ud)
ud->activity_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
g_object_ref(ud->activity_buffer);
widget = GHB_WIDGET(ud->builder, "queue_activity_view");
- ud->queue_activity_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
- g_object_ref(ud->queue_activity_buffer);
- ud->extra_activity_buffer = gtk_text_buffer_new(NULL);
+ ud->extra_activity_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
+ g_object_ref(ud->extra_activity_buffer);
+ ud->queue_activity_buffer = gtk_text_buffer_new(NULL);
// Must set the names of the widgets that I want to modify
// style for.
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index fa5242f69..b0b2f7fdc 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -572,6 +572,7 @@ void
queue_update_stats(GhbValue * queueDict, signal_user_data_t *ud)
{
GhbValue * uiDict;
+ GtkLabel * label;
uiDict = ghb_dict_get(queueDict, "uiSettings");
if (uiDict == NULL) // should never happen
@@ -579,9 +580,31 @@ queue_update_stats(GhbValue * queueDict, signal_user_data_t *ud)
return;
}
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_pass_label"));
+ gtk_widget_set_visible(GTK_WIDGET(label), FALSE);
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_pass"));
+ gtk_widget_set_visible(GTK_WIDGET(label), FALSE);
+
const char * result = "";
int status = ghb_dict_get_int(uiDict, "job_status");
+ if (status == GHB_QUEUE_PENDING)
+ {
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_start_time"));
+ gtk_label_set_text(label, "");
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_finish_time"));
+ gtk_label_set_text(label, "");
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_paused"));
+ gtk_label_set_text(label, "");
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_encode"));
+ gtk_label_set_text(label, "");
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_file_size"));
+ gtk_label_set_text(label, "");
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_result"));
+ gtk_label_set_text(label, "Pending");
+ return;
+ }
+
switch (status)
{
case GHB_QUEUE_RUNNING:
@@ -603,12 +626,10 @@ queue_update_stats(GhbValue * queueDict, signal_user_data_t *ud)
case GHB_QUEUE_PENDING:
default:
- // Should never happen
- result = _("Unknown");
+ result = _("Pending");
break;
}
- GtkLabel * label;
struct tm * tm;
char date[40] = "";
char * str;
@@ -618,11 +639,6 @@ queue_update_stats(GhbValue * queueDict, signal_user_data_t *ud)
finish = ghb_dict_get_int(uiDict, "job_finish_time");
paused = ghb_dict_get_int(uiDict, "job_pause_time_ms") / 1000;
- label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_pass_label"));
- gtk_widget_set_visible(GTK_WIDGET(label), FALSE);
- label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_pass"));
- gtk_widget_set_visible(GTK_WIDGET(label), FALSE);
-
tm = localtime( &start );
strftime(date, 40, "%c", tm);
label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_stats_start_time"));
@@ -722,6 +738,28 @@ queue_update_stats(GhbValue * queueDict, signal_user_data_t *ud)
gtk_label_set_text(label, result);
}
+void queue_update_current_stats(signal_user_data_t * ud)
+{
+ GtkListBox * lb;
+ GtkListBoxRow * row;
+ gint index;
+ GhbValue * queueDict;
+
+ lb = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "queue_list"));
+ row = gtk_list_box_get_selected_row(lb);
+ if (row != NULL)
+ {
+ // There is a queue list row selected
+ index = gtk_list_box_row_get_index(row);
+ if (index < 0 || index >= ghb_array_len(ud->queue))
+ { // Should never happen
+ return;
+ }
+ queueDict = ghb_array_get(ud->queue, index);
+ queue_update_stats(queueDict, ud);
+ }
+}
+
#define ACTIVITY_MAX_READ_SZ (1024*1024)
static void read_log(signal_user_data_t * ud, const char * log_path)
{
@@ -779,10 +817,7 @@ void ghb_queue_select_log(signal_user_data_t * ud)
GtkTextBuffer * current;
gint index;
GhbValue * queueDict, *uiDict;
- GtkWidget * queue_log_tab, * queue_stats_tab;
- queue_log_tab = GHB_WIDGET(ud->builder, "queue_log_tab");
- queue_stats_tab = GHB_WIDGET(ud->builder, "queue_stats_tab");
lb = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "queue_list"));
row = gtk_list_box_get_selected_row(lb);
if (row != NULL)
@@ -790,6 +825,7 @@ void ghb_queue_select_log(signal_user_data_t * ud)
// There is a queue list row selected
GtkTextView * tv;
int status;
+ const char * log_path;
index = gtk_list_box_row_get_index(row);
if (index < 0 || index >= ghb_array_len(ud->queue))
@@ -801,13 +837,22 @@ void ghb_queue_select_log(signal_user_data_t * ud)
// Get the current buffer that is displayed in the queue log
tv = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "queue_activity_view"));
current = gtk_text_view_get_buffer(tv);
+
status = ghb_dict_get_int(uiDict, "job_status");
+ log_path = ghb_dict_get_string(uiDict, "ActivityFilename");
+ if (status != GHB_QUEUE_PENDING && log_path != NULL)
+ {
+ ghb_ui_update(ud, "queue_activity_location",
+ ghb_string_value(log_path));
+ }
+ else
+ {
+ ghb_ui_update(ud, "queue_activity_location", ghb_string_value(""));
+ }
if (status == GHB_QUEUE_RUNNING)
{
// Selected encode is running, enable display of log and
// show the live buffer
- gtk_widget_set_visible(queue_log_tab, TRUE);
- gtk_widget_set_visible(queue_stats_tab, TRUE);
if (ud->queue_activity_buffer != current)
{
gtk_text_view_set_buffer(tv, ud->queue_activity_buffer);
@@ -815,8 +860,6 @@ void ghb_queue_select_log(signal_user_data_t * ud)
}
else
{
- const char * log_path;
-
// Selected encode is pending/finished/canceled/failed
// use non-live buffer (aka extra) to display log
if (ud->extra_activity_buffer != current)
@@ -827,27 +870,18 @@ void ghb_queue_select_log(signal_user_data_t * ud)
if (status != GHB_QUEUE_PENDING && log_path != NULL)
{
// enable display of log and read log into display buffer
- gtk_widget_set_visible(queue_log_tab, TRUE);
- gtk_widget_set_visible(queue_stats_tab, TRUE);
- ghb_ui_update(ud, "queue_activity_location",
- ghb_string_value(log_path));
read_log(ud, log_path);
}
else
{
// No log file, encode is pending
// disable display of log
- gtk_widget_set_visible(queue_log_tab, FALSE);
- gtk_widget_set_visible(queue_stats_tab, FALSE);
+ g_free(ud->extra_activity_path);
+ ud->extra_activity_path = NULL;
+ gtk_text_buffer_set_text(ud->extra_activity_buffer, "", 0);
}
}
}
- else
- {
- // No row selected, disable display of log
- gtk_widget_set_visible(queue_log_tab, FALSE);
- gtk_widget_set_visible(queue_stats_tab, FALSE);
- }
}
void
@@ -2708,6 +2742,7 @@ queue_reset_all_action_cb(GSimpleAction *action, GVariant *param,
{
ghb_update_all_status(ud, GHB_QUEUE_PENDING);
ghb_save_queue(ud->queue);
+ queue_update_current_stats(ud);
ghb_queue_select_log(ud);
ghb_update_pending(ud);
}
@@ -2731,6 +2766,7 @@ queue_reset_fail_action_cb(GSimpleAction *action, GVariant *param,
}
}
ghb_save_queue(ud->queue);
+ queue_update_current_stats(ud);
ghb_queue_select_log(ud);
ghb_update_pending(ud);
ghb_queue_buttons_grey(ud);
@@ -2751,6 +2787,7 @@ queue_reset_action_cb(GSimpleAction *action, GVariant *param,
index = gtk_list_box_row_get_index(row);
ghb_queue_update_status(ud, index, GHB_QUEUE_PENDING);
ghb_save_queue(ud->queue);
+ queue_update_current_stats(ud);
ghb_queue_select_log(ud);
ghb_update_pending(ud);
}