[easytag/wip/musicbrainz-support-merge: 1/75] Added MusicBrainz dialog



commit 25cc5fba4f8c41f2916fe9e9d19dde03f7637b75
Author: Abhinav <abhijangda hotmail com>
Date:   Fri Aug 22 17:54:32 2014 +0530

    Added MusicBrainz dialog
    
    Added libmusicbrainz compilation flags. Added musicbrainz_dialog.ui
    containing MusicBrainz dialog. Added new file mbentityview.c containing
    EtMbEntityView widget. MusicBrainz Search has been added to the toolbar
    and menubar show-musicbrainz is the action name.

 Makefile.am                          |    7 +
 data/menus.ui                        |    5 +
 data/musicbrainz_dialog.ui           |  759 ++++++++++++++++++++++++++++++++++
 data/org.gnome.EasyTAG.gresource.xml |    1 +
 data/toolbar.ui                      |    8 +
 po/POTFILES.in                       |    1 +
 src/application_window.c             |   29 ++
 src/mbentityview.c                   |  142 +++++++
 src/mbentityview.h                   |   76 ++++
 src/musicbrainz_dialog.c             |   81 ++++
 src/musicbrainz_dialog.h             |   31 ++
 11 files changed, 1140 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index ef45dc9..5b49365 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,6 +54,9 @@ easytag_SOURCES = \
        src/log.c \
        src/main.c \
        src/misc.c \
+       src/musicbrainz_dialog.c \
+       src/mb_search.c \
+       src/mbentityview.c \
        src/picture.c \
        src/playlist_dialog.c \
        src/preferences_dialog.c \
@@ -105,7 +108,11 @@ easytag_headers = \
        src/genres.h \
        src/load_files_dialog.h \
        src/log.h \
+       src/mbentityview.h \
        src/misc.h \
+       src/musicbrainz_dialog.h \
+       src/mb_search.h \
+       src/mbentityview.h \
        src/picture.h \
        src/playlist_dialog.h \
        src/preferences_dialog.h \
diff --git a/data/menus.ui b/data/menus.ui
index e89f58c..7540640 100644
--- a/data/menus.ui
+++ b/data/menus.ui
@@ -454,6 +454,11 @@
                 <attribute name="label" translatable="yes">CDD_B Search…</attribute>
             </item>
             <item>
+                <attribute name="accel">&lt;Primary&gt;m</attribute>
+                <attribute name="action">win.show-musicbrainz</attribute>
+                <attribute name="label" translatable="yes">MusicBrainz Search…</attribute>
+            </item>
+            <item>
                 <attribute name="accel">&lt;Primary&gt;t</attribute>
                 <attribute name="action">win.show-load-filenames</attribute>
                 <attribute name="label" translatable="yes">Load Filenames From a Text File…</attribute>
