diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-07-17 23:38:13 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-07-17 23:40:25 +0200 |
commit | 440343b9681e6e32eb6b0674f41baa6398f302e6 (patch) | |
tree | e6f1467c9923aa0835c2b43050737d8c661b4a91 | |
parent | 563a8d53f008bde67759801efa6628caeb67e5cf (diff) | |
download | nautilus-440343b9681e6e32eb6b0674f41baa6398f302e6.tar.gz |
window: don't show open button if current location
In the operation notification we show a "Open X" button to
open the destination folder of a operation.
But it's not useful if the current location in the view is
the destination folder itself.
So don't show the open button in that case.
-rw-r--r-- | src/nautilus-window.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 748e91c09..ddaf4125c 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1661,27 +1661,35 @@ nautilus_window_show_operation_notification (NautilusWindow *window, gchar *button_label; gchar *folder_name; NautilusFile *folder; + GFile *current_location; + current_location = nautilus_window_slot_get_location (window->priv->active_slot); if (gtk_window_has_toplevel_focus (GTK_WINDOW (window)) && !NAUTILUS_IS_DESKTOP_WINDOW (window)) { remove_notifications (window); - window->priv->folder_to_open = g_object_ref (folder_to_open); - folder = nautilus_file_get (folder_to_open); - folder_name = nautilus_file_get_display_name (folder); - button_label = g_strdup_printf (_("Open %s"), folder_name); - gtk_label_set_text (GTK_LABEL (window->priv->notification_operation_label), + gtk_label_set_text (GTK_LABEL (window->priv->notification_operation_label), main_label); - gtk_button_set_label (GTK_BUTTON (window->priv->notification_operation_open), - button_label); - gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->notification_operation), TRUE); - window->priv->notification_operation_timeout_id = g_timeout_add_seconds (NOTIFICATION_TIMEOUT, + + if (g_file_equal (folder_to_open, current_location)) { + gtk_widget_hide (window->priv->notification_operation_open); + } else { + gtk_widget_show (window->priv->notification_operation_open); + window->priv->folder_to_open = g_object_ref (folder_to_open); + folder = nautilus_file_get (folder_to_open); + folder_name = nautilus_file_get_display_name (folder); + button_label = g_strdup_printf (_("Open %s"), folder_name); + gtk_button_set_label (GTK_BUTTON (window->priv->notification_operation_open), + button_label); + g_object_unref (folder); + g_free (folder_name); + g_free (button_label); + } + + gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->notification_operation), TRUE); + window->priv->notification_operation_timeout_id = g_timeout_add_seconds (NOTIFICATION_TIMEOUT, (GSourceFunc) on_notification_operation_timeout, window); - g_object_unref (folder); - g_free (folder_name); - g_free (button_label); } - } static void |