From 5be9587903122389c955f5e4ecc8ff0539542d7b Mon Sep 17 00:00:00 2001 From: rim Date: Sat, 26 May 2018 23:27:03 +0200 Subject: [PATCH] Add G_DEBUG_FMT macro (bug 14401, bug 14403) --- src/app-manager.c | 13 ++++--------- src/process-tree-view.c | 12 +++--------- src/task-manager.h | 8 ++++++++ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/app-manager.c b/src/app-manager.c index 4118e9c..a97725f 100644 --- a/src/app-manager.c +++ b/src/app-manager.c @@ -17,6 +17,7 @@ #include #include "app-manager.h" +#include "task-manager.h" @@ -78,9 +79,7 @@ xtm_app_manager_init (XtmAppManager *manager) apps_add_application (manager->apps, application); } -#if DEBUG - g_debug ("Initial applications: %d", manager->apps->len); -#endif + G_DEBUG_FMT ("Initial applications: %d", manager->apps->len); /* Connect signals */ g_signal_connect (screen, "application-opened", G_CALLBACK (application_opened), manager); @@ -158,18 +157,14 @@ apps_lookup_pid (GArray *apps, gint pid) static void application_opened (WnckScreen *screen, WnckApplication *application, XtmAppManager *manager) { -#if DEBUG - g_debug ("Application opened %p %d", application, wnck_application_get_pid (application)); -#endif + G_DEBUG_FMT ("Application opened %p %d", application, wnck_application_get_pid (application)); apps_add_application (manager->apps, application); } static void application_closed (WnckScreen *screen, WnckApplication *application, XtmAppManager *manager) { -#if DEBUG - g_debug ("Application closed %p", application); -#endif + G_DEBUG_FMT ("Application closed %p", application); apps_remove_application (manager->apps, application); } diff --git a/src/process-tree-view.c b/src/process-tree-view.c index bc84dd3..32fc37b 100644 --- a/src/process-tree-view.c +++ b/src/process-tree-view.c @@ -543,9 +543,7 @@ treeview_clicked (XtmProcessTreeView *treeview, GdkEventButton *event) gtk_tree_selection_select_path (selection, path); gtk_tree_path_free (path); -#if DEBUG - g_debug ("Found iter with pid %d", pid); -#endif + G_DEBUG_FMT ("Found iter with pid %d", pid); } popup_menu (treeview, pid, event->time, TRUE); @@ -601,9 +599,7 @@ column_clicked (GtkTreeViewColumn *column, XtmProcessTreeView *treeview) GtkSortType sort_type; gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (treeview->model), &sort_column_id, &sort_type); -#if DEBUG - g_debug ("Last sort column %d; sort type: %d", sort_column_id, sort_type); -#endif + G_DEBUG_FMT ("Last sort column %d; sort type: %d", sort_column_id, sort_type); if (treeview->sort_column != column) { @@ -617,9 +613,7 @@ column_clicked (GtkTreeViewColumn *column, XtmProcessTreeView *treeview) sort_type = (sort_type == GTK_SORT_ASCENDING) ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING; } -#if DEBUG - g_debug ("New sort column %d; sort type: %d", sort_column_id, sort_type); -#endif + G_DEBUG_FMT ("New sort column %d; sort type: %d", sort_column_id, sort_type); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (treeview->model), sort_column_id, sort_type); gtk_tree_view_column_set_sort_order (column, sort_type); diff --git a/src/task-manager.h b/src/task-manager.h index e74acd0..5384715 100644 --- a/src/task-manager.h +++ b/src/task-manager.h @@ -97,4 +97,12 @@ gchar * get_hostname (void); gboolean send_signal_to_pid (guint pid, gint xtm_signal); gboolean set_priority_to_pid (guint pid, gint priority); + +#if DEBUG +# define G_DEBUG_FMT(fmt, args...) g_debug((fmt), ##args) +#else +# define G_DEBUG_FMT(fmt, args...) +#endif + + #endif /* !TASK_MANAGER_H */