[pulseaudio-discuss] [PATCH 1/2] devicewidget: Move latency offset into an expander

Arun Raghavan arun.raghavan at collabora.co.uk
Tue Nov 20 06:38:13 PST 2012


We don't want to flood users with this option, let's just leave it
closed by default for those who need it.
---
 src/devicewidget.cc   |   9 +++-
 src/devicewidget.h    |   1 +
 src/pavucontrol.glade | 125 ++++++++++++++++++++++++++++----------------------
 3 files changed, 77 insertions(+), 58 deletions(-)

diff --git a/src/devicewidget.cc b/src/devicewidget.cc
index ba08cc8..bb3cfa8 100644
--- a/src/devicewidget.cc
+++ b/src/devicewidget.cc
@@ -40,6 +40,7 @@ DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
     x->get_widget("defaultToggleButton", defaultToggleButton);
     x->get_widget("portSelect", portSelect);
     x->get_widget("portList", portList);
+    x->get_widget("advancedOptions", advancedOptions);
     x->get_widget("offsetSelect", offsetSelect);
     x->get_widget("offsetButton", offsetButton);
 
@@ -194,13 +195,17 @@ void DeviceWidget::prepareMenu() {
     if (ports.size() > 0) {
         portSelect->show();
 
-        if (pa_context_get_server_protocol_version(get_context()) >= 27)
+        if (pa_context_get_server_protocol_version(get_context()) >= 27) {
             offsetSelect->show();
-        else
+            advancedOptions->set_sensitive(true);
+        } else {
+            advancedOptions->set_sensitive(false);
             offsetSelect->hide();
+        }
 
     } else {
         portSelect->hide();
+        advancedOptions->set_sensitive(false);
         offsetSelect->hide();
     }
 }
diff --git a/src/devicewidget.h b/src/devicewidget.h
index f099e6e..d2dff51 100644
--- a/src/devicewidget.h
+++ b/src/devicewidget.h
@@ -94,6 +94,7 @@ protected:
 
     ModelColumns portModel;
 
+    Gtk::Expander *advancedOptions;
     Gtk::HBox *portSelect, *offsetSelect;
     Gtk::ComboBox *portList;
     Glib::RefPtr<Gtk::ListStore> treeModel;
diff --git a/src/pavucontrol.glade b/src/pavucontrol.glade
index befdee0..96c4e10 100644
--- a/src/pavucontrol.glade
+++ b/src/pavucontrol.glade
@@ -395,61 +395,6 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="offsetSelect">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkLabel" id="label2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes"><b>Latency offset:</b></property>
-                        <property name="use_markup">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="offsetButton">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="primary_icon_activatable">False</property>
-                        <property name="secondary_icon_activatable">False</property>
-                        <property name="primary_icon_sensitive">True</property>
-                        <property name="secondary_icon_sensitive">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label3">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">ms</property>
-                        <property name="use_markup">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
                   <object class="GtkTable" id="encodingSelect">
                     <property name="can_focus">False</property>
                     <property name="n_rows">2</property>
@@ -531,7 +476,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">3</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
                 <child>
@@ -549,6 +494,74 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkExpander" id="advancedOptions">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <child>
+                      <object class="GtkHBox" id="offsetSelect">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes"><b>Latency offset:</b></property>
+                            <property name="use_markup">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="offsetButton">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">•</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">ms</property>
+                            <property name="use_markup">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="advancedLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Advanced</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
                     <property name="position">4</property>
                   </packing>
                 </child>
-- 
1.8.0



More information about the pulseaudio-discuss mailing list