Commit 08b61728 authored by Darin Adler's avatar Darin Adler
Browse files

No parameters is indicated by "(void)" instead of "()".

	* components/help/help-method.c: (help_uri_new): No parameters
	is indicated by "(void)" instead of "()".
	(help_uri_to_string): Changed to share more code (I think I might
	have fixed a leak too).
	(init_help_module): No parameters is indicated by "(void)"
	instead of "()". Also fixed a bug where the wrong lock is unlocked.
	(convert_file_to_uri): Use g_strcasecmp instead of strcmp since we
	are checking MIME types.
	(transform_file), (transform_absolute_file), (file_from_path),
	(find_help_file), (transform_relative_file): Merged these so they
	share a lot of common code.

	* components/services/vault/command-line/vault-operations.c:
	(vault_list): Fixed a g_strconcat that was missing a trailing NULL.

	* libnautilus-extensions/nautilus-directory-private.h:
	* libnautilus-extensions/nautilus-file-attributes.h:
	* libnautilus-extensions/nautilus-directory-async.c:
	(cancel_top_left_read), (top_left_read_done),
	(top_left_read_callback), (top_left_read_more_callback),
	(start_getting_top_lefts), Changed top_left code to use
	nautilus_read_file calls.
	(cancel_metafile_read),
	Changed to reflect name changes in nautilus_read_file calls.
	(cancel_get_activation_uri), (nautilus_directory_cancel),
	(set_up_request_by_file_attributes),
	(nautilus_async_destroying_file), (lacks_activation_uri),
	(wants_activation_uri), (request_is_satisfied),
	(activation_uri_found),
	(activation_uri_nautilus_link_read_callback),
	(activation_uri_gmc_link_read_callback),
	(activation_uri_gmc_link_read_more_callback),
	(start_getting_activation_uris),
	(nautilus_directory_async_state_changed): Add code to fetch
	activation URIs for either GMC or Nautilus-style link files.
	(lacks_top_left): Changed to share common
	nautilus_file_should_get_top_left_text function so we don't have
	lots of different code reading the preferences about top-left
	text.
	(is_needy): Enhanced and renamed is_wanted so it takes into
	account files that are and aren't interesting.
	(start_getting_directory_counts), (deep_count_start):
	(start_getting_file_info), Change to use is_needy.

	* libnautilus-extensions/nautilus-directory.h:
	* libnautilus-extensions/nautilus-directory.c:
	Tweaked spacing.

	* libnautilus-extensions/nautilus-file-private.h:
	Added a self_owned flag so we do better with files that don't have
	parent directories and the fields to support activation_uri.

	* libnautilus-extensions/nautilus-file-utilities.h:
	* libnautilus-extensions/nautilus-file-utilities.c:
	(read_file_close_callback), (read_file_close),
	(read_file_succeeded), (read_file_failed),
	(read_file_read_callback), (read_file_read_chunk),
	(read_file_open_callback), (nautilus_read_file_async),
	(nautilus_read_entire_file_async), (nautilus_read_file_cancel):
	Added a variation of the read file call that takes a function to
	decide whether to keep reading or not.

	* libnautilus-extensions/nautilus-file.h:
	* libnautilus-extensions/nautilus-file.c:
	(nautilus_file_new_from_name), (nautilus_file_get),
	(nautilus_file_get_parent_uri_as_string),
	(get_file_for_parent_directory), (nautilus_file_rename),
	(nautilus_file_get_gnome_vfs_uri),
	(nautilus_file_get_uri),
	Add code that handles the "self_owned" flag to make files without
	parents work better.
	(destroy): Fixed some leaks I noticed.
	(nautilus_file_get_top_left_text),
	(nautilus_file_should_get_top_left_text): Added this so that all
	code can share a single call when deciding whether to get text
	based on local vs. non-local.
	(nautilus_file_get_activation_uri): Changed to work with new
	async. code to fetch this.

	* libnautilus-extensions/nautilus-icon-factory.c:
	(nautilus_icon_factory_get_icon_for_file): Call
	nautilus_file_should_get_top_left_text.

	* libnautilus-extensions/nautilus-link.h:
	* libnautilus-extensions/nautilus-link.c:
	(nautilus_link_is_link_file_name): Named so it's clear it looks
	at the file name only.
	(xml_get_root_property), (nautilus_link_get_root_property):
	Added these to share a lot of common code.
	(nautilus_link_get_additional_text): Use the new calls.
	(make_local_path), (icon_read_done_callback),
	(nautilus_link_get_image_uri), (nautilus_link_get_link_uri),
	(nautilus_link_get_display_name): Other cleanup and rewrite.
	(nautilus_link_get_link_uri_given_file_contents): Add API that
	can work with the async. I/O version.

	* libnautilus-extensions/nautilus-stock-dialogs.c:
	(timed_wait_free), (nautilus_timed_wait_start):
	Added some asserts.

	* src/file-manager/fm-directory-view.c: (activate_callback),
	(fm_directory_view_activate_file): Use call_when_ready and
	the new async. stuff.

	* src/file-manager/fm-error-reporting.c:
	(fm_report_error_setting_group): Added a (low-quality) error
	message for the case where you aren't alowed to change the
	group of something.

	* src/file-manager/fm-icon-view.c:
	(icon_position_changed_callback): Added missing NULL in a call
	to g_strconcat.
	(get_icon_text_callback): Fix storage leak.

	* src/file-manager/fm-properties-window.c:
	(activate_owner_callback): Fixed a timed_wait_start/stop mismatch
	that was causing an assert and other badness when you changed the
	owner.

	* src/file-manager/fm-search-list-view.c:
	(get_attribute_from_column): Added a missing case to prevent a
	crash, but had to put in a FIXME since the code isn't really working.

	* src/nautilus-application.c: (nautilus_application_startup):
	Fixed bug where you wouldn't see error messages on startup.  Also
	improved one of the error messages by adding some blank lines.
