spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit c9e4146536101d6af357a08042999d1de1ce8d4a
parent 5052a6ce72e88a51bb8260a4ba1125acc8cc3672
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Sat, 10 Jul 2010 22:51:30 +1000

[win] Fix link activation (issue 31)

Diffstat:
Msrc/Makefile.am | 5++++-
Msrc/spek-message-bar.vala | 1+
Asrc/spek-platform.h | 27+++++++++++++++++++++++++++
Msrc/spek-window.vala | 38+++++++++++++++++++++++---------------
Mvapi/Makefile.am | 3++-
Avapi/spek-platform.vapi | 4++++
6 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am @@ -6,6 +6,7 @@ spek_SOURCES = \ spek-fft.c \ spek-message-bar.vala \ spek-pipeline.vala \ + spek-platform.c \ spek-ruler.vala \ spek-spectrogram.vala \ spek-window.vala @@ -24,6 +25,7 @@ VALAFLAGS = \ --pkg config \ --pkg spek-audio \ --pkg spek-fft \ + --pkg spek-platform \ @SPEK_PACKAGES@ spek_LDADD = \ @@ -32,4 +34,5 @@ spek_LDADD = \ EXTRA_DIST = \ spek-audio.h \ - spek-fft.h + spek-fft.h \ + spek-platform.h diff --git a/src/spek-message-bar.vala b/src/spek-message-bar.vala @@ -41,6 +41,7 @@ namespace Spek { label.set_markup (message); label.ellipsize = Pango.EllipsizeMode.END; label.xalign = 0f; + label.activate_link.connect (uri => { Platform.show_uri (uri); return true; }); var button_box = new HBox (false, 0); button_box.spacing = 3; var close_button = new Button (); diff --git a/src/spek-platform.h b/src/spek-platform.h @@ -0,0 +1,27 @@ +/* spek-platform.h + * + * Copyright (C) 2010 Alexander Kojevnikov <alexander@kojevnikov.com> + * + * Spek 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 3 of the License, or + * (at your option) any later version. + * + * Spek 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 Spek. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __SPEK_PLATFORM_H__ +#define __SPEK_PLATFORM_H__ + +#include <glib.h> + +/* Open a link in the browser */ +void spek_platform_show_uri (const gchar *uri); + +#endif diff --git a/src/spek-window.vala b/src/spek-window.vala @@ -208,21 +208,29 @@ namespace Spek { license += "You should have received a copy of the GNU General Public License "; license += "along with Spek. If not, see http://www.gnu.org/licenses/"; - show_about_dialog ( - this, - "program-name", "Spek", - "version", Config.PACKAGE_VERSION, - "copyright", _("Copyright \xc2\xa9 2010 Alexander Kojevnikov"), - "comments", full_title, - "authors", authors, -// "documenters", documenters, - "artists", artists, - "website-label", _("Spek Website"), - "website", "http://spek-project.org/", - "license", license, - "wrap-license", true, - "logo-icon-name", "spek", - "translator-credits", _("translator-credits")); + var dlg = new AboutDialog (); + dlg.program_name = "Spek"; + dlg.version = Config.PACKAGE_VERSION; + dlg.copyright = _("Copyright \xc2\xa9 2010 Alexander Kojevnikov"); + dlg.comments = full_title; + dlg.set ("authors", authors); +// dlg.set ("documenters", documenters); + dlg.set ("artists", artists); + dlg.website_label = _("Spek Website"); + dlg.website = "http://www.spek-project.org/"; + dlg.license = license; + dlg.wrap_license = true; + dlg.logo_icon_name = "spek"; + dlg.translator_credits = _("translator-credits"); + dlg.set_transient_for (this); + dlg.destroy_with_parent = true; + dlg.response.connect (id => dlg.destroy ()); + dlg.set_url_hook (url_hook); + dlg.present (); + } + + private void url_hook (AboutDialog about, string link) { + Platform.show_uri (link); } private string[] audio_extensions = { diff --git a/vapi/Makefile.am b/vapi/Makefile.am @@ -1,7 +1,8 @@ noinst_DATA = \ config.vapi \ spek-audio.vapi \ - spek-fft.vapi + spek-fft.vapi \ + spek-platform.vapi EXTRA_DIST = \ $(noinst_DATA) diff --git a/vapi/spek-platform.vapi b/vapi/spek-platform.vapi @@ -0,0 +1,4 @@ +[CCode (cprefix = "SpekPlatform", lower_case_cprefix = "spek_platform_", cheader_filename = "spek-platform.h")] +namespace Spek.Platform { + public static void show_uri (string uri); +}