summaryrefslogtreecommitdiff
path: root/src/nautilus-files-view.c
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2016-03-22 13:49:49 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2016-11-27 17:36:59 +0100
commit0954a426232342f6a9e89647bd5639b99b1bc5f8 (patch)
tree1948998cf84caaabc4f0ad2d24f11a9b233c9d17 /src/nautilus-files-view.c
parent765eb7d38c3c464d28f3b88afcd9ec688b5da4b0 (diff)
downloadnautilus-0954a426232342f6a9e89647bd5639b99b1bc5f8.tar.gz
files-view: remove the floating barwip/gbsneto/actionbar
The floating bar was a bad choice since it's inception. Not only it hovers content, it's behavior is inconsistent and the usability of it is very poor. After the introduction of the actionbar, most of the data that we displayed through the floating bar was moved to the actionbar, making the floating bar obsolete. This commit follows up and completely removes the floating bar.
Diffstat (limited to 'src/nautilus-files-view.c')
-rw-r--r--src/nautilus-files-view.c501
1 files changed, 0 insertions, 501 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 20aaca540..26685cf96 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -35,7 +35,6 @@
#endif
#include "nautilus-error-reporting.h"
#include "nautilus-file-undo-manager.h"
-#include "nautilus-floating-bar.h"
#include "nautilus-list-view.h"
#include "nautilus-canvas-view.h"
#include "nautilus-mime-actions.h"
@@ -126,9 +125,6 @@
#define SHORTCUTS_PATH "/nautilus/scripts-accels"
-/* Delay to show the Loading... floating bar */
-#define FLOATING_BAR_LOADING_DELAY 200 /* ms */
-
#define MIN_COMMON_FILENAME_PREFIX_LENGTH 4
@@ -192,7 +188,6 @@ struct NautilusFilesViewDetails
guint display_selection_idle_id;
guint update_context_menus_timeout_id;
- guint update_status_idle_id;
guint reveal_selection_idle_id;
guint display_pending_source_id;
@@ -262,11 +257,6 @@ struct NautilusFilesViewDetails
GtkWidget *trash_is_empty_widget;
GtkWidget *no_search_results_widget;
- /* Floating bar */
- guint floating_bar_set_status_timeout_id;
- guint floating_bar_loading_timeout_id;
- GtkWidget *floating_bar;
-
/* Toolbar menu */
NautilusToolbarMenuSections *toolbar_menu_sections;
GtkWidget *sort_menu;
@@ -305,8 +295,6 @@ static void open_one_in_new_window (gpointer data,
gpointer callback_data);
static void schedule_update_context_menus (NautilusFilesView *view);
static void remove_update_context_menus_timeout_callback (NautilusFilesView *view);
-static void schedule_update_status (NautilusFilesView *view);
-static void remove_update_status_idle_callback (NautilusFilesView *view);
static void reset_update_interval (NautilusFilesView *view);
static void schedule_idle_display_of_pending_files (NautilusFilesView *view);
static void unschedule_display_of_pending_files (NautilusFilesView *view);
@@ -361,195 +349,6 @@ static const struct
#endif
};
-/*
- * Floating Bar code
- */
-static void
-remove_loading_floating_bar (NautilusFilesView *view)
-{
- if (view->details->floating_bar_loading_timeout_id != 0)
- {
- g_source_remove (view->details->floating_bar_loading_timeout_id);
- view->details->floating_bar_loading_timeout_id = 0;
- }
-
- gtk_widget_hide (view->details->floating_bar);
- nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
-}
-
-static void
-real_setup_loading_floating_bar (NautilusFilesView *view)
-{
- gboolean disable_chrome;
-
- g_object_get (nautilus_files_view_get_window (view),
- "disable-chrome", &disable_chrome,
- NULL);
-
- if (disable_chrome)
- {
- gtk_widget_hide (view->details->floating_bar);
- return;
- }
-
- nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
- nautilus_floating_bar_set_primary_label (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
- nautilus_view_is_searching (NAUTILUS_VIEW (view)) ? _("Searching…") : _("Loading…"));
- nautilus_floating_bar_set_details_label (NAUTILUS_FLOATING_BAR (view->details->floating_bar), NULL);
- nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (view->details->floating_bar), view->details->loading);
- nautilus_floating_bar_add_action (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
- "process-stop-symbolic",
- NAUTILUS_FLOATING_BAR_ACTION_ID_STOP);
-
- gtk_widget_set_halign (view->details->floating_bar, GTK_ALIGN_END);
- gtk_widget_show (view->details->floating_bar);
-}
-
-static gboolean
-setup_loading_floating_bar_timeout_cb (gpointer user_data)
-{
- NautilusFilesView *view = user_data;
-
- view->details->floating_bar_loading_timeout_id = 0;
- real_setup_loading_floating_bar (view);
-
- return FALSE;
-}
-
-static void
-setup_loading_floating_bar (NautilusFilesView *view)
-{
- /* setup loading overlay */
- if (view->details->floating_bar_set_status_timeout_id != 0)
- {
- g_source_remove (view->details->floating_bar_set_status_timeout_id);
- view->details->floating_bar_set_status_timeout_id = 0;
- }
-
- if (view->details->floating_bar_loading_timeout_id != 0)
- {
- g_source_remove (view->details->floating_bar_loading_timeout_id);
- view->details->floating_bar_loading_timeout_id = 0;
- }
-
- view->details->floating_bar_loading_timeout_id =
- g_timeout_add (FLOATING_BAR_LOADING_DELAY, setup_loading_floating_bar_timeout_cb, view);
-}
-
-static void
-floating_bar_action_cb (NautilusFloatingBar *floating_bar,
- gint action,
- NautilusFilesView *view)
-{
- if (action == NAUTILUS_FLOATING_BAR_ACTION_ID_STOP)
- {
- remove_loading_floating_bar (view);
- nautilus_window_slot_stop_loading (view->details->slot);
- }
-}
-
-static void
-real_floating_bar_set_short_status (NautilusFilesView *view,
- const gchar *primary_status,
- const gchar *detail_status)
-{
- gboolean disable_chrome;
-
- if (view->details->loading)
- {
- return;
- }
-
- nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
- nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
- FALSE);
-
- g_object_get (nautilus_files_view_get_window (view),
- "disable-chrome", &disable_chrome,
- NULL);
-
- if ((primary_status == NULL && detail_status == NULL) || disable_chrome)
- {
- gtk_widget_hide (view->details->floating_bar);
- nautilus_floating_bar_remove_hover_timeout (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
- return;
- }
-
- nautilus_floating_bar_set_labels (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
- primary_status,
- detail_status);
-
- gtk_widget_show (view->details->floating_bar);
-}
-
-typedef struct
-{
- gchar *primary_status;
- gchar *detail_status;
- NautilusFilesView *view;
-} FloatingBarSetStatusData;
-
-static void
-floating_bar_set_status_data_free (gpointer data)
-{
- FloatingBarSetStatusData *status_data = data;
-
- g_free (status_data->primary_status);
- g_free (status_data->detail_status);
-
- g_slice_free (FloatingBarSetStatusData, data);
-}
-
-static gboolean
-floating_bar_set_status_timeout_cb (gpointer data)
-{
- FloatingBarSetStatusData *status_data = data;
-
- status_data->view->details->floating_bar_set_status_timeout_id = 0;
- real_floating_bar_set_short_status (status_data->view,
- status_data->primary_status,
- status_data->detail_status);
-
- return FALSE;
-}
-
-static void
-set_floating_bar_status (NautilusFilesView *view,
- const gchar *primary_status,
- const gchar *detail_status)
-{
- GtkSettings *settings;
- gint double_click_time;
- FloatingBarSetStatusData *status_data;
-
- if (view->details->floating_bar_set_status_timeout_id != 0)
- {
- g_source_remove (view->details->floating_bar_set_status_timeout_id);
- view->details->floating_bar_set_status_timeout_id = 0;
- }
-
- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (view)));
- g_object_get (settings,
- "gtk-double-click-time", &double_click_time,
- NULL);
-
- status_data = g_slice_new0 (FloatingBarSetStatusData);
- status_data->primary_status = g_strdup (primary_status);
- status_data->detail_status = g_strdup (detail_status);
- status_data->view = view;
-
- /* waiting for half of the double-click-time before setting
- * the status seems to be a good approximation of not setting it
- * too often and not delaying the statusbar too much.
- */
- view->details->floating_bar_set_status_timeout_id =
- g_timeout_add_full (G_PRIORITY_DEFAULT,
- (guint) (double_click_time / 2),
- floating_bar_set_status_timeout_cb,
- status_data,
- floating_bar_set_status_data_free);
-}
-
static char *
real_get_backing_uri (NautilusFilesView *view)
{
@@ -2989,7 +2788,6 @@ nautilus_files_view_destroy (GtkWidget *object)
}
remove_update_context_menus_timeout_callback (view);
- remove_update_status_idle_callback (view);
if (view->details->display_selection_idle_id != 0)
{
@@ -3003,18 +2801,6 @@ nautilus_files_view_destroy (GtkWidget *object)
view->details->reveal_selection_idle_id = 0;
}
- if (view->details->floating_bar_set_status_timeout_id != 0)
- {
- g_source_remove (view->details->floating_bar_set_status_timeout_id);
- view->details->floating_bar_set_status_timeout_id = 0;
- }
-
- if (view->details->floating_bar_loading_timeout_id != 0)
- {
- g_source_remove (view->details->floating_bar_loading_timeout_id);
- view->details->floating_bar_loading_timeout_id = 0;
- }
-
g_signal_handlers_disconnect_by_func (nautilus_preferences,
schedule_update_context_menus, view);
g_signal_handlers_disconnect_by_func (nautilus_preferences,
@@ -3023,8 +2809,6 @@ nautilus_files_view_destroy (GtkWidget *object)
sort_directories_first_changed_callback, view);
g_signal_handlers_disconnect_by_func (gtk_filechooser_preferences,
show_hidden_files_changed_callback, view);
- g_signal_handlers_disconnect_by_func (nautilus_window_state,
- nautilus_files_view_display_selection_info, view);
g_signal_handlers_disconnect_by_func (gnome_lockdown_preferences,
schedule_update_context_menus, view);
g_signal_handlers_disconnect_by_func (nautilus_trash_monitor_get (),
@@ -3068,218 +2852,6 @@ nautilus_files_view_finalize (GObject *object)
G_OBJECT_CLASS (nautilus_files_view_parent_class)->finalize (object);
}
-/**
- * nautilus_files_view_display_selection_info:
- *
- * Display information about the current selection, and notify the view frame of the changed selection.
- * @view: NautilusFilesView for which to display selection info.
- *
- **/
-void
-nautilus_files_view_display_selection_info (NautilusFilesView *view)
-{
- GList *selection;
- goffset non_folder_size;
- gboolean non_folder_size_known;
- guint non_folder_count, folder_count, folder_item_count;
- gboolean folder_item_count_known;
- guint file_item_count;
- GList *p;
- char *first_item_name;
- char *non_folder_count_str;
- char *non_folder_item_count_str;
- char *folder_count_str;
- char *folder_item_count_str;
- char *primary_status;
- char *detail_status;
- NautilusFile *file;
-
- g_return_if_fail (NAUTILUS_IS_FILES_VIEW (view));
-
- selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
-
- folder_item_count_known = TRUE;
- folder_count = 0;
- folder_item_count = 0;
- non_folder_count = 0;
- non_folder_size_known = FALSE;
- non_folder_size = 0;
- first_item_name = NULL;
- folder_count_str = NULL;
- folder_item_count_str = NULL;
- non_folder_count_str = NULL;
- non_folder_item_count_str = NULL;
-
- for (p = selection; p != NULL; p = p->next)
- {
- file = p->data;
- if (nautilus_file_is_directory (file))
- {
- folder_count++;
- if (nautilus_file_get_directory_item_count (file, &file_item_count, NULL))
- {
- folder_item_count += file_item_count;
- }
- else
- {
- folder_item_count_known = FALSE;
- }
- }
- else
- {
- non_folder_count++;
- if (!nautilus_file_can_get_size (file))
- {
- non_folder_size_known = TRUE;
- non_folder_size += nautilus_file_get_size (file);
- }
- }
-
- if (first_item_name == NULL)
- {
- first_item_name = nautilus_file_get_display_name (file);
- }
- }
-
- nautilus_file_list_free (selection);
-
- /* Break out cases for localization's sake. But note that there are still pieces
- * being assembled in a particular order, which may be a problem for some localizers.
- */
-
- if (folder_count != 0)
- {
- if (folder_count == 1 && non_folder_count == 0)
- {
- folder_count_str = g_strdup_printf (_("“%s” selected"), first_item_name);
- }
- else
- {
- folder_count_str = g_strdup_printf (ngettext ("%'d folder selected",
- "%'d folders selected",
- folder_count),
- folder_count);
- }
-
- if (folder_count == 1)
- {
- if (!folder_item_count_known)
- {
- folder_item_count_str = g_strdup ("");
- }
- else
- {
- folder_item_count_str = g_strdup_printf (ngettext ("(containing %'d item)",
- "(containing %'d items)",
- folder_item_count),
- folder_item_count);
- }
- }
- else
- {
- if (!folder_item_count_known)
- {
- folder_item_count_str = g_strdup ("");
- }
- else
- {
- /* translators: this is preceded with a string of form 'N folders' (N more than 1) */
- folder_item_count_str = g_strdup_printf (ngettext ("(containing a total of %'d item)",
- "(containing a total of %'d items)",
- folder_item_count),
- folder_item_count);
- }
- }
- }
-
- if (non_folder_count != 0)
- {
- if (folder_count == 0)
- {
- if (non_folder_count == 1)
- {
- non_folder_count_str = g_strdup_printf (_("“%s” selected"),
- first_item_name);
- }
- else
- {
- non_folder_count_str = g_strdup_printf (ngettext ("%'d item selected",
- "%'d items selected",
- non_folder_count),
- non_folder_count);
- }
- }
- else
- {
- /* Folders selected also, use "other" terminology */
- non_folder_count_str = g_strdup_printf (ngettext ("%'d other item selected",
- "%'d other items selected",
- non_folder_count),
- non_folder_count);
- }
-
- if (non_folder_size_known)
- {
- char *size_string;
-
- size_string = g_format_size (non_folder_size);
- /* This is marked for translation in case a localiser
- * needs to use something other than parentheses. The
- * the message in parentheses is the size of the selected items.
- */
- non_folder_item_count_str = g_strdup_printf (_("(%s)"), size_string);
- g_free (size_string);
- }
- else
- {
- non_folder_item_count_str = g_strdup ("");
- }
- }
-
- if (folder_count == 0 && non_folder_count == 0)
- {
- primary_status = NULL;
- detail_status = NULL;
- }
- else if (folder_count == 0)
- {
- primary_status = g_strdup (non_folder_count_str);
- detail_status = g_strdup (non_folder_item_count_str);
- }
- else if (non_folder_count == 0)
- {
- primary_status = g_strdup (folder_count_str);
- detail_status = g_strdup (folder_item_count_str);
- }
- else
- {
- /* This is marked for translation in case a localizer
- * needs to change ", " to something else. The comma
- * is between the message about the number of folders
- * and the number of items in those folders and the
- * message about the number of other items and the
- * total size of those items.
- */
- primary_status = g_strdup_printf (_("%s %s, %s %s"),
- folder_count_str,
- folder_item_count_str,
- non_folder_count_str,
- non_folder_item_count_str);
- detail_status = NULL;
- }
-
- g_free (first_item_name);
- g_free (folder_count_str);
- g_free (folder_item_count_str);
- g_free (non_folder_count_str);
- g_free (non_folder_item_count_str);
-
- set_floating_bar_status (view, primary_status, detail_status);
-
- g_free (primary_status);
- g_free (detail_status);
-}
-
static void
nautilus_files_view_set_location (NautilusView *view,
GFile *location)
@@ -3380,9 +2952,7 @@ done_loading (NautilusFilesView *view,
if (!view->details->in_destruction)
{
- remove_loading_floating_bar (view);
schedule_update_context_menus (view);
- schedule_update_status (view);
nautilus_files_view_update_toolbar_menus (view);
reset_update_interval (view);
@@ -3437,7 +3007,6 @@ done_loading (NautilusFilesView *view,
nautilus_files_view_reveal_selection (view);
}
}
- nautilus_files_view_display_selection_info (view);
}
view->details->loading = FALSE;
@@ -3999,7 +3568,6 @@ display_selection_info_idle_callback (gpointer data)
g_object_ref (G_OBJECT (view));
view->details->display_selection_idle_id = 0;
- nautilus_files_view_display_selection_info (view);
g_object_notify (G_OBJECT (view), "selection");
g_object_unref (G_OBJECT (view));
@@ -4224,9 +3792,6 @@ files_added_callback (NautilusDirectory *directory,
queue_pending_files (view, directory, files, &view->details->new_added_files);
- /* The number of items could have changed */
- schedule_update_status (view);
-
nautilus_profile_end (NULL);
}
@@ -4251,9 +3816,6 @@ files_changed_callback (NautilusDirectory *directory,
queue_pending_files (view, directory, files, &view->details->new_changed_files);
- /* The free space or the number of items could have changed */
- schedule_update_status (view);
-
/* A change in MIME type could affect the Open with menu, for
* one thing, so we need to update menus when files change.
*/
@@ -4278,8 +3840,6 @@ done_loading_callback (NautilusDirectory *directory,
*/
unschedule_display_of_pending_files (view);
schedule_timeout_display_of_pending_files (view, UPDATE_INTERVAL_MIN);
-
- remove_loading_floating_bar (view);
}
nautilus_profile_end (NULL);
}
@@ -7862,52 +7422,6 @@ schedule_update_context_menus (NautilusFilesView *view)
}
}
-static void
-remove_update_status_idle_callback (NautilusFilesView *view)
-{
- if (view->details->update_status_idle_id != 0)
- {
- g_source_remove (view->details->update_status_idle_id);
- view->details->update_status_idle_id = 0;
- }
-}
-
-static gboolean
-update_status_idle_callback (gpointer data)
-{
- NautilusFilesView *view;
-
- view = NAUTILUS_FILES_VIEW (data);
- nautilus_files_view_display_selection_info (view);
- view->details->update_status_idle_id = 0;
- return FALSE;
-}
-
-static void
-schedule_update_status (NautilusFilesView *view)
-{
- g_assert (NAUTILUS_IS_FILES_VIEW (view));
-
- /* Make sure we haven't already destroyed it */
- if (view->details->slot == NULL)
- {
- return;
- }
-
- if (view->details->loading)
- {
- /* Don't update status bar while loading the dir */
- return;
- }
-
- if (view->details->update_status_idle_id == 0)
- {
- view->details->update_status_idle_id =
- g_idle_add_full (G_PRIORITY_DEFAULT_IDLE - 20,
- update_status_idle_callback, view, NULL);
- }
-}
-
/**
* nautilus_files_view_notify_selection_changed:
*
@@ -7963,9 +7477,7 @@ file_changed_callback (NautilusFile *file,
NautilusFilesView *view = NAUTILUS_FILES_VIEW (callback_data);
schedule_changes (view);
-
schedule_update_context_menus (view);
- schedule_update_status (view);
}
/**
@@ -7993,8 +7505,6 @@ load_directory (NautilusFilesView *view,
view->details->loading = TRUE;
- setup_loading_floating_bar (view);
-
/* Update menus when directory is empty, before going to new
* location, so they won't have any false lingering knowledge
* of old selection.
@@ -9160,17 +8670,6 @@ nautilus_files_view_init (NautilusFilesView *view)
TRUE);
g_object_unref (builder);
- /* Floating bar */
- view->details->floating_bar = nautilus_floating_bar_new (NULL, NULL, FALSE);
- gtk_widget_set_halign (view->details->floating_bar, GTK_ALIGN_END);
- gtk_widget_set_valign (view->details->floating_bar, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (view->details->overlay), view->details->floating_bar);
-
- g_signal_connect (view->details->floating_bar,
- "action",
- G_CALLBACK (floating_bar_action_cb),
- view);
-
/* Default to true; desktop-icon-view sets to false */
view->details->show_foreign_files = TRUE;