Update
This commit is contained in:
parent
f06f3dbb33
commit
bbe332f107
@ -1,24 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkBox" id="noti_vbox_disabled">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="noti_disabled_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="label" translatable="yes">Notification support disabled at compile time.</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkAdjustment" id="fine_scroll_step_adjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="noti_timeout_adjustment">
|
||||
<property name="upper">1000000000</property>
|
||||
@ -30,11 +17,11 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">5</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table8">
|
||||
@ -88,6 +75,9 @@
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
@ -111,13 +101,14 @@
|
||||
<object class="GtkFrame" id="frame11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">3</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="noti_hotkey_check">
|
||||
@ -203,12 +194,29 @@
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="scroll_step_adjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<object class="GtkBox" id="noti_vbox_disabled">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="noti_disabled_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="label" translatable="yes">Notification support disabled at compile time.</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="fine_scroll_step_adjustment">
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="scroll_step_adjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
@ -220,10 +228,10 @@
|
||||
</object>
|
||||
<object class="GtkDialog" id="prefs_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="title" translatable="yes">PNMixer Preferences</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="icon_name">preferences-system</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
@ -234,7 +242,6 @@
|
||||
<object class="GtkButtonBox" id="action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">10</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel_button">
|
||||
@ -320,6 +327,11 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
@ -339,47 +351,20 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">5</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="row_spacing">15</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label35">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Slider Orientation:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="vol_orientation_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="active">0</property>
|
||||
<items>
|
||||
<item translatable="yes" id="vertical">Vertical</item>
|
||||
<item translatable="yes" id="horizontal">Horizontal</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="vol_text_check">
|
||||
<property name="label" translatable="yes">Display Text Volume</property>
|
||||
@ -393,8 +378,6 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -402,12 +385,12 @@
|
||||
<object class="GtkLabel" id="vol_pos_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Text Volume Position:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Text Volume Position:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -417,17 +400,17 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="active">0</property>
|
||||
<items>
|
||||
<item translatable="yes" id="top">Top</item>
|
||||
<item translatable="yes" id="bottom">Bottom</item>
|
||||
<item translatable="yes" id="left">Left</item>
|
||||
<item translatable="yes" id="right">Right</item>
|
||||
<item id="top" translatable="yes">Top</item>
|
||||
<item id="bottom" translatable="yes">Bottom</item>
|
||||
<item id="left" translatable="yes">Left</item>
|
||||
<item id="right" translatable="yes">Right</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -454,6 +437,7 @@
|
||||
<object class="GtkFrame" id="frame2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table2">
|
||||
@ -483,8 +467,8 @@
|
||||
<object class="GtkLabel" id="vol_meter_pos_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Volume Meter Offset (%):</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Volume Meter Offset (%):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@ -496,8 +480,8 @@
|
||||
<object class="GtkLabel" id="vol_meter_color_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Volume Meter Color:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Volume Meter Color:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
@ -563,6 +547,7 @@
|
||||
<object class="GtkFrame" id="frame6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="system_theme">
|
||||
@ -571,8 +556,8 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -611,26 +596,26 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">5</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="row_spacing">15</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Card:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Card:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
@ -640,8 +625,8 @@
|
||||
<object class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Channel:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Channel:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@ -674,37 +659,6 @@
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="normalize_vol_check">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label23">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Normalize Volume:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="tooltip_text" translatable="yes">Change volume on a logarithmic scale, closer to human perception.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
@ -721,6 +675,7 @@
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@ -745,11 +700,11 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">5</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="vol_control_entry">
|
||||
@ -782,6 +737,7 @@
|
||||
<object class="GtkFrame" id="frame10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table7">
|
||||
@ -796,8 +752,8 @@
|
||||
<object class="GtkLabel" id="label31">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Scroll Step:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Scroll Step:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
@ -807,8 +763,8 @@
|
||||
<object class="GtkLabel" id="label32">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Fine Scroll Step:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Fine Scroll Step:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@ -820,12 +776,12 @@
|
||||
<object class="GtkSpinButton" id="scroll_step_spin">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="adjustment">scroll_step_adjustment</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@ -837,12 +793,12 @@
|
||||
<object class="GtkSpinButton" id="fine_scroll_step_spin">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="adjustment">fine_scroll_step_adjustment</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@ -875,6 +831,7 @@
|
||||
<object class="GtkFrame" id="frame5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table4">
|
||||
@ -889,8 +846,8 @@
|
||||
<object class="GtkLabel" id="label15">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Middle Click Action:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Middle Click Action:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
@ -900,8 +857,8 @@
|
||||
<object class="GtkLabel" id="custom_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Custom Command:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Custom Command:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@ -914,10 +871,10 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<items>
|
||||
<item translatable="yes" id="mute">Mute/Unmute</item>
|
||||
<item translatable="yes" id="prefs">Show Preferences</item>
|
||||
<item translatable="yes" id="mixer">Volume Control</item>
|
||||
<item translatable="yes" id="custom">Custom (set below)</item>
|
||||
<item id="mute" translatable="yes">Mute/Unmute</item>
|
||||
<item id="prefs" translatable="yes">Show Preferences</item>
|
||||
<item id="mixer" translatable="yes">Volume Control</item>
|
||||
<item id="custom" translatable="yes">Custom (set below)</item>
|
||||
</items>
|
||||
<signal name="changed" handler="on_middle_click_combo_changed" swapped="no"/>
|
||||
</object>
|
||||
@ -984,18 +941,18 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">5</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hotkeys_enable_check">
|
||||
<property name="label" translatable="yes">Enable HotKeys</property>
|
||||
@ -1026,8 +983,8 @@
|
||||
<object class="GtkLabel" id="label20">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Command</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Command</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
@ -1037,8 +994,8 @@
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Mute/Unmute:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Mute/Unmute:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@ -1049,8 +1006,8 @@
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Volume Up:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Volume Up:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
@ -1061,8 +1018,8 @@
|
||||
<object class="GtkLabel" id="label18">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Volume Down:</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Volume Down:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
@ -1218,8 +1175,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-5">ok_button</action-widget>
|
||||
<action-widget response="-6">cancel_button</action-widget>
|
||||
<action-widget response="-5">ok_button</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
@ -78,10 +78,21 @@ impl AlsaCard {
|
||||
}
|
||||
|
||||
|
||||
pub fn card_name(&self) -> Result<String> {
|
||||
return self.card.get_name().from_err();
|
||||
}
|
||||
|
||||
|
||||
pub fn chan_name(&self) -> Result<String> {
|
||||
let n = self.selem_id
|
||||
.get_name()
|
||||
.map(|y| String::from(y))?;
|
||||
return Ok(n);
|
||||
}
|
||||
|
||||
|
||||
pub fn selem(&self) -> Selem {
|
||||
return get_selems(&self.mixer)
|
||||
.nth(self.selem_id.get_index() as usize)
|
||||
.unwrap();
|
||||
return self.mixer.find_selem(&self.selem_id).unwrap();
|
||||
}
|
||||
|
||||
|
||||
@ -254,6 +265,19 @@ pub fn get_alsa_cards() -> alsa::card::Iter {
|
||||
}
|
||||
|
||||
|
||||
pub fn get_alsa_card_names() -> Vec<String> {
|
||||
let mut vec = vec![];
|
||||
for card in get_alsa_cards() {
|
||||
match card.and_then(|c| c.get_name()) {
|
||||
Ok(name) => vec.push(name),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
||||
pub fn get_alsa_card_by_name(name: String) -> Result<Card> {
|
||||
for r_card in get_alsa_cards() {
|
||||
let card = r_card?;
|
||||
@ -284,6 +308,22 @@ pub fn get_selems(mixer: &Mixer) -> Map<alsa::mixer::Iter, fn(Elem) -> Selem> {
|
||||
}
|
||||
|
||||
|
||||
pub fn get_selem_names(mixer: &Mixer) -> Vec<String> {
|
||||
let mut vec = vec![];
|
||||
for selem in get_selems(mixer) {
|
||||
let n = selem.get_id()
|
||||
.get_name()
|
||||
.map(|y| String::from(y));
|
||||
match n {
|
||||
Ok(name) => vec.push(name),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
||||
pub fn get_selem_by_name(mixer: &Mixer, name: String) -> Result<Selem> {
|
||||
for selem in get_selems(mixer) {
|
||||
let n = selem.get_id()
|
||||
|
@ -1,8 +1,6 @@
|
||||
use gtk;
|
||||
use audio::Audio;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use glade_helpers::*;
|
||||
|
||||
|
||||
|
||||
// TODO: destructors
|
||||
@ -19,8 +17,12 @@ impl AppS {
|
||||
let builder_popup_window =
|
||||
gtk::Builder::new_from_string(include_str!("../data/ui/popup-window.glade"));
|
||||
let builder_popup_menu = gtk::Builder::new_from_string(include_str!("../data/ui/popup-menu.glade"));
|
||||
let builder_prefs_dialog =
|
||||
gtk::Builder::new_from_string(include_str!("../data/ui/prefs-dialog.glade"));
|
||||
return AppS {
|
||||
gui: Gui::new(builder_popup_window, builder_popup_menu),
|
||||
gui: Gui::new(builder_popup_window,
|
||||
builder_popup_menu,
|
||||
builder_prefs_dialog),
|
||||
audio: Audio::new(None, Some(String::from("Master")))
|
||||
.unwrap(),
|
||||
};
|
||||
@ -32,31 +34,41 @@ pub struct Gui {
|
||||
pub status_icon: gtk::StatusIcon,
|
||||
pub popup_window: PopupWindow,
|
||||
pub popup_menu: PopupMenu,
|
||||
pub prefs_dialog: PrefsDialog,
|
||||
}
|
||||
|
||||
|
||||
impl Gui {
|
||||
pub fn new(builder_popup_window: gtk::Builder,
|
||||
builder_popup_menu: gtk::Builder)
|
||||
builder_popup_menu: gtk::Builder,
|
||||
builder_prefs_dialog: gtk::Builder)
|
||||
-> Gui {
|
||||
return Gui {
|
||||
status_icon: gtk::StatusIcon::new_from_icon_name("pnmixer"),
|
||||
popup_window: PopupWindow::new(builder_popup_window),
|
||||
popup_menu: PopupMenu::new(builder_popup_menu),
|
||||
prefs_dialog: PrefsDialog::new(builder_prefs_dialog),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
create_builder_item!(PopupMenu,
|
||||
menu_window: gtk::Window,
|
||||
menubar: gtk::MenuBar,
|
||||
menu: gtk::Menu,
|
||||
about_item: gtk::MenuItem);
|
||||
|
||||
|
||||
create_builder_item!(PopupWindow,
|
||||
popup_window: gtk::Window,
|
||||
vol_scale_adj: gtk::Adjustment,
|
||||
vol_scale: gtk::Scale,
|
||||
mute_check: gtk::CheckButton);
|
||||
|
||||
|
||||
create_builder_item!(PopupMenu,
|
||||
menu_window: gtk::Window,
|
||||
menubar: gtk::MenuBar,
|
||||
menu: gtk::Menu,
|
||||
about_item: gtk::MenuItem,
|
||||
prefs_item: gtk::MenuItem);
|
||||
|
||||
|
||||
create_builder_item!(PrefsDialog,
|
||||
prefs_dialog: gtk::Dialog,
|
||||
card_combo: gtk::ComboBoxText,
|
||||
chan_combo: gtk::ComboBoxText);
|
||||
|
86
src/audio.rs
86
src/audio.rs
@ -1,6 +1,7 @@
|
||||
use errors::*;
|
||||
use glib;
|
||||
use std::cell::Cell;
|
||||
use std::cell::Ref;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::f64;
|
||||
@ -28,11 +29,34 @@ pub enum AudioSignal {
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Handlers {
|
||||
inner: Rc<RefCell<Vec<Box<Fn(AudioSignal, AudioUser)>>>>,
|
||||
}
|
||||
|
||||
|
||||
impl Handlers {
|
||||
fn new() -> Handlers {
|
||||
return Handlers { inner: Rc::new(RefCell::new(vec![])) };
|
||||
}
|
||||
|
||||
|
||||
fn borrow(&self) -> Ref<Vec<Box<Fn(AudioSignal, AudioUser)>>> {
|
||||
return self.inner.borrow();
|
||||
}
|
||||
|
||||
|
||||
fn add_handler(&self, cb: Box<Fn(AudioSignal, AudioUser)>) {
|
||||
self.inner.borrow_mut().push(cb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct Audio {
|
||||
_cannot_construct: (),
|
||||
pub acard: RefCell<Box<AlsaCard>>,
|
||||
pub last_action_timestamp: Rc<RefCell<i64>>,
|
||||
pub handlers: Rc<RefCell<Vec<Box<Fn(AudioSignal, AudioUser)>>>>,
|
||||
pub handlers: Handlers,
|
||||
pub scroll_step: Cell<u32>,
|
||||
}
|
||||
|
||||
@ -42,16 +66,18 @@ impl Audio {
|
||||
elem_name: Option<String>)
|
||||
-> Result<Audio> {
|
||||
|
||||
let handlers = Rc::new(RefCell::new(vec![]));
|
||||
let handlers = Handlers::new();
|
||||
let last_action_timestamp = Rc::new(RefCell::new(0));
|
||||
|
||||
let cb = {
|
||||
let myhandler = handlers.clone();
|
||||
let ts = last_action_timestamp.clone();
|
||||
let cb = Rc::new(move |event| {
|
||||
Audio::on_alsa_event(&mut *ts.borrow_mut(),
|
||||
Rc::new(move |event| {
|
||||
on_alsa_event(&mut *ts.borrow_mut(),
|
||||
&myhandler.borrow(),
|
||||
event)
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
let audio = Audio {
|
||||
_cannot_construct: (),
|
||||
@ -70,12 +96,18 @@ impl Audio {
|
||||
elem_name: Option<String>)
|
||||
-> Result<()> {
|
||||
debug!("Switching cards");
|
||||
let cb = self.acard.borrow().cb.clone();
|
||||
debug!("Old card name: {}", self.acard.borrow().card_name().unwrap());
|
||||
debug!("Old chan name: {}", self.acard.borrow().chan_name().unwrap());
|
||||
let cb = self.acard
|
||||
.borrow()
|
||||
.cb
|
||||
.clone();
|
||||
{
|
||||
let mut ac = self.acard.borrow_mut();
|
||||
*ac = AlsaCard::new(card_name,
|
||||
elem_name,
|
||||
cb)?;
|
||||
|
||||
*ac = AlsaCard::new(card_name, elem_name, cb)?;
|
||||
}
|
||||
debug!("Old card name: {}", self.acard.borrow().card_name().unwrap());
|
||||
debug!("Old chan name: {}", self.acard.borrow().chan_name().unwrap());
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@ -92,7 +124,11 @@ impl Audio {
|
||||
}
|
||||
// TODO invoke handlers, make use of user
|
||||
|
||||
debug!("Setting vol to {:?} by user {:?}", new_vol, user);
|
||||
debug!("Setting vol on card {:?} and chan {:?} to {:?} by user {:?}",
|
||||
self.acard.borrow().card_name().unwrap(),
|
||||
self.acard.borrow().chan_name().unwrap(),
|
||||
new_vol,
|
||||
user);
|
||||
return self.acard.borrow().set_vol(new_vol);
|
||||
}
|
||||
|
||||
@ -105,7 +141,11 @@ impl Audio {
|
||||
let old_vol = self.vol()?;
|
||||
let new_vol = f64::ceil(old_vol + (self.scroll_step.get() as f64));
|
||||
|
||||
debug!("Increase vol by {:?} to {:?}", (new_vol - old_vol), new_vol);
|
||||
debug!("Increase vol on card {:?} and chan {:?} by {:?} to {:?}",
|
||||
self.acard.borrow().card_name().unwrap(),
|
||||
self.acard.borrow().chan_name().unwrap(),
|
||||
(new_vol - old_vol),
|
||||
new_vol);
|
||||
|
||||
return self.set_vol(new_vol, user);
|
||||
}
|
||||
@ -119,7 +159,11 @@ impl Audio {
|
||||
let old_vol = self.vol()?;
|
||||
let new_vol = old_vol - (self.scroll_step.get() as f64);
|
||||
|
||||
debug!("Decrease vol by {:?} to {:?}", (new_vol - old_vol), new_vol);
|
||||
debug!("Decrease vol on card {:?} and chan {:?} by {:?} to {:?}",
|
||||
self.acard.borrow().card_name().unwrap(),
|
||||
self.acard.borrow().chan_name().unwrap(),
|
||||
(new_vol - old_vol),
|
||||
new_vol);
|
||||
|
||||
return self.set_vol(new_vol, user);
|
||||
}
|
||||
@ -139,13 +183,20 @@ impl Audio {
|
||||
let mut rc = self.last_action_timestamp.borrow_mut();
|
||||
*rc = glib::get_monotonic_time();
|
||||
// TODO invoke handlers, make use of user
|
||||
debug!("Setting mute to {} by user {:?}", mute, user);
|
||||
|
||||
debug!("Setting mute to {} on card {:?} and chan {:?} by user {:?}",
|
||||
mute,
|
||||
self.acard.borrow().card_name().unwrap(),
|
||||
self.acard.borrow().chan_name().unwrap(),
|
||||
user);
|
||||
|
||||
return self.acard.borrow().set_mute(mute);
|
||||
}
|
||||
|
||||
|
||||
pub fn connect_handler(&self, cb: Box<Fn(AudioSignal, AudioUser)>) {
|
||||
self.handlers.borrow_mut().push(cb);
|
||||
self.handlers.add_handler(cb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -167,6 +218,8 @@ impl Audio {
|
||||
alsa_event: AlsaEvent) {
|
||||
let last: i64 = *last_action_timestamp;
|
||||
|
||||
debug!("Last: {}", last);
|
||||
|
||||
if last != 0 {
|
||||
let now: i64 = glib::get_monotonic_time();
|
||||
let delay: i64 = now - last;
|
||||
@ -184,7 +237,7 @@ impl Audio {
|
||||
AlsaEvent::AlsaCardDiconnected => debug!("AlsaCardDiconnected"),
|
||||
AlsaEvent::AlsaCardValuesChanged => {
|
||||
debug!("AlsaCardValuesChanged");
|
||||
Audio::invoke_handlers(handlers,
|
||||
invoke_handlers(handlers,
|
||||
self::AudioSignal::AudioValuesChanged,
|
||||
self::AudioUser::AudioUserUnknown);
|
||||
}
|
||||
@ -192,4 +245,3 @@ impl Audio {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,16 +36,16 @@ macro_rules! try_wr {
|
||||
},
|
||||
});
|
||||
($expr:expr, $ret:expr, $fmt:expr) => (match $expr {
|
||||
std::result::Result::Ok(val) => val,
|
||||
std::result::Result::Err(err) => {
|
||||
::std::result::Result::Ok(val) => val,
|
||||
::std::result::Result::Err(err) => {
|
||||
warn!("Original error: {:?}", err);
|
||||
warn!($fmt);
|
||||
return $ret;
|
||||
},
|
||||
});
|
||||
($expr:expr, $ret:expr, $fmt:expr, $($arg:tt)+) => (match $expr {
|
||||
std::result::Result::Ok(val) => val,
|
||||
std::result::Result::Err(err) => {
|
||||
::std::result::Result::Ok(val) => val,
|
||||
::std::result::Result::Err(err) => {
|
||||
warn!("Original error: {:?}", err);
|
||||
warn!(format!($fmt, $(arg)+));
|
||||
return $ret;
|
||||
@ -57,8 +57,8 @@ macro_rules! try_wr {
|
||||
#[macro_export]
|
||||
macro_rules! try_r {
|
||||
($expr:expr, $ret:expr) => (match $expr {
|
||||
std::result::Result::Ok(val) => val,
|
||||
std::result::Result::Err(err) => {
|
||||
::std::result::Result::Ok(val) => val,
|
||||
::std::result::Result::Err(err) => {
|
||||
return $ret;
|
||||
},
|
||||
});
|
||||
@ -90,16 +90,16 @@ macro_rules! try_er {
|
||||
},
|
||||
});
|
||||
($expr:expr, $ret:expr, $fmt:expr) => (match $expr {
|
||||
std::result::Result::Ok(val) => val,
|
||||
std::result::Result::Err(err) => {
|
||||
::std::result::Result::Ok(val) => val,
|
||||
::std::result::Result::Err(err) => {
|
||||
err!("Original error: {:?}", err);
|
||||
err!($fmt);
|
||||
return $ret;
|
||||
},
|
||||
});
|
||||
($expr:expr, $ret:expr, $fmt:expr, $($arg:tt)+) => (match $expr {
|
||||
std::result::Result::Ok(val) => val,
|
||||
std::result::Result::Err(err) => {
|
||||
::std::result::Result::Ok(val) => val,
|
||||
::std::result::Result::Err(err) => {
|
||||
err!("Original error: {:?}", err);
|
||||
err!(format!($fmt, $(arg)+));
|
||||
return $ret;
|
||||
|
@ -4,6 +4,7 @@ use std::rc::Rc;
|
||||
use ui_popup_menu::*;
|
||||
use ui_popup_window::*;
|
||||
use ui_tray_icon::*;
|
||||
use ui_prefs_dialog::*;
|
||||
|
||||
|
||||
|
||||
@ -25,4 +26,5 @@ pub fn init(appstate: Rc<AppS>) {
|
||||
init_tray_icon(appstate.clone());
|
||||
init_popup_window(appstate.clone());
|
||||
init_popup_menu(appstate.clone());
|
||||
init_prefs_dialog(appstate.clone());
|
||||
}
|
||||
|
@ -21,6 +21,18 @@ pub fn init_popup_menu(appstate: Rc<AppS>) {
|
||||
on_about_item_activate(&apps);
|
||||
});
|
||||
}
|
||||
|
||||
/* about_item.connect_activate_link */
|
||||
{
|
||||
let apps = appstate.clone();
|
||||
let prefs_item = &appstate.clone()
|
||||
.gui
|
||||
.popup_menu
|
||||
.prefs_item;
|
||||
prefs_item.connect_activate(move |_| {
|
||||
on_prefs_item_activate(&apps);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -60,3 +72,14 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA."));
|
||||
|
||||
return about_dialog;
|
||||
}
|
||||
|
||||
|
||||
fn on_prefs_item_activate(appstate: &AppS) {
|
||||
/* TODO: only create if needed */
|
||||
let prefs_dialog = &appstate.gui.prefs_dialog.prefs_dialog;
|
||||
let popup_menu = &appstate.gui.popup_menu.menu_window;
|
||||
|
||||
prefs_dialog.set_transient_for(popup_menu);
|
||||
prefs_dialog.run();
|
||||
// prefs_dialog.destroy();
|
||||
}
|
||||
|
119
src/ui_prefs_dialog.rs
Normal file
119
src/ui_prefs_dialog.rs
Normal file
@ -0,0 +1,119 @@
|
||||
use app_state::*;
|
||||
use gtk::prelude::*;
|
||||
use std::rc::Rc;
|
||||
use gtk;
|
||||
use alsa_pn;
|
||||
|
||||
|
||||
pub fn init_prefs_dialog(appstate: Rc<AppS>) {
|
||||
/* prefs_dialog.connect_show */
|
||||
{
|
||||
let apps = appstate.clone();
|
||||
let prefs_dialog = &appstate.clone()
|
||||
.gui
|
||||
.prefs_dialog
|
||||
.prefs_dialog;
|
||||
prefs_dialog.connect_show(move |_| { on_prefs_dialog_show(&apps); });
|
||||
}
|
||||
|
||||
/* card_combo.connect_changed */
|
||||
{
|
||||
let apps = appstate.clone();
|
||||
let card_combo = &appstate.gui.prefs_dialog.card_combo;
|
||||
|
||||
card_combo.connect_changed(move |_| { on_card_combo_changed(&apps); });
|
||||
}
|
||||
/* card_combo.connect_changed */
|
||||
{
|
||||
let apps = appstate.clone();
|
||||
let chan_combo = &appstate.gui.prefs_dialog.chan_combo;
|
||||
|
||||
chan_combo.connect_changed(move |_| { on_chan_combo_changed(&apps); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn on_prefs_dialog_show(appstate: &AppS) {
|
||||
let card_combo = &appstate.gui.prefs_dialog.card_combo;
|
||||
let chan_combo = &appstate.gui.prefs_dialog.chan_combo;
|
||||
let acard = appstate.audio.acard.borrow();
|
||||
|
||||
|
||||
/* set card combo */
|
||||
let cur_card_name = try_w!(acard.card_name(),
|
||||
"Can't get current card name!");
|
||||
let available_card_names = alsa_pn::get_alsa_card_names();
|
||||
|
||||
/* set_active_id doesn't work, so save the index */
|
||||
let mut c_index: i32 = -1;
|
||||
for i in 0..available_card_names.len() {
|
||||
let name = available_card_names.get(i).unwrap();
|
||||
if *name == cur_card_name {
|
||||
c_index = i as i32;
|
||||
}
|
||||
card_combo.append_text(&name);
|
||||
}
|
||||
|
||||
// TODO, block signal?
|
||||
card_combo.set_active(c_index);
|
||||
|
||||
|
||||
|
||||
/* set chan combo */
|
||||
let cur_chan_name = try_w!(acard.chan_name());
|
||||
let available_chan_names = alsa_pn::get_selem_names(&acard.mixer);
|
||||
|
||||
/* set_active_id doesn't work, so save the index */
|
||||
let mut c_index: i32 = -1;
|
||||
for i in 0..available_chan_names.len() {
|
||||
let name = available_chan_names.get(i).unwrap();
|
||||
if *name == cur_chan_name {
|
||||
c_index = i as i32;
|
||||
}
|
||||
chan_combo.append_text(&name);
|
||||
}
|
||||
|
||||
/* TODO, block signal?`*/
|
||||
chan_combo.set_active(c_index);
|
||||
|
||||
}
|
||||
|
||||
|
||||
fn on_card_combo_changed(appstate: &AppS) {
|
||||
let card_combo = &appstate.gui.prefs_dialog.card_combo;
|
||||
let chan_combo = &appstate.gui.prefs_dialog.chan_combo;
|
||||
let active_card_item =
|
||||
try_w!(card_combo.get_active_text().ok_or("No active Card item found"));
|
||||
let active_chan_item =
|
||||
chan_combo.get_active_id();
|
||||
let cur_card_name = {
|
||||
let acard = appstate.audio.acard.borrow();
|
||||
try_w!(acard.card_name(),
|
||||
"Can't get current card name!")
|
||||
};
|
||||
|
||||
if active_card_item != cur_card_name {
|
||||
appstate.audio.switch_acard(Some(cur_card_name), active_chan_item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn on_chan_combo_changed(appstate: &AppS) {
|
||||
let card_combo = &appstate.gui.prefs_dialog.card_combo;
|
||||
let chan_combo = &appstate.gui.prefs_dialog.chan_combo;
|
||||
let active_chan_item =
|
||||
try_w!(chan_combo.get_active_text().ok_or("No active Chan item found"));
|
||||
let cur_card_name = {
|
||||
let acard = appstate.audio.acard.borrow();
|
||||
acard.card_name().ok()
|
||||
};
|
||||
let cur_chan_name = {
|
||||
let acard = appstate.audio.acard.borrow();
|
||||
try_w!(acard.chan_name())
|
||||
};
|
||||
|
||||
if active_chan_item != cur_chan_name {
|
||||
appstate.audio.switch_acard(cur_card_name, Some(active_chan_item));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user