gnome-terminal r3225 - trunk/src



Author: chpe
Date: Sat Nov 29 20:31:20 2008
New Revision: 3225
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=3225&view=rev

Log:
Switch accel debugging over to new debugging framework.

Modified:
   trunk/src/terminal-accels.c
   trunk/src/terminal-screen.c

Modified: trunk/src/terminal-accels.c
==============================================================================
--- trunk/src/terminal-accels.c	(original)
+++ trunk/src/terminal-accels.c	Sat Nov 29 20:31:20 2008
@@ -24,16 +24,10 @@
 
 #include "terminal-accels.h"
 #include "terminal-app.h"
+#include "terminal-debug.h"
 #include "terminal-intl.h"
 #include "terminal-profile.h"
 #include "terminal-util.h"
-#include "terminal-accels.h"
-
-#ifdef DEBUG_ACCELS
-#define D(x) x
-#else
-#define D(x)
-#endif
 
 /* NOTES
  *
@@ -403,22 +397,34 @@
   guint keyval;
   gboolean gconf_writable;
 
-  D (g_print ("key %s changed\n", gconf_entry_get_key (entry)));
+  _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                         "key %s changed\n",
+                         gconf_entry_get_key (entry));
   
   val = gconf_entry_get_value (entry);
 
-  D (if (val == NULL)
-     g_print (" changed to be unset\n");
-     else if (val->type != GCONF_VALUE_STRING)
-     g_print (" changed to non-string value\n");
-     else
-     g_print (" changed to \"%s\"\n",
-              gconf_value_get_string (val)));
+#ifdef GNOME_ENABLE_DEBUG
+  _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
+    {
+      if (val == NULL)
+        _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n");
+      else if (val->type != GCONF_VALUE_STRING)
+        _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to non-string value\n");
+      else
+        _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                               " changed to \"%s\"\n",
+                               gconf_value_get_string (val));
+    }
+#endif
 
   key_entry = g_hash_table_lookup (gconf_key_to_entry, key_from_gconf_key (gconf_entry_get_key (entry)));
-  D (if (!key_entry) g_print ("  WARNING: KeyEntry for changed key not found, bailing out\n"));
   if (!key_entry)
-    return; /* shouldn't really happen, but let's be safe */
+    {
+      /* shouldn't really happen, but let's be safe */
+      _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                             "  WARNING: KeyEntry for changed key not found, bailing out\n");
+      return;
+    }
 
   if (!binding_from_value (val, &keyval, &mask))
     {
@@ -443,9 +449,10 @@
   key_entry->gconf_writable = gconf_writable;
 
   /* sync over to GTK */
-  D (g_print ("changing path %s to %s\n",
-              key_entry->accel_path,
-              binding_name (keyval, mask))); /* memleak */
+  _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                         "changing path %s to %s\n",
+                         key_entry->accel_path,
+                         binding_name (keyval, mask)); /* memleak */
   inside_gconf_notify += 1;
   /* Note that this may return FALSE, e.g. when the entry was already set correctly. */
   gtk_accel_map_change_entry (key_entry->accel_path,
@@ -481,13 +488,15 @@
    */
   KeyEntry *key_entry;
   
-  D (g_print ("Changed accel %s closure %p\n",
-              binding_name (keyval, modifier), /* memleak */
-              accel_closure));
+  _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                         "Changed accel %s closure %p\n",
+                         binding_name (keyval, modifier), /* memleak */
+                         accel_closure);
 
   if (inside_gconf_notify)
     {
-      D (g_print ("Ignoring change from gtk because we're inside a gconf notify\n"));
+      _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                             "Ignoring change from gtk because we're inside a gconf notify\n");
       return;
     }
 
@@ -573,7 +582,8 @@
   GConfChangeSet *changeset;
   GError *error = NULL;
 
-  D (g_print ("gconf sync handler\n"));
+  _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                         "gconf sync handler\n");
   
   sync_idle_id = 0;
 
