[gedit/gnome-3-0] Add debug tracing for the dbus stuff.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/gnome-3-0] Add debug tracing for the dbus stuff.
- Date: Mon, 13 Jun 2011 13:41:53 +0000 (UTC)
commit 25374149a9c5ae69259ec7931370dead2792d396
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Jun 4 23:07:30 2011 +0200
Add debug tracing for the dbus stuff.
gedit/gedit-app.c | 6 ++++--
gedit/gedit-dbus.c | 44 +++++++++++++++++++++++++++++++++++---------
gedit/gedit-debug.c | 5 +++--
gedit/gedit-debug.h | 4 +++-
gedit/gedit-window.c | 11 ++++++++++-
5 files changed, 55 insertions(+), 15 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 37b9e67..59a5a49 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -675,8 +675,6 @@ gedit_app_create_window_real (GeditApp *app,
{
GeditWindow *window;
- gedit_debug (DEBUG_APP);
-
/*
* We need to be careful here, there is a race condition:
* when another gedit is launched it checks active_window,
@@ -766,6 +764,8 @@ gedit_app_create_window (GeditApp *app,
{
GeditWindow *window;
+ gedit_debug (DEBUG_APP);
+
window = gedit_app_create_window_real (app, TRUE, NULL);
if (screen != NULL)
@@ -784,6 +784,8 @@ _gedit_app_restore_window (GeditApp *app,
{
GeditWindow *window;
+ gedit_debug (DEBUG_APP);
+
window = gedit_app_create_window_real (app, FALSE, role);
return window;
diff --git a/gedit/gedit-dbus.c b/gedit/gedit-dbus.c
index fea2752..23fd04b 100644
--- a/gedit/gedit-dbus.c
+++ b/gedit/gedit-dbus.c
@@ -24,11 +24,12 @@
#include <errno.h>
#include <stdlib.h>
#include <gdk/gdk.h>
-#include "gedit-utils.h"
-#include "gedit-command-line.h"
-#include "gedit-window.h"
+#include "gedit-debug.h"
#include "gedit-app.h"
+#include "gedit-command-line.h"
#include "gedit-commands.h"
+#include "gedit-window.h"
+#include "gedit-utils.h"
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
@@ -250,6 +251,8 @@ activate_service (GeditDBus *dbus,
GDBusConnection *conn;
GVariant *ret;
+ gedit_debug (DEBUG_DBUS);
+
conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
if (conn == NULL)
@@ -485,6 +488,8 @@ on_open_proxy_signal (GDBusProxy *proxy,
GVariant *parameters,
GeditDBus *dbus)
{
+ gedit_debug (DEBUG_DBUS);
+
if (g_strcmp0 (signal_name, "WaitDone") == 0)
{
guint wait_id;
@@ -716,6 +721,8 @@ handle_slave (GeditDBus *dbus)
GDBusProxyFlags flags;
GeditCommandLine *command_line;
+ gedit_debug (DEBUG_DBUS);
+
conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
if (conn == NULL)
@@ -754,6 +761,8 @@ handle_slave (GeditDBus *dbus)
static GeditDBusResult
handle_master (GeditDBus *dbus)
{
+ gedit_debug (DEBUG_DBUS);
+
/* let the main gedit thing do its thing */
if (g_getenv ("DBUS_STARTER_ADDRESS"))
{
@@ -910,6 +919,8 @@ set_interaction_time_and_present (GeditWindow *window,
* has been realized otherwise it will not work. lame.
*/
+ gedit_debug (DEBUG_DBUS);
+
if (!gtk_widget_get_realized (GTK_WIDGET (window)))
{
gtk_widget_realize (GTK_WIDGET (window));
@@ -1511,13 +1522,18 @@ dbus_command_line_method_call_cb (GDBusConnection *connection,
g_return_if_fail (g_strcmp0 (object_path, "/org/gnome/gedit") == 0);
g_return_if_fail (g_strcmp0 (interface_name, "org.gnome.gedit.CommandLine") == 0);
- if (g_strcmp0 (method_name, "Open") == 0)
+ if (method_name != NULL)
{
- dbus_handle_open (user_data, parameters, invocation);
- }
- else
- {
- g_warning ("Unsupported method called on gedit service: %s", method_name);
+ gedit_debug_message (DEBUG_DBUS, "method: %s\n", method_name);
+
+ if (g_strcmp0 (method_name, "Open") == 0)
+ {
+ dbus_handle_open (user_data, parameters, invocation);
+ }
+ else
+ {
+ g_warning ("Unsupported method called on gedit service: %s", method_name);
+ }
}
}
@@ -1566,6 +1582,8 @@ bus_acquired_cb (GDBusConnection *connection,
const gchar *name,
GeditDBus *dbus)
{
+ gedit_debug (DEBUG_DBUS);
+
if (connection == NULL)
{
g_warning ("Failed to acquire dbus connection");
@@ -1587,6 +1605,8 @@ name_acquired_cb (GDBusConnection *connection,
const gchar *name,
GeditDBus *dbus)
{
+ gedit_debug (DEBUG_DBUS);
+
dbus->priv->result = GEDIT_DBUS_RESULT_SUCCESS;
g_main_loop_quit (dbus->priv->main_loop);
}
@@ -1596,6 +1616,8 @@ name_lost_cb (GDBusConnection *connection,
const gchar *name,
GeditDBus *dbus)
{
+ gedit_debug (DEBUG_DBUS);
+
dbus->priv->result = GEDIT_DBUS_RESULT_FAILED;
g_main_loop_quit (dbus->priv->main_loop);
}
@@ -1607,6 +1629,8 @@ gedit_dbus_run (GeditDBus *dbus)
g_return_val_if_fail (GEDIT_IS_DBUS (dbus), GEDIT_DBUS_RESULT_PROCEED);
+ gedit_debug (DEBUG_DBUS);
+
command_line = gedit_command_line_get_default ();
if (gedit_command_line_get_standalone (command_line))
@@ -1636,6 +1660,8 @@ gedit_dbus_run (GeditDBus *dbus)
dbus,
NULL);
+ gedit_debug_message (DEBUG_DBUS, "Own name org.gnome.gedit\n");
+
dbus->priv->main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (dbus->priv->main_loop);
g_main_loop_unref (dbus->priv->main_loop);
diff --git a/gedit/gedit-debug.c b/gedit/gedit-debug.c
index 6fb3960..0752f46 100644
--- a/gedit/gedit-debug.c
+++ b/gedit/gedit-debug.c
@@ -88,7 +88,8 @@ gedit_debug_init (void)
debug = debug | GEDIT_DEBUG_SAVER;
if (g_getenv ("GEDIT_DEBUG_PANEL") != NULL)
debug = debug | GEDIT_DEBUG_PANEL;
-
+ if (g_getenv ("GEDIT_DEBUG_DBUS") != NULL)
+ debug = debug | GEDIT_DEBUG_DBUS;
out:
#ifdef ENABLE_PROFILING
@@ -155,7 +156,7 @@ void gedit_debug (GeditDebugSection section,
last = seconds;
#else
g_print ("%s:%d (%s)\n", file, line, function);
-#endif
+#endif
fflush (stdout);
}
}
diff --git a/gedit/gedit-debug.h b/gedit/gedit-debug.h
index ebad05a..51f4c21 100644
--- a/gedit/gedit-debug.h
+++ b/gedit/gedit-debug.h
@@ -57,7 +57,8 @@ typedef enum {
GEDIT_DEBUG_WINDOW = 1 << 12,
GEDIT_DEBUG_LOADER = 1 << 13,
GEDIT_DEBUG_SAVER = 1 << 14,
- GEDIT_DEBUG_PANEL = 1 << 15
+ GEDIT_DEBUG_PANEL = 1 << 15,
+ GEDIT_DEBUG_DBUS = 1 << 16
} GeditDebugSection;
@@ -78,6 +79,7 @@ typedef enum {
#define DEBUG_LOADER GEDIT_DEBUG_LOADER, __FILE__, __LINE__, G_STRFUNC
#define DEBUG_SAVER GEDIT_DEBUG_SAVER, __FILE__, __LINE__, G_STRFUNC
#define DEBUG_PANEL GEDIT_DEBUG_PANEL, __FILE__, __LINE__, G_STRFUNC
+#define DEBUG_DBUS GEDIT_DEBUG_DBUS, __FILE__, __LINE__, G_STRFUNC
void gedit_debug_init (void);
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 79b282b..f35ec2a 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -4358,8 +4358,9 @@ process_create_tab (GeditWindow *window,
return NULL;
}
+ gedit_debug (DEBUG_WINDOW);
+
gtk_widget_show (GTK_WIDGET (tab));
-
gedit_notebook_add_tab (GEDIT_NOTEBOOK (notebook),
tab,
-1,
@@ -4390,8 +4391,12 @@ gedit_window_create_tab (GeditWindow *window,
GtkWidget *notebook;
GeditTab *tab;
+ gedit_debug_message (DEBUG_WINDOW, "AAAAAA\n");
+
g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
+ gedit_debug (DEBUG_WINDOW);
+
notebook = _gedit_window_get_notebook (window);
tab = GEDIT_TAB (_gedit_tab_new ());
gtk_widget_show (GTK_WIDGET (tab));
@@ -4431,6 +4436,8 @@ gedit_window_create_tab_from_location (GeditWindow *window,
g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
g_return_val_if_fail (G_IS_FILE (location), NULL);
+ gedit_debug (DEBUG_WINDOW);
+
notebook = _gedit_window_get_notebook (window);
tab = _gedit_tab_new_from_location (location,
encoding,
@@ -4463,6 +4470,8 @@ gedit_window_create_tab_from_stream (GeditWindow *window,
GtkWidget *notebook;
GtkWidget *tab;
+ gedit_debug (DEBUG_WINDOW);
+
g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]