[easytag/wip/musicbrainz-support-appwin-merge: 2/5] Use EtApplicationWindow and its BrowserList



commit c8d8567f1aa4de0df1fc171f11f973b1523b99f9
Author: Abhinav <abhijangda hotmail com>
Date:   Thu Aug 21 20:35:50 2014 +0530

    Use EtApplicationWindow and its BrowserList
    
    Modified musicbrainz_dialog.c to use MainWindow's BrowserList and its functions
    Removed all functions related to standalone global variable BrowserList

 src/musicbrainz_dialog.c |   56 +++++++++++++++++++++++++++++++--------------
 1 files changed, 38 insertions(+), 18 deletions(-)
---
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index 22ecd31..fb747ec 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -26,9 +26,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>
 #include <discid/discid.h>
-#include <openssl/ssl.h>
 
-#include "gtk2_compat.h"
 #include "easytag.h"
 #include "log.h"
 #include "musicbrainz_dialog.h"
@@ -36,6 +34,7 @@
 #include "mb_search.h"
 #include "browser.h"
 #include "dlm.h"
+#include "application_window.h"
 
 #define TAG_CHOICE_DIALOG_TITLE "Select the tag you want to apply to "
 #define ET_MUSICBRAINZ_DIALOG_GET_PRIVATE(obj) (obj->priv)
@@ -647,11 +646,15 @@ btn_fetch_more_clicked (GtkWidget *btn, gpointer user_data)
         GHashTable *hash_table;
         SelectedFindThreadData *thread_data;
         EtMbSelectedSearch *selected_search;
+        GtkTreeView *browser_list;
+        GtkTreeSelection *selection;
 
+        selection = et_application_window_browser_get_selection (ET_APPLICATION_WINDOW (MainWindow));
+        browser_list = gtk_tree_selection_get_tree_view (selection);   
         iter_list = NULL;
         l = NULL;
-    
-        if (!get_selected_iter_list (GTK_TREE_VIEW (BrowserList), &iter_list))
+
+        if (!get_selected_iter_list (GTK_TREE_VIEW (browser_list), &iter_list))
         {
             gtk_statusbar_push (mb_dialog_priv->statusbar,
                             0, _("No Files Selected"));
@@ -665,7 +668,8 @@ btn_fetch_more_clicked (GtkWidget *btn, gpointer user_data)
             ET_File *etfile;
             File_Tag *file_tag;
     
-            etfile = Browser_List_Get_ETFile_From_Iter ((GtkTreeIter *)l->data);
+            etfile = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW (MainWindow),
+                                                                          (GtkTreeIter *)l->data);
     
             file_tag = (File_Tag *)etfile->FileTag->data;
     
@@ -1066,13 +1070,17 @@ btn_selected_find_clicked (GtkWidget *button, gpointer data)
     SelectedFindThreadData *thread_data;
     EtMusicBrainzDialogPrivate *mb_dialog_priv;
     EtMusicBrainzDialog *dlg;
+    GtkTreeView *browser_list;
+    GtkTreeSelection *selection;
 
+    selection = et_application_window_browser_get_selection (ET_APPLICATION_WINDOW (MainWindow));
+    browser_list = gtk_tree_selection_get_tree_view (selection);       
     dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
     mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     iter_list = NULL;
     l = NULL;
 
-    if (!get_selected_iter_list (GTK_TREE_VIEW (BrowserList), &iter_list))
+    if (!get_selected_iter_list (GTK_TREE_VIEW (browser_list), &iter_list))
     {
         gtk_statusbar_push (mb_dialog_priv->statusbar,
                         0, _("No Files Selected"));
@@ -1087,7 +1095,8 @@ btn_selected_find_clicked (GtkWidget *button, gpointer data)
         ET_File *etfile;
         File_Tag *file_tag;
 
-        etfile = Browser_List_Get_ETFile_From_Iter ((GtkTreeIter *)l->data);
+        etfile = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW (MainWindow),
+                                                                      (GtkTreeIter *)l->data);
 
         file_tag = (File_Tag *)etfile->FileTag->data;
 
@@ -1128,9 +1137,11 @@ get_first_selected_file (ET_File  **et_file)
     GtkListStore *tree_model;
     GtkTreeSelection *selection;
     int count;
