Beispiel #1
0
static void
bookmark_file_changed_callback (NemoFile *file,
				NemoBookmark *bookmark)
{
	GFile *location;

	g_assert (file == bookmark->details->file);

	DEBUG ("%s: file changed", nemo_bookmark_get_name (bookmark));

	location = nemo_file_get_location (file);

	if (!g_file_equal (bookmark->details->location, location) &&
	    !nemo_file_is_in_trash (file)) {
		DEBUG ("%s: file got moved", nemo_bookmark_get_name (bookmark));

		g_object_unref (bookmark->details->location);
		bookmark->details->location = g_object_ref (location);

		g_object_notify_by_pspec (G_OBJECT (bookmark), properties[PROP_LOCATION]);
		g_signal_emit (bookmark, signals[CONTENTS_CHANGED], 0);
	}

	g_object_unref (location);

	if (nemo_file_is_gone (file) ||
	    nemo_file_is_in_trash (file)) {
		/* The file we were monitoring has been trashed, deleted,
		 * or moved in a way that we didn't notice. We should make
		 * a spanking new NemoFile object for this
		 * location so if a new file appears in this place
		 * we will notice. However, we can't immediately do so
		 * because creating a new NemoFile directly as a result
		 * of noticing a file goes away may trigger i/o on that file
		 * again, noticeing it is gone, leading to a loop.
		 * So, the new NemoFile is created when the bookmark
		 * is used again. However, this is not really a problem, as
		 * we don't want to change the icon or anything about the
		 * bookmark just because its not there anymore.
		 */
		DEBUG ("%s: trashed", nemo_bookmark_get_name (bookmark));
		nemo_bookmark_disconnect_file (bookmark);
        nemo_bookmark_set_icon_to_default (bookmark);
	} else {
		nemo_bookmark_update_icon (bookmark);
		bookmark_set_name_from_ready_file (bookmark, file);

        if (metadata_changed (bookmark)) {
            g_signal_emit (bookmark, signals[CONTENTS_CHANGED], 0);
        }
	}
}
Beispiel #2
0
static void
nemo_bookmark_finalize (GObject *object)
{
	NemoBookmark *bookmark;

	g_assert (NEMO_IS_BOOKMARK (object));

	bookmark = NEMO_BOOKMARK (object);

	nemo_bookmark_disconnect_file (bookmark);	

	g_object_unref (bookmark->details->location);
	g_clear_object (&bookmark->details->icon);

	g_free (bookmark->details->name);
	g_free (bookmark->details->scroll_file);

	G_OBJECT_CLASS (nemo_bookmark_parent_class)->finalize (object);
}