sound-juicer r1968 - in trunk: . data src



Author: rburton
Date: Fri Jan 11 15:51:56 2008
New Revision: 1968
URL: http://svn.gnome.org/viewvc/sound-juicer?rev=1968&view=rev

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

	* data/sound-juicer.glade:
	* src/sj-main.[ch]:
	* src/sj-extracting.c:
	Add a Year entry to the main window (#325264, thanks Andrzej Polatynski)


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

Modified: trunk/data/sound-juicer.glade
==============================================================================
--- trunk/data/sound-juicer.glade	(original)
+++ trunk/data/sound-juicer.glade	Fri Jan 11 15:51:56 2008
@@ -258,69 +258,91 @@
                 <property name="column_spacing">12</property>
                 <property name="row_spacing">6</property>
                 <child>
-                  <widget class="GtkLabel" id="duration_label">
+                  <widget class="GtkHBox" id="hbox1">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="xalign">0</property>
-                    <property name="ypad">3</property>
-                    <property name="selectable">True</property>
-                    <accessibility>
-                      <atkrelation target="label3" type="labelled-by"/>
-                    </accessibility>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <widget class="GtkEntry" id="genre_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <signal name="changed" handler="on_genre_edit_changed"/>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label4">
+                        <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;_Year:&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">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="year_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="max_length">4</property>
+                        <property name="width_chars">4</property>
+                        <signal name="changed" handler="on_year_edit_changed"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label3">
+                  <widget class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Duration:&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;_Title:&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
-                    <accessibility>
-                      <atkrelation target="duration_label" type="label-for"/>
-                    </accessibility>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">title_entry</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="genre_entry">
+                  <widget class="GtkEntry" id="title_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="invisible_char">*</property>
-                    <signal name="changed" handler="on_genre_edit_changed"/>
+                    <signal name="changed" handler="on_title_edit_changed" after="yes"/>
                   </widget>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label31">
+                  <widget class="GtkLabel" id="label2">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;_Genre:&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;_Artist:&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
                     <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">genre_entry</property>
+                    <property name="mnemonic_widget">artist_entry</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -329,7 +351,6 @@
                   <widget class="GtkEntry" id="artist_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="invisible_char">*</property>
                     <signal name="changed" handler="on_artist_edit_changed" after="yes"/>
                   </widget>
                   <packing>
@@ -341,44 +362,54 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label2">
+                  <widget class="GtkLabel" id="label31">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;_Artist:&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;_Genre:&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
                     <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">artist_entry</property>
+                    <property name="mnemonic_widget">genre_entry</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="title_entry">
+                  <widget class="GtkLabel" id="label3">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="invisible_char">*</property>
-                    <signal name="changed" handler="on_title_edit_changed" after="yes"/>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Duration:&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                    <accessibility>
+                      <atkrelation target="duration_label" type="label-for"/>
+                    </accessibility>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label1">
+                  <widget class="GtkLabel" id="duration_label">
                     <property name="visible">True</property>
+                    <property name="can_focus">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;_Title:&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">title_entry</property>
+                    <property name="ypad">3</property>
+                    <property name="selectable">True</property>
+                    <accessibility>
+                      <atkrelation target="label3" type="labelled-by"/>
+                    </accessibility>
                   </widget>
                   <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -480,6 +511,7 @@
                     <property name="expand">False</property>
                     <property name="fill">False</property>
                     <property name="pack_type">GTK_PACK_END</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </widget>
@@ -689,24 +721,31 @@
                           <placeholder/>
                         </child>
                         <child>
-                          <widget class="GtkCheckButton" id="check_open">
+                          <widget class="GtkLabel" id="cd_label">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">_Open music folder when finished</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">CD _drive:</property>
                             <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="mnemonic_widget">cd_option</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
+                          <widget class="Custom" id="cd_option">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="creation_function">nautilus_burn_drive_selection_new</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
                           <widget class="GtkCheckButton" id="check_eject">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -725,26 +764,19 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="Custom" id="cd_option">
+                          <widget class="GtkCheckButton" id="check_open">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="creation_function">nautilus_burn_drive_selection_new</property>
+                            <property name="label" translatable="yes">_Open music folder when finished</property>
+                            <property name="use_underline">True</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="cd_label">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">CD _drive:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">cd_option</property>
-                          </widget>
-                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -857,88 +889,88 @@
                           <placeholder/>
                         </child>
                         <child>
-                          <widget class="GtkCheckButton" id="check_strip">
+                          <widget class="GtkLabel" id="folder_label">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">_Strip special characters</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Folder hie_rarchy:</property>
                             <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="mnemonic_widget">path_option</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="path_example_label">
+                          <widget class="GtkLabel" id="file_label">
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
-                            <property name="use_markup">True</property>
-                            <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                            <property name="single_line_mode">True</property>
+                            <property name="label" translatable="yes">File _name:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">file_option</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="file_option">
+                          <widget class="GtkComboBox" id="path_option">
                             <property name="visible">True</property>
                             <property name="items" translatable="yes"></property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
                             <property name="y_options">GTK_FILL</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="path_option">
+                          <widget class="GtkComboBox" id="file_option">
                             <property name="visible">True</property>
                             <property name="items" translatable="yes"></property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                             <property name="y_options">GTK_FILL</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="file_label">
+                          <widget class="GtkLabel" id="path_example_label">
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
-                            <property name="label" translatable="yes">File _name:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">file_option</property>
+                            <property name="use_markup">True</property>
+                            <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+                            <property name="single_line_mode">True</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="folder_label">
+                          <widget class="GtkCheckButton" id="check_strip">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Folder hie_rarchy:</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">_Strip special characters</property>
                             <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">path_option</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>

Modified: trunk/src/sj-extracting.c
==============================================================================
--- trunk/src/sj-extracting.c	(original)
+++ trunk/src/sj-extracting.c	Fri Jan 11 15:51:56 2008
@@ -74,7 +74,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, *track_listview;
+static GtkWidget *extract_button, *play_button, *title_entry, *artist_entry, *genre_entry, *year_entry, *track_listview;
 
 /** The menuitem in the main menu */
 static GtkWidget *extract_menuitem, *play_menuitem, *reread_menuitem, *select_all_menuitem, *deselect_all_menuitem;
@@ -203,6 +203,7 @@
   gtk_widget_set_sensitive (title_entry, TRUE);
   gtk_widget_set_sensitive (artist_entry, TRUE);
   gtk_widget_set_sensitive (genre_entry, TRUE);
+  gtk_widget_set_sensitive (year_entry, TRUE);
   /* Enabling the Menuitem */ 
   gtk_widget_set_sensitive (play_menuitem, TRUE);
   gtk_widget_set_sensitive (extract_menuitem, TRUE);
@@ -688,6 +689,7 @@
     title_entry = glade_xml_get_widget (glade, "title_entry");
     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");
     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");
@@ -716,6 +718,7 @@
   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);
 
   /* 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 11 15:51:56 2008
@@ -65,6 +65,7 @@
 /* Prototypes for the signal blocking/unblocking in update_ui_for_album */
 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);
 
 GladeXML *glade;
 