parent 0ea93ae3
2000-07-25 Darin Adler <darin@eazel.com>
* components/help/help-method.c: (help_uri_new): No parameters
is indicated by "(void)" instead of "()".
(help_uri_to_string): Changed to share more code (I think I might
have fixed a leak too).
(init_help_module): No parameters is indicated by "(void)"
instead of "()". Also fixed a bug where the wrong lock is unlocked.
(convert_file_to_uri): Use g_strcasecmp instead of strcmp since we
are checking MIME types.
(transform_file), (transform_absolute_file), (file_from_path),
(find_help_file), (transform_relative_file): Merged these so they
share a lot of common code.
* components/services/vault/command-line/vault-operations.c:
(vault_list): Fixed a g_strconcat that was missing a trailing NULL.
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-file-attributes.h:
* libnautilus-extensions/nautilus-directory-async.c:
(cancel_top_left_read), (top_left_read_done),
(top_left_read_callback), (top_left_read_more_callback),
(start_getting_top_lefts), Changed top_left code to use
nautilus_read_file calls.
(cancel_metafile_read),
Changed to reflect name changes in nautilus_read_file calls.
(cancel_get_activation_uri), (nautilus_directory_cancel),
(set_up_request_by_file_attributes),
(nautilus_async_destroying_file), (lacks_activation_uri),
(wants_activation_uri), (request_is_satisfied),
(activation_uri_found),
(activation_uri_nautilus_link_read_callback),
(activation_uri_gmc_link_read_callback),
(activation_uri_gmc_link_read_more_callback),
(start_getting_activation_uris),
(nautilus_directory_async_state_changed): Add code to fetch
activation URIs for either GMC or Nautilus-style link files.
(lacks_top_left): Changed to share common
nautilus_file_should_get_top_left_text function so we don't have
lots of different code reading the preferences about top-left
text.
(is_needy): Enhanced and renamed is_wanted so it takes into
account files that are and aren't interesting.
(start_getting_directory_counts), (deep_count_start):
(start_getting_file_info), Change to use is_needy.
* libnautilus-extensions/nautilus-directory.h:
* libnautilus-extensions/nautilus-directory.c:
Tweaked spacing.
* libnautilus-extensions/nautilus-file-private.h:
Added a self_owned flag so we do better with files that don't have
parent directories and the fields to support activation_uri.
* libnautilus-extensions/nautilus-file-utilities.h:
* libnautilus-extensions/nautilus-file-utilities.c:
(read_file_close_callback), (read_file_close),
(read_file_succeeded), (read_file_failed),
(read_file_read_callback), (read_file_read_chunk),
(read_file_open_callback), (nautilus_read_file_async),
(nautilus_read_entire_file_async), (nautilus_read_file_cancel):
Added a variation of the read file call that takes a function to
decide whether to keep reading or not.
* libnautilus-extensions/nautilus-file.h:
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_new_from_name), (nautilus_file_get),
(nautilus_file_get_parent_uri_as_string),
(get_file_for_parent_directory), (nautilus_file_rename),
(nautilus_file_get_gnome_vfs_uri),
(nautilus_file_get_uri),
Add code that handles the "self_owned" flag to make files without
parents work better.
(destroy): Fixed some leaks I noticed.
(nautilus_file_get_top_left_text),
(nautilus_file_should_get_top_left_text): Added this so that all
code can share a single call when deciding whether to get text
based on local vs. non-local.
(nautilus_file_get_activation_uri): Changed to work with new
async. code to fetch this.
* libnautilus-extensions/nautilus-icon-factory.c:
(nautilus_icon_factory_get_icon_for_file): Call
nautilus_file_should_get_top_left_text.
* libnautilus-extensions/nautilus-link.h:
* libnautilus-extensions/nautilus-link.c:
(nautilus_link_is_link_file_name): Named so it's clear it looks
at the file name only.
(xml_get_root_property), (nautilus_link_get_root_property):
Added these to share a lot of common code.
(nautilus_link_get_additional_text): Use the new calls.
(make_local_path), (icon_read_done_callback),
(nautilus_link_get_image_uri), (nautilus_link_get_link_uri),
(nautilus_link_get_display_name): Other cleanup and rewrite.
(nautilus_link_get_link_uri_given_file_contents): Add API that
can work with the async. I/O version.
* libnautilus-extensions/nautilus-stock-dialogs.c:
(timed_wait_free), (nautilus_timed_wait_start):
Added some asserts.
* src/file-manager/fm-directory-view.c: (activate_callback),
(fm_directory_view_activate_file): Use call_when_ready and
the new async. stuff.
* src/file-manager/fm-error-reporting.c:
(fm_report_error_setting_group): Added a (low-quality) error
message for the case where you aren't alowed to change the
group of something.
* src/file-manager/fm-icon-view.c:
(icon_position_changed_callback): Added missing NULL in a call
to g_strconcat.
(get_icon_text_callback): Fix storage leak.
* src/file-manager/fm-properties-window.c:
(activate_owner_callback): Fixed a timed_wait_start/stop mismatch
that was causing an assert and other badness when you changed the
owner.
* src/file-manager/fm-search-list-view.c:
(get_attribute_from_column): Added a missing case to prevent a
crash, but had to put in a FIXME since the code isn't really working.
* src/nautilus-application.c: (nautilus_application_startup):
Fixed bug where you wouldn't see error messages on startup. Also
improved one of the error messages by adding some blank lines.
2000-07-25 Gene Z. Ragan <gzr@eazel.com>
* src/file-manager/fm-desktop-icon-view.c:
......@@ -23,18 +152,17 @@
(free_device_info):
Clean up all data in DeviceEntry structure.
2000-07-25 Arlo Rose <set EMAIL_ADDRESS environment variable>
2000-07-25 Arlo Rose <arlo@eazel.com>
* icons/Makefile.am:
* icons/emblem-trash.png
Added the Trash emblem for items found in the trash by a search.
It will change in the future when/if I clean up or change the
real trash can icon.
2000-07-25 Robey Pointer <robey@eazel.com>
*
components/services/install/command-line/eazel-alt-install-corba.c:
* components/services/install/command-line/eazel-alt-install-corba.c:
(delete_files), (set_root_client), (main):
* components/services/install/idl/trilobite-eazel-install.idl:
* components/services/install/lib/eazel-install-corba-callback.c:
......@@ -53,11 +181,8 @@
2000-07-25 Robey Pointer <robey@eazel.com>
*
components/services/trilobite/libtrilobite/trilobite-root-client-pu
blic.h:
*
components/services/trilobite/libtrilobite/trilobite-root-client.c:
* components/services/trilobite/libtrilobite/trilobite-root-client-public.h:
* components/services/trilobite/libtrilobite/trilobite-root-client.c:
(trilobite_root_client_get_passwordqueryclient),
(trilobite_root_client_attach):
* components/services/trilobite/sample/command-line/main.c: (main):
......@@ -659,8 +784,9 @@ Thu Jul 20 10:41:26 2000 Raph Levien <raph@acm.org>
added forgotten file from last commit
2000-07-19 Rebecca Schulman <rebecka@eazel.com>
Created initial list view for search results, as a subclass (sort of)
of fm-list-view
Created initial list view for search results, as a subclass (sort
of) of fm-list-view
* src/file-manager/fm-list-view.h:
* src/file-manager/fm-list-view.c: (fm_list_view_initialize_class),
......@@ -689,12 +815,9 @@ Thu Jul 20 10:41:26 2000 Raph Levien <raph@acm.org>
* src/file-manager/Makefile.am: added new fm-search-list-view.* files
2000-07-19 Robey Pointer <robey@eazel.com>
*
components/services/trilobite/libtrilobite/trilobite-core-utils.h:
* components/services/trilobite/libtrilobite/trilobite-core-utils.h:
Add __GNUC__ alternate of trilobite_debug for non-gcc compilers.
2000-07-19 Darin Adler <darin@eazel.com>
......@@ -787,7 +910,6 @@ Thu Jul 20 10:41:26 2000 Raph Levien <raph@acm.org>
(eazel_helper_password), (trilobite_root_helper_start),
(trilobite_root_helper_run_program):
* components/services/trilobite/sample/service/main.c: (main):
Add "debug" option to trilobite_init(). If debug mode is on,
the trilobite_debug() macro will be the debug equivalent of
g_message(). Added debugging log messages to the root-helper
......
......@@ -20,25 +20,19 @@
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "help-method.h"
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include <gnome.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomevfs/gnome-vfs-mime.h>
#include "help-method.h"
#include <libgnomevfs/gnome-vfs-module.h>
#include <libgnomevfs/gnome-vfs-module-shared.h>
#include <libgnomevfs/gnome-vfs-module.h>
#include <libgnomevfs/gnome-vfs.h>
#include <stdio.h>
#include <string.h>
#define ALI_DEBUG
static gboolean already_initialized = FALSE;
G_LOCK_DEFINE_STATIC (already_initialized);
......@@ -55,8 +49,8 @@ typedef enum {
} HelpFileTypes;
typedef struct {
gchar *file; /* The absolute path */
gchar *section;
char *file; /* The absolute path */
char *section;
HelpFileTypes type;
} HelpURI;
......@@ -65,7 +59,7 @@ static gboolean file_in_info_path (const char *file);
static HelpURI *
help_uri_new ()
help_uri_new (void)
{
HelpURI *retval;
......@@ -75,63 +69,63 @@ help_uri_new ()
return retval;
}
static gchar *
static char *
help_uri_to_string (HelpURI *help_uri)
{
gchar *retval;
gchar *after_method;
gchar *escaped_uri;
const char *scheme;
char *after_scheme;
char *escaped, *uri;
retval = NULL;
after_method = NULL;
escaped_uri = NULL;
scheme = "pipe:";
after_scheme = NULL;
switch (help_uri->type) {
case SGML_FILE:
if (help_uri->section) {
after_method = g_strdup_printf ("gnome-db2html2 %s?%s;mime-type=text/html",
help_uri->file, help_uri->section);
escaped_uri = gnome_vfs_escape_string (after_method);
retval = g_strconcat ("pipe:", escaped_uri, NULL);
if (help_uri->section != NULL) {
after_scheme = g_strdup_printf
("gnome-db2html2 %s?%s;mime-type=text/html",
help_uri->file, help_uri->section);
} else {
after_method = g_strdup_printf ("gnome-db2html2 %s;mime-type=text/html",
help_uri->file);
escaped_uri = gnome_vfs_escape_string (after_method);
retval = g_strconcat ("pipe:", escaped_uri, NULL);
after_scheme = g_strdup_printf
("gnome-db2html2 %s;mime-type=text/html",
help_uri->file);
}
break;
case MAN_FILE:
after_method = g_strdup_printf ("gnome-man2html2 %s;mime-type=text/html",
help_uri->file);
escaped_uri = gnome_vfs_escape_string (after_method);
retval = g_strconcat ("pipe:", escaped_uri, NULL);
after_scheme = g_strdup_printf
("gnome-man2html2 %s;mime-type=text/html",
help_uri->file);
break;
case INFO_FILE:
after_method = g_strdup_printf ("gnome-info2html2 %s;mime-type=text/html",
help_uri->file);
escaped_uri = gnome_vfs_escape_string (after_method);
retval = g_strconcat ("pipe:", escaped_uri, NULL);
after_scheme = g_strdup_printf
("gnome-info2html2 %s;mime-type=text/html",
help_uri->file);
break;
case HTML_FILE:
if (help_uri->section) {
retval = g_strdup_printf ("file://%s#%s", help_uri->file, help_uri->section);
scheme = "file://";
if (help_uri->section != NULL) {
after_scheme = g_strconcat (help_uri->file,
"#",
help_uri->section,
NULL);
} else {
retval = g_strdup_printf ("file://%s", help_uri->file);
after_scheme = g_strdup (help_uri->file);
}
break;
default:
/* FIXME: This needs to be removed so things can be handled more
* gracefully (i.e. g_warning) */
/* FIXME: An assert at runtime may be a bit harsh.
* We'd like behavior more like g_return_if_fail.
*/
g_assert_not_reached ();
return NULL;
}
if (after_method != NULL) {
g_free (after_method);
}
if (escaped_uri != NULL) {
g_free (escaped_uri);
}
escaped = gnome_vfs_escape_string (after_scheme);
g_free (after_scheme);
uri = g_strconcat (scheme, escaped, NULL);
g_free (escaped);
return retval;
return uri;
}
static void
......@@ -143,7 +137,7 @@ help_uri_free (HelpURI *help_uri)
}
static void
init_help_module ()
init_help_module (void)
{
G_LOCK (already_initialized);
if (already_initialized) {
......@@ -155,13 +149,13 @@ init_help_module ()
G_LOCK (app_list);
app_list = g_hash_table_new (g_str_hash, g_str_equal);
G_UNLOCK (already_initialized);
G_UNLOCK (app_list);
}
static gboolean
convert_file_to_uri (HelpURI *help_uri, gchar *file)
convert_file_to_uri (HelpURI *help_uri, char *file)
{
const gchar *mime_type;
const char *mime_type;
if (!g_file_test (file, G_FILE_TEST_ISFILE | G_FILE_TEST_ISLINK)) {
return FALSE;
......@@ -169,194 +163,176 @@ convert_file_to_uri (HelpURI *help_uri, gchar *file)
help_uri->file = file;
mime_type = gnome_vfs_get_file_mime_type (file, NULL, FALSE);
if (strcmp (mime_type, "text/sgml") == 0) {
if (g_strcasecmp (mime_type, "text/sgml") == 0) {
help_uri->type = SGML_FILE;
} else if (strcmp (mime_type, "text/html") == 0) {
} else if (g_strcasecmp (mime_type, "text/html") == 0) {
help_uri->type = HTML_FILE;
} else if (strcmp (mime_type, "application/x-troff-man") == 0) {
} else if (g_strcasecmp (mime_type, "application/x-troff-man") == 0) {
/* FIXME: The check above used to check for a prefix
* of "application/x-troff-man", but now we check for
* an exact string match. Is that what we really want?
*/
help_uri->type = MAN_FILE;
} else if (file_in_info_path (file)) {
help_uri->type = INFO_FILE;
}
return TRUE;
}
}
/* We can handle sgml, info and html files only.
*
* possible formats:
*
* /path/to/file[.sgml][?section]
* /path/to/file[.html][#section]
* /absolute/path/to/file[.sgml]
*/
static HelpURI *
transform_absolute_file (const gchar *file)
transform_file (const char *old_uri,
char * (* compute_uri_function) (const char *base))
{
HelpURI *help_uri;
gchar *temp_file_base, *temp_file2, *temp_file;
gchar *p;
char *p;
char *base, *new_uri, *new_uri_with_extension;
help_uri = help_uri_new ();
p = strrchr (file, '?');
/* Find the part after either a "?" or a "#". Only look for a
* "#" if there is no "?". (We could instead use strpbrk to
* search for the first occurence of either "?" or "#".)
*/
p = strrchr (old_uri, '?');
if (p == NULL) {
p = strrchr (g_strchomp((gchar *)file), '#');
}
p = strrchr (old_uri, '#');
}
if (p) {
help_uri->section = g_strdup (p+1);
temp_file_base = g_strndup (file, p - file);
if (p == NULL) {
base = g_strdup (old_uri);
} else {
/* we do not want trailing spaces or it can screw things up */
temp_file_base = g_strdup (g_strchomp ((gchar *) file));
help_uri->section = g_strdup (p + 1);
base = g_strndup (old_uri, p - old_uri);
}
/* Concantation to TOPHELPDIR commented out because this is an
* ABSOLUTE uri
temp_file = g_concat_dir_and_file (TOPHELPDIR, temp_file_base); */
/* First we try the file directly */
temp_file = g_strdup (temp_file_base);
if (convert_file_to_uri (help_uri, temp_file)) {
g_free (temp_file_base);
/* We do not want trailing spaces or it can screw things up. */
g_strchomp (base);
/* Call the passed in function to compute the URI. */
new_uri = (* compute_uri_function) (base);
g_free (base);
if (new_uri == NULL) {
help_uri_free (help_uri);
return NULL;
}
/* Try the URI. */
if (convert_file_to_uri (help_uri, new_uri)) {
return help_uri;
}
/* Next, we try to add extensions */
temp_file2 = g_strdup_printf ("%s.sgml", temp_file);
if (convert_file_to_uri (help_uri, temp_file2) != FALSE) {
g_free (temp_file);
g_free (temp_file_base);
/* Try with an sgml extension. */
new_uri_with_extension = g_strconcat (new_uri, ".sgml", NULL);
if (convert_file_to_uri (help_uri, new_uri)) {
g_free (new_uri);
return help_uri;
}
g_free (new_uri_with_extension);
g_free (temp_file2);
temp_file2 = g_strdup_printf ("%s.html", temp_file);
if (convert_file_to_uri (help_uri, temp_file2) != FALSE) {
g_free (temp_file);
g_free (temp_file_base);
/* Try with an html extension. */
new_uri_with_extension = g_strconcat (new_uri, ".html", NULL);
if (convert_file_to_uri (help_uri, new_uri)) {
g_free (new_uri);
return help_uri;
}
g_free (new_uri_with_extension);
/* Failed, so return. */
g_free (new_uri);
help_uri_free (help_uri);
return NULL;
}
/* We can handle sgml, info and html files only.
*
* possible formats:
*
* /path/to/file[.sgml][?section]
* /path/to/file[.html][#section]
* /absolute/path/to/file[.sgml]
*/
static HelpURI *
transform_absolute_file (const char *file)
{
return transform_file (file, g_strdup);
}
/* Possible cases for 'path' in this function are:
* path/to/file[.sgml]
* file[.sgml]
*/
static char *
file_from_path (const char *path) {
file_from_path (const char *path)
{
const char *slash, *period;
char *retval;
/* Get rid of the path to just get the filename */
retval = NULL;
period = NULL;
slash = strrchr (path, '/');
if (slash != NULL) {
period = strchr (slash, '.');
} else {
period = strchr (path, '.');
}
if (period != NULL) {
if (slash == NULL) {
/* e.g. file.sgml */
retval = g_strndup (path, period - path);
return g_strndup (path, period - path);
} else {
/* e.g. path/to/file.sgml */
slash = slash + 1; /* Get rid of leading '/' */
retval = g_strndup (slash, period - slash);
return g_strndup (slash, period - slash);
}
} else {
if (slash != NULL) {
/* e.g. path/to/file */
retval = g_strndup (slash+1, strlen (slash+1));
return g_strdup (slash+1);
} else {
/* e.g. file */
retval = g_strdup (path);
return g_strdup (path);
}
}
return retval;
}
static HelpURI *
transform_relative_file (const gchar *file)
static char *
find_help_file (const char *old_uri)
{
HelpURI *help_uri;
gchar *temp_file, *temp_file_base, *temp_file2;
gchar *appname;
gchar *p;
char *base_name, *new_uri;
help_uri = help_uri_new ();
p = strrchr (file, '?');
if (p == NULL) {
p = strrchr (g_strchomp ((gchar *)file), '#');
}
base_name = file_from_path (old_uri);
if (base_name == NULL || base_name[0] == '\0') {
g_free (base_name);
return NULL;
}
if (p) {
help_uri->section = g_strdup (p+1);
temp_file_base = g_strndup (file, p - file);
} else {
temp_file_base = g_strdup (g_strchomp ((gchar *) file));
}
appname = file_from_path (temp_file_base);
if (strcmp (appname, "") == 0) {
/* NULL string */
g_free (appname);
appname = NULL;
}
if (appname == NULL)
return NULL;
/* FIXME: gnome_help_file_path should take const char * parameters. */
new_uri = gnome_help_file_path (base_name, (char *) old_uri);
g_free (base_name);
/* Get the help file while taking i18n into account */
temp_file = gnome_help_file_path (appname, temp_file_base);
if (convert_file_to_uri (help_uri, temp_file) != FALSE) {
g_free (temp_file_base);
return help_uri;