summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-02-15 22:47:08 -0500
committerCosimo Cecchi <cosimoc@gnome.org>2011-02-17 11:25:18 -0500
commit476d462bce0bce5fdc367daea3e14be8603f5c3d (patch)
tree28acc288aa4daf7c2b1288b04267f017be9634b2
parent8974c917ecb202a0dad4871c79dc8d7306e28feb (diff)
downloadnautilus-476d462bce0bce5fdc367daea3e14be8603f5c3d.tar.gz
all: remove the concept of global history list
It's not that useful now that nautilus is not a long running application anymore.
-rw-r--r--src/nautilus-navigation-window-menus.c126
-rw-r--r--src/nautilus-navigation-window.c2
-rw-r--r--src/nautilus-window-manage-views.c3
-rw-r--r--src/nautilus-window-private.h9
-rw-r--r--src/nautilus-window-slot.c13
-rw-r--r--src/nautilus-window-slot.h2
-rw-r--r--src/nautilus-window.c117
7 files changed, 7 insertions, 265 deletions
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index 83d9d41b1..a0fcbad3f 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -56,8 +56,6 @@
#define RESPONSE_FORGET 1000
#define MENU_ITEM_MAX_WIDTH_CHARS 32
-static void schedule_refresh_go_menu (NautilusNavigationWindow *window);
-
enum {
SIDEBAR_PLACES,
SIDEBAR_TREE
@@ -254,55 +252,6 @@ action_edit_bookmarks_callback (GtkAction *action,
nautilus_window_edit_bookmarks (NAUTILUS_WINDOW (user_data));
}
-void
-nautilus_navigation_window_remove_go_menu_callback (NautilusNavigationWindow *window)
-{
- if (window->details->refresh_go_menu_idle_id != 0) {
- g_source_remove (window->details->refresh_go_menu_idle_id);
- window->details->refresh_go_menu_idle_id = 0;
- }
-}
-
-void
-nautilus_navigation_window_remove_go_menu_items (NautilusNavigationWindow *window)
-{
- GtkUIManager *ui_manager;
-
- ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
- if (window->details->go_menu_merge_id != 0) {
- gtk_ui_manager_remove_ui (ui_manager,
- window->details->go_menu_merge_id);
- window->details->go_menu_merge_id = 0;
- }
- if (window->details->go_menu_action_group != NULL) {
- gtk_ui_manager_remove_action_group (ui_manager,
- window->details->go_menu_action_group);
- window->details->go_menu_action_group = NULL;
- }
-}
-
-static void
-show_bogus_history_window (NautilusWindow *window,
- NautilusBookmark *bookmark)
-{
- GFile *file;
- char *uri_for_display;
- char *detail;
-
- file = nautilus_bookmark_get_location (bookmark);
- uri_for_display = g_file_get_parse_name (file);
-
- detail = g_strdup_printf (_("The location \"%s\" does not exist."), uri_for_display);
-
- eel_show_warning_dialog (_("The history location doesn't exist."),
- detail,
- GTK_WINDOW (window));
-
- g_object_unref (file);
- g_free (uri_for_display);
- g_free (detail);
-}
-
static void
connect_proxy_cb (GtkActionGroup *action_group,
GtkAction *action,
@@ -337,33 +286,25 @@ static const char* icon_entries[] = {
* @window: The NautilusWindow whose Go menu will be refreshed.
**/
static void
-refresh_go_menu (NautilusNavigationWindow *window)
+nautilus_navigation_window_initialize_go_menu (NautilusNavigationWindow *window)
{
GtkUIManager *ui_manager;
- GList *node;
GtkWidget *menuitem;
- int index;
+ GtkActionGroup *action_group;
int i;
-
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
- /* Unregister any pending call to this function. */
- nautilus_navigation_window_remove_go_menu_callback (window);
- /* Remove old set of history items. */
- nautilus_navigation_window_remove_go_menu_items (window);
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
- window->details->go_menu_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
- window->details->go_menu_action_group = gtk_action_group_new ("GoMenuGroup");
- g_signal_connect (window->details->go_menu_action_group, "connect-proxy",
+ action_group = gtk_action_group_new ("GoMenuGroup");
+ g_signal_connect (action_group, "connect-proxy",
G_CALLBACK (connect_proxy_cb), NULL);
gtk_ui_manager_insert_action_group (ui_manager,
- window->details->go_menu_action_group,
+ action_group,
-1);
- g_object_unref (window->details->go_menu_action_group);
+ g_object_unref (action_group);
for (i = 0; i < G_N_ELEMENTS (icon_entries); i++) {
menuitem = gtk_ui_manager_get_widget (
@@ -373,59 +314,6 @@ refresh_go_menu (NautilusNavigationWindow *window)
gtk_image_menu_item_set_always_show_image (
GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
}
-
- /* Add in a new set of history items. */
- for (node = nautilus_get_history_list (), index = 0;
- node != NULL && index < 10;
- node = node->next, index++) {
- nautilus_menus_append_bookmark_to_menu
- (NAUTILUS_WINDOW (window),
- NAUTILUS_BOOKMARK (node->data),
- MENU_PATH_HISTORY_PLACEHOLDER,
- "history",
- index,
- window->details->go_menu_action_group,
- window->details->go_menu_merge_id,
- G_CALLBACK (schedule_refresh_go_menu),
- show_bogus_history_window);
- }
-}
-
-static gboolean
-refresh_go_menu_idle_callback (gpointer data)
-{
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (data));
-
- refresh_go_menu (NAUTILUS_NAVIGATION_WINDOW (data));
-
- /* Don't call this again (unless rescheduled) */
- return FALSE;
-}
-
-static void
-schedule_refresh_go_menu (NautilusNavigationWindow *window)
-{
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
- if (window->details->refresh_go_menu_idle_id == 0) {
- window->details->refresh_go_menu_idle_id
- = g_idle_add (refresh_go_menu_idle_callback,
- window);
- }
-}
-
-/**
- * nautilus_navigation_window_initialize_go_menu
- *
- * Wire up signals so we'll be notified when history list changes.
- */
-static void
-nautilus_navigation_window_initialize_go_menu (NautilusNavigationWindow *window)
-{
- /* Recreate bookmarks part of menu if history list changes
- */
- g_signal_connect_object (nautilus_signaller_get_current (), "history_list_changed",
- G_CALLBACK (schedule_refresh_go_menu), window, G_CONNECT_SWAPPED);
}
void
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 25df18778..9d5b3c699 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -309,8 +309,6 @@ nautilus_navigation_window_finalize (GObject *object)
g_free (window->details->sidebar_id);
- nautilus_navigation_window_remove_go_menu_callback (window);
-
g_signal_handlers_disconnect_by_func (nautilus_preferences,
always_use_browser_changed,
window);
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index c639c60c4..4441e15cc 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -404,18 +404,15 @@ update_history (NautilusWindowSlot *slot,
switch (type) {
case NAUTILUS_LOCATION_CHANGE_STANDARD:
case NAUTILUS_LOCATION_CHANGE_FALLBACK:
- nautilus_window_slot_add_current_location_to_history_list (slot);
handle_go_elsewhere (slot, new_location);
return;
case NAUTILUS_LOCATION_CHANGE_RELOAD:
/* for reload there is no work to do */
return;
case NAUTILUS_LOCATION_CHANGE_BACK:
- nautilus_window_slot_add_current_location_to_history_list (slot);
handle_go_back (NAUTILUS_NAVIGATION_WINDOW_SLOT (slot), new_location);
return;
case NAUTILUS_LOCATION_CHANGE_FORWARD:
- nautilus_window_slot_add_current_location_to_history_list (slot);
handle_go_forward (NAUTILUS_NAVIGATION_WINDOW_SLOT (slot), new_location);
return;
case NAUTILUS_LOCATION_CHANGE_REDIRECT:
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 778332227..6f738483a 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -102,11 +102,6 @@ struct _NautilusNavigationWindowDetails {
int side_pane_width;
GtkWidget *sidebar;
gchar *sidebar_id;
-
- /* Menus */
- GtkActionGroup *go_menu_action_group;
- guint refresh_go_menu_idle_id;
- guint go_menu_merge_id;
/* Toolbar */
GtkWidget *toolbar;
@@ -204,9 +199,7 @@ void nautilus_window_set_active_pane (Nautil
NautilusWindowPane *new_pane);
NautilusWindowPane * nautilus_window_get_active_pane (NautilusWindow *window);
-void nautilus_send_history_list_changed (void);
gboolean nautilus_add_bookmark_to_history_list (NautilusBookmark *bookmark);
-GList * nautilus_get_history_list (void);
void nautilus_window_bookmarks_preference_changed_callback (gpointer user_data);
@@ -228,8 +221,6 @@ void nautilus_navigation_window_remove_bookmarks_menu_callback
void nautilus_navigation_window_remove_bookmarks_menu_items (NautilusNavigationWindow *window);
void nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow *window);
void nautilus_navigation_window_update_spatial_menu_item (NautilusNavigationWindow *window);
-void nautilus_navigation_window_remove_go_menu_callback (NautilusNavigationWindow *window);
-void nautilus_navigation_window_remove_go_menu_items (NautilusNavigationWindow *window);
/* Navigation window toolbar */
void nautilus_navigation_window_activate_spinner (NautilusNavigationWindow *window);
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 5d5f9b82e..42647e378 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -312,9 +312,6 @@ nautilus_window_slot_set_title (NautilusWindowSlot *slot,
if (eel_strlen (slot->title) > 0 && slot->current_location_bookmark) {
changed = TRUE;
-
- /* Name of item in history list changed, tell listeners. */
- nautilus_send_history_list_changed ();
}
if (changed) {
@@ -520,16 +517,6 @@ nautilus_window_slot_add_extra_location_widget (NautilusWindowSlot *slot,
gtk_widget_show (slot->extra_location_frame);
}
-void
-nautilus_window_slot_add_current_location_to_history_list (NautilusWindowSlot *slot)
-{
-
- if ((slot->pane->window == NULL || !NAUTILUS_IS_DESKTOP_WINDOW (slot->pane->window)) &&
- nautilus_add_bookmark_to_history_list (slot->current_location_bookmark)) {
- nautilus_send_history_list_changed ();
- }
-}
-
/* returns either the pending or the actual current uri */
char *
nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot)
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 5b270ee21..3663a2944 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -176,8 +176,6 @@ void nautilus_window_slot_add_extra_location_widget (NautilusWindowSlot *
GtkWidget *widget);
void nautilus_window_slot_remove_extra_location_widgets (NautilusWindowSlot *slot);
-void nautilus_window_slot_add_current_location_to_history_list (NautilusWindowSlot *slot);
-
void nautilus_window_slot_is_in_active_pane (NautilusWindowSlot *slot, gboolean is_active);
NautilusView * nautilus_window_slot_get_current_view (NautilusWindowSlot *slot);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 03e5d2cdd..8a4f2a12b 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -106,8 +106,6 @@ static void cancel_view_as_callback (NautilusWindowSlot *slot);
static void action_view_as_callback (GtkAction *action,
ActivateViewData *data);
-static GList *history_list;
-
G_DEFINE_TYPE (NautilusWindow, nautilus_window, GTK_TYPE_WINDOW);
static const struct {
@@ -1476,84 +1474,6 @@ nautilus_window_slot_set_viewed_file (NautilusWindowSlot *slot,
slot->viewed_file = file;
}
-void
-nautilus_send_history_list_changed (void)
-{
- g_signal_emit_by_name (nautilus_signaller_get_current (),
- "history_list_changed");
-}
-
-static void
-free_history_list (void)
-{
- g_list_free_full (history_list, g_object_unref);
- history_list = NULL;
-}
-
-/* Remove the this URI from the history list.
- * Do not sent out a change notice.
- * We pass in a bookmark for convenience.
- */
-static void
-remove_from_history_list (NautilusBookmark *bookmark)
-{
- GList *node;
-
- /* Compare only the uris here. Comparing the names also is not
- * necessary and can cause problems due to the asynchronous
- * nature of when the title of the window is set.
- */
- node = g_list_find_custom (history_list,
- bookmark,
- nautilus_bookmark_compare_uris);
-
- /* Remove any older entry for this same item. There can be at most 1. */
- if (node != NULL) {
- history_list = g_list_remove_link (history_list, node);
- g_object_unref (node->data);
- g_list_free_1 (node);
- }
-}
-
-gboolean
-nautilus_add_bookmark_to_history_list (NautilusBookmark *bookmark)
-{
- /* Note that the history is shared amongst all windows so
- * this is not a NautilusNavigationWindow function. Perhaps it belongs
- * in its own file.
- */
- int i;
- GList *l, *next;
- static gboolean free_history_list_is_set_up;
-
- g_assert (NAUTILUS_IS_BOOKMARK (bookmark));
-
- if (!free_history_list_is_set_up) {
- eel_debug_call_at_shutdown (free_history_list);
- free_history_list_is_set_up = TRUE;
- }
-
- if (!history_list ||
- nautilus_bookmark_compare_uris (history_list->data, bookmark)) {
- g_object_ref (bookmark);
- remove_from_history_list (bookmark);
- history_list = g_list_prepend (history_list, bookmark);
-
- for (i = 0, l = history_list; l; l = next) {
- next = l->next;
-
- if (i++ >= MAX_HISTORY_ITEMS) {
- g_object_unref (l->data);
- history_list = g_list_delete_link (history_list, l);
- }
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
NautilusWindowSlot *
nautilus_window_get_slot_for_view (NautilusWindow *window,
NautilusView *view)
@@ -1579,7 +1499,6 @@ nautilus_window_get_slot_for_view (NautilusWindow *window,
void
nautilus_forget_history (void)
{
- NautilusWindowSlot *slot;
NautilusNavigationWindowSlot *navigation_slot;
GList *window_node, *l, *walk;
NautilusApplication *app;
@@ -1612,47 +1531,11 @@ nautilus_forget_history (void)
nautilus_navigation_window_allow_back (window, FALSE);
nautilus_navigation_window_allow_forward (window, FALSE);
}
-
- for (walk = NAUTILUS_WINDOW (window_node->data)->details->panes; walk; walk = walk->next) {
- NautilusWindowPane *pane = walk->data;
- for (l = pane->slots; l != NULL; l = l->next) {
- slot = l->data;
- history_list = g_list_remove (history_list,
- slot->current_location_bookmark);
- }
- }
- }
-
- /* Clobber history list. */
- free_history_list ();
-
- /* Re-add each window's current location to history list. */
- for (window_node = gtk_application_get_windows (GTK_APPLICATION (app));
- window_node != NULL;
- window_node = window_node->next) {
- NautilusWindow *window;
- NautilusWindowSlot *slot;
- GList *l;
-
- window = NAUTILUS_WINDOW (window_node->data);
- for (walk = window->details->panes; walk; walk = walk->next) {
- NautilusWindowPane *pane = walk->data;
- for (l = pane->slots; l != NULL; l = l->next) {
- slot = NAUTILUS_WINDOW_SLOT (l->data);
- nautilus_window_slot_add_current_location_to_history_list (slot);
- }
- }
}
g_object_unref (app);
}
-GList *
-nautilus_get_history_list (void)
-{
- return history_list;
-}
-
NautilusWindowType
nautilus_window_get_window_type (NautilusWindow *window)
{