Commit 1bec035f authored by John Sullivan's avatar John Sullivan

Moved toolbar code into its own file.

parent aa98d924
2000-03-17 John Sullivan <sullivan@eazel.com>
Separate out toolbar code as first step towards
bonobo-izing it.
* src/nautilus-window-toolbars.c: New file
* src/Makefile.am: put new file in build.
* src/ntl-window-private.h: prototype for
nautilus_window_initialize_toolbars
* src/ntl-window.c: Moved toolbar stuff out of here
and into new file.
2000-03-17 Pavel Cisler <pavel@eazel.com>
Fix some bugs that John kindly uncovered.
......@@ -13,7 +25,7 @@
* libnautilus/nautilus-list-column-title.c
(nautilus_list_column_title_paint):
Make the resize indicator draw on the other side of the column title
Make the sort indicator draw on the other side of the column title
as it should.
Tweak an assert.
......
......@@ -31,10 +31,18 @@ nautilus_SOURCES =\
nautilus-bookmark-list.h \
nautilus-bookmarks-window.c \
nautilus-bookmarks-window.h \
nautilus-index-tabs.c \
nautilus-index-tabs.h \
nautilus-index-title.c \
nautilus-index-title.h \
nautilus-location-bar.c \
nautilus-location-bar.h \
nautilus-self-check-functions.c \
nautilus-self-check-functions.h \
nautilus-signaller.c \
nautilus-signaller.h \
nautilus-window-menus.c \
nautilus-window-toolbars.c \
nautilus-zoom-control.c \
nautilus-zoom-control.h \
nautilus-zoomable-frame-svr.c \
......@@ -66,13 +74,6 @@ nautilus_SOURCES =\
ntl-window-state.h \
ntl-window.c \
ntl-window.h \
nautilus-index-tabs.c \
nautilus-index-tabs.h \
nautilus-index-title.c \
nautilus-index-title.h \
nautilus-self-check-functions.c \
nautilus-self-check-functions.h \
nautilus-window-menus.c \
$(NULL)
TESTS=check-nautilus
......
......@@ -175,8 +175,6 @@ impl_Nautilus_ViewWindow__create(NautilusWindow *window)
static void nautilus_window_class_init (NautilusWindowClass *klass);
static void nautilus_window_init (NautilusWindow *window);
static void nautilus_window_destroy (NautilusWindow *window);
static void nautilus_window_reload (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_stop (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
......@@ -195,43 +193,6 @@ static void zoom_out_cb (NautilusZoomControl *zoom_control,
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
/* toolbar definitions */
#define TOOLBAR_BACK_BUTTON_INDEX 0
#define TOOLBAR_FORWARD_BUTTON_INDEX 1
#define TOOLBAR_UP_BUTTON_INDEX 2
#define TOOLBAR_RELOAD_BUTTON_INDEX 3
/* separator */
#define TOOLBAR_HOME_BUTTON_INDEX 5
/* separator */
#define TOOLBAR_STOP_BUTTON_INDEX 7
static GnomeUIInfo toolbar_info[] = {
GNOMEUIINFO_ITEM_STOCK
(N_("Back"), N_("Go to the previously visited directory"),
nautilus_window_back_cb, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK
(N_("Forward"), N_("Go to the next directory"),
nautilus_window_forward_cb, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_ITEM_STOCK
(N_("Up"), N_("Go up a level in the directory heirarchy"),
nautilus_window_up_cb, GNOME_STOCK_PIXMAP_UP),
GNOMEUIINFO_ITEM_STOCK
(N_("Reload"), N_("Reload this view"),
nautilus_window_reload, GNOME_STOCK_PIXMAP_REFRESH),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Home"), N_("Go to your home directory"),
nautilus_window_home_cb, GNOME_STOCK_PIXMAP_HOME),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Stop"), N_("Interrupt loading"),
nautilus_window_stop, GNOME_STOCK_PIXMAP_STOP),
GNOMEUIINFO_END
};
GtkType
nautilus_window_get_type(void)
......@@ -491,15 +452,9 @@ nautilus_window_constructed(NautilusWindow *window)
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GtkWidget *toolbar;
app = GNOME_APP(window);
/* set up toolbar */
toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
gnome_app_fill_toolbar_with_data(GTK_TOOLBAR(toolbar), toolbar_info, app->accel_group, app);
gnome_app_set_toolbar(app, GTK_TOOLBAR(toolbar));
/* set up location bar */
location_bar_box = gtk_hbox_new(FALSE, GNOME_PAD);
......@@ -581,18 +536,11 @@ nautilus_window_constructed(NautilusWindow *window)
window->ntl_viewwindow = impl_Nautilus_ViewWindow__create(window);
window->uih = bonobo_ui_handler_new();
bonobo_ui_handler_set_app(window->uih, app);
bonobo_ui_handler_set_toolbar(window->uih, "Main", toolbar);
bonobo_ui_handler_set_statusbar(window->uih, statusbar);
/* Create menus */
/* Create menus and toolbars */
nautilus_window_initialize_menus (window);
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
nautilus_window_initialize_toolbars (window);
gtk_signal_connect (GTK_OBJECT (window->back_button),
"button_press_event",
......@@ -912,29 +860,12 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
g_free (parent_uri_string);
}
static void
nautilus_window_reload (GtkWidget *btn, NautilusWindow *window)
{
Nautilus_NavigationRequestInfo nri;
memset(&nri, 0, sizeof(nri));
nri.requested_uri = (char *)nautilus_window_get_requested_uri(window);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE, TRUE);
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
......
......@@ -175,8 +175,6 @@ impl_Nautilus_ViewWindow__create(NautilusWindow *window)
static void nautilus_window_class_init (NautilusWindowClass *klass);
static void nautilus_window_init (NautilusWindow *window);
static void nautilus_window_destroy (NautilusWindow *window);
static void nautilus_window_reload (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_stop (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
......@@ -195,43 +193,6 @@ static void zoom_out_cb (NautilusZoomControl *zoom_control,
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
/* toolbar definitions */
#define TOOLBAR_BACK_BUTTON_INDEX 0
#define TOOLBAR_FORWARD_BUTTON_INDEX 1
#define TOOLBAR_UP_BUTTON_INDEX 2
#define TOOLBAR_RELOAD_BUTTON_INDEX 3
/* separator */
#define TOOLBAR_HOME_BUTTON_INDEX 5
/* separator */
#define TOOLBAR_STOP_BUTTON_INDEX 7
static GnomeUIInfo toolbar_info[] = {
GNOMEUIINFO_ITEM_STOCK
(N_("Back"), N_("Go to the previously visited directory"),
nautilus_window_back_cb, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK
(N_("Forward"), N_("Go to the next directory"),
nautilus_window_forward_cb, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_ITEM_STOCK
(N_("Up"), N_("Go up a level in the directory heirarchy"),
nautilus_window_up_cb, GNOME_STOCK_PIXMAP_UP),
GNOMEUIINFO_ITEM_STOCK
(N_("Reload"), N_("Reload this view"),
nautilus_window_reload, GNOME_STOCK_PIXMAP_REFRESH),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Home"), N_("Go to your home directory"),
nautilus_window_home_cb, GNOME_STOCK_PIXMAP_HOME),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Stop"), N_("Interrupt loading"),
nautilus_window_stop, GNOME_STOCK_PIXMAP_STOP),
GNOMEUIINFO_END
};
GtkType
nautilus_window_get_type(void)
......@@ -491,15 +452,9 @@ nautilus_window_constructed(NautilusWindow *window)
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GtkWidget *toolbar;
app = GNOME_APP(window);
/* set up toolbar */
toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
gnome_app_fill_toolbar_with_data(GTK_TOOLBAR(toolbar), toolbar_info, app->accel_group, app);
gnome_app_set_toolbar(app, GTK_TOOLBAR(toolbar));
/* set up location bar */
location_bar_box = gtk_hbox_new(FALSE, GNOME_PAD);
......@@ -581,18 +536,11 @@ nautilus_window_constructed(NautilusWindow *window)
window->ntl_viewwindow = impl_Nautilus_ViewWindow__create(window);
window->uih = bonobo_ui_handler_new();
bonobo_ui_handler_set_app(window->uih, app);
bonobo_ui_handler_set_toolbar(window->uih, "Main", toolbar);
bonobo_ui_handler_set_statusbar(window->uih, statusbar);
/* Create menus */
/* Create menus and toolbars */
nautilus_window_initialize_menus (window);
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
nautilus_window_initialize_toolbars (window);
gtk_signal_connect (GTK_OBJECT (window->back_button),
"button_press_event",
......@@ -912,29 +860,12 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
g_free (parent_uri_string);
}
static void
nautilus_window_reload (GtkWidget *btn, NautilusWindow *window)
{
Nautilus_NavigationRequestInfo nri;
memset(&nri, 0, sizeof(nri));
nri.requested_uri = (char *)nautilus_window_get_requested_uri(window);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE, TRUE);
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
......
......@@ -175,8 +175,6 @@ impl_Nautilus_ViewWindow__create(NautilusWindow *window)
static void nautilus_window_class_init (NautilusWindowClass *klass);
static void nautilus_window_init (NautilusWindow *window);
static void nautilus_window_destroy (NautilusWindow *window);
static void nautilus_window_reload (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_stop (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
......@@ -195,43 +193,6 @@ static void zoom_out_cb (NautilusZoomControl *zoom_control,
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
/* toolbar definitions */
#define TOOLBAR_BACK_BUTTON_INDEX 0
#define TOOLBAR_FORWARD_BUTTON_INDEX 1
#define TOOLBAR_UP_BUTTON_INDEX 2
#define TOOLBAR_RELOAD_BUTTON_INDEX 3
/* separator */
#define TOOLBAR_HOME_BUTTON_INDEX 5
/* separator */
#define TOOLBAR_STOP_BUTTON_INDEX 7
static GnomeUIInfo toolbar_info[] = {
GNOMEUIINFO_ITEM_STOCK
(N_("Back"), N_("Go to the previously visited directory"),
nautilus_window_back_cb, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK
(N_("Forward"), N_("Go to the next directory"),
nautilus_window_forward_cb, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_ITEM_STOCK
(N_("Up"), N_("Go up a level in the directory heirarchy"),
nautilus_window_up_cb, GNOME_STOCK_PIXMAP_UP),
GNOMEUIINFO_ITEM_STOCK
(N_("Reload"), N_("Reload this view"),
nautilus_window_reload, GNOME_STOCK_PIXMAP_REFRESH),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Home"), N_("Go to your home directory"),
nautilus_window_home_cb, GNOME_STOCK_PIXMAP_HOME),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Stop"), N_("Interrupt loading"),
nautilus_window_stop, GNOME_STOCK_PIXMAP_STOP),
GNOMEUIINFO_END
};
GtkType
nautilus_window_get_type(void)
......@@ -491,15 +452,9 @@ nautilus_window_constructed(NautilusWindow *window)
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GtkWidget *toolbar;
app = GNOME_APP(window);
/* set up toolbar */
toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
gnome_app_fill_toolbar_with_data(GTK_TOOLBAR(toolbar), toolbar_info, app->accel_group, app);
gnome_app_set_toolbar(app, GTK_TOOLBAR(toolbar));
/* set up location bar */
location_bar_box = gtk_hbox_new(FALSE, GNOME_PAD);
......@@ -581,18 +536,11 @@ nautilus_window_constructed(NautilusWindow *window)
window->ntl_viewwindow = impl_Nautilus_ViewWindow__create(window);
window->uih = bonobo_ui_handler_new();
bonobo_ui_handler_set_app(window->uih, app);
bonobo_ui_handler_set_toolbar(window->uih, "Main", toolbar);
bonobo_ui_handler_set_statusbar(window->uih, statusbar);
/* Create menus */
/* Create menus and toolbars */
nautilus_window_initialize_menus (window);
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
nautilus_window_initialize_toolbars (window);
gtk_signal_connect (GTK_OBJECT (window->back_button),
"button_press_event",
......@@ -912,29 +860,12 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
g_free (parent_uri_string);
}
static void
nautilus_window_reload (GtkWidget *btn, NautilusWindow *window)
{
Nautilus_NavigationRequestInfo nri;
memset(&nri, 0, sizeof(nri));
nri.requested_uri = (char *)nautilus_window_get_requested_uri(window);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE, TRUE);
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
......
......@@ -49,6 +49,7 @@ GSList *nautilus_get_history_list (void);
void nautilus_window_add_bookmark_for_current_location (NautilusWindow *window);
void nautilus_window_edit_bookmarks (NautilusWindow *window);
void nautilus_window_initialize_menus (NautilusWindow *window);
void nautilus_window_initialize_toolbars (NautilusWindow *window);
void nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window);
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-window-toolbars.c - implementation of nautilus window toolbar operations,
split into separate file just for convenience.
Copyright (C) 2000 Eazel, Inc.
The Gnome 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.
The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: John Sullivan <sullivan@eazel.com>
*/
#include "ntl-window-private.h"
#include "ntl-app.h"
#include <gnome.h>
/* forward declarations */
static void nautilus_window_reload_cb (GtkWidget *widget, NautilusWindow *window);
static void nautilus_window_stop_cb (GtkWidget *widget, NautilusWindow *window);
/* toolbar definitions */
#define TOOLBAR_BACK_BUTTON_INDEX 0
#define TOOLBAR_FORWARD_BUTTON_INDEX 1
#define TOOLBAR_UP_BUTTON_INDEX 2
#define TOOLBAR_RELOAD_BUTTON_INDEX 3
/* separator */
#define TOOLBAR_HOME_BUTTON_INDEX 5
/* separator */
#define TOOLBAR_STOP_BUTTON_INDEX 7
static GnomeUIInfo toolbar_info[] = {
GNOMEUIINFO_ITEM_STOCK
(N_("Back"), N_("Go to the previously visited directory"),
nautilus_window_back_cb, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK
(N_("Forward"), N_("Go to the next directory"),
nautilus_window_forward_cb, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_ITEM_STOCK
(N_("Up"), N_("Go up a level in the directory heirarchy"),
nautilus_window_up_cb, GNOME_STOCK_PIXMAP_UP),
GNOMEUIINFO_ITEM_STOCK
(N_("Reload"), N_("Reload this view"),
nautilus_window_reload_cb, GNOME_STOCK_PIXMAP_REFRESH),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Home"), N_("Go to your home directory"),
nautilus_window_home_cb, GNOME_STOCK_PIXMAP_HOME),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Stop"), N_("Interrupt loading"),
nautilus_window_stop_cb, GNOME_STOCK_PIXMAP_STOP),
GNOMEUIINFO_END
};
void
nautilus_window_initialize_toolbars (NautilusWindow *window)
{
GnomeApp *app;
GtkWidget *toolbar;
app = GNOME_APP (window);
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), toolbar_info, app->accel_group, app);
gnome_app_set_toolbar (app, GTK_TOOLBAR (toolbar));
bonobo_ui_handler_set_toolbar (window->uih, "Main", toolbar);
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
}
static void
nautilus_window_reload_cb (GtkWidget *widget, NautilusWindow *window)
{
Nautilus_NavigationRequestInfo nri;
memset(&nri, 0, sizeof(nri));
nri.requested_uri = (char *)nautilus_window_get_requested_uri (window);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location (window, &nri, NULL, FALSE, TRUE);
}
static void
nautilus_window_stop_cb (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_set_state_info (window, RESET_TO_IDLE, 0);
}
......@@ -175,8 +175,6 @@ impl_Nautilus_ViewWindow__create(NautilusWindow *window)
static void nautilus_window_class_init (NautilusWindowClass *klass);
static void nautilus_window_init (NautilusWindow *window);
static void nautilus_window_destroy (NautilusWindow *window);
static void nautilus_window_reload (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_stop (GtkWidget *btn, NautilusWindow *window);
static void nautilus_window_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
......@@ -195,43 +193,6 @@ static void zoom_out_cb (NautilusZoomControl *zoom_control,
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
/* toolbar definitions */
#define TOOLBAR_BACK_BUTTON_INDEX 0
#define TOOLBAR_FORWARD_BUTTON_INDEX 1
#define TOOLBAR_UP_BUTTON_INDEX 2
#define TOOLBAR_RELOAD_BUTTON_INDEX 3
/* separator */
#define TOOLBAR_HOME_BUTTON_INDEX 5
/* separator */
#define TOOLBAR_STOP_BUTTON_INDEX 7
static GnomeUIInfo toolbar_info[] = {
GNOMEUIINFO_ITEM_STOCK
(N_("Back"), N_("Go to the previously visited directory"),
nautilus_window_back_cb, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK
(N_("Forward"), N_("Go to the next directory"),
nautilus_window_forward_cb, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_ITEM_STOCK
(N_("Up"), N_("Go up a level in the directory heirarchy"),
nautilus_window_up_cb, GNOME_STOCK_PIXMAP_UP),
GNOMEUIINFO_ITEM_STOCK
(N_("Reload"), N_("Reload this view"),
nautilus_window_reload, GNOME_STOCK_PIXMAP_REFRESH),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Home"), N_("Go to your home directory"),
nautilus_window_home_cb, GNOME_STOCK_PIXMAP_HOME),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Stop"), N_("Interrupt loading"),
nautilus_window_stop, GNOME_STOCK_PIXMAP_STOP),
GNOMEUIINFO_END
};
GtkType
nautilus_window_get_type(void)
......@@ -491,15 +452,9 @@ nautilus_window_constructed(NautilusWindow *window)
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GtkWidget *toolbar;
app = GNOME_APP(window);
/* set up toolbar */
toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
gnome_app_fill_toolbar_with_data(GTK_TOOLBAR(toolbar), toolbar_info, app->accel_group, app);
gnome_app_set_toolbar(app, GTK_TOOLBAR(toolbar));
/* set up location bar */
location_bar_box = gtk_hbox_new(FALSE, GNOME_PAD);
......@@ -581,18 +536,11 @@ nautilus_window_constructed(NautilusWindow *window)
window->ntl_viewwindow = impl_Nautilus_ViewWindow__create(window);
window->uih = bonobo_ui_handler_new();
bonobo_ui_handler_set_app(window->uih, app);
bonobo_ui_handler_set_toolbar(window->uih, "Main", toolbar);
bonobo_ui_handler_set_statusbar(window->uih, statusbar);
/* Create menus */
/* Create menus and toolbars */
nautilus_window_initialize_menus (window);
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
nautilus_window_initialize_toolbars (window);
gtk_signal_connect (GTK_OBJECT (window->back_button),
"button_press_event",
......@@ -912,29 +860,12 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
g_free (parent_uri_string);
}
static void
nautilus_window_reload (GtkWidget *btn, NautilusWindow *window)
{
Nautilus_NavigationRequestInfo nri;
memset(&nri, 0, sizeof(nri));
nri.requested_uri = (char *)nautilus_window_get_requested_uri(window);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE, TRUE);
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
......
......@@ -49,6 +49,7 @@ GSList *nautilus_get_history_list (void);