From 8e638ddd817039c0b6cdf342ce657b1b1e975b45 Mon Sep 17 00:00:00 2001 From: Mike Ruprecht Date: Wed, 24 Feb 2010 14:52:38 -0600 Subject: Separate the debug window into its own process. --- src/.gitignore | 1 + src/Makefile.am | 7 ++++++- src/empathy-debugger.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++ src/empathy-main-window.c | 32 ++++++++++++++++++++++++++++-- 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/empathy-debugger.c (limited to 'src') diff --git a/src/.gitignore b/src/.gitignore index 082f7cdd4..cf52a9c68 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -2,3 +2,4 @@ empathy empathy-accounts empathy-chat-chandler empathy-call-chandler +empathy-debugger diff --git a/src/Makefile.am b/src/Makefile.am index f63f7d65c..a01b759a1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -81,6 +81,7 @@ endif bin_PROGRAMS = \ empathy \ empathy-accounts \ + empathy-debugger \ $(NULL) BUILT_SOURCES= @@ -94,13 +95,17 @@ empathy_accounts_LDADD = \ libempathy-accounts-common.la \ $(NULL) +empathy_debugger_SOURCES = \ + empathy-debug-window.c empathy-debug-window.h \ + empathy-debugger.c \ + $(NULL) + empathy_handwritten_source = \ empathy-about-dialog.c empathy-about-dialog.h \ empathy-call-window-fullscreen.c empathy-call-window-fullscreen.h \ empathy-call-window.c empathy-call-window.h \ empathy-chat-window.c empathy-chat-window.h \ empathy-chatrooms-window.c empathy-chatrooms-window.h \ - empathy-debug-window.c empathy-debug-window.h \ empathy-event-manager.c empathy-event-manager.h \ empathy-ft-manager.c empathy-ft-manager.h \ empathy-invite-participant-dialog.c empathy-invite-participant-dialog.h \ diff --git a/src/empathy-debugger.c b/src/empathy-debugger.c new file mode 100644 index 000000000..ef6f503f1 --- /dev/null +++ b/src/empathy-debugger.c @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2005-2007 Imendio AB + * Copyright (C) 2007-2010 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include +#include + +#include +#include + +#include "empathy-debug-window.h" + +int +main (int argc, + char **argv) +{ + GtkWidget *window; + + g_thread_init (NULL); + gtk_init (&argc, &argv); + empathy_gtk_init (); + + g_set_application_name (_(PACKAGE_NAME " Debugger")); + + gtk_window_set_default_icon_name ("empathy"); + + window = empathy_debug_window_new (NULL); + g_signal_connect (window, "destroy", gtk_main_quit, NULL); + + gtk_main (); + + return EXIT_SUCCESS; +} diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 84331e7bd..c40b0df65 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -1,7 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 2002-2007 Imendio AB - * Copyright (C) 2007-2008 Collabora Ltd. + * Copyright (C) 2007-2010 Collabora Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -1095,7 +1095,35 @@ static void main_window_help_debug_cb (GtkAction *action, EmpathyMainWindow *window) { - empathy_debug_window_new (NULL); + GdkScreen *screen = gdk_screen_get_default (); + GError *error = NULL; + gchar *argv[2] = { NULL, }; + gint i = 0; + gchar *path; + + g_return_if_fail (GDK_IS_SCREEN (screen)); + + /* Try to run from source directory if possible */ + path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"), "src", + "empathy-debugger", NULL); + + if (!g_file_test (path, G_FILE_TEST_EXISTS)) { + g_free (path); + path = g_build_filename (BIN_DIR, "empathy-debugger", NULL); + } + + argv[i++] = path; + + gdk_spawn_on_screen (screen, NULL, argv, NULL, + G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, + NULL, NULL, NULL, &error); + + if (error) { + g_warning ("Failed to open debug window: %s", error->message); + g_error_free (error); + } + + g_free (path); } static void -- cgit v1.2.3