summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-08-09 20:42:57 +0000
committerDarin Adler <darin@src.gnome.org>2000-08-09 20:42:57 +0000
commit39d0bf45867f213d1861beb57bda2d03c189f1d3 (patch)
tree377133c76541c4e397a8136cbd138938f149b838 /components
parentc33cedc829e0174457d70a5a093e7fd561597223 (diff)
downloadnautilus-39d0bf45867f213d1861beb57bda2d03c189f1d3.tar.gz
After this change, you will get a warning each time you exit
unless you get the new Bonobo with my destroy-notify bug fix. Fixed the "metafile read fails" bug. Fixed a bunch of memory leaks that I found because I added a new function to get rid of hash tables at quit time and there's a hash table with all the NautilusDirectory objects in there. I'm only 1/2 done with what I'm working on, but people need the "read fails" bug fix. * components/help/help-method.c: (escape_for_shell), (help_uri_to_string): Improve code that constructs URIs so it doesn't to excessive escaping. * libnautilus-extensions/nautilus-directory-async.c: (metafile_read_failed): Fixed a bug that caused it to fail to read "public" metafiles. (new_files_callback): Redid the fix for "NULL names" to check the result from the call instead of checking the name for NULL. * libnautilus-extensions/nautilus-directory-background.c: (nautilus_connect_background_to_directory_metadata): Got rid of the dummy callback so the NautilusDirectory code knows that only the metadata needs to be monitored. * libnautilus-extensions/nautilus-directory.c: (nautilus_directory_get): Got rid of silly ref and sink code. We don't use the floating feature, so we should just ignore it. Use the new function that creates a hash table that should be empty and freed on exit. This helps us detect leaks. (nautilus_directory_file_monitor_add): Got rid of incorrect code that would reject a caller that didn't supply a callback. Callers might want to monitor metadata only, not files. * libnautilus-extensions/nautilus-file.c: (nautilus_file_new_from_name): Got rid of silly ref and sink code. We don't use the floating feature, so we should just ignore it. (modify_link_hash_table), (add_to_link_hash_table_list), (add_to_link_hash_table), (remove_from_link_hash_table_list), (remove_from_link_hash_table): Maintain a hash table to map from a URI to links to that URI. (nautilus_file_new_from_info): Got rid of silly ref and sink code. We don't use the floating feature, so we should just ignore it. To share more code, call nautilus_file_update_info as part of the implementation here. (nautilus_file_update_info): Maintain the hash table entries as the symlink_name field changes. * libnautilus-extensions/nautilus-glib-extensions.h: * libnautilus-extensions/nautilus-glib-extensions.c: (free_hash_tables_at_exit), (nautilus_g_hash_table_new_free_at_exit): Added new function to create a hash table that should be empty on exit, check that is is empty, and free it at exit time. * libnautilus-extensions/nautilus-global-preferences.c: Got rid of some function-pointer casting. * libnautilus-extensions/nautilus-icon-container.h: * libnautilus-extensions/nautilus-icon-container.c: (call_icon_callback), (nautilus_icon_container_for_each): Added a new call to iterate all the icons in the container. Needed so we can unref all the files when we empty it. * libnautilus-extensions/nautilus-glib-extensions.h: * libnautilus-extensions/nautilus-mime-actions.c: (nautilus_mime_get_short_list_applications_for_uri), (nautilus_mime_get_short_list_components_for_uri): Updated for name change: NautilusGPredicateFunc -> NautilusPredicateFunction. * src/file-manager/fm-directory-view.c: (fm_directory_view_destroy), (done_loading): Added code to stop and clear when destroying the directory view. * src/file-manager/fm-icon-view.c: (unref_cover), (fm_icon_view_clear): Added code to get rid of the refs on all the files when the icon view is cleared. * src/file-manager/fm-list-view.c: (fm_list_view_clear): Added code to get rid of the refs on all the files when the icon view is cleared. * src/file-manager/nautilus-trash-monitor.h: * src/file-manager/nautilus-trash-monitor.c: (nautilus_trash_monitor_initialize_class), (destroy), (unref_trash_monitor), (nautilus_trash_monitor_get), (nautilus_trash_monitor_is_empty): Added code to destroy the trash monitor on exit. * src/nautilus-bookmark-list.c: (nautilus_bookmark_list_initialize_class), (stop_monitoring_one), (clear), (destroy), (nautilus_bookmark_list_load_file): Added code to clear out the list at destroy time the same way we already did before loading a file. * src/nautilus-window-menus.c: (free_bookmark_list), (get_bookmark_list): Add code to free the global bookmark list on exit to help with leak checking. (refresh_go_menu): Changed to use GList instead of GSList. * src/nautilus-window-private.h: * src/nautilus-window.c: (nautilus_window_destroy): Unref the current_location_bookmark and last_location_bookmark to fix a leak. (free_history_list), (nautilus_add_to_history_list): Free the history list at exit time to make it easier to spot leaks. (nautilus_window_get_history_list_callback): Change the history list to be a GList instead of GSList.
Diffstat (limited to 'components')
-rw-r--r--components/help/help-method.c70
1 files changed, 38 insertions, 32 deletions
diff --git a/components/help/help-method.c b/components/help/help-method.c
index ff07681c0..78e813c31 100644
--- a/components/help/help-method.c
+++ b/components/help/help-method.c
@@ -71,61 +71,67 @@ help_uri_new (void)
}
static char *
+escape_for_shell (const char *item)
+{
+ /* FIXME: This should add single quotes around items that need
+ * it and handle single quotes themselves right. For now, just
+ * put a placeholder that does ntohing.
+ */
+ return g_strdup (item);
+}
+
+static char *
help_uri_to_string (HelpURI *help_uri)
{
- const char *scheme;
- char *after_scheme;
- char *escaped, *uri;
+ const char *command;
+ char *parameter, *command_line, *escaped, *uri;
- scheme = "pipe:";
- after_scheme = NULL;
-
switch (help_uri->type) {
- case SGML_FILE: case XML_FILE:
+ case SGML_FILE: case XML_FILE:
+ command = "gnome-db2html2";
if (help_uri->section != NULL) {
- after_scheme = g_strdup_printf
- ("gnome-db2html2 %s?%s;mime-type=text/html",
- help_uri->file, help_uri->section);
+ parameter = g_strconcat (help_uri->file, "?", help_uri->section, NULL);
} else {
- after_scheme = g_strdup_printf
- ("gnome-db2html2 %s;mime-type=text/html",
- help_uri->file);
+ parameter = g_strdup (help_uri->file);
}
break;
case MAN_FILE:
- after_scheme = g_strdup_printf
- ("gnome-man2html2 %s;mime-type=text/html",
- help_uri->file);
+ command = "gnome-man2html2";
+ parameter = g_strdup (help_uri->file);
break;
case INFO_FILE:
- after_scheme = g_strdup_printf
- ("gnome-info2html2 %s;mime-type=text/html",
- help_uri->file);
+ command = "info2html2";
+ parameter = g_strdup (help_uri->file);
break;
+
case HTML_FILE:
- scheme = "file://";
- if (help_uri->section != NULL) {
- after_scheme = g_strconcat (help_uri->file,
- "#",
- help_uri->section,
- NULL);
- } else {
- after_scheme = g_strdup (help_uri->file);
+ escaped = gnome_vfs_escape_path_string (help_uri->file);
+ if (help_uri->section == NULL) {
+ uri = g_strconcat ("file://", escaped, NULL);
+ } else {
+ uri = g_strconcat ("file://", escaped, "#", help_uri->section, NULL);
}
- break;
+ g_free (escaped);
+ return uri;
case UNKNOWN_FILE:
return NULL;
default:
/* FIXME: An assert at runtime may be a bit harsh.
- * We'd like behavior more like g_return_if_fail.
+ * We'd prefer behavior more like g_return_if_fail.
+ * In glib 2.0 we can use g_return_val_if_reached.
*/
g_assert_not_reached ();
return NULL;
}
- escaped = gnome_vfs_escape_string (after_scheme);
- g_free (after_scheme);
- uri = g_strconcat (scheme, escaped, NULL);
+ /* Build a command line. */
+ escaped = escape_for_shell (parameter);
+ g_free (parameter);
+ command_line = g_strconcat (command, " ", escaped, ";mime-type=text/html", NULL);
+ g_free (escaped);
+ escaped = gnome_vfs_escape_string (command_line);
+ g_free (command_line);
+ uri = g_strconcat ("pipe:", escaped, NULL);
g_free (escaped);
return uri;