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 (bookmark->details->exists) { 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)); g_signal_connect_object (bookmark->details->file, "changed", G_CALLBACK (bookmark_file_changed_callback), bookmark, 0); } if (bookmark->details->icon == NULL || bookmark->details->symbolic_icon == NULL) { nautilus_bookmark_set_icon_to_default (bookmark); } if (bookmark->details->file != NULL && nautilus_file_check_if_ready (bookmark->details->file, NAUTILUS_FILE_ATTRIBUTE_INFO)) { bookmark_set_name_from_ready_file (bookmark, bookmark->details->file); } if (bookmark->details->name == NULL) { bookmark->details->name = nautilus_compute_title_for_location (bookmark->details->location); } }
static NautilusBookmark * new_bookmark_from_uri (const char *uri, const char *label) { NautilusBookmark *new_bookmark; NautilusFile *file; char *name; GIcon *icon; gboolean has_label; GFile *location; gboolean native; location = NULL; if (uri) { location = g_file_new_for_uri (uri); } has_label = FALSE; if (!label) { name = nautilus_compute_title_for_location (location); } else { name = g_strdup (label); has_label = TRUE; } new_bookmark = NULL; if (uri) { native = g_file_is_native (location); file = nautilus_file_get (location); icon = NULL; if (nautilus_file_check_if_ready (file, NAUTILUS_FILE_ATTRIBUTES_FOR_ICON)) { icon = nautilus_file_get_gicon (file, 0); } nautilus_file_unref (file); if (icon == NULL) { icon = native ? g_themed_icon_new (NAUTILUS_ICON_FOLDER) : g_themed_icon_new (NAUTILUS_ICON_FOLDER_REMOTE); } new_bookmark = nautilus_bookmark_new (location, name, has_label, icon); g_object_unref (icon); } g_free (name); g_object_unref (location); return new_bookmark; }
static gboolean desktop_directory_file_check_if_ready (NautilusFile *file, NautilusFileAttributes attributes) { NautilusFileAttributes delegated_attributes, non_delegated_attributes; NautilusDesktopDirectoryFile *desktop_file; desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file); partition_attributes (attributes, &delegated_attributes, &non_delegated_attributes); return real_check_if_ready (file, non_delegated_attributes) && nautilus_file_check_if_ready (desktop_file->details->real_dir_file, delegated_attributes); }