From: Greg <is...@gm...> - 2009-04-01 04:42:54
|
I added a gui interface to configure the ReplayGain preferences that I created in the previous patch. Again, this patch depends on the previous two patches from Todd and the my previous one: http://sourceforge.net/mailarchive/message.php?msg_name=c461c7560903211738r5d099a7ek77b13c0e3d724009%40mail.gmail.com I put the ReplayGain dialog box as a button on the "music" tab of the main prefs dialog. It seemed logical to me but I'm open to other suggestions. It looks like line wrapping may be an issue in this message, let me know if you would like an actual file... Cheers, Greg Index: src/prefsdlg.c =================================================================== --- src/prefsdlg.c (revision 2278) +++ src/prefsdlg.c (working copy) @@ -1294,3 +1294,45 @@ { sort_window_create (); } + +/* + glade callback +*/ +G_MODULE_EXPORT void on_replaygain_clicked (GtkButton *sender, gpointer e) +{ + GladeXML *xml = gtkpod_xml_new (xml_file, "prefs_replaygain_dialog"); + GtkWidget *dlg = gtkpod_xml_get_widget (xml, "prefs_replaygain_dialog"); + GtkWidget *mode_album_radio = gtkpod_xml_get_widget (xml, "mode_album"); + GtkWidget *mode_track_radio = gtkpod_xml_get_widget (xml, "mode_track"); + + gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (prefs_dialog)); + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtkpod_xml_get_widget (xml, "replaygain_offset")), prefs_get_int("replaygain_offset")); + if(prefs_get_int("replaygain_mode_album_priority")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_album_radio), TRUE); + else + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_track_radio), TRUE); + + glade_xml_signal_autoconnect (xml); + gtk_dialog_run (GTK_DIALOG (dlg)); + gtk_widget_destroy (dlg); + g_object_unref (xml); +} + +/* + glade callback +*/ +G_MODULE_EXPORT void on_replaygain_mode_album_toggled (GtkToggleButton *sender, gpointer e) +{ + gboolean active = gtk_toggle_button_get_active (sender); + + prefs_set_int ("replaygain_mode_album_priority", active); +} + +/* + glade callback +*/ +G_MODULE_EXPORT void on_replaygain_offset_value_changed (GtkSpinButton *sender, gpointer e) +{ + prefs_set_int ("replaygain_offset", gtk_spin_button_get_value_as_int (sender)); +} Index: data/gtkpod.glade =================================================================== --- data/gtkpod.glade (revision 2278) +++ data/gtkpod.glade (working copy) @@ -10440,6 +10440,19 @@ <property name="position">2</property> </packing> </child> + <child> + <widget class="GtkButton" id="replaygain"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="label" translatable="yes">ReplayGain...</property> + <property name="response_id">0</property> + <signal name="clicked" handler="on_replaygain_clicked"/> + </widget> + <packing> + <property name="position">3</property> + </packing> + </child> </widget> <packing> <property name="expand">False</property> @@ -13654,4 +13667,245 @@ </widget> </child> </widget> + <widget class="GtkDialog" id="prefs_replaygain_dialog"> + <property name="border_width">5</property> + <property name="title" translatable="yes">ReplayGain Preferences</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="has_separator">False</property> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox19"> + <property name="visible">True</property> + <property name="spacing">2</property> + <child> + <widget class="GtkVBox" id="vbox45"> + <property name="visible">True</property> + <property name="border_width">7</property> + <property name="spacing">18</property> + <child> + <widget class="GtkLabel" id="label118"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">The following settings control how gtkpod handles ReplayGain values previously tagged to music files</property> + <property name="wrap">True</property> + <property name="width_chars">63</property> + </widget> + </child> + <child> + <widget class="GtkFrame" id="frame27"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <child> + <widget class="GtkAlignment" id="alignment12"> + <property name="visible">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <widget class="GtkVBox" id="vbox45"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <widget class="GtkLabel" id="label119"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Select the prefered value to use</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkAlignment" id="alignment46"> + <property name="visible">True</property> + <property name="left_padding">12</property> + <child> + <widget class="GtkVBox" id="vbox57"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <widget class="GtkRadioButton" id="mode_album"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Album gain (formerly "audiophile gain")</property> + <property name="response_id">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_replaygain_mode_album_toggled"/> + </widget> + </child> + <child> + <widget class="GtkRadioButton" id="mode_track"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Track gain (formerly "radio gain")</property> + <property name="response_id">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">mode_album</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkLabel" id="label120"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Mode</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkFrame" id="frame28"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <child> + <widget class="GtkAlignment" id="alignment48"> + <property name="visible">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <widget class="GtkVBox" id="vbox58"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <widget class="GtkLabel" id="label121"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Select an offset value to add to the ReplayGain value</property> + </widget> + </child> + <child> + <widget class="GtkAlignment" id="alignment49"> + <property name="visible">True</property> + <property name="left_padding">12</property> + <child> + <widget class="GtkHBox" id="hbox52"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <widget class="GtkSpinButton" id="replaygain_offset"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="adjustment">0 -20 20 1 10 10</property> + <property name="climb_rate">1</property> + <signal name="value_changed" handler="on_replaygain_offset_value_changed"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label124"> + <property name="visible">True</property> + <property name="label" translatable="yes">dB</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkLabel" id="label125"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Offset</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <widget class="GtkVBox" id="vbox51"> + <property name="visible">True</property> + <child> + <widget class="GtkLabel" id="label51"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">These setting will only apply to newly added and/or synchronized tracks. This could result in tracks that are normalized to different levels until re-sychronized.</property> + <property name="wrap">True</property> + <property name="width_chars">63</property> + </widget> + </child> + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="position">3</property> + </packing> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area19"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <child> + <widget class="GtkButton" id="rg_close"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="label" translatable="yes">gtk-close</property> + <property name="use_stock">True</property> + <property name="response_id">0</property> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + </child> + </widget> </glade-interface> |