summaryrefslogtreecommitdiffstats
path: root/gtk/src/hb-backend.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-02-22 03:01:15 +0000
committerjstebbins <[email protected]>2014-02-22 03:01:15 +0000
commitab50e34327aea45ed0a1b258d07bd269dcc39a9e (patch)
treea848a75d05e42a0ea5ca493d286e22f8f936ed7b /gtk/src/hb-backend.c
parente334a91396d51f1c22648f27c32492101a3053b5 (diff)
LinGui: add dialog to select multiple titles to add to queue
Replaces "Add All to Queue". Dialog provides checkboxes to select titles to add to the queue and file chooser/file entry to change destination file names. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6056 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r--gtk/src/hb-backend.c104
1 files changed, 57 insertions, 47 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index ae09f6dc4..0a4a3266c 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -2058,6 +2058,61 @@ language_opts_set(GtkBuilder *builder, const gchar *name)
static gchar **titles = NULL;
+gchar*
+ghb_create_title_label(hb_title_t *title)
+{
+ gchar *label;
+
+ if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
+ {
+ if (title->duration != 0)
+ {
+ char *tmp;
+ tmp = g_strdup_printf ("%d - %02dh%02dm%02ds - %s",
+ title->index, title->hours, title->minutes, title->seconds,
+ title->name);
+ label = g_markup_escape_text(tmp, -1);
+ g_free(tmp);
+ }
+ else
+ {
+ char *tmp;
+ tmp = g_strdup_printf ("%d - %s",
+ title->index, title->name);
+ label = g_markup_escape_text(tmp, -1);
+ g_free(tmp);
+ }
+ }
+ else if (title->type == HB_BD_TYPE)
+ {
+ if (title->duration != 0)
+ {
+ label = g_strdup_printf("%d (%05d.MPLS) - %02dh%02dm%02ds",
+ title->index, title->playlist, title->hours,
+ title->minutes, title->seconds);
+ }
+ else
+ {
+ label = g_strdup_printf("%d (%05d.MPLS) - Unknown Length",
+ title->index, title->playlist);
+ }
+ }
+ else
+ {
+ if (title->duration != 0)
+ {
+ label = g_strdup_printf("%d - %02dh%02dm%02ds",
+ title->index, title->hours, title->minutes, title->seconds);
+ }
+ else
+ {
+ label = g_strdup_printf("%d - Unknown Length",
+ title->index);
+ }
+ }
+ return label;
+}
+
void
title_opts_set(GtkBuilder *builder, const gchar *name)
{
@@ -2111,53 +2166,8 @@ title_opts_set(GtkBuilder *builder, const gchar *name)
for (ii = 0; ii < count; ii++)
{
title = (hb_title_t*)hb_list_item(list, ii);
- if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
- {
- if (title->duration != 0)
- {
- char *tmp;
- tmp = g_strdup_printf ("%d - %02dh%02dm%02ds - %s",
- title->index, title->hours, title->minutes, title->seconds,
- title->name);
- titles[ii] = g_markup_escape_text(tmp, -1);
- g_free(tmp);
- }
- else
- {
- char *tmp;
- tmp = g_strdup_printf ("%d - %s",
- title->index, title->name);
- titles[ii] = g_markup_escape_text(tmp, -1);
- g_free(tmp);
- }
- }
- else if (title->type == HB_BD_TYPE)
- {
- if (title->duration != 0)
- {
- titles[ii] = g_strdup_printf("%d (%05d.MPLS) - %02dh%02dm%02ds",
- title->index, title->playlist, title->hours,
- title->minutes, title->seconds);
- }
- else
- {
- titles[ii] = g_strdup_printf("%d (%05d.MPLS) - Unknown Length",
- title->index, title->playlist);
- }
- }
- else
- {
- if (title->duration != 0)
- {
- titles[ii] = g_strdup_printf("%d - %02dh%02dm%02ds",
- title->index, title->hours, title->minutes, title->seconds);
- }
- else
- {
- titles[ii] = g_strdup_printf("%d - Unknown Length",
- title->index);
- }
- }
+ titles[ii] = ghb_create_title_label(title);
+
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, titles[ii],