[empathy] Separate the debug window into its own process.



commit 8e638ddd817039c0b6cdf342ce657b1b1e975b45
Author: Mike Ruprecht <mike ruprecht collabora co uk>
Date:   Wed Feb 24 14:52:38 2010 -0600

    Separate the debug window into its own process.

 po/POTFILES.in            |    1 +
 src/.gitignore            |    1 +
 src/Makefile.am           |    7 +++++-
 src/empathy-debugger.c    |   50 +++++++++++++++++++++++++++++++++++++++++++++
 src/empathy-main-window.c |   32 +++++++++++++++++++++++++++-
 5 files changed, 88 insertions(+), 3 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 65bb2b9..7b231f3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -93,3 +93,4 @@ src/empathy-invite-participant-dialog.c
 src/cc-empathy-accounts-page.c
 src/cc-empathy-accounts-panel.c
 src/empathy-accounts.c
+src/empathy-debugger.c
diff --git a/src/.gitignore b/src/.gitignore
index 082f7cd..cf52a9c 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 f63f7d6..a01b759 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 0000000..ef6f503
--- /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 <config.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include <libempathy/empathy-utils.h>
+#include <libempathy-gtk/empathy-ui-utils.h>
+
+#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 84331e7..c40b0df 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]