summaryrefslogtreecommitdiffstats
path: root/gtk/src/callbacks.c
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-09-06 17:11:27 +0000
committersr55 <[email protected]>2013-09-06 17:11:27 +0000
commit10f5aec2de68e0f60a13c7696832e1a02dff187b (patch)
treea987ad5db3e0da36eb9757711764a3b59e7f7de7 /gtk/src/callbacks.c
parentf35cf60ca4a4b94f352afc22cc2252ffe7ff67d1 (diff)
OpenCL: Merging Trunk to OpenCL Branch.
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5770 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/callbacks.c')
-rw-r--r--gtk/src/callbacks.c202
1 files changed, 108 insertions, 94 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index eead66275..a6839c42b 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -21,6 +21,7 @@
#include <time.h>
#include <glib/gstdio.h>
+#include <glib/gi18n.h>
#include <gio/gio.h>
#include "ghbcompat.h"
@@ -324,7 +325,7 @@ on_quit1_activate(GtkMenuItem *quit, signal_user_data_t *ud)
g_debug("on_quit1_activate ()");
if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING))
{
- if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n"))
+ if (ghb_cancel_encode2(ud, _("Closing HandBrake will terminate encoding.\n")))
{
ghb_hb_cleanup(FALSE);
prune_logs(ud);
@@ -563,21 +564,17 @@ static const gchar*
get_extension(GValue *settings)
{
int container;
- const gchar *extension = "error";
+ const gchar *extension;
container = ghb_settings_combo_int(settings, "FileFormat");
- if (container == HB_MUX_MP4)
- {
- extension = "mp4";
- if (ghb_settings_get_boolean(settings, "UseM4v"))
- {
- extension = "m4v";
- }
- }
- else if (container == HB_MUX_MKV)
+ if ((container & HB_MUX_MASK_MP4) &&
+ ghb_settings_get_boolean(settings, "UseM4v"))
{
- extension = "mkv";
+ return "m4v";
}
+ extension = hb_container_get_default_extension(container);
+ if (extension == NULL)
+ extension = "error";
return extension;
}
@@ -776,7 +773,7 @@ update_source_label(signal_user_data_t *ud, const gchar *source, gboolean update
}
else
{
- label = "No Title Found";
+ label = _("No Title Found");
gtk_label_set_text (GTK_LABEL(widget), label);
ghb_settings_set_string(ud->settings, "volume_label", label);
return FALSE;
@@ -860,7 +857,7 @@ source_dialog_extra_widgets(
gtk_combo_box_get_model(GTK_COMBO_BOX(combo))));
link = drives = dvd_device_list();
- gtk_combo_box_text_append_text (combo, "Not Selected");
+ gtk_combo_box_text_append_text (combo, _("Not Selected"));
while (link != NULL)
{
gchar *name = get_dvd_device_name(link->data);
@@ -887,7 +884,7 @@ show_scan_progress(signal_user_data_t *ud)
gtk_widget_show(GTK_WIDGET(progress));
label = GTK_LABEL(GHB_WIDGET(ud->builder, "source_title"));
- gtk_label_set_text( label, "Scanning ..." );
+ gtk_label_set_text( label, _("Scanning ...") );
}
static void
@@ -907,8 +904,8 @@ start_scan(
widget = GHB_WIDGET(ud->builder, "sourcetoolbutton");
gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop Scan");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Scan");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), _("Stop Scan"));
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Stop Scan"));
//gtk_widget_set_sensitive(widget, FALSE);
action = GHB_ACTION(ud->builder, "source_action");
@@ -1082,7 +1079,7 @@ dvd_source_activate_cb(GtkAction *action, signal_user_data_t *ud)
void
ghb_update_destination_extension(signal_user_data_t *ud)
{
- static gchar *containers[] = {".mkv", ".mp4", ".m4v", NULL};
+ static gchar *containers[] = {".mkv", ".mp4", ".m4v", ".error", NULL};
gchar *filename;
const gchar *extension;
gint ii;
@@ -1262,7 +1259,7 @@ window_delete_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *u
g_debug("window_delete_event_cb ()");
if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING))
{
- if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n"))
+ if (ghb_cancel_encode2(ud, _("Closing HandBrake will terminate encoding.\n")))
{
ghb_hb_cleanup(FALSE);
prune_logs(ud);
@@ -1284,12 +1281,41 @@ update_acodec_combo(signal_user_data_t *ud)
ghb_grey_combo_options (ud);
}
+static void
+set_visible(GtkWidget *widget, gboolean visible)
+{
+ if (visible)
+ {
+ gtk_widget_show_now(widget);
+ }
+ else
+ {
+ gtk_widget_hide(widget);
+ }
+}
+
+static void show_container_options(signal_user_data_t *ud)
+{
+ GtkWidget *w1, *w2, *w3;
+ w1 = GHB_WIDGET(ud->builder, "Mp4LargeFile");
+ w2 = GHB_WIDGET(ud->builder, "Mp4HttpOptimize");
+ w3 = GHB_WIDGET(ud->builder, "Mp4iPodCompatible");
+
+ gint mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ gint enc = ghb_settings_combo_int(ud->settings, "VideoEncoder");
+
+ set_visible(w1, (mux == HB_MUX_MP4V2));
+ set_visible(w2, (mux & HB_MUX_MASK_MP4));
+ set_visible(w3, (mux & HB_MUX_MASK_MP4) && (enc == HB_VCODEC_X264));
+}
+
G_MODULE_EXPORT void
container_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("container_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
+ show_container_options(ud);
update_acodec_combo(ud);
ghb_update_destination_extension(ud);
ghb_clear_presets_selection(ud);
@@ -1398,7 +1424,7 @@ show_title_info(signal_user_data_t *ud, hb_title_t *title)
}
else
{
- gchar *label = "No Title Found";
+ gchar *label = _("No Title Found");
gtk_label_set_text (GTK_LABEL(widget), label);
ghb_settings_set_string(ud->settings, "volume_label", label);
}
@@ -1579,7 +1605,7 @@ set_title_settings(GValue *settings, gint titleindex)
}
else
{
- gchar *label = "No Title Found";
+ gchar *label = _("No Title Found");
ghb_settings_set_string(settings, "volume_label", label);
}
}
@@ -1883,6 +1909,7 @@ vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
+ show_container_options(ud);
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
@@ -2134,28 +2161,28 @@ scale_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
gchar *text;
- text = ghb_settings_get_boolean(ud->settings, "PictureAutoCrop") ? "On" : "Off";
+ text = ghb_settings_get_boolean(ud->settings, "PictureAutoCrop") ? _("On") : _("Off");
widget = GHB_WIDGET (ud->builder, "crop_auto");
gtk_label_set_text (GTK_LABEL(widget), text);
- text = ghb_settings_get_boolean(ud->settings, "autoscale") ? "On" : "Off";
+ text = ghb_settings_get_boolean(ud->settings, "autoscale") ? _("On") : _("Off");
widget = GHB_WIDGET (ud->builder, "scale_auto");
gtk_label_set_text (GTK_LABEL(widget), text);
switch (ghb_settings_combo_int(ud->settings, "PicturePAR"))
{
case 0:
- text = "Off";
+ text = _("Off");
break;
case 1:
- text = "Strict";
+ text = _("Strict");
break;
case 2:
- text = "Loose";
+ text = _("Loose");
break;
case 3:
- text = "Custom";
+ text = _("Custom");
break;
default:
- text = "Unknown";
+ text = _("Unknown");
break;
}
widget = GHB_WIDGET (ud->builder, "scale_anamorphic");
@@ -2226,7 +2253,7 @@ quit_cb(countdown_t *cd)
gtk_main_quit();
return FALSE;
}
- str = g_strdup_printf("%s\n\n%s in %d seconds ...",
+ 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);
@@ -2248,7 +2275,7 @@ shutdown_cb(countdown_t *cd)
gtk_main_quit();
return FALSE;
}
- str = g_strdup_printf("%s\n\n%s in %d seconds ...",
+ 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);
@@ -2267,7 +2294,7 @@ suspend_cb(countdown_t *cd)
ghb_suspend_gpm();
return FALSE;
}
- str = g_strdup_printf("%s\n\n%s in %d seconds ...",
+ 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);
@@ -2297,7 +2324,7 @@ ghb_countdown_dialog(
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
type, GTK_BUTTONS_NONE,
- "%s\n\n%s in %d seconds ...",
+ _("%s\n\n%s in %d seconds ..."),
message, action, timeout);
gtk_dialog_add_buttons( GTK_DIALOG(dialog),
cancel, GTK_RESPONSE_CANCEL,
@@ -2366,13 +2393,13 @@ ghb_cancel_encode(signal_user_data_t *ud, const gchar *extra_msg)
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
- "%sYour movie will be lost if you don't continue encoding.",
+ _("%sYour movie will be lost if you don't continue encoding."),
extra_msg);
gtk_dialog_add_buttons( GTK_DIALOG(dialog),
- "Cancel Current and Stop", 1,
- "Cancel Current, Start Next", 2,
- "Finish Current, then Stop", 3,
- "Continue Encoding", 4,
+ _("Cancel Current and Stop"), 1,
+ _("Cancel Current, Start Next"), 2,
+ _("Finish Current, then Stop"), 3,
+ _("Continue Encoding"), 4,
NULL);
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
@@ -2406,11 +2433,11 @@ ghb_cancel_encode2(signal_user_data_t *ud, const gchar *extra_msg)
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
- "%sYour movie will be lost if you don't continue encoding.",
+ _("%sYour movie will be lost if you don't continue encoding."),
extra_msg);
gtk_dialog_add_buttons( GTK_DIALOG(dialog),
- "Cancel Current and Stop", 1,
- "Continue Encoding", 4,
+ _("Cancel Current and Stop"), 1,
+ _("Continue Encoding"), 4,
NULL);
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
@@ -2709,7 +2736,7 @@ working_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
}
if (qcount > 1)
{
- job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
+ job_str = g_strdup_printf(_("job %d of %d, "), index+1, qcount);
}
else
{
@@ -2719,12 +2746,12 @@ working_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
{
if (status->job_cur == 1 && subtitle_scan)
{
- task_str = g_strdup_printf("pass %d (subtitle scan) of %d, ",
+ task_str = g_strdup_printf(_("pass %d (subtitle scan) of %d, "),
status->job_cur, status->job_count);
}
else
{
- task_str = g_strdup_printf("pass %d of %d, ",
+ task_str = g_strdup_printf(_("pass %d of %d, "),
status->job_cur, status->job_count);
}
}
@@ -2737,8 +2764,8 @@ working_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
if (status->rate_cur > 0.0)
{
status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%"
- " (%.2f fps, avg %.2f fps, ETA %02dh%02dm%02ds)",
+ _("Encoding: %s%s%.2f %%"
+ " (%.2f fps, avg %.2f fps, ETA %02dh%02dm%02ds)"),
job_str, task_str,
100.0 * status->progress,
status->rate_cur, status->rate_avg, status->hours,
@@ -2747,8 +2774,8 @@ working_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
else
{
status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%"
- " (ETA %02dh%02dm%02ds)",
+ _("Encoding: %s%s%.2f %%"
+ " (ETA %02dh%02dm%02ds)"),
job_str, task_str,
100.0 * status->progress,
status->hours, status->minutes, status->seconds );
@@ -2757,7 +2784,7 @@ working_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
else
{
status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%",
+ _("Encoding: %s%s%.2f %%"),
job_str, task_str,
100.0 * status->progress );
}
@@ -2778,18 +2805,18 @@ searching_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
index = find_queue_job(ud->queue, status->unique_id, &js);
if (qcount > 1)
{
- job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
+ job_str = g_strdup_printf(_("job %d of %d, "), index+1, qcount);
}
else
{
job_str = g_strdup("");
}
- task_str = g_strdup_printf("Searching for start time, ");
+ task_str = g_strdup_printf(_("Searching for start time, "));
if(status->seconds > -1)
{
status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%"
- " (ETA %02dh%02dm%02ds)",
+ _("Encoding: %s%s%.2f %%"
+ " (ETA %02dh%02dm%02ds)"),
job_str, task_str,
100.0 * status->progress,
status->hours, status->minutes, status->seconds );
@@ -2797,7 +2824,7 @@ searching_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
else
{
status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%",
+ _("Encoding: %s%s%.2f %%"),
job_str, task_str,
100.0 * status->progress );
}
@@ -2856,16 +2883,16 @@ ghb_backend_events(signal_user_data_t *ud)
if (status.scan.title_cur == 0)
{
- status_str = g_strdup ("Scanning...");
+ status_str = g_strdup (_("Scanning..."));
}
else
{
if (status.scan.preview_cur == 0)
- status_str = g_strdup_printf("Scanning title %d of %d...",
+ status_str = g_strdup_printf(_("Scanning title %d of %d..."),
status.scan.title_cur, status.scan.title_count );
else
status_str = g_strdup_printf(
- "Scanning title %d of %d preview %d...",
+ _("Scanning title %d of %d preview %d..."),
status.scan.title_cur, status.scan.title_count,
status.scan.preview_cur);
@@ -2888,8 +2915,8 @@ ghb_backend_events(signal_user_data_t *ud)
widget = GHB_WIDGET(ud->builder, "sourcetoolbutton");
gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-source");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Source");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Choose Video Source");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), _("Source"));
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Choose Video Source"));
action = GHB_ACTION(ud->builder, "source_action");
gtk_action_set_sensitive(action, TRUE);
@@ -2917,7 +2944,7 @@ ghb_backend_events(signal_user_data_t *ud)
hb_title_t * title = ghb_get_title_info(titleindex);
if (title == NULL)
{
- gtk_label_set_text(label, "None");
+ gtk_label_set_text(label, _("None"));
}
ghb_clear_scan_state(GHB_STATE_SCANDONE);
if (ghb_queue_edit_settings)
@@ -2935,7 +2962,7 @@ ghb_backend_events(signal_user_data_t *ud)
{
// This needs to be in scanning and working since scanning
// happens fast enough that it can be missed
- gtk_label_set_text (work_status, "Scanning ...");
+ gtk_label_set_text (work_status, _("Scanning ..."));
gtk_progress_bar_set_fraction (progress, 0);
}
else if (status.queue.state & GHB_STATE_SCANDONE)
@@ -2947,7 +2974,7 @@ ghb_backend_events(signal_user_data_t *ud)
}
else if (status.queue.state & GHB_STATE_PAUSED)
{
- gtk_label_set_text (work_status, "Paused");
+ gtk_label_set_text (work_status, _("Paused"));
}
else if (status.queue.state & GHB_STATE_SEARCHING)
{
@@ -3059,7 +3086,7 @@ ghb_backend_events(signal_user_data_t *ud)
switch( status.queue.error )
{
case GHB_ERROR_NONE:
- gtk_label_set_text (work_status, "Encode Done!");
+ gtk_label_set_text (work_status, _("Encode Done!"));
qstatus = GHB_QUEUE_DONE;
if (js != NULL)
{
@@ -3073,7 +3100,7 @@ ghb_backend_events(signal_user_data_t *ud)
}
break;
case GHB_ERROR_CANCELED:
- gtk_label_set_text (work_status, "Encode Canceled.");
+ gtk_label_set_text (work_status, _("Encode Canceled."));
qstatus = GHB_QUEUE_CANCELED;
if (js != NULL)
{
@@ -3087,7 +3114,7 @@ ghb_backend_events(signal_user_data_t *ud)
}
break;
default:
- gtk_label_set_text (work_status, "Encode Failed.");
+ gtk_label_set_text (work_status, _("Encode Failed."));
qstatus = GHB_QUEUE_CANCELED;
if (js != NULL)
{
@@ -3133,7 +3160,7 @@ ghb_backend_events(signal_user_data_t *ud)
}
else if (status.queue.state & GHB_STATE_MUXING)
{
- gtk_label_set_text (work_status, "Muxing: This may take a while...");
+ gtk_label_set_text (work_status, _("Muxing: This may take a while..."));
}
if (status.scan.state & GHB_STATE_WORKING)
@@ -3182,7 +3209,7 @@ status_icon_query_tooltip_cb(
else if (status.queue.state & GHB_STATE_SEARCHING)
status_str = searching_status_string(ud, &status.queue);
else if (status.queue.state & GHB_STATE_WORKDONE)
- status_str = g_strdup("Encode Complete");
+ status_str = g_strdup(_("Encode Complete"));
else
status_str = g_strdup("HandBrake");
@@ -3365,19 +3392,6 @@ ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data)
return TRUE;
}
-static void
-set_visible(GtkWidget *widget, gboolean visible)
-{
- if (visible)
- {
- gtk_widget_show_now(widget);
- }
- else
- {
- gtk_widget_hide(widget);
- }
-}
-
G_MODULE_EXPORT void
show_activity_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
@@ -4855,7 +4869,7 @@ tweak_setting_cb(
{
gchar *message;
message = g_strdup_printf(
- "Invalid Settings:\n%s",
+ _("Invalid Settings:\n%s"),
tweak);
ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
g_free(message);
@@ -4898,7 +4912,7 @@ format_deblock_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
{
if (val < 5.0)
{
- return g_strdup_printf("Off");
+ return g_strdup_printf(_("Off"));
}
else
{
@@ -4916,7 +4930,7 @@ format_vquality_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
{
if (val == 0.0)
{
- return g_strdup_printf("RF: %.4g (Warning: lossless)", val);
+ return g_strdup_printf(_("RF: %.4g (Warning: lossless)"), val);
}
else
{
@@ -4967,7 +4981,7 @@ process_appcast(signal_user_data_t *ud)
{
goto done;
}
- msg = g_strdup_printf("HandBrake %s/%s is now available (you have %s/%d).",
+ msg = g_strdup_printf(_("HandBrake %s/%s is now available (you have %s/%d)."),
version, build, hb_get_version(NULL), hb_get_build(NULL));
label = GHB_WIDGET(ud->builder, "update_message");
gtk_label_set_text(GTK_LABEL(label), msg);
@@ -5208,8 +5222,8 @@ ghb_notify_done(signal_user_data_t *ud)
#if !defined(_WIN32)
NotifyNotification *notification;
notification = notify_notification_new(
- "Encode Complete",
- "Put down that cocktail, Your HandBrake queue is done!",
+ _("Encode Complete"),
+ _("Put down that cocktail, Your HandBrake queue is done!"),
NULL
#if NOTIFY_CHECK_VERSION (0, 7, 0)
);
@@ -5233,9 +5247,9 @@ ghb_notify_done(signal_user_data_t *ud)
if (ghb_can_shutdown_gsm())
{
ghb_countdown_dialog(GTK_MESSAGE_WARNING,
- "Your encode is complete.",
- "Shutting down the computer",
- "Cancel", (GSourceFunc)shutdown_cb, ud, 60);
+ _("Your encode is complete."),
+ _("Shutting down the computer"),
+ _("Cancel"), (GSourceFunc)shutdown_cb, ud, 60);
}
}
if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 2)
@@ -5243,17 +5257,17 @@ ghb_notify_done(signal_user_data_t *ud)
if (ghb_can_suspend_gpm())
{
ghb_countdown_dialog(GTK_MESSAGE_WARNING,
- "Your encode is complete.",
- "Putting computer to sleep",
- "Cancel", (GSourceFunc)suspend_cb, ud, 60);
+ _("Your encode is complete."),
+ _("Putting computer to sleep"),
+ _("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);
+ _("Your encode is complete."),
+ _("Quiting Handbrake"),
+ _("Cancel"), (GSourceFunc)quit_cb, ud, 60);
}
}