diff --git a/data/musicbrainz_dialog.ui b/data/musicbrainz_dialog.ui
new file mode 100755
index 0000000..415f3cf
--- /dev/null
+++ b/data/musicbrainz_dialog.ui
@@ -0,0 +1,759 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkImage" id="image12">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-find</property>
+  </object>
+  <object class="GtkImage" id="image13">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-stop</property>
+  </object>
+  <object class="GtkImage" id="image8">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-find</property>
+  </object>
+  <object class="GtkImage" id="image9">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-stop</property>
+  </object>
+  <object class="GtkImage" id="findimage">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-find</property>
+  </object>
+  <object class="GtkImage" id="image14">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-missing-image</property>
+    <property name="icon-size">5</property>
+  </object>
+  <object class="GtkImage" id="img_invert_selection">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">easytag-invert-selection</property>
+  </object>
+  <object class="GtkImage" id="img_red_lines">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">easytag-red-lines</property>
+  </object>
+  <object class="GtkImage" id="img_unselect_all">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">easytag-unselect-all</property>
+  </object>
+  <object class="GtkImage" id="image10">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-find</property>
+  </object>
+  <object class="GtkImage" id="image11">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-stop</property>
+  </object>
+  <object class="GtkDialog" id="mbDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Music Brainz Search</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">1</property>
+            <child>
+              <object class="GtkNotebook" id="notebook1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <object class="GtkVBox" id="vbox1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkFrame" id="frame1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkAlignment" id="alignment1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="top_padding">2</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkHBox" id="hbox1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">5</property>
+                                <child>
+                                  <object class="GtkLabel" id="label4">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">Search:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkComboBoxText" id="cbAutomaticSearch">
+                                    <property name="width_request">240</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="entry_text_column">0</property>
+                                    <property name="id_column">1</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="padding">4</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkButton" id="btnAutomaticFind">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="image">image8</property>
+                                    <property name="image_position">top</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkButton" id="btnAutomaticStop">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="image">image9</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">4</property>
+                                  </packing>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Automatic Search in MusicBrainz 
Database</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Automatic Search</property>
+                  </object>
+                  <packing>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box7">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkLabel" id="label6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0.0099999997764825821</property>
+                        <property name="label" translatable="yes">Manually Search MusicBrainz 
Database</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkAlignment" id="alignment3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="top_padding">3</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkHBox" id="hbox3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">5</property>
+                            <child>
+                              <object class="GtkLabel" id="label7">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Search:</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBoxText" id="cbManualSearch">
+                                <property name="width_request">240</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="entry_text_column">0</property>
+                                <property name="id_column">1</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="padding">4</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label14">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Through:</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="cbManualSearchIn">
+                                <property name="width_request">120</property>
+                                <property name="height_request">26</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="btnManualFind">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="image">findimage</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="btnManualStop">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="image">stopimage</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">5</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="label13">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Manual Search</property>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkBox" id="box6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">5</property>
+                        <child>
+                          <object class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes"> Scan Selected Files from MusicBrainz 
Database based on their album:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="btnSelectedFind">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="image">image10</property>
+                            <property name="image_position">right</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="btnSelectedStop">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="image">image11</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">4</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">4</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="label10">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">1</property>
+                    <property name="label" translatable="yes">Scan Selected Files</property>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">1</property>
+                    <child>
+                      <object class="GtkBox" id="box5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">3</property>
+                        <child>
+                          <object class="GtkLabel" id="label12">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0.019999999552965164</property>
+                            <property name="label" translatable="yes"> Insert Disc into Disc Drive to search 
into MusicBrainz Data Base with DiscID: </property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="btnDiscFind">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="image">image12</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="btnDiscStop">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="image">image13</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">4</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">3</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="label9">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Disc Lookup</property>
+                  </object>
+                  <packing>
+                    <property name="position">3</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="padding">1</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame2">
+                <property name="width_request">555</property>
+                <property name="height_request">216</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="width_request">551</property>
+                    <property name="height_request">193</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="centralBox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">3</property>
+                        <child>
+                          <object class="GtkToolbar" id="toolbar1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkToolItem" id="toolbutton1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <object class="GtkLabel" id="label3">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">Search:</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolItem" id="toolbutton2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <object class="GtkComboBoxText" id="comboboxtext1">
+                                    <property name="width_request">131</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="entry_text_column">0</property>
+                                    <property name="id_column">1</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolButton" id="toolbtnUp">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">toolbutton3</property>
+                                <property name="use_underline">True</property>
+                                <property name="stock_id">gtk-go-up</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolButton" id="toolbutton3">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">toolbutton3</property>
+                                <property name="use_underline">True</property>
+                                <property name="stock_id">gtk-go-down</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSeparatorToolItem" id="toolbutton4">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolButton" id="toolbutton5">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">toolbutton5</property>
+                                <property name="use_underline">True</property>
+                                <property name="icon_widget">img_invert_selection</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolButton" id="toolbutton6">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">toolbutton6</property>
+                                <property name="use_underline">True</property>
+                                <property name="stock_id">gtk-select-all</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolButton" id="toolbutton7">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">toolbutton7</property>
+                                <property name="use_underline">True</property>
+                                <property name="icon_widget">img_unselect_all</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolButton" id="toolbutton8">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">toolbutton8</property>
+                                <property name="use_underline">True</property>
+                                <property name="icon_widget">img_red_lines</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkToolButton" id="toolbutton9">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">toolbutton9</property>
+                                <property name="use_underline">True</property>
+                                <property name="stock_id">gtk-refresh</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="homogeneous">True</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label8">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Results:&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="box2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkBox" id="box10">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">4</property>
+                    <child>
+                      <object class="GtkButton" id="button9">
+                        <property name="label" translatable="yes">Close</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="button10">
+                        <property name="label" translatable="yes">Apply Tag Changes</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkStatusbar" id="statusbar1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">2</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkImage" id="stopimage">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-stop</property>
+  </object>
+  <object class="GtkTreeStore" id="treestore1">
+    <columns>
+      <!-- column-name Entities -->
+      <column type="guchar"/>
+    </columns>
+  </object>
+</interface>
diff --git a/data/org.gnome.EasyTAG.gresource.xml b/data/org.gnome.EasyTAG.gresource.xml
index b024e74..675fe05 100644
--- a/data/org.gnome.EasyTAG.gresource.xml
+++ b/data/org.gnome.EasyTAG.gresource.xml
@@ -23,5 +23,6 @@
         <file preprocess='to-pixdata'>images/red-lines.png</file>
         <file preprocess='to-pixdata'>images/sequence-track.png</file>
         <file preprocess='to-pixdata'>images/unselect-all.png</file>
