[nautilus] Try to store names for bookmarked uris
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Try to store names for bookmarked uris
- Date: Tue, 28 Aug 2012 17:46:48 +0000 (UTC)
commit 4047e53197b215e9b7ec4cccdba2eb97e0152f25
Author: William Jon McCann <jmccann redhat com>
Date: Mon Aug 27 20:23:39 2012 -0400
Try to store names for bookmarked uris
https://bugzilla.gnome.org/show_bug.cgi?id=524116
src/nautilus-places-sidebar.c | 9 +++++++--
src/nautilus-window-manage-views.c | 36 +++++++++++++++++++++++++-----------
2 files changed, 32 insertions(+), 13 deletions(-)
---
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 821f302..17a3740 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -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);
}
}
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 57a8bc8..5820128 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]