summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2008-09-23 14:41:20 +0000
committerjstebbins <[email protected]>2008-09-23 14:41:20 +0000
commit7480a8483de8df20e892418e5228210ef6440e9e (patch)
tree3d812764b4d5a7090458fcbd1a2e4317da427f67 /gtk
parentd47c63b262763b76f1fe0c752472d138ab66490d (diff)
LinGui: Add progress info to queue window
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1747 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c106
-rw-r--r--gtk/src/ghb.ui5
-rw-r--r--gtk/src/resource_data.h8
-rw-r--r--gtk/src/resources.plist5
4 files changed, 80 insertions, 44 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index eb0e42861..3477ea2aa 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -3268,6 +3268,55 @@ start_next_job(signal_user_data_t *ud, gboolean find_first)
return NULL;
}
+gchar*
+working_status_string(signal_user_data_t *ud, ghb_status_t *status)
+{
+ gchar *task_str, *job_str, *status_str;
+ gint qcount;
+ gint index;
+ GValue *js;
+
+ if (status->job_count > 1)
+ {
+ task_str = g_strdup_printf("pass %d of %d, ",
+ status->job_cur, status->job_count);
+ }
+ else
+ {
+ task_str = g_strdup("");
+ }
+ qcount = ghb_array_len(ud->queue);
+ if (qcount > 1)
+ {
+ index = find_queue_job(ud->queue, status->unique_id, &js);
+ job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
+ }
+ else
+ {
+ job_str = g_strdup("");
+ }
+ if(status->seconds > -1)
+ {
+ status_str= g_strdup_printf(
+ "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,
+ status->minutes, status->seconds );
+ }
+ else
+ {
+ status_str= g_strdup_printf(
+ "Encoding: %s%s%.2f %%",
+ job_str, task_str,
+ 100.0 * status->progress );
+ }
+ g_free(task_str);
+ g_free(job_str);
+ return status_str;
+}
+
static void
ghb_backend_events(signal_user_data_t *ud)
{
@@ -3344,47 +3393,7 @@ ghb_backend_events(signal_user_data_t *ud)
}
else if (status.queue_state & GHB_STATE_WORKING)
{
- gchar *task_str, *job_str;
- gint qcount;
-
- if (status.job_count > 1)
- {
- task_str = g_strdup_printf("pass %d of %d, ",
- status.job_cur, status.job_count);
- }
- else
- {
- task_str = g_strdup("");
- }
- qcount = ghb_array_len(ud->queue);
- if (qcount > 1)
- {
- index = find_queue_job(ud->queue, status.unique_id, &js);
- job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
- }
- else
- {
- job_str = g_strdup("");
- }
- if(status.seconds > -1)
- {
- status_str= g_strdup_printf(
- "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,
- status.minutes, status.seconds );
- }
- else
- {
- status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%",
- job_str, task_str,
- 100.0 * status.progress );
- }
- g_free(job_str);
- g_free(task_str);
+ status_str = working_status_string(ud, &status);
gtk_progress_bar_set_text (progress, status_str);
gtk_progress_bar_set_fraction (progress, status.progress);
g_free(status_str);
@@ -3494,6 +3503,13 @@ ghb_backend_events(signal_user_data_t *ud)
}
g_free(path);
}
+ GtkLabel *label;
+ gchar *status_str;
+
+ status_str = working_status_string(ud, &status);
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
+ gtk_label_set_text (label, status_str);
+ g_free(status_str);
}
}
@@ -4412,9 +4428,11 @@ ghb_reload_queue(signal_user_data_t *ud)
if (unfinished)
{
message = g_strdup_printf(
- "You have %d unfinished jobs in a saved queue.\n\n"
- "Would you like to reload them?",
- unfinished);
+ "You have %d unfinished job%s in a saved queue.\n\n"
+ "Would you like to reload %s?",
+ unfinished,
+ (unfinished > 1) ? "s" : "",
+ (unfinished > 1) ? "them" : "it");
if (ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "No", "Yes"))
{
GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 473b2a122..3cef79446 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -3928,8 +3928,13 @@ this setting.</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="queue_status">
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="visible">True</property>
</object>
+ <packing>
+ <property name="padding">10</property>
+ <property name="expand">False</property>
+ </packing>
</child>
<child>
<placeholder/>
diff --git a/gtk/src/resource_data.h b/gtk/src/resource_data.h
index 3a793fd5e..252620d8c 100644
--- a/gtk/src/resource_data.h
+++ b/gtk/src/resource_data.h
@@ -6456,9 +6456,17 @@
" &lt;child&gt;\n"
" &lt;object class=&quot;GtkLabel&quot; id=&quot;queue_"
"status&quot;&gt;\n"
+" &lt;property name=&quot;justify&quot;&gt;GTK_JUSTIF"
+"Y_LEFT&lt;/property&gt;\n"
" &lt;property name=&quot;visible&quot;&gt;True&lt;/p"
"roperty&gt;\n"
" &lt;/object&gt;\n"
+" &lt;packing&gt;\n"
+" &lt;property name=&quot;padding&quot;&gt;10&lt;/pro"
+"perty&gt;\n"
+" &lt;property name=&quot;expand&quot;&gt;False&lt;/p"
+"roperty&gt;\n"
+" &lt;/packing&gt;\n"
" &lt;/child&gt;\n"
" &lt;child&gt;\n"
" &lt;placeholder/&gt;\n"
diff --git a/gtk/src/resources.plist b/gtk/src/resources.plist
index 671bb9f77..37e7c1adf 100644
--- a/gtk/src/resources.plist
+++ b/gtk/src/resources.plist
@@ -3933,8 +3933,13 @@ this setting.&lt;/property&gt;
&lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
&lt;child&gt;
&lt;object class=&quot;GtkLabel&quot; id=&quot;queue_status&quot;&gt;
+ &lt;property name=&quot;justify&quot;&gt;GTK_JUSTIFY_LEFT&lt;/property&gt;
&lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
&lt;/object&gt;
+ &lt;packing&gt;
+ &lt;property name=&quot;padding&quot;&gt;10&lt;/property&gt;
+ &lt;property name=&quot;expand&quot;&gt;False&lt;/property&gt;
+ &lt;/packing&gt;
&lt;/child&gt;
&lt;child&gt;
&lt;placeholder/&gt;