[easytag/wip/musicbrainz-support-merge: 34/75] Use USERAGENT and Coding Style Changes



commit 790b15fecd85e7cd3bdd5c03abb78dfcd2d50bc0
Author: Abhinav <abhijangda hotmail com>
Date:   Thu Jul 24 17:05:14 2014 +0530

    Use USERAGENT and Coding Style Changes

 src/mb_search.c          |  105 +++++++++++++++++++++----------------
 src/mbentityview.c       |  130 +++++++++++++++++++++++-----------------------
 src/musicbrainz_dialog.c |   14 +++---
 3 files changed, 131 insertions(+), 118 deletions(-)
---
diff --git a/src/mb_search.c b/src/mb_search.c
index 5cb7a63..f7822bf 100755
--- a/src/mb_search.c
+++ b/src/mb_search.c
@@ -30,6 +30,7 @@
 static gchar *server = NULL;
 static int port = 0;
 
+#define USER_AGENT PACKAGE_NAME"/"PACKAGE_VERSION" ( "PACKAGE_URL" ) "
 #define CHECK_CANCELLED(cancellable) if (g_cancellable_is_cancelled (cancellable))\
                                      {\
                                            g_set_error (error, ET_MB5_SEARCH_ERROR,\
@@ -64,9 +65,6 @@ et_mb5_recording_get_artists_names (Mb5Recording recording)
 {
     GString *artist;
     Mb5ArtistCredit artist_credit;
-    int i;
-    int size;
-    gchar title [NAME_MAX_SIZE];
 
     artist_credit = mb5_recording_get_artistcredit (recording);
     artist = g_string_new ("");
@@ -74,6 +72,9 @@ et_mb5_recording_get_artists_names (Mb5Recording recording)
     if (artist_credit)
     {
         Mb5NameCreditList name_list;
+        int i;
+        int size;
+        gchar title[NAME_MAX_SIZE];
 
         name_list = mb5_artistcredit_get_namecreditlist (artist_credit);
 
@@ -109,7 +110,6 @@ gchar *
 et_mb5_release_get_artists_names (Mb5Release release)
 {
     GString *album_artist;
-    int i;
     Mb5ArtistCredit artist_credit;
 
     album_artist = g_string_new ("");
@@ -119,6 +119,7 @@ et_mb5_release_get_artists_names (Mb5Release release)
     {
         Mb5NameCreditList name_list;
         gchar temp[NAME_MAX_SIZE];
+        int i;
 
         name_list = mb5_artistcredit_get_namecreditlist (artist_credit);
 
@@ -190,13 +191,13 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
 
     CHECK_CANCELLED(cancellable);
 
-    param_names [0] = "inc";
-    query = mb5_query_new ("easytag", server, port);
+    param_names[0] = "inc";
+    query = mb5_query_new (USER_AGENT, server, port);
 
     if (child_type == MB_ENTITY_KIND_ALBUM &&
         parent_type == MB_ENTITY_KIND_ARTIST)
     {
-        param_values [0] = "releases";
+        param_values[0] = "releases";
         metadata = mb5_query_query (query, "artist", parent_mbid, "", 1,
                                     param_names, param_values);
         result = mb5_query_get_lastresult (query);
@@ -214,7 +215,9 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
                 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)"),
+                message = g_strdup_printf (ngettext (_("Found %d Album"),
+                                           _("Found %d Albums"),
+                                           mb5_release_list_size (list)),
                                            mb5_release_list_size (list));
 #ifndef TEST
                 et_show_status_msg_in_idle (message);
@@ -229,7 +232,7 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
                     if (release)
                     {
                         Mb5Metadata metadata_release;
-                        gchar buf [NAME_MAX_SIZE];
+                        gchar buf[NAME_MAX_SIZE];
                         GNode *node;
                         EtMbEntity *entity;
                         int size;
@@ -237,7 +240,7 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
                         CHECK_CANCELLED(cancellable);
                         size = mb5_release_get_title ((Mb5Release)release, buf,
                                                       sizeof (buf));
-                        buf [size] = '\0';
+                        buf[size] = '\0';
                         message = g_strdup_printf (_("Retrieving %s (%d/%d)"),
                                                    buf, i+1,
                                                    mb5_release_list_size (list));
@@ -249,7 +252,7 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
                         size = mb5_release_get_id ((Mb5Release)release,
                                                    buf,
                                                    sizeof (buf));
-                        buf [size] = '\0';
+                        buf[size] = '\0';
                         metadata_release = mb5_query_query (query, "release",
                                                             buf, "",
                                                             1, param_names,
@@ -276,7 +279,7 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
     else if (child_type == MB_ENTITY_KIND_TRACK &&
              parent_type == MB_ENTITY_KIND_ALBUM)
     {
-        param_values [0] = "recordings";
+        param_values[0] = "recordings";
         CHECK_CANCELLED(cancellable);
         metadata = mb5_query_query (query, "release", parent_mbid, "", 1,
                                     param_names, param_values);
@@ -302,7 +305,7 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
                     if (medium)
                     {
                         Mb5Metadata metadata_recording;
-                        gchar buf [NAME_MAX_SIZE];
+                        gchar buf[NAME_MAX_SIZE];
                         GNode *node;
                         EtMbEntity *entity;
                         Mb5TrackList track_list;
@@ -311,7 +314,9 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
                         gchar *message;
 
                         track_list = mb5_medium_get_tracklist (medium);
-                        message = g_strdup_printf (_("Found %d Track(s)"),
+                        message = g_strdup_printf (ngettext (_("Found %d Track"),
+                                                   _("Found %d Tracks"),
+                                                   mb5_track_list_size (list)),
                                                    mb5_track_list_size (list));
 #ifndef TEST
                         et_show_status_msg_in_idle (message);
@@ -336,7 +341,7 @@ et_musicbrainz_search_in_entity (MbEntityKind child_type,
                             recording = mb5_track_get_recording (mb5_track_list_item (track_list, j));
                             size = mb5_recording_get_title (recording, buf,
                                                             sizeof (buf));
-                            buf [size] = '\0';
+                            buf[size] = '\0';
                             message = g_strdup_printf (_("Retrieving %s (%d/%d)"),
                                                        buf, j,
                                                        mb5_track_list_size (track_list));
@@ -455,10 +460,10 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
 
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-    param_names [0] = "query";
-    param_names [1] = "limit";
-    param_values [1] = SEARCH_LIMIT_STR;
-    query = mb5_query_new ("easytag", server, port);
+    param_names[0] = "query";
+    param_names[1] = "limit";
+    param_values[1] = SEARCH_LIMIT_STR;
+    query = mb5_query_new (USER_AGENT, server, port);
 
     if (g_cancellable_is_cancelled (cancellable))
     {
@@ -472,10 +477,10 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
 
     if (type == MB_ENTITY_KIND_ARTIST)
     {
-        param_values [0] = g_strconcat ("artist:", string, NULL);
+        param_values[0] = g_strconcat ("artist:", string, NULL);
         metadata = mb5_query_query (query, "artist", "", "", 2, param_names,
                                     param_values);
-        g_free (param_values [0]);
+        g_free (param_values[0]);
         result = mb5_query_get_lastresult (query);
 
         if (result == eQuery_Success)
@@ -517,11 +522,11 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
 
     else if (type == MB_ENTITY_KIND_ALBUM)
     {
-        param_values [0] = g_strconcat ("release:", string, NULL);
+        param_values[0] = g_strconcat ("release:", string, NULL);
         metadata = mb5_query_query (query, "release", "", "", 2, param_names,
                                     param_values);
         result = mb5_query_get_lastresult (query);
-        g_free (param_values [0]);
+        g_free (param_values[0]);
 
         if (result == eQuery_Success)
         {
@@ -532,9 +537,11 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                 gchar *message;
 
                 list = mb5_metadata_get_releaselist (metadata);
-                param_names [0] = "inc";
-                param_values [0] = "artists release-groups";
-                message = g_strdup_printf (_("Found %d Album(s)"),
+                param_names[0] = "inc";
+                param_values[0] = "artists release-groups";
+                message = g_strdup_printf (ngettext (_("Found %d Albums"),
+                                           _("Found %d Albums"), 
+                                           mb5_release_list_size (list)),
                                            mb5_release_list_size (list));
 #ifndef TEST
                 et_show_status_msg_in_idle (message);
@@ -551,14 +558,14 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                     if (release)
                     {
                         Mb5Metadata metadata_release;
-                        gchar buf [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';
+                        buf[size] = '\0';
                         message = g_strdup_printf (_("Retrieving %s (%d/%d)"),
                                                    buf, i,
                                                    mb5_release_list_size (list));
@@ -597,11 +604,11 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
 
     else if (type == MB_ENTITY_KIND_TRACK)
     {
-        param_values [0] = g_strconcat ("recordings:", string, NULL);
+        param_values[0] = g_strconcat ("recordings:", string, NULL);
         metadata = mb5_query_query (query, "recording", "", "", 2,
                                     param_names, param_values);
         result = mb5_query_get_lastresult (query);
-        g_free (param_values [0]);
+        g_free (param_values[0]);
 
         if (result == eQuery_Success)
         {
@@ -612,9 +619,11 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                 gchar *message;
 
                 list = mb5_metadata_get_recordinglist (metadata);
-                param_names [0] = "inc";
+                param_names[0] = "inc";
                 param_values[0] = "releases artists artist-credits release-groups";
-                message = g_strdup_printf (_("Found %d Track(s)"),
+                message = g_strdup_printf (ngettext (_("Found %d Track"),
+                                           _("Found %d Tracks"),
+                                           mb5_recording_list_size (list)),
                                            mb5_recording_list_size (list));
 #ifndef TEST
                 et_show_status_msg_in_idle (message);
@@ -625,7 +634,7 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                 {
                     Mb5Recording recording;
                     Mb5Metadata metadata_recording;
-                    gchar buf [NAME_MAX_SIZE];
+                    gchar buf[NAME_MAX_SIZE];
                     GNode *node;
                     EtMbEntity *entity;
                     int size;
@@ -633,7 +642,7 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                     CHECK_CANCELLED(cancellable);
                     recording = mb5_recording_list_item (list, i);
                     size = mb5_recording_get_title (recording, buf, sizeof (buf));
-                    buf [size] = '\0';
+                    buf[size] = '\0';
                     message = g_strdup_printf (_("Retrieving %s (%d/%d)"),
                                                buf, i,
                                                mb5_track_list_size (list));
@@ -671,7 +680,7 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
     else if (type == MB_ENTITY_KIND_DISCID)
     {
         param_names[0] = "toc";
-        param_values [0] = "";
+        param_values[0] = "";
         metadata = mb5_query_query (query, "discid", string, "", 1, param_names,
                                     param_values);
         result = mb5_query_get_lastresult (query);
@@ -687,9 +696,11 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
 
                 disc = mb5_metadata_get_disc (metadata);
                 list = mb5_disc_get_releaselist (disc);
-                param_names [0] = "inc";
-                param_values [0] = "artists release-groups";
-                message = g_strdup_printf (_("Found %d Album(s)"),
+                param_names[0] = "inc";
+                param_values[0] = "artists release-groups";
+                message = g_strdup_printf (ngettext (_("Found %d Album"),
+                                           _("Found %d Albums"),
+                                           mb5_release_list_size (list)),
                                            mb5_release_list_size (list));
 #ifndef TEST
                 et_show_status_msg_in_idle (message);
@@ -706,14 +717,14 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                     if (release)
                     {
                         Mb5Metadata metadata_release;
-                        gchar buf [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';
+                        buf[size] = '\0';
                         message = g_strdup_printf (_("Retrieving %s (%d/%d)"),
                                                    buf, i,
                                                    mb5_release_list_size (list));
@@ -750,11 +761,11 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
     }
     else if (type == MB_ENTITY_KIND_FREEDBID)
     {
-        param_values [0] = g_strconcat ("discid:", string, NULL);
+        param_values[0] = g_strconcat ("discid:", string, NULL);
         metadata = mb5_query_query (query, "freedb", "", "", 2, param_names,
                                     param_values);
         result = mb5_query_get_lastresult (query);
-        g_free (param_values [0]);
+        g_free (param_values[0]);
 
         if (result == eQuery_Success)
         {
@@ -765,10 +776,12 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                 gchar *message;
 
                 list = mb5_metadata_get_freedbdisclist (metadata);
-                message = g_strdup_printf (_("Found %d Result(s)"),
+                message = g_strdup_printf (ngettext (_("Found %d Result"),
+                                           _("Found %d Results"),
+                                           mb5_freedbdisc_list_size (list)), 
                                            mb5_freedbdisc_list_size (list));
 #ifndef TEST
-                //et_show_status_msg_in_idle (message);
+                et_show_status_msg_in_idle (message);
 #endif
                 g_free (message);
 
@@ -781,14 +794,14 @@ et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
 
                     if (freedbdisc)
                     {
-                        gchar buf [NAME_MAX_SIZE];
+                        gchar buf[NAME_MAX_SIZE];
                         GNode *node;
                         EtMbEntity *entity;
                         int size;
 
                         size = mb5_freedbdisc_get_title (freedbdisc,
                                                          buf, sizeof (buf));
-                        buf [size] = '\0';
+                        buf[size] = '\0';
                         entity = g_slice_new (EtMbEntity);
                         entity->entity = mb5_freedbdisc_clone (freedbdisc);
                         entity->type = MB_ENTITY_KIND_FREEDBID;
diff --git a/src/mbentityview.c b/src/mbentityview.c
index 698e034..8ad2b0c 100644
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -39,14 +39,6 @@ G_DEFINE_TYPE (EtMbEntityView, et_mb_entity_view, GTK_TYPE_BOX)
 /***************
  * Declaration *
  ***************/
-
-char *columns [MB_ENTITY_KIND_COUNT][10] = {
-    {"Name", "Gender", "Type"},
-    {"Name", "Artist", "Type"},
-    {"Name", "Album", "Artist", "Time"},
-    {"FreeDB ID", "Title", "Artist"}
-    };
-
 /*
  * ET_MB_DISPLAY_RESULTS:
  * @ET_MB_DISPLAY_RESULTS_ALL: Display all results.
@@ -60,8 +52,6 @@ enum ET_MB_DISPLAY_RESULTS
     ET_MB_DISPLAY_RESULTS_SEARCH = 1 << 1,
 };
 
-static GSimpleAsyncResult *async_result;
-
 /*
  * EtMbEntityViewPrivate:
  * @bread_crumb_box: GtkBox which represents the BreadCrumbWidget
@@ -263,6 +253,8 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
     int minutes;
     int seconds;
     GtkTreeIter iter;
+    static const GdkRGBA red = {1, 0, 0, 0};
+    static const GdkRGBA black = {0, 0, 0, 0};
 
     type = ((EtMbEntity *)node->data)->type;
     while (node)
@@ -275,9 +267,9 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
         {
             case MB_ENTITY_KIND_ARTIST:
             {
-                gchar gender [NAME_MAX_SIZE];
-                gchar type [NAME_MAX_SIZE];               
-                gchar name [NAME_MAX_SIZE];
+                gchar gender[NAME_MAX_SIZE];
+                gchar type[NAME_MAX_SIZE];               
+                gchar name[NAME_MAX_SIZE];
 
                 mb5_artist_get_name ((Mb5Artist)entity, name, sizeof (name));
                 mb5_artist_get_gender ((Mb5Artist)entity, gender,
@@ -294,7 +286,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                                                        MB_ARTIST_COLUMNS_TYPE,
                                                        type,
                                                        MB_ARTIST_COLUMNS_N,
-                                                       "red", -1);
+                                                       &red, -1);
                 }
                 else
                 {
@@ -306,7 +298,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                                                        MB_ARTIST_COLUMNS_TYPE,
                                                        type,
                                                        MB_ARTIST_COLUMNS_N,
-                                                       "black", -1);
+                                                       &black, -1);
                 }
 
                 break;
@@ -314,9 +306,9 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
 
             case MB_ENTITY_KIND_ALBUM:
             {
-                gchar group [NAME_MAX_SIZE];
+                gchar group[NAME_MAX_SIZE];
                 GString *gstring;
-                gchar name [NAME_MAX_SIZE];
+                gchar name[NAME_MAX_SIZE];
 
                 release_group = mb5_release_get_releasegroup ((Mb5Release)entity);
                 mb5_releasegroup_get_primarytype (release_group, group,
@@ -359,7 +351,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                                                        MB_ALBUM_COLUMNS_TYPE,
                                                        group,
                                                        MB_ALBUM_COLUMNS_N,
-                                                       "red", -1);
+                                                       &red, -1);
                 }
                 else
                 {
@@ -368,7 +360,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                                         MB_ALBUM_COLUMNS_ARTIST,
                                         gstring->str,
                                         MB_ALBUM_COLUMNS_TYPE, group,
-                                        MB_ALBUM_COLUMNS_N, "black", -1);
+                                        MB_ALBUM_COLUMNS_N, &black, -1);
                 }
 
                 g_string_free (gstring, TRUE);
@@ -380,8 +372,8 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
             {
                 GString *artists;
                 GString *releases;
-                gchar name [NAME_MAX_SIZE];
-                gchar time [NAME_MAX_SIZE];
+                gchar name[NAME_MAX_SIZE];
+                gchar time[NAME_MAX_SIZE];
 
                 artist_credit = mb5_recording_get_artistcredit ((Mb5Release)entity);
                 artists = g_string_new ("");
@@ -429,7 +421,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                         release = mb5_release_list_item (release_list, i);
                         size = mb5_releasegroup_get_id (mb5_release_get_releasegroup (release),
                                                         name, sizeof (name));
-                        name [size] = '\0';
+                        name[size] = '\0';
 
                         if (g_hash_table_contains (hash_table, name))
                         {
@@ -455,7 +447,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                 seconds = mb5_recording_get_length ((Mb5Recording)entity)%60000;
                 i = g_snprintf (time, NAME_MAX_SIZE, "%d:%d", minutes,
                                 seconds/1000);
-                time [i] = '\0';
+                time[i] = '\0';
                 mb5_recording_get_title ((Mb5Recording)entity, name,
                                          sizeof (name));
                 gtk_list_store_insert_with_values (list_store, &iter, -1,
@@ -474,9 +466,9 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
 
             case MB_ENTITY_KIND_FREEDBID:
             {
-                gchar freedbid [NAME_MAX_SIZE];
-                gchar title [NAME_MAX_SIZE];
-                gchar artist [NAME_MAX_SIZE];
+                gchar freedbid[NAME_MAX_SIZE];
+                gchar title[NAME_MAX_SIZE];
+                gchar artist[NAME_MAX_SIZE];
 
                 mb5_freedbdisc_get_artist ((Mb5FreeDBDisc)entity,
                                            artist, sizeof (artist));
@@ -517,6 +509,12 @@ show_data_in_entity_view (EtMbEntityView *entity_view)
     int i, total_cols, type;
     GList *list_cols, *list;
     GType *types;
+    static const gchar *columns[MB_ENTITY_KIND_COUNT][10] = {
+        {N_("Name"), N_("Gender"), N_("Type")},
+        {N_("Name"), N_("Artist"), N_("Type")},
+        {"Name", "Album", "Artist", "Time"},
+        {"FreeDB ID", "Title", "Artist"}
+    };
 
     priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
 
@@ -573,17 +571,17 @@ show_data_in_entity_view (EtMbEntityView *entity_view)
 
     for (i = 0; i < total_cols; i++)
     {
-        types [i] = G_TYPE_STRING;
+        types[i] = G_TYPE_STRING;
         renderer = gtk_cell_renderer_text_new ();
         column = gtk_tree_view_column_new_with_attributes (columns[type][i],
                                                            renderer, "text",
-                                                           i, "foreground",
+                                                           i, "foreground-rgba",
                                                            total_cols, NULL);
         gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), column);
     }
 
     /* Setting the colour column */
-    types [total_cols] = G_TYPE_STRING;
+    types[total_cols] = GDK_TYPE_RGBA;
     priv->list_store = GTK_TREE_MODEL (gtk_list_store_newv (total_cols + 1,
                                                             types));
     priv->filter = GTK_TREE_MODEL (gtk_tree_model_filter_new (priv->list_store,
@@ -695,7 +693,7 @@ search_in_levels_callback (GObject *source, GAsyncResult *res,
     
         toggle_btn = insert_togglebtn_in_breadcrumb (GTK_BOX (priv->bread_crumb_box));
         children = gtk_container_get_children (GTK_CONTAINER (priv->bread_crumb_box));
-        priv->bread_crumb_nodes [g_list_length (children) - 1] = thread_data->child;
+        priv->bread_crumb_nodes[g_list_length (children) - 1] = thread_data->child;
     
         if (priv->active_toggle_button)
         {
@@ -745,10 +743,10 @@ search_in_levels_thread_func (GSimpleAsyncResult *res, GObject *obj,
                               GCancellable *cancellable)
 {
     SearchInLevelThreadData *thread_data;
-    gchar mbid [NAME_MAX_SIZE];
-    GError *error;
+    gchar mbid[NAME_MAX_SIZE];
+    GError *error = NULL;
     gchar *status_msg;
-    gchar parent_entity_str [NAME_MAX_SIZE];
+    gchar parent_entity_str[NAME_MAX_SIZE];
     gchar *child_entity_type_str;
     MbEntityKind to_search;
 
@@ -767,38 +765,39 @@ search_in_levels_thread_func (GSimpleAsyncResult *res, GObject *obj,
         return;
     }
 
-    if (((EtMbEntity *)thread_data->child->data)->type ==
-        MB_ENTITY_KIND_ARTIST)
-    {
-        child_entity_type_str = g_strdup ("Albums ");
-        mb5_artist_get_id (((EtMbEntity *)thread_data->child->data)->entity,
-                           mbid, sizeof (mbid));
-        mb5_artist_get_name (((EtMbEntity *)thread_data->child->data)->entity,
-                             parent_entity_str, sizeof (parent_entity_str));
-        to_search = MB_ENTITY_KIND_ALBUM;
-    }
-    else if (((EtMbEntity *)thread_data->child->data)->type ==
-             MB_ENTITY_KIND_ALBUM)
+    switch (((EtMbEntity *)thread_data->child->data)->type)
     {
-        child_entity_type_str = g_strdup ("Tracks ");
-        mb5_release_get_id (((EtMbEntity *)thread_data->child->data)->entity,
-                            mbid, sizeof (mbid));
-        mb5_release_get_title (((EtMbEntity *)thread_data->child->data)->entity,
-                               parent_entity_str, sizeof (parent_entity_str));
-        to_search = MB_ENTITY_KIND_TRACK;
-    }
-    else if (((EtMbEntity *)thread_data->child->data)->type ==
-             MB_ENTITY_KIND_FREEDBID)
-    {
-        child_entity_type_str = g_strdup ("Albums ");
-        mb5_freedbdisc_get_title (((EtMbEntity *)thread_data->child->data)->entity,
-                                  mbid, sizeof (mbid));
-        g_stpcpy (parent_entity_str, mbid);
-        to_search = MB_ENTITY_KIND_ALBUM;
-    }
-    else
-    {
-        return;
+        case MB_ENTITY_KIND_ARTIST:
+        {
+            child_entity_type_str = g_strdup ("Albums ");
+            mb5_artist_get_id (((EtMbEntity *)thread_data->child->data)->entity,
+                               mbid, sizeof (mbid));
+            mb5_artist_get_name (((EtMbEntity *)thread_data->child->data)->entity,
+                                 parent_entity_str, sizeof (parent_entity_str));
+            to_search = MB_ENTITY_KIND_ALBUM;
+            break;
+        }
+        case MB_ENTITY_KIND_ALBUM:
+        {
+            child_entity_type_str = g_strdup ("Tracks ");
+            mb5_release_get_id (((EtMbEntity *)thread_data->child->data)->entity,
+                                mbid, sizeof (mbid));
+            mb5_release_get_title (((EtMbEntity *)thread_data->child->data)->entity,
+                                   parent_entity_str, sizeof (parent_entity_str));
+            to_search = MB_ENTITY_KIND_TRACK;
+            break;
+        }
+        case MB_ENTITY_KIND_FREEDBID:
+        {
+            child_entity_type_str = g_strdup ("Albums ");
+            mb5_freedbdisc_get_title (((EtMbEntity *)thread_data->child->data)->entity,
+                                      mbid, sizeof (mbid));
+            g_stpcpy (parent_entity_str, mbid);
+            to_search = MB_ENTITY_KIND_ALBUM;
+            break;
+        }
+        default:
+            return;
     }
 
     error = NULL;
@@ -886,6 +885,7 @@ search_in_levels (EtMbEntityView *entity_view, GNode *child,
 {
     SearchInLevelThreadData *thread_data;
     EtMbEntityViewPrivate *priv;
+    GSimpleAsyncResult *async_result;
 
     if (((EtMbEntity *)child->data)->type ==
         MB_ENTITY_KIND_TRACK)
@@ -1021,7 +1021,7 @@ et_mb_entity_view_set_tree_root (EtMbEntityView *entity_view, GNode *treeRoot)
                 break;
         }
 
-        priv->bread_crumb_nodes [0] = treeRoot;
+        priv->bread_crumb_nodes[0] = treeRoot;
         priv->active_toggle_button = btn;
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (btn), TRUE);
         gtk_widget_show_all (priv->bread_crumb_box);
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index f92b10a..282688e 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -848,7 +848,7 @@ selected_find_thread_func (GSimpleAsyncResult *res, GObject *obj,
 /*
  * get_selected_iter_list:
  * @tree_view: GtkTreeView
- * @list: [out] GList
+ * @list:[out] GList
  *
  * Returns: Number of Elements of list.
  *
@@ -982,7 +982,7 @@ btn_selected_find_clicked (GtkWidget *button, gpointer data)
 
 /*
  * get_first_selected_file:
- * @et_file: [out] ET_File
+ * @et_file:[out] ET_File
  *
  * Get the First Selected File from BrowserFileList.
  */
@@ -1472,7 +1472,7 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
     {
         EtMbEntity *et_entity;
         EtMbEntity *album_entity;
-        gchar album [NAME_MAX_SIZE];
+        gchar album[NAME_MAX_SIZE];
 
         album_entity = et_mb_entity_view_get_current_entity (ET_MB_ENTITY_VIEW (entityView));
         mb5_release_get_title (album_entity->entity, album, sizeof (album));
@@ -1482,7 +1482,7 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
         {
             ET_File *best_et_file;
             gchar *filename;
-            gchar title [NAME_MAX_SIZE];
+            gchar title[NAME_MAX_SIZE];
             File_Tag *file_tag;
             int min_distance;
 
@@ -1535,7 +1535,7 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
     {
         EtMbEntity *et_entity;
         EtMbEntity *album_entity;
-        gchar album [NAME_MAX_SIZE];
+        gchar album[NAME_MAX_SIZE];
 
         album_entity = et_mb_entity_view_get_current_entity (ET_MB_ENTITY_VIEW (entityView));
         mb5_release_get_title (album_entity->entity, album, sizeof (album));
@@ -1580,7 +1580,7 @@ et_apply_track_tag_to_et_file (Mb5Recording recording, ET_File *et_file)
 {
     int size;
     Mb5ReleaseList *release_list;
-    gchar title [NAME_MAX_SIZE];
+    gchar title[NAME_MAX_SIZE];
     gchar *album_artist;
     gchar album[NAME_MAX_SIZE];
     gchar date[NAME_MAX_SIZE];
@@ -1595,7 +1595,7 @@ et_apply_track_tag_to_et_file (Mb5Recording recording, ET_File *et_file)
     artist = et_mb5_recording_get_artists_names (recording);
     size = mb5_recording_get_title (recording, title,
                                     sizeof (title));
-    title [size] = '\0';
+    title[size] = '\0';
     size = mb5_release_list_size (release_list);
 
     if (size > 1)


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