summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-10-12 22:58:01 +0000
committerjstebbins <[email protected]>2010-10-12 22:58:01 +0000
commit40ce642aaeeebf87ad5af699f993716a026fd48d (patch)
tree11a15472fc5cd97b6bc8bf142197713ae066bd02
parentb41e92fff1731fad2595143b7c3f5f79aeaf89f7 (diff)
LinGui: add "Quit HandBrake" option to "When Done" options
Thanks to mxttie for the patch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3600 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--gtk/src/callbacks.c39
-rw-r--r--gtk/src/hb-backend.c1
2 files changed, 38 insertions, 2 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 2fb880f18..a964cf843 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1974,9 +1974,32 @@ typedef struct
const gchar *msg;
const gchar *action;
gint timeout;
+ signal_user_data_t *ud;
} countdown_t;
static gboolean
+quit_cb(countdown_t *cd)
+{
+ gchar *str;
+
+ cd->timeout--;
+ if (cd->timeout == 0)
+ {
+ ghb_hb_cleanup(FALSE);
+ prune_logs(cd->ud);
+
+ gtk_widget_destroy (GTK_WIDGET(cd->dlg));
+ gtk_main_quit();
+ return FALSE;
+ }
+ str = g_strdup_printf("%s\n\n%s in %d seconds ...",
+ cd->msg, cd->action, cd->timeout);
+ gtk_message_dialog_set_markup(cd->dlg, str);
+ g_free(str);
+ return TRUE;
+}
+
+static gboolean
shutdown_cb(countdown_t *cd)
{
gchar *str;
@@ -1984,6 +2007,9 @@ shutdown_cb(countdown_t *cd)
cd->timeout--;
if (cd->timeout == 0)
{
+ ghb_hb_cleanup(FALSE);
+ prune_logs(cd->ud);
+
ghb_shutdown_gsm();
gtk_main_quit();
return FALSE;
@@ -2021,6 +2047,7 @@ ghb_countdown_dialog(
const gchar *action,
const gchar *cancel,
GSourceFunc action_func,
+ signal_user_data_t *ud,
gint timeout)
{
GtkWidget *dialog;
@@ -2031,6 +2058,7 @@ ghb_countdown_dialog(
cd.msg = message;
cd.action = action;
cd.timeout = timeout;
+ cd.ud = ud;
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
@@ -4852,7 +4880,7 @@ ghb_notify_done(signal_user_data_t *ud)
ghb_countdown_dialog(GTK_MESSAGE_WARNING,
"Your encode is complete.",
"Shutting down the computer",
- "Cancel", (GSourceFunc)shutdown_cb, 60);
+ "Cancel", (GSourceFunc)shutdown_cb, ud, 60);
}
}
if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 2)
@@ -4862,7 +4890,14 @@ ghb_notify_done(signal_user_data_t *ud)
ghb_countdown_dialog(GTK_MESSAGE_WARNING,
"Your encode is complete.",
"Putting computer to sleep",
- "Cancel", (GSourceFunc)suspend_cb, 60);
+ "Cancel", (GSourceFunc)suspend_cb, ud, 60);
}
}
+ if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 4)
+ {
+ ghb_countdown_dialog(GTK_MESSAGE_WARNING,
+ "Your encode is complete.",
+ "Quiting Handbrake",
+ "Cancel", (GSourceFunc)quit_cb, ud, 60);
+ }
}
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 6f44ecf42..eb6e233f6 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -86,6 +86,7 @@ static options_map_t d_when_complete_opts[] =
{
{"Do Nothing", "nothing", 0, "0"},
{"Show Notification", "notify", 1, "1"},
+ {"Quit Handbrake", "quit", 4, "4"},
{"Put Computer To Sleep", "sleep", 2, "2"},
{"Shutdown Computer", "shutdown", 3, "3"},
};