[easytag/wip/musicbrainz-support] Some Improvements after review



commit 4b5140647778713b5a9a2d07cd814b47936a1289
Author: Abhinav <abhijangda hotmail com>
Date:   Mon Jun 23 22:00:20 2014 +0530

    Some Improvements after review

 src/mb_search.c          |   40 ++++++++++----------
 src/mb_search.h          |   22 +++++-----
 src/mbentityview.c       |   92 +++++++++++++++++++++++-----------------------
 src/musicbrainz_dialog.c |   31 ++++++++++++---
 4 files changed, 102 insertions(+), 83 deletions(-)
---
diff --git a/src/mb_search.c b/src/mb_search.c
old mode 100644
new mode 100755
index 58c36e4..0937a17
--- a/src/mb_search.c
+++ b/src/mb_search.c
@@ -64,8 +64,8 @@ et_musicbrainz_search_set_server_port (gchar *_server, int _port)
  * Returns: TRUE if successful, FALSE if not.
  */
 gboolean
-et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
-                                 enum MB_ENTITY_TYPE parent_type,
+et_musicbrainz_search_in_entity (MbEntityKind child_type,
+                                 MbEntityKind parent_type,
                                  gchar *parent_mbid, GNode *root,
                                  GError **error, GCancellable *cancellable)
 {
@@ -88,8 +88,8 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
     param_names [0] = "inc";
     query = mb5_query_new ("easytag", server, port);
 
-    if (child_type == MB_ENTITY_TYPE_ALBUM &&
-        parent_type == MB_ENTITY_TYPE_ARTIST)
+    if (child_type == MB_ENTITY_KIND_ALBUM &&
+        parent_type == MB_ENTITY_KIND_ARTIST)
     {
         param_values [0] = "releases";
         metadata = mb5_query_query (query, "artist", parent_mbid, "", 1,
@@ -171,7 +171,7 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
                                                             param_values);
                         entity = g_malloc (sizeof (EtMbEntity));
                         entity->entity = mb5_release_clone (mb5_metadata_get_release (metadata_release));
-                        entity->type = MB_ENTITY_TYPE_ALBUM;
+                        entity->type = MB_ENTITY_KIND_ALBUM;
                         entity->is_red_line = FALSE;
                         node = g_node_new (entity);
                         g_node_append (root, node);
@@ -187,8 +187,8 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
             goto err;
         }
     }
-    else if (child_type == MB_ENTITY_TYPE_TRACK &&
-             parent_type == MB_ENTITY_TYPE_ALBUM)
+    else if (child_type == MB_ENTITY_KIND_TRACK &&
+             parent_type == MB_ENTITY_KIND_ALBUM)
     {
         param_values [0] = "recordings";
         metadata = mb5_query_query (query, "release", parent_mbid, "", 1,
@@ -269,7 +269,7 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
                                                                   param_values);
                             entity = g_malloc (sizeof (EtMbEntity));
                             entity->entity = mb5_recording_clone (mb5_metadata_get_recording 
(metadata_recording));
-                            entity->type = MB_ENTITY_TYPE_TRACK;
+                            entity->type = MB_ENTITY_KIND_TRACK;
                             entity->is_red_line = FALSE;
                             node = g_node_new (entity);
                             g_node_append (root, node);
@@ -348,7 +348,7 @@ et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
  * Returns: TRUE if successfull, FALSE if not.
  */
 gboolean
-et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
+et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                        GError **error, GCancellable *cancellable)
 {
     Mb5Query query;
@@ -375,7 +375,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
         return FALSE;
     }
 
-    if (type == MB_ENTITY_TYPE_ARTIST)
+    if (type == MB_ENTITY_KIND_ARTIST)
     {
         param_values [0] = g_strconcat ("artist:", string, NULL);
         metadata = mb5_query_query (query, "artist", "", "", 2, param_names,
@@ -414,7 +414,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
                         EtMbEntity *entity;
                         entity = g_malloc (sizeof (EtMbEntity));
                         entity->entity = mb5_artist_clone (artist);
-                        entity->type = MB_ENTITY_TYPE_ARTIST;
+                        entity->type = MB_ENTITY_KIND_ARTIST;
                         entity->is_red_line = FALSE;
                         node = g_node_new (entity);
                         g_node_append (root, node);
@@ -430,7 +430,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
         }
     }
 
