pnmixer
Volume mixer for the system tray
|
Popup window subsystem. More...
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include "audio.h"
#include "prefs.h"
#include "support-intl.h"
#include "support-log.h"
#include "support-ui.h"
#include "ui-popup-window.h"
#include "main.h"
Go to the source code of this file.
Data Structures | |
struct | popup_window |
Macros | |
#define | POPUP_WINDOW_HORIZONTAL_UI_FILE "popup-window-horizontal-gtk2.glade" |
#define | POPUP_WINDOW_VERTICAL_UI_FILE "popup-window-vertical-gtk2.glade" |
Functions | |
static void | configure_vol_text (GtkScale *vol_scale) |
static void | configure_vol_increment (GtkAdjustment *vol_scale_adj) |
static void | update_mute_check (GtkToggleButton *mute_check, GCallback handler_func, gpointer handler_data, gboolean has_mute, gboolean muted) |
static void | update_volume_slider (GtkAdjustment *vol_scale_adj, gdouble volume) |
static void | grab_devices (GtkWidget *window) |
gboolean | on_popup_window_event (G_GNUC_UNUSED GtkWidget *widget, GdkEvent *event, PopupWindow *window) |
void | on_vol_scale_value_changed (GtkRange *range, PopupWindow *window) |
void | on_mute_check_toggled (G_GNUC_UNUSED GtkToggleButton *button, PopupWindow *window) |
void | on_mixer_button_clicked (G_GNUC_UNUSED GtkButton *button, PopupWindow *window) |
static void | on_audio_changed (G_GNUC_UNUSED Audio *audio, AudioEvent *event, gpointer data) |
void | popup_window_show (PopupWindow *window) |
void | popup_window_hide (PopupWindow *window) |
void | popup_window_toggle (PopupWindow *window) |
static void | popup_window_cleanup (PopupWindow *window) |
static void | popup_window_init (PopupWindow *window, Audio *audio) |
void | popup_window_reload (PopupWindow *window) |
void | popup_window_destroy (PopupWindow *window) |
PopupWindow * | popup_window_create (Audio *audio) |
Popup window subsystem.
This file holds the ui-related code for the popup window.
There are two ways to handle the slider value.
I tried both ways. The second one is a real pain in the ass. A few unexpected problems arise, it makes things complex, and ends up with dirty workarounds. So, trust me, don't try it.
The first way is much simpler, works great.
So, here's the current behavior for the slider. When you open it, it queries the audio system, and display the real volume value. Then, when you change the volume, it displays the volume as you ask it to be, not as it is. So if volume is 60, and you move it to 61, then 61 is displayed. But the truth may be that the volume is still 60, because your hardware doesn't have such fine capabilities, and the next real step will be 65.
Definition in file ui-popup-window.c.
#define POPUP_WINDOW_HORIZONTAL_UI_FILE "popup-window-horizontal-gtk2.glade" |
Definition at line 65 of file ui-popup-window.c.
#define POPUP_WINDOW_VERTICAL_UI_FILE "popup-window-vertical-gtk2.glade" |
Definition at line 66 of file ui-popup-window.c.
|
static |
Definition at line 102 of file ui-popup-window.c.
|
static |
Definition at line 75 of file ui-popup-window.c.
|
static |
Definition at line 214 of file ui-popup-window.c.
|
static |
Handle signals from the audio subsystem.
audio | the Audio instance that emitted the signal. |
event | the AudioEvent containing useful information. |
data | user supplied data. |
Definition at line 346 of file ui-popup-window.c.
void on_mixer_button_clicked | ( | G_GNUC_UNUSED GtkButton * | button, |
PopupWindow * | window | ||
) |
Handles the 'clicked' signal on the GtkButton 'mixer_button', therefore opening the mixer application.
button | the GtkButton that received the signal. |
window | user data set when the signal handler was connected. |
Definition at line 332 of file ui-popup-window.c.
void on_mute_check_toggled | ( | G_GNUC_UNUSED GtkToggleButton * | button, |
PopupWindow * | window | ||
) |
Handles the 'toggled' signal on the GtkToggleButton 'mute_check', changing the mute status accordingly.
button | the GtkToggleButton that received the signal. |
window | user data set when the signal handler was connected. |
Definition at line 319 of file ui-popup-window.c.
gboolean on_popup_window_event | ( | G_GNUC_UNUSED GtkWidget * | widget, |
GdkEvent * | event, | ||
PopupWindow * | window | ||
) |
Handles 'button-press-event', 'key-press-event' and 'grab-broken-event' signals, on the GtkWindow. Used to hide the volume popup window.
widget | the object which received the signal. |
event | the GdkEvent which triggered this signal. |
window | user data set when the signal handler was connected. |
Definition at line 247 of file ui-popup-window.c.
void on_vol_scale_value_changed | ( | GtkRange * | range, |
PopupWindow * | window | ||
) |
Handles the 'value-changed' signal on the GtkRange 'vol_scale', changing the voume accordingly.
There are many ways for the user to change the slider value. Think about testing them all if you touch this function. Here's a list of actions you can do to trigger this callback:
range | the GtkRange that received the signal. |
window | user data set when the signal handler was connected. |
Definition at line 303 of file ui-popup-window.c.
|
static |
Definition at line 433 of file ui-popup-window.c.
PopupWindow* popup_window_create | ( | Audio * | audio | ) |
Creates the popup window and connects all the signals.
audio | pointer to this audio subsystem. |
Definition at line 527 of file ui-popup-window.c.
void popup_window_destroy | ( | PopupWindow * | window | ) |
Destroys the popup window, freeing any resources.
window | a PopupWindow instance. |
Definition at line 514 of file ui-popup-window.c.
void popup_window_hide | ( | PopupWindow * | window | ) |
Hides the popup window.
window | a PopupWindow instance. |
Definition at line 408 of file ui-popup-window.c.
|
static |
Definition at line 451 of file ui-popup-window.c.
void popup_window_reload | ( | PopupWindow * | window | ) |
Update the popup window according to the current preferences. This has to be called each time the preferences are modified.
window | a PopupWindow instance. |
Definition at line 497 of file ui-popup-window.c.
void popup_window_show | ( | PopupWindow * | window | ) |
Shows the popup window, and grab the focus.
window | a PopupWindow instance. |
Definition at line 379 of file ui-popup-window.c.
void popup_window_toggle | ( | PopupWindow * | window | ) |
Toggle the popup window (aka hide or show).
window | a PopupWindow instance. |
Definition at line 419 of file ui-popup-window.c.
|
static |
Definition at line 116 of file ui-popup-window.c.
|
static |
Definition at line 141 of file ui-popup-window.c.