]> granicus.if.org Git - handbrake/commitdiff
LinGui: Add progress info to queue window
authorjstebbins <jstebbins.hb@gmail.com>
Tue, 23 Sep 2008 14:41:20 +0000 (14:41 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Tue, 23 Sep 2008 14:41:20 +0000 (14:41 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1747 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/callbacks.c
gtk/src/ghb.ui
gtk/src/resource_data.h
gtk/src/resources.plist

index eb0e428619feaeed2bce1e78734577d37bd09ff8..3477ea2aa039026755f041426ba68a9b3c87f157 100644 (file)
@@ -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");
index 473b2a12206914b88f898754c639e451b66b57d2..3cef794465d5b7daa9d8d238fe48829499f99b58 100644 (file)
@@ -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/>
index 3a793fd5ecf7639d07c711b166738b2d762c493b..252620d8c5ebb1246eb7baf5a3b61d104b264142 100644 (file)
 "                &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"
index 671bb9f77d83d967f1ea6786cd96b5530f86d8a7..37e7c1adfeeb105bf6f068a7edc16d66c249d2c1 100644 (file)
@@ -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;