This commit is contained in:
Julian Ospald 2017-07-05 00:22:23 +02:00
parent 8907a2005c
commit aa60ab2c9c
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
3 changed files with 103 additions and 29 deletions

View File

@ -547,18 +547,6 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="column_homogeneous">True</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="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="vol_pos_label">
<property name="visible">True</property>
@ -568,7 +556,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
@ -584,21 +572,6 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</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 id="vertical" translatable="yes">Vertical</item>
<item id="horizontal" translatable="yes">Horizontal</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
@ -616,7 +589,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>

View File

@ -38,6 +38,7 @@ mod ui_popup_menu;
mod ui_popup_window;
mod ui_prefs_dialog;
mod ui_tray_icon;
mod prefs;
mod support_ui;
mod support_alsa;

100
src/prefs.rs Normal file
View File

@ -0,0 +1,100 @@
use errors::*;
use std::path::Path;
use glib;
use glib::KeyFile;
const DEFAULT_PREFS: &str = "[PNMixer]\n
AlsaCard=(default)\n
AlsaChannel=Master\n
DrawVolMeter=True\n
VolMeterOffset=10\n
VolMeterColor=245;121;0;\n
SystemTheme=true\n
VolControlCommand=xfce4-mixer\n
VolControlStep=5\n
MiddleClickAction=0\n
CustomCommand=\n
EnableNotifications=true\n
NotificationTimeout=1500\n
MouseNotifications=true\n
PopupNotifcations=true\n
ExternalNotifications=true\n";
const VOL_CONTROL_COMMANDS: [&str; 3] = [
"gnome-alsamixer",
"xfce4-mixer",
"alsamixergui"
];
pub enum MiddleClickAction {
ToggleMute,
ShowPreferences,
VolumeControl,
CustomCommand(String),
}
struct Prefs {
key_file: glib::KeyFile,
/* device prefs */
pub card: String,
pub channel: String,
// TODO: normalize volume?
/* view prefs */
pub draw_vol_meter: bool,
pub vol_meter_offset: i64,
pub vol_meter_color: (u8, u8, u8),
pub system_theme: bool,
// TODO: Display text folume/text volume pos?
/* behavior */
pub vol_control_cmd: String,
pub vol_scroll_step: f64,
pub middle_click_action: MiddleClickAction,
// TODO: fine scroll step?
// TODO: HotKeys?
/* notifications */
pub enable_notifications: bool,
pub notifcation_timeout: i64,
pub notify_mouse_scroll: bool,
pub notify_popup: bool,
pub notify_external: bool,
// TODO: notify_hotkeys?
}
impl Prefs {
pub fn new() -> Prefs {
// load from config
}
pub fn reload_from_config(&self) {
}
pub fn save_to_config() -> Result<()> {
}
fn config_path() -> String {
}
fn ensure_config_path() {
}
}