[pitivi] render: Use ComboBox instead of TreeView for presets



commit 4bed27d74be7fef392fe4656889d42e7f926bf53
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Oct 22 12:50:16 2015 +0200

    render: Use ComboBox instead of TreeView for presets
    
    Moved logic from ProjectSettingsDialog to PresetManager so it can be
    reused by RenderDialog.
    
    Removed the volatile-presets logic as we don't need to display a
    "Custom" preset now.
    
    Differential Revision: https://phabricator.freedesktop.org/D377
    Reviewed-by: Thibault Saunier <tsaunier gnome org>

 data/ui/renderingdialog.ui |  538 +++++++++++++++++++-------------------------
 pitivi/preset.py           |  115 ++++++++--
 pitivi/project.py          |  143 ++----------
 pitivi/render.py           |  186 +++-------------
 4 files changed, 382 insertions(+), 600 deletions(-)
---
diff --git a/data/ui/renderingdialog.ui b/data/ui/renderingdialog.ui
index 352c918..4595dfe 100644
--- a/data/ui/renderingdialog.ui
+++ b/data/ui/renderingdialog.ui
@@ -137,28 +137,98 @@
             <property name="row_spacing">6</property>
             <property name="column_spacing">12</property>
             <child>
-              <object class="GtkFrame" id="video_frame">
+              <object class="GtkBox" id="preset_box">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">end</property>
+                <property name="margin_top">12</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label6">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">Preset:</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="presets_combo">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="has_entry">True</property>
+                    <child internal-child="entry">
+                      <object class="GtkEntry" id="combobox-entry">
+                        <property name="can_focus">False</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="preset_menubutton">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="relief">none</property>
+                    <child>
+                      <object class="GtkImage" id="image1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="icon_name">open-menu-symbolic</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="audio_frame">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment1">
+                  <object class="GtkAlignment" id="alignment2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <object class="GtkBox" id="box3">
+                      <object class="GtkBox" id="box4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="border_width">12</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkLabel" id="label3">
+                          <object class="GtkLabel" id="label23">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="label" translatable="yes">Scale:</property>
+                            <property name="label" translatable="yes">Channels:</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -167,55 +237,17 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkBox" id="hbox3">
+                          <object class="GtkComboBox" id="channels_combo">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkSpinButton" id="scale_spinbutton">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="halign">start</property>
-                                <property name="invisible_char">•</property>
-                                <property name="text" translatable="yes">1.0</property>
-                                <property name="primary_icon_activatable">False</property>
-                                <property name="secondary_icon_activatable">False</property>
-                                <property name="adjustment">adjustment1</property>
-                                <property name="digits">1</property>
-                                <property name="numeric">True</property>
-                                <property name="value">1</property>
-                                <signal name="value-changed" handler="_scaleSpinbuttonChangedCb" 
swapped="no"/>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="scale_spinbutton-atkobject">
-                                    <property name="AtkObject::accessible-name" 
translatable="yes">Scale</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
+                            <property name="model">model5</property>
+                            <signal name="changed" handler="_channelsComboChangedCb" swapped="no"/>
                             <child>
-                              <object class="GtkLabel" id="resolution_label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="halign">start</property>
-                                <property name="label" translatable="yes">1000 x 1000</property>
-                                <property name="width_chars">12</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="resolution_label-atkobject">
-                                    <property name="AtkObject::accessible-name" 
translatable="yes">Height</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">1</property>
-                              </packing>
+                              <object class="GtkCellRendererText" id="renderer5"/>
+                              <attributes>
+                                <attribute name="text">0</attribute>
+                              </attributes>
                             </child>
                           </object>
                           <packing>
@@ -225,83 +257,69 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="project_settings_button">
-                            <property name="label" translatable="yes">Edit Project Settings...</property>
+                          <object class="GtkButton" id="audio_settings_button">
+                            <property name="label" translatable="yes">Advanced...</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
                             <property name="halign">end</property>
-                            <signal name="clicked" handler="_projectSettingsButtonClickedCb" swapped="no"/>
+                            <property name="xalign">1</property>
+                            <signal name="clicked" handler="_audioSettingsButtonClickedCb" swapped="no"/>
                           </object>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
+                            <property name="pack_type">end</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label17">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">Frame rate:</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">3</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkComboBox" id="frame_rate_combo">
+                          <object class="GtkComboBox" id="audio_encoder_combo">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="model">model3</property>
-                            <signal name="changed" handler="_frameRateComboChangedCb" swapped="no"/>
+                            <property name="model">model4</property>
+                            <signal name="changed" handler="_audioEncoderChangedComboCb" swapped="no"/>
                             <child>
-                              <object class="GtkCellRendererText" id="renderer3"/>
+                              <object class="GtkCellRendererText" id="renderer4"/>
                               <attributes>
                                 <attribute name="text">0</attribute>
                               </attributes>
                             </child>
-                            <child internal-child="accessible">
-                              <object class="AtkObject" id="frame_rate_combo-atkobject">
-                                <property name="AtkObject::accessible-name" 
translatable="yes">Framerate</property>
-                              </object>
-                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">4</property>
+                            <property name="pack_type">end</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="video_settings_button">
-                            <property name="label" translatable="yes">Advanced...</property>
+                          <object class="GtkLabel" id="label21">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="halign">end</property>
-                            <signal name="clicked" handler="_videoSettingsButtonClickedCb" swapped="no"/>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="label" translatable="yes">Codec:</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
+                            <property name="fill">True</property>
                             <property name="pack_type">end</property>