@@ -75,7 +76,7 @@
 
 GtkWidget *main_window;
 static GtkWidget *message_area_vbox;
-static GtkWidget *title_entry, *artist_entry, *duration_label, *genre_entry;
+static GtkWidget *title_entry, *artist_entry, *duration_label, *genre_entry, *year_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;
@@ -492,10 +493,12 @@
     gtk_entry_set_text (GTK_ENTRY (title_entry), "");
     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_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 (play_button, FALSE);
     gtk_widget_set_sensitive (play_menuitem, FALSE);
     gtk_widget_set_sensitive (extract_button, FALSE);
@@ -512,16 +515,22 @@
 
     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);
     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)) {
+      gtk_entry_set_text (GTK_ENTRY (year_entry), g_strdup_printf ("%d", g_date_get_year (album->release_date)));
+    }
     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);
     /* Clear the genre field, it's from the user */
     gtk_entry_set_text (GTK_ENTRY (genre_entry), "");
 
     gtk_widget_set_sensitive (title_entry, TRUE);
     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 (play_button, TRUE);
     gtk_widget_set_sensitive (play_menuitem, TRUE);
     gtk_widget_set_sensitive (extract_button, TRUE);
@@ -1403,6 +1412,23 @@
   current_album->genre = gtk_editable_get_chars (widget, 0, -1); /* get all the characters */
 }
 
+void on_year_edit_changed(GtkEditable *widget, gpointer user_data) {
+  const gchar* yearstr;
+  int year;
+  
+  g_return_if_fail (current_album != NULL);
+  
+  yearstr = gtk_entry_get_text (GTK_ENTRY (widget));
+  year = atoi (yearstr);
+  if (year > 0) {
+    if (current_album->release_date) {
+      g_date_set_dmy (current_album->release_date, 1, 1, year);
+    } else {
+      current_album->release_date = g_date_new_dmy (1, 1, year);
+    }
+  }
+}
+
 void on_contents_activate(GtkWidget *button, gpointer user_data) {
   GError *error = NULL;
 
@@ -1646,6 +1672,7 @@
   artist_entry = glade_xml_get_widget (glade, "artist_entry");
   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");
   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");

Modified: trunk/src/sj-main.h
==============================================================================
--- trunk/src/sj-main.h	(original)
+++ trunk/src/sj-main.h	Fri Jan 11 15:51:56 2008
@@ -40,6 +40,7 @@
 void on_reread_activate (GtkWidget *button, gpointer user_data);
 void on_submit_activate (GtkWidget *menuitem, gpointer user_data);
 void on_genre_edit_changed(GtkEditable *widget, gpointer user_data);
+void on_year_edit_changed(GtkEditable *widget, gpointer user_data);
 void on_contents_activate(GtkWidget *button, gpointer user_data);
 void on_duplicate_activate (GtkWidget *button, gpointer user_data);
 



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