28 #include <gdk/gdkkeysyms.h> 44 #define PREFS_UI_FILE "prefs-dialog-gtk3.glade" 46 #define PREFS_UI_FILE "prefs-dialog-gtk2.glade" 57 const gchar *key_accel;
59 key_accel = gtk_label_get_text(label);
75 gtk_label_set_text(label, key_accel);
92 gchar *selected_channel;
93 GSList *channel_list, *item;
95 DEBUG(
"Filling channels ComboBox for card '%s'", card_name);
104 for (sidx = idx = 0, item = channel_list; item; idx++, item = item->next) {
105 const char *channel_name = item->data;
106 gtk_combo_box_text_append_text(combo, channel_name);
108 if (!g_strcmp0(channel_name, selected_channel))
113 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), sidx);
116 g_slist_free_full(channel_list, g_free);
117 g_free(selected_channel);
132 const gchar *active_card;
133 GSList *card_list, *item;
135 DEBUG(
"Filling cards ComboBox");
144 for (sidx = idx = 0, item = card_list; item; idx++, item = item->next) {
145 const char *card_name = item->data;
146 gtk_combo_box_text_append_text(combo, card_name);
148 if (!g_strcmp0(card_name, active_card))
153 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), sidx);
156 g_slist_free_full(card_list, g_free);
215 #ifdef WITH_LIBNOTIFY 216 GtkWidget *noti_vbox_enabled;
217 GtkWidget *noti_enable_check;
218 GtkWidget *noti_timeout_label;
219 GtkWidget *noti_timeout_spin;
220 GtkWidget *noti_hotkey_check;
221 GtkWidget *noti_mouse_check;
222 GtkWidget *noti_popup_check;
223 GtkWidget *noti_ext_check;
239 gboolean active = gtk_toggle_button_get_active(button);
254 gboolean active = gtk_toggle_button_get_active(button);
273 card_name = gtk_combo_box_text_get_active_text(box);
288 gboolean cust = gtk_combo_box_get_active(GTK_COMBO_BOX(box)) == 3;
303 gboolean active = gtk_toggle_button_get_active(button);
324 GtkLabel *hotkey_label;
328 if (event->button != 1)
332 if (event->type != GDK_2BUTTON_PRESS)
367 if (key_pressed == NULL)
371 if (!g_ascii_strcasecmp(key_pressed,
"<Primary>c")) {
373 key_pressed = g_strdup_printf(
"(%s)",
_(
"None"));
377 gtk_label_set_text(hotkey_label, key_pressed);
390 #ifdef WITH_LIBNOTIFY 394 gboolean active = gtk_toggle_button_get_active(button);
395 gtk_widget_set_sensitive(dialog->noti_timeout_label, active);
396 gtk_widget_set_sensitive(dialog->noti_timeout_spin, active);
397 gtk_widget_set_sensitive(dialog->noti_hotkey_check, active);
398 gtk_widget_set_sensitive(dialog->noti_mouse_check, active);
399 gtk_widget_set_sensitive(dialog->noti_popup_check, active);
400 gtk_widget_set_sensitive(dialog->noti_ext_check, active);
436 GtkComboBoxText *card_combo = GTK_COMBO_BOX_TEXT(dialog->
card_combo);
437 GtkComboBoxText *chan_combo = GTK_COMBO_BOX_TEXT(dialog->
chan_combo);
458 DEBUG(
"Retrieving prefs dialog values");
462 const gchar *orientation;
464 orientation = gtk_combo_box_get_active_id(GTK_COMBO_BOX(soc));
467 orientation =
"vertical";
468 if (gtk_combo_box_get_active(GTK_COMBO_BOX(soc)) == 1)
469 orientation =
"horizontal";
475 gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vtc));
480 gint idx = gtk_combo_box_get_active(GTK_COMBO_BOX(vpc));
485 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dvc));
490 gint vmpos = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(vmps));
498 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(vcb), &color);
499 colors[0] = color.red;
500 colors[1] = color.green;
501 colors[2] = color.blue;
504 gtk_color_button_get_color(GTK_COLOR_BUTTON(vcb), &color);
505 colors[0] = (gdouble) color.red / 65536;
506 colors[1] = (gdouble) color.green / 65536;
507 colors[2] = (gdouble) color.blue / 65536;
513 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(system_theme));
518 gchar *card = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(acc));
523 gchar *chan = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(ccc));
531 is_pressed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vnorm));
536 const gchar *vc = gtk_entry_get_text(GTK_ENTRY(ve));
541 gdouble step = gtk_spin_button_get_value(GTK_SPIN_BUTTON(sss));
545 gdouble fine_step = gtk_spin_button_get_value(GTK_SPIN_BUTTON(fsss));
550 idx = gtk_combo_box_get_active(GTK_COMBO_BOX(mcc));
555 const gchar *cc = gtk_entry_get_text(GTK_ENTRY(ce));
560 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hkc));
566 GdkModifierType mods;
584 #ifdef WITH_LIBNOTIFY 585 GtkWidget *nc = dialog->noti_enable_check;
587 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(nc));
590 nc = dialog->noti_hotkey_check;
591 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(nc));
594 nc = dialog->noti_mouse_check;
595 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(nc));
598 nc = dialog->noti_popup_check;
599 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(nc));
602 nc = dialog->noti_ext_check;
603 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(nc));
606 nc = dialog->noti_timeout_spin;
607 noti_spin = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(nc));
619 gdouble *vol_meter_clrs;
620 gchar *slider_orientation, *vol_cmd, *custcmd;
622 DEBUG(
"Populating prefs dialog values");
626 if (slider_orientation) {
627 GtkComboBox *combo_box =
631 if (!strcmp(slider_orientation,
"horizontal"))
632 gtk_combo_box_set_active(combo_box, 1);
634 gtk_combo_box_set_active(combo_box, 0);
636 gtk_combo_box_set_active_id(combo_box, slider_orientation);
638 g_free(slider_orientation);
642 gtk_toggle_button_set_active
650 gtk_combo_box_set_active
655 gtk_toggle_button_set_active
663 gtk_spin_button_set_value
670 GdkRGBA vol_meter_color_button_color;
671 vol_meter_color_button_color.red = vol_meter_clrs[0];
672 vol_meter_color_button_color.green = vol_meter_clrs[1];
673 vol_meter_color_button_color.blue = vol_meter_clrs[2];
674 vol_meter_color_button_color.alpha = 1.0;
675 gtk_color_chooser_set_rgba
677 &vol_meter_color_button_color);
679 GdkColor vol_meter_color_button_color;
680 vol_meter_color_button_color.red = (guint32) (vol_meter_clrs[0] * 65536);
681 vol_meter_color_button_color.green = (guint32) (vol_meter_clrs[1] * 65536);
682 vol_meter_color_button_color.blue = (guint32) (vol_meter_clrs[2] * 65536);
683 gtk_color_button_set_color
685 &vol_meter_color_button_color);
687 g_free(vol_meter_clrs);
690 gtk_toggle_button_set_active
705 gtk_toggle_button_set_active
717 gtk_spin_button_set_value
721 gtk_spin_button_set_value
726 gtk_combo_box_set_active
734 gtk_entry_set_invisible_char(GTK_ENTRY(dialog->
custom_entry), 8226);
738 gtk_entry_set_text(GTK_ENTRY(dialog->
custom_entry), custcmd);
743 gtk_toggle_button_set_active
764 #ifdef WITH_LIBNOTIFY 765 gtk_toggle_button_set_active
766 (GTK_TOGGLE_BUTTON(dialog->noti_enable_check),
769 gtk_toggle_button_set_active
770 (GTK_TOGGLE_BUTTON(dialog->noti_hotkey_check),
773 gtk_toggle_button_set_active
774 (GTK_TOGGLE_BUTTON(dialog->noti_mouse_check),
777 gtk_toggle_button_set_active
778 (GTK_TOGGLE_BUTTON(dialog->noti_popup_check),
781 gtk_toggle_button_set_active
782 (GTK_TOGGLE_BUTTON(dialog->noti_ext_check),
785 gtk_spin_button_set_value
786 (GTK_SPIN_BUTTON(dialog->noti_timeout_spin),
790 (GTK_TOGGLE_BUTTON(dialog->noti_enable_check), dialog);
802 GtkWindow *prefs_window = GTK_WINDOW(dialog->
prefs_dialog);
805 gtk_window_present(prefs_window);
818 g_signal_handler_disconnect(GTK_WINDOW(dialog->
prefs_dialog),
843 gchar *uifile = NULL;
844 GtkBuilder *builder = NULL;
853 DEBUG(
"Building from ui file '%s'", uifile);
860 gtk_notebook_append_page
861 (GTK_NOTEBOOK(gtk_builder_get_object(builder,
"notebook")),
862 #ifdef WITH_LIBNOTIFY
863 GTK_WIDGET(gtk_builder_get_object(builder,
"noti_vbox_enabled")),
865 GTK_WIDGET(gtk_builder_get_object(builder,
"noti_vbox_disabled")),
867 gtk_label_new(
_(
"Notifications")));
908 #ifdef WITH_LIBNOTIFY 922 gtk_window_set_transient_for(GTK_WINDOW(dialog->
prefs_dialog), parent);
925 gtk_builder_connect_signals(builder, dialog);
943 g_object_unref(G_OBJECT(builder));
GtkWidget * cancel_button
GtkBuilder * gtk_builder_new_from_file(const gchar *filename)
Internationalization support.
GtkAdjustment * vol_meter_pos_adjustment
static void on_prefs_dialog_response(G_GNUC_UNUSED GtkDialog *widget, gint response_id, PrefsDialog *dialog)
void hotkeys_unbind(Hotkeys *hotkeys)
GtkWidget * vol_meter_color_button
HotkeyDialog * hotkey_dialog_create(GtkWindow *parent, const gchar *hotkey)
GtkWidget * vol_text_check
GtkWidget * hotkeys_mute_label
GtkWidget * hotkeys_enable_check
static void get_keycode_for_label(GtkLabel *label, gint *code, GdkModifierType *mods)
const char * audio_get_card(Audio *audio)
gchar * hotkey_dialog_run(HotkeyDialog *dialog)
gchar * hotkey_code_to_accel(guint code, GdkModifierType mods)
void prefs_set_double(const gchar *key, gdouble value)
GtkWidget * normalize_vol_check
void audio_signals_disconnect(Audio *audio, AudioCallback callback, gpointer data)
#define assign_gtk_widget(builder, container, name)
Header for ui-hotkey-dialog.c.
GtkWidget * hotkeys_mute_eventbox
static void on_audio_changed(Audio *audio, AudioEvent *event, gpointer data)
void audio_signals_connect(Audio *audio, AudioCallback callback, gpointer data)
void prefs_dialog_present(PrefsDialog *dialog)
void hotkey_accel_to_code(const gchar *accel, gint *code, GdkModifierType *mods)
void gtk_combo_box_text_remove_all(GtkComboBoxText *combo_box)
gdouble * prefs_get_double_list(const gchar *key, gsize *n)
void prefs_dialog_retrieve(PrefsDialog *dialog)
void prefs_set_channel(const gchar *card, const gchar *channel)
static void set_label_for_keycode(GtkLabel *label, gint code, GdkModifierType mods)
GtkWidget * scroll_step_spin
GtkWidget * hotkeys_down_eventbox
gboolean prefs_get_boolean(const gchar *key, gboolean def)
void on_hotkeys_enable_check_toggled(GtkToggleButton *button, PrefsDialog *dialog)
void on_card_combo_changed(GtkComboBoxText *box, PrefsDialog *dialog)
GtkWidget * middle_click_combo
gchar * get_ui_file(const char *filename)
GtkWidget * vol_meter_color_label
GSList * audio_get_channel_list(const char *card_name)
PrefsDialog * prefs_dialog_create(GtkWindow *parent, Audio *audio, Hotkeys *hotkeys, PrefsDialogResponseCallback cb)
static void fill_chan_combo(GtkComboBoxText *combo, const gchar *card_name)
GtkWidget * vol_meter_pos_label
void(* PrefsDialogResponseCallback)(PrefsDialog *dialog, gint response_id)
void on_noti_enable_check_toggled(G_GNUC_UNUSED GtkToggleButton *button, G_GNUC_UNUSED PrefsDialog *dialog)
GtkWidget * vol_meter_draw_check
void prefs_set_integer(const gchar *key, gint value)
gchar * prefs_get_channel(const gchar *card)
gchar * prefs_get_string(const gchar *key, const gchar *def)
#define assign_gtk_adjustment(builder, container, name)
void prefs_set_double_list(const gchar *key, gdouble *list, gsize n)
GSList * audio_get_card_list(void)
void hotkeys_bind(Hotkeys *hotkeys)
gboolean on_hotkey_event_box_button_press_event(GtkWidget *widget, GdkEventButton *event, PrefsDialog *dialog)
GtkWidget * vol_pos_label
GtkWidget * vol_control_entry
Header for ui-prefs-dialog.c.
void prefs_set_string(const gchar *key, const gchar *value)
GtkWidget * noti_vbox_disabled
gint prefs_get_integer(const gchar *key, gint def)
GtkWidget * vol_orientation_combo
void on_middle_click_combo_changed(GtkComboBoxText *box, PrefsDialog *dialog)
void on_vol_text_check_toggled(GtkToggleButton *button, PrefsDialog *dialog)
void prefs_dialog_populate(PrefsDialog *dialog)
GtkWidget * fine_scroll_step_spin
GtkWidget * vol_meter_pos_spin
GtkWidget * hotkeys_down_label
void prefs_set_boolean(const gchar *key, gboolean value)
void on_vol_meter_draw_check_toggled(GtkToggleButton *button, PrefsDialog *dialog)
void hotkey_dialog_destroy(HotkeyDialog *dialog)
PrefsDialogResponseCallback response_user_cb
GtkWidget * hotkeys_up_eventbox
GtkWidget * hotkeys_up_label
static void fill_card_combo(GtkComboBoxText *combo, Audio *audio)
HotkeyDialog * hotkey_dialog
void prefs_dialog_destroy(PrefsDialog *dialog)
GtkWidget * vol_pos_combo
gdouble prefs_get_double(const gchar *key, gdouble def)