[easytag/wip/future-gtk: 2/2] Convert EtCDDBDialog to a template widget
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/future-gtk: 2/2] Convert EtCDDBDialog to a template widget
- Date: Sun, 3 May 2015 15:01:09 +0000 (UTC)
commit 434a35fe7f65bf799fa0bfa182bfc957d59fa71a
Author: David King <amigadave amigadave com>
Date: Sun May 3 16:00:12 2015 +0100
Convert EtCDDBDialog to a template widget
data/cddb_dialog.ui | 1253 +++++++++++++++++++++++++++------------------------
src/cddb_dialog.c | 446 ++++++++----------
2 files changed, 860 insertions(+), 839 deletions(-)
---
diff --git a/data/cddb_dialog.ui b/data/cddb_dialog.ui
index 837204a..446a452 100644
--- a/data/cddb_dialog.ui
+++ b/data/cddb_dialog.ui
@@ -1,5 +1,5 @@
<interface domain="easytag">
- <requires lib="gtk+" version="3.4"/>
+ <requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="album_list_model">
<columns>
<column type="GdkPixbuf"/>
@@ -20,649 +20,714 @@
<column type="gpointer"/>
</columns>
</object>
- <object class="GtkGrid" id="cddb_grid">
- <property name="column-spacing">6</property>
- <property name="row-spacing">6</property>
- <child>
- <object class="GtkLabel" id="search_label">
- <property name="halign">start</property>
- <property name="label" translatable="yes">Search</property>
- <property name="visible">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="search_entry">
- <property name="margin-left">12</property>
- <property name="tooltip-text" translatable="yes">Enter the words to search (separated by a
space or ‘+’)</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="manual_search_button">
- <property name="label" translatable="yes">_Search</property>
- <property name="use-underline">True</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="automatic_search_button">
- <property name="label" translatable="yes">Search Using Selected _Files</property>
- <property name="tooltip-text" translatable="yes">Generate the CDDB disc ID using the
selected files (the order is important)</property>
- <property name="use-underline">True</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">2</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="stop_button">
- <property name="label" translatable="yes">Stop</property>
- <property name="sensitive">False</property>
- <property name="tooltip-text" translatable="yes">Stop the search</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">3</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="manual_search_label">
- <property name="halign">start</property>
- <property name="label" translatable="yes">Manual Search Options</property>
- <property name="margin-left">12</property>
- <property name="visible">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="search_options_grid">
- <property name="column-spacing">6</property>
- <property name="margin-left">24</property>
- <property name="row-spacing">6</property>
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="search_fields_label">
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Translators: header for CDDB
fields to use when searching">Search Fields</property>
- <property name="visible">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- <property name="width">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="artist_check">
- <property name="label" translatable="yes">Artist</property>
- <property name="margin-left">12</property>
- <property name="name">artist</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="album_check">
- <property name="label" translatable="yes">Album</property>
- <property name="name">title</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="track_check">
- <property name="label" translatable="yes">Track Name</property>
- <property name="name">track</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">2</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="other_check">
- <property name="label" translatable="yes">Other</property>
- <property name="name">other</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">3</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="categories_label">
- <property name="halign">start</property>
- <property name="label" translatable="yes">Categories</property>
- <property name="margin-left">12</property>
- <property name="visible">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left-attach">5</property>
- <property name="top-attach">0</property>
- <property name="width">5</property>
- </packing>
- </child>
-r <child>
- <object class="GtkCheckButton" id="blues_check">
- <property name="label" translatable="yes">Blues</property>
- <property name="margin-left">12</property>
- <property name="name">blues</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">5</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="classical_check">
- <property name="label" translatable="yes">Classical</property>
- <property name="name">classical</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">6</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="country_check">
- <property name="label" translatable="yes">Country</property>
- <property name="name">country</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">7</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="folk_check">
- <property name="label" translatable="yes">Folk</property>
- <property name="name">folk</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">8</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="jazz_check">
- <property name="label" translatable="yes">Jazz</property>
- <property name="name">jazz</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">9</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="misc_check">
- <property name="label" translatable="yes">Misc.</property>
- <property name="name">misc</property>
- <property name="margin-left">12</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">5</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="newage_check">
- <property name="label" translatable="yes">New Age</property>
- <property name="name">newage</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">6</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="reggae_check">
- <property name="label" translatable="yes">Reggae</property>
- <property name="name">reggae</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">7</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="rock_check">
- <property name="label" translatable="yes">Rock</property>
- <property name="name">rock</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">8</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="soundtrack_check">
- <property name="label" translatable="yes">Soundtrack</property>
- <property name="name">soundtrack</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">9</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">4</property>
- <property name="width">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="results_label">
- <property name="halign">start</property>
- <property name="label" translatable="yes">Results</property>
- <property name="margin-top">6</property>
- <property name="visible">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="results_box">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <object class="GtkImage" id="invert_selection_image">
+ <property name="resource">/org/gnome/EasyTAG/images/invert-selection.png</property>
+ <property name="visible">True</property>
+ </object>
+ <object class="GtkImage" id="unselect_all_image">
+ <property name="resource">/org/gnome/EasyTAG/images/unselect-all.png</property>
+ <property name="visible">True</property>
+ </object>
+ <template class="EtCDDBDialog" parent="GtkDialog">
+ <property name="title" translatable="yes">CDDB Search</property>
+ <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
+ <signal name="response" handler="et_cddb_dialog_on_response"/>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="cddb_vbox">
+ <property name="border-width">6</property>
<child>
- <object class="GtkPaned" id="results_paned">
- <property name="orientation">horizontal</property>
- <property name="margin-left">12</property>
- <property name="visible">True</property>
+ <object class="GtkGrid" id="cddb_grid">
+ <property name="column-spacing">6</property>
+ <property name="row-spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="search_label">
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Search</property>
+ <property name="visible">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="search_entry">
+ <property name="margin-left">12</property>
+ <property name="tooltip-text" translatable="yes">Enter the words to search
(separated by a space or ‘+’)</property>
+ <property name="visible">True</property>
+ <signal name="activate" handler="Cddb_Search_Album_List_From_String"
swapped="true"/>
+ <signal name="changed" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
<child>
- <object class="GtkScrolledWindow" id="album_scrolled">
- <property name="expand">True</property>
- <property name="min-content-height">225</property>
- <property name="min-content-width">225</property>
+ <object class="GtkButton" id="manual_search_button">
+ <property name="can-default">True</property>
+ <property name="label" translatable="yes">_Search</property>
+ <property name="use-underline">True</property>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="Cddb_Search_Album_List_From_String"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="automatic_search_button">
+ <property name="can-default">True</property>
+ <property name="label" translatable="yes">Search Using Selected
_Files</property>
+ <property name="tooltip-text" translatable="yes">Generate the CDDB disc ID
using the selected files (the order is important)</property>
+ <property name="use-underline">True</property>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="et_cddb_dialog_search_from_selection"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">2</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stop_search_button">
+ <property name="label" translatable="yes">Stop</property>
+ <property name="sensitive">False</property>
+ <property name="tooltip-text" translatable="yes">Stop the search</property>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="stop_search" swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">3</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="manual_search_label">
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Manual Search Options</property>
+ <property name="margin-left">12</property>
+ <property name="visible">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="search_options_grid">
+ <property name="column-spacing">6</property>
+ <property name="margin-left">24</property>
+ <property name="row-spacing">6</property>
<property name="visible">True</property>
<child>
- <object class="GtkTreeView" id="album_view">
- <property name="model">album_list_model</property>
- <property name="search-column">1</property>
+ <object class="GtkLabel" id="search_fields_label">
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Translators:
header for CDDB fields to use when searching">Search Fields</property>
<property name="visible">True</property>
- <child>
- <object class="GtkTreeViewColumn" id="service_column">
- <child>
- <object class="GtkCellRendererPixbuf"
id="service_renderer"/>
- <attributes>
- <attribute name="pixbuf">0</attribute>
- </attributes>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="artist_album_column">
- <property name="title" translatable="yes">Artist /
Album</property>
- <child>
- <object class="GtkCellRendererText"
id="artist_album_renderer"/>
- <attributes>
- <attribute name="foreground-rgba">6</attribute>
- <attribute name="style">4</attribute>
- <attribute name="text">1</attribute>
- <attribute name="weight">5</attribute>
- </attributes>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="category_column">
- <property name="title" translatable="yes">Category</property>
- <child>
- <object class="GtkCellRendererText"
id="category_renderer"/>
- <attributes>
- <attribute name="foreground-rgba">6</attribute>
- <attribute name="style">4</attribute>
- <attribute name="text">2</attribute>
- <attribute name="weight">5</attribute>
- </attributes>
- </child>
- </object>
- </child>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ <property name="width">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="artist_check">
+ <property name="label" translatable="yes">Artist</property>
+ <property name="margin-left">12</property>
+ <property name="name">artist</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="album_check">
+ <property name="label" translatable="yes">Album</property>
+ <property name="name">title</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="track_check">
+ <property name="label" translatable="yes">Track Name</property>
+ <property name="name">track</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">2</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="other_check">
+ <property name="label" translatable="yes">Other</property>
+ <property name="name">other</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">3</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="categories_label">
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Categories</property>
+ <property name="margin-left">12</property>
+ <property name="visible">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left-attach">5</property>
+ <property name="top-attach">0</property>
+ <property name="width">5</property>
+ </packing>
+ </child>
+ r <child>
+ <object class="GtkCheckButton" id="blues_check">
+ <property name="label" translatable="yes">Blues</property>
+ <property name="margin-left">12</property>
+ <property name="name">blues</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">5</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="classical_check">
+ <property name="label" translatable="yes">Classical</property>
+ <property name="name">classical</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">6</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="country_check">
+ <property name="label" translatable="yes">Country</property>
+ <property name="name">country</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">7</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="folk_check">
+ <property name="label" translatable="yes">Folk</property>
+ <property name="name">folk</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">8</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="jazz_check">
+ <property name="label" translatable="yes">Jazz</property>
+ <property name="name">jazz</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">9</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="misc_check">
+ <property name="label" translatable="yes">Misc.</property>
+ <property name="name">misc</property>
+ <property name="margin-left">12</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">5</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="newage_check">
+ <property name="label" translatable="yes">New Age</property>
+ <property name="name">newage</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">6</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="reggae_check">
+ <property name="label" translatable="yes">Reggae</property>
+ <property name="name">reggae</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">7</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="rock_check">
+ <property name="label" translatable="yes">Rock</property>
+ <property name="name">rock</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
</object>
+ <packing>
+ <property name="left-attach">8</property>
+ <property name="top-attach">2</property>
+ </packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="soundtrack_check">
+ <property name="label" translatable="yes">Soundtrack</property>
+ <property name="name">soundtrack</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_search_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">9</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
+ <property name="width">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="results_label">
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Results</property>
+ <property name="margin-top">6</property>
+ <property name="visible">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
<packing>
- <property name="resize">True</property>
- <property name="shrink">False</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">5</property>
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="track_scrolled">
- <property name="expand">True</property>
- <property name="min-content-height">225</property>
- <property name="min-content-width">225</property>
+ <object class="GtkBox" id="results_box">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkTreeView" id="track_view">
- <property name="model">track_list_model</property>
- <property name="tooltip-text" translatable="yes">Select lines from
which tags will be applied to your files list. All lines will be processed if no line is selected.\nYou can
also reorder lines in this list before using the ‘apply’ button</property>
+ <object class="GtkPaned" id="results_paned">
+ <property name="orientation">horizontal</property>
+ <property name="margin-left">12</property>
<property name="visible">True</property>
<child>
- <object class="GtkTreeViewColumn" id="number_column">
- <property name="sort-column-id">0</property>
- <property name="title" translatable="yes"
comments="Translators: column header for track number.">#</property>
+ <object class="GtkScrolledWindow" id="album_scrolled">
+ <property name="expand">True</property>
+ <property name="min-content-height">225</property>
+ <property name="min-content-width">225</property>
+ <property name="visible">True</property>
<child>
- <object class="GtkCellRendererText"
id="number_renderer"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkTreeView" id="album_list_view">
+ <property name="model">album_list_model</property>
+ <property name="search-column">1</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkTreeViewColumn"
id="service_column">
+ <child>
+ <object class="GtkCellRendererPixbuf"
id="service_renderer"/>
+ <attributes>
+ <attribute
name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="artist_album_column">
+ <property name="title"
translatable="yes">Artist / Album</property>
+ <child>
+ <object class="GtkCellRendererText"
id="artist_album_renderer"/>
+ <attributes>
+ <attribute
name="foreground-rgba">6</attribute>
+ <attribute name="style">4</attribute>
+ <attribute name="text">1</attribute>
+ <attribute
name="weight">5</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="category_column">
+ <property name="title"
translatable="yes">Category</property>
+ <child>
+ <object class="GtkCellRendererText"
id="category_renderer"/>
+ <attributes>
+ <attribute
name="foreground-rgba">6</attribute>
+ <attribute name="style">4</attribute>
+ <attribute name="text">2</attribute>
+ <attribute
name="weight">5</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"
id="album_selection">
+ <signal name="changed"
handler="show_album_info" swapped="true"/>
+ <signal name="changed"
handler="Cddb_Get_Album_Tracks_List_CB" swapped="true"/>
+ </object>
+ </child>
+ </object>
</child>
</object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
</child>
<child>
- <object class="GtkTreeViewColumn" id="track_column">
- <property name="sort-column-id">1</property>
- <property name="title" translatable="yes">Track
Name</property>
+ <object class="GtkScrolledWindow" id="track_scrolled">
+ <property name="expand">True</property>
+ <property name="min-content-height">225</property>
+ <property name="min-content-width">225</property>
+ <property name="visible">True</property>
+ <signal name="button-press-event"
handler="on_track_list_button_press_event" swapped="true"/>
<child>
- <object class="GtkCellRendererText" id="track_renderer"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
+ <object class="GtkTreeView" id="track_list_view">
+ <property name="model">track_list_model</property>
+ <property name="tooltip-text"
translatable="yes">Select lines from which tags will be applied to your files list. All lines will be
processed if no line is selected.\nYou can also reorder lines in this list before using the ‘apply’
button</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkTreeViewColumn"
id="number_column">
+ <property name="sort-column-id">0</property>
+ <property name="title" translatable="yes"
comments="Translators: column header for track number.">#</property>
+ <child>
+ <object class="GtkCellRendererText"
id="number_renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="track_column">
+ <property name="sort-column-id">1</property>
+ <property name="title"
translatable="yes">Track Name</property>
+ <child>
+ <object class="GtkCellRendererText"
id="track_renderer"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="duration_column">
+ <property name="title"
translatable="yes">Duration</property>
+ <child>
+ <object class="GtkCellRendererText"
id="duration_renderer"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"
id="track_selection">
+ <property name="mode">multiple</property>
+ <signal name="changed"
handler="Cddb_Track_List_Row_Selected" swapped="true"/>
+ </object>
+ </child>
+ </object>
</child>
</object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToolbar" id="results_toolbar">
+ <property name="margin-left">12</property>
+ <property name="visible">True</property>
+ <style>
+ <class name="inline-toolbar"/>
+ </style>
<child>
- <object class="GtkTreeViewColumn" id="duration_column">
- <property name="title" translatable="yes">Duration</property>
- <child>
- <object class="GtkCellRendererText"
id="duration_renderer"/>
- <attributes>
- <attribute name="text">2</attribute>
- </attributes>
- </child>
+ <object class="GtkToolButton" id="select_all_button">
+ <property name="icon-name">edit-select-all</property>
+ <property name="tooltip-text" translatable="yes">Select all
lines</property>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="track_list_select_all"
swapped="true"/>
</object>
</child>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="track_selection">
- <property name="mode">multiple</property>
+ <child>
+ <object class="GtkToolButton" id="invert_button">
+ <property
name="icon-widget">invert_selection_image</property>
+ <property name="tooltip-text" translatable="yes">Invert line
selection</property>
+ <property name="visible">True</property>
+ <signal name="clicked"
handler="Cddb_Track_List_Invert_Selection" swapped="true"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="unselect_all_button">
+ <property name="icon-widget">unselect_all_image</property>
+ <property name="tooltip-text" translatable="yes">Unselect
all lines</property>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="track_list_unselect_all"
swapped="true"/>
</object>
</child>
</object>
</child>
</object>
<packing>
- <property name="resize">True</property>
- <property name="shrink">False</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">7</property>
+ <property name="width">4</property>
</packing>
</child>
- </object>
- </child>
- <child>
- <object class="GtkToolbar" id="results_toolbar">
- <property name="margin-left">12</property>
- <property name="visible">True</property>
- <style>
- <class name="inline-toolbar"/>
- </style>
- <child>
- <object class="GtkToolButton" id="select_all_button">
- <property name="icon-name">edit-select-all</property>
- <property name="tooltip-text" translatable="yes">Select all lines</property>
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkToolButton" id="invert_button">
- <property name="tooltip-text" translatable="yes">Invert line
selection</property>
- <property name="visible">True</property>
- </object>
- </child>
<child>
- <object class="GtkToolButton" id="unselect_all_button">
- <property name="tooltip-text" translatable="yes">Unselect all
lines</property>
+ <object class="GtkGrid" id="fill_tags_grid">
+ <property name="column-spacing">12</property>
+ <property name="margin-left">12</property>
+ <property name="margin-top">6</property>
+ <property name="row-spacing">12</property>
<property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="fill_tags_label">
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Fill Tags</property>
+ <property name="visible">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ <property name="width">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="filename_check">
+ <property name="label" translatable="yes">Filename</property>
+ <property name="margin-left">12</property>
+ <property name="name">filename</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="title_check">
+ <property name="label" translatable="yes">Title</property>
+ <property name="name">title</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="fill_artist_check">
+ <property name="label" translatable="yes">Artist</property>
+ <property name="name">artist</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">2</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="fill_album_check">
+ <property name="label" translatable="yes">Album</property>
+ <property name="name">album</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">3</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="year_check">
+ <property name="label" translatable="yes">Year</property>
+ <property name="name">year</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">4</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="fill_track_check">
+ <property name="label" translatable="yes">Track Number</property>
+ <property name="name">track</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">5</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="track_total_check">
+ <property name="label" translatable="yes">Number of Tracks</property>
+ <property name="name">track-total</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">6</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="genre_check">
+ <property name="label" translatable="yes">Genre</property>
+ <property name="name">genre</property>
+ <property name="visible">True</property>
+ <signal name="toggled" handler="update_apply_button_sensitivity"
swapped="true"/>
+ </object>
+ <packing>
+ <property name="left-attach">7</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">8</property>
+ <property name="width">4</property>
+ </packing>
</child>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">7</property>
- <property name="width">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="fill_tags_grid">
- <property name="column-spacing">12</property>
- <property name="margin-left">12</property>
- <property name="margin-top">6</property>
- <property name="row-spacing">12</property>
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="fill_tags_label">
- <property name="halign">start</property>
- <property name="label" translatable="yes">Fill Tags</property>
- <property name="visible">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- <property name="width">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="filename_check">
- <property name="label" translatable="yes">Filename</property>
- <property name="margin-left">12</property>
- <property name="name">filename</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="title_check">
- <property name="label" translatable="yes">Title</property>
- <property name="name">title</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="fill_artist_check">
- <property name="label" translatable="yes">Artist</property>
- <property name="name">artist</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">2</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="fill_album_check">
- <property name="label" translatable="yes">Album</property>
- <property name="name">album</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">3</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="year_check">
- <property name="label" translatable="yes">Year</property>
- <property name="name">year</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">4</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="fill_track_check">
- <property name="label" translatable="yes">Track Number</property>
- <property name="name">track</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">5</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="track_total_check">
- <property name="label" translatable="yes">Number of Tracks</property>
- <property name="name">track-total</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">6</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="genre_check">
- <property name="label" translatable="yes">Genre</property>
- <property name="name">genre</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">7</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">8</property>
- <property name="width">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="results_check_box">
- <property name="margin-left">12</property>
- <property name="margin-top">6</property>
- <property name="spacing">12</property>
- <property name="visible">True</property>
- <child>
- <object class="GtkCheckButton" id="scanner_check">
- <property name="label" translatable="yes">Run the current scanner for each
file</property>
- <property name="tooltip-text" translatable="yes">Whether to run the tag scanner,
with the current settings, on the CDDB results</property>
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkCheckButton" id="dlm_check">
- <property name="label" translatable="yes">Match lines with the Levenshtein
algorithm</property>
- <property name="tooltip-text" translatable="yes">Whether to use the DLM algorithm to
match CDDB results to files</property>
- <property name="visible">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">9</property>
- <property name="width">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="status_box">
- <property name="margin-top">6</property>
- <property name="orientation">horizontal</property>
- <property name="spacing">6</property>
- <property name="visible">True</property>
- <child>
- <object class="GtkStatusbar" id="cddb_bar">
- <property name="hexpand">True</property>
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkButtonBox" id="button_box">
- <property name="layout-style">end</property>
- <property name="orientation">horizontal</property>
- <property name="spacing">6</property>
- <property name="visible">True</property>
<child>
- <object class="GtkButton" id="close_button">
- <property name="label" translatable="yes">_Close</property>
- <property name="use-underline">True</property>
+ <object class="GtkBox" id="results_check_box">
+ <property name="margin-left">12</property>
+ <property name="margin-top">6</property>
+ <property name="spacing">12</property>
<property name="visible">True</property>
+ <child>
+ <object class="GtkCheckButton" id="scanner_check">
+ <property name="label" translatable="yes">Run the current scanner
for each file</property>
+ <property name="tooltip-text" translatable="yes">Whether to run the
tag scanner, with the current settings, on the CDDB results</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="dlm_check">
+ <property name="label" translatable="yes">Match lines with the
Levenshtein algorithm</property>
+ <property name="tooltip-text" translatable="yes">Whether to use the
DLM algorithm to match CDDB results to files</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">9</property>
+ <property name="width">4</property>
+ </packing>
</child>
<child>
- <object class="GtkButton" id="apply_button">
- <property name="label" translatable="yes">_Apply</property>
- <property name="sensitive">False</property>
- <property name="tooltip-text" translatable="yes">Load the selected lines or
all lines (if no lines are selected)</property>
- <property name="use-underline">True</property>
+ <object class="GtkBox" id="status_box">
+ <property name="margin-top">6</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
<property name="visible">True</property>
+ <child>
+ <object class="GtkStatusbar" id="status_bar">
+ <property name="hexpand">True</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButtonBox" id="button_box">
+ <property name="layout-style">end</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="can-default">True</property>
+ <property name="label" translatable="yes">_Close</property>
+ <property name="use-underline">True</property>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="Cddb_Destroy_Window"
swapped="true"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="apply_button">
+ <property name="label" translatable="yes">_Apply</property>
+ <property name="sensitive">False</property>
+ <property name="tooltip-text" translatable="yes">Load the
selected lines or all lines (if no lines are selected)</property>
+ <property name="use-underline">True</property>
+ <property name="visible">True</property>
+ <signal name="clicked"
handler="Cddb_Set_Track_Infos_To_File_List" swapped="true"/>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">10</property>
+ <property name="width">4</property>
+ </packing>
</child>
</object>
</child>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">10</property>
- <property name="width">4</property>
- </packing>
</child>
- </object>
+ </template>
</interface>
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index e40c882..f704a11 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -61,10 +61,11 @@ typedef struct
GtkListStore *album_list_model;
GtkListStore *track_list_model;
- GtkWidget *search_string_entry;
+ GtkWidget *search_entry;
GtkWidget *apply_button;
- GtkWidget *search_button;
+ GtkWidget *automatic_search_button;
+ GtkWidget *manual_search_button;
GtkWidget *stop_search_button;
GtkWidget *status_bar;
@@ -72,8 +73,33 @@ typedef struct
gboolean stop_searching;
- GtkWidget *run_scanner_toggle;
- GtkWidget *use_dlm2_toggle; /* '2' as also used in prefs.c */
+ GtkWidget *artist_check;
+ GtkWidget *album_check;
+ GtkWidget *track_check;
+ GtkWidget *other_check;
+
+ GtkWidget *blues_check;
+ GtkWidget *classical_check;
+ GtkWidget *country_check;
+ GtkWidget *folk_check;
+ GtkWidget *jazz_check;
+ GtkWidget *misc_check;
+ GtkWidget *newage_check;
+ GtkWidget *reggae_check;
+ GtkWidget *rock_check;
+ GtkWidget *soundtrack_check;
+
+ GtkWidget *filename_check;
+ GtkWidget *title_check;
+ GtkWidget *fill_artist_check;
+ GtkWidget *fill_album_check;
+ GtkWidget *year_check;
+ GtkWidget *fill_track_check;
+ GtkWidget *track_total_check;
+ GtkWidget *genre_check;
+
+ GtkWidget *scanner_check;
+ GtkWidget *dlm_check;
} EtCDDBDialogPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (EtCDDBDialog, et_cddb_dialog, GTK_TYPE_DIALOG)
@@ -232,16 +258,16 @@ update_search_button_sensitivity (EtCDDBDialog *self)
priv = et_cddb_dialog_get_instance_private (self);
- if (priv->search_button
- && *(gtk_entry_get_text (GTK_ENTRY (priv->search_string_entry)))
+ if (priv->manual_search_button
+ && *(gtk_entry_get_text (GTK_ENTRY (priv->search_entry)))
&& (g_settings_get_flags (MainSettings, "cddb-search-fields") != 0)
&& (g_settings_get_flags (MainSettings, "cddb-search-categories") != 0))
{
- gtk_widget_set_sensitive (GTK_WIDGET (priv->search_button), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->manual_search_button), TRUE);
}
else
{
- gtk_widget_set_sensitive (GTK_WIDGET (priv->search_button), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->manual_search_button), FALSE);
}
}
@@ -1511,7 +1537,7 @@ Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,"");
/* Get words to search... */
- string = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_string_entry)));
+ string = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_entry)));
if (et_str_empty (string))
{
return FALSE;
@@ -1847,7 +1873,7 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,"");
/* Get words to search... */
- string = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_string_entry)));
+ string = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_entry)));
if (et_str_empty (string))
{
return FALSE;
@@ -2470,7 +2496,7 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
ET_Manage_Changes_Of_File_Data (etfile, FileName, FileTag);
/* Then run current scanner if requested. */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->scanner_check)))
{
EtScanDialog *dialog;
@@ -2601,7 +2627,7 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
ET_Manage_Changes_Of_File_Data(etfile,FileName,FileTag);
/* Then run current scanner if requested. */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->scanner_check)))
{
EtScanDialog *dialog;
@@ -2736,209 +2762,79 @@ Cddb_Destroy_Window (EtCDDBDialog *self)
}
static void
+init_search_field_check (GtkWidget *widget)
+{
+ g_object_set_data (G_OBJECT (widget), "flags-type",
+ GSIZE_TO_POINTER (ET_TYPE_CDDB_SEARCH_FIELD));
+ g_settings_bind_with_mapping (MainSettings, "cddb-search-fields", widget,
+ "active", G_SETTINGS_BIND_DEFAULT,
+ et_settings_flags_toggle_get,
+ et_settings_flags_toggle_set, widget, NULL);
+}
+static void
+init_search_category_check (GtkWidget *widget)
+{
+ g_object_set_data (G_OBJECT (widget), "flags-type",
+ GSIZE_TO_POINTER (ET_TYPE_CDDB_SEARCH_CATEGORY));
+ g_settings_bind_with_mapping (MainSettings, "cddb-search-categories",
+ widget, "active", G_SETTINGS_BIND_DEFAULT,
+ et_settings_flags_toggle_get,
+ et_settings_flags_toggle_set, widget, NULL);
+}
+
+static void
+init_set_field_check (GtkWidget *widget)
+{
+ g_object_set_data (G_OBJECT (widget), "flags-type",
+ GSIZE_TO_POINTER (ET_TYPE_CDDB_SET_FIELD));
+ g_settings_bind_with_mapping (MainSettings, "cddb-set-fields", widget,
+ "active", G_SETTINGS_BIND_DEFAULT,
+ et_settings_flags_toggle_get,
+ et_settings_flags_toggle_set, widget, NULL);
+}
+
+static void
create_cddb_dialog (EtCDDBDialog *self)
{
EtCDDBDialogPrivate *priv;
- GtkWidget *vbox;
- GtkWidget *grid;
- GtkWidget *button;
- GtkWidget *tool_button;
- GtkWidget *image;
GtkTreePath *path;
- GtkBuilder *builder;
- GError *error = NULL;
priv = et_cddb_dialog_get_instance_private (self);
- gtk_window_set_title (GTK_WINDOW (self), _("CDDB Search"));
-
- g_signal_connect (self, "response",
- G_CALLBACK (et_cddb_dialog_on_response), NULL);
- g_signal_connect (self, "delete-event",
- G_CALLBACK (gtk_widget_hide_on_delete), NULL);
-
- vbox = gtk_dialog_get_content_area (GTK_DIALOG (self));
- gtk_container_set_border_width (GTK_CONTAINER (self), BOX_SPACING);
-
- /* Dialog content. */
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder,
- "/org/gnome/EasyTAG/cddb_dialog.ui",
- &error);
-
- if (error != NULL)
- {
- g_error ("Unable to get CDDB dialog from resource: %s",
- error->message);
- }
-
- grid = GTK_WIDGET (gtk_builder_get_object (builder, "cddb_grid"));
- gtk_box_pack_start (GTK_BOX (vbox), grid, TRUE, TRUE, 0);
-
/* Button to generate CddbId and request string from the selected files. */
- button = GTK_WIDGET (gtk_builder_get_object (builder,
- "automatic_search_button"));
- gtk_widget_set_can_default (button, TRUE);
- gtk_widget_grab_default (button);
- g_signal_connect_swapped (button, "clicked",
- G_CALLBACK (et_cddb_dialog_search_from_selection),
- self);
-
- /* Button to stop the search. */
- priv->stop_search_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "stop_button"));
- g_signal_connect_swapped (priv->stop_search_button, "clicked",
- G_CALLBACK (stop_search), self);
-
- /* Button to quit. */
- button = GTK_WIDGET (gtk_builder_get_object (builder, "close_button"));
- gtk_widget_set_can_default (button, TRUE);
- g_signal_connect_swapped (button, "clicked",
- G_CALLBACK (Cddb_Destroy_Window), self);
-
- priv->search_string_entry = GTK_WIDGET (gtk_builder_get_object (builder,
- "search_entry"));
- g_signal_connect_swapped (priv->search_string_entry, "activate",
- G_CALLBACK (Cddb_Search_Album_List_From_String),
- self);
+ gtk_widget_grab_default (priv->automatic_search_button);
/* Set content of the clipboard if available. */
- gtk_editable_paste_clipboard (GTK_EDITABLE (priv->search_string_entry));
+ gtk_editable_paste_clipboard (GTK_EDITABLE (priv->search_entry));
/* Button to run the search. */
- priv->search_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "manual_search_button"));
- gtk_widget_set_can_default (priv->search_button, TRUE);
- gtk_widget_grab_default (priv->search_button);
- g_signal_connect_swapped (priv->search_button, "clicked",
- G_CALLBACK (Cddb_Search_Album_List_From_String),
- self);
- g_signal_connect_swapped (GTK_ENTRY (priv->search_string_entry), "changed",
- G_CALLBACK (update_search_button_sensitivity),
- self);
+ gtk_widget_grab_default (priv->manual_search_button);
/* Search options. */
- {
- gsize i;
- static const struct
- {
- const gchar *id;
- } ids[] =
- {
- { "artist_check" },
- { "album_check" },
- { "track_check" },
- { "other_check" }
- };
-
- for (i = 0; i < G_N_ELEMENTS (ids); i++)
- {
- GtkWidget *widget;
-
- widget = GTK_WIDGET (gtk_builder_get_object (builder, ids[i].id));
- g_object_set_data (G_OBJECT (widget), "flags-type",
- GSIZE_TO_POINTER (ET_TYPE_CDDB_SEARCH_FIELD));
- g_settings_bind_with_mapping (MainSettings, "cddb-search-fields",
- widget, "active",
- G_SETTINGS_BIND_DEFAULT,
- et_settings_flags_toggle_get,
- et_settings_flags_toggle_set,
- widget, NULL);
- g_signal_connect_swapped (widget, "toggled",
- G_CALLBACK (update_search_button_sensitivity),
- self);
- }
- }
-
- {
- gsize i;
- static const struct
- {
- const gchar *id;
- } ids[] =
- {
- { "blues_check" },
- { "classical_check" },
- { "country_check" },
- { "folk_check" },
- { "jazz_check" },
- { "misc_check" },
- { "newage_check" },
- { "reggae_check" },
- { "rock_check" },
- { "soundtrack_check" }
- };
-
- for (i = 0; i < G_N_ELEMENTS (ids); i++)
- {
- GtkWidget *widget;
-
- widget = GTK_WIDGET (gtk_builder_get_object (builder, ids[i].id));
- g_object_set_data (G_OBJECT (widget), "flags-type",
- GSIZE_TO_POINTER (ET_TYPE_CDDB_SEARCH_CATEGORY));
- g_settings_bind_with_mapping (MainSettings,
- "cddb-search-categories", widget,
- "active", G_SETTINGS_BIND_DEFAULT,
- et_settings_flags_toggle_get,
- et_settings_flags_toggle_set,
- widget, NULL);
- g_signal_connect_swapped (G_OBJECT (widget), "toggled",
- G_CALLBACK (update_search_button_sensitivity),
- self);
- }
- }
-
- /* Results command. */
- image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/unselect-all.png");
- tool_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "unselect_all_button"));
- gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (tool_button), image);
- g_signal_connect_swapped (tool_button, "clicked",
- G_CALLBACK (track_list_unselect_all), self);
-
- image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/invert-selection.png");
- tool_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "invert_button"));
- gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (tool_button), image);
- g_signal_connect_swapped (tool_button, "clicked",
- G_CALLBACK (Cddb_Track_List_Invert_Selection),
- self);
-
- tool_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "select_all_button"));
- g_signal_connect_swapped (tool_button, "clicked",
- G_CALLBACK (track_list_select_all), self);
+ init_search_field_check (priv->artist_check);
+ init_search_field_check (priv->album_check);
+ init_search_field_check (priv->track_check);
+ init_search_field_check (priv->other_check);
+
+ init_search_category_check (priv->blues_check);
+ init_search_category_check (priv->classical_check);
+ init_search_category_check (priv->country_check);
+ init_search_category_check (priv->folk_check);
+ init_search_category_check (priv->jazz_check);
+ init_search_category_check (priv->misc_check);
+ init_search_category_check (priv->newage_check);
+ init_search_category_check (priv->reggae_check);
+ init_search_category_check (priv->rock_check);
+ init_search_category_check (priv->soundtrack_check);
/* Result of search. */
/* List of albums. */
- priv->album_list_model = GTK_LIST_STORE (gtk_builder_get_object (builder,
- "album_list_model"));
- priv->album_list_view = GTK_WIDGET (gtk_builder_get_object (builder,
- "album_view"));
-
path = gtk_tree_path_new_first ();
gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->album_list_view), path, NULL,
FALSE);
gtk_tree_path_free (path);
- g_signal_connect_swapped (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->album_list_view)),
- "changed", G_CALLBACK (show_album_info), self);
- g_signal_connect_swapped (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->album_list_view)),
- "changed",
- G_CALLBACK (Cddb_Get_Album_Tracks_List_CB),
- self);
/* List of tracks. */
- priv->track_list_model = GTK_LIST_STORE (gtk_builder_get_object (builder,
- "track_list_model"));
- priv->track_list_view = GTK_WIDGET (gtk_builder_get_object (builder,
- "track_view"));
- g_signal_connect_swapped (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->track_list_view)),
- "changed",
- G_CALLBACK (Cddb_Track_List_Row_Selected), self);
- g_signal_connect_swapped (priv->track_list_view, "button-press-event",
- G_CALLBACK (on_track_list_button_press_event),
- self);
-
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->track_list_model),
SORT_LIST_NUMBER,
Cddb_Track_List_Sort_Func,
@@ -2948,74 +2844,32 @@ create_cddb_dialog (EtCDDBDialog *self)
GINT_TO_POINTER (SORT_LIST_NAME), NULL);
/* Apply results to fields. */
- {
- gsize i;
- static const struct
- {
- const gchar *id;
- } ids[] =
- {
- { "filename_check" },
- { "title_check" },
- { "fill_artist_check" },
- { "fill_album_check" },
- { "year_check" },
- { "fill_track_check" },
- { "track_total_check" },
- { "genre_check" }
- };
-
- for (i = 0; i < G_N_ELEMENTS (ids); i++)
- {
- GtkWidget *widget;
-
- widget = GTK_WIDGET (gtk_builder_get_object (builder, ids[i].id));
- g_object_set_data (G_OBJECT (widget), "flags-type",
- GSIZE_TO_POINTER (ET_TYPE_CDDB_SET_FIELD));
- g_settings_bind_with_mapping (MainSettings, "cddb-set-fields",
- widget, "active",
- G_SETTINGS_BIND_DEFAULT,
- et_settings_flags_toggle_get,
- et_settings_flags_toggle_set,
- widget, NULL);
- g_signal_connect_swapped (G_OBJECT (widget), "toggled",
- G_CALLBACK (update_apply_button_sensitivity),
- self);
- }
- }
+ init_set_field_check (priv->filename_check);
+ init_set_field_check (priv->title_check);
+ init_set_field_check (priv->fill_artist_check);
+ init_set_field_check (priv->fill_album_check);
+ init_set_field_check (priv->year_check);
+ init_set_field_check (priv->fill_track_check);
+ init_set_field_check (priv->track_total_check);
+ init_set_field_check (priv->genre_check);
/* Check box to run the scanner. */
- priv->run_scanner_toggle = GTK_WIDGET (gtk_builder_get_object (builder,
- "scanner_check"));
g_settings_bind (MainSettings, "cddb-run-scanner",
- priv->run_scanner_toggle, "active",
+ priv->scanner_check, "active",
G_SETTINGS_BIND_DEFAULT);
/* Check box to use DLM (also used in the preferences window). */
- priv->use_dlm2_toggle = GTK_WIDGET (gtk_builder_get_object (builder,
- "dlm_check"));
- g_settings_bind (MainSettings, "cddb-dlm-enabled", priv->use_dlm2_toggle,
+ g_settings_bind (MainSettings, "cddb-dlm-enabled", priv->dlm_check,
"active", G_SETTINGS_BIND_DEFAULT);
- /* Button to apply. */
- priv->apply_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "apply_button"));
- g_signal_connect_swapped (priv->apply_button, "clicked",
- G_CALLBACK (Cddb_Set_Track_Infos_To_File_List),
- self);
-
/* Status bar. */
- priv->status_bar = GTK_WIDGET (gtk_builder_get_object (builder,
- "cddb_bar"));
priv->status_bar_context = gtk_statusbar_get_context_id (GTK_STATUSBAR (priv->status_bar),
"Messages");
gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar),
priv->status_bar_context, _("Ready to search"));
- g_signal_emit_by_name (priv->search_string_entry, "changed");
+ g_signal_emit_by_name (priv->search_entry, "changed");
priv->stop_searching = FALSE;
-
- g_object_unref (builder);
}
/*
@@ -3765,13 +3619,115 @@ et_cddb_dialog_finalize (GObject *object)
static void
et_cddb_dialog_init (EtCDDBDialog *self)
{
+ gtk_widget_init_template (GTK_WIDGET (self));
create_cddb_dialog (self);
}
static void
et_cddb_dialog_class_init (EtCDDBDialogClass *klass)
{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
G_OBJECT_CLASS (klass)->finalize = et_cddb_dialog_finalize;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
+ "/org/gnome/EasyTAG/cddb_dialog.ui");
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ album_list_model);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ album_list_view);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ track_list_model);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ track_list_view);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ search_entry);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ apply_button);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ automatic_search_button);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ manual_search_button);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ stop_search_button);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ status_bar);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ artist_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ album_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ track_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ other_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ blues_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ classical_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ country_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ folk_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ jazz_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ misc_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ newage_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ reggae_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ rock_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ soundtrack_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ filename_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ title_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ fill_artist_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ fill_album_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ year_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ fill_track_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ track_total_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ genre_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ dlm_check);
+ gtk_widget_class_bind_template_child_private (widget_class, EtCDDBDialog,
+ scanner_check);
+ gtk_widget_class_bind_template_callback (widget_class,
+ et_cddb_dialog_on_response);
+ gtk_widget_class_bind_template_callback (widget_class,
+ et_cddb_dialog_search_from_selection);
+ gtk_widget_class_bind_template_callback (widget_class,
+ on_track_list_button_press_event);
+ gtk_widget_class_bind_template_callback (widget_class, show_album_info);
+ gtk_widget_class_bind_template_callback (widget_class, stop_search);
+ gtk_widget_class_bind_template_callback (widget_class,
+ track_list_select_all);
+ gtk_widget_class_bind_template_callback (widget_class,
+ track_list_unselect_all);
+ gtk_widget_class_bind_template_callback (widget_class,
+ update_apply_button_sensitivity);
+ gtk_widget_class_bind_template_callback (widget_class,
+ update_search_button_sensitivity);
+ gtk_widget_class_bind_template_callback (widget_class,
+ Cddb_Destroy_Window);
+ gtk_widget_class_bind_template_callback (widget_class,
+ Cddb_Get_Album_Tracks_List_CB);
+ gtk_widget_class_bind_template_callback (widget_class,
+ Cddb_Set_Track_Infos_To_File_List);
+ gtk_widget_class_bind_template_callback (widget_class,
+ Cddb_Search_Album_List_From_String);
+ gtk_widget_class_bind_template_callback (widget_class,
+ Cddb_Track_List_Invert_Selection);
+ gtk_widget_class_bind_template_callback (widget_class,
+ Cddb_Track_List_Row_Selected);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]