summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Burton <rburton@src.gnome.org>2003-04-01 10:04:06 +0000
committerRoss Burton <rburton@src.gnome.org>2003-04-01 10:04:06 +0000
commit71ad4e0f42e78aa9c4b1a88fb51e01d13fe34472 (patch)
tree356872aff260c75974e18881db724b65baf5039b
parentae7153a61e3c09495860b9caa2f95d6eea743af3 (diff)
Loads of changes
-rw-r--r--ChangeLog25
-rw-r--r--Makefile.am5
-rw-r--r--README12
-rwxr-xr-xautogen.sh2
-rw-r--r--configure.in2
-rw-r--r--data/Makefile.am9
-rw-r--r--data/sound-juicer.desktop.in10
-rw-r--r--data/sound-juicer.glade37
-rw-r--r--data/sound-juicer.pngbin0 -> 4213 bytes
-rw-r--r--po/Makefile9
-rw-r--r--po/Makefile.in2
-rw-r--r--po/POTFILES7
-rw-r--r--po/POTFILES.in6
-rw-r--r--src/sj-gstreamer.c26
-rw-r--r--src/sj-musicbrainz.c15
-rwxr-xr-xsrc/update-from-bacon.sh25
-rw-r--r--tests/glade-test.c100
17 files changed, 216 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 776816b..3d3f794 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2003-04-01 Ross Burton <ross@burtonini.com>
+
+ * README: Update to reflect new state -- it works!
+
+ * data/sound-juicer.desktop.in: Added.
+ * src/sound-juicer.png: Renamed from grip-48.png
+ * data/Makefile.am: Added, install data files.
+ * src/Makefile.am: Added, all it does at the moment it automake
+ the libbacon updates.
+ * Makefile.am: Go into src/ and data/, and remove NOTES as it
+ doesn't exist any more.
+
+ * src/sj-gstreamer.c:Markup translatable strings, and remove #if'd
+ out code.
+ * src/sj-musicbrainz.c: Markup translatable strings
+
+ * po/POTFILES.in: Update
+
+ * src/sj-gstreamer.c: Remove a compile warning.
+
+ * data/sound-juicer.glade: Added a Select All menu item, and
+ renamed some control.s
+ * tests/glade-test.c: Implemented Select All, the album duration
+ display, album extract progress, i18nized more strings...
+
2003-03-31 Ross Burton <ross@burtonini.com>
* src/sj-gstreamer.c: Cleansups.
diff --git a/Makefile.am b/Makefile.am
index 5da004c..1392770 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = tests
+SUBDIRS = data src tests
INTLTOOL_BUILT = \
intltool-extract \
@@ -7,7 +7,6 @@ INTLTOOL_BUILT = \
EXTRA_DIST = \
autogen.sh \
- $(INTLTOOL_BUILT:=.in) \
- NOTES
+ $(INTLTOOL_BUILT:=.in)
CLEANFILES = $(INTLTOOL_BUILT)
diff --git a/README b/README
index cad3b0e..0238f6d 100644
--- a/README
+++ b/README
@@ -8,11 +8,9 @@ src/ contains the code sort of works.
test/ is where I've been trying out code and ideas.
-Currently test/glade-test.c is the "application" -- at the moment it
-will rip and single track and probably break in style if you try and
-rip more than one. By setting MAINLOOP to 0 in src/sj-gstreamer.c it
-might rip an entire CD (it worked last night, but a lot has changed
-since then), but the interface will freeze.
+Currently test/glade-test.c is the "application". Once it managed to
+rip two tracks of a CD I considered it "working", but it needs
+testing...
CVS GStreamer is required for the Ogg tagging to work correctly --
you'll get invalid tag messages with 0.6.0.
@@ -23,4 +21,6 @@ and rewrite the pipeline. This may become an option in the future.
I will replace the function pointers in src/sj-gstreamer.c with GLib
signals, but as I said, this is all in flux at the moment. I'm still
undecided about the exact API for the ripper. I'll probably make it a
-GObject or something just to be l33t.
+GObject or something.
+
+I must also create a GConf schema file.
diff --git a/autogen.sh b/autogen.sh
index 0b2c3c6..1b0929b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -7,7 +7,7 @@ srcdir=${srcdir:-.}
# default version requirements ...
REQUIRED_AUTOCONF_VERSION=${REQUIRED_AUTOCONF_VERSION:-2.53}
-REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.7}
+REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.6}
REQUIRED_LIBTOOL_VERSION=${REQUIRED_LIBTOOL_VERSION:-1.4.3}
REQUIRED_GETTEXT_VERSION=${REQUIRED_GETTEXT_VERSION:-0.10.40}
REQUIRED_GLIB_GETTEXT_VERSION=${REQUIRED_GLIB_GETTEXT_VERSION:-2.2.0}
diff --git a/configure.in b/configure.in
index 4adf55f..7e1c0ba 100644
--- a/configure.in
+++ b/configure.in
@@ -57,6 +57,8 @@ AM_GLIB_GNU_GETTEXT
AC_OUTPUT([
Makefile
+data/Makefile
po/Makefile.in
+src/Makefile
tests/Makefile
])
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..cc586c9
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,9 @@
+pixmapdir = $(datadir)/pixmaps
+pixmap_DATA = sound-juicer.png
+
+gladedir = $(datadir)/sound-juicer/
+glade_DATA = sound-juicer.glade
+
+desktopdir = $(datadir)/applications
+desktop_DATA = sound-juicer.desktop
+@INTLTOOL_DESKTOP_RULE@
diff --git a/data/sound-juicer.desktop.in b/data/sound-juicer.desktop.in
new file mode 100644
index 0000000..28a4761
--- /dev/null
+++ b/data/sound-juicer.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+_Name=CD Ripper
+_Comment=Rip music from your CDs
+Exec=sound-juicer
+Icon=sound-juicer.png
+StartupNotify=true
+Terminal=false
+Type=Application
+Categories=GNOME;Application;AudioVideo;
diff --git a/data/sound-juicer.glade b/data/sound-juicer.glade
index ce5f59f..75c19ca 100644
--- a/data/sound-juicer.glade
+++ b/data/sound-juicer.glade
@@ -35,14 +35,15 @@
<widget class="GtkMenu" id="menuitem1_menu">
<child>
- <widget class="GtkImageMenuItem" id="extract">
+ <widget class="GtkImageMenuItem" id="extract_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Extract</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_extract_activate" last_modification_time="Tue, 25 Mar 2003 07:45:51 GMT"/>
+ <accelerator key="E" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image21">
+ <widget class="GtkImage" id="image47">
<property name="visible">True</property>
<property name="stock">gtk-cdrom</property>
<property name="icon_size">1</property>
@@ -61,9 +62,10 @@
<property name="label" translatable="yes">Re-read</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_reread_activate" last_modification_time="Tue, 25 Mar 2003 07:45:51 GMT"/>
+ <accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image22">
+ <widget class="GtkImage" id="image48">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -91,7 +93,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image23">
+ <widget class="GtkImage" id="image49">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@@ -118,14 +120,31 @@
<widget class="GtkMenu" id="menuitem2_menu">
<child>
+ <widget class="GtkMenuItem" id="select_all">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Select _All</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_select_all_activate" last_modification_time="Tue, 01 Apr 2003 06:36:30 GMT"/>
+ <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="separator1">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+
+ <child>
<widget class="GtkImageMenuItem" id="edit_preferences">
<property name="visible">True</property>
<property name="label" translatable="yes">Prefere_nces</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_edit_preferences_cb" last_modification_time="Tue, 25 Mar 2003 08:37:30 GMT"/>
+ <accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image24">
+ <widget class="GtkImage" id="image50">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@@ -159,7 +178,7 @@
<signal name="activate" handler="on_about_activate" last_modification_time="Thu, 20 Mar 2003 18:36:52 GMT"/>
<child internal-child="image">
- <widget class="GtkImage" id="image25">
+ <widget class="GtkImage" id="image51">
<property name="visible">True</property>
<property name="stock">gnome-stock-about</property>
<property name="icon_size">1</property>
@@ -1032,7 +1051,7 @@
<child>
<widget class="GtkLabel" id="progress_label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Currently ripping track %d (%d remaining)</property>
+ <property name="label" translatable="yes">label</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1122,7 +1141,7 @@
<property name="spacing">8</property>
<child>
- <widget class="GtkProgressBar" id="disc_progress">
+ <widget class="GtkProgressBar" id="album_progress">
<property name="visible">True</property>
<property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
<property name="fraction">0</property>
@@ -1140,7 +1159,7 @@
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Disc Progress&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Album Progress&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
diff --git a/data/sound-juicer.png b/data/sound-juicer.png
new file mode 100644
index 0000000..a184924
--- /dev/null
+++ b/data/sound-juicer.png
Binary files differ
diff --git a/po/Makefile b/po/Makefile
index a5eaf1d..1453c16 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -24,7 +24,7 @@ top_srcdir = ..
top_builddir = ..
-prefix = /usr/local
+prefix = /home/users/ross/bin/gnome2
exec_prefix = ${prefix}
datadir = ${prefix}/share
libdir = ${exec_prefix}/lib
@@ -62,7 +62,12 @@ DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
$(POFILES) $(GMOFILES) $(SOURCES)
POTFILES = \
- ../data/sound-juicer.glade
+ ../data/sound-juicer.glade \
+ ../data/sound-juicer.desktop.in \
+ ../src/cd-drive.c \
+ ../src/bacon-cd-selection.c \
+ ../src/sj-musicbrainz.c \
+ ../src/sj-gstreamer.c
CATALOGS =
CATOBJEXT = .gmo
diff --git a/po/Makefile.in b/po/Makefile.in
index ba10c99..54b5059 100644
--- a/po/Makefile.in
+++ b/po/Makefile.in
@@ -24,7 +24,7 @@ top_srcdir = ..
top_builddir = ..
-prefix = /usr/local
+prefix = /home/users/ross/bin/gnome2
exec_prefix = ${prefix}
datadir = ${prefix}/share
libdir = ${exec_prefix}/lib
diff --git a/po/POTFILES b/po/POTFILES
index c8d3bf5..03e5ee2 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -1 +1,6 @@
- ../data/sound-juicer.glade
+ ../data/sound-juicer.glade \
+ ../data/sound-juicer.desktop.in \
+ ../src/cd-drive.c \
+ ../src/bacon-cd-selection.c \
+ ../src/sj-musicbrainz.c \
+ ../src/sj-gstreamer.c
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 93df9ed..3379cc2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1 +1,7 @@
data/sound-juicer.glade
+data/sound-juicer.desktop.in
+
+src/cd-drive.c
+src/bacon-cd-selection.c
+src/sj-musicbrainz.c
+src/sj-gstreamer.c
diff --git a/src/sj-gstreamer.c b/src/sj-gstreamer.c
index 7fc6b07..eb1a5b3 100644
--- a/src/sj-gstreamer.c
+++ b/src/sj-gstreamer.c
@@ -1,6 +1,7 @@
#include <glib/gerror.h>
#include <glib/gtypes.h>
#include <gst/gst.h>
+#include <libgnome/gnome-i18n.h>
#include "sj-structures.h"
#include "sj-gstreamer.h"
#include "sj-error.h"
@@ -10,9 +11,6 @@ static GstElement *cdparanoia, *vorbisenc, *filesink;
static GstFormat track_format;
GstPad *source_pad;
-#define THREADED 0
-#define MAINLOOP 1
-
typedef void (*progress_cb_t) (int seconds);
typedef void (*completion_cb_t) (void);
@@ -29,18 +27,14 @@ void sj_gstreamer_init (int argc, char **argv, GError **error)
{
gst_init (&argc, &argv);
-#if THREADED
- pipeline = gst_thread_new ("pipeline");
-#else
pipeline = gst_pipeline_new ("pipeline");
-#endif
/* Read from CD */
cdparanoia = gst_element_factory_make ("cdparanoia", "cdparanoia");
if (cdparanoia == NULL) {
g_set_error (error,
SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,
- "Could not create cdparanoia element");
+ _("Could not create cdparanoia element"));
return;
}
g_object_set (G_OBJECT (cdparanoia), "paranoia_mode", 0, NULL);
@@ -56,18 +50,18 @@ void sj_gstreamer_init (int argc, char **argv, GError **error)
if (vorbisenc == NULL) {
g_set_error (error,
SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,
- "Could not create Vorbis encoding element");
+ _("Could not create Vorbis encoding element"));
return;
}
/* Connect to the eos so we know when its finished */
- g_signal_connect (vorbisenc, "eos", eos_cb, NULL);
+ g_signal_connect (vorbisenc, "eos", G_CALLBACK (eos_cb), NULL);
/* Write to disk */
filesink = gst_element_factory_make ("filesink", "filesink");
if (filesink == NULL) {
g_set_error (error,
SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,
- "Could not create file sink element");
+ _("Could not create file sink element"));
return;
}
@@ -148,7 +142,7 @@ void sj_gstreamer_extract_track (const TrackDetails *track, const char* path, GE
"artist", GST_PROPS_STRING (track->artist),
"tracknumber", GST_PROPS_STRING (tracknumber),
"album", GST_PROPS_STRING (track->album->title),
- "comment", GST_PROPS_STRING("Ripped with Sound Juicer")
+ "comment", GST_PROPS_STRING(_("Ripped with Sound Juicer"))
);
g_object_set (G_OBJECT (vorbisenc), "metadata", caps, NULL);
g_free (tracknumber);
@@ -162,17 +156,11 @@ void sj_gstreamer_extract_track (const TrackDetails *track, const char* path, GE
if (!gst_pad_send_event (source_pad, event)) {
g_set_error (error,
SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,
- "Could not seek to track");
+ _("Could not seek to track"));
return;
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
-#if MAINLOOP
g_idle_add ((GSourceFunc)gst_bin_iterate, pipeline);
g_timeout_add (200, (GSourceFunc)tick_timeout_cb, NULL);
-#else
- while (gst_bin_iterate (GST_BIN (pipeline))) {
- g_print(".");
- }
-#endif
}
diff --git a/src/sj-musicbrainz.c b/src/sj-musicbrainz.c
index 07dee05..5b92fee 100644
--- a/src/sj-musicbrainz.c
+++ b/src/sj-musicbrainz.c
@@ -2,6 +2,7 @@
#include <glib/glist.h>
#include <glib/gstrfuncs.h>
#include <glib/gmessages.h>
+#include <libgnome/gnome-i18n.h>
#include <musicbrainz/queries.h>
#include <musicbrainz/mb_c.h>
#include <stdlib.h>
@@ -30,19 +31,19 @@ static GList* get_offline_track_listing(musicbrainz_t mb, GError **error)
if (!mb_Query (mb, MBQ_GetCDTOC)) {
char error[255];
mb_GetQueryError (mb, error, 255);
- g_print("Cannot read CD: %s\n", error);
+ g_print(_("Cannot read CD: %s\n"), error);
return NULL; /* TODO: GError */
}
num_tracks = mb_GetResultInt (mb, MBE_TOCGetLastTrack);
album = g_new0 (AlbumDetails, 1);
- album->artist = "Unknown Artist";
- album->title = "Unknown Title";
+ album->artist = _("Unknown Artist");
+ album->title = _("Unknown Title");
for (i = 1; i <= num_tracks; i++) {
track = g_new0 (TrackDetails, 1);
track->album = album;
track->number = i;
- track->title = g_strdup_printf ("Track %d", i);
+ track->title = g_strdup_printf (_("Track %d"), i);
track->artist = album->artist;
/* TODO: track duration */
album->tracks = g_list_append (album->tracks, track);
@@ -59,7 +60,7 @@ GList* sj_musicbrainz_list_albums(GError **error) {
mb = mb_New ();
if (!mb) {
- g_print ("Cannot get MusicBrainz connection\n");
+ g_print (_("Cannot get MusicBrainz connection\n"));
return NULL; /* TODO: GError */
}
mb_SetDevice (mb, cdrom);
@@ -67,13 +68,13 @@ GList* sj_musicbrainz_list_albums(GError **error) {
if (!mb_Query (mb, MBQ_GetCDInfo)) {
char error[255];
mb_GetQueryError (mb, error, 255);
- g_print("Cannot lookup CD: %s\n", error);
+ g_print(_("Cannot lookup CD: %s\n"), error);
return get_offline_track_listing (mb, NULL);
}
num_albums = mb_GetResultInt(mb, MBE_GetNumAlbums);
if (num_albums < 1) {
- g_print("This CD was not found.\n");
+ g_print(_("This CD was not found.\n"));
return NULL;
}
diff --git a/src/update-from-bacon.sh b/src/update-from-bacon.sh
new file mode 100755
index 0000000..fb32f03
--- /dev/null
+++ b/src/update-from-bacon.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+function die() {
+ echo $*
+ exit 1
+}
+
+if test -z "$BACONDIR"; then
+ echo "Must set BACONDIR"
+ exit 1
+fi
+
+if test -z "$BACONFILES"; then
+ echo "Must set BACONFILES"
+ exit 1
+fi
+
+for FILE in $BACONFILES; do
+ if cmp -s $BACONDIR/$FILE $FILE; then
+ echo "File $FILE is unchanged"
+ else
+ cp $BACONDIR/$FILE $FILE || die "Could not move $BACONDIR/$FILE to $FILE"
+ echo "Updated $FILE"
+ fi
+done
diff --git a/tests/glade-test.c b/tests/glade-test.c
index 6fa9b59..5803b1c 100644
--- a/tests/glade-test.c
+++ b/tests/glade-test.c
@@ -4,6 +4,7 @@
#include <gtk/gtk.h>
#include <glade/glade-xml.h>
#include <gconf/gconf-client.h>
+#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-about.h>
#include <libgnomeui/gnome-file-entry.h>
#include "bacon-cd-selection.h"
@@ -16,17 +17,19 @@ GladeXML *glade;
GConfClient *gconf_client;
GtkWidget *main_window, *progress_dialog = NULL;
-GtkWidget *title_label, *artist_label, *basepath_label;
+GtkWidget *title_label, *artist_label, *duration_label, *basepath_label;
GtkWidget *track_listview, *cd_option, *reread_button, *extract_button;
-GtkWidget *progress_label, *track_progress;
+GtkWidget *extract_menuitem, *select_all_menuitem;
+GtkWidget *progress_label, *track_progress, *album_progress;
GtkListStore *track_store;
const char *base_path;
const char *device;
-int duration; /* duration of current track for progress dialog */
+int track_duration; /* duration of current track for progress dialog */
gboolean ripping = FALSE;
GList *pending = NULL; /* a GList of TrackDetails* to rip */
+int total_ripping; /* the number of tracks to rip, not decremented */
#define GCONF_ROOT "/apps/sound-juicer"
#define GCONF_DEVICE GCONF_ROOT "/device"
@@ -49,10 +52,10 @@ void on_about_activate (GtkMenuItem *item, gpointer user_data)
{
GtkWidget *dialog = NULL;
const char* authors[] = {"Ross Burton <ross@burtonini.com>", NULL};
- dialog = gnome_about_new ("Sound Juicer",
+ dialog = gnome_about_new (_("Sound Juicer"),
VERSION,
- "Copyright (C) 2003 Ross Burton",
- "A CD ripper",
+ _("Copyright (C) 2003 Ross Burton"),
+ _("A CD ripper"),
authors,
NULL, NULL, NULL);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (main_window));
@@ -77,9 +80,9 @@ gboolean on_destory_event (GtkWidget *widget, GdkEvent *event, gpointer user_dat
dialog = gtk_message_dialog_new (GTK_WINDOW (main_window), GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
- "You are currently ripping a CD. Do you want to quit now or contine ripping?");
+ _("You are currently ripping a CD. Do you want to quit now or contine ripping?"));
gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-quit", GTK_RESPONSE_ACCEPT);
- gtk_dialog_add_button (GTK_DIALOG (dialog), "Continue", GTK_RESPONSE_REJECT);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), _("Continue"), GTK_RESPONSE_REJECT);
gtk_widget_show_all (dialog);
response = gtk_dialog_run (GTK_DIALOG (dialog));
return response != GTK_RESPONSE_ACCEPT;
@@ -87,6 +90,20 @@ gboolean on_destory_event (GtkWidget *widget, GdkEvent *event, gpointer user_dat
return FALSE;
}
+static gboolean select_all_foreach_cb (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ gtk_list_store_set (track_store, iter, COLUMN_EXTRACT, TRUE, -1);
+ return FALSE;
+}
+
+void on_select_all_activate (GtkMenuItem *item, gpointer user_data)
+{
+ gtk_tree_model_foreach (GTK_TREE_MODEL (track_store), select_all_foreach_cb, NULL);
+}
+
/**
* GtkTreeView cell renderer callback to render durations
*/
@@ -104,7 +121,11 @@ static void duration_cell_data_cb (GtkTreeViewColumn *tree_column,
g_value_unset (&v);
g_value_init(&v, G_TYPE_STRING);
- g_value_set_string (&v, g_strdup_printf("%d:%02d", duration / 60, duration % 60));
+ if (duration) {
+ g_value_set_string (&v, g_strdup_printf("%d:%02d", duration / 60, duration % 60));
+ } else {
+ g_value_set_string (&v, _("(unknown)"));
+ }
g_object_set_property (G_OBJECT (cell), "text", &v);
}
@@ -114,20 +135,29 @@ static void duration_cell_data_cb (GtkTreeViewColumn *tree_column,
static void update_ui_for_album (AlbumDetails *album)
{
GList *l;
+ int album_duration = 0;
+ char* duration_text;
+
if (album == NULL) {
gtk_label_set_text (GTK_LABEL (title_label), "");
gtk_label_set_text (GTK_LABEL (artist_label), "");
+ gtk_label_set_text (GTK_LABEL (duration_label), "");
gtk_list_store_clear (track_store);
gtk_widget_set_sensitive (extract_button, FALSE);
+ gtk_widget_set_sensitive (extract_menuitem, FALSE);
+ gtk_widget_set_sensitive (select_all_menuitem, FALSE);
} else {
gtk_label_set_text (GTK_LABEL (title_label), album->title);
gtk_label_set_text (GTK_LABEL (artist_label), album->artist);
gtk_widget_set_sensitive (extract_button, TRUE);
+ gtk_widget_set_sensitive (extract_menuitem, TRUE);
+ gtk_widget_set_sensitive (select_all_menuitem, TRUE);
gtk_list_store_clear (track_store);
for (l = album->tracks; l; l=g_list_next (l)) {
GtkTreeIter iter;
TrackDetails *track = (TrackDetails*)l->data;
+ album_duration += track->duration;
gtk_list_store_append (track_store, &iter);
gtk_list_store_set (track_store, &iter,
COLUMN_NUMBER, track->number,
@@ -137,6 +167,14 @@ static void update_ui_for_album (AlbumDetails *album)
COLUMN_DETAILS, track,
-1);
}
+ /* Some albums don't have track durations :( */
+ if (album_duration) {
+ duration_text = g_strdup_printf("%d:%02d", album_duration / 60, album_duration % 60);
+ gtk_label_set_text (GTK_LABEL (duration_label), duration_text);
+ g_free (duration_text);
+ } else {
+ gtk_label_set_text (GTK_LABEL (duration_label), _("(unknown)"));
+ }
}
}
@@ -177,13 +215,13 @@ AlbumDetails* multiple_album_dialog(GList *albums)
g_signal_connect (albums_listview, "row-activated", G_CALLBACK (album_row_activated), dialog);
albums_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
- column = gtk_tree_view_column_new_with_attributes ("Title",
+ column = gtk_tree_view_column_new_with_attributes (_("Title"),
text_renderer,
"text", 0,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (albums_listview), column);
- column = gtk_tree_view_column_new_with_attributes ("Artist",
+ column = gtk_tree_view_column_new_with_attributes (_("Artist"),
text_renderer,
"text", 1,
NULL);
@@ -243,7 +281,7 @@ void reread_cd (void)
albums = sj_musicbrainz_list_albums(&error);
if (error) {
- g_print ("Cannot list albums: %s\n", error->message);
+ g_print (_("Cannot list albums: %s\n"), error->message);
g_error_free (error);
return;
}
@@ -271,8 +309,8 @@ void device_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, g
dialog = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- "<b>No CD-ROMs found</b>\n\n"
- "Sound Juicer could not find any CD-ROM drives to read.");
+ _("<b>No CD-ROMs found</b>\n\n"
+ "Sound Juicer could not find any CD-ROM drives to read."));
gtk_label_set_use_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), TRUE);
gtk_dialog_run (GTK_DIALOG (dialog));
exit(1); /* TODO: fix */
@@ -305,6 +343,7 @@ static gboolean rip_track_foreach_cb (GtkTreeModel *model,
-1);
if (!extract) return FALSE;
pending = g_list_append (pending, track);
+ ++total_ripping;
return FALSE;
}
@@ -313,6 +352,7 @@ static void pop_and_rip (void)
TrackDetails *track;
char *file_path, *directory;
GError *error = NULL;
+ int left;
if (pending == NULL) {
gtk_widget_hide (progress_dialog);
@@ -322,9 +362,12 @@ static void pop_and_rip (void)
track = pending->data;
pending = g_list_next (pending);
- gtk_label_set_text (GTK_LABEL (progress_label), g_strdup_printf ("Currently extracting '%s'", track->title));
+ left = total_ripping - g_list_length (pending);
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (album_progress), (float)left/(float)total_ripping);
+
+ gtk_label_set_text (GTK_LABEL (progress_label), g_strdup_printf (_("Currently extracting '%s'"), track->title));
file_path = g_strdup_printf("%s/%s/%s.ogg", base_path, track->album->title, track->title); /* TODO: CRAP */
- /* TODO: create the folder */
+ /* TODO: create the folder, recurse */
directory = g_path_get_dirname (file_path);
if (!g_file_test (directory, G_FILE_TEST_IS_DIR)) {
int res;
@@ -356,6 +399,7 @@ void on_extract_activate (GtkWidget *button, gpointer user_data)
progress_dialog = glade_xml_get_widget (glade, "progress_dialog");
gtk_window_set_transient_for (GTK_WINDOW (progress_dialog), GTK_WINDOW (main_window));
track_progress = glade_xml_get_widget (glade, "track_progress");
+ album_progress = glade_xml_get_widget (glade, "album_progress");
progress_label = glade_xml_get_widget (glade, "progress_label");
g_assert (progress_dialog != NULL);
}
@@ -363,6 +407,7 @@ void on_extract_activate (GtkWidget *button, gpointer user_data)
/* Fill pending with a list of all tracks to rip */
g_list_free (pending);
+ total_ripping = 0;
gtk_tree_model_foreach (GTK_TREE_MODEL (track_store), rip_track_foreach_cb, NULL);
pop_and_rip();
}
@@ -421,9 +466,8 @@ static void on_extract_toggled (GtkCellRendererToggle *cellrenderertoggle,
static void on_progress_cb (int seconds)
{
- g_print ("Callback: %d\n", seconds);
- if (duration != 0) {
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (track_progress), (float)seconds/(float)duration);
+ if (track_duration != 0) {
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (track_progress), (float)seconds/(float)track_duration);
} else {
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (track_progress));
}
@@ -432,7 +476,6 @@ static void on_progress_cb (int seconds)
static void on_completion_cb (void)
{
- g_print ("Callback complete\n");
ripping = FALSE;
pop_and_rip ();
return;
@@ -457,11 +500,14 @@ int main (int argc, char **argv)
glade_xml_signal_autoconnect (glade);
main_window = glade_xml_get_widget (glade, "main_window");
+ select_all_menuitem = glade_xml_get_widget (glade, "select_all");
+ extract_menuitem = glade_xml_get_widget (glade, "extract_menuitem");
title_label = glade_xml_get_widget (glade, "title_label");
artist_label = glade_xml_get_widget (glade, "artist_label");
- basepath_label = glade_xml_get_widget (glade, "path_label"); /* from prefs, urgh */
+ duration_label = glade_xml_get_widget (glade, "duration_label");
+ basepath_label = glade_xml_get_widget (glade, "path_label"); /* TODO: from prefs, urgh. gconf it separately */
track_listview = glade_xml_get_widget (glade, "track_listview");
- cd_option = glade_xml_get_widget (glade, "cd_option"); /* hmm */
+ cd_option = glade_xml_get_widget (glade, "cd_option"); /* also from prefs, urgh */
extract_button = glade_xml_get_widget (glade, "extract_button");
reread_button = glade_xml_get_widget (glade, "reread_button");
@@ -473,32 +519,32 @@ int main (int argc, char **argv)
toggle_renderer = gtk_cell_renderer_toggle_new ();
g_signal_connect (toggle_renderer, "toggled", G_CALLBACK (on_extract_toggled), NULL);
- column = gtk_tree_view_column_new_with_attributes ("Extract?",
+ column = gtk_tree_view_column_new_with_attributes (_("Extract?"),
toggle_renderer,
"active", COLUMN_EXTRACT,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (track_listview), column);
text_renderer = gtk_cell_renderer_text_new (); /* TODO: is this cheating? */
- column = gtk_tree_view_column_new_with_attributes ("Track",
+ column = gtk_tree_view_column_new_with_attributes (_("Track"),
text_renderer,
"text", COLUMN_NUMBER,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (track_listview), column);
- column = gtk_tree_view_column_new_with_attributes ("Title",
+ column = gtk_tree_view_column_new_with_attributes (_("Title"),
text_renderer,
"text", COLUMN_TITLE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (track_listview), column);
- column = gtk_tree_view_column_new_with_attributes ("Artist",
+ column = gtk_tree_view_column_new_with_attributes (_("Artist"),
text_renderer,
"text", COLUMN_ARTIST,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (track_listview), column);
- column = gtk_tree_view_column_new_with_attributes ("Duration",
+ column = gtk_tree_view_column_new_with_attributes (_("Duration"),
text_renderer,
NULL);
gtk_tree_view_column_set_cell_data_func (column, text_renderer, duration_cell_data_cb, NULL, NULL);