[win] Fix link activation (issue 31)

This commit is contained in:
Alexander Kojevnikov 2010-07-10 22:51:30 +10:00
parent 5052a6ce72
commit c9e4146536
6 changed files with 61 additions and 17 deletions

View File

@ -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

View File

@ -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 ();

27
src/spek-platform.h Normal file
View File

@ -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

View File

@ -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 = {

View File

@ -1,7 +1,8 @@
noinst_DATA = \
config.vapi \
spek-audio.vapi \
spek-fft.vapi
spek-fft.vapi \
spek-platform.vapi
EXTRA_DIST = \
$(noinst_DATA)

4
vapi/spek-platform.vapi Normal file
View File

@ -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);
}