summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-06-27 11:57:06 -0700
committerJohn Stebbins <[email protected]>2019-06-27 11:57:06 -0700
commit19ba0208c2ac34ddaffed61af3ffecdc87d77576 (patch)
treec3e3f74589e3e1cb6b7aea345a8b576ef2db70d1
parentb0a88a4221c2e698847987b28a15fb8d5d6a5dcf (diff)
LinGui: add options to open encode log and log directory
... To the "Actions" menu button on the queue window
-rw-r--r--gtk/src/ghb.m48
-rw-r--r--gtk/src/main.c6
-rw-r--r--gtk/src/queuehandler.c98
3 files changed, 112 insertions, 0 deletions
diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4
index da02b276e..cae4291f4 100644
--- a/gtk/src/ghb.m4
+++ b/gtk/src/ghb.m4
@@ -101,6 +101,14 @@ conjunction with the "Forced" option.</property>
<attribute name="label" translatable="yes">Open Destination Directory</attribute>
<attribute name="action">app.queue-open-dest</attribute>
</item>
+ <item>
+ <attribute name="label" translatable="yes">Open Encode Log Directory</attribute>
+ <attribute name="action">app.queue-open-log-dir</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Open Encode Log</attribute>
+ <attribute name="action">app.queue-open-log</attribute>
+ </item>
</section>
</menu>
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 3df99f574..c407edfe6 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -828,6 +828,10 @@ queue_open_source_action_cb(GSimpleAction *action, GVariant *param, gpointer ud)
G_MODULE_EXPORT void
queue_open_dest_action_cb(GSimpleAction *action, GVariant *param, gpointer ud);
G_MODULE_EXPORT void
+queue_open_log_dir_action_cb(GSimpleAction *action, GVariant *param, gpointer ud);
+G_MODULE_EXPORT void
+queue_open_log_action_cb(GSimpleAction *action, GVariant *param, gpointer ud);
+G_MODULE_EXPORT void
queue_delete_all_action_cb(GSimpleAction *action, GVariant *param,
gpointer ud);
G_MODULE_EXPORT void
@@ -895,6 +899,8 @@ static void map_actions(GApplication * app, signal_user_data_t * ud)
{ "queue-pause", queue_pause_action_cb },
{ "queue-open-source", queue_open_source_action_cb },
{ "queue-open-dest", queue_open_dest_action_cb },
+ { "queue-open-log-dir", queue_open_log_dir_action_cb },
+ { "queue-open-log", queue_open_log_action_cb },
{ "queue-reset-fail", queue_reset_fail_action_cb },
{ "queue-reset-all", queue_reset_all_action_cb },
{ "queue-reset", queue_reset_action_cb },
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index b0b2f7fdc..1cc358756 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -2179,10 +2179,24 @@ ghb_queue_buttons_grey(signal_user_data_t *ud)
gboolean allow_start, show_stop, allow_add, paused;
GtkListBox * lb;
GtkListBoxRow * row;
+ gint index, status = GHB_QUEUE_PENDING;
lb = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "queue_list"));
row = gtk_list_box_get_selected_row(lb);
+ if (row != NULL)
+ {
+ index = gtk_list_box_row_get_index(row);
+ if (index >= 0 && index < ghb_array_len(ud->queue))
+ {
+ GhbValue * queueDict, *uiDict;
+
+ queueDict = ghb_array_get(ud->queue, index);
+ uiDict = ghb_dict_get(queueDict, "uiSettings");
+ status = ghb_dict_get_int(uiDict, "job_status");
+ }
+ }
+
queue_count = ghb_array_len(ud->queue);
title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
@@ -2232,6 +2246,14 @@ ghb_queue_buttons_grey(signal_user_data_t *ud)
"queue-open-dest"));
g_simple_action_set_enabled(action, row != NULL);
+ action = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(ud->app),
+ "queue-open-log-dir"));
+ g_simple_action_set_enabled(action, status != GHB_QUEUE_PENDING);
+
+ action = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(ud->app),
+ "queue-open-log"));
+ g_simple_action_set_enabled(action, status != GHB_QUEUE_PENDING);
+
widget = GHB_WIDGET (ud->builder, "queue_start");
if (show_stop)
{
@@ -2557,6 +2579,80 @@ queue_open_dest_action_cb(GSimpleAction *action, GVariant *param,
}
G_MODULE_EXPORT void
+queue_open_log_action_cb(GSimpleAction *action, GVariant *param,
+ signal_user_data_t *ud)
+{
+ GtkListBox * lb;
+ GtkListBoxRow * row;
+ gint index;
+ GhbValue * queueDict, * uiDict;
+ GString * str;
+ const char * path;
+ char * uri;
+
+ lb = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "queue_list"));
+ row = gtk_list_box_get_selected_row(lb);
+ if (row != NULL)
+ {
+ index = gtk_list_box_row_get_index(row);
+ if (index < 0 || index >= ghb_array_len(ud->queue))
+ {
+ return;
+ }
+ queueDict = ghb_array_get(ud->queue, index);
+ uiDict = ghb_dict_get(queueDict, "uiSettings");
+ path = ghb_dict_get_string(uiDict, "ActivityFilename");
+ if (path == NULL)
+ {
+ return;
+ }
+ str = g_string_new(NULL);
+ g_string_printf(str, "file://%s", path);
+ uri = g_string_free(str, FALSE);
+ ghb_browse_uri(ud, uri);
+ g_free(uri);
+ }
+}
+
+G_MODULE_EXPORT void
+queue_open_log_dir_action_cb(GSimpleAction *action, GVariant *param,
+ signal_user_data_t *ud)
+{
+ GtkListBox * lb;
+ GtkListBoxRow * row;
+ gint index;
+ GhbValue * queueDict, * uiDict;
+ GString * str;
+ const char * path;
+ char * dir, * uri;
+
+ lb = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "queue_list"));
+ row = gtk_list_box_get_selected_row(lb);
+ if (row != NULL)
+ {
+ index = gtk_list_box_row_get_index(row);
+ if (index < 0 || index >= ghb_array_len(ud->queue))
+ {
+ return;
+ }
+ queueDict = ghb_array_get(ud->queue, index);
+ uiDict = ghb_dict_get(queueDict, "uiSettings");
+ path = ghb_dict_get_string(uiDict, "ActivityFilename");
+ if (path == NULL)
+ {
+ return;
+ }
+ dir = g_path_get_dirname(path);
+ str = g_string_new(NULL);
+ g_string_printf(str, "file://%s", dir);
+ uri = g_string_free(str, FALSE);
+ ghb_browse_uri(ud, uri);
+ g_free(uri);
+ g_free(dir);
+ }
+}
+
+G_MODULE_EXPORT void
queue_list_selection_changed_cb(GtkListBox *box, GtkListBoxRow *row,
signal_user_data_t *ud)
{
@@ -2745,6 +2841,7 @@ queue_reset_all_action_cb(GSimpleAction *action, GVariant *param,
queue_update_current_stats(ud);
ghb_queue_select_log(ud);
ghb_update_pending(ud);
+ ghb_queue_buttons_grey(ud);
}
G_MODULE_EXPORT void
@@ -2790,6 +2887,7 @@ queue_reset_action_cb(GSimpleAction *action, GVariant *param,
queue_update_current_stats(ud);
ghb_queue_select_log(ud);
ghb_update_pending(ud);
+ ghb_queue_buttons_grey(ud);
}
}