GtkTreeView *treeview;
GtkTreeStore *store;
GtkTreeIter iter;
- static gint working = 0;
- static gboolean work_started = FALSE;
+ static gint prev_scan_state = 0;
+ static gint prev_queue_state = 0;
ghb_track_status();
ghb_get_status(&status);
+ if (prev_scan_state != status.scan.state ||
+ prev_queue_state != status.queue.state)
+ {
+ ghb_queue_buttons_grey(ud);
+ prev_scan_state = status.scan.state;
+ prev_queue_state = status.queue.state;
+ }
progress = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "progressbar"));
work_status = GTK_LABEL(GHB_WIDGET (ud->builder, "work_status"));
if (status.scan.state == GHB_STATE_IDLE &&
gtk_label_set_text(label, "None");
}
ghb_clear_scan_state(GHB_STATE_SCANDONE);
- ghb_queue_buttons_grey(ud, work_started);
if (ghb_queue_edit_settings)
{
gint jstatus;
{
// This needs to be in scanning and working since scanning
// happens fast enough that it can be missed
- if (!work_started)
- {
- work_started = TRUE;
- ghb_queue_buttons_grey(ud, TRUE);
- }
gtk_label_set_text (work_status, "Scanning ...");
gtk_progress_bar_set_fraction (progress, 0);
}
}
else if (status.queue.state & GHB_STATE_WORKING)
{
+ static gint working = 0;
+
// This needs to be in scanning and working since scanning
// happens fast enough that it can be missed
- if (!work_started)
- {
- work_started = TRUE;
- ghb_queue_buttons_grey(ud, TRUE);
- }
index = find_queue_job(ud->queue, status.queue.unique_id, &js);
if (status.queue.unique_id != 0 && index >= 0)
{
{
gint qstatus;
- work_started = FALSE;
- ghb_queue_buttons_grey(ud, FALSE);
index = find_queue_job(ud->queue, status.queue.unique_id, &js);
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
<signal handler="queue_pause_clicked_cb" name="activate"/>
</object>
</child>
- <child>
- <object class="GtkAction" id="queue_stop_menu">
- <property name="sensitive">False</property>
- <property name="icon-name">hb-stop</property>
- <property name="name">queue_stop_menu</property>
- <property name="label" translatable="yes">S_top Queue</property>
- <signal handler="queue_stop_clicked_cb" name="activate"/>
- </object>
- </child>
<child>
<object class="GtkAction" id="menuitem3">
<property name="name">menuitem3</property>
<menuitem action="queue_add_menu"/>
<menuitem action="queue_start_menu"/>
<menuitem action="queue_pause_menu"/>
- <menuitem action="queue_stop_menu"/>
</menu>
<menu action="menuitem3">
<menuitem action="hbfd"/>
<property name="expand">False</property>
</packing>
</child>
- <child>
- <object class="GtkToolButton" id="queue_stop1">
- <property name="visible">False</property>
- <property name="sensitive">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">Stop Encoding</property>
- <property name="label" translatable="yes">Stop</property>
- <property name="icon_name">hb-stop</property>
- <signal handler="queue_stop_clicked_cb" name="clicked"/>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
<child>
<object class="GtkToolButton" id="queue_pause1">
<property name="visible">True</property>
<property name="expand">False</property>
</packing>
</child>
- <child>
- <object class="GtkToolButton" id="queue_stop">
- <property name="visible">True</property>
- <property name="sensitive">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="label" translatable="yes">Stop</property>
- <property name="icon_name">hb-stop</property>
- <signal handler="queue_stop_clicked_cb" name="clicked"/>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
<child>
<object class="GtkToolButton" id="queue_edit">
<property name="visible">True</property>
}
void
-ghb_queue_buttons_grey(signal_user_data_t *ud, gboolean working)
+ghb_queue_buttons_grey(signal_user_data_t *ud)
{
GtkWidget *widget;
GtkAction *action;
gint queue_count;
gint titleindex;
- gboolean title_ok;
+ gint queue_state, scan_state;
+ gboolean show_start, show_stop, paused;
queue_count = ghb_array_len(ud->queue);
titleindex = ghb_settings_combo_int(ud->settings, "title");
- title_ok = (titleindex >= 0);
+
+ queue_state = ghb_get_queue_state();
+ scan_state = ghb_get_scan_state();
+
+ show_stop = queue_state &
+ (GHB_STATE_WORKING | GHB_STATE_SCANNING | GHB_STATE_MUXING);
+ show_start = !(scan_state & GHB_STATE_SCANNING) &&
+ (titleindex >= 0 || queue_count > 0);
+
+
+ paused = queue_state & GHB_STATE_PAUSED;
widget = GHB_WIDGET (ud->builder, "queue_start1");
- gtk_widget_set_sensitive (widget, !working && (title_ok || queue_count));
- if (working)
+ if (show_stop)
{
- gtk_widget_hide (widget);
- widget = GHB_WIDGET (ud->builder, "queue_stop1");
- gtk_widget_show (widget);
+ gtk_widget_set_sensitive (widget, TRUE);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
}
else
{
- widget = GHB_WIDGET (ud->builder, "queue_stop1");
- gtk_widget_hide (widget);
- widget = GHB_WIDGET (ud->builder, "queue_start1");
- gtk_widget_show (widget);
+ gtk_widget_set_sensitive (widget, show_start);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
}
widget = GHB_WIDGET (ud->builder, "queue_start2");
- gtk_widget_set_sensitive (widget, !working && (title_ok || queue_count));
- action = GHB_ACTION (ud->builder, "queue_start_menu");
- gtk_action_set_sensitive (action, !working && (title_ok || queue_count));
+ if (show_stop)
+ {
+ gtk_widget_set_sensitive (widget, TRUE);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
+ }
+ else
+ {
+ gtk_widget_set_sensitive (widget, show_start);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
+ }
widget = GHB_WIDGET (ud->builder, "queue_pause1");
- gtk_widget_set_sensitive (widget, working);
+ if (paused)
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
+ }
+ else
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
+ }
widget = GHB_WIDGET (ud->builder, "queue_pause2");
- gtk_widget_set_sensitive (widget, working);
+ if (paused)
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
+ }
+ else
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
+ }
+
+ action = GHB_ACTION (ud->builder, "queue_start_menu");
+ if (show_stop)
+ {
+ gtk_action_set_sensitive (action, TRUE);
+ gtk_action_set_icon_name(action, "hb-stop");
+ gtk_action_set_label(action, "S_top Queue");
+ }
+ else
+ {
+ gtk_action_set_sensitive (action, show_start);
+ gtk_action_set_icon_name(action, "hb-play");
+ gtk_action_set_label(action, "_Start Queue");
+ }
action = GHB_ACTION (ud->builder, "queue_pause_menu");
- gtk_action_set_sensitive (action, working);
- widget = GHB_WIDGET (ud->builder, "queue_stop");
- gtk_widget_set_sensitive (widget, working);
- action = GHB_ACTION (ud->builder, "queue_stop_menu");
- gtk_action_set_sensitive (action, working);
+ if (paused)
+ {
+ gtk_action_set_sensitive (action, show_start);
+ gtk_action_set_icon_name(action, "hb-play");
+ gtk_action_set_label(action, "_Resume Queue");
+ }
+ else
+ {
+ gtk_action_set_sensitive (action, show_stop);
+ gtk_action_set_icon_name(action, "hb-pause");
+ gtk_action_set_label(action, "_Pause Queue");
+ }
}
G_MODULE_EXPORT void
gint status;
gint state;
+ state = ghb_get_queue_state();
+ if (state & (GHB_STATE_WORKING | GHB_STATE_SCANNING | GHB_STATE_MUXING))
+ {
+ ud->cancel_encode = TRUE;
+ ghb_cancel_encode(NULL);
+ return;
+ }
+
count = ghb_array_len(ud->queue);
for (ii = 0; ii < count; ii++)
{
if (!queue_add(ud))
return;
}
- state = ghb_get_queue_state();
if (state == GHB_STATE_IDLE)
{
// Add the first pending queue item and start
}
}
-G_MODULE_EXPORT void
-queue_stop_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
-{
- ud->cancel_encode = TRUE;
- ghb_cancel_encode(NULL);
-}
-
G_MODULE_EXPORT void
queue_pause_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
add_to_queue_list(ud, settings, NULL);
}
- ghb_queue_buttons_grey(ud, FALSE);
+ ghb_queue_buttons_grey(ud);
}
else
{