+        <file preprocess='xml-stripblanks'>musicbrainz_dialog.ui</file>
     </gresource>
 </gresources>
diff --git a/data/toolbar.ui b/data/toolbar.ui
index 8d8cc31..4ead0ff 100644
--- a/data/toolbar.ui
+++ b/data/toolbar.ui
@@ -145,6 +145,14 @@
             </object>
         </child>
         <child>
+            <object class="GtkToolButton" id="musicbrainz_button">
+                <property name="action-name">win.show-musicbrainz</property>
+                <property name="label" translatable="yes">MusicBrainz Search…</property>
+                <property name="tooltip-text" translatable="yes">MusicBrainz Search</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
             <object class="GtkToolButton" id="playlist_button">
                 <property name="action-name">win.show-playlist</property>
                 <property name="icon-name">document-save-as</property>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6f9914e..fd7bf25 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,6 +9,7 @@ data/easytag.desktop.in
 [type: gettext/glade]data/toolbar.ui
 data/org.gnome.EasyTAG.gschema.xml
 nautilus-extension/nautilus-easytag.c
+[type: gettext/glade]data/musicbrainz_dialog.ui
 src/about.c
 src/application.c
 src/application_window.c
diff --git a/src/application_window.c b/src/application_window.c
index ee529c8..1ace460 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -40,6 +40,7 @@
 #include "setting.h"
 #include "status_bar.h"
 #include "tag_area.h"
+#include "musicbrainz_dialog.h"
 
 /* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
 G_DEFINE_TYPE (EtApplicationWindow, et_application_window, GTK_TYPE_APPLICATION_WINDOW)
@@ -299,6 +300,18 @@ et_application_window_show_cddb_dialog (EtApplicationWindow *self)
 }
 
 /*
+ * et_application_window_show_musicbrainz_dialog:
+ * @self: EtApplicationWindow
+ *
+ * Show MusicBrainz Dialog.
+ */
+static void
+et_application_window_show_musicbrainz_dialog (EtApplicationWindow *self)
+{
+    et_open_musicbrainz_dialog ();
+}
+
+/*
  * Delete the file ETFile
  */
 static gint
@@ -1139,6 +1152,18 @@ on_show_cddb (GSimpleAction *action,
 }
 
 static void
+on_show_musicbrainz (GSimpleAction *action,
+                     GVariant *variant,
+                     gpointer user_data)
+{
+    EtApplicationWindow *self;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+
+    et_application_window_show_musicbrainz_dialog (self);
+}
+
+static void
 on_show_load_filenames (GSimpleAction *action,
                         GVariant *variant,
                         gpointer user_data)
@@ -1545,6 +1570,7 @@ static const GActionEntry actions[] =
     /* { "browse-subdir", on_browse_subdir }, Created from GSetting. */
     /* Miscellaneous menu. */
     { "show-cddb", on_show_cddb },
+    { "show-musicbrainz", on_show_musicbrainz},
     { "show-load-filenames", on_show_load_filenames },
     { "show-playlist", on_show_playlist },
     /* Go menu. */
@@ -1702,6 +1728,9 @@ et_application_window_init (EtApplicationWindow *self)
         button = GTK_TOOL_BUTTON (gtk_builder_get_object (builder, "invert_selection_button"));
         gtk_tool_button_set_icon_widget (button,
                                          gtk_image_new_from_resource 
("/org/gnome/EasyTAG/images/invert-selection.png"));
+        button = GTK_TOOL_BUTTON (gtk_builder_get_object (builder, "musicbrainz_button"));
+        gtk_tool_button_set_icon_widget (button,
+                                         gtk_image_new_from_resource 
("/org/gnome/EasyTAG/images/musicbrainz.png"));
 
         g_object_unref (builder);
     }
