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

alsa_card

Alsa audio subsystem.

app_state

Global application state.

audio

High-level audio subsystem.

errors
gdk_x11

Glue code between gdk and x11, allowing some gdk_x11_* functions.

glade_helpers
hotkey

The hotkey subsystem.

hotkeys

The hotkeys subsystem.

notif

The notification subsystem.

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_hotkey_dialog

The ui hotkey preferences dialog.

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
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.