From e9da22edc7ad3b6963cef34078c93dbbc12b5424 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Sun, 10 Jun 2012 12:10:24 +0200 Subject: [PATCH] Remove weblinks. --- glade/preferences-metadata-appearance.ui | 16 --- po/POTFILES.in | 1 - src/Makefile.am | 1 - src/Tools/gmpc-metadata-appearance.vala | 9 -- src/Widgets/gmpc-song-links.vala | 169 ------------------------------- src/browsers/gmpc-metadata-browser2.vala | 50 --------- src/browsers/gmpc-nowplaying2.vala | 26 ----- 7 files changed, 272 deletions(-) delete mode 100644 src/Widgets/gmpc-song-links.vala diff --git a/glade/preferences-metadata-appearance.ui b/glade/preferences-metadata-appearance.ui index fd4267c1..fefcd737 100644 --- a/glade/preferences-metadata-appearance.ui +++ b/glade/preferences-metadata-appearance.ui @@ -83,22 +83,6 @@ - - Web Links - True - True - False - False - True - - - - False - True - 4 - - - Artist information True diff --git a/po/POTFILES.in b/po/POTFILES.in index 159cb4ff..32416be0 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -83,7 +83,6 @@ src/Widgets/advanced_settings.c src/Widgets/gmpc-progress.c src/Widgets/GmpcVolume.c src/Widgets/gmpc-song-list.c -src/Widgets/gmpc-song-links.c src/Widgets/playlist3-messages.c src/Widgets/gmpc-metadata-text-label.c src/Widgets/gmpc-metadata-backdrop.c diff --git a/src/Makefile.am b/src/Makefile.am index c07fc883..ffd6028a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,6 @@ gmpc_WIDGETS_FILES=\ Widgets/gmpc-song-list.vala\ Widgets/gmpc-clicklabel.vala\ Widgets/playlist3-messages.c\ - Widgets/gmpc-song-links.vala\ Widgets/gmpc-image-async.vala\ Widgets/advanced_settings.vala\ Widgets/gmpc-widgets-qtable.vala\ diff --git a/src/Tools/gmpc-metadata-appearance.vala b/src/Tools/gmpc-metadata-appearance.vala index 2ae25802..b8946dac 100644 --- a/src/Tools/gmpc-metadata-appearance.vala +++ b/src/Tools/gmpc-metadata-appearance.vala @@ -59,12 +59,6 @@ public class Gmpc.Tools.MetadataAppearance : Gmpc.Plugin.Base, Gmpc.Plugin.Prefe } public static void - on_checkbutton_show_web_links_toggled(CheckButton source) - { - config.set_int("MetaData", "show-web-links", (int)source.get_active()); - } - - public static void on_checkbutton_show_similar_artists_toggled(CheckButton source) { config.set_int("MetaData", "show-similar-artist", (int)source.get_active()); @@ -106,9 +100,6 @@ public class Gmpc.Tools.MetadataAppearance : Gmpc.Plugin.Base, Gmpc.Plugin.Prefe builderWidget = builder.get_object("checkbutton_show_artist_information") as CheckButton; ((CheckButton)builderWidget).set_active((bool)config.get_int_with_default("MetaData", "show-artist-information", 1)); - builderWidget = builder.get_object("checkbutton_show_web_links") as CheckButton; - ((CheckButton)builderWidget).set_active((bool)config.get_int_with_default("MetaData", "show-web-links", 1)); - builderWidget = builder.get_object("checkbutton_show_similar_artists") as CheckButton; ((CheckButton)builderWidget).set_active((bool)config.get_int_with_default("MetaData", "show-similar-artist", 1)); diff --git a/src/Widgets/gmpc-song-links.vala b/src/Widgets/gmpc-song-links.vala deleted file mode 100644 index 4f1e09fd..00000000 --- a/src/Widgets/gmpc-song-links.vala +++ /dev/null @@ -1,169 +0,0 @@ -/* Gnome Music Player Client (GMPC) - * Copyright (C) 2004-2012 Qball Cow - * Project homepage: http://gmpclient.org/ - - * 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. -*/ - -using Config; -using GLib; -using Gtk; -using Gdk; -using Cairo; -using MPD; -using Gmpc; - -private const bool use_transition_sl = Gmpc.use_transition; - -static bool initialized = false; -public class Gmpc.MetaData.Widgets.SongLinks: Gtk.Frame -{ - private const string some_unique_name = Config.VERSION; - public enum Type { - ARTIST, - ALBUM, - SONG - } - private Type type = Type.ARTIST; - private MPD.Song? song = null; - - ~SongLinks() - { - } - - static void open_uri_function(Gtk.LinkButton but, string uri) - { - Gmpc.open_uri(uri); - } - - public SongLinks(Type type, MPD.Song song) - { - debug("Links created"); - this.type = type; - this.song = song.copy(); - var event = new Gtk.EventBox(); - var label = new Gtk.Label(""); - event.add(label); - event.visible_window = false; - this.label_widget = event; - label.set_markup("%s:".printf(_("Web Links"))); - this.shadow = Gtk.ShadowType.NONE; - - parse_uris(); - - if(!initialized) { - Gtk.LinkButton.set_uri_hook(open_uri_function); - initialized = true; - } - } - - private void parse_uris() - { - var child = this.get_child(); - if(child != null) child.destroy(); - - var file = new GLib.KeyFile(); - var path = Gmpc.user_path("weblinks.list"); - if(! FileUtils.test(path, FileTest.EXISTS)) - { - path = Gmpc.data_path("weblinks.list"); - if(! FileUtils.test(path, FileTest.EXISTS)) - { - return; - } - } - try { - file.load_from_file(path, GLib.KeyFileFlags.NONE); - } - catch (Error e) { - return; - } - - var ali = new Gtk.Alignment(0.0f, 0.0f, 0.0f,0.0f); - ali.set_padding(8,8,12,6); - this.add(ali); - - var vbox = new Gtk.VBox(false, 0); - ali.add(vbox); - - var groups = file.get_groups(); - foreach(string entry in groups) - { - try{ - string typestr = file.get_string(entry,"type"); - string uri = file.get_string(entry, "url"); - - Type type; - switch(typestr) { - case "artist": - type = Type.ARTIST; - if(this.song.artist != null) - uri = uri.replace("%ARTIST%", Gmpc.AsyncDownload.escape_uri(this.song.artist)); - break; - case "album": - type = Type.ALBUM; - - if(this.song.album != null) - uri = uri.replace("%ALBUM%", Gmpc.AsyncDownload.escape_uri(this.song.album)); - - if(this.song.artist != null) - uri = uri.replace("%ARTIST%", Gmpc.AsyncDownload.escape_uri(this.song.artist)); - break; - case "song": - default: - type = Type.SONG; - - if(this.song.title != null) - uri = uri.replace("%TITLE%", Gmpc.AsyncDownload.escape_uri(this.song.title)); - - if(this.song.album != null) - uri = uri.replace("%ALBUM%", Gmpc.AsyncDownload.escape_uri(this.song.album)); - - if(this.song.artist != null) - uri = uri.replace("%ARTIST%", Gmpc.AsyncDownload.escape_uri(this.song.artist)); - break; - } - try{ - string sar = file.get_string(entry, "search-and-replace"); - if(sar != null) { - string[] s = sar.split("::"); - if(s.length == 2){ - try{ - var regex = new GLib.Regex (s[0]); - uri = regex.replace_literal(uri,-1,0, s[1]); - } catch (GLib.RegexError e) { - GLib.debug("Failed to compile regex: '%s'\n", e.message); - } - } - } - }catch(Error e) { - - } - - if((int)type <= (int)this.type) - { - var label = new Gtk.LinkButton(uri); - label.set_label(_("Lookup %s on %s").printf(_(typestr),entry)); - label.set_alignment(0.0f, 0.5f); - vbox.pack_start(label, false, true, 0); - } - }catch(Error e){ - GLib.error("Failed to get entry from %s: '%s'\n", path, e.message); - } - - } - } - -} diff --git a/src/browsers/gmpc-metadata-browser2.vala b/src/browsers/gmpc-metadata-browser2.vala index 63545701..6b2f0036 100644 --- a/src/browsers/gmpc-metadata-browser2.vala +++ b/src/browsers/gmpc-metadata-browser2.vala @@ -1261,22 +1261,6 @@ public class Gmpc.Browsers.Metadata : Gmpc.Plugin.Base, Gmpc.Plugin.BrowserIfac similar_artist.show(); i++; } - if(config.get_int_with_default("MetaData", "show-web-links",1) == 1) - { - - var song_links = new Gmpc.MetaData.Widgets.SongLinks(Gmpc.MetaData.Widgets.SongLinks.Type.SONG,song); - notebook.append_page(song_links, new Gtk.Label(_("Web Links"))); - var button = new Gtk.RadioButton.with_label(group,_("Web Links")); - group = button.get_group(); - hboxje.pack_start(button, false, false, 0); - var j = i; - button.clicked.connect((source) => { - debug("notebook page %i clicked", j); - notebook.set_current_page(j); - }); - song_links.show(); - i++; - } /* Track changed pages */ notebook.notify["page"].connect((source,spec) => { var page = notebook.get_current_page(); @@ -1659,22 +1643,6 @@ public class Gmpc.Browsers.Metadata : Gmpc.Plugin.Base, Gmpc.Plugin.BrowserIfac slhbox.show(); i++; } - /* Show web links */ - if(config.get_int_with_default("MetaData", "show-web-links",1) == 1) - { - var song_links = new Gmpc.MetaData.Widgets.SongLinks(Gmpc.MetaData.Widgets.SongLinks.Type.ALBUM,song); - notebook.append_page(song_links, new Gtk.Label(_("Web Links"))); - var rbutton = new Gtk.RadioButton.with_label(group,_("Web Links")); - group = rbutton.get_group(); - hboxje.pack_start(rbutton, false, false, 0); - var j = i; - rbutton.clicked.connect((source) => { - debug("notebook page %i clicked", j); - notebook.set_current_page(j); - }); - song_links.show(); - i++; - } /* Track changed pages */ notebook.notify["page"].connect((source,spec) => { var page = notebook.get_current_page(); @@ -1944,24 +1912,6 @@ public class Gmpc.Browsers.Metadata : Gmpc.Plugin.Base, Gmpc.Plugin.BrowserIfac slhbox.show(); i++; } - /* Show web links */ - if(config.get_int_with_default("MetaData", "show-web-links",1) == 1) - { - var song_links = new Gmpc.MetaData.Widgets.SongLinks(Gmpc.MetaData.Widgets.SongLinks.Type.ARTIST,song); - notebook.append_page(song_links, new Gtk.Label(_("Web Links"))); - var button_sl = new Gtk.RadioButton.with_label(group,_("Web Links")); - group = button_sl.get_group(); - hboxje.pack_start(button_sl, false, false, 0); - var j = i; - button_sl.clicked.connect((source) => { - if((source as Gtk.CheckButton).get_active()) { - debug("notebook page %i clicked", j); - notebook.set_current_page(j); - } - }); - song_links.show(); - i++; - } if( song.artist != null) { diff --git a/src/browsers/gmpc-nowplaying2.vala b/src/browsers/gmpc-nowplaying2.vala index 17ba4f69..30963f3d 100644 --- a/src/browsers/gmpc-nowplaying2.vala +++ b/src/browsers/gmpc-nowplaying2.vala @@ -742,32 +742,6 @@ namespace Gmpc { i++; } GLib.log(np2_LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_DEBUG, "similar Artist took: %.6f seconds.", t.elapsed()); - if(config.get_int_with_default("MetaData", "show-web-links",1) == 1) - { - - var song_links = new Gmpc.MetaData.Widgets.SongLinks(Gmpc.MetaData.Widgets.SongLinks.Type.SONG,song); - notebook.append_page(song_links, new Gtk.Label(_("Web Links"))); - var button = new Gtk.RadioButton(group);//with_label(group,_("Web Links")); - var label = new Gtk.Label(_("Web Links")); - label.ellipsize = Pango.EllipsizeMode.END; - label.set_alignment(0.0f, 0.5f); - //button.add(label); - if(group != null) - hboxje.pack_start(new Gtk.VSeparator(), false, false, 0); - group = button.get_group(); - hboxje.pack_start(button, false, false, 0); - hboxje.pack_start(label, true, true, 0); - var j = i; - button.clicked.connect((source) => { - if((source as Gtk.CheckButton).get_active()) { - GLib.log(np2_LOG_DOMAIN,GLib.LogLevelFlags.LEVEL_DEBUG, "song link notebook page %i clicked", j); - notebook.set_current_page(j); - } - }); - song_links.show(); - i++; - } - GLib.log(np2_LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_DEBUG, "Web links took: %.6f seconds.", t.elapsed()); if(config.get_int_with_default("MetaData", "show-artist-information",1) == 1) { var alib = new Gtk.Alignment(0f,0f,1f,0f); -- 2.11.4.GIT