-    else if (type == MB_ENTITY_TYPE_ALBUM)
+    else if (type == MB_ENTITY_KIND_ALBUM)
     {
         param_values [0] = g_strconcat ("release:", string, NULL);
         metadata = mb5_query_query (query, "release", "", "", 2, param_names,
@@ -501,7 +501,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
                                                             param_values);
                         entity = g_malloc (sizeof (EtMbEntity));
                         entity->entity = mb5_release_clone (mb5_metadata_get_release (metadata_release));
-                        entity->type = MB_ENTITY_TYPE_ALBUM;
+                        entity->type = MB_ENTITY_KIND_ALBUM;
                         entity->is_red_line = FALSE;
                         node = g_node_new (entity);
                         g_node_append (root, node);
@@ -518,7 +518,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
         }
     }
 
-    else if (type == MB_ENTITY_TYPE_TRACK)
+    else if (type == MB_ENTITY_KIND_TRACK)
     {
         param_values [0] = g_strconcat ("recordings:", string, NULL);
         metadata = mb5_query_query (query, "recording", "", "", 2,
@@ -584,7 +584,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
                                                           param_values);
                     entity = g_malloc (sizeof (EtMbEntity));
                     entity->entity = mb5_recording_clone (mb5_metadata_get_recording (metadata_recording));
-                    entity->type = MB_ENTITY_TYPE_TRACK;
+                    entity->type = MB_ENTITY_KIND_TRACK;
                     entity->is_red_line = FALSE;
                     node = g_node_new (entity);
                     g_node_append (root, node);
@@ -600,7 +600,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
         }
     }
 
-    else if (type == MB_ENTITY_TYPE_DISCID)
+    else if (type == MB_ENTITY_KIND_DISCID)
     {
         param_names[0] = "toc";
         param_values [0] = "";
@@ -673,7 +673,7 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
                                                             param_values);
                         entity = g_malloc (sizeof (EtMbEntity));
                         entity->entity = mb5_release_clone (mb5_metadata_get_release (metadata_release));
-                        entity->type = MB_ENTITY_TYPE_ALBUM;
+                        entity->type = MB_ENTITY_KIND_ALBUM;
                         entity->is_red_line = FALSE;
                         node = g_node_new (entity);
                         g_node_append (root, node);
@@ -755,17 +755,17 @@ free_mb_tree (GNode *node)
 
     if (et_entity)
     {
-        if (et_entity->type == MB_ENTITY_TYPE_ARTIST)
+        if (et_entity->type == MB_ENTITY_KIND_ARTIST)
         {
             mb5_artist_delete ((Mb5Artist)et_entity->entity);
         }
 
-        else if (et_entity->type == MB_ENTITY_TYPE_ALBUM)
+        else if (et_entity->type == MB_ENTITY_KIND_ALBUM)
         {
             mb5_release_delete ((Mb5Release)et_entity->entity);
         }
 
-        else if (et_entity->type == MB_ENTITY_TYPE_TRACK)
+        else if (et_entity->type == MB_ENTITY_KIND_TRACK)
         {
             mb5_recording_delete ((Mb5Recording)et_entity->entity);
         }
diff --git a/src/mb_search.h b/src/mb_search.h
old mode 100644
new mode 100755
index 7f2619c..4e15982
--- a/src/mb_search.h
+++ b/src/mb_search.h
@@ -67,19 +67,19 @@ typedef enum
     ET_MB5_SEARCH_ERROR_DISCID,
 } EtMB5SearchError;
 
-enum MB_ENTITY_TYPE
+typedef enum _MbEntityKind
 {
-    MB_ENTITY_TYPE_ARTIST = 0,
-    MB_ENTITY_TYPE_ALBUM,
-    MB_ENTITY_TYPE_TRACK,
-    MB_ENTITY_TYPE_COUNT,
-    MB_ENTITY_TYPE_DISCID,
-};
+    MB_ENTITY_KIND_ARTIST = 0,
+    MB_ENTITY_KIND_ALBUM,
+    MB_ENTITY_KIND_TRACK,
+    MB_ENTITY_KIND_COUNT,
+    MB_ENTITY_KIND_DISCID,
+} MbEntityKind;
 
 typedef struct
 {
     Mb5Entity entity;
-    enum MB_ENTITY_TYPE type;
+    MbEntityKind type;
     gboolean is_red_line;
 } EtMbEntity;
 
@@ -90,12 +90,12 @@ typedef struct
 void
 et_musicbrainz_search_set_server_port (gchar *server, int port);
 gboolean
