aboutsummaryrefslogtreecommitdiffstats
path: root/shell/evolution-shell-component.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-31 00:39:46 +0800
committerDan Winship <danw@src.gnome.org>2001-03-31 00:39:46 +0800
commitbfdcfc7949e01f47ee4d39de425a993033c413b0 (patch)
tree2c088c5655c9c608fb4756da5f1fd6213b7b5212 /shell/evolution-shell-component.c
parent911f4543a29d5a5ba99a5b1e6f9a847bc06fb78b (diff)
downloadgsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar
gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar.gz
gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar.bz2
gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar.lz
gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar.xz
gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar.zst
gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.zip
add a "debug" method to tell a component to output debugging messages to a
* Evolution-ShellComponent.idl: add a "debug" method to tell a component to output debugging messages to a given file. * main.c (main): Add a "--debug filename" argument, to direct debugging output for all components to a file. Redirect the shell's stdout/stderr to that file if this argument is used. * evolution-shell-component-client.c (evolution_shell_component_client_set_owner): If debug_log is set, call the component's debug method as well. * evolution-shell-component.c (impl_ShellComponent_debug): redirect stdout/stderr to the named file and emit a "debug" signal. svn path=/trunk/; revision=9046
Diffstat (limited to 'shell/evolution-shell-component.c')
-rw-r--r--shell/evolution-shell-component.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index d76b28a9ae..c29b3b00b7 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -25,6 +25,8 @@
#include <config.h>
#endif
+#include <fcntl.h>
+
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-object.h>
@@ -57,6 +59,7 @@ struct _EvolutionShellComponentPrivate {
enum {
OWNER_SET,
OWNER_UNSET,
+ DEBUG,
LAST_SIGNAL
};
@@ -215,6 +218,29 @@ impl_ShellComponent_unset_owner (PortableServer_Servant servant,
gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_UNSET]);
}
+static void
+impl_ShellComponent_debug (PortableServer_Servant servant,
+ const CORBA_char *log_path,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionShellComponent *shell_component;
+ int fd;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object);
+
+ fd = open (log_path, O_WRONLY | O_APPEND);
+ if (!fd)
+ return;
+
+ dup2 (fd, STDOUT_FILENO);
+ dup2 (fd, STDERR_FILENO);
+ close (fd);
+
+ gtk_signal_emit (GTK_OBJECT (shell_component), signals[DEBUG]);
+}
+
static Bonobo_Control
impl_ShellComponent_create_view (PortableServer_Servant servant,
const CORBA_char *physical_uri,
@@ -436,6 +462,14 @@ class_init (EvolutionShellComponentClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ signals[DEBUG]
+ = gtk_signal_new ("debug",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, debug),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
parent_class = gtk_type_class (PARENT_TYPE);
@@ -443,6 +477,7 @@ class_init (EvolutionShellComponentClass *klass)
epv->_get_supported_types = impl_ShellComponent__get_supported_types;
epv->setOwner = impl_ShellComponent_set_owner;
epv->unsetOwner = impl_ShellComponent_unset_owner;
+ epv->debug = impl_ShellComponent_debug;
epv->createView = impl_ShellComponent_create_view;
epv->createFolderAsync = impl_ShellComponent_async_create_folder;
epv->removeFolderAsync = impl_ShellComponent_async_remove_folder;