Exemplo n.º 1
0
static void
nemo_bookmark_connect_file (NemoBookmark *bookmark)
{
    if (bookmark->details->file != NULL) {
        DEBUG ("%s: file already connected, returning",
               nemo_bookmark_get_name (bookmark));
        return;
    }

    if (bookmark->details->exists) {
        DEBUG ("%s: creating file", nemo_bookmark_get_name (bookmark));

        bookmark->details->file = nemo_file_get (bookmark->details->location);
        g_assert (!nemo_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) {
        nemo_bookmark_set_icon_to_default (bookmark);
    }

    if (bookmark->details->file != NULL &&
        nemo_file_check_if_ready (bookmark->details->file, NEMO_FILE_ATTRIBUTE_INFO)) {
        bookmark_set_name_from_ready_file (bookmark, bookmark->details->file);
    }

    if (bookmark->details->name == NULL) {
        bookmark->details->name = nemo_compute_title_for_location (bookmark->details->location);
    }
}
Exemplo n.º 2
0
static void
nemo_bookmark_update_icon (NemoBookmark *bookmark)
{
	GIcon *new_icon;

	if (bookmark->details->file == NULL) {
		return;
	}

	if (!nemo_file_is_local (bookmark->details->file)) {
		/* never update icons for remote bookmarks */
		return;
	}

	if (!nemo_file_is_not_yet_confirmed (bookmark->details->file) &&
	    nemo_file_check_if_ready (bookmark->details->file,
					  NEMO_FILE_ATTRIBUTES_FOR_ICON)) {
		DEBUG ("%s: set new icon", nemo_bookmark_get_name (bookmark));

		new_icon = nemo_file_get_gicon (bookmark->details->file, 0);
		g_object_set (bookmark,
			      "icon", new_icon,
			      NULL);

		g_object_unref (new_icon);
	}
}
Exemplo n.º 3
0
static void
nemo_bookmark_update_icon (NemoBookmark *bookmark)
{
    gchar *new_icon_name;

    if (bookmark->details->file == NULL) {
        return;
    }

    if (!nemo_file_is_not_yet_confirmed (bookmark->details->file) &&
        nemo_file_check_if_ready (bookmark->details->file,
                                  NEMO_FILE_ATTRIBUTES_FOR_ICON)) {
        DEBUG ("%s: set new icon", nemo_bookmark_get_name (bookmark));

        new_icon_name = nemo_file_get_control_icon_name (bookmark->details->file);
        g_object_set (bookmark,
                      "icon-name", new_icon_name,
                      NULL);

        g_free (new_icon_name);
    }
}