[rhythmbox] Bug 535065 – If a cd is not listed in musicbrainz it can not be added.
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] Bug 535065 – If a cd is not listed in musicbrainz it can not be added.
- Date: Fri, 7 Aug 2009 14:22:40 +0000 (UTC)
commit 34ce7e378c4748e01eff0eb18bd82c04c90a0172
Author: Bastien Nocera <hadess hadess net>
Date: Fri Aug 7 15:19:32 2009 +0100
Bug 535065 â?? If a cd is not listed in musicbrainz it can not be added.
Add infobar to ask the user to enter the metadata into
MusicBrainz.
configure.ac | 4 +-
plugins/audiocd/album-info.ui | 30 +++++++++-------
plugins/audiocd/rb-audiocd-source.c | 66 ++++++++++++++++++++++++++++++++++-
3 files changed, 84 insertions(+), 16 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 153d344..1644096 100644
--- a/configure.ac
+++ b/configure.ac
@@ -353,8 +353,8 @@ have_sj_metadata_getter=no
AC_ARG_ENABLE(musicbrainz, AC_HELP_STRING([--disable-musicbrainz],
[don't build with MusicBrainz support]))
if test x"$enable_musicbrainz" != "xno"; then
- PKG_CHECK_MODULES(MUSICBRAINZ3, libmusicbrainz3 >= $MUSICBRAINZ3_REQS, [have_musicbrainz3=yes], [have_musicbrainz3=no])
- PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz >= $MUSICBRAINZ_REQS, [have_musicbrainz=yes], [have_musicbrainz=no])
+ PKG_CHECK_MODULES(MUSICBRAINZ3, libmusicbrainz3 >= $MUSICBRAINZ3_REQS gtk+-2.0 >= 2.17.6, [have_musicbrainz3=yes], [have_musicbrainz3=no])
+ PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz >= $MUSICBRAINZ_REQS gtk+-2.0 >= 2.17.6, [have_musicbrainz=yes], [have_musicbrainz=no])
AC_SUBST(MUSICBRAINZ3_CFLAGS)
AC_SUBST(MUSICBRAINZ3_LIBS)
diff --git a/plugins/audiocd/album-info.ui b/plugins/audiocd/album-info.ui
index 471f0f3..0f2bcd6 100644
--- a/plugins/audiocd/album-info.ui
+++ b/plugins/audiocd/album-info.ui
@@ -5,7 +5,7 @@
<object class="GtkTable" id="album_info">
<property name="visible">True</property>
<property name="border_width">6</property>
- <property name="n_rows">4</property>
+ <property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -19,6 +19,8 @@
<property name="mnemonic_widget">album_entry</property>
</object>
<packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -33,8 +35,8 @@
<property name="mnemonic_widget">artist_entry</property>
</object>
<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_SHRINK | GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -48,6 +50,8 @@
<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>
</packing>
</child>
<child>
@@ -130,8 +134,8 @@
<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">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_SHRINK | GTK_FILL</property>
</packing>
@@ -146,8 +150,8 @@
<property name="mnemonic_widget">genre_entry</property>
</object>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
@@ -161,8 +165,8 @@
<property name="mnemonic_widget">artist_sort_entry</property>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
@@ -175,8 +179,8 @@
<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="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
<child>
@@ -188,8 +192,8 @@
<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="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
</object>
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index 53b1b54..c502ac2 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -93,6 +93,9 @@ static gboolean update_album_cb (GtkWidget *widget, GdkEventFocus *event, RBAudi
static gboolean update_genre_cb (GtkWidget *widget, GdkEventFocus *event, RBAudioCdSource *source);
static gboolean update_year_cb (GtkWidget *widget, GdkEventFocus *event, RBAudioCdSource *source);
static gboolean update_disc_number_cb (GtkWidget *widget, GdkEventFocus *event, RBAudioCdSource *source);
+#ifdef HAVE_SJ_METADATA_GETTER
+static void info_bar_response_cb (GtkInfoBar *info_bar, gint response_id, RBAudioCdSource *source);
+#endif
typedef struct
{
@@ -114,6 +117,11 @@ typedef struct
#ifdef HAVE_SJ_METADATA_GETTER
GtkActionGroup *action_group;
SjMetadataGetter *metadata;
+
+ GtkWidget *info_bar;
+ GtkWidget *info_bar_label;
+
+ char *submit_url;
#endif
} RBAudioCdSourcePrivate;
@@ -126,7 +134,7 @@ static AlbumDetails* multiple_album_dialog (GList *albums, RBAudioCdSource *sour
static GtkActionEntry rb_audiocd_source_actions [] =
{
{ "AudioCdSourceReloadMetadata", GTK_STOCK_REFRESH, N_("Reload"), NULL,
- N_("Reload Metadata"),
+ N_("Reload Album Information"),
G_CALLBACK (rb_audiocd_source_cmd_reload_metadata) },
};
#endif
@@ -198,6 +206,8 @@ rb_audiocd_source_finalize (GObject *object)
g_object_unref (priv->action_group);
priv->action_group = NULL;
}
+ g_free (priv->submit_url);
+ priv->submit_url = NULL;
#endif
if (priv->tracks) {
@@ -279,6 +289,10 @@ rb_audiocd_source_constructor (GType type,
RBAudioCdSourcePrivate *priv;
GtkWidget *table;
GtkBuilder *builder;
+#ifdef HAVE_SJ_METADATA_GETTER
+ GtkWidget *box;
+ char *message;
+#endif
priv = AUDIOCD_SOURCE_GET_PRIVATE (source);
@@ -288,6 +302,26 @@ rb_audiocd_source_constructor (GType type,
table = GTK_WIDGET (gtk_builder_get_object (builder, "album_info"));
g_assert (table != NULL);
+#ifdef HAVE_SJ_METADATA_GETTER
+ /* Info bar for non-Musicbrainz data */
+ priv->info_bar = gtk_info_bar_new_with_buttons (_("S_ubmit Album"), GTK_RESPONSE_OK,
+ _("Hide"), GTK_RESPONSE_CANCEL,
+ NULL);
+ message = g_strdup_printf ("<b>%s</b>\n%s", _("Could not find this album on MusicBrainz."),
+ _("You can improve the MusicBrainz database by adding this album."));
+ priv->info_bar_label = gtk_label_new (NULL);
+ gtk_label_set_markup (GTK_LABEL (priv->info_bar_label), message);
+ gtk_label_set_justify (GTK_LABEL (priv->info_bar_label), GTK_JUSTIFY_LEFT);
+ g_free (message);
+ box = gtk_info_bar_get_content_area (GTK_INFO_BAR (priv->info_bar));
+ gtk_container_add (GTK_CONTAINER (box), priv->info_bar_label);
+ gtk_widget_show_all (box);
+ gtk_widget_set_no_show_all (priv->info_bar, TRUE);
+ g_signal_connect (G_OBJECT (priv->info_bar), "response",
+ G_CALLBACK (info_bar_response_cb), source);
+ gtk_table_attach_defaults (GTK_TABLE (table), priv->info_bar, 0, 2, 0, 1);
+#endif
+
priv->artist_entry = GTK_WIDGET (gtk_builder_get_object (builder, "artist_entry"));
priv->artist_sort_entry = GTK_WIDGET (gtk_builder_get_object (builder, "artist_sort_entry"));
priv->album_entry = GTK_WIDGET (gtk_builder_get_object (builder, "album_entry"));
@@ -708,6 +742,9 @@ metadata_cb (SjMetadataGetter *metadata,
g_value_init (&true_value, G_TYPE_BOOLEAN);
g_value_set_boolean (&true_value, TRUE);
+ g_free (priv->submit_url);
+ priv->submit_url = NULL;
+
/* if we have multiple results, ask the user to pick one */
if (g_list_length (albums) > 1) {
album = multiple_album_dialog (albums, source);
@@ -716,6 +753,12 @@ metadata_cb (SjMetadataGetter *metadata,
} else
album = (AlbumDetails *)albums->data;
+ if (album->metadata_source != SOURCE_MUSICBRAINZ) {
+ priv->submit_url = sj_metadata_getter_get_submit_url (metadata);
+ if (priv->submit_url != NULL)
+ gtk_widget_show (priv->info_bar);
+ }
+
if (album->metadata_source == SOURCE_FALLBACK) {
rb_debug ("ignoring CD metadata from fallback source");
g_object_unref (metadata);
@@ -1177,3 +1220,24 @@ update_disc_number_cb (GtkWidget *widget, GdkEventFocus *event, RBAudioCdSource
return FALSE;
}
+#ifdef HAVE_SJ_METADATA_GETTER
+static void
+info_bar_response_cb (GtkInfoBar *info_bar, gint response_id, RBAudioCdSource *source)
+{
+ RBAudioCdSourcePrivate *priv = AUDIOCD_SOURCE_GET_PRIVATE (source);
+ GError *error = NULL;
+
+ g_return_if_fail (priv->submit_url != NULL);
+
+ if (response_id == GTK_RESPONSE_OK) {
+ if (!gtk_show_uri (NULL, priv->submit_url, GDK_CURRENT_TIME, &error)) {
+ rb_debug ("Could not launch submit URL %s: %s", priv->submit_url, error->message);
+ g_error_free (error);
+ return;
+ }
+ }
+
+ gtk_widget_hide (priv->info_bar);
+}
+#endif
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]