1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2004-2012 Qball Cow <qball@gmpclient.org>
3 * Project homepage: http://gmpclient.org/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * This plugin offers the refinement of metadata appearances
28 private const bool use_transition_tma
= Gmpc
.use_transition
;
29 private const string some_unique_name_tma
= Config
.VERSION
;
32 public class Gmpc
.Tools
.MetadataAppearance
: Gmpc
.Plugin
.Base
, Gmpc
.Plugin
.PreferencesIface
{
34 private const int[] version
= {0,0,0};
35 public override unowned
int[] get_version() {
39 public override unowned
string get_name() {
40 return "Metadata Appearance";
44 /* Mark the plugin as an internal and dummy */
45 this
.plugin_type
= 8+4;
48 /* preferences pane */
50 on_checkbutton_show_lyrics_toggled(CheckButton source
)
52 config
.set_int("MetaData", "show-lyrics", (int)source
.get_active());
56 on_checkbutton_show_artist_information_toggled(CheckButton source
)
58 config
.set_int("MetaData", "show-artist-information", (int)source
.get_active());
62 on_checkbutton_show_similar_artists_toggled(CheckButton source
)
64 config
.set_int("MetaData", "show-similar-artist", (int)source
.get_active());
68 on_checkbutton_show_similar_songs_toggled(CheckButton source
)
70 config
.set_int("MetaData", "show-similar-songs", (int)source
.get_active());
74 on_checkbutton_show_guitar_tabs_toggled(CheckButton source
)
76 config
.set_int("MetaData", "show-guitar-tabs", (int)source
.get_active());
80 on_checkbutton_show_songs_from_album_toggled(CheckButton source
)
82 config
.set_int("MetaData", "show-songs-from-album", (int)source
.get_active());
86 preferences_pane_construct(Gtk
.Container container
)
89 var builder
= new
Builder();
90 string preferences_ui_file
= Gmpc
.data_path("preferences-metadata-appearance.ui");
91 builder
.add_from_file(preferences_ui_file
);
92 builder
.connect_signals(null);
93 Widget builderWidget
= builder
.get_object("frame_metadata_appearance_settings") as Frame
;
94 container
.add(builderWidget
);
95 builderWidget
.show_all();
97 builderWidget
= builder
.get_object("checkbutton_show_lyrics") as CheckButton
;
98 ((CheckButton
)builderWidget
).set_active((bool)config
.get_int_with_default("MetaData", "show-lyrics", 1));
100 builderWidget
= builder
.get_object("checkbutton_show_artist_information") as CheckButton
;
101 ((CheckButton
)builderWidget
).set_active((bool)config
.get_int_with_default("MetaData", "show-artist-information", 1));
103 builderWidget
= builder
.get_object("checkbutton_show_similar_artists") as CheckButton
;
104 ((CheckButton
)builderWidget
).set_active((bool)config
.get_int_with_default("MetaData", "show-similar-artist", 1));
106 builderWidget
= builder
.get_object("checkbutton_show_similar_songs") as CheckButton
;
107 ((CheckButton
)builderWidget
).set_active((bool)config
.get_int_with_default("MetaData", "show-similar-songs", 1));
109 builderWidget
= builder
.get_object("checkbutton_show_guitar_tabs") as CheckButton
;
110 ((CheckButton
)builderWidget
).set_active((bool)config
.get_int_with_default("MetaData", "show-guitar-tabs", 1));
112 builderWidget
= builder
.get_object("checkbutton_show_songs_from_album") as CheckButton
;
113 ((CheckButton
)builderWidget
).set_active((bool)config
.get_int_with_default("MetaData", "show-songs-from-album", 1));
115 stderr
.printf("Could not load UI: %s\n", e
.message
);
120 preferences_pane_destroy(Gtk
.Container container
)
122 foreach(Gtk
.Widget child
in container
.get_children())
124 container
.remove(child
);