Skip to content

Commit

Permalink
Disallow bookmarking of search result views.
Browse files Browse the repository at this point in the history
This doesn't work, but it still would allow you to bookmark a search
results page and show up as a broken bookmark.

With the new search favorites capability, this isn't needed.
  • Loading branch information
mtwebster committed May 5, 2018
1 parent d547d02 commit ec9e496
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/nemo-pathbar.c
Expand Up @@ -28,6 +28,8 @@

#include "nemo-pathbar.h"

#include <eel/eel-vfs-extensions.h>

#include <libnemo-private/nemo-file.h>
#include <libnemo-private/nemo-file-utilities.h>
#include <libnemo-private/nemo-global-preferences.h>
Expand Down Expand Up @@ -1845,6 +1847,7 @@ make_directory_button (NemoPathBar *path_bar,
GFile *path;
GtkWidget *child;
ButtonData *button_data;
gchar *uri;

path = nemo_file_get_location (file);
child = NULL;
Expand Down Expand Up @@ -1913,7 +1916,13 @@ make_directory_button (NemoPathBar *path_bar,
g_signal_connect (button_data->button, "clicked", G_CALLBACK (button_clicked_cb), button_data);
g_object_weak_ref (G_OBJECT (button_data->button), (GWeakNotify) button_data_free, button_data);

setup_button_drag_source (button_data);
uri = g_file_get_uri (path);

if (!eel_uri_is_search (uri)) {
setup_button_drag_source (button_data);
}

g_clear_pointer (&uri, g_free);

nemo_drag_slot_proxy_init (button_data->button, button_data->file, NULL);

Expand Down
2 changes: 1 addition & 1 deletion src/nemo-window-manage-views.c
Expand Up @@ -1453,7 +1453,7 @@ update_for_new_location (NemoWindowSlot *slot)
/* Sync up and zoom action states */
nemo_window_sync_up_button (window);
nemo_window_sync_zoom_widgets (window);

nemo_window_sync_bookmark_action (window);
nemo_window_sync_view_type (window);

/* Load menus from nemo extensions for this location */
Expand Down
1 change: 1 addition & 0 deletions src/nemo-window-private.h
Expand Up @@ -160,6 +160,7 @@ void nemo_window_sync_title (NemoWindow *window,
void nemo_window_sync_zoom_widgets (NemoWindow *window);
void nemo_window_sync_up_button (NemoWindow *window);
void nemo_window_sync_menu_bar (NemoWindow *window);
void nemo_window_sync_bookmark_action (NemoWindow *window);

/* window menus */
GtkActionGroup *nemo_window_create_toolbar_action_group (NemoWindow *window);
Expand Down
1 change: 1 addition & 0 deletions src/nemo-window-slot.c
Expand Up @@ -232,6 +232,7 @@ real_active (NemoWindowSlot *slot)
nemo_window_sync_allow_stop (window, slot);
nemo_window_sync_title (window, slot);
nemo_window_sync_zoom_widgets (window);
nemo_window_sync_bookmark_action (window);
nemo_window_pane_sync_location_widgets (slot->pane);
nemo_window_pane_sync_search_widgets (slot->pane);

Expand Down
27 changes: 27 additions & 0 deletions src/nemo-window.c
Expand Up @@ -51,6 +51,8 @@
#include <eel/eel-debug.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-string.h>
#include <eel/eel-vfs-extensions.h>

#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
Expand Down Expand Up @@ -1311,6 +1313,31 @@ nemo_window_sync_zoom_widgets (NemoWindow *window)
nemo_status_bar_sync_zoom_widgets (NEMO_STATUS_BAR (window->details->nemo_status_bar));
}

void
nemo_window_sync_bookmark_action (NemoWindow *window)
{
NemoWindowSlot *slot;
GFile *location;
GtkAction *action;
gchar *uri;
slot = nemo_window_get_active_slot (window);
location = nemo_window_slot_get_location (slot);

if (!location) {
return;
}

uri = g_file_get_uri (location);

action = gtk_action_group_get_action (nemo_window_get_main_action_group (window),
NEMO_ACTION_ADD_BOOKMARK);

gtk_action_set_sensitive (action, !eel_uri_is_search (uri));

g_free (uri);
g_object_unref (location);
}

static void
zoom_level_changed_callback (NemoView *view,
NemoWindow *window)
Expand Down

0 comments on commit ec9e496

Please sign in to comment.