-et_musicbrainz_search_in_entity (enum MB_ENTITY_TYPE child_type,
-                                 enum MB_ENTITY_TYPE parent_type,
+et_musicbrainz_search_in_entity (MbEntityKind child_type,
+                                 MbEntityKind parent_type,
                                  gchar *parent_mbid, GNode *root,
                                  GError **error, GCancellable *cancellable);
 gboolean
-et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
+et_musicbrainz_search (gchar *string, MbEntityKind type, GNode *root,
                        GError **error, GCancellable *cancellable);
 void
 free_mb_tree (GNode *node);
diff --git a/src/mbentityview.c b/src/mbentityview.c
old mode 100644
new mode 100755
index b422080..cb04c62
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -38,7 +38,7 @@ G_DEFINE_TYPE (EtMbEntityView, et_mb_entity_view, GTK_TYPE_BOX)
  * Declaration *
  ***************/
 
-char *columns [MB_ENTITY_TYPE_COUNT][8] = {
+char *columns [MB_ENTITY_KIND_COUNT][8] = {
     {"Name", "Gender", "Type"},
     {"Name", "Artist", "Type"},
     {"Name", "Album", "Artist", "Time"},
@@ -79,7 +79,7 @@ static GSimpleAsyncResult *async_result;
 typedef struct
 {
     GtkWidget *bread_crumb_box;
-    GNode *bread_crumb_nodes[MB_ENTITY_TYPE_COUNT];
+    GNode *bread_crumb_nodes[MB_ENTITY_KIND_COUNT];
     GtkWidget *tree_view;
     GtkTreeModel *list_store;
     GtkWidget *scrolled_window;
@@ -131,8 +131,7 @@ static gboolean
 tree_filter_visible_func (GtkTreeModel *model, GtkTreeIter *iter,
                           gpointer data);
 static void
-et_mb_entity_view_destroy (GtkWidget *object);
-
+et_mb_entity_view_finalize (GObject *object);
 /*************
  * Functions *
  *************/
@@ -152,7 +151,9 @@ tree_filter_visible_func (GtkTreeModel *model, GtkTreeIter *iter,
                           gpointer data)
 {
     EtMbEntityViewPrivate *priv;
+    int columns;
 
+    columns = gtk_tree_model_get_n_columns (model);
     priv = (EtMbEntityViewPrivate *)data;
 
     if (priv->search_or_red == ET_MB_DISPLAY_RESULTS_ALL)
@@ -179,17 +180,15 @@ tree_filter_visible_func (GtkTreeModel *model, GtkTreeIter *iter,
     {
         gchar *value;
 
-        if (gtk_tree_model_get_n_columns (model) == MB_ARTIST_COLUMNS_N + 1)
+        if (columns == MB_ARTIST_COLUMNS_N + 1)
         {
             gtk_tree_model_get (model, iter, MB_ARTIST_COLUMNS_N, &value, -1);
         }
-        else if (gtk_tree_model_get_n_columns (model) ==
-                 MB_ALBUM_COLUMNS_N + 1)
+        else if (columns == MB_ALBUM_COLUMNS_N + 1)
         {
             gtk_tree_model_get (model, iter, MB_ALBUM_COLUMNS_N, &value, -1);
         }
-        else if (gtk_tree_model_get_n_columns (model) ==
-                 MB_TRACK_COLUMNS_N + 1)
+        else if (columns == MB_TRACK_COLUMNS_N + 1)
         {
             gtk_tree_model_get (model, iter, MB_TRACK_COLUMNS_N, &value, -1);
         }
@@ -221,11 +220,8 @@ tree_filter_visible_func (GtkTreeModel *model, GtkTreeIter *iter,
 static void
 et_mb_entity_view_class_init (EtMbEntityViewClass *klass)
 {
-    GtkWidgetClass *widget_class;
-
     g_type_class_add_private (klass, sizeof (EtMbEntityViewPrivate));
-    widget_class = GTK_WIDGET_CLASS (klass);
-    widget_class->destroy = et_mb_entity_view_destroy;
+    G_OBJECT_CLASS (klass)->finalize = et_mb_entity_view_finalize;
 }
 
 /*
@@ -255,7 +251,7 @@ static void
 add_iter_to_list_store (GtkListStore *list_store, GNode *node)
 {
     /* Traverse node in GNode and add it to list_store */
-    enum MB_ENTITY_TYPE type;
+    MbEntityKind type;
     Mb5ArtistCredit artist_credit;
     Mb5NameCreditList name_list;
     Mb5ReleaseGroup release_group;
@@ -276,10 +272,11 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
 
         switch (type)
         {
-            case MB_ENTITY_TYPE_ARTIST:
+            case MB_ENTITY_KIND_ARTIST:
                 mb5_artist_get_name ((Mb5Artist)entity, name, sizeof (name));
                 gtk_list_store_insert_with_values (list_store, &iter, -1,
-                                        MB_ARTIST_COLUMNS_N, "black", -1);
+                                                   MB_ARTIST_COLUMNS_N,
+                                                   "black", -1);
                 gtk_list_store_set (list_store, &iter,
                                     MB_ARTIST_COLUMNS_NAME, name, -1);
 
@@ -306,7 +303,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
 
                 break;
 
-            case MB_ENTITY_TYPE_ALBUM:
+            case MB_ENTITY_KIND_ALBUM:
                 mb5_release_get_title ((Mb5Release)entity, name,
                                        sizeof (name));
                 gtk_list_store_insert_with_values (list_store, &iter, -1,
@@ -358,7 +355,7 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                                     MB_ALBUM_COLUMNS_TYPE, name, -1);
                 break;
 
-            case MB_ENTITY_TYPE_TRACK:
+            case MB_ENTITY_KIND_TRACK:
                 mb5_recording_get_title ((Mb5Recording)entity, name,
                                          sizeof (name));
                 gtk_list_store_append (list_store, &iter);
@@ -425,8 +422,8 @@ add_iter_to_list_store (GtkListStore *list_store, GNode *node)
                                     name, -1);
                 break;
 
-            case MB_ENTITY_TYPE_COUNT:
-            case MB_ENTITY_TYPE_DISCID:
+            case MB_ENTITY_KIND_COUNT:
+            case MB_ENTITY_KIND_DISCID:
                 break;
  
         }
@@ -482,15 +479,15 @@ show_data_in_entity_view (EtMbEntityView *entity_view)
     type = ((EtMbEntity *)(g_node_first_child (priv->mb_tree_current_node)->data))->type;
     switch (type)
     {
-        case MB_ENTITY_TYPE_ARTIST:
+        case MB_ENTITY_KIND_ARTIST:
             total_cols = MB_ARTIST_COLUMNS_N;
             break;
 
-        case MB_ENTITY_TYPE_ALBUM:
+        case MB_ENTITY_KIND_ALBUM:
             total_cols = MB_ALBUM_COLUMNS_N;
             break;
 
-        case MB_ENTITY_TYPE_TRACK:
+        case MB_ENTITY_KIND_TRACK:
             total_cols = MB_TRACK_COLUMNS_N;
             break;
 
@@ -513,8 +510,14 @@ show_data_in_entity_view (EtMbEntityView *entity_view)
 
     /* Setting the colour column */
     types [total_cols] = G_TYPE_STRING;
+    //if (priv->list_store == NULL)
     priv->list_store = GTK_TREE_MODEL (gtk_list_store_newv (total_cols + 1,
                                                             types));
+    /*else FIXME:
+    {
+        gtk_list_store_clear (GTK_LIST_STORE (priv->list_store));
+        gtk_list_store_set_column_types (GTK_LIST_STORE (priv->list_store), total_cols + 1, types);
+    }*/
     priv->filter = GTK_TREE_MODEL (gtk_tree_model_filter_new (priv->list_store,
                                                               NULL));
     gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->filter),
@@ -682,12 +685,12 @@ search_in_levels_thread_func (GSimpleAsyncResult *res, GObject *obj,
     }
 
     if (((EtMbEntity *)thread_data->child->data)->type ==
-        MB_ENTITY_TYPE_TRACK)
+        MB_ENTITY_KIND_TRACK)
     {
         return;
     }
     else if (((EtMbEntity *)thread_data->child->data)->type ==
-             MB_ENTITY_TYPE_ARTIST)
+             MB_ENTITY_KIND_ARTIST)
     {
         child_entity_type_str = g_strdup ("Albums ");
         mb5_artist_get_id (((EtMbEntity *)thread_data->child->data)->entity,
@@ -696,7 +699,7 @@ search_in_levels_thread_func (GSimpleAsyncResult *res, GObject *obj,
                              parent_entity_str, sizeof (parent_entity_str));
     }
     else if (((EtMbEntity *)thread_data->child->data)->type ==
-             MB_ENTITY_TYPE_ALBUM)
+             MB_ENTITY_KIND_ALBUM)
     {
         child_entity_type_str = g_strdup ("Tracks ");
         mb5_release_get_id (((EtMbEntity *)thread_data->child->data)->entity,
@@ -774,7 +777,7 @@ tree_view_row_activated (GtkTreeView *tree_view, GtkTreePath *path,
                               depth);
 
     if (((EtMbEntity *)child->data)->type ==
-        MB_ENTITY_TYPE_TRACK)
+        MB_ENTITY_KIND_TRACK)
     {
         return;
     }
@@ -821,10 +824,11 @@ et_mb_entity_view_init (EtMbEntityView *entity_view)
     priv->bread_crumb_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
     priv->tree_view = gtk_tree_view_new ();
     priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
+                                    GTK_POLICY_AUTOMATIC,
+                                    GTK_POLICY_AUTOMATIC);
     gtk_container_add (GTK_CONTAINER (priv->scrolled_window),
                        priv->tree_view);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
-                                    GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
     gtk_box_pack_start (GTK_BOX (entity_view), priv->bread_crumb_box,
                         FALSE, FALSE, 2);
     gtk_box_pack_start (GTK_BOX (entity_view), priv->scrolled_window,
@@ -834,7 +838,7 @@ et_mb_entity_view_init (EtMbEntityView *entity_view)
     priv->active_toggle_button = NULL;
     priv->toggle_red_lines = TRUE;
     priv->search_or_red = ET_MB_DISPLAY_RESULTS_ALL;
-
+    priv->list_store = NULL;
     g_signal_connect (G_OBJECT (priv->tree_view), "row-activated",
                       G_CALLBACK (tree_view_row_activated), entity_view);
 }
@@ -879,15 +883,15 @@ et_mb_entity_view_set_tree_root (EtMbEntityView *entity_view, GNode *treeRoot)
     {
         switch (((EtMbEntity *)child->data)->type)
         {
-            case MB_ENTITY_TYPE_ARTIST:
+            case MB_ENTITY_KIND_ARTIST:
                 gtk_button_set_label (GTK_BUTTON (btn), _("Artists"));
                 break;
 
-            case MB_ENTITY_TYPE_ALBUM:
+            case MB_ENTITY_KIND_ALBUM:
                 gtk_button_set_label (GTK_BUTTON (btn), _("Albums"));
                 break;
 
-            case MB_ENTITY_TYPE_TRACK:
+            case MB_ENTITY_KIND_TRACK:
                 gtk_button_set_label (GTK_BUTTON (btn), _("Tracks"));
                 break;
 
@@ -1120,7 +1124,11 @@ et_mb_entity_view_clear_all (EtMbEntityView *entity_view)
     EtMbEntityViewPrivate *priv;
 
     priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
-    gtk_list_store_clear (GTK_LIST_STORE (priv->list_store));
+
+    if (GTK_IS_LIST_STORE (priv->list_store))
+    {
+        gtk_list_store_clear (GTK_LIST_STORE (priv->list_store));
+    }
 }
 
 /*
@@ -1130,7 +1138,7 @@ et_mb_entity_view_clear_all (EtMbEntityView *entity_view)
  * Overloaded destructor for EtMbEntityView.
  */
 static void
-et_mb_entity_view_destroy (GtkWidget *object)
+et_mb_entity_view_finalize (GObject *object)
 {
     EtMbEntityView *entity_view;
     EtMbEntityViewPrivate *priv;
@@ -1140,14 +1148,6 @@ et_mb_entity_view_destroy (GtkWidget *object)
 
     entity_view = ET_MB_ENTITY_VIEW (object);
     priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
-
-    if (GTK_IS_LIST_STORE (priv->list_store))
-    {
-        g_object_unref (priv->list_store);
-    }
-
-    if (GTK_WIDGET_CLASS (et_mb_entity_view_parent_class)->destroy)
-    {
-        (*GTK_WIDGET_CLASS (et_mb_entity_view_parent_class)->destroy)(object);
-    }
-}
\ No newline at end of file
+    g_clear_object (&priv->list_store);
+    G_OBJECT_CLASS (et_mb_entity_view_parent_class)->finalize(object);
+}
diff --git a/src/mbentityview.h b/src/mbentityview.h
old mode 100644
new mode 100755
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
old mode 100644
new mode 100755
index 7e86d19..5e6952c
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -42,6 +42,12 @@ static GSimpleAsyncResult *async_result;
 
 typedef struct
 {
+    GNode *mb_tree_root;
+    GSimpleAsyncResult *async_result;
+} MusicBrainzDialog;
+
+typedef struct
+{
     GHashTable *hash_table;
 } SelectedFindThreadData;
 /*
@@ -189,8 +195,7 @@ manual_search_thread_func (GSimpleAsyncResult *res, GObject *obj,
     }
 
     thread_data = (ManualSearchThreadData *)g_async_result_get_user_data (G_ASYNC_RESULT (res));
-    status_msg = g_strconcat (_("Searching "), thread_data->text_to_search,
-                              NULL);
+    status_msg = g_strdup_printf (_("Searching %s"), thread_data->text_to_search);
     et_show_status_msg_in_idle (status_msg);
     g_free (status_msg);
 
@@ -362,7 +367,7 @@ tool_btn_unselect_all_clicked (GtkWidget *btn, gpointer user_data)
  * Signal Handler for "clicked" signal of btnManualStop.
  */
 static void
-tool_btn_refersh_clicked (GtkWidget *btn, gpointer user_data)
+tool_btn_refresh_clicked (GtkWidget *btn, gpointer user_data)
 {
     /* TODO: Implement Refresh Operation */
     if (et_mb_entity_view_get_current_level (ET_MB_ENTITY_VIEW (entityView)) >
@@ -445,7 +450,7 @@ selected_find_thread_func (GSimpleAsyncResult *res, GObject *obj,
 
     while (iter)
     {
-        if (!et_musicbrainz_search ((gchar *)iter->data, MB_ENTITY_TYPE_ALBUM,
+        if (!et_musicbrainz_search ((gchar *)iter->data, MB_ENTITY_KIND_ALBUM,
                                     mb_tree_root, &error, cancellable))
         {
             g_simple_async_report_gerror_in_idle (NULL,
@@ -621,7 +626,7 @@ discid_search_thread_func (GSimpleAsyncResult *res, GObject *obj,
         return;
     }
 
-    if (!et_musicbrainz_search (discid, MB_ENTITY_TYPE_DISCID, mb_tree_root,
+    if (!et_musicbrainz_search (discid, MB_ENTITY_KIND_DISCID, mb_tree_root,
                                 &error, cancellable))
     {
         g_simple_async_report_gerror_in_idle (NULL,
@@ -652,6 +657,12 @@ btn_discid_search (GtkWidget *button, gpointer data)
                                          mb5_search_cancellable);
 }
 
+static void
+btn_close_clicked (GtkWidget *button, gpointer data)
+{
+    gtk_dialog_response (GTK_DIALOG (mbDialog), GTK_RESPONSE_CLOSE);
+}
+
 /*
  * et_open_musicbrainz_dialog:
  *
@@ -708,6 +719,9 @@ et_open_musicbrainz_dialog ()
     g_signal_connect (gtk_builder_get_object (builder, "toolbtnToggleRedLines"),
                       "clicked", G_CALLBACK (tool_btn_toggle_red_lines_clicked),
                       NULL);
+    g_signal_connect (gtk_builder_get_object (builder, "toolbtnRefresh"),
+                      "clicked", G_CALLBACK (tool_btn_refresh_clicked),
+                      NULL);
     g_signal_connect (gtk_builder_get_object (builder, "btnSelectedFind"),
                       "clicked", G_CALLBACK (bt_selected_find_clicked),
                       NULL);
@@ -720,6 +734,9 @@ et_open_musicbrainz_dialog ()
     g_signal_connect (gtk_builder_get_object (builder, "btnDiscStop"),
                       "clicked", G_CALLBACK (btn_manual_stop_clicked),
                       NULL);
+    g_signal_connect (gtk_builder_get_object (builder, "btnClose"),
+                      "clicked", G_CALLBACK (btn_close_clicked),
+                      NULL);
     g_signal_connect_after (gtk_builder_get_object (builder, "entryTreeViewSearch"),
                             "changed",
                             G_CALLBACK (entry_tree_view_search_changed),
@@ -733,9 +750,11 @@ et_open_musicbrainz_dialog ()
     gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb_manual_search_in), "Album");
     gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb_manual_search_in), "Track");
 
+    gtk_combo_box_set_active (GTK_COMBO_BOX (cb_manual_search_in), 1);
+
     gtk_widget_show_all (mbDialog);
     gtk_dialog_run (GTK_DIALOG (mbDialog));
     gtk_widget_destroy (mbDialog);
     g_object_unref (G_OBJECT (builder));
     free_mb_tree (mb_tree_root);
-}
\ No newline at end of file
+}
diff --git a/src/musicbrainz_dialog.h b/src/musicbrainz_dialog.h
old mode 100644
new mode 100755


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