mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +01:00 
			
		
		
		
	gdbusproxy: Add G_DBUS_DEBUG=proxy support
(Turned into a merge request by Philip Withnall; unmodified from original patch on https://bugzilla.gnome.org/show_bug.cgi?id=654905.) https://gitlab.gnome.org/GNOME/glib/issues/424
This commit is contained in:
		
				
					committed by
					
						
						Philip Withnall
					
				
			
			
				
	
			
			
			
						parent
						
							aa3f7eaac7
						
					
				
				
					commit
					cd7bba985e
				
			@@ -1817,6 +1817,7 @@ _g_dbus_worker_flush_sync (GDBusWorker    *worker,
 | 
			
		||||
#define G_DBUS_DEBUG_RETURN         (1<<7)
 | 
			
		||||
#define G_DBUS_DEBUG_EMISSION       (1<<8)
 | 
			
		||||
#define G_DBUS_DEBUG_ADDRESS        (1<<9)
 | 
			
		||||
#define G_DBUS_DEBUG_PROXY          (1<<10)
 | 
			
		||||
 | 
			
		||||
static gint _gdbus_debug_flags = 0;
 | 
			
		||||
 | 
			
		||||
@@ -1890,6 +1891,13 @@ _g_dbus_debug_address (void)
 | 
			
		||||
  return (_gdbus_debug_flags & G_DBUS_DEBUG_ADDRESS) != 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
_g_dbus_debug_proxy (void)
 | 
			
		||||
{
 | 
			
		||||
  _g_dbus_initialize ();
 | 
			
		||||
  return (_gdbus_debug_flags & G_DBUS_DEBUG_PROXY) != 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
G_LOCK_DEFINE_STATIC (print_lock);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
@@ -1938,7 +1946,8 @@ _g_dbus_initialize (void)
 | 
			
		||||
            { "incoming",       G_DBUS_DEBUG_INCOMING       },
 | 
			
		||||
            { "return",         G_DBUS_DEBUG_RETURN         },
 | 
			
		||||
            { "emission",       G_DBUS_DEBUG_EMISSION       },
 | 
			
		||||
            { "address",        G_DBUS_DEBUG_ADDRESS        }
 | 
			
		||||
            { "address",        G_DBUS_DEBUG_ADDRESS        },
 | 
			
		||||
            { "proxy",          G_DBUS_DEBUG_PROXY          }
 | 
			
		||||
          };
 | 
			
		||||
 | 
			
		||||
          _gdbus_debug_flags = g_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
 | 
			
		||||
 
 | 
			
		||||
@@ -91,6 +91,7 @@ gboolean _g_dbus_debug_incoming (void);
 | 
			
		||||
gboolean _g_dbus_debug_return (void);
 | 
			
		||||
gboolean _g_dbus_debug_emission (void);
 | 
			
		||||
gboolean _g_dbus_debug_address (void);
 | 
			
		||||
gboolean _g_dbus_debug_proxy (void);
 | 
			
		||||
 | 
			
		||||
void     _g_dbus_debug_print_lock (void);
 | 
			
		||||
void     _g_dbus_debug_print_unlock (void);
 | 
			
		||||
 
 | 
			
		||||
@@ -1235,11 +1235,14 @@ on_name_owner_changed_get_all_cb (GDBusConnection *connection,
 | 
			
		||||
       *
 | 
			
		||||
       * Either way, apps can know about this by using
 | 
			
		||||
       * get_cached_property_names() or get_cached_property().
 | 
			
		||||
       *
 | 
			
		||||
       * TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the
 | 
			
		||||
       * fact that GetAll() failed
 | 
			
		||||
       */
 | 
			
		||||
      //g_debug ("error: %d %d %s", error->domain, error->code, error->message);
 | 
			
		||||
      if (G_UNLIKELY (_g_dbus_debug_proxy ()))
 | 
			
		||||
        {
 | 
			
		||||
          g_debug ("error: %d %d %s",
 | 
			
		||||
                   error->domain,
 | 
			
		||||
                   error->code,
 | 
			
		||||
                   error->message);
 | 
			
		||||
        }
 | 
			
		||||
      g_error_free (error);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -1432,11 +1435,14 @@ async_init_get_all_cb (GDBusConnection *connection,
 | 
			
		||||
       *
 | 
			
		||||
       * Either way, apps can know about this by using
 | 
			
		||||
       * get_cached_property_names() or get_cached_property().
 | 
			
		||||
       *
 | 
			
		||||
       * TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the
 | 
			
		||||
       * fact that GetAll() failed
 | 
			
		||||
       */
 | 
			
		||||
      //g_debug ("error: %d %d %s", error->domain, error->code, error->message);
 | 
			
		||||
      if (G_UNLIKELY (_g_dbus_debug_proxy ()))
 | 
			
		||||
        {
 | 
			
		||||
          g_debug ("error: %d %d %s",
 | 
			
		||||
                   error->domain,
 | 
			
		||||
                   error->code,
 | 
			
		||||
                   error->message);
 | 
			
		||||
        }
 | 
			
		||||
      g_error_free (error);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user