1 /*
2 |  Copyright (C) 2007 Maia Kozheva <sikon at users sourceforge net>
3 |  Part of the gtkpod project.
4 |
5 |  URL: http://www.gtkpod.org/
6 |  URL: http://gtkpod.sourceforge.net/
7 |
8 |  This program is free software; you can redistribute it and/or modify
9 |  it under the terms of the GNU General Public License as published by
10 |  the Free Software Foundation; either version 2 of the License, or
11 |  (at your option) any later version.
12 |
13 |  This program is distributed in the hope that it will be useful,
14 |  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 |  GNU General Public License for more details.
17 |
18 |  You should have received a copy of the GNU General Public License
19 |  along with this program; if not, write to the Free Software
20 |  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 |
22 |  iTunes and iPod are trademarks of Apple
23 |
24 |  This product is not supported/written/published by Apple!
25 */
26 
27 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30 
31 #include <glib.h>
32 #include <gtk/gtk.h>
33 #include "help.h"
34 #include "misc.h"
35 
36 /*------------------------------------------------------------------*\
37  *                                                                  *
38  *             About Window                                         *
39  *                                                                  *
40 \*------------------------------------------------------------------*/
41 
42 /* ATTENTION: directly used as callback in gtkpod.glade -- if you
43    change the arguments of this function, make sure you define a
44    separate callback for gtkpod.glade */
open_about_window()45 G_MODULE_EXPORT void open_about_window ()
46 {
47 	const gchar *authors[] = {
48 		_("© 2002 - 2010\n"
49 		    "Jorg Schuler (jcsjcs at users dot sourceforge dot net)\n"
50 		    "Corey Donohoe (atmos at atmos dot org)\n"
51 		    ""),
52 		_("Codebase includes contribution from the following people and many other helpful individuals\n"),
53 		_("Ramesh Dharan: Multi-Edit (edit tags of several tracks in one run)"),
54 		_("Hiroshi Kawashima: Japanese charset autodetection feature"),
55 		_("Adrian Ulrich: porting of playlist code from mktunes.pl to itunesdb.c"),
56 		_("Walter Bell: correct handling of DND URIs with escaped characters and/or cr/newlines at the end"),
57 		_("Sam Clegg: user defined filenames when exporting tracks from the iPod"),
58 		_("Chris Cutler: automatic creation of various playlist types"),
59 		_("Graeme Wilford: reading and writing of the 'Composer' ID3 tags, progress dialogue during sync"),
60 		_("Edward Matteucci: debugging, special playlist creation, most of the volume normalizing code"),
61 		_("Jens Lautenbach: some optical improvements"),
62 		_("Alex Tribble: iPod eject patch"),
63 		_("Yaroslav Halchenko: Orphaned and dangling tracks handling"),
64 		_("Andrew Huntwork: Filename case sensitivity fix and various other bugfixes"),
65 		_("Ero Carrera: Filename validation and quick sync when copying tracks from the iPod"),
66 		_("Jens Taprogge: Support for LAME's replay gain tag to normalize volume"),
67 		_("Armando Atienza: Support with external playcounts"),
68 		_("D.L. Sharp: Support for m4b files (bookmarkable AAC files)"),
69 		_("Jim Hall: Decent INSTALL file"),
70 		_("Juergen Helmers, Markus Gaugusch: Conversion scripts to sync calendar/contacts to the iPod"),    /* J"urgen! */
71 		_("Flavio Stanchina: bugfixes"),
72 		_("Chris Micacchi: when sorting ignore 'the' and similar at the beginning of the title"),
73 		_("Steve Jay: use statvfs() instead of df (better portability, faster)"),
74 		"",
75 		_("Christoph Kunz: address compatibility issues when writing id3v2.4 type mp3 tags"),
76 		"",
77 		_("James Liggett:\n"
78 		    "replacement of old GTK file selection dialogs with new GTK filechooser dialogs\n"
79 		    "refactored user preferences system."),
80 		"",
81 		_("Daniel Kercher: sync scripts for abook and webcalendar"),
82 		"",
83 		_("Clinton Gormley: sync scripts for thunderbird"),
84 		"",
85 		_("Sebastien Beridot: sync script for ldif addressbook format"),
86 		"",
87 		_("Sebastian Scherer: sync script for kNotes"),
88 		"",
89 		_("Nick Piper: sync script for Palm, type-ahead search"),
90 		"",
91 		_("Uwe Hermann: help with support for iPod Video"),
92 		"",
93 		_("Iain Benson: support for compilation tag in mp3 files and separate display of compilations in the sort tab."),
94 		_("Nicolas Chariot: icons of buttons\n"),
95 		_("Others past and present for their excellent contributions\n\n"),
96 		_("This program borrows code from the following projects:"),
97 		_("gnutools: (mktunes.pl, ported to C) reading and writing of iTunesDB  (http://www.gnu.org/software/gnupod/)"),
98 		_("iPod.cpp, iPod.h by Samuel Wood (sam dot wood at gmail dot com): some code for smart playlists is based on his C++-classes."),
99 		_("mp3info: mp3 playlength detection (http://ibiblio.org/mp3info/)"),
100 		_("xmms: dirbrowser, mp3 playlength detection (http://www.xmms.org)"),
101 		"",
102 		_("The GUI was created with the help of glade (http://glade.gnome.org/)."),
103 		NULL };
104 
105 	gchar  *translators[] = {
106 		_("French: David Le Brun (david at dyn-ns dot net)"),
107 		_("French: Éric Lassauge (rpmfarm at free dot fr)"),
108 		_("French: Alain Portal (alain.portal at free dot fr)"),
109 		_("German: Jorg Schuler (jcsjcs at users dot sourceforge dot net)"),
110 		_("German: Kai-Ove"),
111 		_("Hebrew: Assaf Gillat (gillata at gmail dot com)"),
112 		_("Italian: Edward Matteucci (edward_matteucc at users dot sourceforge dot net)"),
113 		_("Italian: Daniele Forsi (dforsi at gmail dot com)"),
114 		_("Japanese: Ayako Sano"),
115 		_("Japanese: Kentaro Fukuchi (fukuchi at users dot sourceforge dot net)"),
116 		_("Romanian: Alex Eftimie (alexeftimie at gmail dot com)"),
117 		_("Spanish: Alejandro Lamas Daviña (alejandro.lamas at ific dot uv dot es)"),
118 		_("Swedish: Stefan Asserhall (stefan.asserhall at comhem dot se)"),
119 		NULL
120 	};
121 
122 	gchar *license = _(
123 		"This program is free software; you can redistribute it and/or\n"
124 		"modify it under the terms of the GNU General Public License as\n"
125 		"published by the Free Software Foundation; either version 2 of the\n"
126 		"License, or (at your option) any later version.\n"
127 		"\n"
128 		"This program is distributed in the hope that it will be useful, but\n"
129 		"WITHOUT ANY WARRANTY; without even the implied warranty of\n"
130 		"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See\n"
131 		"the GNU General Public License for more details.\n"
132 		"\n"
133 		"You should have received a copy of the GNU General Public\n"
134 		"License along with this program; if not, write to the Free Software\n"
135 		"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n02111-1307, USA."
136 	);
137 
138 	gchar *copyright = _("© 2002-2007\nJorg Schuler <jcsjcs at users.sourceforge.net>\nCorey Donohoe <atmos at atmos.org>");
139 	gchar *translator_credits = g_strjoinv("\n", translators);
140 	GdkPixbuf *icon = gdk_pixbuf_new_from_file(PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S "gtkpod-logo.png", NULL);
141 
142 #ifdef LIBGPOD_VERSION
143 	gchar *version = g_strdup_printf (_("(using libgpod %s)"), LIBGPOD_VERSION);
144 	gchar *description = g_strdup_printf ("%s\n%s", _("Cross-platform multilingual interface to Apple's iPod™"),
145 											version);
146 
147 	g_free (version);
148 #else
149 	gchar *description = _("Cross-platform multilingual interface to Apple's iPod™");
150 #endif
151 
152 	gtk_show_about_dialog(GTK_WINDOW(gtkpod_window),
153 		"name", "gtkpod",
154 		"version", VERSION,
155 		"logo", icon,
156 		"comments", description,
157 		"copyright", copyright,
158 		"website", "http://gtkpod.org",
159 		"license", license,
160 		"authors", authors,
161 		"translator_credits", translator_credits,
162 		NULL);
163 
164 	g_free (translator_credits);
165 
166 #ifdef LIBGPOD_VERSION
167 	g_free (description);
168 #endif
169 
170 	if(icon)
171 		g_object_unref(icon);
172 }
173 
174 
175 /* ATTENTION: directly used as callback in gtkpod.glade -- if you
176    change the arguments of this function make sure you define a
177    separate callback for gtkpod.glade */
open_help_contents()178 G_MODULE_EXPORT void open_help_contents ()
179 {
180 	gtkpod_open_help_context("gtkpod");
181 }
182 
183 /* ATTENTION: directly used as callback in gtkpod.glade -- if you
184    change the arguments of this function, make sure you define a
185    separate callback for gtkpod.glade */
open_help_online()186 G_MODULE_EXPORT void open_help_online ()
187 {
188 	gtkpod_open_in_browser("http://www.gtkpod.org/contact.html");
189 }
190 
191 /* ATTENTION: directly used as callback in gtkpod.glade -- if you
192    change the arguments of this function, make sure you define a
193    separate callback for gtkpod.glade */
open_help_reportbug()194 G_MODULE_EXPORT void open_help_reportbug ()
195 {
196 	gtkpod_open_in_browser("http://sourceforge.net/tracker/?group_id=67873&atid=519273");
197 }
198 
gtkpod_open_in_browser(const gchar * url)199 void gtkpod_open_in_browser (const gchar *url)
200 {
201 	const gchar *xdg_open_argv[]   = { "xdg-open", url, NULL };
202 	const gchar *gnome_open_argv[] = { "gnome-open", url, NULL };
203 	const gchar *kfmclient_argv[]  = { "kfmclient", "exec", url, NULL };
204 
205 	if(g_spawn_async(NULL, (gchar **)xdg_open_argv, NULL, G_SPAWN_SEARCH_PATH,
206 					 NULL, NULL, NULL, NULL))
207 	{
208 		return;
209 	}
210 
211 	if(g_spawn_async(NULL, (gchar **)gnome_open_argv, NULL, G_SPAWN_SEARCH_PATH,
212 					 NULL, NULL, NULL, NULL))
213 	{
214 		return;
215 	}
216 
217 	g_spawn_async(NULL, (gchar **)kfmclient_argv, NULL, G_SPAWN_SEARCH_PATH,
218 					 NULL, NULL, NULL, NULL);
219 }
220 
gtkpod_open_help_context(const gchar * context)221 void gtkpod_open_help_context (const gchar *context)
222 {
223 	const gchar *docdir =
224 		PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "doc" G_DIR_SEPARATOR_S;
225 
226 	gchar *filename = g_strdup_printf("%sgtkpod.xml#%s", docdir, context);
227 	const gchar *yelp_open_argv[] = { "yelp", filename, NULL };
228 
229 	if(g_spawn_async(NULL, (gchar **)yelp_open_argv, NULL, G_SPAWN_SEARCH_PATH,
230 					 NULL, NULL, NULL, NULL))
231 	{
232 		g_free(filename);
233 		return;
234 	}
235 
236 	g_free(filename);
237 	filename = g_strdup_printf("%s%s.html", docdir, context);
238 	gtkpod_open_in_browser(filename);
239 	g_free(filename);
240 }
241