+    GtkTreeView *browser_list;
 
-    tree_model = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(BrowserList)));
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList));
+    selection = et_application_window_browser_get_selection (ET_APPLICATION_WINDOW (MainWindow));
+    browser_list = gtk_tree_selection_get_tree_view (selection);    
+    tree_model = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(browser_list)));
     count = gtk_tree_selection_count_selected_rows(selection);
     *et_file = NULL;
 
@@ -1144,7 +1155,8 @@ get_first_selected_file (ET_File  **et_file)
                                     &iter,
                                     (GtkTreePath *)list_sel_rows->data))
         {
-            *et_file = Browser_List_Get_ETFile_From_Iter (&iter);
+            *et_file = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW 
(MainWindow),
+                                                                            &iter);
         }
 
         g_list_free_full (list_sel_rows,
@@ -1485,14 +1497,16 @@ btn_automatic_search_clicked (GtkWidget *btn, gpointer data)
     EtMusicBrainzDialogPrivate *mb_dialog_priv;
     EtMusicBrainzDialog *dlg;
     FreeDBIDSearchThreadData *thread_data;
+    GtkTreeView *browser_list;
 
+    selection = et_application_window_browser_get_selection (ET_APPLICATION_WINDOW (MainWindow));
+    browser_list = gtk_tree_selection_get_tree_view (selection);    
     dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
     mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     total_frames = 150;
     disc_length  = 2;
     iter_list = NULL;
-    tree_model = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(BrowserList)));
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList));
+    tree_model = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(browser_list)));
     count = gtk_tree_selection_count_selected_rows(selection);
 
     if (count > 0)
@@ -1576,7 +1590,8 @@ btn_automatic_search_clicked (GtkWidget *btn, gpointer data)
         ET_File *etfile;
         gulong secs = 0;
 
-        etfile = Browser_List_Get_ETFile_From_Iter ((GtkTreeIter *)l->data);
+        etfile = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW (MainWindow),
+                                                                      (GtkTreeIter *)l->data);
         secs = etfile->ETFileInfo->duration;
         total_frames += secs * 75;
         disc_length  += secs;
@@ -1662,13 +1677,17 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
     EtMbEntity *et_entity;
     EtMbEntity *album_entity;
     gchar album[NAME_MAX_SIZE];
+    GtkTreeView *browser_list;
+    GtkTreeSelection *selection;
 
+    selection = et_application_window_browser_get_selection (ET_APPLICATION_WINDOW (MainWindow));
+    browser_list = gtk_tree_selection_get_tree_view (selection);       
     dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
     mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     file_iter_list = NULL;
     track_iter_list = NULL;
 
-    if (!get_selected_iter_list (GTK_TREE_VIEW (BrowserList),
+    if (!get_selected_iter_list (GTK_TREE_VIEW (browser_list),
                                  &file_iter_list))
     {
         gtk_statusbar_push (mb_dialog_priv->statusbar,
@@ -1732,7 +1751,8 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
                 int distance;
                 ET_File *et_file;
 
-                et_file = Browser_List_Get_ETFile_From_Iter (list_iter2->data);
+                et_file = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW 
(MainWindow),
+                                                                               list_iter2->data);
                 filename = ((File_Name *)et_file->FileNameCur->data)->value;
                 file_tag = (File_Tag *)et_file->FileTag->data;
 
@@ -1770,8 +1790,8 @@ btn_apply_changes_clicked (GtkWidget *btn, gpointer data)
             ET_File *et_file;
 
             et_entity = list_iter1->data;
-            et_file = Browser_List_Get_ETFile_From_Iter (list_iter2->data);
-
+            et_file = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW 
(MainWindow),
+                                                                           list_iter2->data);
             et_apply_track_tag_to_et_file (et_entity->entity, album_entity, 
                                            et_file);
         }
@@ -2517,4 +2537,4 @@ et_open_musicbrainz_dialog ()
         et_music_brainz_dialog_clear (&mbDialog);
     }
 }
-#endif /* ENABLE_libmusicbrainz */
\ No newline at end of file
+#endif /* ENABLE_libmusicbrainz */


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