File: help.c

package info (click to toggle)
gtkpod 0.99.14-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,716 kB
  • ctags: 3,266
  • sloc: ansic: 43,120; sh: 4,837; xml: 1,316; lex: 637; perl: 264; makefile: 236; awk: 73; python: 35
file content (239 lines) | stat: -rw-r--r-- 9,612 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/*
|  Copyright (C) 2007 Matvey Kozhev <sikon at users sourceforge net>
|  Part of the gtkpod project.
| 
|  URL: http://www.gtkpod.org/
|  URL: http://gtkpod.sourceforge.net/
|
|  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|  iTunes and iPod are trademarks of Apple
|
|  This product is not supported/written/published by Apple!
*/

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <glib.h>
#include <gtk/gtk.h>
#include "help.h"
#include "misc.h"

/*------------------------------------------------------------------*\
 *                                                                  *
 *             About Window                                         *
 *                                                                  *
\*------------------------------------------------------------------*/

/* ATTENTION: directly used as callback in gtkpod.glade -- if you
   change the arguments of this function, make sure you define a
   separate callback for gtkpod.glade */
G_MODULE_EXPORT void open_about_window ()
{
	const gchar *authors[] = {
		_("© 2002 - 2007\n"
		    "Jorg Schuler (jcsjcs at users dot sourceforge dot net)\n"
		    "Corey Donohoe (atmos at atmos dot org)\n"
		    ""),
		_("Patches were supplied by the following people (list may be incomplete -- please contact me)\n"),
		_("Ramesh Dharan: Multi-Edit (edit tags of several tracks in one run)"),
		_("Hiroshi Kawashima: Japanese charset autodetection feature"),
		_("Adrian Ulrich: porting of playlist code from mktunes.pl to itunesdb.c"),
		_("Walter Bell: correct handling of DND URIs with escaped characters and/or cr/newlines at the end"),
		_("Sam Clegg: user defined filenames when exporting tracks from the iPod"),
		_("Chris Cutler: automatic creation of various playlist types"),
		_("Graeme Wilford: reading and writing of the 'Composer' ID3 tags, progress dialogue during sync"),
		_("Edward Matteucci: debugging, special playlist creation, most of the volume normalizing code"),
		_("Jens Lautenbach: some optical improvements"),
		_("Alex Tribble: iPod eject patch"),
		_("Yaroslav Halchenko: Orphaned and dangling tracks handling"),
		_("Andrew Huntwork: Filename case sensitivity fix and various other bugfixes"),
		_("Ero Carrera: Filename validation and quick sync when copying tracks from the iPod"),
		_("Jens Taprogge: Support for LAME's replay gain tag to normalize volume"),
		_("Armando Atienza: Support with external playcounts"),
		_("D.L. Sharp: Support for m4b files (bookmarkable AAC files)"),
		_("Jim Hall: Decent INSTALL file"),
		_("Juergen Helmers, Markus Gaugusch: Conversion scripts to sync calendar/contacts to the iPod"),    /* J"urgen! */
		_("Flavio Stanchina: bugfixes"),
		_("Chris Micacchi: when sorting ignore 'the' and similar at the beginning of the title"),
		_("Steve Jay: use statvfs() instead of df (better portability, faster)"),
		"",
		_("Christoph Kunz: address compatibility issues when writing id3v2.4 type mp3 tags"),
		"",
		_("James Liggett:\n"
		    "replacement of old GTK file selection dialogs with new GTK filechooser dialogs\n"
		    "refactored user preferences system."),
		"",
		_("Daniel Kercher: sync scripts for abook and webcalendar"),
		"",
		_("Clinton Gormley: sync scripts for thunderbird"),
		"",
		_("Sebastien Beridot: sync script for ldif addressbook format"),
		"",
		_("Sebastian Scherer: sync script for kNotes"),
		"",
		_("Nick Piper: sync script for Palm, type-ahead search"),
		"",
		_("Uwe Hermann: help with support for iPod Video"),
		"",
		_("Iain Benson: support for compilation tag in mp3 files and separate display of compilations in the sort tab."),
		_("Nicolas Chariot: icons of buttons\n"
		    "\n"),
		_("This program borrows code from the following projects:"),
		_("gnutools: (mktunes.pl, ported to C) reading and writing of iTunesDB  (http://www.gnu.org/software/gnupod/)"),
		_("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."),
		_("mp3info: mp3 playlength detection (http://ibiblio.org/mp3info/)"),
		_("xmms: dirbrowser, mp3 playlength detection (http://www.xmms.org)"),
		"",
		_("The GUI was created with the help of glade-2 (http://glade.gnome.org/)."),
		NULL };

	gchar  *translators[] = {
		_("French: David Le Brun (david at dyn-ns dot net)"),
		_("French: Éric Lassauge (rpmfarm at free dot fr)"),
		_("German: Jorg Schuler (jcsjcs at users dot sourceforge dot net)"),
		_("German: Kai-Ove"),
		_("Hebrew: Assaf Gillat (gillata at gmail dot com)"),
		_("Italian: Edward Matteucci (edward_matteucc at users dot sourceforge dot net)"),
		_("Italian: Daniele Forsi (dforsi at gmail dot com)"),
		_("Japanese: Ayako Sano"),
		_("Japanese: Kentaro Fukuchi (fukuchi at users dot sourceforge dot net)"),
		_("Romanian: Alex Eftimie (alexeftimie at gmail dot com)"),
		_("Spanish: Alejandro Lamas Daviña (alejandro.lamas at ific dot uv dot es)"),
		_("Swedish: Stefan Asserhall (stefan.asserhall at comhem dot se)"),
		NULL
	};

	gchar *license = _(
		"This program is free software; you can redistribute it and/or\n"
		"modify it under the terms of the GNU General Public License as\n"
		"published by the Free Software Foundation; either version 2 of the\n"
		"License, or (at your option) any later version.\n"
		"\n"
		"This program is distributed in the hope that it will be useful, but\n"
		"WITHOUT ANY WARRANTY; without even the implied warranty of\n"
		"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See\n"
		"the GNU General Public License for more details.\n"
		"\n"
		"You should have received a copy of the GNU General Public\n"
		"License along with this program; if not, write to the Free Software\n"
		"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n02111-1307, USA."
	);

	gchar *copyright = _("© 2002-2007\nJorg Schuler <jcsjcs at users.sourceforge.net>\nCorey Donohoe <atmos at atmos.org>");
	gchar *translator_credits = g_strjoinv("\n", translators);
	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);
	
