pnmixer
Volume mixer for the system tray
Data Structures | Macros | Functions
ui-prefs-dialog.c File Reference

Preferences dialog ui subsystem. More...

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include "audio.h"
#include "prefs.h"
#include "hotkey.h"
#include "hotkeys.h"
#include "support-log.h"
#include "support-intl.h"
#include "support-ui.h"
#include "ui-prefs-dialog.h"
#include "ui-hotkey-dialog.h"
#include "main.h"
Include dependency graph for ui-prefs-dialog.c:

Go to the source code of this file.

Data Structures

struct  prefs_dialog
 

Macros

#define PREFS_UI_FILE   "prefs-dialog-gtk2.glade"
 

Functions

static void get_keycode_for_label (GtkLabel *label, gint *code, GdkModifierType *mods)
 
static void set_label_for_keycode (GtkLabel *label, gint code, GdkModifierType mods)
 
static void fill_chan_combo (GtkComboBoxText *combo, const gchar *card_name)
 
static void fill_card_combo (GtkComboBoxText *combo, Audio *audio)
 
void on_vol_text_check_toggled (GtkToggleButton *button, PrefsDialog *dialog)
 
void on_vol_meter_draw_check_toggled (GtkToggleButton *button, PrefsDialog *dialog)
 
void on_card_combo_changed (GtkComboBoxText *box, PrefsDialog *dialog)
 
void on_middle_click_combo_changed (GtkComboBoxText *box, PrefsDialog *dialog)
 
void on_hotkeys_enable_check_toggled (GtkToggleButton *button, PrefsDialog *dialog)
 
gboolean on_hotkey_event_box_button_press_event (GtkWidget *widget, GdkEventButton *event, PrefsDialog *dialog)
 
void on_noti_enable_check_toggled (G_GNUC_UNUSED GtkToggleButton *button, G_GNUC_UNUSED PrefsDialog *dialog)
 
static void on_prefs_dialog_response (G_GNUC_UNUSED GtkDialog *widget, gint response_id, PrefsDialog *dialog)
 
static void on_audio_changed (Audio *audio, AudioEvent *event, gpointer data)
 
void prefs_dialog_retrieve (PrefsDialog *dialog)
 
void prefs_dialog_populate (PrefsDialog *dialog)
 
void prefs_dialog_present (PrefsDialog *dialog)
 
void prefs_dialog_destroy (PrefsDialog *dialog)
 
PrefsDialogprefs_dialog_create (GtkWindow *parent, Audio *audio, Hotkeys *hotkeys, PrefsDialogResponseCallback cb)
 

Detailed Description

Preferences dialog ui subsystem.

This file holds the ui-related code for the preferences window.

Definition in file ui-prefs-dialog.c.

Macro Definition Documentation

◆ PREFS_UI_FILE

#define PREFS_UI_FILE   "prefs-dialog-gtk2.glade"

Definition at line 46 of file ui-prefs-dialog.c.

Function Documentation

◆ fill_card_combo()

static void fill_card_combo ( GtkComboBoxText *  combo,
Audio audio 
)
static

Fills the GtkComboBoxText 'card_combo' with the currently available cards. The active card in the combo box is set to the currently ACTIVE card, which may be different from the SELECTED card found in preferences.

Parameters
combothe GtkComboBoxText widget for the cards.
audioan Audio instance.

Definition at line 129 of file ui-prefs-dialog.c.

◆ fill_chan_combo()

static void fill_chan_combo ( GtkComboBoxText *  combo,
const gchar *  card_name 
)
static

Fills the GtkComboBoxText 'chan_combo' with the currently available channels for a given card. The active channel in the combo box is set to the SELECTED channel found in preferences for this card.

Parameters
combothe GtkComboBoxText widget for the channels.
card_namethe card to use to get the channels list.

Definition at line 89 of file ui-prefs-dialog.c.

◆ get_keycode_for_label()

static void get_keycode_for_label ( GtkLabel *  label,
gint *  code,
GdkModifierType *  mods 
)
static

Definition at line 55 of file ui-prefs-dialog.c.

◆ on_audio_changed()

static void on_audio_changed ( Audio audio,
AudioEvent event,
gpointer  data 
)
static

Handle signals from the audio subsystem.

Parameters
audiothe Audio instance that emitted the signal.
eventthe AudioEvent containing useful information.
datauser supplied data.

Definition at line 433 of file ui-prefs-dialog.c.

◆ on_card_combo_changed()

void on_card_combo_changed ( GtkComboBoxText *  box,
PrefsDialog dialog 
)

Handles the 'changed' signal on the GtkComboBoxText 'card_combo'. This basically refills the channel list if the card changes.

Parameters
boxthe box which received the signal.
dialoguser data set when the signal handler was connected.

Definition at line 269 of file ui-prefs-dialog.c.

◆ on_hotkey_event_box_button_press_event()

gboolean on_hotkey_event_box_button_press_event ( GtkWidget *  widget,
GdkEventButton *  event,
PrefsDialog dialog 
)

