devicewidget: Move latency offset into an expander

We don't want to flood users with this option, let's just leave it
closed by default for those who need it.
This commit is contained in:
Arun Raghavan 2012-11-20 16:21:53 +05:30
parent cc06ae9029
commit c69cffecdc
3 changed files with 78 additions and 58 deletions

View File

@ -40,6 +40,7 @@ DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
x->get_widget("defaultToggleButton", defaultToggleButton); x->get_widget("defaultToggleButton", defaultToggleButton);
x->get_widget("portSelect", portSelect); x->get_widget("portSelect", portSelect);
x->get_widget("portList", portList); x->get_widget("portList", portList);
x->get_widget("advancedOptions", advancedOptions);
x->get_widget("offsetSelect", offsetSelect); x->get_widget("offsetSelect", offsetSelect);
x->get_widget("offsetButton", offsetButton); x->get_widget("offsetButton", offsetButton);
@ -194,13 +195,17 @@ void DeviceWidget::prepareMenu() {
if (ports.size() > 0) { if (ports.size() > 0) {
portSelect->show(); portSelect->show();
if (pa_context_get_server_protocol_version(get_context()) >= 27) if (pa_context_get_server_protocol_version(get_context()) >= 27) {
offsetSelect->show(); offsetSelect->show();
else advancedOptions->set_sensitive(true);
} else {
/* advancedOptions has sensitive=false by default */
offsetSelect->hide(); offsetSelect->hide();
}
} else { } else {
portSelect->hide(); portSelect->hide();
advancedOptions->set_sensitive(false);
offsetSelect->hide(); offsetSelect->hide();
} }
} }

View File

@ -94,6 +94,7 @@ protected:
ModelColumns portModel; ModelColumns portModel;
Gtk::Expander *advancedOptions;
Gtk::HBox *portSelect, *offsetSelect; Gtk::HBox *portSelect, *offsetSelect;
Gtk::ComboBox *portList; Gtk::ComboBox *portList;
Glib::RefPtr<Gtk::ListStore> treeModel; Glib::RefPtr<Gtk::ListStore> treeModel;

View File

@ -394,61 +394,6 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </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">&lt;b&gt;Latency offset:&lt;/b&gt;</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> <child>
<object class="GtkTable" id="encodingSelect"> <object class="GtkTable" id="encodingSelect">
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -531,7 +476,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">3</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -546,6 +491,75 @@
<placeholder/> <placeholder/>
</child> </child>
</object> </object>
<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="sensitive">False</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">&lt;b&gt;Latency offset:&lt;/b&gt;</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> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>