summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-20000414157
-rw-r--r--components/html/ntl-web-browser.c7
-rw-r--r--idl/nautilus.idl11
-rw-r--r--libnautilus-extensions/nautilus-bookmark.c18
-rw-r--r--libnautilus-extensions/nautilus-bookmark.h2
-rw-r--r--libnautilus-private/nautilus-bookmark.c18
-rw-r--r--libnautilus-private/nautilus-bookmark.h2
-rw-r--r--libnautilus/nautilus-bookmark.c18
-rw-r--r--libnautilus/nautilus-bookmark.h2
-rw-r--r--libnautilus/nautilus-content-view-frame.c24
-rw-r--r--libnautilus/nautilus-content-view-frame.h3
-rw-r--r--libnautilus/nautilus-view-frame-private.h36
-rw-r--r--libnautilus/nautilus-view-frame.c42
-rw-r--r--libnautilus/nautilus-view-frame.h11
-rw-r--r--libnautilus/nautilus-view.c42
-rw-r--r--libnautilus/nautilus-view.h11
-rw-r--r--libnautilus/ntl-content-view-frame.c24
-rw-r--r--libnautilus/ntl-content-view-frame.h3
-rw-r--r--libnautilus/ntl-view-frame.c42
-rw-r--r--libnautilus/ntl-view-frame.h11
-rw-r--r--src/nautilus-bookmark-list.c21
-rw-r--r--src/nautilus-bookmarks-window.c14
-rw-r--r--src/nautilus-index-title.c67
-rw-r--r--src/nautilus-index-title.h5
-rw-r--r--src/nautilus-information-panel.c20
-rw-r--r--src/nautilus-information-panel.h5
-rw-r--r--src/nautilus-navigation-window-menus.c12
-rw-r--r--src/nautilus-navigation-window.c56
-rw-r--r--src/nautilus-navigation-window.h6
-rw-r--r--src/nautilus-object-window.c56
-rw-r--r--src/nautilus-object-window.h6
-rw-r--r--src/nautilus-sidebar-title.c67
-rw-r--r--src/nautilus-sidebar-title.h5
-rw-r--r--src/nautilus-sidebar.c20
-rw-r--r--src/nautilus-sidebar.h5
-rw-r--r--src/nautilus-spatial-window.c56
-rw-r--r--src/nautilus-spatial-window.h6
-rw-r--r--src/nautilus-view-frame-bonobo-control.c7
-rw-r--r--src/nautilus-view-frame-bonobo-embeddable.c7
-rw-r--r--src/nautilus-view-frame-corba.c7
-rw-r--r--src/nautilus-view-frame-nautilus-view.c20
-rw-r--r--src/nautilus-view-frame-private.h15
-rw-r--r--src/nautilus-view-frame.c22
-rw-r--r--src/nautilus-view-frame.h5
-rw-r--r--src/nautilus-window-manage-views.c231
-rw-r--r--src/nautilus-window-manage-views.h4
-rw-r--r--src/nautilus-window-menus.c12
-rw-r--r--src/nautilus-window-private.h7
-rw-r--r--src/nautilus-window.c56
-rw-r--r--src/nautilus-window.h6
-rw-r--r--src/ntl-content-view.c43
-rw-r--r--src/ntl-content-view.h20
-rw-r--r--src/ntl-index-panel.c20
-rw-r--r--src/ntl-index-panel.h5
-rw-r--r--src/ntl-view-bonobo-control.c7
-rw-r--r--src/ntl-view-bonobo-subdoc.c7
-rw-r--r--src/ntl-view-frame-svr.c7
-rw-r--r--src/ntl-view-nautilus.c20
-rw-r--r--src/ntl-view-private.h15
-rw-r--r--src/ntl-view.c22
-rw-r--r--src/ntl-view.h5
-rw-r--r--src/ntl-window-msgs.c231
-rw-r--r--src/ntl-window-msgs.h4
-rw-r--r--src/ntl-window-private.h7
-rw-r--r--src/ntl-window.c56
-rw-r--r--src/ntl-window.h6
66 files changed, 1402 insertions, 383 deletions
diff --git a/ChangeLog-20000414 b/ChangeLog-20000414
index 38252a705..88b225e16 100644
--- a/ChangeLog-20000414
+++ b/ChangeLog-20000414
@@ -1,3 +1,160 @@
+2000-03-27 John Sullivan <sullivan@eazel.com>
+
+ Made web page titles be used for the window title,
+ the index panel location name, and the menu item in
+ the Go menu (which is then used for the Bookmarks menu
+ too). This required lots of underpinnings work. Now any
+ content view (not just the web browser) can express its
+ opinion on what title for the current location should be
+ displayed to the user.
+
+ * idl/nautilus.idl: added View:notify_title_change; added
+ initial_title parameter to View:notify_location_change;
+ reordered functions in View to better group related items;
+ added ContentViewFrame:request_title_change.
+
+ * libnautilus/nautilus-view-frame-private.h: New file,
+ holds a struct and a function shared by NautilusViewFrame
+ and (now) NautilusContentViewFrame.
+
+ * libnautilus/ntl-view-frame.h: Reordered functions to
+ match idl (just for clarity); also added (notify_title_change).
+ * libnautilus/ntl-view-frame.c: Moved _NautilusViewFramePrivate
+ struct to new private .h file, added (notify_title_change);
+ reordered function pointers in epv to match idl.
+ (nautilus_view_frame_class_init): Set up signal for
+ notify_title_change.
+ (nautilus_view_frame_ensure_view_frame): No longer static since
+ it's in new private .h file.
+
+ * libnautilus/ntl-content-view-frame.h,
+ * libnautilus/ntl-content-view-frame.c:
+ (nautilus_content_view_frame_request_title_change):
+ New function that a content view calls on its frame
+ when it has an opinion about what the user-displayable
+ title for the current location should be.
+
+ * libnautilus/nautilus-bookmark.c,
+ * libnautilus/nautilus-bookmark.h:
+ (nautilus_bookmark_set_name): New function to change the name of
+ an existing bookmark.
+
+ * src/ntl-view-private.h: Moved definition of impl_POA_Nautilus_ViewFrame
+ here so it can be shared by NautilusContentView; reordered functions in
+ _NautilusViewComponentType to match idl and included notify_title_change.
+ * src/ntl-view-frame-svr.c: Moved definition of impl_POA_Nautilus_ViewFrame
+ out of here.
+ * src/ntl-view.h,
+ * src/ntl-view.c:
+ (nautilus_view_notify_location_change): Added initial_title parameter.
+ (nautilus_view_notify_title_change): New function.
+ * src/ntl-view-nautilus.c:
+ (nv_notify_location_change): Added initial_title parameter.
+ (nv_notify_title_change): New function.
+ nautilus_view_component_type: reordered function pointers to
+ match idl, and added new one for notify_title_change.
+ * src/ntl-view-bonobo-control.c:
+ (bonobo_control_notify_location_change): Added initial_title parameter.
+ bonobo_control_component_type: reordered function pointers to match idl
+ and added notify_title_change.
+ * src/ntl-view-bonobo-subdoc.c
+ (bonobo_subdoc_notify_location_change): Added initial_title parameter.
+ bonobo_subdoc_component_type: reordered function pointers to match idl
+ and added notify_title_change.
+
+ * src/nautilus-bookmark-list.c:
+ (destroy_bookmark): Removed this function.
+ (nautilus_bookmark_list_delete_item_at): unref where it was destroying.
+ (nautilus_list_load_file): use gtk_object_unref as foreach function
+ instead of destroy_bookmark.
+
+ * src/nautilus-index-title.h,
+ * src/nautilus-index-title.c:
+ new field _NautilusIndexTitleDetails->requested_text.
+ (nautilus_index_title_set_uri): Added initial_text parameter;
+ store initial_text in requested_text field after freeing old value.
+ (nautilus_index_panel_set_text): New function, passes new text to
+ nautilus_index_title_set_up_label.
+ (nautilus_index_title_finalize): free requested_text.
+ (nautilus_index_title_set_up_label):
+ Use requested_text instead of extracting short name of URI here.
+ * src/ntl-index-panel.h,
+ * src/ntl-index-panel.c:
+ (nautilus_index_panel_set_uri): Added initial_title parameter.
+ (nautilus_index_panel_set_title): New function, called if the title
+ changes later on; pass new_title on to nautilus_index_title_set_text.
+ (nautilus_index_panel_set_up_info): Added initial_title parameter;
+ pass initial_title on to nautilus_index_title_set_uri.
+
+ * src/ntl-content-view.h: Redid object & class struct definitions
+ to match others; added request_title_change signal definition.
+ * src/ntl-content-view.c:
+ added function pointer for request_title_change to epv;
+ added signal-definining enum & array;
+ (impl_Nautilus_ContentViewFrame_request_title_change): New function.
+ (nautilus_content_view_class_init): Define "request_title_change" signal.
+ (nautilus_content_view_request_title_change): New function, emits signal.
+
+ * src/ntl-window.h: New fields for requested_title, default_title,
+ current_location_bookmark, last_location_bookmark.
+ * src/ntl-window.c:
+ (nautilus_send_history_list_changed): New convenience routine to
+ emit "history_list_changed" signal since it's emitted in more than
+ one place now.
+ (nautilus_add_to_history_list): Change parameter from a const char *
+ to a NautilusBookmark; call nautilus_send_history_list_changed.
+ (nautilus_window_request_title_change_callback): New function, calls
+ nautilus_window_request_title_change.
+ (nautilus_window_connect_view): Just variable renaming & reformatting.
+ (nautilus_window_connect_content_view): New function, calls
+ nautilus_window_connect_view then connects to "request_title_change: signal
+ also.
+ * src/ntl-window-private.h:
+ (nautilus_window_connect_content_view): New prototype.
+ (nautilus_send_history_list): New prototype.
+ (nautilus_add_to_history_list): Change parameter from const char *
+ to NautilusBookmark *
+ * src/ntl-window-msgs.h:
+ (nautilus_window_request_title_change): prototype for new function.
+ * src/ntl-window-msgs.c:
+ (nautilus_window_refresh_title): Removed.
+ (compute_default_title), (nautilus_window_get_current_location_title),
+ (nautilus_window_update_title_internal),
+ (nautilus_window_reset_title_internal),
+ (nautilus_window_request_title_change): New functions having to do with
+ passing around the title-change request. Note that there's an unresolved
+ problem where calling nautilus_view_notify_title_change here doesn't work
+ properly for metaviews. There's a comment in the code and I'll write up
+ a bug report also. There are currently no metaviews that care.
+ (nautilus_window_update_internals): Use window->last_location_bookmark
+ instead of creating a new bookmark for back/forward lists (this means the
+ back/forward menus will respect any title change requests); remove one
+ of the two identical calls to nautilus_index_panel_set_uri; modify the
+ other one to pass current location title.
+ (nautilus_window_update_view): Pass current title to
+ nautilus_view_notify_location_change.
+ (nautilus_window_load_content_view):
+ Call nautilus_window_connect_content_view instead of
+ nautilus_window_connect_view.
+ (nautilus_window_update_state): Call nautilus_window_reset_title_internal
+ at two spots where the location is changing.
+ * src/nautilus-window-menus.c:
+ (nautilus_window_add_bookmark_for_current_location): Use
+ window->current_location_bookmark instead of creating a new one
+ to take advantage of any requested title changes.
+
+ * components/html/ntl-web-browser.c:
+ (browser_title_changed): New function, calls
+ nautilus_content_view_frame_request_title_change.
+ (make_obj): Connect browser_title_changed to "title_changed" signal
+ of gtkhtml widget.
+
+ Fixed bug 353 (Removing all bookmark items from window can lead to crash)
+
+ * src/nautilus-bookmarks-window.c: (on_remove_button_clicked):
+ If we removed the last item, explicitly call repopulate since
+ no callback handles that case.
+
2000-03-27 Andy Hertzfeld <andy@eazel.com>
* libnautilus/nautilus-icon-canvas-item.c:
diff --git a/components/html/ntl-web-browser.c b/components/html/ntl-web-browser.c
index 529e4a4e3..8ea557a61 100644
--- a/components/html/ntl-web-browser.c
+++ b/components/html/ntl-web-browser.c
@@ -519,6 +519,12 @@ browser_select_url(GtkWidget *htmlw, const char *url, BrowserInfo *bi)
}
static void
+browser_title_changed(GtkWidget *htmlw, const char *new_title, BrowserInfo *bi)
+{
+ nautilus_content_view_frame_request_title_change (NAUTILUS_CONTENT_VIEW_FRAME (bi->view_frame), new_title);
+}
+
+static void
browser_submit(GtkWidget *htmlw, const char *method, const char *url, const char *encoding, BrowserInfo *bi)
{
g_free(bi->post_data); bi->post_data = NULL;
@@ -587,6 +593,7 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, void *closure)
gtk_signal_connect(GTK_OBJECT(bi->htmlw), "url_requested", browser_url_requested, bi);
gtk_signal_connect(GTK_OBJECT(bi->htmlw), "on_url", browser_select_url, bi);
gtk_signal_connect(GTK_OBJECT(bi->htmlw), "submit", browser_submit, bi);
+ gtk_signal_connect(GTK_OBJECT(bi->htmlw), "title_changed", browser_title_changed, bi);
wtmp = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
diff --git a/idl/nautilus.idl b/idl/nautilus.idl
index e94241fa7..263d66783 100644
--- a/idl/nautilus.idl
+++ b/idl/nautilus.idl
@@ -42,13 +42,13 @@ module Nautilus {
interface View : ::Bonobo::Unknown {
void save_state (in string config_path);
void load_state (in string config_path);
- oneway void notify_location_change (in NavigationInfo navinfo);
-
- oneway void show_properties (); // Requests that the client show its properties
-
+ oneway void notify_location_change (in NavigationInfo navinfo,
+ in string initial_title);
+ oneway void stop_location_change ();
oneway void notify_selection_change (in SelectionInfo selinfo);
+ oneway void notify_title_change (in string new_title);
- oneway void stop_location_change ();
+ oneway void show_properties (); // Requests that the client show its properties
};
interface MetaView : View {
@@ -71,6 +71,7 @@ module Nautilus {
};
interface ContentViewFrame : ViewFrame {
+ oneway void request_title_change (in string new_title);
};
// typedef sequence<double> ZoomLevelList;
diff --git a/libnautilus-extensions/nautilus-bookmark.c b/libnautilus-extensions/nautilus-bookmark.c
index 5998eca85..35082f10c 100644
--- a/libnautilus-extensions/nautilus-bookmark.c
+++ b/libnautilus-extensions/nautilus-bookmark.c
@@ -178,6 +178,24 @@ nautilus_bookmark_get_uri (const NautilusBookmark *bookmark)
return bookmark->details->uri;
}
+
+/**
+ * nautilus_bookmark_set_name:
+ *
+ * Change the user-displayed name of a bookmark.
+ * @new_name: The new user-displayed name for this bookmark, mustn't be NULL.
+ *
+ **/
+void
+nautilus_bookmark_set_name (NautilusBookmark *bookmark, const char *new_name)
+{
+ g_return_if_fail(NAUTILUS_IS_BOOKMARK (bookmark));
+ g_return_if_fail (new_name != NULL);
+
+ g_free (bookmark->details->name);
+ bookmark->details->name = g_strdup (new_name);
+}
+
/**
* nautilus_bookmark_new_with_name:
*
diff --git a/libnautilus-extensions/nautilus-bookmark.h b/libnautilus-extensions/nautilus-bookmark.h
index 95ee35f1e..2c73f0ada 100644
--- a/libnautilus-extensions/nautilus-bookmark.h
+++ b/libnautilus-extensions/nautilus-bookmark.h
@@ -63,6 +63,8 @@ NautilusBookmark *nautilus_bookmark_new (const char
NautilusBookmark *nautilus_bookmark_copy (const NautilusBookmark *bookmark);
const char * nautilus_bookmark_get_name (const NautilusBookmark *bookmark);
const char * nautilus_bookmark_get_uri (const NautilusBookmark *bookmark);
+void nautilus_bookmark_set_name (NautilusBookmark *bookmark,
+ const char *new_name);
int nautilus_bookmark_compare_with (gconstpointer a,
gconstpointer b);
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c
index 5998eca85..35082f10c 100644
--- a/libnautilus-private/nautilus-bookmark.c
+++ b/libnautilus-private/nautilus-bookmark.c
@@ -178,6 +178,24 @@ nautilus_bookmark_get_uri (const NautilusBookmark *bookmark)
return bookmark->details->uri;
}
+
+/**
+ * nautilus_bookmark_set_name:
+ *
+ * Change the user-displayed name of a bookmark.
+ * @new_name: The new user-displayed name for this bookmark, mustn't be NULL.
+ *
+ **/
+void
+nautilus_bookmark_set_name (NautilusBookmark *bookmark, const char *new_name)
+{
+ g_return_if_fail(NAUTILUS_IS_BOOKMARK (bookmark));
+ g_return_if_fail (new_name != NULL);
+
+ g_free (bookmark->details->name);
+ bookmark->details->name = g_strdup (new_name);
+}
+
/**
* nautilus_bookmark_new_with_name:
*
diff --git a/libnautilus-private/nautilus-bookmark.h b/libnautilus-private/nautilus-bookmark.h
index 95ee35f1e..2c73f0ada 100644
--- a/libnautilus-private/nautilus-bookmark.h
+++ b/libnautilus-private/nautilus-bookmark.h
@@ -63,6 +63,8 @@ NautilusBookmark *nautilus_bookmark_new (const char
NautilusBookmark *nautilus_bookmark_copy (const NautilusBookmark *bookmark);
const char * nautilus_bookmark_get_name (const NautilusBookmark *bookmark);
const char * nautilus_bookmark_get_uri (const NautilusBookmark *bookmark);
+void nautilus_bookmark_set_name (NautilusBookmark *bookmark,
+ const char *new_name);
int nautilus_bookmark_compare_with (gconstpointer a,
gconstpointer b);
diff --git a/libnautilus/nautilus-bookmark.c b/libnautilus/nautilus-bookmark.c
index 5998eca85..35082f10c 100644
--- a/libnautilus/nautilus-bookmark.c
+++ b/libnautilus/nautilus-bookmark.c
@@ -178,6 +178,24 @@ nautilus_bookmark_get_uri (const NautilusBookmark *bookmark)
return bookmark->details->uri;
}
+
+/**
+ * nautilus_bookmark_set_name:
+ *
+ * Change the user-displayed name of a bookmark.
+ * @new_name: The new user-displayed name for this bookmark, mustn't be NULL.
+ *
+ **/
+void
+nautilus_bookmark_set_name (NautilusBookmark *bookmark, const char *new_name)
+{
+ g_return_if_fail(NAUTILUS_IS_BOOKMARK (bookmark));
+ g_return_if_fail (new_name != NULL);
+
+ g_free (bookmark->details->name);
+ bookmark->details->name = g_strdup (new_name);
+}
+
/**
* nautilus_bookmark_new_with_name:
*
diff --git a/libnautilus/nautilus-bookmark.h b/libnautilus/nautilus-bookmark.h
index 95ee35f1e..2c73f0ada 100644
--- a/libnautilus/nautilus-bookmark.h
+++ b/libnautilus/nautilus-bookmark.h
@@ -63,6 +63,8 @@ NautilusBookmark *nautilus_bookmark_new (const char
NautilusBookmark *nautilus_bookmark_copy (const NautilusBookmark *bookmark);
const char * nautilus_bookmark_get_name (const NautilusBookmark *bookmark);
const char * nautilus_bookmark_get_uri (const NautilusBookmark *bookmark);
+void nautilus_bookmark_set_name (NautilusBookmark *bookmark,
+ const char *new_name);
int nautilus_bookmark_compare_with (gconstpointer a,
gconstpointer b);
diff --git a/libnautilus/nautilus-content-view-frame.c b/libnautilus/nautilus-content-view-frame.c
index e0f7b4a4e..edcaaf206 100644
--- a/libnautilus/nautilus-content-view-frame.c
+++ b/libnautilus/nautilus-content-view-frame.c
@@ -29,6 +29,7 @@
#include <config.h>
#include "ntl-content-view-frame.h"
+#include "nautilus-view-frame-private.h"
#include <bonobo/bonobo-control.h>
typedef struct {
@@ -130,3 +131,26 @@ nautilus_content_view_frame_class_init (NautilusContentViewFrameClass *klass)
view_class->servant_destroy_func = POA_Nautilus_ContentView__fini;
view_class->vepv = &impl_Nautilus_ContentView_vepv;
}
+
+void
+nautilus_content_view_frame_request_title_change (NautilusContentViewFrame *view,
+ const char *new_title)
+{
+ CORBA_Environment ev;
+
+ g_return_if_fail (NAUTILUS_IS_CONTENT_VIEW_FRAME (view));
+ g_return_if_fail (new_title != NULL);
+
+ CORBA_exception_init(&ev);
+
+ if (nautilus_view_frame_ensure_view_frame (NAUTILUS_VIEW_FRAME (view))) {
+ Nautilus_ContentViewFrame_request_title_change (NAUTILUS_VIEW_FRAME (view)->private->view_frame, new_title, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ {
+ CORBA_Object_release(NAUTILUS_VIEW_FRAME (view)->private->view_frame, &ev);
+ NAUTILUS_VIEW_FRAME (view)->private->view_frame = CORBA_OBJECT_NIL;
+ }
+ }
+
+ CORBA_exception_free(&ev);
+}
diff --git a/libnautilus/nautilus-content-view-frame.h b/libnautilus/nautilus-content-view-frame.h
index c94fc2e89..a945a1a60 100644
--- a/libnautilus/nautilus-content-view-frame.h
+++ b/libnautilus/nautilus-content-view-frame.h
@@ -53,4 +53,7 @@ GtkType nautilus_content_view_frame_get_type (
NautilusContentViewFrame *nautilus_content_view_frame_new (GtkWidget *widget);
NautilusContentViewFrame *nautilus_content_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control);
+void nautilus_content_view_frame_request_title_change (NautilusContentViewFrame *view,
+ const char *new_title);
+
#endif
diff --git a/libnautilus/nautilus-view-frame-private.h b/libnautilus/nautilus-view-frame-private.h
new file mode 100644
index 000000000..4ddbce9cc
--- /dev/null
+++ b/libnautilus/nautilus-view-frame-private.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
+
+/*
+ * libnautilus: A library for nautilus view implementations.
+ *
+ * Copyright (C) 2000 Eazel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: John Sullivan <sullivan@eazel.com>
+ *
+ */
+
+#ifndef NTL_VIEW_FRAME_PRIVATE_H
+#define NTL_VIEW_FRAME_PRIVATE_H
+
+struct _NautilusViewFramePrivate {
+ BonoboObject *control;
+ Nautilus_ViewFrame view_frame;
+};
+
+gboolean nautilus_view_frame_ensure_view_frame (NautilusViewFrame *view);
+
+#endif
diff --git a/libnautilus/nautilus-view-frame.c b/libnautilus/nautilus-view-frame.c
index ff7c1f74a..c26a37e9a 100644
--- a/libnautilus/nautilus-view-frame.c
+++ b/libnautilus/nautilus-view-frame.c
@@ -29,18 +29,15 @@
#include <config.h>
#include "ntl-view-frame.h"
+#include "nautilus-view-frame-private.h"
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-control.h>
-struct _NautilusViewFramePrivate {
- BonoboObject *control;
- Nautilus_ViewFrame view_frame;
-};
-
enum {
NOTIFY_LOCATION_CHANGE,
+ NOTIFY_TITLE_CHANGE,
NOTIFY_SELECTION_CHANGE,
LOAD_STATE,
SAVE_STATE,
@@ -83,8 +80,8 @@ impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev);
static void
-impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
+impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
+ CORBA_Environment * ev);
static void
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
@@ -92,8 +89,13 @@ impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev);
static void
-impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
+impl_Nautilus_View_notify_title_change(impl_POA_Nautilus_View * servant,
+ const char * new_title,
+ CORBA_Environment * ev);
+
+static void
+impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
+ CORBA_Environment * ev);
POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
{
@@ -101,9 +103,10 @@ POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
(gpointer) & impl_Nautilus_View_save_state,
(gpointer) & impl_Nautilus_View_load_state,
(gpointer) & impl_Nautilus_View_notify_location_change,
- (gpointer) & impl_Nautilus_View_show_properties,
+ (gpointer) & impl_Nautilus_View_stop_location_change,
(gpointer) & impl_Nautilus_View_notify_selection_change,
- (gpointer) & impl_Nautilus_View_stop_location_change
+ (gpointer) & impl_Nautilus_View_notify_title_change,
+ (gpointer) & impl_Nautilus_View_show_properties
};
static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
@@ -155,6 +158,14 @@ impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
}
static void
+impl_Nautilus_View_notify_title_change(impl_POA_Nautilus_View * servant,
+ const char * new_title,
+ CORBA_Environment * ev)
+{
+ gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[NOTIFY_TITLE_CHANGE], new_title);
+}
+
+static void
impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev)
{
@@ -271,6 +282,13 @@ nautilus_view_frame_class_init (NautilusViewFrameClass *klass)
GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_selection_change),
gtk_marshal_NONE__BOXED,
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
+ nautilus_view_frame_signals[NOTIFY_TITLE_CHANGE] =
+ gtk_signal_new("notify_title_change",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_title_change),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
nautilus_view_frame_signals[LOAD_STATE] =
gtk_signal_new("load_state",
GTK_RUN_LAST,
@@ -382,7 +400,7 @@ nautilus_view_frame_destroy (NautilusViewFrame *view)
((GtkObjectClass *)klass->parent_class)->destroy((GtkObject *)view);
}
-static gboolean
+gboolean
nautilus_view_frame_ensure_view_frame (NautilusViewFrame *view)
{
CORBA_Environment ev;
diff --git a/libnautilus/nautilus-view-frame.h b/libnautilus/nautilus-view-frame.h
index 107c025a7..8e91690a2 100644
--- a/libnautilus/nautilus-view-frame.h
+++ b/libnautilus/nautilus-view-frame.h
@@ -51,14 +51,17 @@ struct _NautilusViewFrameClass
{
BonoboObjectClass parent_spot;
+ void (*save_state) (NautilusViewFrame *view, const char *config_path);
+ void (*load_state) (NautilusViewFrame *view, const char *config_path);
void (*notify_location_change) (NautilusViewFrame *view,
- Nautilus_NavigationInfo *nav_context);
+ Nautilus_NavigationInfo *nav_context,
+ const char *initial_title);
+ void (*stop_location_change) (NautilusViewFrame *view);
void (*notify_selection_change) (NautilusViewFrame *view,
Nautilus_SelectionInfo *nav_context);
- void (*load_state) (NautilusViewFrame *view, const char *config_path);
- void (*save_state) (NautilusViewFrame *view, const char *config_path);
+ void (*notify_title_change) (NautilusViewFrame *view,
+ const char *new_title);
void (*show_properties) (NautilusViewFrame *view);
- void (*stop_location_change) (NautilusViewFrame *view);
BonoboObjectClass *parent_class;
diff --git a/libnautilus/nautilus-view.c b/libnautilus/nautilus-view.c
index ff7c1f74a..c26a37e9a 100644
--- a/libnautilus/nautilus-view.c
+++ b/libnautilus/nautilus-view.c
@@ -29,18 +29,15 @@
#include <config.h>
#include "ntl-view-frame.h"
+#include "nautilus-view-frame-private.h"
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-control.h>
-struct _NautilusViewFramePrivate {
- BonoboObject *control;
- Nautilus_ViewFrame view_frame;
-};
-
enum {
NOTIFY_LOCATION_CHANGE,
+ NOTIFY_TITLE_CHANGE,
NOTIFY_SELECTION_CHANGE,
LOAD_STATE,
SAVE_STATE,
@@ -83,8 +80,8 @@ impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev);
static void
-impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
+impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
+ CORBA_Environment * ev);
static void
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
@@ -92,8 +89,13 @@ impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev);
static void
-impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
+impl_Nautilus_View_notify_title_change(impl_POA_Nautilus_View * servant,
+ const char * new_title,
+ CORBA_Environment * ev);
+
+static void
+impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
+ CORBA_Environment * ev);
POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
{
@@ -101,9 +103,10 @@ POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
(gpointer) & impl_Nautilus_View_save_state,
(gpointer) & impl_Nautilus_View_load_state,
(gpointer) & impl_Nautilus_View_notify_location_change,
- (gpointer) & impl_Nautilus_View_show_properties,
+ (gpointer) & impl_Nautilus_View_stop_location_change,
(gpointer) & impl_Nautilus_View_notify_selection_change,
- (gpointer) & impl_Nautilus_View_stop_location_change
+ (gpointer) & impl_Nautilus_View_notify_title_change,
+ (gpointer) & impl_Nautilus_View_show_properties
};
static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
@@ -155,6 +158,14 @@ impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
}
static void
+impl_Nautilus_View_notify_title_change(impl_POA_Nautilus_View * servant,
+ const char * new_title,
+ CORBA_Environment * ev)
+{
+ gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[NOTIFY_TITLE_CHANGE], new_title);
+}
+
+static void
impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev)
{
@@ -271,6 +282,13 @@ nautilus_view_frame_class_init (NautilusViewFrameClass *klass)
GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_selection_change),
gtk_marshal_NONE__BOXED,
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
+ nautilus_view_frame_signals[NOTIFY_TITLE_CHANGE] =
+ gtk_signal_new("notify_title_change",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_title_change),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
nautilus_view_frame_signals[LOAD_STATE] =
gtk_signal_new("load_state",
GTK_RUN_LAST,
@@ -382,7 +400,7 @@ nautilus_view_frame_destroy (NautilusViewFrame *view)
((GtkObjectClass *)klass->parent_class)->destroy((GtkObject *)view);
}
-static gboolean
+gboolean
nautilus_view_frame_ensure_view_frame (NautilusViewFrame *view)
{
CORBA_Environment ev;
diff --git a/libnautilus/nautilus-view.h b/libnautilus/nautilus-view.h
index 107c025a7..8e91690a2 100644
--- a/libnautilus/nautilus-view.h
+++ b/libnautilus/nautilus-view.h
@@ -51,14 +51,17 @@ struct _NautilusViewFrameClass
{
BonoboObjectClass parent_spot;
+ void (*save_state) (NautilusViewFrame *view, const char *config_path);
+ void (*load_state) (NautilusViewFrame *view, const char *config_path);
void (*notify_location_change) (NautilusViewFrame *view,
- Nautilus_NavigationInfo *nav_context);
+ Nautilus_NavigationInfo *nav_context,
+ const char *initial_title);
+ void (*stop_location_change) (NautilusViewFrame *view);
void (*notify_selection_change) (NautilusViewFrame *view,
Nautilus_SelectionInfo *nav_context);
- void (*load_state) (NautilusViewFrame *view, const char *config_path);
- void (*save_state) (NautilusViewFrame *view, const char *config_path);
+ void (*notify_title_change) (NautilusViewFrame *view,
+ const char *new_title);
void (*show_properties) (NautilusViewFrame *view);
- void (*stop_location_change) (NautilusViewFrame *view);
BonoboObjectClass *parent_class;
diff --git a/libnautilus/ntl-content-view-frame.c b/libnautilus/ntl-content-view-frame.c
index e0f7b4a4e..edcaaf206 100644
--- a/libnautilus/ntl-content-view-frame.c
+++ b/libnautilus/ntl-content-view-frame.c
@@ -29,6 +29,7 @@
#include <config.h>
#include "ntl-content-view-frame.h"
+#include "nautilus-view-frame-private.h"
#include <bonobo/bonobo-control.h>
typedef struct {
@@ -130,3 +131,26 @@ nautilus_content_view_frame_class_init (NautilusContentViewFrameClass *klass)
view_class->servant_destroy_func = POA_Nautilus_ContentView__fini;
view_class->vepv = &impl_Nautilus_ContentView_vepv;
}
+
+void
+nautilus_content_view_frame_request_title_change (NautilusContentViewFrame *view,
+ const char *new_title)
+{
+ CORBA_Environment ev;
+
+ g_return_if_fail (NAUTILUS_IS_CONTENT_VIEW_FRAME (view));
+ g_return_if_fail (new_title != NULL);
+
+ CORBA_exception_init(&ev);
+
+ if (nautilus_view_frame_ensure_view_frame (NAUTILUS_VIEW_FRAME (view))) {
+ Nautilus_ContentViewFrame_request_title_change (NAUTILUS_VIEW_FRAME (view)->private->view_frame, new_title, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ {
+ CORBA_Object_release(NAUTILUS_VIEW_FRAME (view)->private->view_frame, &ev);
+ NAUTILUS_VIEW_FRAME (view)->private->view_frame = CORBA_OBJECT_NIL;
+ }
+ }
+
+ CORBA_exception_free(&ev);
+}
diff --git a/libnautilus/ntl-content-view-frame.h b/libnautilus/ntl-content-view-frame.h
index c94fc2e89..a945a1a60 100644
--- a/libnautilus/ntl-content-view-frame.h
+++ b/libnautilus/ntl-content-view-frame.h
@@ -53,4 +53,7 @@ GtkType nautilus_content_view_frame_get_type (
NautilusContentViewFrame *nautilus_content_view_frame_new (GtkWidget *widget);
NautilusContentViewFrame *nautilus_content_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control);
+void nautilus_content_view_frame_request_title_change (NautilusContentViewFrame *view,
+ const char *new_title);
+
#endif
diff --git a/libnautilus/ntl-view-frame.c b/libnautilus/ntl-view-frame.c
index ff7c1f74a..c26a37e9a 100644
--- a/libnautilus/ntl-view-frame.c
+++ b/libnautilus/ntl-view-frame.c
@@ -29,18 +29,15 @@
#include <config.h>
#include "ntl-view-frame.h"
+#include "nautilus-view-frame-private.h"
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-control.h>
-struct _NautilusViewFramePrivate {
- BonoboObject *control;
- Nautilus_ViewFrame view_frame;
-};
-
enum {
NOTIFY_LOCATION_CHANGE,
+ NOTIFY_TITLE_CHANGE,
NOTIFY_SELECTION_CHANGE,
LOAD_STATE,
SAVE_STATE,
@@ -83,8 +80,8 @@ impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev);
static void
-impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
+impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
+ CORBA_Environment * ev);
static void
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
@@ -92,8 +89,13 @@ impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev);
static void
-impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
+impl_Nautilus_View_notify_title_change(impl_POA_Nautilus_View * servant,
+ const char * new_title,
+ CORBA_Environment * ev);
+
+static void
+impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
+ CORBA_Environment * ev);
POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
{
@@ -101,9 +103,10 @@ POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
(gpointer) & impl_Nautilus_View_save_state,
(gpointer) & impl_Nautilus_View_load_state,
(gpointer) & impl_Nautilus_View_notify_location_change,
- (gpointer) & impl_Nautilus_View_show_properties,
+ (gpointer) & impl_Nautilus_View_stop_location_change,
(gpointer) & impl_Nautilus_View_notify_selection_change,
- (gpointer) & impl_Nautilus_View_stop_location_change
+ (gpointer) & impl_Nautilus_View_notify_title_change,
+ (gpointer) & impl_Nautilus_View_show_properties
};
static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
@@ -155,6 +158,14 @@ impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
}
static void
+impl_Nautilus_View_notify_title_change(impl_POA_Nautilus_View * servant,
+ const char * new_title,
+ CORBA_Environment * ev)
+{
+ gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[NOTIFY_TITLE_CHANGE], new_title);
+}
+
+static void
impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
CORBA_Environment * ev)
{
@@ -271,6 +282,13 @@ nautilus_view_frame_class_init (NautilusViewFrameClass *klass)
GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_selection_change),
gtk_marshal_NONE__BOXED,
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
+ nautilus_view_frame_signals[NOTIFY_TITLE_CHANGE] =
+ gtk_signal_new("notify_title_change",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_title_change),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
nautilus_view_frame_signals[LOAD_STATE] =
gtk_signal_new("load_state",
GTK_RUN_LAST,
@@ -382,7 +400,7 @@ nautilus_view_frame_destroy (NautilusViewFrame *view)
((GtkObjectClass *)klass->parent_class)->destroy((GtkObject *)view);
}
-static gboolean
+gboolean
nautilus_view_frame_ensure_view_frame (NautilusViewFrame *view)
{
CORBA_Environment ev;
diff --git a/libnautilus/ntl-view-frame.h b/libnautilus/ntl-view-frame.h
index 107c025a7..8e91690a2 100644
--- a/libnautilus/ntl-view-frame.h
+++ b/libnautilus/ntl-view-frame.h
@@ -51,14 +51,17 @@ struct _NautilusViewFrameClass
{
BonoboObjectClass parent_spot;
+ void (*save_state) (NautilusViewFrame *view, const char *config_path);
+ void (*load_state) (NautilusViewFrame *view, const char *config_path);
void (*notify_location_change) (NautilusViewFrame *view,
- Nautilus_NavigationInfo *nav_context);
+ Nautilus_NavigationInfo *nav_context,
+ const char *initial_title);
+ void (*stop_location_change) (NautilusViewFrame *view);
void (*notify_selection_change) (NautilusViewFrame *view,
Nautilus_SelectionInfo *nav_context);
- void (*load_state) (NautilusViewFrame *view, const char *config_path);
- void (*save_state) (NautilusViewFrame *view, const char *config_path);
+ void (*notify_title_change) (NautilusViewFrame *view,
+ const char *new_title);
void (*show_properties) (NautilusViewFrame *view);
- void (*stop_location_change) (NautilusViewFrame *view);
BonoboObjectClass *parent_class;
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c
index f96988dc1..7b9e649ba 100644
--- a/src/nautilus-bookmark-list.c
+++ b/src/nautilus-bookmark-list.c
@@ -45,8 +45,6 @@ enum {
/* forward declarations */
static void append_bookmark_node (gpointer list_element,
gpointer user_data);
-static void destroy_bookmark (gpointer list_element,
- gpointer user_data);
static const char *nautilus_bookmark_list_get_file_path (NautilusBookmarkList *bookmarks);
static void nautilus_bookmark_list_load_file (NautilusBookmarkList *bookmarks);
static void nautilus_bookmark_list_save_file (NautilusBookmarkList *bookmarks);
@@ -111,21 +109,6 @@ append_bookmark_node (gpointer data, gpointer user_data)
}
/**
- * destroy_bookmark:
- *
- * Foreach function; destroy a bookmark that was the data of a GList node.
- * @data: a NautilusBookmark * that is the data of a GList node.
- * @user_data: ignored.
- **/
-static void
-destroy_bookmark (gpointer data, gpointer user_data)
-{
- g_assert (NAUTILUS_IS_BOOKMARK (data));
-
- gtk_object_destroy (GTK_OBJECT (data));
-}
-
-/**
* nautilus_bookmark_list_append:
*
* Append a bookmark to a bookmark list.
@@ -202,7 +185,7 @@ nautilus_bookmark_list_delete_item_at (NautilusBookmarkList *bookmarks,
bookmarks->list = g_list_remove_link (bookmarks->list, doomed);
g_assert (NAUTILUS_IS_BOOKMARK (doomed->data));
- gtk_object_destroy (GTK_OBJECT (doomed->data));
+ gtk_object_unref (GTK_OBJECT (doomed->data));
g_list_free (doomed);
@@ -309,7 +292,7 @@ nautilus_bookmark_list_load_file (NautilusBookmarkList *bookmarks)
xmlNodePtr node;
/* Wipe out old list. */
- g_list_foreach (bookmarks->list, destroy_bookmark, NULL);
+ g_list_foreach (bookmarks->list, (GFunc)gtk_object_unref, NULL);
g_list_free (bookmarks->list);
bookmarks->list = NULL;
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index 5a0b7c18d..8cd675170 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -415,6 +415,16 @@ on_remove_button_clicked (GtkButton *button,
bookmark_list_changed_signalID);
gtk_clist_remove(GTK_CLIST(bookmark_list_widget), get_selected_row());
+
+ /*
+ * If removing the selected row selected the next row, then we'll
+ * get a callback. But if the list is now empty, we won't get a
+ * callback, which will leave the Remove button and text fields
+ * in the wrong state unless we fix them explicitly here.
+ */
+ if (nautilus_bookmark_list_length (bookmarks) == 0) {
+ repopulate ();
+ }
}
@@ -439,7 +449,7 @@ on_row_move (GtkCList *clist,
gtk_signal_handler_unblock(GTK_OBJECT(bookmarks),
bookmark_list_changed_signalID);
- gtk_object_destroy(GTK_OBJECT(bookmark));
+ gtk_object_unref(GTK_OBJECT(bookmark));
}
static void
@@ -489,7 +499,7 @@ on_text_field_focus_out_event (GtkWidget *widget,
gtk_signal_handler_unblock (GTK_OBJECT (bookmarks),
bookmark_list_changed_signalID);
- gtk_object_destroy (GTK_OBJECT (bookmark));
+ gtk_object_unref (GTK_OBJECT (bookmark));
}
return FALSE;
diff --git a/src/nautilus-index-title.c b/src/nautilus-index-title.c
index d66d4c571..016a30f15 100644
--- a/src/nautilus-index-title.c
+++ b/src/nautilus-index-title.c
@@ -57,6 +57,7 @@ static void nautilus_index_title_set_up_info (NautilusIndexTitle
struct _NautilusIndexTitleDetails {
char *uri;
+ char *requested_text;
GtkWidget *icon;
GtkWidget *title;
GtkWidget *more_info;
@@ -105,6 +106,7 @@ nautilus_index_title_finalize (GtkObject *object)
NautilusIndexTitle *index_title = NAUTILUS_INDEX_TITLE (object);
g_free (index_title->details->uri);
+ g_free (index_title->details->requested_text);
g_free (index_title->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object));
@@ -245,56 +247,52 @@ set_up_font(GtkWidget *widget, GdkFont *font)
void
nautilus_index_title_set_up_label (NautilusIndexTitle *index_title)
{
- GnomeVFSURI *vfs_uri;
GdkFont *label_font;
- char *file_name;
+ char *displayed_text;
- vfs_uri = gnome_vfs_uri_new (index_title->details->uri);
- if (vfs_uri == NULL)
- return;
-
- file_name = gnome_vfs_uri_extract_short_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
-
- if (file_name == NULL)
- return;
+ if (index_title->details->requested_text == NULL) {
+ /* Use empty string to replace previous contents. */
+ displayed_text = g_strdup ("");
+ } else {
+ displayed_text = g_strdup (index_title->details->requested_text);
+ }
/* split the filename into two lines if necessary */
- if (strlen(file_name) >= 16) {
+ if (strlen(displayed_text) >= 16) {
/* find an appropriate split point if we can */
gint index;
- gint mid_point = strlen(file_name) >> 1;
+ gint mid_point = strlen(displayed_text) >> 1;
gint quarter_point = mid_point >> 1;
for (index = 0; index < quarter_point; index++) {
gint split_offset = 0;
- if (!isalnum(file_name[mid_point + index]))
+ if (!isalnum(displayed_text[mid_point + index]))
split_offset = mid_point + index;
- else if (!isalnum(file_name[mid_point - index]))
+ else if (!isalnum(displayed_text[mid_point - index]))
split_offset = mid_point - index;
if (split_offset != 0) {
- char *buffer = (char *) g_malloc(strlen(file_name) + 2);
+ char *buffer = (char *) g_malloc(strlen(displayed_text) + 2);
/* build the new string, with a CR inserted, also remembering them separately for measuring */
- memcpy(buffer, file_name, split_offset);
+ memcpy(buffer, displayed_text, split_offset);
buffer[split_offset] = '\n';
- strcpy(&buffer[split_offset + 1], &file_name[split_offset]);
+ strcpy(&buffer[split_offset + 1], &displayed_text[split_offset]);
/* free up the old string and replace it with the new one with the return inserted */
- g_free(file_name);
- file_name = buffer;
+ g_free(displayed_text);
+ displayed_text = buffer;
}
}
}
if (index_title->details->title != NULL)
- gtk_label_set_text (GTK_LABEL (index_title->details->title), file_name);
+ gtk_label_set_text (GTK_LABEL (index_title->details->title), displayed_text);
else {
- index_title->details->title = GTK_WIDGET (gtk_label_new (file_name));
+ index_title->details->title = GTK_WIDGET (gtk_label_new (displayed_text));
gtk_label_set_line_wrap (GTK_LABEL (index_title->details->title), TRUE);
gtk_label_set_justify(GTK_LABEL(index_title->details->title), GTK_JUSTIFY_CENTER);
gtk_widget_show (index_title->details->title);
@@ -303,11 +301,11 @@ nautilus_index_title_set_up_label (NautilusIndexTitle *index_title)
}
/* FIXME: don't use hardwired font like this - get it from preferences */
- label_font = select_font(file_name, GTK_WIDGET (index_title)->allocation.width - 4,
+ label_font = select_font(displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
"-bitstream-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*");
set_up_font(index_title->details->title, label_font);
- g_free (file_name);
+ g_free (displayed_text);
}
/* set up more info about the file */
@@ -392,15 +390,28 @@ nautilus_index_title_set_up_info (NautilusIndexTitle *index_title)
/* here's the place where we set everything up passed on the passed in uri */
void
-nautilus_index_title_set_uri(NautilusIndexTitle *index_title, const char* new_uri)
+nautilus_index_title_set_text (NautilusIndexTitle *index_title, const char* new_text)
+{
+ g_free (index_title->details->requested_text);
+ index_title->details->requested_text = g_strdup (new_text);
+
+ /* Recompute the displayed text. */
+ nautilus_index_title_set_up_label (index_title);
+}
+
+void
+nautilus_index_title_set_uri(NautilusIndexTitle *index_title,
+ const char* new_uri,
+ const char* initial_text)
{
NautilusFile *file_object;
- if (index_title->details->uri != NULL) {
- g_free (index_title->details->uri);
- }
+ g_free (index_title->details->uri);
index_title->details->uri = g_strdup (new_uri);
+ g_free (index_title->details->requested_text);
+ index_title->details->requested_text = g_strdup (initial_text);
+
file_object = nautilus_file_get(new_uri);
/* add the icon */
diff --git a/src/nautilus-index-title.h b/src/nautilus-index-title.h
index 64a351263..4e6e3e680 100644
--- a/src/nautilus-index-title.h
+++ b/src/nautilus-index-title.h
@@ -55,7 +55,10 @@ struct _NautilusIndexTitleClass
GtkType nautilus_index_title_get_type (void);
GtkWidget* nautilus_index_title_new (void);
void nautilus_index_title_set_uri (NautilusIndexTitle *index_title,
- const char *new_uri);
+ const char *new_uri,
+ const char *initial_text);
+void nautilus_index_title_set_text (NautilusIndexTitle *index_title,
+ const char *new_title);
#endif /* NAUTILUS_INDEX_TITLE_H */
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index a39e0245c..91d4ced5e 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -72,7 +72,7 @@ static void nautilus_index_panel_drag_data_received (GtkWidget *widget, GdkDragC
GtkSelectionData *selection_data,
guint info, guint time);
-static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri);
+static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri, const char *initial_title);
static void nautilus_index_panel_set_up_buttons (NautilusIndexPanel *index_panel, const char* new_uri);
static void add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list);
@@ -560,7 +560,9 @@ nautilus_index_panel_set_up_buttons (NautilusIndexPanel *index_panel, const char
/* this routine populates the index panel with the per-uri information */
void
-nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri)
+nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel,
+ const char* new_uri,
+ const char* initial_title)
{
NautilusDirectory *directory;
NautilusBackground *background;
@@ -588,7 +590,7 @@ nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* n
g_free (background_color);
/* tell the title widget about it */
- nautilus_index_title_set_uri(NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_uri);
+ nautilus_index_title_set_uri(NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_uri, initial_title);
/* add keywords if we got any */
@@ -599,7 +601,9 @@ nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* n
/* here is the key routine that populates the index panel with the appropriate information when the uri changes */
void
-nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel, const char* new_uri)
+nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel,
+ const char* new_uri,
+ const char* initial_title)
{
/* there's nothing to do if the uri is the same as the current one */
@@ -610,5 +614,11 @@ nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel, const char* new_u
index_panel->details->uri = g_strdup (new_uri);
/* populate the per-uri box with the info */
- nautilus_index_panel_set_up_info (index_panel, new_uri);
+ nautilus_index_panel_set_up_info (index_panel, new_uri, initial_title);
+}
+
+void
+nautilus_index_panel_set_title (NautilusIndexPanel *index_panel, const char* new_title)
+{
+ nautilus_index_title_set_text (NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_title);
}
diff --git a/src/nautilus-information-panel.h b/src/nautilus-information-panel.h
index 24c2a4373..b648ccb27 100644
--- a/src/nautilus-information-panel.h
+++ b/src/nautilus-information-panel.h
@@ -63,6 +63,9 @@ void nautilus_index_panel_add_meta_view (NautilusIndexPanel *p
void nautilus_index_panel_remove_meta_view (NautilusIndexPanel *panel,
NautilusView *meta_view);
void nautilus_index_panel_set_uri (NautilusIndexPanel *panel,
- const gchar *new_uri);
+ const char *new_uri,
+ const char *initial_title);
+void nautilus_index_panel_set_title (NautilusIndexPanel *panel,
+ const char *new_title);
#endif /* NTL_INDEX_PANEL_H */
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index 692e9954c..9a75ab5ed 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -487,12 +487,20 @@ nautilus_window_add_bookmark_for_current_location (NautilusWindow *window)
g_return_if_fail(NAUTILUS_IS_WINDOW (window));
- bookmark = nautilus_bookmark_new (nautilus_window_get_requested_uri(window));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->current_location_bookmark),
+ nautilus_window_get_requested_uri(window)) == 0);
+
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ bookmark = window->current_location_bookmark;
if (!nautilus_bookmark_list_contains (get_bookmark_list (), bookmark)) {
+ /*
+ * Only append bookmark if there's not already a copy of this one in there.
+ * Maybe it would be better to remove the other one and always append?
+ * This won't be a sensible rule if we have hierarchical menus.
+ */
nautilus_bookmark_list_append (get_bookmark_list (), bookmark);
}
- gtk_object_destroy(GTK_OBJECT(bookmark));
}
void
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 6d9c64d66..dcc93dc3b 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -793,18 +793,22 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
}
void
-nautilus_add_to_history_list (const char *uri)
+nautilus_send_history_list_changed ()
+{
+ gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
+ "history_list_changed");
+}
+
+void
+nautilus_add_to_history_list (NautilusBookmark *bookmark)
{
/* Note that the history is shared amongst all windows so
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
- NautilusBookmark *bookmark;
GSList *found_link;
- g_return_if_fail (nautilus_strlen(uri) > 0);
-
- bookmark = nautilus_bookmark_new (uri);
+ g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
found_link = g_slist_find_custom (history_list,
bookmark,
@@ -818,13 +822,13 @@ nautilus_add_to_history_list (const char *uri)
}
/* New item goes first. */
+ gtk_object_ref (GTK_OBJECT (bookmark));
history_list = g_slist_prepend(history_list, bookmark);
/* Tell world that history list has changed. At least all the
* NautilusWindows (not just this one) are listening.
*/
- gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
- "history_list_changed");
+ nautilus_send_history_list_changed ();
}
GSList *
@@ -867,35 +871,59 @@ nautilus_window_request_progress_change_cb (NautilusView *view,
nautilus_window_request_progress_change(window, info, view);
}
+static void
+nautilus_window_request_title_change_callback (NautilusContentView *view,
+ const char *new_title,
+ NautilusWindow *window)
+{
+ nautilus_window_request_title_change(window, new_title, view);
+}
+
void
nautilus_window_connect_view(NautilusWindow *window, NautilusView *view)
{
- GtkObject *viewo;
+ GtkObject *view_object;
- viewo = GTK_OBJECT(view);
- gtk_signal_connect(viewo,
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
"request_location_change",
nautilus_window_request_location_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_selection_change",
nautilus_window_request_selection_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_status_change",
nautilus_window_request_status_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_progress_change",
nautilus_window_request_progress_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"destroy",
nautilus_window_view_destroyed,
window);
}
void
+nautilus_window_connect_content_view(NautilusWindow *window, NautilusContentView *view)
+{
+ GtkObject *view_object;
+
+ /* First connect with NautilusView signals. */
+ nautilus_window_connect_view (window, NAUTILUS_VIEW (view));
+
+ /* Now connect with NautilusContentView signals. */
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
+ "request_title_change",
+ nautilus_window_request_title_change_callback,
+ window);
+}
+
+void
nautilus_window_display_error(NautilusWindow *window, const char *error_msg)
{
GtkWidget *dialog;
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index 629c1794d..af5e9926a 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -29,6 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
+#include <libnautilus/nautilus-bookmark.h>
#include "ntl-types.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
@@ -75,12 +76,17 @@ struct _NautilusWindow {
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
+ char *requested_title;
+ char *default_title;
/* Back/Forward chain, and history list.
* The data in these lists are NautilusBookmark pointers.
*/
GSList *back_list, *forward_list;
+ NautilusBookmark *current_location_bookmark;
+ NautilusBookmark *last_location_bookmark;
+
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index 6d9c64d66..dcc93dc3b 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -793,18 +793,22 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
}
void
-nautilus_add_to_history_list (const char *uri)
+nautilus_send_history_list_changed ()
+{
+ gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
+ "history_list_changed");
+}
+
+void
+nautilus_add_to_history_list (NautilusBookmark *bookmark)
{
/* Note that the history is shared amongst all windows so
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
- NautilusBookmark *bookmark;
GSList *found_link;
- g_return_if_fail (nautilus_strlen(uri) > 0);
-
- bookmark = nautilus_bookmark_new (uri);
+ g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
found_link = g_slist_find_custom (history_list,
bookmark,
@@ -818,13 +822,13 @@ nautilus_add_to_history_list (const char *uri)
}
/* New item goes first. */
+ gtk_object_ref (GTK_OBJECT (bookmark));
history_list = g_slist_prepend(history_list, bookmark);
/* Tell world that history list has changed. At least all the
* NautilusWindows (not just this one) are listening.
*/
- gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
- "history_list_changed");
+ nautilus_send_history_list_changed ();
}
GSList *
@@ -867,35 +871,59 @@ nautilus_window_request_progress_change_cb (NautilusView *view,
nautilus_window_request_progress_change(window, info, view);
}
+static void
+nautilus_window_request_title_change_callback (NautilusContentView *view,
+ const char *new_title,
+ NautilusWindow *window)
+{
+ nautilus_window_request_title_change(window, new_title, view);
+}
+
void
nautilus_window_connect_view(NautilusWindow *window, NautilusView *view)
{
- GtkObject *viewo;
+ GtkObject *view_object;
- viewo = GTK_OBJECT(view);
- gtk_signal_connect(viewo,
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
"request_location_change",
nautilus_window_request_location_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_selection_change",
nautilus_window_request_selection_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_status_change",
nautilus_window_request_status_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_progress_change",
nautilus_window_request_progress_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"destroy",
nautilus_window_view_destroyed,
window);
}
void
+nautilus_window_connect_content_view(NautilusWindow *window, NautilusContentView *view)
+{
+ GtkObject *view_object;
+
+ /* First connect with NautilusView signals. */
+ nautilus_window_connect_view (window, NAUTILUS_VIEW (view));
+
+ /* Now connect with NautilusContentView signals. */
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
+ "request_title_change",
+ nautilus_window_request_title_change_callback,
+ window);
+}
+
+void
nautilus_window_display_error(NautilusWindow *window, const char *error_msg)
{
GtkWidget *dialog;
diff --git a/src/nautilus-object-window.h b/src/nautilus-object-window.h
index 629c1794d..af5e9926a 100644
--- a/src/nautilus-object-window.h
+++ b/src/nautilus-object-window.h
@@ -29,6 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
+#include <libnautilus/nautilus-bookmark.h>
#include "ntl-types.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
@@ -75,12 +76,17 @@ struct _NautilusWindow {
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
+ char *requested_title;
+ char *default_title;
/* Back/Forward chain, and history list.
* The data in these lists are NautilusBookmark pointers.
*/
GSList *back_list, *forward_list;
+ NautilusBookmark *current_location_bookmark;
+ NautilusBookmark *last_location_bookmark;
+
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c
index d66d4c571..016a30f15 100644
--- a/src/nautilus-sidebar-title.c
+++ b/src/nautilus-sidebar-title.c
@@ -57,6 +57,7 @@ static void nautilus_index_title_set_up_info (NautilusIndexTitle
struct _NautilusIndexTitleDetails {
char *uri;
+ char *requested_text;
GtkWidget *icon;
GtkWidget *title;
GtkWidget *more_info;
@@ -105,6 +106,7 @@ nautilus_index_title_finalize (GtkObject *object)
NautilusIndexTitle *index_title = NAUTILUS_INDEX_TITLE (object);
g_free (index_title->details->uri);
+ g_free (index_title->details->requested_text);
g_free (index_title->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object));
@@ -245,56 +247,52 @@ set_up_font(GtkWidget *widget, GdkFont *font)
void
nautilus_index_title_set_up_label (NautilusIndexTitle *index_title)
{
- GnomeVFSURI *vfs_uri;
GdkFont *label_font;
- char *file_name;
+ char *displayed_text;
- vfs_uri = gnome_vfs_uri_new (index_title->details->uri);
- if (vfs_uri == NULL)
- return;
-
- file_name = gnome_vfs_uri_extract_short_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
-
- if (file_name == NULL)
- return;
+ if (index_title->details->requested_text == NULL) {
+ /* Use empty string to replace previous contents. */
+ displayed_text = g_strdup ("");
+ } else {
+ displayed_text = g_strdup (index_title->details->requested_text);
+ }
/* split the filename into two lines if necessary */
- if (strlen(file_name) >= 16) {
+ if (strlen(displayed_text) >= 16) {
/* find an appropriate split point if we can */
gint index;
- gint mid_point = strlen(file_name) >> 1;
+ gint mid_point = strlen(displayed_text) >> 1;
gint quarter_point = mid_point >> 1;
for (index = 0; index < quarter_point; index++) {
gint split_offset = 0;
- if (!isalnum(file_name[mid_point + index]))
+ if (!isalnum(displayed_text[mid_point + index]))
split_offset = mid_point + index;
- else if (!isalnum(file_name[mid_point - index]))
+ else if (!isalnum(displayed_text[mid_point - index]))
split_offset = mid_point - index;
if (split_offset != 0) {
- char *buffer = (char *) g_malloc(strlen(file_name) + 2);
+ char *buffer = (char *) g_malloc(strlen(displayed_text) + 2);
/* build the new string, with a CR inserted, also remembering them separately for measuring */
- memcpy(buffer, file_name, split_offset);
+ memcpy(buffer, displayed_text, split_offset);
buffer[split_offset] = '\n';
- strcpy(&buffer[split_offset + 1], &file_name[split_offset]);
+ strcpy(&buffer[split_offset + 1], &displayed_text[split_offset]);
/* free up the old string and replace it with the new one with the return inserted */
- g_free(file_name);
- file_name = buffer;
+ g_free(displayed_text);
+ displayed_text = buffer;
}
}
}
if (index_title->details->title != NULL)
- gtk_label_set_text (GTK_LABEL (index_title->details->title), file_name);
+ gtk_label_set_text (GTK_LABEL (index_title->details->title), displayed_text);
else {
- index_title->details->title = GTK_WIDGET (gtk_label_new (file_name));
+ index_title->details->title = GTK_WIDGET (gtk_label_new (displayed_text));
gtk_label_set_line_wrap (GTK_LABEL (index_title->details->title), TRUE);
gtk_label_set_justify(GTK_LABEL(index_title->details->title), GTK_JUSTIFY_CENTER);
gtk_widget_show (index_title->details->title);
@@ -303,11 +301,11 @@ nautilus_index_title_set_up_label (NautilusIndexTitle *index_title)
}
/* FIXME: don't use hardwired font like this - get it from preferences */
- label_font = select_font(file_name, GTK_WIDGET (index_title)->allocation.width - 4,
+ label_font = select_font(displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
"-bitstream-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*");
set_up_font(index_title->details->title, label_font);
- g_free (file_name);
+ g_free (displayed_text);
}
/* set up more info about the file */
@@ -392,15 +390,28 @@ nautilus_index_title_set_up_info (NautilusIndexTitle *index_title)
/* here's the place where we set everything up passed on the passed in uri */
void
-nautilus_index_title_set_uri(NautilusIndexTitle *index_title, const char* new_uri)
+nautilus_index_title_set_text (NautilusIndexTitle *index_title, const char* new_text)
+{
+ g_free (index_title->details->requested_text);
+ index_title->details->requested_text = g_strdup (new_text);
+
+ /* Recompute the displayed text. */
+ nautilus_index_title_set_up_label (index_title);
+}
+
+void
+nautilus_index_title_set_uri(NautilusIndexTitle *index_title,
+ const char* new_uri,
+ const char* initial_text)
{
NautilusFile *file_object;
- if (index_title->details->uri != NULL) {
- g_free (index_title->details->uri);
- }
+ g_free (index_title->details->uri);
index_title->details->uri = g_strdup (new_uri);
+ g_free (index_title->details->requested_text);
+ index_title->details->requested_text = g_strdup (initial_text);
+
file_object = nautilus_file_get(new_uri);
/* add the icon */
diff --git a/src/nautilus-sidebar-title.h b/src/nautilus-sidebar-title.h
index 64a351263..4e6e3e680 100644
--- a/src/nautilus-sidebar-title.h
+++ b/src/nautilus-sidebar-title.h
@@ -55,7 +55,10 @@ struct _NautilusIndexTitleClass
GtkType nautilus_index_title_get_type (void);
GtkWidget* nautilus_index_title_new (void);
void nautilus_index_title_set_uri (NautilusIndexTitle *index_title,
- const char *new_uri);
+ const char *new_uri,
+ const char *initial_text);
+void nautilus_index_title_set_text (NautilusIndexTitle *index_title,
+ const char *new_title);
#endif /* NAUTILUS_INDEX_TITLE_H */
diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c
index a39e0245c..91d4ced5e 100644
--- a/src/nautilus-sidebar.c
+++ b/src/nautilus-sidebar.c
@@ -72,7 +72,7 @@ static void nautilus_index_panel_drag_data_received (GtkWidget *widget, GdkDragC
GtkSelectionData *selection_data,
guint info, guint time);
-static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri);
+static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri, const char *initial_title);
static void nautilus_index_panel_set_up_buttons (NautilusIndexPanel *index_panel, const char* new_uri);
static void add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list);
@@ -560,7 +560,9 @@ nautilus_index_panel_set_up_buttons (NautilusIndexPanel *index_panel, const char
/* this routine populates the index panel with the per-uri information */
void
-nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri)
+nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel,
+ const char* new_uri,
+ const char* initial_title)
{
NautilusDirectory *directory;
NautilusBackground *background;
@@ -588,7 +590,7 @@ nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* n
g_free (background_color);
/* tell the title widget about it */
- nautilus_index_title_set_uri(NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_uri);
+ nautilus_index_title_set_uri(NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_uri, initial_title);
/* add keywords if we got any */
@@ -599,7 +601,9 @@ nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* n
/* here is the key routine that populates the index panel with the appropriate information when the uri changes */
void
-nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel, const char* new_uri)
+nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel,
+ const char* new_uri,
+ const char* initial_title)
{
/* there's nothing to do if the uri is the same as the current one */
@@ -610,5 +614,11 @@ nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel, const char* new_u
index_panel->details->uri = g_strdup (new_uri);
/* populate the per-uri box with the info */
- nautilus_index_panel_set_up_info (index_panel, new_uri);
+ nautilus_index_panel_set_up_info (index_panel, new_uri, initial_title);
+}
+
+void
+nautilus_index_panel_set_title (NautilusIndexPanel *index_panel, const char* new_title)
+{
+ nautilus_index_title_set_text (NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_title);
}
diff --git a/src/nautilus-sidebar.h b/src/nautilus-sidebar.h
index 24c2a4373..b648ccb27 100644
--- a/src/nautilus-sidebar.h
+++ b/src/nautilus-sidebar.h
@@ -63,6 +63,9 @@ void nautilus_index_panel_add_meta_view (NautilusIndexPanel *p
void nautilus_index_panel_remove_meta_view (NautilusIndexPanel *panel,
NautilusView *meta_view);
void nautilus_index_panel_set_uri (NautilusIndexPanel *panel,
- const gchar *new_uri);
+ const char *new_uri,
+ const char *initial_title);
+void nautilus_index_panel_set_title (NautilusIndexPanel *panel,
+ const char *new_title);
#endif /* NTL_INDEX_PANEL_H */
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 6d9c64d66..dcc93dc3b 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -793,18 +793,22 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
}
void
-nautilus_add_to_history_list (const char *uri)
+nautilus_send_history_list_changed ()
+{
+ gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
+ "history_list_changed");
+}
+
+void
+nautilus_add_to_history_list (NautilusBookmark *bookmark)
{
/* Note that the history is shared amongst all windows so
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
- NautilusBookmark *bookmark;
GSList *found_link;
- g_return_if_fail (nautilus_strlen(uri) > 0);
-
- bookmark = nautilus_bookmark_new (uri);
+ g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
found_link = g_slist_find_custom (history_list,
bookmark,
@@ -818,13 +822,13 @@ nautilus_add_to_history_list (const char *uri)
}
/* New item goes first. */
+ gtk_object_ref (GTK_OBJECT (bookmark));
history_list = g_slist_prepend(history_list, bookmark);
/* Tell world that history list has changed. At least all the
* NautilusWindows (not just this one) are listening.
*/
- gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
- "history_list_changed");
+ nautilus_send_history_list_changed ();
}
GSList *
@@ -867,35 +871,59 @@ nautilus_window_request_progress_change_cb (NautilusView *view,
nautilus_window_request_progress_change(window, info, view);
}
+static void
+nautilus_window_request_title_change_callback (NautilusContentView *view,
+ const char *new_title,
+ NautilusWindow *window)
+{
+ nautilus_window_request_title_change(window, new_title, view);
+}
+
void
nautilus_window_connect_view(NautilusWindow *window, NautilusView *view)
{
- GtkObject *viewo;
+ GtkObject *view_object;
- viewo = GTK_OBJECT(view);
- gtk_signal_connect(viewo,
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
"request_location_change",
nautilus_window_request_location_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_selection_change",
nautilus_window_request_selection_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_status_change",
nautilus_window_request_status_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_progress_change",
nautilus_window_request_progress_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"destroy",
nautilus_window_view_destroyed,
window);
}
void
+nautilus_window_connect_content_view(NautilusWindow *window, NautilusContentView *view)
+{
+ GtkObject *view_object;
+
+ /* First connect with NautilusView signals. */
+ nautilus_window_connect_view (window, NAUTILUS_VIEW (view));
+
+ /* Now connect with NautilusContentView signals. */
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
+ "request_title_change",
+ nautilus_window_request_title_change_callback,
+ window);
+}
+
+void
nautilus_window_display_error(NautilusWindow *window, const char *error_msg)
{
GtkWidget *dialog;
diff --git a/src/nautilus-spatial-window.h b/src/nautilus-spatial-window.h
index 629c1794d..af5e9926a 100644
--- a/src/nautilus-spatial-window.h
+++ b/src/nautilus-spatial-window.h
@@ -29,6 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
+#include <libnautilus/nautilus-bookmark.h>
#include "ntl-types.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
@@ -75,12 +76,17 @@ struct _NautilusWindow {
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
+ char *requested_title;
+ char *default_title;
/* Back/Forward chain, and history list.
* The data in these lists are NautilusBookmark pointers.
*/
GSList *back_list, *forward_list;
+ NautilusBookmark *current_location_bookmark;
+ NautilusBookmark *last_location_bookmark;
+
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
diff --git a/src/nautilus-view-frame-bonobo-control.c b/src/nautilus-view-frame-bonobo-control.c
index 8b0f57da8..b9f805a02 100644
--- a/src/nautilus-view-frame-bonobo-control.c
+++ b/src/nautilus-view-frame-bonobo-control.c
@@ -79,7 +79,7 @@ bonobo_control_get_label(NautilusView *view, CORBA_Environment *ev)
}
static void
-bonobo_control_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, CORBA_Environment *ev)
+bonobo_control_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, const char *initial_title, CORBA_Environment *ev)
{
Nautilus_ProgressRequestInfo pri;
pri.amount = 0;
@@ -93,11 +93,12 @@ NautilusViewComponentType bonobo_control_component_type = {
"IDL:Bonobo/Control:1.0",
&bonobo_control_try_load_client, /* try_load */
&destroy_bonobo_control_view, /* destroy */
- NULL, /* show_properties */
NULL, /* save_state */
NULL, /* load_state */
&bonobo_control_notify_location_change, /* notify_location_change */
- NULL, /* notify_selection_change */
NULL, /* stop_location_change */
+ NULL, /* notify_selection_change */
+ NULL, /* notify_title_change */
+ NULL, /* show_properties */
&bonobo_control_get_label /* get_label */
};
diff --git a/src/nautilus-view-frame-bonobo-embeddable.c b/src/nautilus-view-frame-bonobo-embeddable.c
index 8ecd4cf8f..b5b4a44d5 100644
--- a/src/nautilus-view-frame-bonobo-embeddable.c
+++ b/src/nautilus-view-frame-bonobo-embeddable.c
@@ -43,7 +43,7 @@ destroy_bonobo_subdoc_view(NautilusView *view, CORBA_Environment *ev)
}
static void
-bonobo_subdoc_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, CORBA_Environment *ev)
+bonobo_subdoc_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, const char *new_title, CORBA_Environment *ev)
{
Bonobo_PersistStream persist;
@@ -109,12 +109,13 @@ NautilusViewComponentType bonobo_subdoc_component_type = {
"IDL:Bonobo/Embeddable:1.0",
&bonobo_subdoc_try_load_client, /* try_load */
&destroy_bonobo_subdoc_view, /* destroy */
- NULL, /* show_properties */
NULL, /* save_state */
NULL, /* load_state */
&bonobo_subdoc_notify_location_change, /* notify_location_change */
- NULL, /* notify_selection_change */
NULL, /* stop_location_change */
+ NULL, /* notify_selection_change */
+ NULL, /* notify_title_change */
+ NULL, /* show_properties */
NULL, /* get_label */
};
diff --git a/src/nautilus-view-frame-corba.c b/src/nautilus-view-frame-corba.c
index 48792194a..cab50b069 100644
--- a/src/nautilus-view-frame-corba.c
+++ b/src/nautilus-view-frame-corba.c
@@ -29,13 +29,6 @@
#include "nautilus.h"
#include "ntl-view-private.h"
-typedef struct {
- POA_Nautilus_ViewFrame servant;
- gpointer bonobo_object;
-
- NautilusView *view;
-} impl_POA_Nautilus_ViewFrame;
-
static Nautilus_ViewWindow
impl_Nautilus_ViewFrame__get_main_window(impl_POA_Nautilus_ViewFrame *servant,
CORBA_Environment *ev);
diff --git a/src/nautilus-view-frame-nautilus-view.c b/src/nautilus-view-frame-nautilus-view.c
index d626534ae..ae8817b0e 100644
--- a/src/nautilus-view-frame-nautilus-view.c
+++ b/src/nautilus-view-frame-nautilus-view.c
@@ -109,11 +109,11 @@ nv_load_state(NautilusView *view, const char *config_path, CORBA_Environment *ev
}
static void
-nv_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, CORBA_Environment *ev)
+nv_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, const char *initial_title, CORBA_Environment *ev)
{
NautilusViewInfo *nvi = view->component_data;
- Nautilus_View_notify_location_change(nvi->view_client, nav_ctx, ev);
+ Nautilus_View_notify_location_change(nvi->view_client, nav_ctx, initial_title, ev);
if(ev->_major != CORBA_NO_EXCEPTION)
gtk_object_destroy(GTK_OBJECT(view));
}
@@ -129,6 +129,17 @@ nv_notify_selection_change(NautilusView *view, Nautilus_SelectionInfo *nav_ctx,
}
static void
+nv_notify_title_change(NautilusView *view, const char *new_title, CORBA_Environment *ev)
+{
+ NautilusViewInfo *nvi = view->component_data;
+
+ g_message ("called nv_notify_title_change");
+ Nautilus_View_notify_title_change(nvi->view_client, new_title, ev);
+ if(ev->_major != CORBA_NO_EXCEPTION)
+ gtk_object_destroy(GTK_OBJECT(view));
+}
+
+static void
nv_stop_location_change(NautilusView *view, CORBA_Environment *ev)
{
NautilusViewInfo *nvi = view->component_data;
@@ -172,11 +183,12 @@ NautilusViewComponentType nautilus_view_component_type = {
"IDL:Nautilus/View:1.0",
&nautilus_view_try_load_client, /* try_load */
&destroy_nautilus_view, /* destroy */
- &nv_show_properties, /* show_properties */
&nv_save_state, /* save_state */
&nv_load_state, /* load_state */
&nv_notify_location_change, /* notify_location_change */
+ &nv_stop_location_change, /*stop_location_change */
&nv_notify_selection_change, /* notify_selection_change */
- &nv_stop_location_change, /* stop_location_change */
+ &nv_notify_title_change, /* notify_title_change */
+ &nv_show_properties, /* show_properties */
&nv_get_label /* get_label */
};
diff --git a/src/nautilus-view-frame-private.h b/src/nautilus-view-frame-private.h
index f98a96cb3..79a4b01a8 100644
--- a/src/nautilus-view-frame-private.h
+++ b/src/nautilus-view-frame-private.h
@@ -29,6 +29,14 @@
#include "nautilus.h"
+typedef struct {
+ POA_Nautilus_ViewFrame servant;
+ gpointer bonobo_object;
+
+ NautilusView *view;
+} impl_POA_Nautilus_ViewFrame;
+
+
extern POA_Nautilus_ViewFrame__vepv impl_Nautilus_ViewFrame_vepv;
extern POA_Nautilus_ZoomableFrame__vepv impl_Nautilus_ZoomableFrame_vepv;
@@ -54,12 +62,13 @@ struct _NautilusViewComponentType {
const char *primary_repoid;
gboolean (* try_load)(NautilusView *view, CORBA_Object obj, CORBA_Environment *ev);
void (* destroy) (NautilusView *view, CORBA_Environment *ev);
- void (* show_properties)(NautilusView *view, CORBA_Environment *ev);
void (* save_state)(NautilusView *view, const char *config_path, CORBA_Environment *ev);
void (* load_state)(NautilusView *view, const char *config_path, CORBA_Environment *ev);
- void (* notify_location_change)(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, CORBA_Environment *ev);
- void (* notify_selection_change)(NautilusView *view, Nautilus_SelectionInfo *nav_ctx, CORBA_Environment *ev);
+ void (* notify_location_change)(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, const char *initial_title, CORBA_Environment *ev);
void (* stop_location_change)(NautilusView *view, CORBA_Environment *ev);
+ void (* notify_selection_change)(NautilusView *view, Nautilus_SelectionInfo *nav_ctx, CORBA_Environment *ev);
+ void (* notify_title_change)(NautilusView *view, const char *new_title, CORBA_Environment *ev);
+ void (* show_properties)(NautilusView *view, CORBA_Environment *ev);
char * (* get_label)(NautilusView *view, CORBA_Environment *ev);
};
diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c
index 1781fedcb..3cd392388 100644
--- a/src/nautilus-view-frame.c
+++ b/src/nautilus-view-frame.c
@@ -432,7 +432,8 @@ nautilus_view_load_client(NautilusView *view, const char *iid)
void
nautilus_view_notify_location_change(NautilusView *view,
- Nautilus_NavigationInfo *nav_context)
+ Nautilus_NavigationInfo *nav_context,
+ const char *initial_title)
{
Nautilus_NavigationInfo real_nav_ctx;
CORBA_Environment ev;
@@ -453,7 +454,7 @@ nautilus_view_notify_location_change(NautilusView *view,
CORBA_exception_init(&ev);
if(view->component_class->notify_location_change)
- view->component_class->notify_location_change(view, &real_nav_ctx, &ev);
+ view->component_class->notify_location_change(view, &real_nav_ctx, initial_title, &ev);
CORBA_exception_free(&ev);
}
@@ -476,6 +477,23 @@ nautilus_view_notify_selection_change(NautilusView *view,
}
void
+nautilus_view_notify_title_change(NautilusView *view,
+ const char *new_title)
+{
+ CORBA_Environment ev;
+
+ g_return_if_fail(NAUTILUS_IS_VIEW(view));
+ g_return_if_fail(view->component_class);
+
+ CORBA_exception_init(&ev);
+
+ if(view->component_class->notify_title_change)
+ view->component_class->notify_title_change(view, new_title, &ev);
+
+ CORBA_exception_free(&ev);
+}
+
+void
nautilus_view_load_state(NautilusView *view, const char *config_path)
{
CORBA_Environment ev;
diff --git a/src/nautilus-view-frame.h b/src/nautilus-view-frame.h
index e6c6d0d47..090955a01 100644
--- a/src/nautilus-view-frame.h
+++ b/src/nautilus-view-frame.h
@@ -113,9 +113,12 @@ CORBA_Object nautilus_view_get_objref (NautilusView *view);
/* These functions correspond to methods of the Nautilus:View CORBAinterface */
void nautilus_view_notify_location_change (NautilusView *view,
- Nautilus_NavigationInfo *nav_context);
+ Nautilus_NavigationInfo *nav_context,
+ const char *initial_title);
void nautilus_view_notify_selection_change (NautilusView *view,
Nautilus_SelectionInfo *sel_context);
+void nautilus_view_notify_title_change (NautilusView *view,
+ const char *new_title);
void nautilus_view_load_state (NautilusView *view,
const char *config_path);
void nautilus_view_save_state (NautilusView *view,
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 517d768b1..776d25255 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -45,7 +45,6 @@ static void nautilus_window_notify_selection_change(NautilusWindow *window,
NautilusView *view,
Nautilus_SelectionInfo *loc,
NautilusView *requesting_view);
-static void nautilus_window_refresh_title (NautilusWindow *window);
static void nautilus_window_load_content_view_menu (NautilusWindow *window, NautilusNavigationInfo *ni);
typedef enum { PROGRESS_INITIAL, PROGRESS_VIEWS, PROGRESS_DONE, PROGRESS_ERROR } ProgressType;
@@ -170,6 +169,146 @@ nautilus_window_request_progress_change(NautilusWindow *window,
nautilus_window_set_state_info(window, item, (NautilusWindowStateItem)0);
}
+static char *
+compute_default_title (const char *text_uri)
+{
+ GnomeVFSURI *vfs_uri;
+ char *short_name;
+
+ if (text_uri != NULL)
+ {
+ vfs_uri = gnome_vfs_uri_new (text_uri);
+ if (vfs_uri != NULL)
+ {
+ short_name = gnome_vfs_uri_extract_short_name (vfs_uri);
+ gnome_vfs_uri_unref (vfs_uri);
+
+ g_assert (short_name != NULL);
+ return short_name;
+ }
+ }
+
+ return g_strdup(_("Nautilus"));
+}
+
+/*
+ * nautilus_window_get_current_location_title:
+ *
+ * Get a newly allocated copy of the user-displayable title for the current
+ * location. Note that the window title is related to this but might not
+ * be exactly this.
+ * @window: The NautilusWindow in question.
+ *
+ * Return value: A newly allocated string. Use g_free when done with it.
+ */
+static char *
+nautilus_window_get_current_location_title (NautilusWindow *window)
+{
+ return window->requested_title != NULL ? g_strdup (window->requested_title) : g_strdup (window->default_title);
+
+}
+
+/*
+ * nautilus_window_update_title_internal:
+ *
+ * Update the non-NautilusView objects that use the location's user-displayable
+ * title in some way. Called when the location or title has changed.
+ * @window: The NautilusWindow in question.
+ * @title: The new user-displayable title.
+ *
+ */
+static void
+nautilus_window_update_title_internal (NautilusWindow *window, const char *title)
+{
+ char *window_title;
+
+ if (strcmp (title, _("Nautilus")) == 0)
+ {
+ gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
+ }
+ else
+ {
+ window_title = g_strdup_printf (_("Nautilus: %s"), title);
+ gtk_window_set_title (GTK_WINDOW (window), window_title);
+ g_free (window_title);
+ }
+
+ nautilus_index_panel_set_title (window->index_panel, title);
+ nautilus_bookmark_set_name (window->current_location_bookmark, title);
+ /* Name of item in history list may have changed, tell listeners. */
+ nautilus_send_history_list_changed ();
+}
+
+/*
+ * nautilus_window_reset_title_internal:
+ *
+ * Update the non-NautilusView objects that use the location's user-displayable
+ * title in some way. Called when the location or title has changed.
+ * @window: The NautilusWindow in question.
+ * @title: The new user-displayable title.
+ *
+ */
+static void
+nautilus_window_reset_title_internal (NautilusWindow *window, const char *uri)
+{
+ g_free (window->requested_title);
+ window->requested_title = NULL;
+ g_free (window->default_title);
+ window->default_title = compute_default_title (uri);
+
+ if (window->current_location_bookmark == NULL ||
+ strcmp (uri, nautilus_bookmark_get_uri (window->current_location_bookmark)) != 0)
+ {
+ /* We've changed locations, must recreate bookmark for current location. */
+ if (window->last_location_bookmark != NULL)
+ {
+ gtk_object_unref (GTK_OBJECT (window->last_location_bookmark));
+ }
+ window->last_location_bookmark = window->current_location_bookmark;
+ window->current_location_bookmark = nautilus_bookmark_new (uri);
+ }
+
+ nautilus_window_update_title_internal (window, window->default_title);
+}
+
+void
+nautilus_window_request_title_change(NautilusWindow *window,
+ const char *new_title,
+ NautilusContentView *requesting_view)
+{
+ GSList *cur;
+
+ g_return_if_fail (new_title != NULL);
+
+ g_free (window->requested_title);
+ window->requested_title = g_strdup (new_title);
+
+ /*
+ * Tell the requesting content view also, to keep the code parallel.
+ * Don't tell the view in window->content_view because it might be
+ * the old one that's about to be removed.
+ */
+ nautilus_view_notify_title_change (NAUTILUS_VIEW (requesting_view), new_title);
+
+ for(cur = window->meta_views; cur; cur = cur->next)
+ {
+#if 0
+ /*
+ * This should tell metaviews of the new title, but
+ * something about it isn't right. If the metaview connects
+ * to the notify_title_change signal, its callback doesn't
+ * get called. And ORBit warns for each metaview about some
+ * unhandled message of type 1 (REPLY). Right now no metaviews
+ * use this anyway, but we need to fix it.
+ */
+ nautilus_view_notify_title_change (NAUTILUS_VIEW (cur->data), new_title);
+#endif
+ }
+
+ /* Now change the stuff that doesn't use the NautilusView API */
+ nautilus_window_update_title_internal (window, new_title);
+}
+
/* The bulk of this file - location changing */
static void
@@ -190,6 +329,7 @@ static void
nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo *loci)
{
GnomeVFSURI *new_uri;
+ char *current_title;
if(loci) /* This is a location change */
{
@@ -197,9 +337,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
/* Maintain history lists. */
if (window->location_change_type != NAUTILUS_LOCATION_CHANGE_RELOAD)
- {
- nautilus_add_to_history_list (loci->navinfo.requested_uri);
-
+ {
+ /* Always add new location to history list. */
+ nautilus_add_to_history_list (window->current_location_bookmark);
+
if (window->location_change_type == NAUTILUS_LOCATION_CHANGE_BACK)
{
guint index;
@@ -210,8 +351,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
g_assert(window->ni);
/* Move current location to Forward list */
- window->forward_list = g_slist_prepend (window->forward_list,
- nautilus_bookmark_new (window->ni->requested_uri));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->last_location_bookmark), window->ni->requested_uri) == 0);
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ window->forward_list = g_slist_prepend (window->forward_list, window->last_location_bookmark);
+ gtk_object_ref (GTK_OBJECT (window->forward_list->data));
/* Move extra links from Back to Forward list */
for (index = 0; index < window->location_change_distance; ++index)
@@ -237,8 +380,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
g_assert(window->ni);
/* Move current location to Back list */
- window->back_list = g_slist_prepend (window->back_list,
- nautilus_bookmark_new (window->ni->requested_uri));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->last_location_bookmark), window->ni->requested_uri) == 0);
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ window->back_list = g_slist_prepend (window->back_list, window->last_location_bookmark);
+ gtk_object_ref (GTK_OBJECT (window->back_list->data));
/* Move extra links from Forward to Back list */
for (index = 0; index < window->location_change_distance; ++index)
@@ -267,8 +412,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
if (window->ni)
{
/* Store bookmark for current location in back list, unless there is no current location */
- window->back_list = g_slist_prepend(window->back_list,
- nautilus_bookmark_new (window->ni->requested_uri));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->last_location_bookmark), window->ni->requested_uri) == 0);
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ window->back_list = g_slist_prepend (window->back_list, window->last_location_bookmark);
+ gtk_object_ref (GTK_OBJECT (window->back_list->data));
}
}
}
@@ -296,21 +443,22 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
window->si = NULL;
nautilus_window_load_content_view_menu (window, loci);
-
- /* Notify the index panel of the location change. FIXME: Eventually,
- this will not be necessary when we restructure the index panel to
- be a NautilusView */
- nautilus_index_panel_set_uri(window->index_panel, loci->navinfo.requested_uri);
}
nautilus_window_allow_back(window, window->back_list != NULL);
nautilus_window_allow_forward(window, window->forward_list != NULL);
-
+
nautilus_location_bar_set_location(NAUTILUS_LOCATION_BAR(window->ent_uri),
window->ni->requested_uri);
- nautilus_index_panel_set_uri (NAUTILUS_INDEX_PANEL (window->index_panel), window->ni->requested_uri);
- nautilus_window_refresh_title (window);
+ /*
+ * Notify the index panel of the location change. FIXME: Eventually,
+ * this will not be necessary when we restructure the index panel to
+ * be a NautilusView.
+ */
+ current_title = nautilus_window_get_current_location_title (window);
+ nautilus_index_panel_set_uri (window->index_panel, window->ni->requested_uri, current_title);
+ g_free (current_title);
}
static void
@@ -322,13 +470,17 @@ nautilus_window_update_view(NautilusWindow *window,
NautilusView *content_view)
{
CORBA_Environment environment;
+ char *current_title;
g_return_if_fail(view);
loci->self_originated = (view == requesting_view);
-
- nautilus_view_notify_location_change(NAUTILUS_VIEW(view), loci);
-
+
+ current_title = nautilus_window_get_current_location_title (window);
+ g_assert (current_title != NULL);
+ nautilus_view_notify_location_change (view, loci, current_title);
+ g_free (current_title);
+
if(seli)
{
CORBA_exception_init(&environment);
@@ -349,37 +501,6 @@ nautilus_window_view_destroyed(NautilusView *view, NautilusWindow *window)
nautilus_window_set_state_info(window, item, view, (NautilusWindowStateItem)0);
}
-static void
-nautilus_window_refresh_title (NautilusWindow *window)
-{
- GnomeVFSURI *vfs_uri;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- vfs_uri = gnome_vfs_uri_new (nautilus_window_get_requested_uri (window));
- if (vfs_uri == NULL)
- {
- gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
- }
- else
- {
- gchar *short_name;
- gchar *new_title;
-
- short_name = gnome_vfs_uri_extract_short_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
-
- g_assert (short_name != NULL);
-
- new_title = g_strdup_printf (_("Nautilus: %s"), short_name);
- gtk_window_set_title (GTK_WINDOW (window), new_title);
- g_free (new_title);
-
- g_free (short_name);
- }
-
-}
-
/* This is called when we have decided we can actually change to the new view/location situation. */
static void
nautilus_window_has_really_changed(NautilusWindow *window)
@@ -538,7 +659,7 @@ nautilus_window_load_content_view(NautilusWindow *window,
new_view = NAUTILUS_VIEW(gtk_widget_new(nautilus_content_view_get_type(), "main_window", window, NULL));
- nautilus_window_connect_view(window, new_view);
+ nautilus_window_connect_content_view (window, NAUTILUS_CONTENT_VIEW (new_view));
if(!nautilus_view_load_client(new_view, iid))
{
@@ -670,6 +791,8 @@ nautilus_window_update_state(gpointer data)
if(window->pending_ni)
{
+ nautilus_window_reset_title_internal (window, window->ni->requested_uri);
+
/* Tell previously-notified views to go back to the old page */
for(cur = window->meta_views; cur; cur = cur->next)
{
@@ -742,6 +865,8 @@ nautilus_window_update_state(gpointer data)
si = window->si;
}
+ nautilus_window_reset_title_internal (window, ni->requested_uri);
+
#ifdef EXTREME_DEBUGGING
g_message("!!! Sending update_view");
#endif
diff --git a/src/nautilus-window-manage-views.h b/src/nautilus-window-manage-views.h
index c6add3885..276a88f47 100644
--- a/src/nautilus-window-manage-views.h
+++ b/src/nautilus-window-manage-views.h
@@ -28,6 +28,7 @@
#define NTL_WINDOW_MSGS_H 1
#include "ntl-window.h"
+#include "ntl-content-view.h"
void nautilus_window_request_location_change(NautilusWindow *window,
Nautilus_NavigationRequestInfo *loc,
@@ -41,5 +42,8 @@ void nautilus_window_request_status_change(NautilusWindow *window,
void nautilus_window_request_progress_change(NautilusWindow *window,
Nautilus_ProgressRequestInfo *loc,
NautilusView *requesting_view);
+void nautilus_window_request_title_change(NautilusWindow *window,
+ const char *new_title,
+ NautilusContentView *requesting_view);
#endif
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 692e9954c..9a75ab5ed 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -487,12 +487,20 @@ nautilus_window_add_bookmark_for_current_location (NautilusWindow *window)
g_return_if_fail(NAUTILUS_IS_WINDOW (window));
- bookmark = nautilus_bookmark_new (nautilus_window_get_requested_uri(window));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->current_location_bookmark),
+ nautilus_window_get_requested_uri(window)) == 0);
+
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ bookmark = window->current_location_bookmark;
if (!nautilus_bookmark_list_contains (get_bookmark_list (), bookmark)) {
+ /*
+ * Only append bookmark if there's not already a copy of this one in there.
+ * Maybe it would be better to remove the other one and always append?
+ * This won't be a sensible rule if we have hierarchical menus.
+ */
nautilus_bookmark_list_append (get_bookmark_list (), bookmark);
}
- gtk_object_destroy(GTK_OBJECT(bookmark));
}
void
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 363897113..63162b967 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -2,6 +2,7 @@
#define NTL_WINDOW_PRIVATE_H 1
#include "ntl-window.h"
+#include "ntl-content-view.h"
#include <libnautilus/libnautilus.h>
#include <gtk/gtk.h>
@@ -42,10 +43,14 @@ void nautilus_window_begin_location_change(NautilusWindow *window,
NautilusLocationChangeType type,
guint distance);
void nautilus_window_remove_meta_view_real(NautilusWindow *window, NautilusView *meta_view);
+void nautilus_window_connect_content_view (NautilusWindow *window,
+ NautilusContentView *view);
void nautilus_window_connect_view (NautilusWindow *window,
NautilusView *view);
void nautilus_window_view_destroyed(NautilusView *view, NautilusWindow *window);
-void nautilus_add_to_history_list (const char *uri);
+
+void nautilus_send_history_list_changed (void);
+void nautilus_add_to_history_list (NautilusBookmark *bookmark);
GSList *nautilus_get_history_list (void);
void nautilus_window_add_bookmark_for_current_location (NautilusWindow *window);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 6d9c64d66..dcc93dc3b 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -793,18 +793,22 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
}
void
-nautilus_add_to_history_list (const char *uri)
+nautilus_send_history_list_changed ()
+{
+ gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
+ "history_list_changed");
+}
+
+void
+nautilus_add_to_history_list (NautilusBookmark *bookmark)
{
/* Note that the history is shared amongst all windows so
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
- NautilusBookmark *bookmark;
GSList *found_link;
- g_return_if_fail (nautilus_strlen(uri) > 0);
-
- bookmark = nautilus_bookmark_new (uri);
+ g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
found_link = g_slist_find_custom (history_list,
bookmark,
@@ -818,13 +822,13 @@ nautilus_add_to_history_list (const char *uri)
}
/* New item goes first. */
+ gtk_object_ref (GTK_OBJECT (bookmark));
history_list = g_slist_prepend(history_list, bookmark);
/* Tell world that history list has changed. At least all the
* NautilusWindows (not just this one) are listening.
*/
- gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
- "history_list_changed");
+ nautilus_send_history_list_changed ();
}
GSList *
@@ -867,35 +871,59 @@ nautilus_window_request_progress_change_cb (NautilusView *view,
nautilus_window_request_progress_change(window, info, view);
}
+static void
+nautilus_window_request_title_change_callback (NautilusContentView *view,
+ const char *new_title,
+ NautilusWindow *window)
+{
+ nautilus_window_request_title_change(window, new_title, view);
+}
+
void
nautilus_window_connect_view(NautilusWindow *window, NautilusView *view)
{
- GtkObject *viewo;
+ GtkObject *view_object;
- viewo = GTK_OBJECT(view);
- gtk_signal_connect(viewo,
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
"request_location_change",
nautilus_window_request_location_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_selection_change",
nautilus_window_request_selection_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_status_change",
nautilus_window_request_status_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_progress_change",
nautilus_window_request_progress_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"destroy",
nautilus_window_view_destroyed,
window);
}
void
+nautilus_window_connect_content_view(NautilusWindow *window, NautilusContentView *view)
+{
+ GtkObject *view_object;
+
+ /* First connect with NautilusView signals. */
+ nautilus_window_connect_view (window, NAUTILUS_VIEW (view));
+
+ /* Now connect with NautilusContentView signals. */
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
+ "request_title_change",
+ nautilus_window_request_title_change_callback,
+ window);
+}
+
+void
nautilus_window_display_error(NautilusWindow *window, const char *error_msg)
{
GtkWidget *dialog;
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 629c1794d..af5e9926a 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -29,6 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
+#include <libnautilus/nautilus-bookmark.h>
#include "ntl-types.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
@@ -75,12 +76,17 @@ struct _NautilusWindow {
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
+ char *requested_title;
+ char *default_title;
/* Back/Forward chain, and history list.
* The data in these lists are NautilusBookmark pointers.
*/
GSList *back_list, *forward_list;
+ NautilusBookmark *current_location_bookmark;
+ NautilusBookmark *last_location_bookmark;
+
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
diff --git a/src/ntl-content-view.c b/src/ntl-content-view.c
index 7a1050561..a2dfff9bc 100644
--- a/src/ntl-content-view.c
+++ b/src/ntl-content-view.c
@@ -26,12 +26,19 @@
/* ntl-content-view.c: Implementation of the object representing a content view. */
#include "ntl-content-view.h"
+#include "ntl-view-private.h"
#include <gtk/gtksignal.h>
static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
+static void
+impl_Nautilus_ContentViewFrame_request_title_change (impl_POA_Nautilus_ViewFrame * servant,
+ const char * new_info,
+ CORBA_Environment * ev);
+
static POA_Nautilus_ContentViewFrame__epv impl_Nautilus_ContentViewFrame_epv = {
- NULL
+ NULL,
+ (void(*))&impl_Nautilus_ContentViewFrame_request_title_change,
};
extern POA_Nautilus_ViewFrame__epv impl_Nautilus_ViewFrame_epv;
@@ -44,8 +51,25 @@ static POA_Nautilus_ContentViewFrame__vepv impl_Nautilus_ContentViewFrame_vepv =
&impl_Nautilus_ContentViewFrame_epv
};
+enum {
+ REQUEST_TITLE_CHANGE,
+ LAST_SIGNAL
+};
+
static void nautilus_content_view_class_init (NautilusContentViewClass *klass);
static void nautilus_content_view_init (NautilusContentView *view);
+static void nautilus_content_view_request_title_change (NautilusContentView *view,
+ const char *new_title);
+
+static guint nautilus_content_view_signals[LAST_SIGNAL];
+
+static void
+impl_Nautilus_ContentViewFrame_request_title_change (impl_POA_Nautilus_ViewFrame * servant,
+ const char * new_info,
+ CORBA_Environment * ev)
+{
+ nautilus_content_view_request_title_change (NAUTILUS_CONTENT_VIEW (servant->view), new_info);
+}
GtkType
nautilus_content_view_get_type(void)
@@ -84,6 +108,16 @@ nautilus_content_view_class_init (NautilusContentViewClass *klass)
NAUTILUS_VIEW_CLASS(klass)->servant_init_func = POA_Nautilus_ContentViewFrame__init;
NAUTILUS_VIEW_CLASS(klass)->servant_destroy_func = POA_Nautilus_ContentViewFrame__fini;
NAUTILUS_VIEW_CLASS(klass)->vepv = &impl_Nautilus_ContentViewFrame_vepv;
+
+ nautilus_content_view_signals[REQUEST_TITLE_CHANGE] = gtk_signal_new ("request_title_change",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (NautilusContentViewClass,
+ request_title_change),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
+ gtk_object_class_add_signals (object_class, nautilus_content_view_signals, LAST_SIGNAL);
}
static void
@@ -98,3 +132,10 @@ nautilus_content_view_set_active (NautilusContentView *view)
(BONOBO_CONTROL_FRAME (bonobo_object_query_local_interface
(NAUTILUS_VIEW (view)->view_frame, "IDL:Bonobo/ControlFrame:1.0")));
}
+
+static void
+nautilus_content_view_request_title_change (NautilusContentView *view,
+ const char *new_title)
+{
+ gtk_signal_emit (GTK_OBJECT(view), nautilus_content_view_signals[REQUEST_TITLE_CHANGE], new_title);
+}
diff --git a/src/ntl-content-view.h b/src/ntl-content-view.h
index c52e7862b..f31360657 100644
--- a/src/ntl-content-view.h
+++ b/src/ntl-content-view.h
@@ -35,15 +35,27 @@
#define NAUTILUS_IS_CONTENT_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_CONTENT_VIEW))
#define NAUTILUS_IS_CONTENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_CONTENT_VIEW))
-typedef struct {
+typedef struct _NautilusContentView NautilusContentView;
+typedef struct _NautilusContentViewClass NautilusContentViewClass;
+
+struct _NautilusContentViewClass
+{
NautilusViewClass parent_spot;
+ /*
+ * These signals correspond to the Nautilus:ContentViewFrame CORBA interface.
+ * They are requests that the underlying view may make of the framework.
+ */
+
+ void (*request_title_change) (NautilusContentView *view,
+ const char *new_title);
+
NautilusViewClass *parent_class;
-} NautilusContentViewClass;
+};
-typedef struct {
+struct _NautilusContentView {
NautilusView parent_object;
-} NautilusContentView;
+};
GtkType nautilus_content_view_get_type (void);
diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c
index a39e0245c..91d4ced5e 100644
--- a/src/ntl-index-panel.c
+++ b/src/ntl-index-panel.c
@@ -72,7 +72,7 @@ static void nautilus_index_panel_drag_data_received (GtkWidget *widget, GdkDragC
GtkSelectionData *selection_data,
guint info, guint time);
-static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri);
+static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri, const char *initial_title);
static void nautilus_index_panel_set_up_buttons (NautilusIndexPanel *index_panel, const char* new_uri);
static void add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list);
@@ -560,7 +560,9 @@ nautilus_index_panel_set_up_buttons (NautilusIndexPanel *index_panel, const char
/* this routine populates the index panel with the per-uri information */
void
-nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* new_uri)
+nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel,
+ const char* new_uri,
+ const char* initial_title)
{
NautilusDirectory *directory;
NautilusBackground *background;
@@ -588,7 +590,7 @@ nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* n
g_free (background_color);
/* tell the title widget about it */
- nautilus_index_title_set_uri(NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_uri);
+ nautilus_index_title_set_uri(NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_uri, initial_title);
/* add keywords if we got any */
@@ -599,7 +601,9 @@ nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, const char* n
/* here is the key routine that populates the index panel with the appropriate information when the uri changes */
void
-nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel, const char* new_uri)
+nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel,
+ const char* new_uri,
+ const char* initial_title)
{
/* there's nothing to do if the uri is the same as the current one */
@@ -610,5 +614,11 @@ nautilus_index_panel_set_uri (NautilusIndexPanel *index_panel, const char* new_u
index_panel->details->uri = g_strdup (new_uri);
/* populate the per-uri box with the info */
- nautilus_index_panel_set_up_info (index_panel, new_uri);
+ nautilus_index_panel_set_up_info (index_panel, new_uri, initial_title);
+}
+
+void
+nautilus_index_panel_set_title (NautilusIndexPanel *index_panel, const char* new_title)
+{
+ nautilus_index_title_set_text (NAUTILUS_INDEX_TITLE(index_panel->details->index_title), new_title);
}
diff --git a/src/ntl-index-panel.h b/src/ntl-index-panel.h
index 24c2a4373..b648ccb27 100644
--- a/src/ntl-index-panel.h
+++ b/src/ntl-index-panel.h
@@ -63,6 +63,9 @@ void nautilus_index_panel_add_meta_view (NautilusIndexPanel *p
void nautilus_index_panel_remove_meta_view (NautilusIndexPanel *panel,
NautilusView *meta_view);
void nautilus_index_panel_set_uri (NautilusIndexPanel *panel,
- const gchar *new_uri);
+ const char *new_uri,
+ const char *initial_title);
+void nautilus_index_panel_set_title (NautilusIndexPanel *panel,
+ const char *new_title);
#endif /* NTL_INDEX_PANEL_H */
diff --git a/src/ntl-view-bonobo-control.c b/src/ntl-view-bonobo-control.c
index 8b0f57da8..b9f805a02 100644
--- a/src/ntl-view-bonobo-control.c
+++ b/src/ntl-view-bonobo-control.c
@@ -79,7 +79,7 @@ bonobo_control_get_label(NautilusView *view, CORBA_Environment *ev)
}
static void
-bonobo_control_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, CORBA_Environment *ev)
+bonobo_control_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, const char *initial_title, CORBA_Environment *ev)
{
Nautilus_ProgressRequestInfo pri;
pri.amount = 0;
@@ -93,11 +93,12 @@ NautilusViewComponentType bonobo_control_component_type = {
"IDL:Bonobo/Control:1.0",
&bonobo_control_try_load_client, /* try_load */
&destroy_bonobo_control_view, /* destroy */
- NULL, /* show_properties */
NULL, /* save_state */
NULL, /* load_state */
&bonobo_control_notify_location_change, /* notify_location_change */
- NULL, /* notify_selection_change */
NULL, /* stop_location_change */
+ NULL, /* notify_selection_change */
+ NULL, /* notify_title_change */
+ NULL, /* show_properties */
&bonobo_control_get_label /* get_label */
};
diff --git a/src/ntl-view-bonobo-subdoc.c b/src/ntl-view-bonobo-subdoc.c
index 8ecd4cf8f..b5b4a44d5 100644
--- a/src/ntl-view-bonobo-subdoc.c
+++ b/src/ntl-view-bonobo-subdoc.c
@@ -43,7 +43,7 @@ destroy_bonobo_subdoc_view(NautilusView *view, CORBA_Environment *ev)
}
static void
-bonobo_subdoc_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, CORBA_Environment *ev)
+bonobo_subdoc_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, const char *new_title, CORBA_Environment *ev)
{
Bonobo_PersistStream persist;
@@ -109,12 +109,13 @@ NautilusViewComponentType bonobo_subdoc_component_type = {
"IDL:Bonobo/Embeddable:1.0",
&bonobo_subdoc_try_load_client, /* try_load */
&destroy_bonobo_subdoc_view, /* destroy */
- NULL, /* show_properties */
NULL, /* save_state */
NULL, /* load_state */
&bonobo_subdoc_notify_location_change, /* notify_location_change */
- NULL, /* notify_selection_change */
NULL, /* stop_location_change */
+ NULL, /* notify_selection_change */
+ NULL, /* notify_title_change */
+ NULL, /* show_properties */
NULL, /* get_label */
};
diff --git a/src/ntl-view-frame-svr.c b/src/ntl-view-frame-svr.c
index 48792194a..cab50b069 100644
--- a/src/ntl-view-frame-svr.c
+++ b/src/ntl-view-frame-svr.c
@@ -29,13 +29,6 @@
#include "nautilus.h"
#include "ntl-view-private.h"
-typedef struct {
- POA_Nautilus_ViewFrame servant;
- gpointer bonobo_object;
-
- NautilusView *view;
-} impl_POA_Nautilus_ViewFrame;
-
static Nautilus_ViewWindow
impl_Nautilus_ViewFrame__get_main_window(impl_POA_Nautilus_ViewFrame *servant,
CORBA_Environment *ev);
diff --git a/src/ntl-view-nautilus.c b/src/ntl-view-nautilus.c
index d626534ae..ae8817b0e 100644
--- a/src/ntl-view-nautilus.c
+++ b/src/ntl-view-nautilus.c
@@ -109,11 +109,11 @@ nv_load_state(NautilusView *view, const char *config_path, CORBA_Environment *ev
}
static void
-nv_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, CORBA_Environment *ev)
+nv_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, const char *initial_title, CORBA_Environment *ev)
{
NautilusViewInfo *nvi = view->component_data;
- Nautilus_View_notify_location_change(nvi->view_client, nav_ctx, ev);
+ Nautilus_View_notify_location_change(nvi->view_client, nav_ctx, initial_title, ev);
if(ev->_major != CORBA_NO_EXCEPTION)
gtk_object_destroy(GTK_OBJECT(view));
}
@@ -129,6 +129,17 @@ nv_notify_selection_change(NautilusView *view, Nautilus_SelectionInfo *nav_ctx,
}
static void
+nv_notify_title_change(NautilusView *view, const char *new_title, CORBA_Environment *ev)
+{
+ NautilusViewInfo *nvi = view->component_data;
+
+ g_message ("called nv_notify_title_change");
+ Nautilus_View_notify_title_change(nvi->view_client, new_title, ev);
+ if(ev->_major != CORBA_NO_EXCEPTION)
+ gtk_object_destroy(GTK_OBJECT(view));
+}
+
+static void
nv_stop_location_change(NautilusView *view, CORBA_Environment *ev)
{
NautilusViewInfo *nvi = view->component_data;
@@ -172,11 +183,12 @@ NautilusViewComponentType nautilus_view_component_type = {
"IDL:Nautilus/View:1.0",
&nautilus_view_try_load_client, /* try_load */
&destroy_nautilus_view, /* destroy */
- &nv_show_properties, /* show_properties */
&nv_save_state, /* save_state */
&nv_load_state, /* load_state */
&nv_notify_location_change, /* notify_location_change */
+ &nv_stop_location_change, /*stop_location_change */
&nv_notify_selection_change, /* notify_selection_change */
- &nv_stop_location_change, /* stop_location_change */
+ &nv_notify_title_change, /* notify_title_change */
+ &nv_show_properties, /* show_properties */
&nv_get_label /* get_label */
};
diff --git a/src/ntl-view-private.h b/src/ntl-view-private.h
index f98a96cb3..79a4b01a8 100644
--- a/src/ntl-view-private.h
+++ b/src/ntl-view-private.h
@@ -29,6 +29,14 @@
#include "nautilus.h"
+typedef struct {
+ POA_Nautilus_ViewFrame servant;
+ gpointer bonobo_object;
+
+ NautilusView *view;
+} impl_POA_Nautilus_ViewFrame;
+
+
extern POA_Nautilus_ViewFrame__vepv impl_Nautilus_ViewFrame_vepv;
extern POA_Nautilus_ZoomableFrame__vepv impl_Nautilus_ZoomableFrame_vepv;
@@ -54,12 +62,13 @@ struct _NautilusViewComponentType {
const char *primary_repoid;
gboolean (* try_load)(NautilusView *view, CORBA_Object obj, CORBA_Environment *ev);
void (* destroy) (NautilusView *view, CORBA_Environment *ev);
- void (* show_properties)(NautilusView *view, CORBA_Environment *ev);
void (* save_state)(NautilusView *view, const char *config_path, CORBA_Environment *ev);
void (* load_state)(NautilusView *view, const char *config_path, CORBA_Environment *ev);
- void (* notify_location_change)(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, CORBA_Environment *ev);
- void (* notify_selection_change)(NautilusView *view, Nautilus_SelectionInfo *nav_ctx, CORBA_Environment *ev);
+ void (* notify_location_change)(NautilusView *view, Nautilus_NavigationInfo *nav_ctx, const char *initial_title, CORBA_Environment *ev);
void (* stop_location_change)(NautilusView *view, CORBA_Environment *ev);
+ void (* notify_selection_change)(NautilusView *view, Nautilus_SelectionInfo *nav_ctx, CORBA_Environment *ev);
+ void (* notify_title_change)(NautilusView *view, const char *new_title, CORBA_Environment *ev);
+ void (* show_properties)(NautilusView *view, CORBA_Environment *ev);
char * (* get_label)(NautilusView *view, CORBA_Environment *ev);
};
diff --git a/src/ntl-view.c b/src/ntl-view.c
index 1781fedcb..3cd392388 100644
--- a/src/ntl-view.c
+++ b/src/ntl-view.c
@@ -432,7 +432,8 @@ nautilus_view_load_client(NautilusView *view, const char *iid)
void
nautilus_view_notify_location_change(NautilusView *view,
- Nautilus_NavigationInfo *nav_context)
+ Nautilus_NavigationInfo *nav_context,
+ const char *initial_title)
{
Nautilus_NavigationInfo real_nav_ctx;
CORBA_Environment ev;
@@ -453,7 +454,7 @@ nautilus_view_notify_location_change(NautilusView *view,
CORBA_exception_init(&ev);
if(view->component_class->notify_location_change)
- view->component_class->notify_location_change(view, &real_nav_ctx, &ev);
+ view->component_class->notify_location_change(view, &real_nav_ctx, initial_title, &ev);
CORBA_exception_free(&ev);
}
@@ -476,6 +477,23 @@ nautilus_view_notify_selection_change(NautilusView *view,
}
void
+nautilus_view_notify_title_change(NautilusView *view,
+ const char *new_title)
+{
+ CORBA_Environment ev;
+
+ g_return_if_fail(NAUTILUS_IS_VIEW(view));
+ g_return_if_fail(view->component_class);
+
+ CORBA_exception_init(&ev);
+
+ if(view->component_class->notify_title_change)
+ view->component_class->notify_title_change(view, new_title, &ev);
+
+ CORBA_exception_free(&ev);
+}
+
+void
nautilus_view_load_state(NautilusView *view, const char *config_path)
{
CORBA_Environment ev;
diff --git a/src/ntl-view.h b/src/ntl-view.h
index e6c6d0d47..090955a01 100644
--- a/src/ntl-view.h
+++ b/src/ntl-view.h
@@ -113,9 +113,12 @@ CORBA_Object nautilus_view_get_objref (NautilusView *view);
/* These functions correspond to methods of the Nautilus:View CORBAinterface */
void nautilus_view_notify_location_change (NautilusView *view,
- Nautilus_NavigationInfo *nav_context);
+ Nautilus_NavigationInfo *nav_context,
+ const char *initial_title);
void nautilus_view_notify_selection_change (NautilusView *view,
Nautilus_SelectionInfo *sel_context);
+void nautilus_view_notify_title_change (NautilusView *view,
+ const char *new_title);
void nautilus_view_load_state (NautilusView *view,
const char *config_path);
void nautilus_view_save_state (NautilusView *view,
diff --git a/src/ntl-window-msgs.c b/src/ntl-window-msgs.c
index 517d768b1..776d25255 100644
--- a/src/ntl-window-msgs.c
+++ b/src/ntl-window-msgs.c
@@ -45,7 +45,6 @@ static void nautilus_window_notify_selection_change(NautilusWindow *window,
NautilusView *view,
Nautilus_SelectionInfo *loc,
NautilusView *requesting_view);
-static void nautilus_window_refresh_title (NautilusWindow *window);
static void nautilus_window_load_content_view_menu (NautilusWindow *window, NautilusNavigationInfo *ni);
typedef enum { PROGRESS_INITIAL, PROGRESS_VIEWS, PROGRESS_DONE, PROGRESS_ERROR } ProgressType;
@@ -170,6 +169,146 @@ nautilus_window_request_progress_change(NautilusWindow *window,
nautilus_window_set_state_info(window, item, (NautilusWindowStateItem)0);
}
+static char *
+compute_default_title (const char *text_uri)
+{
+ GnomeVFSURI *vfs_uri;
+ char *short_name;
+
+ if (text_uri != NULL)
+ {
+ vfs_uri = gnome_vfs_uri_new (text_uri);
+ if (vfs_uri != NULL)
+ {
+ short_name = gnome_vfs_uri_extract_short_name (vfs_uri);
+ gnome_vfs_uri_unref (vfs_uri);
+
+ g_assert (short_name != NULL);
+ return short_name;
+ }
+ }
+
+ return g_strdup(_("Nautilus"));
+}
+
+/*
+ * nautilus_window_get_current_location_title:
+ *
+ * Get a newly allocated copy of the user-displayable title for the current
+ * location. Note that the window title is related to this but might not
+ * be exactly this.
+ * @window: The NautilusWindow in question.
+ *
+ * Return value: A newly allocated string. Use g_free when done with it.
+ */
+static char *
+nautilus_window_get_current_location_title (NautilusWindow *window)
+{
+ return window->requested_title != NULL ? g_strdup (window->requested_title) : g_strdup (window->default_title);
+
+}
+
+/*
+ * nautilus_window_update_title_internal:
+ *
+ * Update the non-NautilusView objects that use the location's user-displayable
+ * title in some way. Called when the location or title has changed.
+ * @window: The NautilusWindow in question.
+ * @title: The new user-displayable title.
+ *
+ */
+static void
+nautilus_window_update_title_internal (NautilusWindow *window, const char *title)
+{
+ char *window_title;
+
+ if (strcmp (title, _("Nautilus")) == 0)
+ {
+ gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
+ }
+ else
+ {
+ window_title = g_strdup_printf (_("Nautilus: %s"), title);
+ gtk_window_set_title (GTK_WINDOW (window), window_title);
+ g_free (window_title);
+ }
+
+ nautilus_index_panel_set_title (window->index_panel, title);
+ nautilus_bookmark_set_name (window->current_location_bookmark, title);
+ /* Name of item in history list may have changed, tell listeners. */
+ nautilus_send_history_list_changed ();
+}
+
+/*
+ * nautilus_window_reset_title_internal:
+ *
+ * Update the non-NautilusView objects that use the location's user-displayable
+ * title in some way. Called when the location or title has changed.
+ * @window: The NautilusWindow in question.
+ * @title: The new user-displayable title.
+ *
+ */
+static void
+nautilus_window_reset_title_internal (NautilusWindow *window, const char *uri)
+{
+ g_free (window->requested_title);
+ window->requested_title = NULL;
+ g_free (window->default_title);
+ window->default_title = compute_default_title (uri);
+
+ if (window->current_location_bookmark == NULL ||
+ strcmp (uri, nautilus_bookmark_get_uri (window->current_location_bookmark)) != 0)
+ {
+ /* We've changed locations, must recreate bookmark for current location. */
+ if (window->last_location_bookmark != NULL)
+ {
+ gtk_object_unref (GTK_OBJECT (window->last_location_bookmark));
+ }
+ window->last_location_bookmark = window->current_location_bookmark;
+ window->current_location_bookmark = nautilus_bookmark_new (uri);
+ }
+
+ nautilus_window_update_title_internal (window, window->default_title);
+}
+
+void
+nautilus_window_request_title_change(NautilusWindow *window,
+ const char *new_title,
+ NautilusContentView *requesting_view)
+{
+ GSList *cur;
+
+ g_return_if_fail (new_title != NULL);
+
+ g_free (window->requested_title);
+ window->requested_title = g_strdup (new_title);
+
+ /*
+ * Tell the requesting content view also, to keep the code parallel.
+ * Don't tell the view in window->content_view because it might be
+ * the old one that's about to be removed.
+ */
+ nautilus_view_notify_title_change (NAUTILUS_VIEW (requesting_view), new_title);
+
+ for(cur = window->meta_views; cur; cur = cur->next)
+ {
+#if 0
+ /*
+ * This should tell metaviews of the new title, but
+ * something about it isn't right. If the metaview connects
+ * to the notify_title_change signal, its callback doesn't
+ * get called. And ORBit warns for each metaview about some
+ * unhandled message of type 1 (REPLY). Right now no metaviews
+ * use this anyway, but we need to fix it.
+ */
+ nautilus_view_notify_title_change (NAUTILUS_VIEW (cur->data), new_title);
+#endif
+ }
+
+ /* Now change the stuff that doesn't use the NautilusView API */
+ nautilus_window_update_title_internal (window, new_title);
+}
+
/* The bulk of this file - location changing */
static void
@@ -190,6 +329,7 @@ static void
nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo *loci)
{
GnomeVFSURI *new_uri;
+ char *current_title;
if(loci) /* This is a location change */
{
@@ -197,9 +337,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
/* Maintain history lists. */
if (window->location_change_type != NAUTILUS_LOCATION_CHANGE_RELOAD)
- {
- nautilus_add_to_history_list (loci->navinfo.requested_uri);
-
+ {
+ /* Always add new location to history list. */
+ nautilus_add_to_history_list (window->current_location_bookmark);
+
if (window->location_change_type == NAUTILUS_LOCATION_CHANGE_BACK)
{
guint index;
@@ -210,8 +351,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
g_assert(window->ni);
/* Move current location to Forward list */
- window->forward_list = g_slist_prepend (window->forward_list,
- nautilus_bookmark_new (window->ni->requested_uri));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->last_location_bookmark), window->ni->requested_uri) == 0);
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ window->forward_list = g_slist_prepend (window->forward_list, window->last_location_bookmark);
+ gtk_object_ref (GTK_OBJECT (window->forward_list->data));
/* Move extra links from Back to Forward list */
for (index = 0; index < window->location_change_distance; ++index)
@@ -237,8 +380,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
g_assert(window->ni);
/* Move current location to Back list */
- window->back_list = g_slist_prepend (window->back_list,
- nautilus_bookmark_new (window->ni->requested_uri));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->last_location_bookmark), window->ni->requested_uri) == 0);
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ window->back_list = g_slist_prepend (window->back_list, window->last_location_bookmark);
+ gtk_object_ref (GTK_OBJECT (window->back_list->data));
/* Move extra links from Forward to Back list */
for (index = 0; index < window->location_change_distance; ++index)
@@ -267,8 +412,10 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
if (window->ni)
{
/* Store bookmark for current location in back list, unless there is no current location */
- window->back_list = g_slist_prepend(window->back_list,
- nautilus_bookmark_new (window->ni->requested_uri));
+ g_assert (strcmp (nautilus_bookmark_get_uri (window->last_location_bookmark), window->ni->requested_uri) == 0);
+ /* Use the first bookmark in the history list rather than creating a new one. */
+ window->back_list = g_slist_prepend (window->back_list, window->last_location_bookmark);
+ gtk_object_ref (GTK_OBJECT (window->back_list->data));
}
}
}
@@ -296,21 +443,22 @@ nautilus_window_update_internals(NautilusWindow *window, NautilusNavigationInfo
window->si = NULL;
nautilus_window_load_content_view_menu (window, loci);
-
- /* Notify the index panel of the location change. FIXME: Eventually,
- this will not be necessary when we restructure the index panel to
- be a NautilusView */
- nautilus_index_panel_set_uri(window->index_panel, loci->navinfo.requested_uri);
}
nautilus_window_allow_back(window, window->back_list != NULL);
nautilus_window_allow_forward(window, window->forward_list != NULL);
-
+
nautilus_location_bar_set_location(NAUTILUS_LOCATION_BAR(window->ent_uri),
window->ni->requested_uri);
- nautilus_index_panel_set_uri (NAUTILUS_INDEX_PANEL (window->index_panel), window->ni->requested_uri);
- nautilus_window_refresh_title (window);
+ /*
+ * Notify the index panel of the location change. FIXME: Eventually,
+ * this will not be necessary when we restructure the index panel to
+ * be a NautilusView.
+ */
+ current_title = nautilus_window_get_current_location_title (window);
+ nautilus_index_panel_set_uri (window->index_panel, window->ni->requested_uri, current_title);
+ g_free (current_title);
}
static void
@@ -322,13 +470,17 @@ nautilus_window_update_view(NautilusWindow *window,
NautilusView *content_view)
{
CORBA_Environment environment;
+ char *current_title;
g_return_if_fail(view);
loci->self_originated = (view == requesting_view);
-
- nautilus_view_notify_location_change(NAUTILUS_VIEW(view), loci);
-
+
+ current_title = nautilus_window_get_current_location_title (window);
+ g_assert (current_title != NULL);
+ nautilus_view_notify_location_change (view, loci, current_title);
+ g_free (current_title);
+
if(seli)
{
CORBA_exception_init(&environment);
@@ -349,37 +501,6 @@ nautilus_window_view_destroyed(NautilusView *view, NautilusWindow *window)
nautilus_window_set_state_info(window, item, view, (NautilusWindowStateItem)0);
}
-static void
-nautilus_window_refresh_title (NautilusWindow *window)
-{
- GnomeVFSURI *vfs_uri;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- vfs_uri = gnome_vfs_uri_new (nautilus_window_get_requested_uri (window));
- if (vfs_uri == NULL)
- {
- gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
- }
- else
- {
- gchar *short_name;
- gchar *new_title;
-
- short_name = gnome_vfs_uri_extract_short_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
-
- g_assert (short_name != NULL);
-
- new_title = g_strdup_printf (_("Nautilus: %s"), short_name);
- gtk_window_set_title (GTK_WINDOW (window), new_title);
- g_free (new_title);
-
- g_free (short_name);
- }
-
-}
-
/* This is called when we have decided we can actually change to the new view/location situation. */
static void
nautilus_window_has_really_changed(NautilusWindow *window)
@@ -538,7 +659,7 @@ nautilus_window_load_content_view(NautilusWindow *window,
new_view = NAUTILUS_VIEW(gtk_widget_new(nautilus_content_view_get_type(), "main_window", window, NULL));
- nautilus_window_connect_view(window, new_view);
+ nautilus_window_connect_content_view (window, NAUTILUS_CONTENT_VIEW (new_view));
if(!nautilus_view_load_client(new_view, iid))
{
@@ -670,6 +791,8 @@ nautilus_window_update_state(gpointer data)
if(window->pending_ni)
{
+ nautilus_window_reset_title_internal (window, window->ni->requested_uri);
+
/* Tell previously-notified views to go back to the old page */
for(cur = window->meta_views; cur; cur = cur->next)
{
@@ -742,6 +865,8 @@ nautilus_window_update_state(gpointer data)
si = window->si;
}
+ nautilus_window_reset_title_internal (window, ni->requested_uri);
+
#ifdef EXTREME_DEBUGGING
g_message("!!! Sending update_view");
#endif
diff --git a/src/ntl-window-msgs.h b/src/ntl-window-msgs.h
index c6add3885..276a88f47 100644
--- a/src/ntl-window-msgs.h
+++ b/src/ntl-window-msgs.h
@@ -28,6 +28,7 @@
#define NTL_WINDOW_MSGS_H 1
#include "ntl-window.h"
+#include "ntl-content-view.h"
void nautilus_window_request_location_change(NautilusWindow *window,
Nautilus_NavigationRequestInfo *loc,
@@ -41,5 +42,8 @@ void nautilus_window_request_status_change(NautilusWindow *window,
void nautilus_window_request_progress_change(NautilusWindow *window,
Nautilus_ProgressRequestInfo *loc,
NautilusView *requesting_view);
+void nautilus_window_request_title_change(NautilusWindow *window,
+ const char *new_title,
+ NautilusContentView *requesting_view);
#endif
diff --git a/src/ntl-window-private.h b/src/ntl-window-private.h
index 363897113..63162b967 100644
--- a/src/ntl-window-private.h
+++ b/src/ntl-window-private.h
@@ -2,6 +2,7 @@
#define NTL_WINDOW_PRIVATE_H 1
#include "ntl-window.h"
+#include "ntl-content-view.h"
#include <libnautilus/libnautilus.h>
#include <gtk/gtk.h>
@@ -42,10 +43,14 @@ void nautilus_window_begin_location_change(NautilusWindow *window,
NautilusLocationChangeType type,
guint distance);
void nautilus_window_remove_meta_view_real(NautilusWindow *window, NautilusView *meta_view);
+void nautilus_window_connect_content_view (NautilusWindow *window,
+ NautilusContentView *view);
void nautilus_window_connect_view (NautilusWindow *window,
NautilusView *view);
void nautilus_window_view_destroyed(NautilusView *view, NautilusWindow *window);
-void nautilus_add_to_history_list (const char *uri);
+
+void nautilus_send_history_list_changed (void);
+void nautilus_add_to_history_list (NautilusBookmark *bookmark);
GSList *nautilus_get_history_list (void);
void nautilus_window_add_bookmark_for_current_location (NautilusWindow *window);
diff --git a/src/ntl-window.c b/src/ntl-window.c
index 6d9c64d66..dcc93dc3b 100644
--- a/src/ntl-window.c
+++ b/src/ntl-window.c
@@ -793,18 +793,22 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
}
void
-nautilus_add_to_history_list (const char *uri)
+nautilus_send_history_list_changed ()
+{
+ gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
+ "history_list_changed");
+}
+
+void
+nautilus_add_to_history_list (NautilusBookmark *bookmark)
{
/* Note that the history is shared amongst all windows so
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
- NautilusBookmark *bookmark;
GSList *found_link;
- g_return_if_fail (nautilus_strlen(uri) > 0);
-
- bookmark = nautilus_bookmark_new (uri);
+ g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
found_link = g_slist_find_custom (history_list,
bookmark,
@@ -818,13 +822,13 @@ nautilus_add_to_history_list (const char *uri)
}
/* New item goes first. */
+ gtk_object_ref (GTK_OBJECT (bookmark));
history_list = g_slist_prepend(history_list, bookmark);
/* Tell world that history list has changed. At least all the
* NautilusWindows (not just this one) are listening.
*/
- gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()),
- "history_list_changed");
+ nautilus_send_history_list_changed ();
}
GSList *
@@ -867,35 +871,59 @@ nautilus_window_request_progress_change_cb (NautilusView *view,
nautilus_window_request_progress_change(window, info, view);
}
+static void
+nautilus_window_request_title_change_callback (NautilusContentView *view,
+ const char *new_title,
+ NautilusWindow *window)
+{
+ nautilus_window_request_title_change(window, new_title, view);
+}
+
void
nautilus_window_connect_view(NautilusWindow *window, NautilusView *view)
{
- GtkObject *viewo;
+ GtkObject *view_object;
- viewo = GTK_OBJECT(view);
- gtk_signal_connect(viewo,
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
"request_location_change",
nautilus_window_request_location_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_selection_change",
nautilus_window_request_selection_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_status_change",
nautilus_window_request_status_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"request_progress_change",
nautilus_window_request_progress_change_cb,
window);
- gtk_signal_connect(viewo,
+ gtk_signal_connect(view_object,
"destroy",
nautilus_window_view_destroyed,
window);
}
void
+nautilus_window_connect_content_view(NautilusWindow *window, NautilusContentView *view)
+{
+ GtkObject *view_object;
+
+ /* First connect with NautilusView signals. */
+ nautilus_window_connect_view (window, NAUTILUS_VIEW (view));
+
+ /* Now connect with NautilusContentView signals. */
+ view_object = GTK_OBJECT(view);
+ gtk_signal_connect(view_object,
+ "request_title_change",
+ nautilus_window_request_title_change_callback,
+ window);
+}
+
+void
nautilus_window_display_error(NautilusWindow *window, const char *error_msg)
{
GtkWidget *dialog;
diff --git a/src/ntl-window.h b/src/ntl-window.h
index 629c1794d..af5e9926a 100644
--- a/src/ntl-window.h
+++ b/src/ntl-window.h
@@ -29,6 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
+#include <libnautilus/nautilus-bookmark.h>
#include "ntl-types.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
@@ -75,12 +76,17 @@ struct _NautilusWindow {
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
+ char *requested_title;
+ char *default_title;
/* Back/Forward chain, and history list.
* The data in these lists are NautilusBookmark pointers.
*/
GSList *back_list, *forward_list;
+ NautilusBookmark *current_location_bookmark;
+ NautilusBookmark *last_location_bookmark;
+
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;