Handles 'button-press-event' signal on one of the GtkEventBoxes used to define a hotkey: 'hotkeys_mute/up/down_eventbox'. Runs a dialog dialog where user can define a new hotkey. User should double-click on the event box to define a new hotkey.

Parameters
widgetthe object which received the signal.
eventthe GdkEventButton which triggered this signal.
dialoguser data set when the signal handler was connected.
Returns
TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.

Definition at line 320 of file ui-prefs-dialog.c.

◆ on_hotkeys_enable_check_toggled()

void on_hotkeys_enable_check_toggled ( GtkToggleButton *  button,
PrefsDialog dialog 
)

Handles the 'toggled' signal on the GtkCheckButton 'hotkeys_enable_check'. Updates the preferences dialog.

Parameters
buttonthe button which received the signal.
dialoguser data set when the signal handler was connected.

Definition at line 301 of file ui-prefs-dialog.c.

◆ on_middle_click_combo_changed()

void on_middle_click_combo_changed ( GtkComboBoxText *  box,
PrefsDialog dialog 
)

Handles the 'changed' signal on the GtkComboBoxText 'middle_click_combo'. Updates the preferences dialog.

Parameters
boxthe combobox which received the signal.
dialoguser data set when the signal handler was connected.

Definition at line 286 of file ui-prefs-dialog.c.

◆ on_noti_enable_check_toggled()

void on_noti_enable_check_toggled ( G_GNUC_UNUSED GtkToggleButton *  button,
G_GNUC_UNUSED PrefsDialog dialog 
)

Handles the 'toggled' signal on the GtkCheckButton 'noti_enable_check'. Updates the preferences dialog.

Parameters
buttonthe button which received the signal.
dialoguser data set when the signal handler was connected.

Definition at line 404 of file ui-prefs-dialog.c.

◆ on_prefs_dialog_response()

static void on_prefs_dialog_response ( G_GNUC_UNUSED GtkDialog *  widget,
gint  response_id,
PrefsDialog dialog 
)
static

Handles the 'response' signal from the GtkDialog. Just invoke the user callback.

Parameters
widgetthe GtkDialog which emitted the signal
response_idthe id of the response
dialoguser data set when the signal handler was connected.

Definition at line 419 of file ui-prefs-dialog.c.

◆ on_vol_meter_draw_check_toggled()

void on_vol_meter_draw_check_toggled ( GtkToggleButton *  button,
PrefsDialog dialog 
)

Handles the 'toggled' signal on the GtkCheckButton 'vol_meter_draw_check'. Updates the preferences dialog.

Parameters
buttonthe button which received the signal.
dialoguser data set when the signal handler was connected.

Definition at line 252 of file ui-prefs-dialog.c.

◆ on_vol_text_check_toggled()

void on_vol_text_check_toggled ( GtkToggleButton *  button,
PrefsDialog dialog 
)

Handles the 'toggled' signal on the GtkCheckButton 'vol_text_check'. Updates the preferences dialog.

Parameters
buttonthe button which received the signal.
dialoguser data set when the signal handler was connected.

Definition at line 237 of file ui-prefs-dialog.c.

◆ prefs_dialog_create()

PrefsDialog* prefs_dialog_create ( GtkWindow *  parent,
Audio audio,
Hotkeys hotkeys,
PrefsDialogResponseCallback  cb 
)

Creates the preferences dialog.

Parameters
parenta GtkWindow to be used as the parent.
audiopointer to this audio subsystem.
hotkeyspointer to this hotkey subsystem.
cbuser callback to handle responses from the dialog
Returns
the newly created PrefsDialog instance.

Definition at line 840 of file ui-prefs-dialog.c.

◆ prefs_dialog_destroy()

void prefs_dialog_destroy ( PrefsDialog dialog)

Destroys the preferences dialog, freeing any resources.

Parameters
dialoga PrefsDialog instance.

Definition at line 814 of file ui-prefs-dialog.c.

◆ prefs_dialog_populate()

void prefs_dialog_populate ( PrefsDialog dialog)

Set the preferences dialog values according to current preferences.

Parameters
dialogstruct holding the GtkWidgets of the preferences dialog.

Definition at line 617 of file ui-prefs-dialog.c.

◆ prefs_dialog_present()

void prefs_dialog_present ( PrefsDialog dialog)

Presents the preferences dialog.

Parameters
dialoga PrefsDialog instance.

Definition at line 800 of file ui-prefs-dialog.c.

◆ prefs_dialog_retrieve()

void prefs_dialog_retrieve ( PrefsDialog dialog)

Retrieve the preferences dialog values and assign then to preferences.

Parameters
dialogstruct holding the GtkWidgets of the preferences dialog.

Definition at line 456 of file ui-prefs-dialog.c.

◆ set_label_for_keycode()

static void set_label_for_keycode ( GtkLabel *  label,
gint  code,
GdkModifierType  mods 
)
static

Definition at line 67 of file ui-prefs-dialog.c.