This commit is contained in:
Julian Ospald 2017-07-02 18:11:56 +02:00
parent f06f3dbb33
commit bbe332f107
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
8 changed files with 420 additions and 215 deletions

View File

@ -1,24 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkBox" id="noti_vbox_disabled"> <object class="GtkAdjustment" id="fine_scroll_step_adjustment">
<property name="visible">True</property> <property name="upper">100</property>
<property name="can_focus">False</property> <property name="step_increment">1</property>
<property name="valign">start</property> <property name="page_increment">10</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> </object>
<object class="GtkAdjustment" id="noti_timeout_adjustment"> <object class="GtkAdjustment" id="noti_timeout_adjustment">
<property name="upper">1000000000</property> <property name="upper">1000000000</property>
@ -30,11 +17,11 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin">5</property>
<child> <child>
<object class="GtkFrame" id="frame9"> <object class="GtkFrame" id="frame9">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkTable" id="table8"> <object class="GtkTable" id="table8">
@ -88,6 +75,9 @@
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
</packing> </packing>
</child> </child>
<child>
<placeholder/>
</child>
</object> </object>
</child> </child>
<child type="label"> <child type="label">
@ -111,13 +101,14 @@
<object class="GtkFrame" id="frame11"> <object class="GtkFrame" id="frame11">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkBox" id="vbox7"> <object class="GtkBox" id="vbox7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="margin_start">12</property> <property name="margin_start">12</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<child> <child>
<object class="GtkCheckButton" id="noti_hotkey_check"> <object class="GtkCheckButton" id="noti_hotkey_check">
@ -203,12 +194,29 @@
</packing> </packing>
</child> </child>
</object> </object>
<object class="GtkAdjustment" id="scroll_step_adjustment"> <object class="GtkBox" id="noti_vbox_disabled">
<property name="upper">100</property> <property name="visible">True</property>
<property name="step_increment">1</property> <property name="can_focus">False</property>
<property name="page_increment">10</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>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object> </object>
<object class="GtkAdjustment" id="fine_scroll_step_adjustment"> <object class="GtkAdjustment" id="scroll_step_adjustment">
<property name="upper">100</property> <property name="upper">100</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">10</property> <property name="page_increment">10</property>
@ -220,10 +228,10 @@
</object> </object>
<object class="GtkDialog" id="prefs_dialog"> <object class="GtkDialog" id="prefs_dialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<property name="title" translatable="yes">PNMixer Preferences</property> <property name="title" translatable="yes">PNMixer Preferences</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="icon_name">preferences-system</property> <property name="icon_name">preferences-system</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="vbox1"> <object class="GtkBox" id="vbox1">
<property name="visible">True</property> <property name="visible">True</property>
@ -234,7 +242,6 @@
<object class="GtkButtonBox" id="action_area1"> <object class="GtkButtonBox" id="action_area1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">10</property>
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child> <child>
<object class="GtkButton" id="cancel_button"> <object class="GtkButton" id="cancel_button">
@ -320,6 +327,11 @@
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
@ -339,47 +351,20 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin">5</property>
<child> <child>
<object class="GtkFrame" id="frame1"> <object class="GtkFrame" id="frame1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkTable" id="table1"> <object class="GtkTable" id="table1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_start">12</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="n_columns">2</property>
<property name="row_spacing">15</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> <child>
<object class="GtkCheckButton" id="vol_text_check"> <object class="GtkCheckButton" id="vol_text_check">
<property name="label" translatable="yes">Display Text Volume</property> <property name="label" translatable="yes">Display Text Volume</property>
@ -393,8 +378,6 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <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> <property name="y_options">GTK_EXPAND</property>
</packing> </packing>
</child> </child>
@ -402,12 +385,12 @@
<object class="GtkLabel" id="vol_pos_label"> <object class="GtkLabel" id="vol_pos_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Text Volume Position:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Text Volume Position:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">2</property> <property name="top_attach">1</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">2</property>
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
</packing> </packing>
</child> </child>
@ -417,17 +400,17 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="active">0</property> <property name="active">0</property>
<items> <items>
<item translatable="yes" id="top">Top</item> <item id="top" translatable="yes">Top</item>
<item translatable="yes" id="bottom">Bottom</item> <item id="bottom" translatable="yes">Bottom</item>
<item translatable="yes" id="left">Left</item> <item id="left" translatable="yes">Left</item>
<item translatable="yes" id="right">Right</item> <item id="right" translatable="yes">Right</item>
</items> </items>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">1</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">2</property>
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
</packing> </packing>
</child> </child>
@ -454,6 +437,7 @@
<object class="GtkFrame" id="frame2"> <object class="GtkFrame" id="frame2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkTable" id="table2"> <object class="GtkTable" id="table2">
@ -483,8 +467,8 @@
<object class="GtkLabel" id="vol_meter_pos_label"> <object class="GtkLabel" id="vol_meter_pos_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Volume Meter Offset (%):</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Volume Meter Offset (%):</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
@ -496,8 +480,8 @@
<object class="GtkLabel" id="vol_meter_color_label"> <object class="GtkLabel" id="vol_meter_color_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Volume Meter Color:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Volume Meter Color:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">2</property> <property name="top_attach">2</property>
@ -563,6 +547,7 @@
<object class="GtkFrame" id="frame6"> <object class="GtkFrame" id="frame6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkCheckButton" id="system_theme"> <object class="GtkCheckButton" id="system_theme">
@ -571,8 +556,8 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="margin_start">12</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="margin_start">12</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</object> </object>
</child> </child>
@ -611,26 +596,26 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin">5</property>
<child> <child>
<object class="GtkFrame" id="frame3"> <object class="GtkFrame" id="frame3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkTable" id="table3"> <object class="GtkTable" id="table3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_start">12</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="n_columns">2</property>
<property name="row_spacing">15</property> <property name="row_spacing">15</property>
<child> <child>
<object class="GtkLabel" id="label10"> <object class="GtkLabel" id="label10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Card:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Card:</property>
</object> </object>
<packing> <packing>
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
@ -640,8 +625,8 @@
<object class="GtkLabel" id="label11"> <object class="GtkLabel" id="label11">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Channel:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Channel:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
@ -674,37 +659,6 @@
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
</packing> </packing>
</child> </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> </object>
</child> </child>
<child type="label"> <child type="label">
@ -721,6 +675,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="padding">5</property> <property name="padding">5</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -745,11 +700,11 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin">5</property>
<child> <child>
<object class="GtkFrame" id="frame4"> <object class="GtkFrame" id="frame4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkEntry" id="vol_control_entry"> <object class="GtkEntry" id="vol_control_entry">
@ -782,6 +737,7 @@
<object class="GtkFrame" id="frame10"> <object class="GtkFrame" id="frame10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkTable" id="table7"> <object class="GtkTable" id="table7">
@ -796,8 +752,8 @@
<object class="GtkLabel" id="label31"> <object class="GtkLabel" id="label31">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Scroll Step:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Scroll Step:</property>
</object> </object>
<packing> <packing>
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
@ -807,8 +763,8 @@
<object class="GtkLabel" id="label32"> <object class="GtkLabel" id="label32">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Fine Scroll Step:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Fine Scroll Step:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
@ -820,12 +776,12 @@
<object class="GtkSpinButton" id="scroll_step_spin"> <object class="GtkSpinButton" id="scroll_step_spin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">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="invisible_char">•</property>
<property name="primary_icon_activatable">False</property> <property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property> <property name="secondary_icon_activatable">False</property>
<property name="adjustment">scroll_step_adjustment</property> <property name="adjustment">scroll_step_adjustment</property>
<property name="digits">2</property>
<property name="numeric">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -837,12 +793,12 @@
<object class="GtkSpinButton" id="fine_scroll_step_spin"> <object class="GtkSpinButton" id="fine_scroll_step_spin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">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="invisible_char">•</property>
<property name="primary_icon_activatable">False</property> <property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property> <property name="secondary_icon_activatable">False</property>
<property name="adjustment">fine_scroll_step_adjustment</property> <property name="adjustment">fine_scroll_step_adjustment</property>
<property name="digits">2</property>
<property name="numeric">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -875,6 +831,7 @@
<object class="GtkFrame" id="frame5"> <object class="GtkFrame" id="frame5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkTable" id="table4"> <object class="GtkTable" id="table4">
@ -889,8 +846,8 @@
<object class="GtkLabel" id="label15"> <object class="GtkLabel" id="label15">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Middle Click Action:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Middle Click Action:</property>
</object> </object>
<packing> <packing>
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
@ -900,8 +857,8 @@
<object class="GtkLabel" id="custom_label"> <object class="GtkLabel" id="custom_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Custom Command:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Custom Command:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
@ -914,10 +871,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<items> <items>
<item translatable="yes" id="mute">Mute/Unmute</item> <item id="mute" translatable="yes">Mute/Unmute</item>
<item translatable="yes" id="prefs">Show Preferences</item> <item id="prefs" translatable="yes">Show Preferences</item>
<item translatable="yes" id="mixer">Volume Control</item> <item id="mixer" translatable="yes">Volume Control</item>
<item translatable="yes" id="custom">Custom (set below)</item> <item id="custom" translatable="yes">Custom (set below)</item>
</items> </items>
<signal name="changed" handler="on_middle_click_combo_changed" swapped="no"/> <signal name="changed" handler="on_middle_click_combo_changed" swapped="no"/>
</object> </object>
@ -984,18 +941,18 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin">5</property>
<child> <child>
<object class="GtkFrame" id="frame8"> <object class="GtkFrame" id="frame8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkBox" id="vbox6"> <object class="GtkBox" id="vbox6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="margin_start">12</property> <property name="margin_start">12</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkCheckButton" id="hotkeys_enable_check"> <object class="GtkCheckButton" id="hotkeys_enable_check">
<property name="label" translatable="yes">Enable HotKeys</property> <property name="label" translatable="yes">Enable HotKeys</property>
@ -1026,8 +983,8 @@
<object class="GtkLabel" id="label20"> <object class="GtkLabel" id="label20">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Command</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Command</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
@ -1037,8 +994,8 @@
<object class="GtkLabel" id="label7"> <object class="GtkLabel" id="label7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Mute/Unmute:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Mute/Unmute:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
@ -1049,8 +1006,8 @@
<object class="GtkLabel" id="label8"> <object class="GtkLabel" id="label8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Volume Up:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Volume Up:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">2</property> <property name="top_attach">2</property>
@ -1061,8 +1018,8 @@
<object class="GtkLabel" id="label18"> <object class="GtkLabel" id="label18">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Volume Down:</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Volume Down:</property>
</object> </object>
<packing> <packing>
<property name="top_attach">3</property> <property name="top_attach">3</property>
@ -1218,8 +1175,8 @@
</object> </object>
</child> </child>
<action-widgets> <action-widgets>
<action-widget response="-5">ok_button</action-widget>
<action-widget response="-6">cancel_button</action-widget> <action-widget response="-6">cancel_button</action-widget>
<action-widget response="-5">ok_button</action-widget>
</action-widgets> </action-widgets>
</object> </object>
</interface> </interface>