@@ -754,17 +764,27 @@
 
   str = binding_name (keyval, mask);
 
-  D (g_print ("Edited path %s keyval %s, setting gconf to %s\n",
-              ke->accel_path,
-              gdk_keyval_name (keyval) ? gdk_keyval_name (keyval) : "null",
-              str));
-  D({
-    GtkAccelKey old_key;
-    if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key)) {
-      g_print ("  Old entry of path %s is keyval %s mask %x\n", ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods);
-    } else
-      g_print ("  Failed to look up the old entry of path %s\n", ke->accel_path);
-    })
+  _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                         "Edited path %s keyval %s, setting gconf to %s\n",
+                         ke->accel_path,
+                         gdk_keyval_name (keyval) ? gdk_keyval_name (keyval) : "null",
+                         str);
+#ifdef GNOME_ENABLE_DEBUG
+  _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
+    {
+      GtkAccelKey old_key;
+
+      if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key)) {
+        _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                               "  Old entry of path %s is keyval %s mask %x\n",
+                               ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods);
+      } else {
+        _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                               "  Failed to look up the old entry of path %s\n",
+                               ke->accel_path);
+      }
+    }
+#endif
 
   conf = gconf_client_get_default ();
   gconf_client_set_string (conf,
@@ -810,7 +830,10 @@
   ke->needs_gconf_sync = TRUE;
 
   str = binding_name (0, 0);
-  D (g_print ("Cleared keybinding for gconf %s", ke->gconf_key));
+
+  _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                         "Cleared keybinding for gconf %s",
+                         ke->gconf_key);
 
   conf = gconf_client_get_default ();
   gconf_client_set_string (conf,
@@ -844,14 +867,15 @@
   gtk_widget_destroy (editor);
 }
 
-#ifdef DEBUG_ACCELS 
+#ifdef GNOME_ENABLE_DEBUG
 static void
 row_changed (GtkTreeModel *tree_model,
              GtkTreePath  *path,
              GtkTreeIter  *iter,
              gpointer      user_data)
 {
-  g_print ("ROW-CHANGED [%s]\n", gtk_tree_path_to_string (path));
+  _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+                         "ROW-CHANGED [%s]\n", gtk_tree_path_to_string (path) /* leak */);
 }
 #endif
 
@@ -912,8 +936,10 @@
   /* Add the data */
 
   tree = edit_keys_store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
-#ifdef DEBUG_ACCELS
-  g_signal_connect (tree, "row-changed", G_CALLBACK (row_changed), NULL);
+
+#ifdef GNOME_ENABLE_DEBUG
+  _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
+    g_signal_connect (tree, "row-changed", G_CALLBACK (row_changed), NULL);
 #endif
 
   for (i = 0; i < G_N_ELEMENTS (all_entries); ++i)

Modified: trunk/src/terminal-screen.c
==============================================================================
--- trunk/src/terminal-screen.c	(original)
+++ trunk/src/terminal-screen.c	Sat Nov 29 20:31:20 2008
@@ -232,7 +232,7 @@
     g_signal_connect (widget->parent, "parent-set", G_CALLBACK (parent_parent_set_cb), widget);
 
 #ifdef GNOME_ENABLE_DEBUG
-  if (_terminal_debug_on (TERMINAL_DEBUG_GEOMETRY))
+  _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
     {
       if (old_parent)
         g_signal_handlers_disconnect_by_func (old_parent, G_CALLBACK (parent_size_request), widget);
@@ -400,7 +400,7 @@
   g_signal_connect (screen, "parent-set", G_CALLBACK (parent_set_callback), NULL);
 
 #ifdef GNOME_ENABLE_DEBUG
-  if (_terminal_debug_on (TERMINAL_DEBUG_GEOMETRY))
+  _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
     {
       g_signal_connect_after (screen, "size-request", G_CALLBACK (size_request), NULL);
       g_signal_connect_after (screen, "size-allocate", G_CALLBACK (size_allocate), NULL);



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