-                            <property name="position">5</property>
+                            <property name="position">4</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="video_encoder_combo">
+                          <object class="GtkComboBox" id="sample_rate_combo">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="model">model2</property>
-                            <signal name="changed" handler="_videoEncoderComboChangedCb" swapped="no"/>
+                            <property name="model">model5</property>
+                            <signal name="changed" handler="_sampleRateComboChangedCb" swapped="no"/>
                             <child>
-                              <object class="GtkCellRendererText" id="renderer2"/>
+                              <object class="GtkCellRendererText" id="renderer6"/>
                               <attributes>
                                 <attribute name="text">0</attribute>
                               </attributes>
@@ -311,21 +329,24 @@
                             <property name="expand">False</property>
                             <property name="fill">False</property>
                             <property name="pack_type">end</property>
-                            <property name="position">6</property>
+                            <property name="position">5</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label16">
+                          <object class="GtkLabel" id="label4">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="label" translatable="yes">Codec:</property>
+                            <property name="label" translatable="yes">Sample rate:</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
                             <property name="pack_type">end</property>
-                            <property name="position">7</property>
+                            <property name="position">6</property>
                           </packing>
                         </child>
                       </object>
@@ -333,8 +354,8 @@
                   </object>
                 </child>
                 <child type="label">
-                  <object class="GtkCheckButton" id="video_output_checkbutton">
-                    <property name="label" translatable="yes">Video</property>
+                  <object class="GtkCheckButton" id="audio_output_checkbutton">
+                    <property name="label" translatable="yes">Audio</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
@@ -342,38 +363,41 @@
                     <property name="xalign">0</property>
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="_videoOutputCheckbuttonToggledCb" swapped="no"/>
+                    <signal name="toggled" handler="_audioOutputCheckbuttonToggledCb" swapped="no"/>
                   </object>
                 </child>
               </object>
               <packing>
-                <property name="left_attach">0</property>
+                <property name="left_attach">1</property>
                 <property name="top_attach">2</property>
               </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="audio_frame">
+              <object class="GtkFrame" id="video_frame">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment2">
+                  <object class="GtkAlignment" id="alignment1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <object class="GtkBox" id="box4">
+                      <object class="GtkBox" id="box3">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="border_width">12</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkLabel" id="label23">
+                          <object class="GtkLabel" id="label3">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="label" translatable="yes">Channels:</property>
+                            <property name="label" translatable="yes">Scale:</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -382,17 +406,56 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="channels_combo">
+                          <object class="GtkBox" id="hbox3">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="model">model5</property>
-                            <signal name="changed" handler="_channelsComboChangedCb" swapped="no"/>
+                            <property name="spacing">12</property>
                             <child>
-                              <object class="GtkCellRendererText" id="renderer5"/>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
+                              <object class="GtkSpinButton" id="scale_spinbutton">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="halign">start</property>
+                                <property name="invisible_char">•</property>
+                                <property name="text" translatable="yes">1.0</property>
+                                <property name="primary_icon_activatable">False</property>
+                                <property name="secondary_icon_activatable">False</property>
+                                <property name="adjustment">adjustment1</property>
+                                <property name="digits">1</property>
+                                <property name="numeric">True</property>
+                                <property name="value">1</property>
+                                <signal name="value-changed" handler="_scaleSpinbuttonChangedCb" 
swapped="no"/>
+                                <child internal-child="accessible">
+                                  <object class="AtkObject" id="scale_spinbutton-atkobject">
+                                    <property name="AtkObject::accessible-name" 
translatable="yes">Scale</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="resolution_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="halign">start</property>
+                                <property name="label" translatable="yes">1000 x 1000</property>
+                                <property name="width_chars">12</property>
+                                <property name="xalign">0</property>
+                                <child internal-child="accessible">
+                                  <object class="AtkObject" id="resolution_label-atkobject">
+                                    <property name="AtkObject::accessible-name" 
translatable="yes">Height</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
                             </child>
                           </object>
                           <packing>
@@ -402,27 +465,45 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label4">
+                          <object class="GtkButton" id="project_settings_button">
+                            <property name="label" translatable="yes">Project Settings...</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">Sample rate:</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="halign">end</property>
+                            <signal name="clicked" handler="_projectSettingsButtonClickedCb" swapped="no"/>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">True</property>
+                            <property name="fill">False</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="sample_rate_combo">
+                          <object class="GtkButton" id="video_settings_button">
+                            <property name="label" translatable="yes">Advanced...</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="halign">end</property>
+                            <signal name="clicked" handler="_videoSettingsButtonClickedCb" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="pack_type">end</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBox" id="video_encoder_combo">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="model">model5</property>
-                            <signal name="changed" handler="_sampleRateComboChangedCb" swapped="no"/>
+                            <property name="model">model2</property>
+                            <signal name="changed" handler="_videoEncoderComboChangedCb" swapped="no"/>
                             <child>
-                              <object class="GtkCellRendererText" id="renderer6"/>
+                              <object class="GtkCellRendererText" id="renderer2"/>
                               <attributes>
                                 <attribute name="text">0</attribute>
                               </attributes>
