[Xfce4-commits] [xfce/xfdesktop] 01/01: Add runtime debug support
noreply at xfce.org
noreply at xfce.org
Mon Jul 28 09:53:46 CEST 2014
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfdesktop.
commit 24e1ec3f6ca2d44b6bb0f6b04b0ce125d2c87590
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Mon Jul 28 10:47:21 2014 +0300
Add runtime debug support
This patch adds the ability to enable and disable debug messages
for xfdesktop while it is running. It also converts most of the
DBG messages to XF_DEBUG ones except where it would cause a lot
of noise. Additionally, when built with --enable-debug=full the
XF_DEBUG messages will be on by default. The point of this patch
is to allow the users to easily provide more details in their bug
reports.
---
common/xfdesktop-common.c | 39 ++++++++++++++++++
common/xfdesktop-common.h | 17 ++++++++
common/xfdesktop-thumbnailer.c | 4 +-
settings/xfce-backdrop-settings.desktop.in | 2 +-
src/xfce-backdrop.c | 10 ++---
src/xfce-desktop.c | 36 ++++++++---------
src/xfce-workspace.c | 10 ++---
src/xfdesktop-application.c | 46 ++++++++++++++++++++-
src/xfdesktop-file-icon-manager.c | 32 +++++++--------
src/xfdesktop-icon-view.c | 60 ++++++++++++++--------------
src/xfdesktop-volume-icon.c | 8 ++--
xfdesktop.1 | 8 +++-
12 files changed, 188 insertions(+), 84 deletions(-)
diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index d253ae1..767ad50 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -192,3 +192,42 @@ xfdesktop_popup_keyboard_grab_available(GdkWindow *win)
return timestamp;
}
+
+
+#ifdef G_ENABLE_DEBUG
+/* With --enable-debug=full turn on debugging messages from the start */
+static gboolean enable_debug = TRUE;
+#else
+static gboolean enable_debug = FALSE;
+#endif /* G_ENABLE_DEBUG */
+
+#if defined(G_HAVE_ISO_VARARGS)
+void
+xfdesktop_debug(const char *func, const char *file, int line, const char *format, ...)
+{
+ va_list args;
+
+ if(!enable_debug)
+ return;
+
+ va_start(args, format);
+
+ fprintf(stdout, "DBG[%s:%d] %s(): ", file, line, func);
+ vfprintf(stdout, format, args);
+ fprintf(stdout, "\n");
+
+ va_end(args);
+}
+#endif /* defined(G_HAVE_ISO_VARARGS) */
+
+/**
+ * xfdesktop_debug_set:
+ * debug: TRUE to turn on the XF_DEBUG mesages.
+ */
+void
+xfdesktop_debug_set(gboolean debug)
+{
+ enable_debug = debug;
+ if(enable_debug)
+ XF_DEBUG("debugging enabled");
+}
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index a879d25..4c8ade6 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -32,6 +32,8 @@
#include <X11/Xlib.h>
+#include <stdarg.h>
+
#define XFDESKTOP_CHANNEL "xfce4-desktop"
#define DEFAULT_BACKDROP DATADIR "/backgrounds/xfce/xfce-blue.jpg"
#define DEFAULT_ICON_FONT_SIZE 12
@@ -97,6 +99,21 @@ gint xfce_translate_image_styles(gint input);
guint32 xfdesktop_popup_keyboard_grab_available(GdkWindow *win);
+
+#if defined(G_HAVE_ISO_VARARGS)
+
+#define XF_DEBUG(...) xfdesktop_debug (__func__, __FILE__, __LINE__, __VA_ARGS__)
+
+void xfdesktop_debug(const char *func, const char *file, int line, const char *format, ...) __attribute__((format (printf,4,5)));
+
+#else /* defined(G_HAVE_ISO_VARARGS) */
+
+#define XF_DEBUG(...)
+
+#endif /* defined(G_HAVE_ISO_VARARGS) */
+
+void xfdesktop_debug_set(gboolean debug);
+
G_END_DECLS
#endif
diff --git a/common/xfdesktop-thumbnailer.c b/common/xfdesktop-thumbnailer.c
index 42dbb9c..9ef8036 100644
--- a/common/xfdesktop-thumbnailer.c
+++ b/common/xfdesktop-thumbnailer.c
@@ -281,7 +281,7 @@ xfdesktop_thumbnailer_is_supported(XfdesktopThumbnailer *thumbnailer,
mime_type = xfdesktop_get_file_mimetype(file);
if(mime_type == NULL) {
- DBG("File %s has no mime type", file);
+ XF_DEBUG("File %s has no mime type", file);
return FALSE;
}
@@ -315,7 +315,7 @@ xfdesktop_thumbnailer_queue_thumbnail(XfdesktopThumbnailer *thumbnailer,
g_return_val_if_fail(file != NULL, FALSE);
if(!xfdesktop_thumbnailer_is_supported(thumbnailer, file)) {
- DBG("file: %s not supported", file);
+ XF_DEBUG("file: %s not supported", file);
return FALSE;
}
if(thumbnailer->priv->request_timer_id) {
diff --git a/settings/xfce-backdrop-settings.desktop.in b/settings/xfce-backdrop-settings.desktop.in
index 73d92a8..d7557f1 100644
--- a/settings/xfce-backdrop-settings.desktop.in
+++ b/settings/xfce-backdrop-settings.desktop.in
@@ -1,7 +1,7 @@
[Desktop Entry]
Version=1.0
_Name=Desktop
-_Comment=Set desktop background and menu and icon behaviour
+_Comment=Set desktop background and menu and icon behavior
Exec=xfdesktop-settings
Icon=preferences-desktop-wallpaper
Terminal=false
diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index 948b447..5408031 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -487,7 +487,7 @@ xfce_backdrop_choose_chronological(XfceBackdrop *backdrop)
/* Figure out which image to display based on what time of day it is
* and how many images we have to work with */
epoch = (gdouble)g_date_time_get_hour(datetime) / (24.0f / MIN(n_items, 24.0f));
- DBG("epoch %d, hour %d, items %d", epoch, g_date_time_get_hour(datetime), n_items);
+ XF_DEBUG("epoch %d, hour %d, items %d", epoch, g_date_time_get_hour(datetime), n_items);
new_file = g_list_nth(backdrop->priv->image_files, epoch);
@@ -1147,7 +1147,7 @@ xfce_backdrop_timer(XfceBackdrop *backdrop)
/* remove old timer first */
xfce_backdrop_remove_backdrop_timer(backdrop);
- DBG("calling g_timeout_add_seconds, interval is %d", cycle_interval);
+ XF_DEBUG("calling g_timeout_add_seconds, interval is %d", cycle_interval);
backdrop->priv->cycle_timer_id = g_timeout_add_seconds(cycle_interval,
(GSourceFunc)xfce_backdrop_timer,
backdrop);
@@ -1239,7 +1239,7 @@ xfce_backdrop_set_cycle_timer(XfceBackdrop *backdrop, guint cycle_timer)
}
if(cycle_interval != 0) {
- DBG("calling g_timeout_add_seconds, interval is %d", cycle_interval);
+ XF_DEBUG("calling g_timeout_add_seconds, interval is %d", cycle_interval);
backdrop->priv->cycle_timer_id = g_timeout_add_seconds(cycle_interval,
(GSourceFunc)xfce_backdrop_timer,
backdrop);
@@ -1474,7 +1474,7 @@ xfce_backdrop_generate_async(XfceBackdrop *backdrop)
else
image_path = DEFAULT_BACKDROP;
- DBG("loading image %s", image_path);
+ XF_DEBUG("loading image %s", image_path);
file = g_file_new_for_path(image_path);
@@ -1625,7 +1625,7 @@ xfce_backdrop_loader_closed_cb(GdkPixbufLoader *loader,
/* no image and not canceled? return just the canvas */
if(!image && !g_cancellable_is_cancelled(image_data->cancellable)) {
- DBG("image failed to load, displaying canvas only");
+ XF_DEBUG("image failed to load, displaying canvas only");
backdrop->priv->pix = final_image;
g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_READY], 0);
diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index db2c79f..dafc315 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -199,7 +199,7 @@ xfce_desktop_ensure_system_font_size(XfceDesktop *desktop)
DBG("dividing by PANGO_SCALE");
desktop->priv->system_font_size /= PANGO_SCALE;
}
- DBG("system font size is %.05f", desktop->priv->system_font_size);
+ XF_DEBUG("system font size is %.05f", desktop->priv->system_font_size);
g_free(font_name);
pango_font_description_free(pfd);
@@ -391,7 +391,7 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer user_data)
#ifdef G_ENABLE_DEBUG
monitor_name = gdk_screen_get_monitor_plug_name(gscreen, monitor);
- DBG("backdrop changed for workspace %d, monitor %d (%s)", current_workspace, monitor, monitor_name);
+ XF_DEBUG("backdrop changed for workspace %d, monitor %d (%s)", current_workspace, monitor, monitor_name);
g_free(monitor_name);
#endif
@@ -416,12 +416,12 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer user_data)
rect.width = gdk_screen_get_width(gscreen);
rect.height = gdk_screen_get_height(gscreen);
- DBG("xinerama_stretch x %d, y %d, width %d, height %d",
- rect.x, rect.y, rect.width, rect.height);
+ XF_DEBUG("xinerama_stretch x %d, y %d, width %d, height %d",
+ rect.x, rect.y, rect.width, rect.height);
} else {
gdk_screen_get_monitor_geometry(gscreen, monitor, &rect);
- DBG("monitor x %d, y %d, width %d, height %d",
- rect.x, rect.y, rect.width, rect.height);
+ XF_DEBUG("monitor x %d, y %d, width %d, height %d",
+ rect.x, rect.y, rect.width, rect.height);
}
xfce_backdrop_set_size(backdrop, rect.width, rect.height);
@@ -430,8 +430,8 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer user_data)
&& !xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[current_workspace])) {
clip_region = gdk_region_rectangle(&rect);
- DBG("clip_region: x: %d, y: %d, w: %d, h: %d",
- rect.x, rect.y, rect.width, rect.height);
+ XF_DEBUG("clip_region: x: %d, y: %d, w: %d, h: %d",
+ rect.x, rect.y, rect.width, rect.height);
/* If we are not monitor 0 on a multi-monitor setup we need to subtract
* all the previous monitor regions so we don't draw over them. This
@@ -442,9 +442,9 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer user_data)
GdkRegion *previous_region;
gdk_screen_get_monitor_geometry(gscreen, i, &previous_monitor);
- DBG("previous_monitor: x: %d, y: %d, w: %d, h: %d",
- previous_monitor.x, previous_monitor.y,
- previous_monitor.width, previous_monitor.height);
+ XF_DEBUG("previous_monitor: x: %d, y: %d, w: %d, h: %d",
+ previous_monitor.x, previous_monitor.y,
+ previous_monitor.width, previous_monitor.height);
previous_region = gdk_region_rectangle(&previous_monitor);
@@ -457,8 +457,8 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer user_data)
if(clip_region != NULL) {
/* Update the area to redraw to limit the icons/area painted */
gdk_region_get_clipbox(clip_region, &rect);
- DBG("area to update: x: %d, y: %d, w: %d, h: %d",
- rect.x, rect.y, rect.width, rect.height);
+ XF_DEBUG("area to update: x: %d, y: %d, w: %d, h: %d",
+ rect.x, rect.y, rect.width, rect.height);
}
if(rect.width != 0 && rect.height != 0) {
@@ -619,8 +619,8 @@ workspace_changed_cb(WnckScreen *wnck_screen,
desktop->priv->current_workspace = new_workspace;
- DBG("current_workspace %d, new_workspace %d",
- current_workspace, new_workspace);
+ XF_DEBUG("current_workspace %d, new_workspace %d",
+ current_workspace, new_workspace);
for(i = 0; i < xfce_desktop_get_n_monitors(desktop); i++) {
backdrop = xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], i);
@@ -1358,9 +1358,9 @@ xfce_desktop_get_current_workspace(XfceDesktop *desktop)
current_workspace = workspace_num;
}
- DBG("workspace_num %d, single_workspace_num %d, current_workspace %d, max workspaces %d",
- workspace_num, desktop->priv->single_workspace_num, current_workspace,
- desktop->priv->nworkspaces);
+ XF_DEBUG("workspace_num %d, single_workspace_num %d, current_workspace %d, max workspaces %d",
+ workspace_num, desktop->priv->single_workspace_num, current_workspace,
+ desktop->priv->nworkspaces);
return current_workspace;
}
diff --git a/src/xfce-workspace.c b/src/xfce-workspace.c
index b061963..6d3b3e6 100644
--- a/src/xfce-workspace.c
+++ b/src/xfce-workspace.c
@@ -162,7 +162,7 @@ xfce_workspace_set_xfconf_property_string(XfceWorkspace *workspace,
g_free(monitor_name);
}
- DBG("setting %s to %s", buf, value);
+ XF_DEBUG("setting %s to %s", buf, value);
xfconf_channel_set_string(channel, buf, value);
}
@@ -220,7 +220,7 @@ xfce_workspace_change_backdrop(XfceWorkspace *workspace,
for(i = 0; i < workspace->priv->nbackdrops; ++i) {
if(backdrop == workspace->priv->backdrops[i]) {
monitor_num = i;
- DBG("monitor_num %d", monitor_num);
+ XF_DEBUG("monitor_num %d", monitor_num);
break;
}
}
@@ -324,7 +324,7 @@ xfce_workspace_monitors_changed(XfceWorkspace *workspace,
workspace->priv->nbackdrops = n_monitors;
for(i = 0; i < n_monitors; ++i) {
- DBG("Adding workspace %d backdrop %d", workspace->priv->workspace_num, i);
+ XF_DEBUG("Adding workspace %d backdrop %d", workspace->priv->workspace_num, i);
workspace->priv->backdrops[i] = xfce_backdrop_new(vis);
xfce_workspace_connect_backdrop_settings(workspace,
@@ -515,7 +515,7 @@ xfce_workspace_migrate_backdrop_image(XfceWorkspace *workspace,
/* Try to lookup the old backdrop */
xfconf_channel_get_property(channel, buf, &value);
- DBG("looking at %s", buf);
+ XF_DEBUG("looking at %s", buf);
/* Either there was a backdrop to migrate from or we use the backdrop
* we provide as a default */
@@ -613,7 +613,7 @@ xfce_workspace_connect_backdrop_settings(XfceWorkspace *workspace,
}
pp_len = strlen(buf);
- DBG("prefix string: %s", buf);
+ XF_DEBUG("prefix string: %s", buf);
g_strlcat(buf, "color-style", sizeof(buf));
if(!xfconf_channel_has_property(channel, buf)) {
diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index 5756df0..c14d6d3 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -88,6 +88,10 @@ static void cb_xfdesktop_application_arrange(GAction *action,
GVariant *parameter,
gpointer data);
+static void cb_xfdesktop_application_debug(GAction *action,
+ GVariant *parameter,
+ gpointer data);
+
static gboolean cb_wait_for_window_manager(gpointer data);
static void cb_wait_for_window_manager_destroyed(gpointer data);
@@ -200,6 +204,12 @@ xfdesktop_application_init(XfdesktopApplication *app)
xfdesktop_application_add_action(app, G_ACTION(action));
g_object_unref(action);
+ /* debug action, parameter toggles debug state */
+ action = g_simple_action_new("debug", G_VARIANT_TYPE_BOOLEAN);
+ g_signal_connect(action, "activate", G_CALLBACK(cb_xfdesktop_application_debug), app);
+ xfdesktop_application_add_action(app, G_ACTION(action));
+ g_object_unref(action);
+
#if !GLIB_CHECK_VERSION (2, 32, 0)
g_application_set_action_group(G_APPLICATION(app), (GActionGroup*)app->actions);
#endif
@@ -497,6 +507,26 @@ cb_xfdesktop_application_arrange(GAction *action,
xfce_desktop_arrange_icons(XFCE_DESKTOP(app->desktops[screen_num]));
}
+/* parameter is a boolean that determines whether to enable or disable the
+ * debug messages */
+static void
+cb_xfdesktop_application_debug(GAction *action,
+ GVariant *parameter,
+ gpointer data)
+{
+ TRACE("entering");
+
+ /* sanity checks */
+ if(!data || !XFDESKTOP_IS_APPLICATION(data))
+ return;
+
+ if(!g_variant_is_of_type(parameter, G_VARIANT_TYPE_BOOLEAN))
+ return;
+
+ /* Toggle the debug state */
+ xfdesktop_debug_set(g_variant_get_boolean(parameter));
+}
+
/* Cleans up the associated wait for wm resources */
static void
wait_for_window_manager_cleanup(WaitForWM *wfwm)
@@ -523,7 +553,7 @@ cb_wait_for_window_manager(gpointer data)
for(i = 0; i < wfwm->atom_count; i++) {
if(XGetSelectionOwner(wfwm->dpy, wfwm->atoms[i]) == None) {
- DBG("window manager not ready on screen %d", i);
+ XF_DEBUG("window manager not ready on screen %d", i);
have_wm = FALSE;
break;
}
@@ -557,7 +587,7 @@ cb_wait_for_window_manager_destroyed(gpointer data)
g_printerr("No window manager registered on screen 0. "
"To start the xfdesktop without this check, run with --disable-wm-check.\n");
} else {
- DBG("found window manager after %d tries", wfwm->counter);
+ XF_DEBUG("found window manager after %d tries", wfwm->counter);
}
/* start loading the desktop, hopefully a window manager is found, but it
@@ -763,6 +793,8 @@ xfdesktop_application_local_command_line(GApplication *g_application,
gboolean opt_windowlist = FALSE;
gboolean opt_arrange = FALSE;
gboolean opt_quit = FALSE;
+ gboolean opt_enable_debug = FALSE;
+ gboolean opt_disable_debug = FALSE;
gboolean option_set = FALSE;
const GOptionEntry main_entries[] = {
{ "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_version, N_("Display version information"), NULL },
@@ -772,6 +804,8 @@ xfdesktop_application_local_command_line(GApplication *g_application,
#ifdef ENABLE_FILE_ICONS
{ "arrange", 'A', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_arrange, N_("Automatically arrange all the icons on the desktop"), NULL },
#endif
+ { "enable-debug", 'e', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_enable_debug, N_("Enable debug messages"), NULL },
+ { "disable-debug", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_disable_debug, N_("Disable debug messages"), NULL },
{ "disable-wm-check", 'D', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &app->opt_disable_wm_check, N_("Do not wait for a window manager on startup"), NULL },
{ "quit", 'Q', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_quit, N_("Cause xfdesktop to quit"), NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
@@ -853,6 +887,14 @@ xfdesktop_application_local_command_line(GApplication *g_application,
} else if(opt_arrange) {
g_action_group_activate_action(G_ACTION_GROUP(g_application), "arrange", NULL);
option_set = TRUE;
+ } else if(opt_enable_debug) {
+ g_action_group_activate_action(G_ACTION_GROUP(g_application), "debug",
+ g_variant_new_boolean(TRUE));
+ option_set = TRUE;
+ } else if(opt_disable_debug) {
+ g_action_group_activate_action(G_ACTION_GROUP(g_application), "debug",
+ g_variant_new_boolean(FALSE));
+ option_set = TRUE;
}
/* We handled the command line option */
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 147c8a7..943756a 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1786,7 +1786,7 @@ xfdesktop_file_icon_manager_save_icons(gpointer user_data)
if(!path)
return FALSE;
- DBG("saving to: %s", path);
+ XF_DEBUG("saving to: %s", path);
tmppath = g_strconcat(path, ".new", NULL);
@@ -1821,7 +1821,7 @@ xfdesktop_file_icon_manager_save_icons(gpointer user_data)
unlink(tmppath);
}
} else {
- DBG("didn't write anything in the RC file, desktop is probably empty");
+ XF_DEBUG("didn't write anything in the RC file, desktop is probably empty");
}
g_free(path);
@@ -2016,14 +2016,14 @@ xfdesktop_file_icon_manager_add_icon(XfdesktopFileIconManager *fmanager,
* to the front of the pending icon queue, if it didn't then we place it
* on the end */
if(row >= 0 && col >= 0) {
- DBG("attempting to set icon '%s' to position (%d,%d)", name, row, col);
+ XF_DEBUG("attempting to set icon '%s' to position (%d,%d)", name, row, col);
xfdesktop_icon_set_position(XFDESKTOP_ICON(icon), row, col);
g_queue_push_head(fmanager->priv->pending_icons, icon);
} else if(xfdesktop_file_icon_manager_get_cached_icon_position(fmanager,
name, identifier,
&row, &col))
{
- DBG("attempting to set icon '%s' to position (%d,%d)", name, row, col);
+ XF_DEBUG("attempting to set icon '%s' to position (%d,%d)", name, row, col);
xfdesktop_icon_set_position(XFDESKTOP_ICON(icon), row, col);
g_queue_push_head(fmanager->priv->pending_icons, icon);
} else {
@@ -2061,7 +2061,7 @@ xfdesktop_file_icon_manager_remove_icon(XfdesktopFileIconManager *fmanager,
if(item && item->data && XFDESKTOP_IS_FILE_ICON(item->data)) {
gchar *filename = g_file_get_path(xfdesktop_file_icon_peek_file(item->data));
- DBG("removing %s from pending queue", filename);
+ XF_DEBUG("removing %s from pending queue", filename);
/* Icon was pending creation, dequeue the thumbnail and
* remove it from the pending icons queue */
@@ -2072,7 +2072,7 @@ xfdesktop_file_icon_manager_remove_icon(XfdesktopFileIconManager *fmanager,
g_free(filename);
} else {
- DBG("removing icon %s from icon view", xfdesktop_icon_peek_label(XFDESKTOP_ICON(icon)));
+ XF_DEBUG("removing icon %s from icon view", xfdesktop_icon_peek_label(XFDESKTOP_ICON(icon)));
/* Remove the icon from the icon_view */
xfdesktop_icon_view_remove_item(fmanager->priv->icon_view,
XFDESKTOP_ICON(icon));
@@ -2403,7 +2403,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
switch(event) {
case G_FILE_MONITOR_EVENT_MOVED:
- DBG("got a moved event");
+ XF_DEBUG("got a moved event");
icon = g_hash_table_lookup(fmanager->priv->icons, file);
@@ -2416,7 +2416,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
/* Failed to get position... not supported? */
row = col = 0;
}
- DBG("row %d, col %d", row, col);
+ XF_DEBUG("row %d, col %d", row, col);
/* Remove the old icon */
xfdesktop_file_icon_manager_remove_icon(fmanager, icon);
@@ -2433,13 +2433,13 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
/* Failed to get position... not supported? */
row = col = 0;
}
- DBG("row %d, col %d", row, col);
+ XF_DEBUG("row %d, col %d", row, col);
xfdesktop_file_icon_manager_remove_icon(fmanager, moved_icon);
}
if(xfdesktop_compare_paths(g_file_get_parent(other_file), fmanager->priv->folder)) {
- DBG("icon moved off the desktop");
+ XF_DEBUG("icon moved off the desktop");
/* Nothing moved, this is actually a delete */
if(file_info)
g_object_unref(file_info);
@@ -2470,7 +2470,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
break;
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
- DBG("got changed event");
+ XF_DEBUG("got changed event");
icon = g_hash_table_lookup(fmanager->priv->icons, file);
if(icon) {
@@ -2488,7 +2488,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
}
break;
case G_FILE_MONITOR_EVENT_CREATED:
- DBG("got created event");
+ XF_DEBUG("got created event");
/* make sure it's not the desktop folder itself */
if(g_file_equal(fmanager->priv->folder, file))
@@ -2518,7 +2518,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
}
break;
case G_FILE_MONITOR_EVENT_DELETED:
- DBG("got deleted event");
+ XF_DEBUG("got deleted event");
filename = g_file_get_path(file);
@@ -2552,7 +2552,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
g_hash_table_remove(fmanager->priv->icons, file);
} else {
if(g_file_equal(file, fmanager->priv->folder)) {
- DBG("~/Desktop disappeared!");
+ XF_DEBUG("~/Desktop disappeared!");
/* yes, refresh before and after is correct */
xfdesktop_file_icon_manager_refresh_icons(fmanager);
xfdesktop_file_icon_manager_check_create_desktop_folder(fmanager->priv->folder);
@@ -3442,8 +3442,8 @@ xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
}
}
- DBG("finishing drop on desktop from external source: drop_ok=%s, copy_only=%s",
- drop_ok?"TRUE":"FALSE", copy_only?"TRUE":"FALSE");
+ XF_DEBUG("finishing drop on desktop from external source: drop_ok=%s, copy_only=%s",
+ drop_ok?"TRUE":"FALSE", copy_only?"TRUE":"FALSE");
gtk_drag_finish(context, drop_ok, !copy_only, time_);
}
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index e4df3c0..d914d6c 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -1631,7 +1631,7 @@ xfdesktop_icon_view_drag_drop(GtkWidget *widget,
if(target == GDK_NONE)
return FALSE;
}
- DBG("target=%ld (%s)", (glong)target, gdk_atom_name(target));
+ XF_DEBUG("target=%ld (%s)", (glong)target, gdk_atom_name(target));
xfdesktop_xy_to_rowcol(icon_view, x, y, &row, &col);
icon_on_dest = xfdesktop_icon_view_icon_in_cell(icon_view, row, col);
@@ -1704,7 +1704,7 @@ xfdesktop_icon_view_drag_drop(GtkWidget *widget,
xfdesktop_icon_view_invalidate_icon(icon_view, l->data, TRUE);
}
- DBG("drag succeeded");
+ XF_DEBUG("drag succeeded");
gtk_drag_finish(context, TRUE, FALSE, time_);
} else {
@@ -1921,13 +1921,13 @@ xfdesktop_icon_view_style_set(GtkWidget *widget,
icon_view->priv->shadow_color->blue ^= 0xffff;
}
- DBG("label alpha is %d\n", (gint)(icon_view->priv->label_alpha));
- DBG("shadow x offset is %d\n", (gint)(icon_view->priv->shadow_x_offset));
- DBG("shadow y offset is %d\n", (gint)(icon_view->priv->shadow_y_offset));
+ XF_DEBUG("label alpha is %d\n", (gint)(icon_view->priv->label_alpha));
+ XF_DEBUG("shadow x offset is %d\n", (gint)(icon_view->priv->shadow_x_offset));
+ XF_DEBUG("shadow y offset is %d\n", (gint)(icon_view->priv->shadow_y_offset));
#if defined(DEBUG) && (DEBUG > 0)
{
gchar *color = gdk_color_to_string(icon_view->priv->shadow_color);
- DBG("shadow color is %s\n", color);
+ XF_DEBUG("shadow color is %s\n", color);
g_free(color);
}
#endif
@@ -1947,16 +1947,16 @@ xfdesktop_icon_view_style_set(GtkWidget *widget,
icon_view->priv->selected_shadow_color->blue ^= 0xffff;
}
- DBG("selected label alpha is %d\n",
- (gint)(icon_view->priv->selected_label_alpha));
- DBG("selected shadow x offset is %d\n",
- (gint)(icon_view->priv->selected_shadow_x_offset));
- DBG("selected shadow y offset is %d\n",
- (gint)(icon_view->priv->selected_shadow_y_offset));
+ XF_DEBUG("selected label alpha is %d\n",
+ (gint)(icon_view->priv->selected_label_alpha));
+ XF_DEBUG("selected shadow x offset is %d\n",
+ (gint)(icon_view->priv->selected_shadow_x_offset));
+ XF_DEBUG("selected shadow y offset is %d\n",
+ (gint)(icon_view->priv->selected_shadow_y_offset));
#if defined(DEBUG) && (DEBUG > 0)
{
gchar *color = gdk_color_to_string(icon_view->priv->selected_shadow_color);
- DBG("shadow color is %s\n", color);
+ XF_DEBUG("shadow color is %s\n", color);
g_free(color);
}
#endif
@@ -1970,12 +1970,12 @@ xfdesktop_icon_view_style_set(GtkWidget *widget,
"label-radius", &icon_view->priv->label_radius,
NULL);
- DBG("cell spacing is %d", icon_view->priv->cell_spacing);
- DBG("cell padding is %d", icon_view->priv->cell_padding);
- DBG("cell text width proportion is %f", icon_view->priv->cell_text_width_proportion);
- DBG("ellipsize icon label is %s", icon_view->priv->ellipsize_icon_labels?"true":"false");
- DBG("tooltip size is %d", icon_view->priv->tooltip_size_from_style);
- DBG("label radius is %f", icon_view->priv->label_radius);
+ XF_DEBUG("cell spacing is %d", icon_view->priv->cell_spacing);
+ XF_DEBUG("cell padding is %d", icon_view->priv->cell_padding);
+ XF_DEBUG("cell text width proportion is %f", icon_view->priv->cell_text_width_proportion);
+ XF_DEBUG("ellipsize icon label is %s", icon_view->priv->ellipsize_icon_labels?"true":"false");
+ XF_DEBUG("tooltip size is %d", icon_view->priv->tooltip_size_from_style);
+ XF_DEBUG("label radius is %f", icon_view->priv->label_radius);
if(icon_view->priv->selection_box_color) {
gdk_color_free(icon_view->priv->selection_box_color);
@@ -2714,8 +2714,8 @@ xfdesktop_setup_grids(XfdesktopIconView *icon_view)
return;
}
- DBG("CELL_SIZE=%0.3f, TEXT_WIDTH=%0.3f, ICON_SIZE=%u", CELL_SIZE, TEXT_WIDTH, ICON_SIZE);
- DBG("grid size is %dx%d", icon_view->priv->nrows, icon_view->priv->ncols);
+ XF_DEBUG("CELL_SIZE=%0.3f, TEXT_WIDTH=%0.3f, ICON_SIZE=%u", CELL_SIZE, TEXT_WIDTH, ICON_SIZE);
+ XF_DEBUG("grid size is %dx%d", icon_view->priv->nrows, icon_view->priv->ncols);
if(icon_view->priv->grid_layout) {
icon_view->priv->grid_layout = g_realloc(icon_view->priv->grid_layout,
@@ -2728,7 +2728,7 @@ xfdesktop_setup_grids(XfdesktopIconView *icon_view)
} else
icon_view->priv->grid_layout = g_malloc0(new_size);
- DBG("created grid_layout with %lu positions", (gulong)(new_size/sizeof(gpointer)));
+ XF_DEBUG("created grid_layout with %lu positions", (gulong)(new_size/sizeof(gpointer)));
DUMP_GRID_LAYOUT(icon_view);
xfdesktop_icon_view_setup_grids_xinerama(icon_view);
@@ -2745,7 +2745,7 @@ xfdesktop_rootwin_watch_workarea(GdkXEvent *gxevent,
if(xevt->type == PropertyNotify
&& XInternAtom(xevt->display, "_NET_WORKAREA", False) == xevt->atom)
{
- DBG("got _NET_WORKAREA change on rootwin!");
+ XF_DEBUG("got _NET_WORKAREA change on rootwin!");
if(icon_view->priv->grid_resize_timeout) {
g_source_remove(icon_view->priv->grid_resize_timeout);
icon_view->priv->grid_resize_timeout = 0;
@@ -3281,8 +3281,8 @@ xfdesktop_move_all_cached_icons_to_desktop(XfdesktopIconView *icon_view)
&row,
&col))
{
- DBG("icon %s setting position row%dxcol%d",
- xfdesktop_icon_peek_label(icon), row, col);
+ XF_DEBUG("icon %s setting position row%dxcol%d",
+ xfdesktop_icon_peek_label(icon), row, col);
/* Make sure the spot is available */
if(xfdesktop_grid_is_free_position(icon_view, row, col)) {
@@ -3323,8 +3323,8 @@ xfdesktop_move_all_previous_icons_to_desktop(XfdesktopIconView *icon_view)
}
if(xfdesktop_grid_is_free_position(icon_view, row, col)) {
- DBG("adding icon %s position row %d x col %d",
- xfdesktop_icon_peek_label(icon), row, col);
+ XF_DEBUG("adding icon %s position row %d x col %d",
+ xfdesktop_icon_peek_label(icon), row, col);
xfdesktop_icon_view_add_item_internal(icon_view, icon);
} else {
leftovers = g_list_prepend(leftovers, icon);
@@ -3798,11 +3798,11 @@ xfdesktop_icon_view_icon_find_position(XfdesktopIconView *icon_view,
|| !xfdesktop_grid_is_free_position(icon_view, row, col))
{
if(xfdesktop_grid_get_next_free_position(icon_view, &row, &col)) {
- DBG("old position didn't exist or isn't free, got (%d,%d) instead",
- row, col);
+ XF_DEBUG("old position didn't exist or isn't free, got (%d,%d) instead",
+ row, col);
xfdesktop_icon_set_position(icon, row, col);
} else {
- DBG("can't fit icon on screen");
+ XF_DEBUG("can't fit icon on screen");
return FALSE;
}
}
diff --git a/src/xfdesktop-volume-icon.c b/src/xfdesktop-volume-icon.c
index 9203eef..11d9d1e 100644
--- a/src/xfdesktop-volume-icon.c
+++ b/src/xfdesktop-volume-icon.c
@@ -962,7 +962,7 @@ volume_icon_changed_timeout(XfdesktopVolumeIcon *volume_icon)
g_return_val_if_fail(XFDESKTOP_IS_VOLUME_ICON(volume_icon), FALSE);
- DBG("TIMEOUT");
+ XF_DEBUG("TIMEOUT");
/* reset the icon's mount point information */
if(volume_icon->priv->file) {
@@ -1004,7 +1004,7 @@ volume_icon_changed_timeout(XfdesktopVolumeIcon *volume_icon)
mounted_after = TRUE;
}
- DBG("MOUNTED BEFORE: %d, MOUNTED AFTER: %d", mounted_before, mounted_after);
+ XF_DEBUG("MOUNTED BEFORE: %d, MOUNTED AFTER: %d", mounted_before, mounted_after);
if(mounted_before != mounted_after) {
/* invalidate the tooltip */
@@ -1029,7 +1029,7 @@ volume_icon_changed_timeout(XfdesktopVolumeIcon *volume_icon)
volume_icon->priv->changed_timeout_id = 0;
return FALSE;
} else {
- DBG("TRY AGAIN");
+ XF_DEBUG("TRY AGAIN");
return TRUE;
}
}
@@ -1042,7 +1042,7 @@ xfdesktop_volume_icon_changed(GVolume *volume,
g_return_if_fail(G_IS_VOLUME(volume));
g_return_if_fail(XFDESKTOP_IS_VOLUME_ICON(volume_icon));
- DBG("VOLUME CHANGED");
+ XF_DEBUG("VOLUME CHANGED");
/**
* NOTE: We use a timeout here to check if the volume is
diff --git a/xfdesktop.1 b/xfdesktop.1
index e73ea50..652b06b 100644
--- a/xfdesktop.1
+++ b/xfdesktop.1
@@ -1,4 +1,4 @@
-.TH XFDESKTOP 1 "December 2013"
+.TH XFDESKTOP 1 "July 2014"
.SH NAME
xfdesktop \- The Xfce 4 Desktop Environment's desktop manager
@@ -56,6 +56,12 @@ Automatically arrange all the icons on the desktop
.B \-D, --disable-wm-check
Do not wait for a window manager on startup
.TP
+.B \-e, --enable-debug
+Enable debug messages
+.TP
+.B \-d, --disable-debug
+Disable debug messages
+.TP
.B \-Q, --quit
Cause \fBxfdesktop\fP to quit
.TP
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list