summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog54
-rw-r--r--components/history/nautilus-history-view.c297
-rw-r--r--libnautilus/nautilus-view-component.idl27
-rw-r--r--src/Makefile.am1
-rw-r--r--src/nautilus-history-frame.c104
-rw-r--r--src/nautilus-history-frame.h49
-rw-r--r--src/nautilus-navigation-window.c45
-rw-r--r--src/nautilus-object-window.c45
-rw-r--r--src/nautilus-spatial-window.c45
-rw-r--r--src/nautilus-view-frame.c45
-rw-r--r--src/nautilus-view-frame.h74
-rw-r--r--src/nautilus-window.c45
12 files changed, 660 insertions, 171 deletions
diff --git a/ChangeLog b/ChangeLog
index 6cc8f2135..35193809e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,57 @@
+2000-07-06 Gene Z. Ragan <gzr@eazel.com>
+
+ Fixed bug 1571, Need titles in history list instead
+ of just URIs.
+
+ This was a result of sharing the NautilusWindow history list
+ information over CORBA.
+
+ * libnautilus/nautilus-view-component.idl:
+ Create new interface, Nautilus::HistoryFrame
+ Interface has method to get a sequence of
+ history information. This sequence contains
+ structs that contain uri and name history
+ information.
+
+ * src/Makefile.am:
+ Added new file, NautilusHistoryFrame.c, to makefile.
+
+ * src/nautilus-history-frame.c:
+ * src/nautilus-history-frame.h:
+ (impl_Nautilus_HistoryFrame__destroy),
+ (impl_Nautilus_HistoryFrame__create),
+ (impl_Nautilus_HistoryFrame_get_history_list):
+ New files that imliments the functionality of the
+ Nautilus::HistoryFrame.
+
+ * components/history/nautilus-history-view.c:
+ (get_bookmark_from_row), (get_uri_from_row),
+ (history_view_frame_call_begin), (history_view_frame_call_end),
+ (history_view_update_icons), (get_history_list),
+ (hyperbola_navigation_history_load_location),
+ (hyperbola_navigation_history_select_row), (do_destroy),
+ (make_obj), (main):
+ Changes in the way that the history list is maintained.
+ We now use the info that is received by asking the view frame
+ for history information.
+
+ * src/nautilus-view-frame.c:
+ * src/nautilus-view-frame.h:
+ (nautilus_view_frame_initialize_class),
+ (nautilus_view_frame_load_client),
+ (nautilus_view_frame_get_history_list):
+ Added new signal GET_HISTORY_LIST and new
+ function that emits the signal when called.
+
+ * src/nautilus-window.c:
+ (nautilus_window_connect_view):
+ Create and add history interface to connected view.
+
+ (nautilus_window_get_history_list_callback):
+ New signal handler that connects to the get_history_list
+ signal of NautilusViewFrame. Returns a Nautilus_HistoryList
+ created from the history list data.
+
2000-07-06 Michael Engber <engber@eazel.com>
* src/nautilus-window.c: (nautilus_window_class_init):
diff --git a/components/history/nautilus-history-view.c b/components/history/nautilus-history-view.c
index 2c481eff6..97c3fe27c 100644
--- a/components/history/nautilus-history-view.c
+++ b/components/history/nautilus-history-view.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Nautilus
@@ -27,6 +27,7 @@
#include <gnome.h>
#include <libnautilus/libnautilus.h>
+#include <libnautilus/nautilus-view-component.h>
#include <libnautilus-extensions/nautilus-bookmark.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libgnome/gnome-i18n.h>
@@ -35,13 +36,13 @@
#include <liboaf/liboaf.h>
typedef struct {
- NautilusView *view;
+ NautilusView *view;
+ Nautilus_HistoryFrame history_frame;
+ GtkCList *clist;
- GtkCList *clist;
+ gint notify_count;
- gint notify_count;
-
- BonoboUIHandler *uih;
+ BonoboUIHandler *uih;
} HistoryView;
#define HISTORY_VIEW_COLUMN_ICON 0
@@ -51,16 +52,33 @@ typedef struct {
static NautilusBookmark *
get_bookmark_from_row (GtkCList *clist, int row)
{
- g_assert (NAUTILUS_IS_BOOKMARK (gtk_clist_get_row_data (clist, row)));
- return NAUTILUS_BOOKMARK (gtk_clist_get_row_data (clist, row));
+ g_assert (NAUTILUS_IS_BOOKMARK (gtk_clist_get_row_data (clist, row)));
+ return NAUTILUS_BOOKMARK (gtk_clist_get_row_data (clist, row));
}
static char *
get_uri_from_row (GtkCList *clist, int row)
{
- return nautilus_bookmark_get_uri (get_bookmark_from_row (clist, row));
+ return nautilus_bookmark_get_uri (get_bookmark_from_row (clist, row));
}
+static Nautilus_HistoryFrame
+history_view_frame_call_begin (NautilusView *view, CORBA_Environment *ev)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (ev);
+ return Bonobo_Unknown_query_interface
+ (bonobo_control_get_control_frame (nautilus_view_get_bonobo_control (view)),
+ "IDL:Nautilus/HistoryFrame:1.0", ev);
+}
+
+static void
+history_view_frame_call_end (Nautilus_HistoryFrame frame, CORBA_Environment *ev)
+{
+ CORBA_Object_release (frame, ev);
+ CORBA_exception_free (ev);
+}
static void
install_icon (GtkCList *clist, gint row)
@@ -88,12 +106,31 @@ install_icon (GtkCList *clist, gint row)
static void
history_view_update_icons (GtkCList *clist)
{
- int row;
+ int row;
- for (row = 0; row < clist->rows; ++row)
- {
- install_icon (clist, row);
- }
+ for (row = 0; row < clist->rows; ++row)
+ {
+ install_icon (clist, row);
+ }
+}
+
+static Nautilus_HistoryList *
+get_history_list (HistoryView *hview)
+{
+ CORBA_Environment ev;
+ Nautilus_HistoryFrame view_frame;
+ Nautilus_HistoryList *list;
+
+ list = NULL;
+
+ view_frame = history_view_frame_call_begin (hview->view, &ev);
+ if (view_frame != CORBA_OBJECT_NIL) {
+ list = Nautilus_HistoryFrame_get_history_list (view_frame, &ev);
+ }
+
+ history_view_frame_call_end (view_frame, &ev);
+
+ return list;
}
static void
@@ -101,97 +138,86 @@ hyperbola_navigation_history_load_location (NautilusView *view,
const char *location,
HistoryView *hview)
{
- char *cols[HISTORY_VIEW_COLUMN_COUNT];
- int new_rownum;
- GtkCList *clist;
- NautilusBookmark *bookmark;
- int i;
- GnomeVFSURI *vfs_uri;
- char *short_name;
-
- hview->notify_count++;
-
- clist = hview->clist;
- gtk_clist_freeze(clist);
-
- /* FIXME bugzilla.eazel.com 206:
- * Get the bookmark info from the Nautilus window instead of
- * keeping a parallel mechanism here. That will get us the right
- * short name for different locations.
- */
- vfs_uri = gnome_vfs_uri_new (location);
- if (vfs_uri == NULL) {
- short_name = g_strdup (location);
- } else {
- short_name = gnome_vfs_uri_extract_short_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
- }
- bookmark = nautilus_bookmark_new (location, short_name);
-
-
- /* If a bookmark for this location was already in list, remove it
- * (no duplicates in list, new one goes at top)
- */
- for (i = 0; i < clist->rows; ++i)
- {
- if (nautilus_bookmark_compare_with (get_bookmark_from_row (clist, i),
- bookmark)
- == 0)
- {
- gtk_clist_remove (clist, i);
- /* Since we check with each insertion, no need to check further */
- break;
- }
- }
-
- cols[HISTORY_VIEW_COLUMN_ICON] = NULL;
- cols[HISTORY_VIEW_COLUMN_NAME] = short_name;
- new_rownum = gtk_clist_prepend(clist, cols);
- g_free (short_name);
-
- gtk_clist_set_row_data_full (clist,
- new_rownum,
- bookmark,
- (GtkDestroyNotify)gtk_object_unref);
- install_icon (clist, new_rownum);
-
- gtk_clist_columns_autosize(clist);
-
- if(gtk_clist_row_is_visible(clist, new_rownum) != GTK_VISIBILITY_FULL)
- gtk_clist_moveto(clist, new_rownum, -1, 0.5, 0.0);
-
- gtk_clist_select_row(clist, new_rownum, 0);
-
- gtk_clist_thaw(clist);
-
- hview->notify_count--;
+ char *cols[HISTORY_VIEW_COLUMN_COUNT];
+ int new_rownum;
+ GtkCList *clist;
+ NautilusBookmark *bookmark;
+ //int i;
+ //GnomeVFSURI *vfs_uri;
+ //char *short_name;
+
+ Nautilus_HistoryList *history_list;
+ Nautilus_HistoryItem *item;
+ int index;
+
+ hview->notify_count++;
+
+ clist = hview->clist;
+ gtk_clist_freeze(clist);
+
+ /* Clear out list */
+ gtk_clist_clear (clist);
+
+ /* Populate with data from main history list */
+ history_list = get_history_list (hview);
+ if (history_list != NULL) {
+ for (index = 0; index < history_list->_length; index++) {
+ item = &history_list->_buffer[index];
+ bookmark = nautilus_bookmark_new (item->location, item->name);
+
+ cols[HISTORY_VIEW_COLUMN_ICON] = NULL;
+ cols[HISTORY_VIEW_COLUMN_NAME] = item->name;
+ new_rownum = gtk_clist_append(clist, cols);
+
+ gtk_clist_set_row_data_full (clist, new_rownum, bookmark,
+ (GtkDestroyNotify)gtk_object_unref);
+ install_icon (clist, new_rownum);
+
+ gtk_clist_columns_autosize(clist);
+
+ if(gtk_clist_row_is_visible(clist, new_rownum) != GTK_VISIBILITY_FULL) {
+ gtk_clist_moveto(clist, new_rownum, -1, 0.5, 0.0);
+ }
+
+ }
+
+ CORBA_free (history_list);
+ }
+
+ gtk_clist_select_row(clist, 0, 0);
+
+ gtk_clist_thaw(clist);
+
+ hview->notify_count--;
}
static void
hyperbola_navigation_history_select_row(GtkCList *clist, gint row, gint column, GdkEvent *event,
HistoryView *hview)
{
- char *uri;
-
- if(hview->notify_count > 0)
- return;
-
- /* First row is always current location, by definition, so don't activate */
- if (row == 0)
- return;
+ char *uri;
+
+ if(hview->notify_count > 0) {
+ return;
+ }
- /* FIXME bugzilla.eazel.com 702: There are bugs here if you drag up & down */
+ /* First row is always current location, by definition, so don't activate */
+ if (row == 0) {
+ return;
+ }
- gtk_clist_freeze(clist);
+ /* FIXME bugzilla.eazel.com 702: There are bugs here if you drag up & down */
+ gtk_clist_freeze(clist);
- if(gtk_clist_row_is_visible(clist, row) != GTK_VISIBILITY_FULL)
- gtk_clist_moveto(clist, row, -1, 0.5, 0.0);
+ if(gtk_clist_row_is_visible(clist, row) != GTK_VISIBILITY_FULL) {
+ gtk_clist_moveto(clist, row, -1, 0.5, 0.0);
+ }
- uri = get_uri_from_row (clist, row);
- nautilus_view_open_location (hview->view, uri);
- g_free (uri);
+ uri = get_uri_from_row (clist, row);
+ nautilus_view_open_location (hview->view, uri);
+ g_free (uri);
- gtk_clist_thaw(clist);
+ gtk_clist_thaw(clist);
}
static int object_count = 0;
@@ -199,76 +225,77 @@ static int object_count = 0;
static void
do_destroy(GtkObject *obj, HistoryView *hview)
{
- object_count--;
- if(object_count <= 0)
- gtk_main_quit();
+ object_count--;
+ if(object_count <= 0) {
+ gtk_main_quit();
+ }
}
+
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
- GtkWidget *wtmp;
- GtkCList *clist;
- HistoryView *hview;
+ GtkWidget *wtmp;
+ GtkCList *clist;
+ HistoryView *hview;
- g_return_val_if_fail(!strcmp(goad_id, "OAFIID:nautilus_history_view:a7a85bdd-2ecf-4bc1-be7c-ed328a29aacb"), NULL);
+ g_return_val_if_fail(!strcmp(goad_id, "OAFIID:nautilus_history_view:a7a85bdd-2ecf-4bc1-be7c-ed328a29aacb"), NULL);
- hview = g_new0(HistoryView, 1);
+ hview = g_new0(HistoryView, 1);
- /* create interface */
- clist = GTK_CLIST (gtk_clist_new (HISTORY_VIEW_COLUMN_COUNT));
- gtk_clist_column_titles_hide (clist);
- gtk_clist_set_row_height (clist, NAUTILUS_ICON_SIZE_SMALLER);
- gtk_clist_set_selection_mode(clist, GTK_SELECTION_BROWSE);
- gtk_clist_columns_autosize(clist);
- wtmp = gtk_scrolled_window_new(gtk_clist_get_hadjustment(clist),
+ /* create interface */
+ clist = GTK_CLIST (gtk_clist_new (HISTORY_VIEW_COLUMN_COUNT));
+ gtk_clist_column_titles_hide (clist);
+ gtk_clist_set_row_height (clist, NAUTILUS_ICON_SIZE_SMALLER);
+ gtk_clist_set_selection_mode(clist, GTK_SELECTION_BROWSE);
+ gtk_clist_columns_autosize(clist);
+ wtmp = gtk_scrolled_window_new(gtk_clist_get_hadjustment(clist),
gtk_clist_get_vadjustment(clist));
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp),
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- gtk_container_add(GTK_CONTAINER(wtmp), GTK_WIDGET (clist));
+ gtk_container_add(GTK_CONTAINER(wtmp), GTK_WIDGET (clist));
- gtk_widget_show_all(wtmp);
+ gtk_widget_show_all(wtmp);
- /* create object */
- hview->view = nautilus_view_new (wtmp);
- gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
- object_count++;
+ /* create object */
+ hview->view = nautilus_view_new (wtmp);
+ gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
+ object_count++;
- hview->clist = (GtkCList *)clist;
+ hview->clist = (GtkCList *)clist;
- /* handle events */
- gtk_signal_connect(GTK_OBJECT(hview->view), "load_location",
+ /* handle events */
+ gtk_signal_connect(GTK_OBJECT(hview->view), "load_location",
hyperbola_navigation_history_load_location, hview);
- gtk_signal_connect(GTK_OBJECT(clist), "select_row", hyperbola_navigation_history_select_row, hview);
+ gtk_signal_connect(GTK_OBJECT(clist), "select_row", hyperbola_navigation_history_select_row, hview);
- gtk_signal_connect_object_while_alive (nautilus_icon_factory_get (),
+ gtk_signal_connect_object_while_alive (nautilus_icon_factory_get (),
"icons_changed",
history_view_update_icons,
GTK_OBJECT (hview->clist));
-
-
- return BONOBO_OBJECT (hview->view);
+
+ return BONOBO_OBJECT (hview->view);
}
int main(int argc, char *argv[])
{
- BonoboGenericFactory *factory;
- CORBA_ORB orb;
+ BonoboGenericFactory *factory;
+ CORBA_ORB orb;
- gnome_init_with_popt_table("nautilus-history-view", VERSION,
+ gnome_init_with_popt_table("nautilus-history-view", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
- orb = oaf_init (argc, argv);
+ orb = oaf_init (argc, argv);
- bonobo_init(orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
- gnome_vfs_init ();
+ bonobo_init(orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
+ gnome_vfs_init ();
- factory = bonobo_generic_factory_new_multi("OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e", make_obj, NULL);
+ factory = bonobo_generic_factory_new_multi("OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e", make_obj, NULL);
- do {
- bonobo_main();
- } while(object_count > 0);
+ do {
+ bonobo_main();
+ } while(object_count > 0);
- return 0;
+ return 0;
}
diff --git a/libnautilus/nautilus-view-component.idl b/libnautilus/nautilus-view-component.idl
index 505681740..c90d06da6 100644
--- a/libnautilus/nautilus-view-component.idl
+++ b/libnautilus/nautilus-view-component.idl
@@ -125,6 +125,33 @@ module Nautilus {
interface ZoomableFrame : ::Bonobo::Unknown {
oneway void report_zoom_level_changed (in double zoom_level);
};
+
+
+ /* The specifications for a history list item. The stucture
+ * containes the name to be displayed and the position of
+ * the item withing the history stack.
+ */
+
+ struct HistoryItem {
+ string name;
+ string location;
+ long position;
+ };
+
+ typedef sequence<HistoryItem> HistoryList;
+
+ /* The interface for something that manages and modifies history
+ * transactions.
+ */
+
+ interface HistoryFrame : ::Bonobo::Unknown {
+
+ /* Called by a view component to get the Nautilus
+ * history list.
+ */
+ HistoryList get_history_list ();
+ };
+
};
#endif /* NAUTILUS_VIEW_COMPONENT_IDL */
diff --git a/src/Makefile.am b/src/Makefile.am
index f8db362c7..517822b9e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -76,6 +76,7 @@ nautilus_SOURCES =\
nautilus-complex-search-bar.c \
nautilus-desktop-window.c \
nautilus-first-time-druid.c \
+ nautilus-history-frame.c \
nautilus-link-set-window.c \
nautilus-location-bar.c \
nautilus-main.c \
diff --git a/src/nautilus-history-frame.c b/src/nautilus-history-frame.c
new file mode 100644
index 000000000..5b453230e
--- /dev/null
+++ b/src/nautilus-history-frame.c
@@ -0,0 +1,104 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 1999, 2000 Eazel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Gene Z. Ragan <gzr@eazel.com>
+ *
+ */
+
+/* nautilus-history-frame.c: CORBA server implementation of
+ Nautilus::HistoryFrame interface of a Nautilus HistoryFrame. */
+
+#include <config.h>
+
+#include "nautilus-history-frame.h"
+
+typedef struct {
+ POA_Nautilus_HistoryFrame servant;
+ BonoboObject *bonobo_object;
+ NautilusViewFrame *view;
+} impl_POA_Nautilus_HistoryFrame;
+
+static Nautilus_HistoryList *impl_Nautilus_HistoryFrame_get_history_list (PortableServer_Servant servant,
+ CORBA_Environment *ev);
+
+POA_Nautilus_HistoryFrame__epv impl_Nautilus_HistoryFrame_epv =
+{
+ NULL,
+ impl_Nautilus_HistoryFrame_get_history_list,
+};
+
+static PortableServer_ServantBase__epv base_epv;
+POA_Nautilus_HistoryFrame__vepv impl_Nautilus_HistoryFrame_vepv =
+{
+ &base_epv,
+ NULL,
+ &impl_Nautilus_HistoryFrame_epv
+};
+
+static void
+impl_Nautilus_HistoryFrame__destroy (BonoboObject *object,
+ impl_POA_Nautilus_HistoryFrame *servant)
+{
+ PortableServer_ObjectId *object_id;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ object_id = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
+ PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev);
+ CORBA_free (object_id);
+ object->servant = NULL;
+
+ POA_Nautilus_HistoryFrame__fini ((PortableServer_Servant) servant, &ev);
+ g_free (servant);
+
+ CORBA_exception_free (&ev);
+}
+
+BonoboObject *
+impl_Nautilus_HistoryFrame__create (NautilusViewFrame *view,
+ CORBA_Environment * ev)
+{
+ BonoboObject *bonobo_object;
+ impl_POA_Nautilus_HistoryFrame *servant;
+
+ impl_Nautilus_HistoryFrame_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv();
+
+ servant = g_new0 (impl_POA_Nautilus_HistoryFrame, 1);
+ servant->servant.vepv = &impl_Nautilus_HistoryFrame_vepv;
+ servant->view = view;
+ POA_Nautilus_HistoryFrame__init ((PortableServer_Servant) servant, ev);
+
+ bonobo_object = bonobo_object_new_from_servant (servant);
+
+ gtk_signal_connect (GTK_OBJECT (bonobo_object), "destroy",
+ GTK_SIGNAL_FUNC (impl_Nautilus_HistoryFrame__destroy), servant);
+
+ return bonobo_object;
+}
+
+static Nautilus_HistoryList *
+impl_Nautilus_HistoryFrame_get_history_list (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ return (nautilus_view_frame_get_history_list
+ (((impl_POA_Nautilus_HistoryFrame *)servant)->view));
+}
diff --git a/src/nautilus-history-frame.h b/src/nautilus-history-frame.h
new file mode 100644
index 000000000..7b7838846
--- /dev/null
+++ b/src/nautilus-history-frame.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 1999, 2000 Eazel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Gene Z. Ragan <gzr@eazel.com>
+ *
+ */
+
+#ifndef NAUTILUS_HISTORY_FRAME_H
+#define NAUTILUS_HISTORY_FRAME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "nautilus-view-frame.h"
+
+#include <bonobo/bonobo-object.h>
+#include <bonobo/bonobo-main.h>
+#include <libnautilus/nautilus-view-component.h>
+
+
+
+BonoboObject *impl_Nautilus_HistoryFrame__create (NautilusViewFrame *view,
+ CORBA_Environment *ev);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* NAUTILUS_HISTORY_FRAME_H */
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 686cfd28a..07d171ed5 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -1167,6 +1167,50 @@ nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
}
}
+static void
+nautilus_window_get_history_list_callback (NautilusViewFrame *view,
+ Nautilus_HistoryList **out_list,
+ NautilusWindow *window)
+{
+ Nautilus_HistoryList *local_list;
+ Nautilus_HistoryItem *history_item;
+ NautilusBookmark *bookmark;
+ int length, index;
+ GSList *element;
+ char *name, *location;
+
+ /* Get total number of history items */
+ length = g_slist_length (history_list);
+ if (length <= 0) {
+ *out_list = NULL;
+ return;
+ }
+
+ local_list = Nautilus_HistoryList__alloc ();
+ local_list->_length = length;
+ local_list->_maximum = length;
+ local_list->_buffer = CORBA_sequence_Nautilus_HistoryItem_allocbuf (length);
+
+ /* Iterate through list and copy item data */
+ for (index = 0, element = history_list; index < length; index++, element = element->next) {
+ bookmark = element->data;
+ name = nautilus_bookmark_get_name (bookmark);
+ location = nautilus_bookmark_get_uri (bookmark);
+
+ history_item = &local_list->_buffer[index];
+ history_item->name = CORBA_string_dup (name);
+ history_item->location = CORBA_string_dup (location);
+
+ history_item->position = index;
+
+ g_free (name);
+ g_free (location);
+ }
+ CORBA_sequence_set_release (local_list, CORBA_TRUE);
+
+ *out_list = local_list;
+}
+
void
nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
{
@@ -1187,6 +1231,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (zoom_level_changed);
+ CONNECT (get_history_list);
#undef CONNECT
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index 686cfd28a..07d171ed5 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -1167,6 +1167,50 @@ nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
}
}
+static void
+nautilus_window_get_history_list_callback (NautilusViewFrame *view,
+ Nautilus_HistoryList **out_list,
+ NautilusWindow *window)
+{
+ Nautilus_HistoryList *local_list;
+ Nautilus_HistoryItem *history_item;
+ NautilusBookmark *bookmark;
+ int length, index;
+ GSList *element;
+ char *name, *location;
+
+ /* Get total number of history items */
+ length = g_slist_length (history_list);
+ if (length <= 0) {
+ *out_list = NULL;
+ return;
+ }
+
+ local_list = Nautilus_HistoryList__alloc ();
+ local_list->_length = length;
+ local_list->_maximum = length;
+ local_list->_buffer = CORBA_sequence_Nautilus_HistoryItem_allocbuf (length);
+
+ /* Iterate through list and copy item data */
+ for (index = 0, element = history_list; index < length; index++, element = element->next) {
+ bookmark = element->data;
+ name = nautilus_bookmark_get_name (bookmark);
+ location = nautilus_bookmark_get_uri (bookmark);
+
+ history_item = &local_list->_buffer[index];
+ history_item->name = CORBA_string_dup (name);
+ history_item->location = CORBA_string_dup (location);
+
+ history_item->position = index;
+
+ g_free (name);
+ g_free (location);
+ }
+ CORBA_sequence_set_release (local_list, CORBA_TRUE);
+
+ *out_list = local_list;
+}
+
void
nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
{
@@ -1187,6 +1231,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (zoom_level_changed);
+ CONNECT (get_history_list);
#undef CONNECT
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 686cfd28a..07d171ed5 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -1167,6 +1167,50 @@ nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
}
}
+static void
+nautilus_window_get_history_list_callback (NautilusViewFrame *view,
+ Nautilus_HistoryList **out_list,
+ NautilusWindow *window)
+{
+ Nautilus_HistoryList *local_list;
+ Nautilus_HistoryItem *history_item;
+ NautilusBookmark *bookmark;
+ int length, index;
+ GSList *element;
+ char *name, *location;
+
+ /* Get total number of history items */
+ length = g_slist_length (history_list);
+ if (length <= 0) {
+ *out_list = NULL;
+ return;
+ }
+
+ local_list = Nautilus_HistoryList__alloc ();
+ local_list->_length = length;
+ local_list->_maximum = length;
+ local_list->_buffer = CORBA_sequence_Nautilus_HistoryItem_allocbuf (length);
+
+ /* Iterate through list and copy item data */
+ for (index = 0, element = history_list; index < length; index++, element = element->next) {
+ bookmark = element->data;
+ name = nautilus_bookmark_get_name (bookmark);
+ location = nautilus_bookmark_get_uri (bookmark);
+
+ history_item = &local_list->_buffer[index];
+ history_item->name = CORBA_string_dup (name);
+ history_item->location = CORBA_string_dup (location);
+
+ history_item->position = index;
+
+ g_free (name);
+ g_free (location);
+ }
+ CORBA_sequence_set_release (local_list, CORBA_TRUE);
+
+ *out_list = local_list;
+}
+
void
nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
{
@@ -1187,6 +1231,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (zoom_level_changed);
+ CONNECT (get_history_list);
#undef CONNECT
diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c
index c16a909dc..e5083b1d9 100644
--- a/src/nautilus-view-frame.c
+++ b/src/nautilus-view-frame.c
@@ -4,7 +4,7 @@
* Nautilus
*
* Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 1999, 2000 Eazel, Inc.
+ * Copyright (C) 1999, 2000 Eazel, Inc.a
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -31,6 +31,7 @@
#include "nautilus-view-frame-private.h"
#include "nautilus-application.h"
+#include "nautilus-history-frame.h"
#include "nautilus-window.h"
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
@@ -53,6 +54,7 @@ enum {
SET_TITLE,
ZOOM_LEVEL_CHANGED,
CLIENT_GONE,
+ GET_HISTORY_LIST,
LAST_SIGNAL
};
@@ -170,7 +172,16 @@ nautilus_view_frame_initialize_class (NautilusViewFrameClass *klass)
client_gone),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
-
+
+ signals[GET_HISTORY_LIST] =
+ gtk_signal_new ("get_history_list",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (NautilusViewFrameClass,
+ get_history_list),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
@@ -299,11 +310,14 @@ nautilus_view_frame_load_client (NautilusViewFrame *view, const char *iid)
view->zoomable_frame = impl_Nautilus_ZoomableFrame__create(view, &ev);
bonobo_object_add_interface (BONOBO_OBJECT (view->view_frame),
BONOBO_OBJECT (view->zoomable_frame));
+ view->history_frame = impl_Nautilus_HistoryFrame__create(view, &ev);
+ bonobo_object_add_interface (BONOBO_OBJECT (view->view_frame),
+ BONOBO_OBJECT (view->history_frame));
/* Add undo manager to component */
nautilus_undo_manager_add_interface
(view->undo_manager, BONOBO_OBJECT (view->view_frame));
-
+
/* Now figure out which type of embedded object it is: */
for(i = 0; component_types[i] && !view->component_class; i++) {
obj = Bonobo_Unknown_query_interface(bonobo_object_corba_objref(BONOBO_OBJECT(view->client_object)),
@@ -765,3 +779,28 @@ nautilus_view_frame_activate (NautilusViewFrame *view)
bonobo_control_frame_control_activate (control_frame);
bonobo_object_unref (BONOBO_OBJECT (control_frame));
}
+
+
+Nautilus_HistoryList *
+nautilus_view_frame_get_history_list (NautilusViewFrame *view)
+{
+ Nautilus_HistoryList *history_list = NULL;
+
+ g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL);
+
+ /* Signal view for history list */
+ gtk_signal_emit (GTK_OBJECT (view),
+ signals[GET_HISTORY_LIST],
+ &history_list);
+
+ /* Set up empty list if we received NULL list */
+ if (history_list == NULL) {
+ history_list = Nautilus_HistoryList__alloc();
+ history_list->_length = 0;
+ history_list->_buffer = NULL;
+ CORBA_sequence_set_release(history_list, CORBA_TRUE);
+ }
+
+ return history_list;
+}
+
diff --git a/src/nautilus-view-frame.h b/src/nautilus-view-frame.h
index 7263d7d79..53035d80d 100644
--- a/src/nautilus-view-frame.h
+++ b/src/nautilus-view-frame.h
@@ -61,6 +61,7 @@ typedef struct {
BonoboObject *view_frame;
BonoboObject *zoomable_frame;
+ BonoboObject *history_frame;
Nautilus_Zoomable zoomable;
NautilusViewComponentType *component_class;
@@ -104,47 +105,54 @@ typedef struct {
/* Error handling for when client goes away. */
void (* client_gone) (NautilusViewFrame *view);
+
+ /* Get a CORBA copy of the history list */
+ void (*get_history_list) (NautilusViewFrame *view,
+ Nautilus_HistoryList **out_list);
+
} NautilusViewFrameClass;
-GtkType nautilus_view_frame_get_type (void);
-NautilusViewFrame *nautilus_view_frame_new (BonoboUIHandler *ui_handler,
- NautilusUndoManager *undo_manager);
-gboolean nautilus_view_frame_load_client (NautilusViewFrame *view,
- const char *iid);
-const char * nautilus_view_frame_get_iid (NautilusViewFrame *view);
-CORBA_Object nautilus_view_frame_get_client_objref (NautilusViewFrame *view);
-BonoboObject * nautilus_view_frame_get_control_frame (NautilusViewFrame *view);
-CORBA_Object nautilus_view_frame_get_objref (NautilusViewFrame *view);
+GtkType nautilus_view_frame_get_type (void);
+NautilusViewFrame *nautilus_view_frame_new (BonoboUIHandler *ui_handler,
+ NautilusUndoManager *undo_manager);
+gboolean nautilus_view_frame_load_client (NautilusViewFrame *view,
+ const char *iid);
+const char * nautilus_view_frame_get_iid (NautilusViewFrame *view);
+CORBA_Object nautilus_view_frame_get_client_objref (NautilusViewFrame *view);
+BonoboObject * nautilus_view_frame_get_control_frame (NautilusViewFrame *view);
+CORBA_Object nautilus_view_frame_get_objref (NautilusViewFrame *view);
/* These functions correspond to methods of the Nautilus:View CORBAinterface. */
-void nautilus_view_frame_load_location (NautilusViewFrame *view,
- const char *location);
-void nautilus_view_frame_stop_loading (NautilusViewFrame *view);
-void nautilus_view_frame_selection_changed (NautilusViewFrame *view,
- GList *selection);
+void nautilus_view_frame_load_location (NautilusViewFrame *view,
+ const char *location);
+void nautilus_view_frame_stop_loading (NautilusViewFrame *view);
+void nautilus_view_frame_selection_changed (NautilusViewFrame *view,
+ GList *selection);
/* Nautilus:Zoomable */
-gboolean nautilus_view_frame_is_zoomable (NautilusViewFrame *view);
-gdouble nautilus_view_frame_get_zoom_level (NautilusViewFrame *view);
-void nautilus_view_frame_set_zoom_level (NautilusViewFrame *view,
- double zoom_level);
-gdouble nautilus_view_frame_get_min_zoom_level (NautilusViewFrame *view);
-gdouble nautilus_view_frame_get_max_zoom_level (NautilusViewFrame *view);
-gboolean nautilus_view_frame_get_is_continuous (NautilusViewFrame *view);
-GList * nautilus_view_frame_get_preferred_zoom_levels
- (NautilusViewFrame *view);
-
-void nautilus_view_frame_zoom_in (NautilusViewFrame *view);
-void nautilus_view_frame_zoom_out (NautilusViewFrame *view);
-void nautilus_view_frame_zoom_to_fit (NautilusViewFrame *view);
+gboolean nautilus_view_frame_is_zoomable (NautilusViewFrame *view);
+gdouble nautilus_view_frame_get_zoom_level (NautilusViewFrame *view);
+void nautilus_view_frame_set_zoom_level (NautilusViewFrame *view,
+ double zoom_level);
+gdouble nautilus_view_frame_get_min_zoom_level (NautilusViewFrame *view);
+gdouble nautilus_view_frame_get_max_zoom_level (NautilusViewFrame *view);
+gboolean nautilus_view_frame_get_is_continuous (NautilusViewFrame *view);
+GList * nautilus_view_frame_get_preferred_zoom_levels
+ (NautilusViewFrame *view);
+
+void nautilus_view_frame_zoom_in (NautilusViewFrame *view);
+void nautilus_view_frame_zoom_out (NautilusViewFrame *view);
+void nautilus_view_frame_zoom_to_fit (NautilusViewFrame *view);
/* Other. */
-void nautilus_view_frame_set_active_errors (NautilusViewFrame *view,
- gboolean enabled);
-char * nautilus_view_frame_get_label (NautilusViewFrame *view);
-void nautilus_view_frame_set_label (NautilusViewFrame *view,
- const char *label);
-void nautilus_view_frame_activate (NautilusViewFrame *view);
+void nautilus_view_frame_set_active_errors (NautilusViewFrame *view,
+ gboolean enabled);
+char * nautilus_view_frame_get_label (NautilusViewFrame *view);
+void nautilus_view_frame_set_label (NautilusViewFrame *view,
+ const char *label);
+void nautilus_view_frame_activate (NautilusViewFrame *view);
+
+Nautilus_HistoryList *nautilus_view_frame_get_history_list (NautilusViewFrame *view);
#ifdef __cplusplus
}
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 686cfd28a..07d171ed5 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1167,6 +1167,50 @@ nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
}
}
+static void
+nautilus_window_get_history_list_callback (NautilusViewFrame *view,
+ Nautilus_HistoryList **out_list,
+ NautilusWindow *window)
+{
+ Nautilus_HistoryList *local_list;
+ Nautilus_HistoryItem *history_item;
+ NautilusBookmark *bookmark;
+ int length, index;
+ GSList *element;
+ char *name, *location;
+
+ /* Get total number of history items */
+ length = g_slist_length (history_list);
+ if (length <= 0) {
+ *out_list = NULL;
+ return;
+ }
+
+ local_list = Nautilus_HistoryList__alloc ();
+ local_list->_length = length;
+ local_list->_maximum = length;
+ local_list->_buffer = CORBA_sequence_Nautilus_HistoryItem_allocbuf (length);
+
+ /* Iterate through list and copy item data */
+ for (index = 0, element = history_list; index < length; index++, element = element->next) {
+ bookmark = element->data;
+ name = nautilus_bookmark_get_name (bookmark);
+ location = nautilus_bookmark_get_uri (bookmark);
+
+ history_item = &local_list->_buffer[index];
+ history_item->name = CORBA_string_dup (name);
+ history_item->location = CORBA_string_dup (location);
+
+ history_item->position = index;
+
+ g_free (name);
+ g_free (location);
+ }
+ CORBA_sequence_set_release (local_list, CORBA_TRUE);
+
+ *out_list = local_list;
+}
+
void
nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
{
@@ -1187,6 +1231,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (zoom_level_changed);
+ CONNECT (get_history_list);
#undef CONNECT