@@ -431,59 +512,68 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">3</property>
+                            <property name="pack_type">end</property>
+                            <property name="position">4</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="audio_settings_button">
-                            <property name="label" translatable="yes">Advanced...</property>
+                          <object class="GtkLabel" id="label16">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="halign">end</property>
-                            <property name="xalign">1</property>
-                            <signal name="clicked" handler="_audioSettingsButtonClickedCb" swapped="no"/>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="label" translatable="yes">Codec:</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
+                            <property name="fill">True</property>
                             <property name="pack_type">end</property>
-                            <property name="position">4</property>
+                            <property name="position">5</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="audio_encoder_combo">
+                          <object class="GtkComboBox" id="frame_rate_combo">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="model">model4</property>
-                            <signal name="changed" handler="_audioEncoderChangedComboCb" swapped="no"/>
+                            <property name="model">model3</property>
+                            <signal name="changed" handler="_frameRateComboChangedCb" swapped="no"/>
                             <child>
-                              <object class="GtkCellRendererText" id="renderer4"/>
+                              <object class="GtkCellRendererText" id="renderer3"/>
                               <attributes>
                                 <attribute name="text">0</attribute>
                               </attributes>
                             </child>
+                            <child internal-child="accessible">
+                              <object class="AtkObject" id="frame_rate_combo-atkobject">
+                                <property name="AtkObject::accessible-name" 
translatable="yes">Framerate</property>
+                              </object>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
                             <property name="pack_type">end</property>
-                            <property name="position">5</property>
+                            <property name="position">6</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label21">
+                          <object class="GtkLabel" id="label17">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
-                            <property name="label" translatable="yes">Codec:</property>
+                            <property name="label" translatable="yes">Frame rate:</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
                             <property name="pack_type">end</property>
-                            <property name="position">6</property>
+                            <property name="position">7</property>
                           </packing>
                         </child>
                       </object>
@@ -491,8 +581,8 @@
                   </object>
                 </child>
                 <child type="label">
-                  <object class="GtkCheckButton" id="audio_output_checkbutton">
-                    <property name="label" translatable="yes">Audio</property>
+                  <object class="GtkCheckButton" id="video_output_checkbutton">
+                    <property name="label" translatable="yes">Video</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
@@ -500,12 +590,12 @@
                     <property name="xalign">0</property>
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="_audioOutputCheckbuttonToggledCb" swapped="no"/>
+                    <signal name="toggled" handler="_videoOutputCheckbuttonToggledCb" swapped="no"/>
                   </object>
                 </child>
               </object>
               <packing>
-                <property name="left_attach">1</property>
+                <property name="left_attach">0</property>
                 <property name="top_attach">2</property>
               </packing>
             </child>
@@ -649,176 +739,10 @@
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-                <property name="width">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox" id="preset_box">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <object class="GtkLabel" id="label11">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="margin_left">6</property>
-                    <property name="margin_start">6</property>
-                    <property name="label" translatable="yes">Render Preset</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkInfoBar" id="render-preset-infobar">
-                    <property name="app_paintable">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="message_type">error</property>
-                    <child internal-child="action_area">
-                      <object class="GtkButtonBox" id="infobar-action_area">
-                        <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
-                        <property name="layout_style">center</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child internal-child="content_area">
-                      <object class="GtkBox" id="infobar-content_area">
-                        <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkLabel" id="render-preset-error-label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkScrolledWindow" id="scrolledwindow2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="shadow_type">in</property>
-                    <child>
-                      <object class="GtkTreeView" id="render_preset_treeview">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection" id="treeview-selection"/>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkToolbar" id="render_presets_toolbar">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="show_arrow">False</property>
-                    <property name="icon_size">1</property>
-                    <child>
-                      <object class="GtkToolButton" id="add_render_preset_button">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="receives_default">True</property>
-                        <property name="tooltip_text" translatable="yes">Create a new preset</property>
-                        <property name="icon_name">list-add-symbolic</property>
-                        <signal name="clicked" handler="_addRenderPresetButtonClickedCb" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="remove_render_preset_button">
-                        <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">False</property>
-                        <property name="receives_default">True</property>
-                        <property name="tooltip_text" translatable="yes">Remove the selected 
preset</property>
-                        <property name="icon_name">list-remove-symbolic</property>
-                        <signal name="clicked" handler="_removeRenderPresetButtonClickedCb" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="save_render_preset_button">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="receives_default">True</property>
-                        <property name="tooltip_text" translatable="yes">Save changes to the currently 
selected preset</property>
-                        <property name="icon_name">document-save-symbolic</property>
-                        <signal name="clicked" handler="_saveRenderPresetButtonClickedCb" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">3</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="top_attach">2</property>
+                <property name="top_attach">0</property>
+                <property name="width">2</property>
               </packing>
             </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
           </object>
           <packing>
             <property name="expand">False</property>
diff --git a/pitivi/preset.py b/pitivi/preset.py
index a3e4fa3..f0e7302 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -22,8 +22,10 @@
 import json
 import os.path
 
+from gi.repository import Gio
 from gi.repository import Gst
 from gi.repository import Gtk
+from gi.repository import GObject
 
 from gettext import gettext as _
 
@@ -37,7 +39,7 @@ class DeserializeException(Exception):
     pass
 
 
-class PresetManager(Loggable):
+class PresetManager(GObject.Object, Loggable):
 
     """Abstract class for storing a list of presets.
 
@@ -58,7 +60,12 @@ class PresetManager(Loggable):
     @type widget_map: dict
     """
 
