sound-juicer r1985 - in trunk: . data libjuicer src



Author: rburton
Date: Fri Jan 18 17:15:12 2008
New Revision: 1985
URL: http://svn.gnome.org/viewvc/sound-juicer?rev=1985&view=rev

Log:
2008-01-18  Ross Burton  <ross burtonini com>

	* data/sound-juicer.glade:
	* libjuicer/sj-structures.h:
	* libjuicer/sj-extractor.c:
	* src/sj-extracting.c:
	* src/sj-main.c:
	Add a Disc Number field (#136514, thanks Matthew Martin).


Modified:
   trunk/ChangeLog
   trunk/data/sound-juicer.glade
   trunk/libjuicer/sj-extractor.c
   trunk/libjuicer/sj-structures.h
   trunk/src/sj-extracting.c
   trunk/src/sj-main.c

Modified: trunk/data/sound-juicer.glade
==============================================================================
--- trunk/data/sound-juicer.glade	(original)
+++ trunk/data/sound-juicer.glade	Fri Jan 18 17:15:12 2008
@@ -297,6 +297,32 @@
                         <property name="position">2</property>
                       </packing>
                     </child>
+                    <child>
+                      <widget class="GtkLabel" id="label6">
+                        <property name="visible">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="xalign">0</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Disc:&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">year_entry</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="disc_number_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="width_chars">2</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
                     <property name="left_attach">1</property>
@@ -833,8 +859,8 @@
                         <child>
                           <widget class="GtkFileChooserButton" id="path_chooser">
                             <property name="visible">True</property>
-                            <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
                             <property name="local_only">False</property>
+                            <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
                             <property name="title" translatable="yes">Select A Folder</property>
                             <signal name="current_folder_changed" handler="prefs_base_folder_changed"/>
                           </widget>

Modified: trunk/libjuicer/sj-extractor.c
==============================================================================
--- trunk/libjuicer/sj-extractor.c	(original)
+++ trunk/libjuicer/sj-extractor.c	Fri Jan 18 17:15:12 2008
@@ -563,6 +563,12 @@
                                  GST_TAG_DATE, track->album->release_date,
                                  NULL);
       }
+      if (track->album->disc_number > 0) {
+        gst_tag_setter_add_tags (tagger,
+                                 GST_TAG_MERGE_APPEND,
+                                 GST_TAG_ALBUM_VOLUME_NUMBER, track->album->disc_number,
+                                 NULL);
+      }
       gst_object_unref (tagger);
       break;
     case GST_ITERATOR_RESYNC:

Modified: trunk/libjuicer/sj-structures.h
==============================================================================
--- trunk/libjuicer/sj-structures.h	(original)
+++ trunk/libjuicer/sj-structures.h	Fri Jan 18 17:15:12 2008
@@ -54,6 +54,7 @@
   char* artist_sortname;
   char *genre;
   int   number; /* number of tracks in the album */
+  int   disc_number;
   GList* tracks;
   GDate *release_date; /* MusicBrainz support multiple releases per album */
   char* album_id;

Modified: trunk/src/sj-extracting.c
==============================================================================
--- trunk/src/sj-extracting.c	(original)
+++ trunk/src/sj-extracting.c	Fri Jan 18 17:15:12 2008
@@ -75,7 +75,7 @@
 static GtkWidget *progress_bar, *status_bar;
 
 /** The widgets in the main UI */
-static GtkWidget *extract_button, *play_button, *title_entry, *artist_entry, *genre_entry, *year_entry, *track_listview;
+static GtkWidget *extract_button, *play_button, *title_entry, *artist_entry, *genre_entry, *year_entry, *disc_number_entry, *track_listview;
 
 /** The menuitem in the main menu */
 static GtkWidget *extract_menuitem, *play_menuitem, *reread_menuitem, *select_all_menuitem, *deselect_all_menuitem;
@@ -223,6 +223,7 @@
   gtk_widget_set_sensitive (artist_entry, TRUE);
   gtk_widget_set_sensitive (genre_entry, TRUE);
   gtk_widget_set_sensitive (year_entry, TRUE);
+  gtk_widget_set_sensitive (disc_number_entry, TRUE);
   /* Enabling the Menuitem */ 
   gtk_widget_set_sensitive (play_menuitem, TRUE);
   gtk_widget_set_sensitive (extract_menuitem, TRUE);
@@ -691,6 +692,7 @@
     artist_entry = glade_xml_get_widget (glade, "artist_entry");
     genre_entry = glade_xml_get_widget (glade, "genre_entry");
     year_entry = glade_xml_get_widget (glade, "year_entry");
+    disc_number_entry = glade_xml_get_widget (glade, "disc_number_entry");
     track_listview = glade_xml_get_widget (glade, "track_listview");
     progress_bar = glade_xml_get_widget (glade, "progress_bar");
     status_bar = glade_xml_get_widget (glade, "status_bar");
@@ -720,6 +722,7 @@
   gtk_widget_set_sensitive (artist_entry, FALSE);
   gtk_widget_set_sensitive (genre_entry, FALSE);
   gtk_widget_set_sensitive (year_entry, FALSE);
