Skip to content

Commit 0ab6db8

Browse files
committed
xapp-sn-watcher.c: Mute some warning messages from more of
dbus-menu, gtk. Fixes #167.
1 parent 8570496 commit 0ab6db8

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

xapp-sn-watcher/xapp-sn-watcher.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -683,13 +683,12 @@ watcher_new (const gchar *current_desktop)
683683
}
684684

685685
static void
686-
dbusmenu_log_handler (const char *log_domain,
687-
GLogLevelFlags log_level,
688-
const char *message,
689-
gpointer data)
686+
muted_log_handler (const char *log_domain,
687+
GLogLevelFlags log_level,
688+
const char *message,
689+
gpointer data)
690690

691691
{
692-
DEBUG ("%s", message);
693692
}
694693

695694
int
@@ -750,10 +749,18 @@ main (int argc, char **argv)
750749
exit(0);
751750
}
752751

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

758765
watcher = watcher_new (current_desktop);
759766

0 commit comments

Comments
 (0)