summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-08-28 20:19:44 +0200
committerCarlos Soriano <csoriano@gnome.org>2015-08-28 22:24:25 +0200
commit7ebdf7cb99af2db52df14c7133039656004c3d69 (patch)
tree628bbffa55e994fc878e0088a63462612fa95fc1
parent4186ef2740b7ed0f19bab00a5ecc59c34642e978 (diff)
downloadnautilus-7ebdf7cb99af2db52df14c7133039656004c3d69.tar.gz
files-view: don't add sidebar shortcuts for gtkfilechooser
That was used when the action "Move to..." or "Copy to..." since it was using gtkfilechooser to choose the destination. We were adding a sidebar shortcut folder for every slot that was opened, that means that if we had a few tabs, the sidebar started to look crowed. Also the sidebar is no longer consistent, since it's diffenrent thant the state of the sidebar in the main Nautilus window. Designers agree that is better to make the sidebar less crowed and don't make it incosistent, since the value of adding a shorcut for opened locations doesn't balance the inconsistency and crowdness of the sidebar.
-rw-r--r--src/nautilus-files-view.c210
1 files changed, 0 insertions, 210 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 217943725..a9adb3bb4 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -5000,198 +5000,8 @@ typedef struct _CopyCallbackData {
} CopyCallbackData;
static void
-add_bookmark_for_uri (CopyCallbackData *data,
- const char *uri)
-{
- GError *error = NULL;
- int count;
-
- count = GPOINTER_TO_INT (g_hash_table_lookup (data->locations, uri));
- if (count == 0) {
- gtk_file_chooser_add_shortcut_folder_uri (data->chooser,
- uri,
- &error);
- if (error != NULL) {
- DEBUG ("Unable to add location '%s' to file selector: %s", uri, error->message);
- g_clear_error (&error);
- }
- }
- g_hash_table_replace (data->locations, g_strdup (uri), GINT_TO_POINTER (count + 1));
-}
-
-static void
-remove_bookmark_for_uri (CopyCallbackData *data,
- const char *uri)
-{
- GError *error = NULL;
- int count;
-
- count = GPOINTER_TO_INT (g_hash_table_lookup (data->locations, uri));
- if (count == 1) {
- gtk_file_chooser_remove_shortcut_folder_uri (data->chooser,
- uri,
- &error);
- if (error != NULL) {
- DEBUG ("Unable to remove location '%s' to file selector: %s", uri, error->message);
- g_clear_error (&error);
- }
- g_hash_table_remove (data->locations, uri);
- } else {
- g_hash_table_replace (data->locations, g_strdup (uri), GINT_TO_POINTER (count - 1));
- }
-}
-
-static void
-add_bookmarks_for_window_slot (CopyCallbackData *data,
- NautilusWindowSlot *slot)
-{
- GFile *location;
- char *uri;
-
- location = nautilus_window_slot_get_location (slot);
- if (location != NULL) {
- uri = g_file_get_uri (location);
- add_bookmark_for_uri (data, uri);
- g_free (uri);
- }
-}
-
-static void
-remove_bookmarks_for_window_slot (CopyCallbackData *data,
- NautilusWindowSlot *slot)
-{
- GFile *location;
- char *uri;
-
- location = nautilus_window_slot_get_location (slot);
- if (location != NULL) {
- uri = g_file_get_uri (location);
- remove_bookmark_for_uri (data, uri);
- g_free (uri);
- }
-}
-
-static void
-on_slot_location_changed (NautilusWindowSlot *slot,
- const char *from,
- const char *to,
- CopyCallbackData *data)
-{
- if (from != NULL) {
- remove_bookmark_for_uri (data, from);
- }
-
- if (to != NULL) {
- add_bookmark_for_uri (data, to);
- }
-}
-
-static void
-on_slot_added (NautilusWindow *window,
- NautilusWindowSlot *slot,
- CopyCallbackData *data)
-{
- add_bookmarks_for_window_slot (data, slot);
- g_signal_connect (slot, "location-changed", G_CALLBACK (on_slot_location_changed), data);
-}
-
-static void
-on_slot_removed (NautilusWindow *window,
- NautilusWindowSlot *slot,
- CopyCallbackData *data)
-{
- remove_bookmarks_for_window_slot (data, slot);
- g_signal_handlers_disconnect_by_func (slot,
- G_CALLBACK (on_slot_location_changed),
- data);
-}
-
-static void
-add_bookmarks_for_window (CopyCallbackData *data,
- NautilusWindow *window)
-{
- GList *s;
- GList *slots;
-
- slots = nautilus_window_get_slots (window);
- for (s = slots; s != NULL; s = s->next) {
- NautilusWindowSlot *slot = s->data;
- add_bookmarks_for_window_slot (data, slot);
- g_signal_connect (slot, "location-changed", G_CALLBACK (on_slot_location_changed), data);
- }
- g_signal_connect (window, "slot-added", G_CALLBACK (on_slot_added), data);
- g_signal_connect (window, "slot-removed", G_CALLBACK (on_slot_removed), data);
-}
-
-static void
-remove_bookmarks_for_window (CopyCallbackData *data,
- NautilusWindow *window)
-{
- GList *s;
- GList *slots;
-
- slots = nautilus_window_get_slots (window);
- for (s = slots; s != NULL; s = s->next) {
- NautilusWindowSlot *slot = s->data;
- remove_bookmarks_for_window_slot (data, slot);
- g_signal_handlers_disconnect_by_func (slot,
- G_CALLBACK (on_slot_location_changed),
- data);
- }
- g_signal_handlers_disconnect_by_func (window,
- G_CALLBACK (on_slot_added),
- data);
- g_signal_handlers_disconnect_by_func (window,
- G_CALLBACK (on_slot_removed),
- data);
-}
-
-static void
-on_app_window_added (GtkApplication *application,
- GtkWindow *window,
- CopyCallbackData *data)
-{
- add_bookmarks_for_window (data, NAUTILUS_WINDOW (window));
-}
-
-static void
-on_app_window_removed (GtkApplication *application,
- GtkWindow *window,
- CopyCallbackData *data)
-{
- remove_bookmarks_for_window (data, NAUTILUS_WINDOW (window));
-}
-
-static void
copy_data_free (CopyCallbackData *data)
{
- NautilusApplication *application;
- GList *windows;
- GList *w;
-
- application = NAUTILUS_APPLICATION (g_application_get_default ());
- g_signal_handlers_disconnect_by_func (application,
- G_CALLBACK (on_app_window_added),
- data);
- g_signal_handlers_disconnect_by_func (application,
- G_CALLBACK (on_app_window_removed),
- data);
-
- windows = nautilus_application_get_windows (application);
- for (w = windows; w != NULL; w = w->next) {
- NautilusWindow *window = w->data;
- GList *slots;
- GList *s;
-
- slots = nautilus_window_get_slots (window);
- for (s = slots; s != NULL; s = s->next) {
- NautilusWindowSlot *slot = s->data;
- g_signal_handlers_disconnect_by_func (slot, G_CALLBACK (on_slot_location_changed), data);
- }
- g_signal_handlers_disconnect_by_func (window, G_CALLBACK (on_slot_added), data);
- g_signal_handlers_disconnect_by_func (window, G_CALLBACK (on_slot_removed), data);
- }
-
nautilus_file_list_free (data->selection);
g_hash_table_destroy (data->locations);
g_free (data);
@@ -5299,24 +5109,6 @@ get_selected_folders (GList *selection)
}
static void
-add_window_location_bookmarks (CopyCallbackData *data)
-{
- NautilusApplication *application;
- GList *windows;
- GList *w;
-
- application = NAUTILUS_APPLICATION (g_application_get_default ());
- windows = nautilus_application_get_windows (application);
- g_signal_connect (application, "window-added", G_CALLBACK (on_app_window_added), data);
- g_signal_connect (application, "window-removed", G_CALLBACK (on_app_window_removed), data);
-
- for (w = windows; w != NULL; w = w->next) {
- NautilusWindow *window = w->data;
- add_bookmarks_for_window (data, window);
- }
-}
-
-static void
copy_or_move_selection (NautilusFilesView *view,
gboolean is_move)
{
@@ -5350,8 +5142,6 @@ copy_or_move_selection (NautilusFilesView *view,
copy_data->chooser = GTK_FILE_CHOOSER (dialog);
copy_data->locations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- add_window_location_bookmarks (copy_data);
-
if (selection != NULL) {
GtkFileFilter *filter;
GList *folders;