+  gtk_widget_set_sensitive (disc_number_entry, FALSE);
 
   /* Disable the menuitems in the main menu*/ 
   gtk_widget_set_sensitive (play_menuitem, FALSE);

Modified: trunk/src/sj-main.c
==============================================================================
--- trunk/src/sj-main.c	(original)
+++ trunk/src/sj-main.c	Fri Jan 18 17:15:12 2008
@@ -66,6 +66,7 @@
 void on_title_edit_changed(GtkEditable *widget, gpointer user_data);
 void on_artist_edit_changed(GtkEditable *widget, gpointer user_data);
 void on_year_edit_changed(GtkEditable *widget, gpointer user_data);
+void on_disc_number_edit_changed(GtkEditable *widget, gpointer user_data);
 
 GladeXML *glade;
 
@@ -76,7 +77,7 @@
 
 GtkWidget *main_window;
 static GtkWidget *message_area_vbox;
-static GtkWidget *title_entry, *artist_entry, *duration_label, *genre_entry, *year_entry;
+static GtkWidget *title_entry, *artist_entry, *duration_label, *genre_entry, *year_entry, *disc_number_entry;
 static GtkWidget *track_listview, *extract_button, *play_button;
 static GtkWidget *status_bar;
 static GtkWidget *extract_menuitem, *play_menuitem, *next_menuitem, *prev_menuitem, *select_all_menuitem, *deselect_all_menuitem;
@@ -494,11 +495,13 @@
     gtk_entry_set_text (GTK_ENTRY (artist_entry), "");
     gtk_entry_set_text (GTK_ENTRY (genre_entry), "");
     gtk_entry_set_text (GTK_ENTRY (year_entry), "");
+    gtk_entry_set_text (GTK_ENTRY (disc_number_entry), "");
     gtk_label_set_text (GTK_LABEL (duration_label), "");
     gtk_widget_set_sensitive (title_entry, FALSE);
     gtk_widget_set_sensitive (artist_entry, FALSE);
     gtk_widget_set_sensitive (genre_entry, FALSE);
     gtk_widget_set_sensitive (year_entry, FALSE);
+    gtk_widget_set_sensitive (disc_number_entry, FALSE);
     gtk_widget_set_sensitive (play_button, FALSE);
     gtk_widget_set_sensitive (play_menuitem, FALSE);
     gtk_widget_set_sensitive (extract_button, FALSE);
@@ -516,6 +519,7 @@
     g_signal_handlers_block_by_func (title_entry, on_title_edit_changed, NULL);
     g_signal_handlers_block_by_func (artist_entry, on_artist_edit_changed, NULL);
     g_signal_handlers_block_by_func (year_entry, on_year_edit_changed, NULL);
+    g_signal_handlers_block_by_func (disc_number_entry, on_disc_number_edit_changed, NULL);
     gtk_entry_set_text (GTK_ENTRY (title_entry), album->title);
     gtk_entry_set_text (GTK_ENTRY (artist_entry), album->artist);
     if (g_date_valid (album->release_date)) {
@@ -524,6 +528,7 @@
     g_signal_handlers_unblock_by_func (title_entry, on_title_edit_changed, NULL);
     g_signal_handlers_unblock_by_func (artist_entry, on_artist_edit_changed, NULL);
     g_signal_handlers_unblock_by_func (year_entry, on_year_edit_changed, NULL);
+    g_signal_handlers_unblock_by_func (disc_number_entry, on_disc_number_edit_changed, NULL);
     /* Clear the genre field, it's from the user */
     gtk_entry_set_text (GTK_ENTRY (genre_entry), "");
 
@@ -531,6 +536,7 @@
     gtk_widget_set_sensitive (artist_entry, TRUE);
     gtk_widget_set_sensitive (genre_entry, TRUE);
     gtk_widget_set_sensitive (year_entry, TRUE);
+    gtk_widget_set_sensitive (disc_number_entry, TRUE);
     gtk_widget_set_sensitive (play_button, TRUE);
     gtk_widget_set_sensitive (play_menuitem, TRUE);
     gtk_widget_set_sensitive (extract_button, TRUE);
@@ -1429,6 +1435,17 @@
   }
 }
 
+void on_disc_number_edit_changed(GtkEditable *widget, gpointer user_data) {
+    const gchar* discstr;  
+    int disc_number;
+
+    g_return_if_fail (current_album != NULL);
+    discstr = gtk_entry_get_text (GTK_ENTRY (widget));
+    disc_number = atoi(discstr);
+    if (disc_number > 0)
+        current_album->disc_number = disc_number;
+}
+
 void on_contents_activate(GtkWidget *button, gpointer user_data) {
   GError *error = NULL;
 
@@ -1673,6 +1690,7 @@
   duration_label = glade_xml_get_widget (glade, "duration_label");
   genre_entry = glade_xml_get_widget (glade, "genre_entry");
   year_entry = glade_xml_get_widget (glade, "year_entry");
+  disc_number_entry = glade_xml_get_widget (glade, "disc_number_entry");
   track_listview = glade_xml_get_widget (glade, "track_listview");
   extract_button = glade_xml_get_widget (glade, "extract_button");
   extract_menuitem = glade_xml_get_widget (glade, "extract_menuitem");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]