View File

@ -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 { pub fn selem(&self) -> Selem {
return get_selems(&self.mixer) return self.mixer.find_selem(&self.selem_id).unwrap();
.nth(self.selem_id.get_index() as usize)
.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> { pub fn get_alsa_card_by_name(name: String) -> Result<Card> {
for r_card in get_alsa_cards() { for r_card in get_alsa_cards() {
let card = r_card?; 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> { pub fn get_selem_by_name(mixer: &Mixer, name: String) -> Result<Selem> {
for selem in get_selems(mixer) { for selem in get_selems(mixer) {
let n = selem.get_id() let n = selem.get_id()

View File

@ -1,8 +1,6 @@
use gtk; use gtk;
use audio::Audio; use audio::Audio;
use std::cell::RefCell;
use std::rc::Rc;
use glade_helpers::*;
// TODO: destructors // TODO: destructors
@ -19,8 +17,12 @@ impl AppS {
let builder_popup_window = let builder_popup_window =
gtk::Builder::new_from_string(include_str!("../data/ui/popup-window.glade")); 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_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 { 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"))) audio: Audio::new(None, Some(String::from("Master")))
.unwrap(), .unwrap(),
}; };
@ -32,31 +34,41 @@ pub struct Gui {
pub status_icon: gtk::StatusIcon, pub status_icon: gtk::StatusIcon,
pub popup_window: PopupWindow, pub popup_window: PopupWindow,
pub popup_menu: PopupMenu, pub popup_menu: PopupMenu,
pub prefs_dialog: PrefsDialog,
} }
impl Gui { impl Gui {
pub fn new(builder_popup_window: gtk::Builder, pub fn new(builder_popup_window: gtk::Builder,
builder_popup_menu: gtk::Builder) builder_popup_menu: gtk::Builder,
builder_prefs_dialog: gtk::Builder)
-> Gui { -> Gui {
return Gui { return Gui {
status_icon: gtk::StatusIcon::new_from_icon_name("pnmixer"), status_icon: gtk::StatusIcon::new_from_icon_name("pnmixer"),
popup_window: PopupWindow::new(builder_popup_window), popup_window: PopupWindow::new(builder_popup_window),
popup_menu: PopupMenu::new(builder_popup_menu), 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, create_builder_item!(PopupWindow,
popup_window: gtk::Window, popup_window: gtk::Window,
vol_scale_adj: gtk::Adjustment, vol_scale_adj: gtk::Adjustment,
vol_scale: gtk::Scale, vol_scale: gtk::Scale,
mute_check: gtk::CheckButton); 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);

View File

@ -1,6 +1,7 @@
use errors::*; use errors::*;
use glib; use glib;
use std::cell::Cell; use std::cell::Cell;
use std::cell::Ref;
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use std::f64; 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 { pub struct Audio {
_cannot_construct: (), _cannot_construct: (),
pub acard: RefCell<Box<AlsaCard>>, pub acard: RefCell<Box<AlsaCard>>,
pub last_action_timestamp: Rc<RefCell<i64>>, pub last_action_timestamp: Rc<RefCell<i64>>,
pub handlers: Rc<RefCell<Vec<Box<Fn(AudioSignal, AudioUser)>>>>, pub handlers: Handlers,
pub scroll_step: Cell<u32>, pub scroll_step: Cell<u32>,
} }
@ -42,16 +66,18 @@ impl Audio {
elem_name: Option<String>) elem_name: Option<String>)
-> Result<Audio> { -> Result<Audio> {
let handlers = Rc::new(RefCell::new(vec![])); let handlers = Handlers::new();
let last_action_timestamp = Rc::new(RefCell::new(0)); let last_action_timestamp = Rc::new(RefCell::new(0));
let myhandler = handlers.clone(); let cb = {
let ts = last_action_timestamp.clone(); let myhandler = handlers.clone();
let cb = Rc::new(move |event| { let ts = last_action_timestamp.clone();
Audio::on_alsa_event(&mut *ts.borrow_mut(), Rc::new(move |event| {
&myhandler.borrow(), on_alsa_event(&mut *ts.borrow_mut(),
event) &myhandler.borrow(),
}); event)
})
};
let audio = Audio { let audio = Audio {
_cannot_construct: (), _cannot_construct: (),
@ -70,12 +96,18 @@ impl Audio {
elem_name: Option<String>) elem_name: Option<String>)
-> Result<()> { -> Result<()> {
debug!("Switching cards"); debug!("Switching cards");
let cb = self.acard.borrow().cb.clone(); debug!("Old card name: {}", self.acard.borrow().card_name().unwrap());
let mut ac = self.acard.borrow_mut(); debug!("Old chan name: {}", self.acard.borrow().chan_name().unwrap());
*ac = AlsaCard::new(card_name, let cb = self.acard
elem_name, .borrow()
cb)?; .cb
.clone();
{
let mut ac = self.acard.borrow_mut();
*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(()); return Ok(());
} }
@ -92,7 +124,11 @@ impl Audio {
} }
// TODO invoke handlers, make use of user // 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); return self.acard.borrow().set_vol(new_vol);
} }
@ -105,7 +141,11 @@ impl Audio {
let old_vol = self.vol()?; let old_vol = self.vol()?;
let new_vol = f64::ceil(old_vol + (self.scroll_step.get() as f64)); 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); return self.set_vol(new_vol, user);
} }
@ -119,7 +159,11 @@ impl Audio {
let old_vol = self.vol()?; let old_vol = self.vol()?;
let new_vol = old_vol - (self.scroll_step.get() as f64); 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); return self.set_vol(new_vol, user);
} }
@ -139,57 +183,65 @@ impl Audio {
let mut rc = self.last_action_timestamp.borrow_mut(); let mut rc = self.last_action_timestamp.borrow_mut();
*rc = glib::get_monotonic_time(); *rc = glib::get_monotonic_time();
// TODO invoke handlers, make use of user // 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); return self.acard.borrow().set_mute(mute);
} }
pub fn connect_handler(&self, cb: Box<Fn(AudioSignal, AudioUser)>) { pub fn connect_handler(&self, cb: Box<Fn(AudioSignal, AudioUser)>) {
self.handlers.borrow_mut().push(cb); self.handlers.add_handler(cb);
}
fn invoke_handlers(handlers: &Vec<Box<Fn(AudioSignal, AudioUser)>>,
signal: AudioSignal,
user: AudioUser) {
debug!("Invoking handlers for signal {:?} by user {:?}",
signal,
user);
for handler in handlers {
let unboxed = handler.as_ref();
unboxed(signal, user);
}
}
fn on_alsa_event(last_action_timestamp: &mut i64,
handlers: &Vec<Box<Fn(AudioSignal, AudioUser)>>,
alsa_event: AlsaEvent) {
let last: i64 = *last_action_timestamp;
if last != 0 {
let now: i64 = glib::get_monotonic_time();
let delay: i64 = now - last;
if delay < 1000000 {
return;
}
debug!("Discarding last time stamp, too old");
*last_action_timestamp = 0;
}
/* external change */
match alsa_event {
// TODO: invoke handlers with AudioUserUnknown
AlsaEvent::AlsaCardError => debug!("AlsaCardError"),
AlsaEvent::AlsaCardDiconnected => debug!("AlsaCardDiconnected"),
AlsaEvent::AlsaCardValuesChanged => {
debug!("AlsaCardValuesChanged");
Audio::invoke_handlers(handlers,
self::AudioSignal::AudioValuesChanged,
self::AudioUser::AudioUserUnknown);
}
e => warn!("Unhandled alsa event: {:?}", e),
}
} }
} }
fn invoke_handlers(handlers: &Vec<Box<Fn(AudioSignal, AudioUser)>>,
signal: AudioSignal,
user: AudioUser) {
debug!("Invoking handlers for signal {:?} by user {:?}",
signal,
user);
for handler in handlers {
let unboxed = handler.as_ref();
unboxed(signal, user);
}
}
fn on_alsa_event(last_action_timestamp: &mut i64,
handlers: &Vec<Box<Fn(AudioSignal, AudioUser)>>,
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;
if delay < 1000000 {
return;
}
debug!("Discarding last time stamp, too old");
*last_action_timestamp = 0;
}
/* external change */
match alsa_event {
// TODO: invoke handlers with AudioUserUnknown
AlsaEvent::AlsaCardError => debug!("AlsaCardError"),
AlsaEvent::AlsaCardDiconnected => debug!("AlsaCardDiconnected"),
AlsaEvent::AlsaCardValuesChanged => {
debug!("AlsaCardValuesChanged");
invoke_handlers(handlers,
self::AudioSignal::AudioValuesChanged,
self::AudioUser::AudioUserUnknown);
}
e => warn!("Unhandled alsa event: {:?}", e),
}
}

View File

@ -36,16 +36,16 @@ macro_rules! try_wr {
}, },
}); });
($expr:expr, $ret:expr, $fmt:expr) => (match $expr { ($expr:expr, $ret:expr, $fmt:expr) => (match $expr {
std::result::Result::Ok(val) => val, ::std::result::Result::Ok(val) => val,
std::result::Result::Err(err) => { ::std::result::Result::Err(err) => {
warn!("Original error: {:?}", err); warn!("Original error: {:?}", err);
warn!($fmt); warn!($fmt);
return $ret; return $ret;
}, },
}); });
($expr:expr, $ret:expr, $fmt:expr, $($arg:tt)+) => (match $expr { ($expr:expr, $ret:expr, $fmt:expr, $($arg:tt)+) => (match $expr {
std::result::Result::Ok(val) => val, ::std::result::Result::Ok(val) => val,
std::result::Result::Err(err) => { ::std::result::Result::Err(err) => {
warn!("Original error: {:?}", err); warn!("Original error: {:?}", err);
warn!(format!($fmt, $(arg)+)); warn!(format!($fmt, $(arg)+));
return $ret; return $ret;
@ -57,8 +57,8 @@ macro_rules! try_wr {
#[macro_export] #[macro_export]
macro_rules! try_r { macro_rules! try_r {
($expr:expr, $ret:expr) => (match $expr { ($expr:expr, $ret:expr) => (match $expr {
std::result::Result::Ok(val) => val, ::std::result::Result::Ok(val) => val,
std::result::Result::Err(err) => { ::std::result::Result::Err(err) => {
return $ret; return $ret;
}, },
}); });
@ -90,16 +90,16 @@ macro_rules! try_er {
}, },
}); });
($expr:expr, $ret:expr, $fmt:expr) => (match $expr { ($expr:expr, $ret:expr, $fmt:expr) => (match $expr {
std::result::Result::Ok(val) => val, ::std::result::Result::Ok(val) => val,
std::result::Result::Err(err) => { ::std::result::Result::Err(err) => {
err!("Original error: {:?}", err); err!("Original error: {:?}", err);
err!($fmt); err!($fmt);
return $ret; return $ret;
}, },
}); });
($expr:expr, $ret:expr, $fmt:expr, $($arg:tt)+) => (match $expr { ($expr:expr, $ret:expr, $fmt:expr, $($arg:tt)+) => (match $expr {
std::result::Result::Ok(val) => val, ::std::result::Result::Ok(val) => val,
std::result::Result::Err(err) => { ::std::result::Result::Err(err) => {
err!("Original error: {:?}", err); err!("Original error: {:?}", err);
err!(format!($fmt, $(arg)+)); err!(format!($fmt, $(arg)+));
return $ret; return $ret;

View File

@ -4,6 +4,7 @@ use std::rc::Rc;
use ui_popup_menu::*; use ui_popup_menu::*;
use ui_popup_window::*; use ui_popup_window::*;
use ui_tray_icon::*; use ui_tray_icon::*;
use ui_prefs_dialog::*;
@ -25,4 +26,5 @@ pub fn init(appstate: Rc<AppS>) {
init_tray_icon(appstate.clone()); init_tray_icon(appstate.clone());
init_popup_window(appstate.clone()); init_popup_window(appstate.clone());
init_popup_menu(appstate.clone()); init_popup_menu(appstate.clone());
init_prefs_dialog(appstate.clone());
} }

View File

@ -21,6 +21,18 @@ pub fn init_popup_menu(appstate: Rc<AppS>) {
on_about_item_activate(&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; 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
View 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));
}
}