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 gtk;
pub extern crate libnotify;

Modules

app_state

Global application state.

ui_entry

Global GUI state.

Macros

create_builder_item
error_dialog

Present a gtk error dialog with given message. Provides only a close button.

just_warn

Warns on err and yields () without returning the function.

pixbuf_new_from_png

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

push_warning

If there is an error in the expression, push it to the given mutable warning vector.

result_warn

Present a gtk error dialog with the error from the Result type, if any. Provides only a close button.

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.

unwrap_any

Unwraps a Result<T, E> by yielding a value of the samet ype for either case.

unwrap_error

If there is a value in the Result type, unwrap it, otherwise error-log the error, show it via gtk dialog and exit the whole program.

wresult_warn

Convert WResult to Result. All warnings are printed via the log crate and are shown via Gtk dialogs.