[easytag/wip/musicbrainz-support-merge: 116/180] FIXME (split) Added more verbose Status Bar Messages and comments
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/musicbrainz-support-merge: 116/180] FIXME (split) Added more verbose Status Bar Messages and comments
- Date: Sat, 6 Sep 2014 17:01:51 +0000 (UTC)
commit dff1dac1eccd65b58a3a9f0b357953fd6fffb202
Author: Abhinav <abhijangda hotmail com>
Date: Sun May 25 12:11:33 2014 +0530
FIXME (split) Added more verbose Status Bar Messages and comments
Added function et_show_status_msg_in_idle to show messages in Status Bar
in a thread safe manner. Added more messages depicting more information.
src/mb_search.c | 99 +++++++++++++++++++++++++++++++++++++--------
src/mbentityview.c | 32 ++++++++-------
src/musicbrainz_dialog.c | 69 +++++++++++++++++++++++++++++++-
3 files changed, 166 insertions(+), 34 deletions(-)
---
diff --git a/src/mb_search.c b/src/mb_search.c
index f64865d..ad6f8c7 100644
--- a/src/mb_search.c
+++ b/src/mb_search.c
@@ -19,6 +19,7 @@
*/
#include "mb_search.h"
+#include "musicbrainz_dialog.h"
/*
* et_mb5_search_error_quark:
@@ -74,9 +75,14 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
int i;
Mb5ReleaseList list;
Mb5Artist artist;
+ gchar *message;
+
artist = mb5_metadata_get_artist (metadata);
list = mb5_artist_get_releaselist (artist);
param_values[0] = "artists release-groups";
+ message = g_strdup_printf ("Found %d Album(s)", mb5_release_list_size (list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
for (i = 0; i < mb5_release_list_size (list); i++)
{
@@ -85,14 +91,26 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
if (release)
{
Mb5Metadata metadata_release;
- gchar release_mbid [NAME_MAX_SIZE];
+ gchar buf [NAME_MAX_SIZE];
GNode *node;
EtMbEntity *entity;
- mb5_release_get_id ((Mb5Release)release,
- release_mbid,
- sizeof (release_mbid));
+ int size;
+
+ size = mb5_release_get_title ((Mb5Release)release, buf,
+ sizeof (buf));
+ buf [size] = '\0';
+ message = g_strdup_printf ("Retrieving %s (%d/%d)",
+ buf, i,
+ mb5_release_list_size (list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
+
+ size = mb5_release_get_id ((Mb5Release)release,
+ buf,
+ sizeof (buf));
+ buf [size] = '\0';
metadata_release = mb5_query_query (query, "release",
- release_mbid, "",
+ buf, "",
1, param_names,
param_values);
entity = g_malloc (sizeof (EtMbEntity));
@@ -139,24 +157,39 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
if (medium)
{
Mb5Metadata metadata_recording;
- gchar recording_mbid [NAME_MAX_SIZE];
+ gchar buf [NAME_MAX_SIZE];
GNode *node;
EtMbEntity *entity;
Mb5TrackList track_list;
int j;
+ int size;
+ gchar *message;
track_list = mb5_medium_get_tracklist (medium);
+ message = g_strdup_printf ("Found %d Track(s)", mb5_track_list_size (list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
for (j = 0; j < mb5_track_list_size (track_list); j++)
{
Mb5Recording recording;
recording = mb5_track_get_recording (mb5_track_list_item (track_list, j));
- mb5_recording_get_id (recording,
- recording_mbid,
- sizeof (recording_mbid));
+ size = mb5_recording_get_title (recording, buf,
+ sizeof (buf));
+ buf [size] = '\0';
+ message = g_strdup_printf ("Retrieving %s (%d/%d)",
+ buf, j,
+ mb5_track_list_size (track_list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
+
+ size = mb5_recording_get_id (recording,
+ buf,
+ sizeof (buf));
+
metadata_recording = mb5_query_query (query, "recording",
- recording_mbid, "",
+ buf, "",
1, param_names,
param_values);
entity = g_malloc (sizeof (EtMbEntity));
@@ -316,19 +349,35 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
for (i = 0; i < mb5_release_list_size (list); i++)
{
Mb5Release release;
+ gchar *message;
+
+ message = g_strdup_printf ("Found %d Album(s)", mb5_release_list_size (list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
+
release = mb5_release_list_item (list, i);
if (release)
{
Mb5Metadata metadata_release;
- gchar release_mbid [NAME_MAX_SIZE];
+ gchar buf [NAME_MAX_SIZE];
GNode *node;
EtMbEntity *entity;
+ int size;
+
+ size = mb5_release_get_title ((Mb5Release)release, buf,
+ sizeof (buf));
+ buf [size] = '\0';
+ message = g_strdup_printf ("Retrieving %s (%d/%d)",
+ buf, i,
+ mb5_release_list_size (list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
mb5_release_get_id ((Mb5Release)release,
- release_mbid,
- sizeof (release_mbid));
+ buf,
+ sizeof (buf));
metadata_release = mb5_query_query (query, "release",
- release_mbid, "",
+ buf, "",
1, param_names,
param_values);
entity = g_malloc (sizeof (EtMbEntity));
@@ -364,25 +413,39 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
{
int i;
Mb5RecordingList list;
+ gchar *message;
list = mb5_metadata_get_recordinglist (metadata);
param_names [0] = "inc";
param_values[0] = "releases artists";
+ message = g_strdup_printf ("Found %d Track(s)",
+ mb5_recording_list_size (list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
for (i = 0; i < mb5_recording_list_size (list); i++)
{
Mb5Recording recording;
Mb5Metadata metadata_recording;
- gchar recording_mbid [NAME_MAX_SIZE];
+ gchar buf [NAME_MAX_SIZE];
GNode *node;
EtMbEntity *entity;
+ int size;
recording = mb5_recording_list_item (list, i);
+ size = mb5_recording_get_title (recording, buf, sizeof (buf));
+ buf [size] = '\0';
+ message = g_strdup_printf ("Retrieving %s (%d/%d)",
+ buf, i,
+ mb5_track_list_size (list));
+ et_show_status_msg_in_idle (message);
+ g_free (message);
+
mb5_recording_get_id (recording,
- recording_mbid,
- sizeof (recording_mbid));
+ buf,
+ sizeof (buf));
metadata_recording = mb5_query_query (query, "recording",
- recording_mbid, "",
+ buf, "",
1, param_names,
param_values);
entity = g_malloc (sizeof (EtMbEntity));
diff --git a/src/mbentityview.c b/src/mbentityview.c
index c985eb5..48dcd57 100644
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -952,21 +952,22 @@ et_mb_entity_view_select_up (EtMbEntityView *entity_view)
EtMbEntityViewPrivate *priv;
GtkTreeSelection *selection;
GtkTreeIter iter;
+ GList *selected_rows;
priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
-
- if (!gtk_tree_selection_iter_is_selected (selection, &iter))
- {
- return;
- }
-
- if (!gtk_tree_model_iter_previous (priv->filter, &iter))
+ selected_rows = gtk_tree_selection_get_selected_rows (selection, &priv->filter);
+ gtk_tree_model_get_iter (priv->filter, &iter,
+ (g_list_first (selected_rows)->data));
+ if (!gtk_tree_model_iter_next (priv->filter, &iter))
{
- return;
+ goto exit;
}
gtk_tree_selection_select_iter (selection, &iter);
+
+ exit:
+ g_list_free_full (selected_rows, (GDestroyNotify)gtk_tree_path_free);
}
/*
@@ -981,21 +982,22 @@ et_mb_entity_view_select_down (EtMbEntityView *entity_view)
EtMbEntityViewPrivate *priv;
GtkTreeSelection *selection;
GtkTreeIter iter;
+ GList *selected_rows;
priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
-
- if (!gtk_tree_selection_iter_is_selected (selection, &iter))
- {
- return;
- }
-
+ selected_rows = gtk_tree_selection_get_selected_rows (selection, &priv->filter);
+ gtk_tree_model_get_iter (priv->filter, &iter,
+ g_list_last (selected_rows)->data);
if (!gtk_tree_model_iter_next (priv->filter, &iter))
{
- return;
+ goto exit;
}
gtk_tree_selection_select_iter (selection, &iter);
+
+ exit:
+ g_list_free_full (selected_rows, (GDestroyNotify)gtk_tree_path_free);
}
/*
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index f3a4f50..33b9025 100644
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -119,6 +119,14 @@ et_show_status_msg_in_idle (gchar *message)
g_simple_async_result_complete_in_idle (async_res);
}
+/*
+ * et_show_status_msg_in_idle_cb:
+ * @obj: Source Object
+ * @res: GAsyncResult
+ * @user_data: User data
+ *
+ * Callback function for Displaying StatusBar Message.
+ */
void
mb5_search_error_callback (GObject *source, GAsyncResult *res,
gpointer user_data)
@@ -220,36 +228,78 @@ tool_btn_toggle_red_lines_clicked (GtkWidget *btn, gpointer user_data)
et_mb_entity_view_toggle_red_lines (ET_MB_ENTITY_VIEW (entityView));
}
+/*
+ * btn_manual_stop_clicked:
+ * @btn: GtkButton
+ * @user_data: User data
+ *
+ * Signal Handler for "clicked" signal of toolbtnUp.
+ */
static void
tool_btn_up_clicked (GtkWidget *btn, gpointer user_data)
{
et_mb_entity_view_select_up (ET_MB_ENTITY_VIEW (entityView));
}
+/*
+ * btn_manual_stop_clicked:
+ * @btn: GtkButton
+ * @user_data: User data
+ *
+ * Signal Handler for "clicked" signal of toolbtnDown.
+ */
static void
tool_btn_down_clicked (GtkWidget *btn, gpointer user_data)
{
et_mb_entity_view_select_down (ET_MB_ENTITY_VIEW (entityView));
}
+/*
+ * btn_manual_stop_clicked:
+ * @btn: GtkButton
+ * @user_data: User data
+ *
+ * Signal Handler for "clicked" signal of toolbtnInvertSelection.
+ */
static void
tool_btn_invert_selection_clicked (GtkWidget *btn, gpointer user_data)
{
et_mb_entity_view_invert_selection (ET_MB_ENTITY_VIEW (entityView));
}
+/*
+ * btn_manual_stop_clicked:
+ * @btn: GtkButton
+ * @user_data: User data
+ *
+ * Signal Handler for "clicked" signal of toolbtnSelectAll.
+ */
static void
tool_btn_select_all_clicked (GtkWidget *btn, gpointer user_data)
{
et_mb_entity_view_select_all (ET_MB_ENTITY_VIEW (entityView));
}
+/*
+ * btn_manual_stop_clicked:
+ * @btn: GtkButton
+ * @user_data: User data
+ *
+ * Signal Handler for "clicked" signal of toolbtnUnselectAll.
+ */
static void
tool_btn_unselect_all_clicked (GtkWidget *btn, gpointer user_data)
{
et_mb_entity_view_unselect_all (ET_MB_ENTITY_VIEW (entityView));
}
+/*
+ * btn_manual_stop_clicked:
+ * @btn: GtkButton
+ * @user_data: User data
+ *
+ * Signal Handler for "clicked" signal of btnManualStop.
+ */
static void
tool_btn_refersh_clicked (GtkWidget *btn, gpointer user_data)
{
@@ -262,17 +312,31 @@ tool_btn_refersh_clicked (GtkWidget *btn, gpointer user_data)
}
}
+/*
+ * btn_manual_stop_clicked:
+ * @btn: GtkButton
+ * @user_data: User data
+ *
+ * Signal Handler for "clicked" signal of btnManualStop.
+ */
static void
btn_manual_stop_clicked (GtkWidget *btn, gpointer user_data)
{
g_cancellable_cancel (mb5_search_cancellable);
}
+/*
+ * entry_tree_view_search_changed:
+ * @editable: GtkEditable for which handler is called
+ * @user_data: User data
+ *
+ * Signal Handler for "changed" signal of entryTreeViewSearch.
+ */
static void
entry_tree_view_search_changed (GtkEditable *editable, gpointer user_data)
{
et_mb_entity_view_search_in_results (ET_MB_ENTITY_VIEW (entityView),
- gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder,
"entryTreeViewSearch"))));
+ gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder,
"entryTreeViewSearch"))));
}
/*
@@ -330,6 +394,9 @@ et_open_musicbrainz_dialog ()
g_signal_connect (gtk_builder_get_object (builder, "toolbtnInvertSelection"),
"clicked", G_CALLBACK (tool_btn_invert_selection_clicked),
NULL);
+ g_signal_connect (gtk_builder_get_object (builder, "toolbtnToggleRedLines"),
+ "clicked", G_CALLBACK (tool_btn_toggle_red_lines_clicked),
+ NULL);
g_signal_connect_after (gtk_builder_get_object (builder, "entryTreeViewSearch"),
"changed",
G_CALLBACK (entry_tree_view_search_changed),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]