summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-debug.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-01-18 18:55:36 +0000
committerDarin Adler <darin@src.gnome.org>2000-01-18 18:55:36 +0000
commit7e292ac0048804f96845aa930d584dc24ed90d38 (patch)
treec171d655adf8726565219d65457e6488e9d73aeb /libnautilus-private/nautilus-debug.c
parent98d22d4f2b47e8c5d580a3745967826f15ddfc02 (diff)
downloadnautilus-7e292ac0048804f96845aa930d584dc24ed90d38.tar.gz
Added first cut at code to put metafiles in the user's home directory if
* libnautilus/nautilus-directory.c: (nautilus_directory_read_metafile): (nautilus_directory_try_to_read_metafile): (nautilus_directory_write_metafile): (nautilus_directory_try_to_write_metafile): (nautilus_directory_switch_to_alternate_metafile_uri): (nautilus_directory_escape_slashes): (nautilus_make_directory_and_parents): Added first cut at code to put metafiles in the user's home directory if the directory is not accessible and you can't read and write a metafile in the directory itself. We'll have to refine this later to handle cases where you end up with two metafiles. * libnautilus/Makefile.am: libnautilus/nautilus-debug.h: libnautilus/nautilus-debug.c: Took trick for getting into the debugger and put it into a public header file so it can be used outside of the nautilus executable. * src/ntl-main.c: (stop_in_debugger): (nautilus_stop_after_default_log_handler): (main): Use the new calls from libnautilus to set up the drop into debugger for criticals and warnings. * src/file-manager/fm-main.c: (main): Minimized includes and used the new calls from libnautilus to set up the drop into debugger for criticals and warnings. * src/ntl-uri-map.c: (nautilus_navinfo_add_mapping): src/ntl-window.c: (nautilus_window_constructed): src/file-manager/fm-directory-view.c: (fm_directory_view_initialize): (fm_directory_view_destroy): (notify_location_change_cb): (stop_location_change_cb): (fm_directory_view_sort): Removed some messages that aren't so useful. * libnautilus/ntl-view-frame.h: Minimized includes. * libnautilus/ntl-view-frame.c: Include "ntl-view-frame.h" first so it tests to see that it has sufficient includes in it. * src/ntl-view.c: (nautilus_view_load_client): Changed function so that NULL for an iid is allowed and simply results in a failed load instead of being illegal. * src/ntl-window-msgs.c: (nautilus_window_change_location_internal): src/ntl-window.c: (nautilus_window_up): Got rid of calls to gnome_vfs_uri_destroy; use gnome_vfs_uri_unref instead since it's safer and Federico is getting rid of gnome_vfs_uri_destroy. * src/file-manager/fm-directory-view-icons.h: src/file-manager/fm-directory-view-icons.c: (fm_directory_view_icons_new): src/file-manager/fm-directory-view-list.h: src/file-manager/fm-directory-view-list.c: (fm_directory_view_list_new): src/file-manager/fm-directory-view.h: src/file-manager/fm-directory-view.c: (fm_directory_view_new): Minimized includes and got rid of the unused _new functions. * libnautilus/nautilus-directory.h: Added a missing 2000 copyright date.
Diffstat (limited to 'libnautilus-private/nautilus-debug.c')
-rw-r--r--libnautilus-private/nautilus-debug.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-debug.c b/libnautilus-private/nautilus-debug.c
new file mode 100644
index 000000000..50343e12c
--- /dev/null
+++ b/libnautilus-private/nautilus-debug.c
@@ -0,0 +1,87 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-debug.c: Nautilus debugging aids.
+
+ Copyright (C) 2000 Eazel, Inc.
+
+ 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.
+
+ Author: Darin Adler <darin@eazel.com>
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "nautilus-debug.h"
+
+#include <glib.h>
+#include <signal.h>
+
+/* Raise a SIGINT signal to get the attention of the debugger.
+ When not running under the debugger, we don't want to stop,
+ so we ignore the signal for just the moment that we raise it.
+*/
+void
+nautilus_stop_in_debugger (void)
+{
+ void (* saved_handler) (int);
+
+ saved_handler = signal (SIGINT, SIG_IGN);
+ raise (SIGINT);
+ signal (SIGINT, saved_handler);
+}
+
+/* Stop in the debugger after running the default log handler.
+ This makes certain kinds of messages stop in the debugger
+ without making them fatal.
+*/
+static void
+nautilus_stop_after_default_log_handler (const char *domain,
+ GLogLevelFlags level,
+ const char *message,
+ gpointer data)
+{
+ g_log_default_handler (domain, level, message, data);
+ nautilus_stop_in_debugger ();
+}
+
+static void
+nautilus_set_stop_after_default_log_handler (const char *domain)
+{
+ g_log_set_handler (domain, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
+ nautilus_stop_after_default_log_handler, NULL);
+}
+
+void
+nautilus_make_warnings_and_criticals_stop_in_debugger (const char *first_domain, ...)
+{
+ va_list domains;
+ const char *domain;
+
+ nautilus_set_stop_after_default_log_handler (first_domain);
+
+ va_start (domains, first_domain);
+
+ for (;;) {
+ domain = va_arg (domains, const char *);
+ if (domain == NULL)
+ break;
+ nautilus_set_stop_after_default_log_handler (domain);
+ }
+
+ va_end (domains);
+}