summaryrefslogtreecommitdiff
path: root/cut-n-paste-code/libegg/egg-screen-help.c
blob: 42e717f5eb9df9305a53b840c5ea9ac327c9e098 (plain)
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
/* egg-screen-help.c
 * Copyright (C) 2001 Sid Vicious
 * Copyright (C) 2001 Jonathan Blandford <jrb@alum.mit.edu>
 * Copyright (C) 2002 Sun Microsystems Inc.
 * All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc.,  59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
 *
 * Authors: Mark McLoughlin <mark@skynet.ie>
 */

#include <config.h>

#include "egg-screen-help.h"

#include <libgnome/gnome-help.h>

#include "egg-screen-exec.h"

/**
 * egg_help_display_on_screen:
 * @file_name: The name of the help document to display.
 * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
 * requested document.
 * @screen: a #GdkScreen.
 * @error: A #GError instance that will hold the specifics of any error which
 * occurs during processing, or %NULL
 *
 * Description: Like gnome_help_display(), but ensures that the help viewer
 * application appears on @screen.
 *
 * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
 * contain the actual error).
 **/
gboolean
egg_help_display_on_screen (const char  *file_name,
			    const char  *link_id,
			    GdkScreen   *screen,
			    GError     **error)
{
	return egg_help_display_with_doc_id_on_screen (
			NULL, NULL, file_name, link_id, screen, error);
}

/**
 * egg_help_display_with_doc_id_on_screen:
 * @program: The current application object, or %NULL for the default one.
 * @doc_id: The document identifier, or %NULL to default to the application ID
 * (app_id) of the specified @program.
 * @file_name: The name of the help document to display.
 * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
 * requested document.
 * @screen: a #GdkScreen.
 * @error: A #GError instance that will hold the specifics of any error which
 * occurs during processing, or %NULL
 *
 * Description: Like gnome_help_display_with_doc_id(), but ensures that the help
 * viewer application appears on @screen.
 *
 * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
 * contain the actual error).
 **/
gboolean
egg_help_display_with_doc_id_on_screen (GnomeProgram  *program,
					const char    *doc_id,
					const char    *file_name,
					const char    *link_id,
					GdkScreen     *screen,
					GError       **error)
{
	gboolean   retval;
	char     **env;

	env = egg_screen_exec_environment (screen);

	retval = gnome_help_display_with_doc_id_and_env (
			program, doc_id, file_name, link_id, env, error);

	g_strfreev (env);

	return retval;
}

/**
 * egg_help_display_desktop_on_screen:
 * @program: The current application object, or %NULL for the default one.
 * @doc_id: The name of the help file relative to the system's help domain
 * (#GNOME_FILE_DOMAIN_HELP).
 * @file_name: The name of the help document to display.
 * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
 * requested document.
 * @screen: a #GdkScreen.
 * @error: A #GError instance that will hold the specifics of any error which
 * occurs during processing, or %NULL
 *
 * Description: Like gnome_help_display_desktop(), but ensures that the help
 * viewer application appears on @screen.
 *
 * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
 * contain the actual error).
 **/
gboolean
egg_help_display_desktop_on_screen (GnomeProgram  *program,
				    const char    *doc_id,
				    const char    *file_name,
				    const char    *link_id,
				    GdkScreen     *screen,
				    GError       **error)
{
	gboolean   retval;
	char     **env;

	env = egg_screen_exec_environment (screen);

	retval = gnome_help_display_desktop_with_env (
			program, doc_id, file_name, link_id, env, error);

	g_strfreev (env);

	return retval;
}

/**
 * egg_help_display_uri_on_screen:
 * @help_uri: The URI to display.
 * @screen: a #GdkScreen.
 * @error: A #GError instance that will hold the specifics of any error which
 * occurs during processing, or %NULL
 *
 * Description: Like gnome_help_display_uri(), but ensures that the help viewer
 * application appears on @screen.
 *
 * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
 * contain the actual error).
 **/
gboolean
egg_help_display_uri_on_screen (const char  *help_uri,
				GdkScreen   *screen,
				GError     **error)
{
	gboolean   retval;
	char     **env;

	env = egg_screen_exec_environment (screen);

	retval = gnome_help_display_uri_with_env (help_uri, env, error);

	g_strfreev (env);

	return retval;
}