#ifdef LIBGPOD_VERSION
	gchar *version = g_strdup_printf (_("(using libgpod %s)"), LIBGPOD_VERSION);
	gchar *description = g_strdup_printf ("%s\n%s", _("Cross-platform multilingual interface to Apple's iPod™"),
											version);
										  
	g_free (version);
#else
	gchar *description = _("Cross-platform multilingual interface to Apple's iPod™");
#endif

	gtk_show_about_dialog(GTK_WINDOW(gtkpod_window),
		"name", "gtkpod",
		"version", VERSION,
		"logo", icon,
		"comments", description,
		"copyright", copyright,
		"website", "http://gtkpod.org",
		"license", license,
		"authors", authors,
		"translator_credits", translator_credits,
		NULL);

	g_free (translator_credits);
										 
#ifdef LIBGPOD_VERSION
	g_free (description);
#endif

	if(icon)
		g_object_unref(icon);
}


/* ATTENTION: directly used as callback in gtkpod.glade -- if you
   change the arguments of this function make sure you define a
   separate callback for gtkpod.glade */
G_MODULE_EXPORT void open_help_contents ()
{
	gtkpod_open_help_context("gtkpod");
}

/* ATTENTION: directly used as callback in gtkpod.glade -- if you
   change the arguments of this function, make sure you define a
   separate callback for gtkpod.glade */
G_MODULE_EXPORT void open_help_online ()
{
	gtkpod_open_in_browser("http://www.gtkpod.org/contact.html");
}

/* ATTENTION: directly used as callback in gtkpod.glade -- if you
   change the arguments of this function, make sure you define a
   separate callback for gtkpod.glade */
G_MODULE_EXPORT void open_help_reportbug ()
{
	gtkpod_open_in_browser("http://sourceforge.net/tracker/?group_id=67873&atid=519273");
}

void gtkpod_open_in_browser (const gchar *url)
{
	const gchar *xdg_open_argv[]   = { "xdg-open", url, NULL };
	const gchar *gnome_open_argv[] = { "gnome-open", url, NULL };
	const gchar *kfmclient_argv[]  = { "kfmclient", "exec", url, NULL };
	
	if(g_spawn_async(NULL, (gchar **)xdg_open_argv, NULL, G_SPAWN_SEARCH_PATH,
					 NULL, NULL, NULL, NULL))
	{
		return;
	}
	
	if(g_spawn_async(NULL, (gchar **)gnome_open_argv, NULL, G_SPAWN_SEARCH_PATH,
					 NULL, NULL, NULL, NULL))
	{
		return;
	}
	
	g_spawn_async(NULL, (gchar **)kfmclient_argv, NULL, G_SPAWN_SEARCH_PATH,
					 NULL, NULL, NULL, NULL);
}

void gtkpod_open_help_context (const gchar *context)
{
	const gchar *docdir =
		PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "doc" G_DIR_SEPARATOR_S;
	
	gchar *filename = g_strdup_printf("%sgtkpod.xml#%s", docdir, context);
	const gchar *yelp_open_argv[] = { "yelp", filename, NULL };
	
	if(g_spawn_async(NULL, (gchar **)yelp_open_argv, NULL, G_SPAWN_SEARCH_PATH,
					 NULL, NULL, NULL, NULL))
	{
		g_free(filename);
		return;
	}
	
	g_free(filename);
	filename = g_strdup_printf("%s%s.html", docdir, context);
	gtkpod_open_in_browser(filename);
	g_free(filename);
}