[easytag/wip/musicbrainz-support] Reverse List after prepending to it



commit 2a38f4b28a4e2ad2f9b5e4f7dd84431a34b0804e
Author: Abhinav <abhijangda hotmail com>
Date:   Mon Jul 28 23:04:32 2014 +0530

    Reverse List after prepending to it

 data/musicbrainz_dialog.ui |   32 ++++++++++----------------------
 src/mbentityview.c         |    3 +++
 src/musicbrainz_dialog.c   |   30 +++++++++++++++++++-----------
 3 files changed, 32 insertions(+), 33 deletions(-)
---
diff --git a/data/musicbrainz_dialog.ui b/data/musicbrainz_dialog.ui
index 01152df..f469508 100755
--- a/data/musicbrainz_dialog.ui
+++ b/data/musicbrainz_dialog.ui
@@ -1,25 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkImage" id="img_red_lines">
+  <object class="GtkImage" id="findimage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">easytag-red-lines</property>
+    <property name="stock">gtk-find</property>
   </object>
-  <object class="GtkImage" id="img_unselect_all">
+  <object class="GtkImage" id="img_invert_selection">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">easytag-unselect-all</property>
+    <property name="stock">easytag-invert-selection</property>
   </object>
-  <object class="GtkImage" id="findimage">
+  <object class="GtkImage" id="img_red_lines">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">gtk-find</property>
+    <property name="stock">easytag-red-lines</property>
   </object>
-  <object class="GtkImage" id="img_invert_selection">
+  <object class="GtkImage" id="img_unselect_all">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">easytag-invert-selection</property>
+    <property name="stock">easytag-unselect-all</property>
   </object>
   <object class="GtkBox" id="mb_box">
     <property name="visible">True</property>
@@ -461,6 +461,7 @@
   <object class="GtkDialog" id="tag_choice_dialog">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
+    <property name="title" translatable="yes">Select the Tag you want apply</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox2">
@@ -506,19 +507,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Select the Tag you want to apply:</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkScrolledWindow" id="scrolledwindow1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
@@ -536,7 +524,7 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
diff --git a/src/mbentityview.c b/src/mbentityview.c
index dac85b0..d1d4167 100755
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -1378,6 +1378,9 @@ et_mb_entity_view_get_selected_entity_list (EtMbEntityView *entity_view,
         while (child != NULL);
     }
 
+    /* Reverse the list as we are prepending elements to it */
+    *list = g_list_reverse (*list);
+
     return count;
 }
 #endif /* ENABLE_libmusicbrainz */
\ No newline at end of file
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index d6fb7aa..6c75f55 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -281,12 +281,24 @@ et_initialize_tag_choice_dialog (EtMusicBrainzDialogPrivate *mb_dialog_priv);
  * Functions *
  *************/
 
+/*
+ * et_music_brainz_dialog_set_response:
+ * @response: Response of GtkDialog
+ *
+ * Set the Response of MusicBrainzDialog and exit it.
+ */
 void
 et_music_brainz_dialog_set_response (GtkResponseType response)
 {
     gtk_dialog_response (GTK_DIALOG (mbDialog), response);
 }
 
+/*
+ * et_music_brainz_dialog_set_statusbar_message:
+ * @message: Message to be displayed
+ *
+ * Display message in Statusbar.
+ */
 void
 et_music_brainz_dialog_set_statusbar_message (gchar *message)
 {
@@ -920,6 +932,8 @@ get_selected_iter_list (GtkTreeView *tree_view, GList **list)
                                                 NULL);
     }
 
+    *list = g_list_reverse (*list);
+
     return count;
 }
 
@@ -1539,10 +1553,9 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
 
         album_entity = et_mb_entity_view_get_current_entity (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
         mb5_release_get_title (album_entity->entity, album, sizeof (album));
-        list_iter2 = file_iter_list;
 
-        for (list_iter1 = track_iter_list; list_iter1 && list_iter2;
-             list_iter1 = g_list_next (list_iter1),
+        for (list_iter1 = track_iter_list, list_iter2 = file_iter_list;
+             list_iter1 && list_iter2; list_iter1 = g_list_next (list_iter1),
              list_iter2 = g_list_next (list_iter2))
         {
             ET_File *et_file;
@@ -1550,14 +1563,7 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
             et_entity = list_iter1->data;
             et_file = Browser_List_Get_ETFile_From_Iter (list_iter2->data);
 
-            if (et_apply_track_tag_to_et_file (et_entity->entity,
-                                               et_file))
-            {
-                while (gtk_events_pending ())
-                {
-                    gtk_main_iteration ();
-                }
-            }
+            et_apply_track_tag_to_et_file (et_entity->entity, et_file);
         }
     }
 
@@ -1869,6 +1875,8 @@ et_music_brainz_dialog_stop_set_sensitive (gboolean sensitive)
                               !sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtnRefresh")),
                               !sensitive);
+    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btnApplyChanges")),
+                              !sensitive);
 }
 
 /*


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