Commit 4047e531 authored by William Jon McCann's avatar William Jon McCann

Try to store names for bookmarked uris

https://bugzilla.gnome.org/show_bug.cgi?id=524116
parent b49e144e
......@@ -1865,20 +1865,24 @@ add_bookmark (NautilusPlacesSidebar *sidebar)
GtkTreeModel *model;
GtkTreeIter iter;
char *uri;
char *name;
GFile *location;
NautilusBookmark *bookmark;
model = gtk_tree_view_get_model (sidebar->tree_view);
if (get_selected_iter (sidebar, &iter)) {
gtk_tree_model_get (model, &iter, PLACES_SIDEBAR_COLUMN_URI, &uri, -1);
gtk_tree_model_get (model, &iter,
PLACES_SIDEBAR_COLUMN_URI, &uri,
PLACES_SIDEBAR_COLUMN_NAME, &name,
-1);
if (uri == NULL) {
return;
}
location = g_file_new_for_uri (uri);
bookmark = nautilus_bookmark_new (location, NULL, NULL);
bookmark = nautilus_bookmark_new (location, name, NULL);
if (!nautilus_bookmark_list_contains (sidebar->bookmarks, bookmark)) {
nautilus_bookmark_list_append (sidebar->bookmarks, bookmark);
......@@ -1887,6 +1891,7 @@ add_bookmark (NautilusPlacesSidebar *sidebar)
g_object_unref (location);
g_object_unref (bookmark);
g_free (uri);
g_free (name);
}
}
......
......@@ -103,30 +103,44 @@ static void load_new_location (NautilusWindowSlot
static void location_has_really_changed (NautilusWindowSlot *slot);
static void update_for_new_location (NautilusWindowSlot *slot);
/* set_displayed_location:
*/
static void
set_displayed_location (NautilusWindowSlot *slot, GFile *location)
set_displayed_file (NautilusWindowSlot *slot, NautilusFile *file)
{
GFile *bookmark_location;
gboolean recreate;
GFile *new_location = NULL;
if (file != NULL) {
new_location = nautilus_file_get_location (file);
}
if (slot->current_location_bookmark == NULL || location == NULL) {
if (slot->current_location_bookmark == NULL || file == NULL) {
recreate = TRUE;
} else {
GFile *bookmark_location;
bookmark_location = nautilus_bookmark_get_location (slot->current_location_bookmark);
recreate = !g_file_equal (bookmark_location, location);
recreate = !g_file_equal (bookmark_location, new_location);
g_object_unref (bookmark_location);
}
if (recreate) {
char *display_name = NULL;
/* We've changed locations, must recreate bookmark for current location. */
g_clear_object (&slot->last_location_bookmark);
if (file != NULL) {
display_name = nautilus_file_get_display_name (file);
}
slot->last_location_bookmark = slot->current_location_bookmark;
slot->current_location_bookmark = (location == NULL) ? NULL
: nautilus_bookmark_new (location, NULL, NULL);
if (new_location == NULL) {
slot->current_location_bookmark = NULL;
} else {
slot->current_location_bookmark = nautilus_bookmark_new (new_location, display_name, NULL);
}
g_free (display_name);
}
g_clear_object (&new_location);
}
static void
......@@ -1394,7 +1408,8 @@ update_for_new_location (NautilusWindowSlot *slot)
new_location = slot->pending_location;
slot->pending_location = NULL;
set_displayed_location (slot, new_location);
file = nautilus_file_get (new_location);
set_displayed_file (slot, file);
update_history (slot, slot->location_change_type, new_location);
......@@ -1412,7 +1427,6 @@ update_for_new_location (NautilusWindowSlot *slot)
* if it goes away.
*/
cancel_viewed_file_changed_callback (slot);
file = nautilus_file_get (slot->location);
nautilus_window_slot_set_viewed_file (slot, file);
slot->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file);
slot->viewed_file_in_trash = nautilus_file_is_in_trash (file);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment