Skip to content

Commit

Permalink
xapp-sn-watcher.c: Mute some warning messages from more of
Browse files Browse the repository at this point in the history
dbus-menu, gtk.

Fixes #167.
  • Loading branch information
mtwebster committed Aug 1, 2023
1 parent 8570496 commit 0ab6db8
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions xapp-sn-watcher/xapp-sn-watcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,12 @@ watcher_new (const gchar *current_desktop)
}

static void
dbusmenu_log_handler (const char *log_domain,
GLogLevelFlags log_level,
const char *message,
gpointer data)
muted_log_handler (const char *log_domain,
GLogLevelFlags log_level,
const char *message,
gpointer data)

{
DEBUG ("%s", message);
}

int
Expand Down Expand Up @@ -750,10 +749,18 @@ main (int argc, char **argv)
exit(0);
}

// libdbusmenu throws a lot of warnings for problems we already handle. They can be noisy in
// .xsession-errors, however. Redirect them to debug output.
g_log_set_handler ("LIBDBUSMENU-GTK", G_LOG_LEVEL_WARNING,
dbusmenu_log_handler, NULL);
// libdbusmenu and gtk throw a lot of menu-related warnings for problems we already handle.
// They can be noisy in .xsession-errors, however. Redirect them to debug output only.
DEBUG (""); // Initialize the DEBUGGING flag
if (!DEBUGGING)
{
g_log_set_handler ("LIBDBUSMENU-GTK", G_LOG_LEVEL_WARNING,
muted_log_handler, NULL);
g_log_set_handler ("LIBDBUSMENU-GLIB", G_LOG_LEVEL_WARNING,
muted_log_handler, NULL);
g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL,
muted_log_handler, NULL);
}

watcher = watcher_new (current_desktop);

Expand Down

0 comments on commit 0ab6db8

Please sign in to comment.