Crate pnmixerlib [] [src]

PNMixer-rs is a mixer for the system tray.

Design Overview

The lowest level part of the code is the sound backend. Only Alsa is supported at the moment, but more backends may be added in the future.

The backend is hidden behind a frontend, defined in audio.rs. Only audio.rs deals with audio backends. This means that the whole of the code is blissfully ignorant of the audio backend in use.

audio.rs is also in charge of emitting signals whenever a change happens. This means that PNMixer-rs design is quite signal-oriented, so to say.

The ui code is nothing fancy. Each ui element...

There's something you should keep in mind. Audio on a computer is a shared resource. PNMixer-rs isn't the only one that can change it. At any moment the audio volume may be modified by someone else, and we must update the ui accordingly. So listening to changes from the audio subsystem (and therefore having a signal-oriented design) is the most obvious solution to solve that problem.

Reexports

pub extern crate flexi_logger;
pub extern crate log;
pub extern crate error_chain;
pub extern crate serde_derive;
pub extern crate toml;
pub extern crate serde;
pub extern crate alsa;
pub extern crate alsa_sys;
pub extern crate ffi;
pub extern crate gdk;
pub extern crate gdk_pixbuf;
pub extern crate gdk_pixbuf_sys;
pub extern crate gdk_sys;
pub extern crate gio;
pub extern crate glib;
pub extern crate glib_sys;
pub extern crate gobject_sys;
pub extern crate gtk;
pub extern crate gtk_sys;
pub extern crate libc;
pub extern crate png;
pub extern crate which;
pub extern crate xdg;

Modules

alsa_card

Alsa audio subsystem.

app_state

Global application state.

audio

High-level audio subsystem.

errors
glade_helpers
prefs

The preferences subsystem.

support_alsa

Alsa audio helper functions.

support_audio

Helper functions of the audio subsystem.

support_cmd

Helper functions for invoking system commands.

support_ui

Helper functions for the UI, mostly pixbuf functions.

ui_entry

Global GUI state.

ui_popup_menu

The popup menu subsystem when the user right-clicks on the tray icon.

ui_popup_window

The popup window subsystem when the user left-clicks on the tray icon.

ui_prefs_dialog

The preferences window subsystem, when the user clicks the "Preferences" menu item on the popup menu.

ui_tray_icon

The tray icon subsystem.

Macros

create_builder_item
pixbuf_new_from_png

Create a pixbuf from the given PNG file. Includes the file as bytes in the binary and decodes it.

try_e

Try to unwrap a Result<T, E>. If there is a value T, yield it, otherwise print an error and exit the program.

try_r

Try to unwrap a Result<T, E>. If there is a value T, yield it, otherwise return from the function with the given value.

try_w

Try to unwrap a Result<T, E>. If there is a value T, yield it, otherwise print a warning and return () from the function.

try_wr

Try to unwrap a Result<T, E>. If there is a value T, yield it, otherwise print a warning and return from the function with the given value.