diff --git a/src/mbentityview.c b/src/mbentityview.c
new file mode 100644
index 0000000..f792a00
--- /dev/null
+++ b/src/mbentityview.c
@@ -0,0 +1,142 @@
+/* mbentityview.c - 2014/05/05 */
+/*
+ *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
+ *  Copyright (C) 2000-2014  Abhinav Jangda <abhijangda hotmail com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "mbentityview.h"
+
+#define ET_MB_ENTITY_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
+                                            ET_MB_ENTITY_VIEW_TYPE, \
+                                            EtMbEntityViewPrivate))
+
+/***************
+ * Declaration *
+ ***************/
+
+/*
+ * EtMbEntityViewPrivate:
+ * @breadCrumbBox: GtkToolbar which represents the BreadCrumbWidget
+ * @treeView: GtkTreeView to display the recieved music brainz data
+ * @listStore: GtkListStore for treeView
+ * @scrolledWindow: GtkScrolledWindow for treeView
+ *
+ * Private data for EtMbEntityView.
+ */
+typedef struct
+{
+    GtkWidget *breadCrumbBox;
+    GtkWidget *treeView;
+    GtkListStore *listStore;
+    GtkWidget *scrolledWindow;
+} EtMbEntityViewPrivate;
+
+/**************
+ * Prototypes *
+ **************/
+
+static void
+et_mb_entity_view_class_init (EtMbEntityViewClass *klass);
+
+static void
+et_mb_entity_view_init (EtMbEntityView *proj_notebook);
+
+/*************
+ * Functions *
+ *************/
+
+/*
+ * et_mb_entity_view_get_type
+ *
+ * Returns: A GType, type of EtMbEntityView.
+ */
+GType
+et_mb_entity_view_get_type (void)
+{
+    static GType et_mb_entity_view_type = 0;
+    
+    if (!et_mb_entity_view_type)
+    {
+        static const GTypeInfo et_mb_entity_view_type_info = 
+        {
+            sizeof (EtMbEntityViewClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) et_mb_entity_view_class_init,
+            NULL,
+            NULL,
+            sizeof (EtMbEntityView),
+            0,
+            (GInstanceInitFunc) et_mb_entity_view_init,
+        };
+        et_mb_entity_view_type = g_type_register_static (GTK_TYPE_BOX, 
+                                                         "EtMbEntityView",
+                                                         &et_mb_entity_view_type_info,
+                                                         0);
+    }
+    return et_mb_entity_view_type;
+}
+
+/*
+ * et_mb_entity_view_class_init:
+ * klass: EtMbEntityViewClass to initialize.
+ *
+ * Initializes an EtMbEntityViewClass class.
+ */
+static void
+et_mb_entity_view_class_init (EtMbEntityViewClass *klass)
+{
+    g_type_class_add_private (klass, sizeof (EtMbEntityViewPrivate));
+}
+
+/*
+ * et_mb_entity_view_init:
+ * @entity_view: EtMbEntityView to initialize.
+ *
+ * Initializes an EtMbEntityView.
+ */
+static void
+et_mb_entity_view_init (EtMbEntityView *entity_view)
+{
+    EtMbEntityViewPrivate *priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
+
+    /* Adding child widgets */
+    priv->breadCrumbBox = gtk_toolbar_new ();
+    priv->listStore = gtk_list_store_new (0);
+    priv->treeView = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->listStore));
+    priv->scrolledWindow = gtk_scrolled_window_new (NULL, NULL);
+    gtk_container_add (GTK_CONTAINER (priv->scrolledWindow), priv->treeView);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolledWindow),
+                                    GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
+    gtk_box_pack_start (GTK_BOX (entity_view), priv->breadCrumbBox,
+                        FALSE, FALSE, 2);
+    gtk_box_pack_start (GTK_BOX (entity_view), priv->scrolledWindow,
+                        TRUE, TRUE, 2);
+}
+
+/*
+ * et_mb_entity_view_new:
+ *
+ * Creates a new EtMbEntityView.
+ *
+ * Returns: GtkWidget, a new EtMbEntityView.
+ */
+GtkWidget *
+et_mb_entity_view_new ()
+{
+    return GTK_WIDGET (g_object_new (et_mb_entity_view_get_type (), NULL));
+}
\ No newline at end of file
diff --git a/src/mbentityview.h b/src/mbentityview.h
new file mode 100644
index 0000000..59d94b0
--- /dev/null
+++ b/src/mbentityview.h
@@ -0,0 +1,76 @@
+/* mbentityview.h - 2014/05/05 */
+/*
+ *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
+ *  Copyright (C) 2000-2014  Abhinav Jangda <abhijangda hotmail com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __MB_ENTITY_VIEW_H__
+#define __MB_ENTITY_VIEW_H__
+
+#include <gtk/gtk.h>
+
+#define ET_MB_ENTITY_VIEW_TYPE (et_mb_entity_view_get_type ())
+#define ET_MB_ENTITY_VIEW (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                                                             ET_MB_ENTITY_VIEW_TYPE, \
+                                                             EtMbEntityView))
+
+#define ET_MB_ENTITY_VIEW_CLASS (klass) (G_TYPE_CHECK_INSTANCE_CAST ((klass), \
+                                                                    ET_MB_ENTITY_VIEW_TYPE, \
+                                                                    EtMbEntityView))
+
+#define IS_ET_MB_ENTITY_VIEW (obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                                                               ET_MB_ENTITY_VIEW_TYPE))
+
+#define IS_ET_MB_ENTITY_VIEW_CLASS (klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                                                                     ET_MB_ENTITY_VIEW_TYPE))
+
+/***************
+ * Declaration *
+ ***************/
+
+/*
+ * EtMbEntityView:
+ * @vbox: GtkBox, parent class of EtMbEntityView
+ *
+ * This widget is used to show data recieved from music brainz and helps to
+ * navigate in it using breadcrumb widget.
+ */
+typedef struct
+{
+    GtkBox vbox;
+} EtMbEntityView;
+
+/*
+ * EtMbEntityViewClass:
+ * @parent: GtkBoxClass, parent class of EtMbEntityViewClass
+ *
+ * Class of EtMbEntityView.
+ */
+typedef struct
+{
+    GtkBoxClass parent;
+} EtMbEntityViewClass;
+
+/**************
+ * Prototypes *
+ **************/
+
+GType
+et_mb_entity_view_get_type (void) G_GNUC_CONST;
+GtkWidget *
+et_mb_entity_view_new (void);
+#endif /* __MB_ENTITY_VIEW_H__ */
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
new file mode 100644
index 0000000..1667b51
--- /dev/null
+++ b/src/musicbrainz_dialog.c
@@ -0,0 +1,81 @@
+/* musicbrainz_dialog.c - 2014/05/05 */
+/*
+ *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
+ *  Copyright (C) 2000-2014  Abhinav Jangda <abhijangda hotmail com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+ 
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
+
+#include "gtk2_compat.h"
+#include "cddb.h"
+#include "easytag.h"
+#include "et_core.h"
+#include "browser.h"
+#include "scan_dialog.h"
+#include "log.h"
+#include "misc.h"
+#include "setting.h"
+#include "id3_tag.h"
+#include "setting.h"
+#include "charset.h"
+#include "musicbrainz_dialog.h"
+#include "mbentityview.h"
+
+/***************
+ * Declaration *
+ ***************/
+
+static GtkBuilder *builder;
+static GtkWidget *mbDialog;
+static GtkWidget *entityView;
+
+/*************
+ * Functions *
+ *************/
+
+/*
+ * et_open_musicbrainz_dialog:
+ *
+ * This function will open the musicbrainz dialog.
+ */
+void
+et_open_musicbrainz_dialog ()
+{
+    entityView = et_mb_entity_view_new ();
+    builder = gtk_builder_new ();
+    /* TODO: Check the error. */
+    gtk_builder_add_from_resource (builder,
+                                   "/org/gnome/EasyTAG/musicbrainz_dialog.ui",
+                                   NULL);
+
+    mbDialog = GTK_WIDGET (gtk_builder_get_object (builder, "mbDialog"));
+
+    gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (builder, "centralBox")),
+                        entityView, TRUE, TRUE, 2);
+    /* FIXME: This should not be needed. */
+    gtk_box_reorder_child (GTK_BOX (gtk_builder_get_object (builder, "centralBox")),
+                           entityView, 0);
+
+    gtk_widget_show_all (mbDialog);
+    gtk_dialog_run (GTK_DIALOG (mbDialog));
+    gtk_widget_destroy (mbDialog);
+    g_object_unref (G_OBJECT (builder));
+}
diff --git a/src/musicbrainz_dialog.h b/src/musicbrainz_dialog.h
new file mode 100644
index 0000000..32e5cad
--- /dev/null
+++ b/src/musicbrainz_dialog.h
@@ -0,0 +1,31 @@
+/* musicbrainz_dialog.h - 2014/05/05 */
+/*
+ *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
+ *  Copyright (C) 2000-2014  Abhinav Jangda <abhijangda hotmail com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+ 
+#ifndef __MUSICBRAINZ_DIALOG_H__
+#define __MUSICBRAINZ_DIALOG_H__
+
+/**************
+ * Prototypes *
+ **************/
+
+void
+et_open_musicbrainz_dialog (void);
+
+#endif /* __MUSICBRAINZ_DIALOG_H__ */


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