[easytag/wip/musicbrainz-support-merge: 38/69] Reverse List after prepending to it



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

    Reverse List after prepending to it
    
    Reverse List in functions using 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 253dfe4..5c0c7da 100644
--- 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 8fe4b82..af5ffb1 100644
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -1385,6 +1385,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_MUSICBRAINZ */
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index 12672f0..0124ce8 100644
--- 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)
 {
@@ -924,6 +936,8 @@ get_selected_iter_list (GtkTreeView *tree_view, GList **list)
                                                 NULL);
     }
 
+    *list = g_list_reverse (*list);
+
     return count;
 }
 
@@ -1553,10 +1567,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;
@@ -1565,14 +1578,7 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
             et_file = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW 
(MainWindow),
                                                                            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);
         }
     }
 
@@ -1887,6 +1893,8 @@ et_music_brainz_dialog_stop_set_sensitive (gboolean sensitive)
                               !sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_apply_changes")),
                               !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]