This commit is contained in:
Julian Ospald 2017-07-03 09:21:51 +02:00
parent cc0530471f
commit 0c881e0c8b
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
6 changed files with 95 additions and 47 deletions

View File

@ -8,6 +8,7 @@ alsa = "^0.1.8"
alsa-sys = "^0.1.1"
libc = "^0.2.23"
gdk-sys = { git = "https://github.com/gtk-rs/sys" }
gdk-pixbuf = { git = "https://github.com/gtk-rs/gdk-pixbuf.git" }
gtk-sys = { git = "https://github.com/gtk-rs/sys" }
glib = { git = "https://github.com/gtk-rs/glib.git" }
glib-sys = { git = "https://github.com/gtk-rs/sys" }

View File

@ -543,41 +543,6 @@
<property name="position">1</property>
</packing>
</child>
<child>
<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">
<property name="label" translatable="yes">Use System Theme</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="margin_start">12</property>
<property name="draw_indicator">True</property>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">&lt;b&gt;Icon Theme&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="tab">

View File

@ -96,8 +96,16 @@ impl Audio {
elem_name: Option<String>)
-> Result<()> {
debug!("Switching cards");
debug!("Old card name: {}", self.acard.borrow().card_name().unwrap());
debug!("Old chan name: {}", self.acard.borrow().chan_name().unwrap());
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
@ -106,8 +114,16 @@ impl Audio {
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());
debug!("Old card name: {}",
self.acard
.borrow()
.card_name()
.unwrap());
debug!("Old chan name: {}",
self.acard
.borrow()
.chan_name()
.unwrap());
return Ok(());
}
@ -125,8 +141,14 @@ impl Audio {
// TODO invoke handlers, make use of user
debug!("Setting vol on card {:?} and chan {:?} to {:?} by user {:?}",
self.acard.borrow().card_name().unwrap(),
self.acard.borrow().chan_name().unwrap(),
self.acard
.borrow()
.card_name()
.unwrap(),
self.acard
.borrow()
.chan_name()
.unwrap(),
new_vol,
user);
return self.acard.borrow().set_vol(new_vol);
@ -142,8 +164,14 @@ impl Audio {
let new_vol = f64::ceil(old_vol + (self.scroll_step.get() as f64));
debug!("Increase vol on card {:?} and chan {:?} by {:?} to {:?}",
self.acard.borrow().card_name().unwrap(),
self.acard.borrow().chan_name().unwrap(),
self.acard
.borrow()
.card_name()
.unwrap(),
self.acard
.borrow()
.chan_name()
.unwrap(),
(new_vol - old_vol),
new_vol);
@ -160,8 +188,14 @@ impl Audio {
let new_vol = old_vol - (self.scroll_step.get() as f64);
debug!("Decrease vol on card {:?} and chan {:?} by {:?} to {:?}",
self.acard.borrow().card_name().unwrap(),
self.acard.borrow().chan_name().unwrap(),
self.acard
.borrow()
.card_name()
.unwrap(),
self.acard
.borrow()
.chan_name()
.unwrap(),
(new_vol - old_vol),
new_vol);
@ -186,8 +220,14 @@ impl Audio {
debug!("Setting mute to {} on card {:?} and chan {:?} by user {:?}",
mute,
self.acard.borrow().card_name().unwrap(),
self.acard.borrow().chan_name().unwrap(),
self.acard
.borrow()
.card_name()
.unwrap(),
self.acard
.borrow()
.chan_name()
.unwrap(),
user);
return self.acard.borrow().set_mute(mute);

View File

@ -12,6 +12,7 @@ extern crate alsa;
extern crate alsa_sys;
extern crate ffi;
extern crate gdk;
extern crate gdk_pixbuf;
extern crate gdk_sys;
extern crate glib;
extern crate glib_sys;
@ -34,6 +35,7 @@ mod audio;
mod ui_entry;
mod ui_popup_menu;
mod ui_popup_window;
mod ui_prefs_dialog;
mod ui_tray_icon;
use app_state::*;
@ -50,6 +52,7 @@ fn main() {
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
let apps = Rc::new(AppS::new());
// let _ = apps.audio.switch_acard(None, None).unwrap();
ui_entry::init(apps);

View File

@ -36,6 +36,8 @@ pub fn init_prefs_dialog(appstate: &Rc<AppS>, prefs_dialog: &Rc<PrefsDialog>) {
prefs_dialog.clone().prefs_dialog.connect_show(move |_| { on_prefs_dialog_show(&apps, &pd); });
}
/* DEVICE TAB */
/* card_combo.connect_changed */
{
let apps = appstate.clone();

View File

@ -1,5 +1,6 @@
use app_state::*;
use gdk;
use gdk_pixbuf;
use gdk_sys;
use glib;
use glib_sys;
@ -13,6 +14,42 @@ use errors::*;
// struct VolMeter {
// pub red: u8,
// pub green: u8,
// pub blue: u8,
// pub x_offset_pct: i64,
// pub y_offset_pct: i64,
// /* dynamic */
// pub pixbuf: gdk_pixbuf::Pixbuf,
// pub width: i64,
// pub row: u8,
// }
// impl VolMeter {
// pub fn new() -> VolMeter {
// let pixbux = Pixbuf::new();
// return VolMeter {
// red: 255,
// green: 255,
// blue: 255,
// x_offset_pct: 0,
// y_offset_pct: 0,
// pixbuf: ,
// width: ,
// row: ,
// }
// }
// }
fn pixbuf_new_from_stock(icon_name: String, size: u32) {
}
pub fn init_tray_icon(appstate: Rc<AppS>) {
/* tray_icon.connect_activate */
{