Commit 5d20d56e authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Patch from Jamie McCracken <jamiemcc@blueyonder.co.uk>

2005-07-08  Alexander Larsson  <alexl@redhat.com>

        Patch from Jamie McCracken <jamiemcc@blueyonder.co.uk>

	* src/Makefile.am:
	* src/nautilus-pathbar.[ch]:
	New pathbar widget. Based on code from gtk.

	* src/nautilus-navigation-window.[ch]:
	* src/nautilus-window-manage-views.c:
	* src/nautilus-window-private.h:
	Use pathbar in browser window.

	* libnautilus-private/apps_nautilus_preferences.schemas.in:
	* libnautilus-private/nautilus-global-preferences.[ch]:
	Add always_use_location_entry prefs.

	* src/nautilus-navigation-window-menus.c:
	Whitespace fixup.
parent ae70afe4
2005-07-08 Alexander Larsson <alexl@redhat.com>
Patch from Jamie McCracken <jamiemcc@blueyonder.co.uk>
* src/Makefile.am:
* src/nautilus-pathbar.[ch]:
New pathbar widget. Based on code from gtk.
* src/nautilus-navigation-window.[ch]:
* src/nautilus-window-manage-views.c:
* src/nautilus-window-private.h:
Use pathbar in browser window.
* libnautilus-private/apps_nautilus_preferences.schemas.in:
* libnautilus-private/nautilus-global-preferences.[ch]:
Add always_use_location_entry prefs.
* src/nautilus-navigation-window-menus.c:
Whitespace fixup.
2005-07-07 Joe Shaw <joeshaw@novell.com>
* configure.in: Bump required gnome-vfs version up to
......
......@@ -52,6 +52,21 @@
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/nautilus/preferences/always_use_location_entry</key>
<applyto>/apps/nautilus/preferences/always_use_location_entry</applyto>
<owner>nautilus</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Always use the location entry, instead of the pathbar</short>
<long>
If set to true, then Nautilus browser windows will always use a textual
input entry for the location toolbar, instead of the pathbar.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/nautilus/preferences/confirm_trash</key>
......
......@@ -394,6 +394,10 @@ static const PreferenceDefault preference_defaults[] = {
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)
......
......@@ -82,6 +82,7 @@ typedef enum
/* Which views should be displayed for new windows */
#define NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR "preferences/start_with_location_bar"
#define NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY "preferences/always_use_location_entry"
#define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR "preferences/start_with_status_bar"
#define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR "preferences/start_with_sidebar"
#define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW "preferences/side_pane_view"
......
2005-07-08 Alexander Larsson <alexl@redhat.com>
* POTFILES.in:
Added src/nautilus-pathbar.c
2005-07-08 Priit Laes <plaes@cvs.gnome.org>
* et.po: Translation updated by Ivar Smolin.
......
......@@ -73,6 +73,7 @@ src/nautilus-navigation-window-menus.c
src/nautilus-navigation-window-ui.xml
src/nautilus-navigation-window.c
src/nautilus-notes-viewer.c
src/nautilus-pathbar.c
src/nautilus-places-sidebar.c
src/nautilus-property-browser.c
src/nautilus-shell-ui.xml
......
......@@ -93,6 +93,8 @@ nautilus_SOURCES = \
nautilus-navigation-window.h \
nautilus-notes-viewer.c \
nautilus-notes-viewer.h \
nautilus-pathbar.c \
nautilus-pathbar.h \
nautilus-places-sidebar.c \
nautilus-places-sidebar.h \
nautilus-property-browser.c \
......
......@@ -423,12 +423,12 @@ static const GtkToggleActionEntry navigation_toggle_entries[] = {
N_("Location _Bar"), NULL, /* label, accelerator */
N_("Change the visibility of this window's location bar"), /* tooltip */
G_CALLBACK (action_show_hide_location_bar_callback),
TRUE }, /* is_active */
TRUE}, /* is_active */
{ "Show Hide Statusbar", NULL, /* name, stock id */
N_("St_atusbar"), NULL, /* label, accelerator */
N_("Change the visibility of this window's statusbar"), /* tooltip */
G_CALLBACK (action_show_hide_statusbar_callback),
TRUE }, /* is_active */
TRUE}, /* is_active */
};
void
......
......@@ -37,6 +37,7 @@
#include "nautilus-main.h"
#include "nautilus-signaller.h"
#include "nautilus-location-bar.h"
#include "nautilus-pathbar.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-zoom-control.h"
#include <eel/eel-accessibility.h>
......@@ -81,6 +82,7 @@
#include <math.h>
#include <sys/time.h>
/* FIXME bugzilla.gnome.org 41243:
* We should use inheritance instead of these special cases
* for the desktop window.
......@@ -110,6 +112,10 @@ static void side_panel_image_changed_callback (NautilusSidebar *
static void navigation_bar_location_changed_callback (GtkWidget *widget,
const char *uri,
NautilusNavigationWindow *window);
static void path_bar_location_changed_callback (GtkWidget *widget,
const char *uri,
NautilusNavigationWindow *window);
static void always_use_location_entry_changed (gpointer callback_data);
GNOME_CLASS_BOILERPLATE (NautilusNavigationWindow, nautilus_navigation_window,
......@@ -123,6 +129,7 @@ nautilus_navigation_window_instance_init (NautilusNavigationWindow *window)
GtkWidget *location_bar;
GtkWidget *view_as_menu_vbox;
GtkToolItem *item;
GtkWidget *hbox;
window->details = g_new0 (NautilusNavigationWindowDetails, 1);
......@@ -141,7 +148,7 @@ nautilus_navigation_window_instance_init (NautilusNavigationWindow *window)
nautilus_navigation_window_initialize_actions (window);
nautilus_navigation_window_initialize_menus (window);
ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
toolbar = gtk_ui_manager_get_widget (ui_manager, "/Toolbar");
window->details->toolbar = toolbar;
......@@ -164,22 +171,36 @@ nautilus_navigation_window_instance_init (NautilusNavigationWindow *window)
/* set up location bar */
location_bar = gtk_toolbar_new ();
window->details->location_bar = location_bar;
window->navigation_bar = nautilus_location_bar_new (window);
gtk_widget_show (GTK_WIDGET (window->navigation_bar));
g_signal_connect_object (window->navigation_bar, "location_changed",
G_CALLBACK (navigation_bar_location_changed_callback), window, 0);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
item = gtk_tool_item_new ();
gtk_container_set_border_width (GTK_CONTAINER (item), GNOME_PAD_SMALL);
gtk_widget_show (GTK_WIDGET (item));
gtk_tool_item_set_expand (item, TRUE);
gtk_container_add (GTK_CONTAINER (item), window->navigation_bar);
gtk_container_add (GTK_CONTAINER (item), hbox);
gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
item, -1);
window->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
gtk_widget_show (window->path_bar);
g_signal_connect_object (window->path_bar, "path_clicked",
G_CALLBACK (path_bar_location_changed_callback), window, 0);
gtk_box_pack_start (GTK_BOX (hbox),
window->path_bar,
TRUE, TRUE, 0);
window->navigation_bar = nautilus_location_bar_new (window);
g_signal_connect_object (window->navigation_bar, "location_changed",
G_CALLBACK (navigation_bar_location_changed_callback), window, 0);
gtk_box_pack_start (GTK_BOX (hbox),
window->navigation_bar,
TRUE, TRUE, 0);
/* Option menu for content view types; it's empty here, filled in when a uri is set.
* Pack it into vbox so it doesn't grow vertically when location bar does.
*/
......@@ -229,10 +250,37 @@ nautilus_navigation_window_instance_init (NautilusNavigationWindow *window)
0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
always_use_location_entry_changed,
window, G_OBJECT (window));
}
static void
always_use_location_entry_changed (gpointer callback_data)
{
NautilusNavigationWindow *window;
window = NAUTILUS_NAVIGATION_WINDOW (callback_data);
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
nautilus_navigation_window_hide_path_bar (window);
} else {
nautilus_navigation_window_show_path_bar (window);
}
}
static void
path_bar_location_changed_callback (GtkWidget *widget,
const char *uri,
NautilusNavigationWindow *window)
{
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
}
static void
navigation_bar_location_changed_callback (GtkWidget *widget,
const char *uri,
......@@ -240,13 +288,20 @@ navigation_bar_location_changed_callback (GtkWidget *widget,
{
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
if (window->details->temporary_navigation_bar) {
if (window->details->temporary_location_bar) {
if (nautilus_navigation_window_location_bar_showing (window)) {
nautilus_navigation_window_hide_location_bar (window, FALSE);
}
window->details->temporary_location_bar = FALSE;
}
if (window->details->temporary_navigation_bar) {
if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
nautilus_navigation_window_show_path_bar (window);
}
window->details->temporary_navigation_bar = FALSE;
}
nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
}
......@@ -418,10 +473,11 @@ nautilus_navigation_window_destroy (GtkObject *object)
window->view_as_option_menu = NULL;
window->navigation_bar = NULL;
window->path_bar = NULL;
window->zoom_control = NULL;
window->details->content_paned = NULL;
if (window->details->tooltips) {
g_object_unref (G_OBJECT (window->details->tooltips));
window->details->tooltips = NULL;
......@@ -733,10 +789,11 @@ static void
real_set_content_view_widget (NautilusWindow *nautilus_window,
NautilusView *new_view)
{
NautilusNavigationWindow *window;
NautilusNavigationWindow *window;
window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
disconnect_view (window, nautilus_window->content_view);
EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
......@@ -783,6 +840,10 @@ nautilus_navigation_window_show_location_bar_temporarily (NautilusNavigationWind
{
if (!nautilus_navigation_window_location_bar_showing (window)) {
nautilus_navigation_window_show_location_bar (window, FALSE);
window->details->temporary_location_bar = TRUE;
}
if (nautilus_navigation_window_path_bar_showing (window)) {
nautilus_navigation_window_hide_path_bar (window);
window->details->temporary_navigation_bar = TRUE;
}
nautilus_navigation_bar_activate
......@@ -871,7 +932,7 @@ add_sidebar_panels (NautilusNavigationWindow *window)
void
nautilus_navigation_window_hide_location_bar (NautilusNavigationWindow *window, gboolean save_preference)
{
window->details->temporary_navigation_bar = FALSE;
window->details->temporary_location_bar = FALSE;
gtk_widget_hide (window->details->location_bar);
nautilus_navigation_window_update_show_hide_menu_items (window);
if (save_preference &&
......@@ -901,6 +962,31 @@ nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *windo
return TRUE;
}
void
nautilus_navigation_window_hide_path_bar (NautilusNavigationWindow *window)
{
window->details->temporary_navigation_bar = FALSE;
gtk_widget_hide (window->path_bar);
gtk_widget_show (window->navigation_bar);
}
void
nautilus_navigation_window_show_path_bar (NautilusNavigationWindow *window)
{
gtk_widget_show (window->path_bar);
gtk_widget_hide (window->navigation_bar);
}
gboolean
nautilus_navigation_window_path_bar_showing (NautilusNavigationWindow *window)
{
if (window->path_bar != NULL) {
return GTK_WIDGET_VISIBLE (window->path_bar);
}
/* If we're not visible yet we haven't changed visibility, so its TRUE */
return TRUE;
}
gboolean
nautilus_navigation_window_toolbar_showing (NautilusNavigationWindow *window)
{
......@@ -1012,6 +1098,8 @@ nautilus_navigation_window_get_base_page_index (NautilusNavigationWindow *window
return forward_count;
}
/**
* nautilus_navigation_window_show:
* @widget: GtkWidget
......@@ -1035,6 +1123,12 @@ nautilus_navigation_window_show (GtkWidget *widget)
nautilus_navigation_window_hide_location_bar (window, FALSE);
}
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
nautilus_navigation_window_hide_path_bar (window);
} else {
nautilus_navigation_window_show_path_bar (window);
}
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_SIDEBAR)) {
nautilus_navigation_window_show_sidebar (window);
} else {
......
......@@ -31,6 +31,7 @@
#define NAUTILUS_NAVIGATION_WINDOW_H
#include <bonobo/bonobo-window.h>
#include <gtk/gtktoolitem.h>
#include <eel/eel-glib-extensions.h>
#include <libnautilus-private/nautilus-bookmark.h>
#include <libnautilus-private/nautilus-sidebar.h>
......@@ -47,7 +48,7 @@
typedef struct _NautilusNavigationWindow NautilusNavigationWindow;
typedef struct _NautilusNavigationWindowClass NautilusNavigationWindowClass;
typedef struct _NautilusNavigationWindowDetails NautilusNavigationWindowDetails;
typedef struct _NautilusNavigationWindowDetails NautilusNavigationWindowDetails;
struct _NautilusNavigationWindow {
NautilusWindow parent_object;
......@@ -58,7 +59,8 @@ struct _NautilusNavigationWindow {
NautilusSidePane *sidebar;
GtkWidget *view_as_option_menu;
GtkWidget *navigation_bar;
GtkWidget *path_bar;
/* Back/Forward chain, and history list.
* The data in these lists are NautilusBookmark pointers.
*/
......@@ -90,6 +92,11 @@ void nautilus_navigation_window_hide_location_bar (NautilusNavigationWind
gboolean save_preference);
void nautilus_navigation_window_show_location_bar (NautilusNavigationWindow *window,
gboolean save_preference);
void nautilus_navigation_window_hide_path_bar (NautilusNavigationWindow *window);
void nautilus_navigation_window_show_path_bar (NautilusNavigationWindow *window);
gboolean nautilus_navigation_window_path_bar_showing (NautilusNavigationWindow *window);
gboolean nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *window);
void nautilus_navigation_window_hide_toolbar (NautilusNavigationWindow *window);
void nautilus_navigation_window_show_toolbar (NautilusNavigationWindow *window);
......
This diff is collapsed.
/* nautilus-pathbar.h
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*
*/
#ifndef NAUTILUS_PATHBAR_H
#define NAUTILUS_PATHBAR_H
#include <gtk/gtkcontainer.h>
typedef struct _NautilusPathBar NautilusPathBar;
typedef struct _NautilusPathBarClass NautilusPathBarClass;
#define NAUTILUS_TYPE_PATH_BAR (nautilus_path_bar_get_type ())
#define NAUTILUS_PATH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_PATH_BAR, NautilusPathBar))
#define NAUTILUS_PATH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PATH_BAR, NautilusPathBarClass))
#define NAUTILUS_IS_PATH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_PATH_BAR))
#define NAUTILUS_IS_PATH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PATH_BAR))
#define NAUTILUS_PATH_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_PATH_BAR, NautilusPathBarClass))
struct _NautilusPathBar
{
GtkContainer parent;
char *root_path;
char *home_path;
char *desktop_path;
GdkPixbuf *root_icon;
GdkPixbuf *home_icon;
GdkPixbuf *desktop_icon;
GList *button_list;
GList *first_scrolled_button;
GList *fake_root;
GtkWidget *up_slider_button;
GtkWidget *down_slider_button;
guint settings_signal_id;
gint icon_size;
gint16 slider_width;
gint16 spacing;
gint16 button_offset;
guint timer;
guint slider_visible : 1;
guint need_timer : 1;
guint ignore_click : 1;
};
struct _NautilusPathBarClass
{
GtkContainerClass parent_class;
void (* path_clicked) (NautilusPathBar *path_bar,
const char *file_path);
};
GType nautilus_path_bar_get_type (void) G_GNUC_CONST;
gboolean nautilus_path_bar_set_path (NautilusPathBar *path_bar, const char *file_path);
void nautilus_path_bar_up (NautilusPathBar *path_bar);
void nautilus_path_bar_down (NautilusPathBar *path_bar);
#endif /* NAUTILUS_PATHBAR_H */
......@@ -31,6 +31,7 @@
#include "nautilus-actions.h"
#include "nautilus-application.h"
#include "nautilus-location-bar.h"
#include "nautilus-pathbar.h"
#include "nautilus-main.h"
#include "nautilus-window-private.h"
#include "nautilus-zoom-control.h"
......@@ -347,10 +348,12 @@ viewed_file_changed_callback (NautilusFile *file,
update_up_button (window);
#if !NEW_UI_COMPLETE
if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
/* Change the location bar to match the current location. */
/* Change the location bar and path bar to match the current location. */
nautilus_navigation_bar_set_location
(NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
window->details->location);
nautilus_path_bar_set_path (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar),
window->details->location);
}
if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
/* Change the location button to match the current location. */
......@@ -1171,10 +1174,11 @@ update_for_new_location (NautilusWindow *window)
nautilus_navigation_window_allow_back (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->back_list != NULL);
nautilus_navigation_window_allow_forward (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->forward_list != NULL);
/* Change the location bar to match the current location. */
/* Change the location bar and path bar to match the current location. */
nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
window->details->location);
nautilus_path_bar_set_path (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar),
window->details->location);
nautilus_navigation_window_load_extension_toolbar_items (NAUTILUS_NAVIGATION_WINDOW (window));
}
......
......@@ -101,6 +101,7 @@ struct _NautilusNavigationWindowDetails {
/* Location bar */
gboolean temporary_navigation_bar;
gboolean temporary_location_bar;
/* Side Pane */
int side_pane_width;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment