[nautilus] bookmark: add debug messages
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] bookmark: add debug messages
- Date: Fri, 14 Jan 2011 17:35:10 +0000 (UTC)
commit c637811c268abdecae3a3720b1f77fc7fe5bcd6a
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 14 18:24:27 2011 +0100
bookmark: add debug messages
libnautilus-private/nautilus-bookmark.c | 43 ++++++++++++++++++++++++++-----
libnautilus-private/nautilus-debug.c | 1 +
libnautilus-private/nautilus-debug.h | 19 +++++++------
3 files changed, 47 insertions(+), 16 deletions(-)
---
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c
index 0a07732..0f9033e 100644
--- a/libnautilus-private/nautilus-bookmark.c
+++ b/libnautilus-private/nautilus-bookmark.c
@@ -25,9 +25,9 @@
*/
#include <config.h>
+
#include "nautilus-bookmark.h"
-#include "nautilus-file.h"
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gtk-macros.h>
@@ -36,10 +36,14 @@
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+
#include <libnautilus-private/nautilus-file.h>
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-icon-names.h>
+#define DEBUG_FLAG NAUTILUS_DEBUG_BOOKMARKS
+#include <libnautilus-private/nautilus-debug.h>
+
enum {
CONTENTS_CHANGED,
LAST_SIGNAL
@@ -98,6 +102,8 @@ nautilus_bookmark_update_icon (NautilusBookmark *bookmark)
if (!nautilus_file_is_not_yet_confirmed (bookmark->details->file) &&
nautilus_file_check_if_ready (bookmark->details->file,
NAUTILUS_FILE_ATTRIBUTES_FOR_ICON)) {
+ DEBUG ("%s: set new icon", nautilus_bookmark_get_name (bookmark));
+
new_icon = nautilus_file_get_gicon (bookmark->details->file, 0);
g_object_set (bookmark,
"icon", new_icon,
@@ -123,6 +129,7 @@ bookmark_set_name_from_ready_file (NautilusBookmark *self,
nautilus_bookmark_set_name_internal (self, _("Home"));
} else if (g_strcmp0 (self->details->name, display_name) != 0) {
nautilus_bookmark_set_name_internal (self, display_name);
+ DEBUG ("%s: name changed to %s", nautilus_bookmark_get_name (self), display_name);
}
g_free (display_name);
@@ -136,10 +143,14 @@ bookmark_file_changed_callback (NautilusFile *file,
g_assert (file == bookmark->details->file);
+ DEBUG ("%s: file changed", nautilus_bookmark_get_name (bookmark));
+
location = nautilus_file_get_location (file);
if (!g_file_equal (bookmark->details->location, location) &&
!nautilus_file_is_in_trash (file)) {
+ DEBUG ("%s: file got moved", nautilus_bookmark_get_name (bookmark));
+
g_object_unref (bookmark->details->location);
bookmark->details->location = g_object_ref (location);
@@ -164,6 +175,7 @@ bookmark_file_changed_callback (NautilusFile *file,
* we don't want to change the icon or anything about the
* bookmark just because its not there anymore.
*/
+ DEBUG ("%s: trashed", nautilus_bookmark_get_name (bookmark));
nautilus_bookmark_disconnect_file (bookmark);
} else {
nautilus_bookmark_update_icon (bookmark);
@@ -176,9 +188,15 @@ nautilus_bookmark_set_icon_to_default (NautilusBookmark *bookmark)
GIcon *icon, *emblemed_icon, *folder;
GEmblem *emblem;
- folder = g_themed_icon_new (NAUTILUS_ICON_FOLDER);
+ if (g_file_is_native (bookmark->details->location)) {
+ folder = g_themed_icon_new (NAUTILUS_ICON_FOLDER);
+ } else {
+ folder = g_themed_icon_new (NAUTILUS_ICON_FOLDER_REMOTE);
+ }
if (nautilus_bookmark_uri_known_not_to_exist (bookmark)) {
+ DEBUG ("%s: file does not exist, add emblem", nautilus_bookmark_get_name (bookmark));
+
icon = g_themed_icon_new (GTK_STOCK_DIALOG_WARNING);
emblem = g_emblem_new (icon);
@@ -191,6 +209,8 @@ nautilus_bookmark_set_icon_to_default (NautilusBookmark *bookmark)
folder = emblemed_icon;
}
+ DEBUG ("%s: setting icon to default", nautilus_bookmark_get_name (bookmark));
+
g_object_set (bookmark,
"icon", folder,
NULL);
@@ -200,21 +220,30 @@ nautilus_bookmark_set_icon_to_default (NautilusBookmark *bookmark)
static void
nautilus_bookmark_disconnect_file (NautilusBookmark *bookmark)
-{
- g_signal_handlers_disconnect_by_func (bookmark->details->file,
- G_CALLBACK (bookmark_file_changed_callback),
- bookmark);
- g_clear_object (&bookmark->details->file);
+{
+ if (bookmark->details->file != NULL) {
+ DEBUG ("%s: disconnecting file",
+ nautilus_bookmark_get_name (bookmark));
+
+ g_signal_handlers_disconnect_by_func (bookmark->details->file,
+ G_CALLBACK (bookmark_file_changed_callback),
+ bookmark);
+ g_clear_object (&bookmark->details->file);
+ }
}
static void
nautilus_bookmark_connect_file (NautilusBookmark *bookmark)
{
if (bookmark->details->file != NULL) {
+ DEBUG ("%s: file already connected, returning",
+ nautilus_bookmark_get_name (bookmark));
return;
}
if (!nautilus_bookmark_uri_known_not_to_exist (bookmark)) {
+ DEBUG ("%s: creating file", nautilus_bookmark_get_name (bookmark));
+
bookmark->details->file = nautilus_file_get (bookmark->details->location);
g_assert (!nautilus_file_is_gone (bookmark->details->file));
diff --git a/libnautilus-private/nautilus-debug.c b/libnautilus-private/nautilus-debug.c
index f85cb54..6499865 100644
--- a/libnautilus-private/nautilus-debug.c
+++ b/libnautilus-private/nautilus-debug.c
@@ -37,6 +37,7 @@ static gboolean initialized = FALSE;
static GDebugKey keys[] = {
{ "Application", NAUTILUS_DEBUG_APPLICATION },
+ { "Bookmarks", NAUTILUS_DEBUG_BOOKMARKS },
{ "DBus", NAUTILUS_DEBUG_DBUS },
{ "DirectoryView", NAUTILUS_DEBUG_DIRECTORY_VIEW },
{ "File", NAUTILUS_DEBUG_FILE },
diff --git a/libnautilus-private/nautilus-debug.h b/libnautilus-private/nautilus-debug.h
index dc55dc4..2092ddd 100644
--- a/libnautilus-private/nautilus-debug.h
+++ b/libnautilus-private/nautilus-debug.h
@@ -34,15 +34,16 @@ G_BEGIN_DECLS
typedef enum {
NAUTILUS_DEBUG_APPLICATION = 1 << 1,
- NAUTILUS_DEBUG_DBUS = 1 << 2,
- NAUTILUS_DEBUG_DIRECTORY_VIEW = 1 << 3,
- NAUTILUS_DEBUG_FILE = 1 << 4,
- NAUTILUS_DEBUG_ICON_CONTAINER = 1 << 5,
- NAUTILUS_DEBUG_LIST_VIEW = 1 << 6,
- NAUTILUS_DEBUG_MIME = 1 << 7,
- NAUTILUS_DEBUG_PLACES = 1 << 8,
- NAUTILUS_DEBUG_SMCLIENT = 1 << 9,
- NAUTILUS_DEBUG_WINDOW = 1 << 10,
+ NAUTILUS_DEBUG_BOOKMARKS = 1 << 2,
+ NAUTILUS_DEBUG_DBUS = 1 << 3,
+ NAUTILUS_DEBUG_DIRECTORY_VIEW = 1 << 4,
+ NAUTILUS_DEBUG_FILE = 1 << 5,
+ NAUTILUS_DEBUG_ICON_CONTAINER = 1 << 6,
+ NAUTILUS_DEBUG_LIST_VIEW = 1 << 7,
+ NAUTILUS_DEBUG_MIME = 1 << 8,
+ NAUTILUS_DEBUG_PLACES = 1 << 9,
+ NAUTILUS_DEBUG_SMCLIENT = 1 << 10,
+ NAUTILUS_DEBUG_WINDOW = 1 << 11,
} DebugFlags;
void nautilus_debug_set_flags (DebugFlags flags);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]