+    __gsignals__ = {
+        "preset-loaded": (GObject.SignalFlags.RUN_LAST, None, ()),
+    }
+
     def __init__(self, default_path, user_path):
+        GObject.Object.__init__(self)
         Loggable.__init__(self)
 
         self.default_path = default_path
@@ -72,6 +79,91 @@ class PresetManager(Loggable):
         self.ignore_update_requests = False
         self.system = system.getSystem()
 
+    def setupUi(self, combo, button):
+        self.combo = combo
+        self.button = button
+
+        combo.set_model(self.ordered)
+        combo.set_id_column(0)
+        combo.set_entry_text_column(0)
+        combo.connect("changed", self._presetChangedCb)
+
+        entry = combo.get_child()
+        style_context = entry.get_style_context()
+        style_provider = Gtk.CssProvider()
+        style_provider.load_from_data("GtkEntry.unsaved {font-style:italic;}".encode('UTF-8'))
+        style_context.add_provider(style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
+
+        action_group = Gio.SimpleActionGroup()
+        menu_model = Gio.Menu()
+        preset_actions = {}
+
+        action = Gio.SimpleAction.new("new", None)
+        action.connect("activate", self._addPresetCb)
+        action_group.insert(action)
+        menu_model.append(_("New"), "preset.%s" % action.get_name())
+        self.action_new = action
+
+        action = Gio.SimpleAction.new("remove", None)
+        action.connect("activate", self._removePresetCb)
+        action_group.insert(action)
+        menu_model.append(_("Remove"), "preset.%s" % action.get_name())
+        self.action_remove = action
+
+        action = Gio.SimpleAction.new("save", None)
+        action.connect("activate", self._savePresetCb)
+        action_group.insert(action)
+        menu_model.append(_("Save"), "preset.%s" % action.get_name())
+        self.action_save = action
+
+        menu = Gtk.Menu.new_from_model(menu_model)
+        menu.insert_action_group("preset", action_group)
+        button.set_popup(menu)
+
+    def _presetChangedCb(self, combo):
+        """Handle the selection of a preset."""
+        # Check whether the user selected a preset or editing the preset name.
+        preset_name = combo.get_active_id()
+        if preset_name:
+            # The user selected a preset.
+            self.restorePreset(preset_name)
+            self.emit("preset-loaded")
+        self.updateMenuActions()
+
+    def _addPresetCb(self, unused_action, unused_param):
+        preset_name = self.getNewPresetName()
+        self.createPreset(preset_name)
+        self.combo.set_active_id(preset_name)
+        self.updateMenuActions()
+
+    def _removePresetCb(self, unused_action, unused_param):
+        self.removeCurrentPreset()
+        self.updateMenuActions()
+
+    def _savePresetCb(self, unused_action, unused_param):
+        entry = self.combo.get_child()
+        preset_name = entry.get_text()
+        if not self.cur_preset:
+            self.createPreset(preset_name)
+        self.saveCurrentPreset(preset_name)
+        self.updateMenuActions()
+
+    def updateMenuActions(self):
+        entry = self.combo.get_child()
+        preset_name = entry.get_text()
+        can_save = self.isSaveButtonSensitive(preset_name)
+        self.action_save.set_enabled(can_save)
+        if can_save:
+            entry.get_style_context().add_class("unsaved")
+        else:
+            entry.get_style_context().remove_class("unsaved")
+
+        can_remove = self.isRemoveButtonSensitive()
+        self.action_remove.set_enabled(can_remove)
+
+        can_create_new = self.isNewButtonSensitive()
+        self.action_new.set_enabled(can_create_new)
+
     def loadAll(self):
         self._loadFromDir(self.default_path, extra={"readonly": True})
         if os.path.isfile(self.user_path):
@@ -128,33 +220,26 @@ class PresetManager(Loggable):
         file_name = self.system.getUniqueFilename(preset_name + ".json")
         return os.path.join(self.user_path, file_name)
 
-    def getUniqueName(self, first=_("Custom"), second=_("Custom %d")):
-        name = first
+    def getNewPresetName(self):
+        """Get a unique name for a new preset."""
+        name = _("New preset")
         i = 1
         while self.hasPreset(name):
-            name = second % i
+            name = _("New preset %d") % i
             i += 1
         return name
 
-    def getNewPresetName(self):
-        """Get a unique name for a new preset."""
-        return self.getUniqueName(_("New preset"), _("New preset %d"))
-
-    def createPreset(self, name, values=None, volatile=False):
+    def createPreset(self, name, values=None):
         """Create a preset, overwriting the preset with the same name if any.
 
         @param name: The name of the new preset.
         @type name: str
         @param values: The values of the new preset.
         @type values: dict
-        @param volatile: Whether the preset should not be saveable.
-        @type volatile: bool
         """
         if not values:
             values = {}
             self._updatePresetValues(values)
-        if volatile:
-            values["volatile"] = True
         self._addPreset(name, values)
         self.cur_preset = name
 
@@ -300,8 +385,6 @@ class PresetManager(Loggable):
         @type name: str
         """
         if self.cur_preset:
-            if "volatile" in self.presets[self.cur_preset]:
-                return False
             return self._isCurrentPresetChanged(name)
 
         if name:
@@ -314,8 +397,6 @@ class PresetManager(Loggable):
         """Whether the Remove button should be enabled"""
         if not self.cur_preset:
             return False
-        if "volatile" in self.presets[self.cur_preset]:
-            return False
         return True
 
     def isNewButtonSensitive(self):
diff --git a/pitivi/project.py b/pitivi/project.py
index 1b98f27..9026a35 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -27,7 +27,6 @@ Project related classes
 import os
 from gi.repository import GstPbutils
 from gi.repository import GES
-from gi.repository import Gio
 from gi.repository import Gst
 from gi.repository import Gtk
 from gi.repository import GLib
@@ -1362,18 +1361,21 @@ class Project(Loggable, GES.Project):
 
 
 # ---------------------- UI classes ----------------------------------------- #
-class ProjectSettingsDialog():
+
+class ProjectSettingsDialog(object):
 
     def __init__(self, parent_window, project):
         self.project = project
         self.audio_presets = AudioPresetManager()
         self.video_presets = VideoPresetManager()
-        self.preset_actions = {}
         self._createUi()
         self.window.set_transient_for(parent_window)
         self._setupUiConstraints()
         self.updateUI()
 
+    def __del__(self):
+        self.video_presets.disconnect_by_func(self.__videoPresetLoadedCb)
+
     def _createUi(self):
         """
         Initialize the static parts of the UI and set up various shortcuts
@@ -1404,13 +1406,12 @@ class ProjectSettingsDialog():
         self.year_spinbutton = getObj("year_spinbutton")
 
         self.video_preset_menubutton = getObj("video_preset_menubutton")
-        self._createPresetMenu(self.video_preset_menubutton,
-                               self.video_presets,
-                               self.video_presets_combo)
+        self.video_presets.setupUi(self.video_presets_combo,
+                                   self.video_preset_menubutton)
+        self.video_presets.connect("preset-loaded", self.__videoPresetLoadedCb)
         self.audio_preset_menubutton = getObj("audio_preset_menubutton")
-        self._createPresetMenu(self.audio_preset_menubutton,
-                               self.audio_presets,
-                               self.audio_presets_combo)
+        self.audio_presets.setupUi(self.audio_presets_combo,
+                                   self.audio_preset_menubutton)
 
     def _setupUiConstraints(self):
         """
@@ -1458,16 +1459,10 @@ class ProjectSettingsDialog():
         self.wg.addVertex(self.height_spinbutton, signal="value-changed")
         self.wg.addVertex(self.audio_preset_menubutton,
                           update_func=self._updatePresetMenuButton,
-                          update_func_args=(
-                              self.audio_preset_menubutton,
-                              self.audio_presets_combo,
-                              self.audio_presets))
+                          update_func_args=(self.audio_presets,))
         self.wg.addVertex(self.video_preset_menubutton,
                           update_func=self._updatePresetMenuButton,
-                          update_func_args=(
-                              self.video_preset_menubutton,
-                              self.video_presets_combo,
-                              self.video_presets))
+                          update_func_args=(self.video_presets,))
         self.wg.addVertex(self.channels_combo, signal="changed")
         self.wg.addVertex(self.sample_rate_combo, signal="changed")
 
@@ -1519,12 +1514,8 @@ class ProjectSettingsDialog():
                         edge_func=self.updateDarFromPar)
 
         # Presets.
-        self._loadPresets(self.audio_presets,
-                          self.audio_presets_combo,
-                          self.audio_preset_menubutton)
-        self._loadPresets(self.video_presets,
-                          self.video_presets_combo,
-                          self.video_preset_menubutton)
+        self.audio_presets.loadAll()
+        self.video_presets.loadAll()
 
         # Bind the widgets in the Video tab to the Video Presets Manager.
         self.bindSpinbutton(self.video_presets, "width", self.width_spinbutton)
@@ -1572,82 +1563,6 @@ class ProjectSettingsDialog():
                        lambda x: widget.set_value(float(x)),
                        lambda: int(widget.get_value()))
 
-    def _createPresetMenu(self, button, mgr, combo):
-        entry = combo.get_child()
-        style_context = entry.get_style_context()
-        style_provider = Gtk.CssProvider()
-        style_provider.load_from_data("GtkEntry.unsaved {font-style:italic;}".encode('UTF-8'))
-        style_context.add_provider(style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
-
-        action_group = Gio.SimpleActionGroup()
-        menu_model = Gio.Menu()
-        self.preset_actions[button] = {}
-
-        action = Gio.SimpleAction.new("new", None)
-        action.connect("activate", self._addPresetCb, button, combo, mgr)
-        action_group.insert(action)
-        menu_model.append(_("New"), "preset.%s" % action.get_name())
-        self.preset_actions[button][action.get_name()] = action
-
-        action = Gio.SimpleAction.new("remove", None)
-        action.connect("activate", self._removePresetCb, button, combo, mgr)
-        action_group.insert(action)
-        menu_model.append(_("Remove"), "preset.%s" % action.get_name())
-        self.preset_actions[button][action.get_name()] = action
-
-        action = Gio.SimpleAction.new("save", None)
-        action.connect("activate", self._savePresetCb, mgr, button, combo)
-        action_group.insert(action)
-        menu_model.append(_("Save"), "preset.%s" % action.get_name())
-        self.preset_actions[button][action.get_name()] = action
-
-        menu = Gtk.Menu.new_from_model(menu_model)
-        menu.insert_action_group("preset", action_group)
-        button.set_popup(menu)
-
-    def _updatePresetActions(self, button, combo, mgr):
-        entry = combo.get_child()
-        preset_name = entry.get_text()
-        can_save = mgr.isSaveButtonSensitive(preset_name)
-        self.preset_actions[button]["save"].set_enabled(can_save)
-        if can_save:
-            entry.get_style_context().add_class("unsaved")
-        else:
-            entry.get_style_context().remove_class("unsaved")
-
-        can_remove = mgr.isRemoveButtonSensitive()
-        self.preset_actions[button]["remove"].set_enabled(can_remove)
-
-        can_create_new = mgr.isNewButtonSensitive()
-        self.preset_actions[button]["new"].set_enabled(can_create_new)
-
-    def _loadPresets(self, mgr, combo, button):
-        """Set up the specified treeview to display the specified presets.
-
-        @param mgr: The preset manager.
-        @type mgr: PresetManager
-        @param combo: The combobox displaying the presets.
-        @type combo: Gtk.ComboBox
-        @param button: The menubutton associated with the combobox.
-        @type button: Gtk.MenuButton
-        """
-        mgr.loadAll()
-        model = mgr.getModel()
-        combo.set_model(model)
-        combo.set_id_column(0)
-        combo.set_entry_text_column(0)
-        combo.connect("changed", self._presetChangedCb, mgr, button)
-
-    def _presetChangedCb(self, combo, mgr, button):
-        """Handle the selection of a preset."""
-        # Check whether the user selected a preset or editing the preset name.
-        preset_name = combo.get_active_id()
-        if preset_name:
-            # The user selected a preset.
-            mgr.restorePreset(preset_name)
-            self._updateSar()
-        self._updatePresetActions(button, combo, mgr)
-
     def widthHeightLinked(self):
         return self.constrain_sar_button.props.active and not self.video_presets.ignore_update_requests
 
@@ -1657,6 +1572,9 @@ class ProjectSettingsDialog():
     def _updateCombo(self, unused, combo, fraction):
         set_combo_value(combo, fraction.getWidgetValue())
 
+    def __videoPresetLoadedCb(self, unused_mgr):
+        self._updateSar()
+
     def getSAR(self):
         width = int(self.width_spinbutton.get_value())
         height = int(self.height_spinbutton.get_value())
@@ -1678,27 +1596,8 @@ class ProjectSettingsDialog():
         self.par_fraction_widget.set_sensitive(not dar_is_selected)
         self.par_combo.set_sensitive(not dar_is_selected)
 
-    def _addPresetCb(self, unused_action, unused_param, button, combo, mgr):
-        preset_name = mgr.getNewPresetName()
-        mgr.createPreset(preset_name)
-        combo.set_active_id(preset_name)
-        self._updatePresetActions(button, combo, mgr)
-
-    def _removePresetCb(self, unused_action, unused_param, button, combo, mgr):
-        mgr.removeCurrentPreset()
-        self._updatePresetActions(button, combo, mgr)
-
-    def _savePresetCb(self, unused_action, unused_param, mgr, button, combo):
-        entry = combo.get_child()
-        preset_name = entry.get_text()
-        if not mgr.cur_preset:
-            mgr.createPreset(preset_name)
-        mgr.saveCurrentPreset(preset_name)
-        self._updatePresetActions(button, combo, mgr)
-
-    def _updatePresetMenuButton(self, unused_source, unused_target,
-                                button, combo, presets):
-        self._updatePresetActions(button, combo, presets)
+    def _updatePresetMenuButton(self, unused_source, unused_target, mgr):
+        mgr.updateMenuActions()
 
     def darSelected(self):
         return self.select_dar_radiobutton.props.active
@@ -1757,7 +1656,7 @@ class ProjectSettingsDialog():
 
         matching_video_preset = self.video_presets.matchingPreset(self.project)
         if matching_video_preset:
-            self.video_presets_combo.set_active_id(matching_video_preset)
+            self.video_presets.restorePreset(matching_video_preset)
 
         # Audio
         set_combo_value(self.channels_combo, self.project.audiochannels)
@@ -1765,7 +1664,7 @@ class ProjectSettingsDialog():
 
         matching_audio_preset = self.audio_presets.matchingPreset(self.project)
         if matching_audio_preset:
-            self.audio_presets_combo.set_active_id(matching_audio_preset)
+            self.audio_presets.restorePreset(matching_audio_preset)
 
         # Metadata
         self.title_entry.set_text(self.project.name)
diff --git a/pitivi/render.py b/pitivi/render.py
index 54eddc9..e905bd2 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -352,6 +352,9 @@ class RenderDialog(Loggable):
         # {object: sigId}
         self._gstSigId = {}
 
+        self.render_presets = RenderPresetManager()
+        self.render_presets.loadAll()
+
         self._createUi()
 
         # Directory and Filename
@@ -379,29 +382,20 @@ class RenderDialog(Loggable):
 
         self.wg = RippleUpdateGroup()
         self.wg.addVertex(self.frame_rate_combo, signal="changed")
-        self.wg.addVertex(
-            self.save_render_preset_button, update_func=self._updateRenderSaveButton)
         self.wg.addVertex(self.channels_combo, signal="changed")
         self.wg.addVertex(self.sample_rate_combo, signal="changed")
         self.wg.addVertex(self.muxercombobox, signal="changed")
         self.wg.addVertex(self.audio_encoder_combo, signal="changed")
         self.wg.addVertex(self.video_encoder_combo, signal="changed")
-        self.render_presets = RenderPresetManager()
-        self.render_presets.loadAll()
+        self.wg.addVertex(self.preset_menubutton,
+                          update_func=self._updatePresetMenuButton)
 
-        self._fillPresetsTreeview(
-            self.render_preset_treeview,
-            self.render_presets,
-            self._updateRenderPresetButtons)
-
-        self.wg.addEdge(self.frame_rate_combo, self.save_render_preset_button)
-        self.wg.addEdge(
-            self.audio_encoder_combo, self.save_render_preset_button)
-        self.wg.addEdge(
-            self.video_encoder_combo, self.save_render_preset_button)
-        self.wg.addEdge(self.muxercombobox, self.save_render_preset_button)
-        self.wg.addEdge(self.channels_combo, self.save_render_preset_button)
-        self.wg.addEdge(self.sample_rate_combo, self.save_render_preset_button)
+        self.wg.addEdge(self.frame_rate_combo, self.preset_menubutton)
+        self.wg.addEdge(self.audio_encoder_combo, self.preset_menubutton)
+        self.wg.addEdge(self.video_encoder_combo, self.preset_menubutton)
+        self.wg.addEdge(self.muxercombobox, self.preset_menubutton)
+        self.wg.addEdge(self.channels_combo, self.preset_menubutton)
+        self.wg.addEdge(self.sample_rate_combo, self.preset_menubutton)
 
         # Bind widgets to RenderPresetsManager
         self.render_presets.bindWidget(
@@ -437,22 +431,8 @@ class RenderDialog(Loggable):
             lambda x: setattr(self.project, "videowidth", x),
             lambda: 0)
 
-        self.createVolatileCustomPreset()
-
-    def createVolatileCustomPreset(self):
-        preset = {
-            "channels": int(get_combo_value(self.channels_combo)),
-            "sample-rate": int(get_combo_value(self.sample_rate_combo)),
-            "acodec": get_combo_value(self.audio_encoder_combo).get_name(),
-            "vcodec": get_combo_value(self.video_encoder_combo).get_name(),
-            "container": get_combo_value(self.muxercombobox).get_name(),
-            "frame-rate": Gst.Fraction(
-                int(get_combo_value(self.frame_rate_combo).num),
-                int(get_combo_value(self.frame_rate_combo).denom)),
-            "height": self.project.videoheight,
-            "width": self.project.videowidth}
-        name = self.render_presets.getUniqueName()
-        self.render_presets.createPreset(name, preset, volatile=True)
+    def _updatePresetMenuButton(self, unused_source, unused_target):
+        self.render_presets.updateMenuActions()
 
     def muxer_setter(self, widget, value):
         set_combo_value(widget, Gst.ElementFactory.find(value))
@@ -495,90 +475,6 @@ class RenderDialog(Loggable):
         set_combo_value(widget, value)
         self.project.videorate = value
 
-    def _fillPresetsTreeview(self, treeview, mgr, update_buttons_func):
-        """Set up the specified treeview to display the specified presets.
-
-        @param treeview: The treeview for displaying the presets.
-        @type treeview: TreeView
-        @param mgr: The preset manager.
-        @type mgr: PresetManager
-        @param update_buttons_func: A function which updates the buttons for
-        removing and saving a preset, enabling or disabling them accordingly.
-        @type update_buttons_func: function
-        """
-        renderer = Gtk.CellRendererText()
-        renderer.props.editable = True
-        column = Gtk.TreeViewColumn("Preset", renderer, text=0)
-        treeview.append_column(column)
-        treeview.props.headers_visible = False
-        model = mgr.getModel()
-        treeview.set_model(model)
-        model.connect(
-            "row-inserted", self._newPresetCb, column, renderer, treeview)
-        renderer.connect("edited", self._presetNameEditedCb, mgr)
-        treeview.get_selection().connect("changed", self._presetChangedCb,
-                                         mgr, update_buttons_func)
-
-    def _newPresetCb(self, unused_model, path, unused_iter_, column, renderer, treeview):
-        """Handle the addition of a preset to the model of the preset manager.
-        """
-        treeview.set_cursor_on_cell(path, column, renderer, start_editing=True)
-        treeview.grab_focus()
-
-    def _presetNameEditedCb(self, unused_renderer, path, new_text, mgr):
-        """Handle the renaming of a preset."""
-        old_name = mgr.getModel()[path][0]
-        assert old_name == mgr.cur_preset
-        mgr.saveCurrentPreset(new_text)
-        self._updateRenderPresetButtons()
-
-    def _updateRenderSaveButton(self, unused_in, button):
-        button.set_sensitive(self.render_presets.isSaveButtonSensitive(self.render_presets.cur_preset))
-
-    def _addRenderPresetButtonClickedCb(self, unused_button):
-        preset_name = self.render_presets.getNewPresetName()
-        framerate = Gst.Fraction(int(get_combo_value(self.frame_rate_combo).num),
-                                 int(get_combo_value(self.frame_rate_combo).denom))
-        preset = {
-            "channels": int(get_combo_value(self.channels_combo)),
-            "sample-rate": int(get_combo_value(self.sample_rate_combo)),
-            "acodec": get_combo_value(self.audio_encoder_combo).get_name(),
-            "vcodec": get_combo_value(self.video_encoder_combo).get_name(),
-            "container": get_combo_value(self.muxercombobox).get_name(),
-            "frame-rate": framerate,
-            "height": 0,
-            "width": 0,
-        }
-        self.render_presets.createPreset(preset_name, preset)
-        self.render_presets.restorePreset(preset_name)
-        self._updateRenderPresetButtons()
-
-    def _saveRenderPresetButtonClickedCb(self, unused_button):
-        self.render_presets.saveCurrentPreset()
-        self.save_render_preset_button.set_sensitive(False)
-        self.remove_render_preset_button.set_sensitive(True)
-
-    def _updateRenderPresetButtons(self):
-        can_save = self.render_presets.isSaveButtonSensitive(self.render_presets.cur_preset)
-        self.save_render_preset_button.set_sensitive(can_save)
-        can_remove = self.render_presets.isRemoveButtonSensitive()
-        self.remove_render_preset_button.set_sensitive(can_remove)
-
-    def _removeRenderPresetButtonClickedCb(self, unused_button):
-        self.render_presets.removeCurrentPreset()
-
-    def _presetChangedCb(self, selection, mgr, update_preset_buttons_func):
-        """Handle the selection of a preset."""
-        model, iter_ = selection.get_selected()
-        if iter_:
-            self.selected_preset = model[iter_][0]
-        else:
-            self.selected_preset = None
-
-        mgr.restorePreset(self.selected_preset)
-        self._displaySettings()
-        update_preset_buttons_func()
-
     def _createUi(self):
         builder = Gtk.Builder()
         builder.add_from_file(
@@ -605,22 +501,15 @@ class RenderDialog(Loggable):
         self.filebutton = builder.get_object("filebutton")
         self.fileentry = builder.get_object("fileentry")
         self.resolution_label = builder.get_object("resolution_label")
-        self.render_preset_treeview = builder.get_object(
-            "render_preset_treeview")
-        self.save_render_preset_button = builder.get_object(
-            "save_render_preset_button")
-        self.remove_render_preset_button = builder.get_object(
-            "remove_render_preset_button")
+        self.presets_combo = builder.get_object("presets_combo")
+        self.preset_menubutton = builder.get_object("preset_menubutton")
+
+        self.render_presets.setupUi(self.presets_combo, self.preset_menubutton)
 
         icon = os.path.join(configure.get_pixmap_dir(), "pitivi-render-16.png")
         self.window.set_icon_from_file(icon)
         self.window.set_transient_for(self.app.gui)
 
-        # Set the shading style in the toolbar below presets
-        presets_toolbar = builder.get_object("render_presets_toolbar")
-        presets_toolbar.get_style_context().add_class(
-            Gtk.STYLE_CLASS_INLINE_TOOLBAR)
-
     def _settingsChanged(self, unused_project, unused_key, unused_value):
         self.updateResolution()
 
@@ -1035,35 +924,24 @@ class RenderDialog(Loggable):
 
     def _audioOutputCheckbuttonToggledCb(self, unused_audio):
         active = self.audio_output_checkbutton.get_active()
-        if active:
-            self.channels_combo.set_sensitive(True)
-            self.sample_rate_combo.set_sensitive(True)
-            self.audio_encoder_combo.set_sensitive(True)
-            self.audio_settings_button.set_sensitive(True)
-            self.render_button.set_sensitive(True)
-        else:
-            self.channels_combo.set_sensitive(False)
-            self.sample_rate_combo.set_sensitive(False)
-            self.audio_encoder_combo.set_sensitive(False)
-            self.audio_settings_button.set_sensitive(False)
-            if not self.video_output_checkbutton.get_active():
-                self.render_button.set_sensitive(False)
+        self.channels_combo.set_sensitive(active)
+        self.sample_rate_combo.set_sensitive(active)
+        self.audio_encoder_combo.set_sensitive(active)
+        self.audio_settings_button.set_sensitive(active)
+        self.__updateRenderButtonSensitivity()
 
     def _videoOutputCheckbuttonToggledCb(self, unused_video):
         active = self.video_output_checkbutton.get_active()
-        if active:
-            self.scale_spinbutton.set_sensitive(True)
-            self.frame_rate_combo.set_sensitive(True)
-            self.video_encoder_combo.set_sensitive(True)
-            self.video_settings_button.set_sensitive(True)
-            self.render_button.set_sensitive(True)
-        else:
-            self.scale_spinbutton.set_sensitive(False)
-            self.frame_rate_combo.set_sensitive(False)
-            self.video_encoder_combo.set_sensitive(False)
-            self.video_settings_button.set_sensitive(False)
-            if not self.audio_output_checkbutton.get_active():
-                self.render_button.set_sensitive(False)
+        self.scale_spinbutton.set_sensitive(active)
+        self.frame_rate_combo.set_sensitive(active)
+        self.video_encoder_combo.set_sensitive(active)
+        self.video_settings_button.set_sensitive(active)
+        self.__updateRenderButtonSensitivity()
+
+    def __updateRenderButtonSensitivity(self):
+        video_enabled = self.video_output_checkbutton.get_active()
+        audio_enabled = self.audio_output_checkbutton.get_active()
+        self.render_button.set_sensitive(video_enabled or audio_enabled)
 
     def _frameRateComboChangedCb(self, combo):
         framerate = get_combo_value(combo)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]