Commit c42ab00a authored by Dave Camp's avatar Dave Camp Committed by Dave Camp

Merge the nautilus-spatial-playground branch to HEAD.

2003-09-30  Dave Camp  <dave@ximian.com>

	* Merge the nautilus-spatial-playground branch to HEAD.
parent 1f859c83
This diff is collapsed.
......@@ -221,8 +221,9 @@ nautilus_adapter_open_location_callback (NautilusAdapterEmbedStrategy *strategy
const char *uri,
NautilusAdapter *adapter)
{
nautilus_view_open_location_in_this_window
(adapter->details->nautilus_view, uri);
nautilus_view_open_location
(adapter->details->nautilus_view,
uri, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0, NULL);
}
......
......@@ -168,8 +168,9 @@ row_activated_callback (GtkTreeView *tree_view,
/* Navigate to the clicked location. */
uri = nautilus_bookmark_get_uri (NAUTILUS_BOOKMARK (bookmark));
nautilus_view_open_location_in_this_window
(NAUTILUS_VIEW (view), uri);
nautilus_view_open_location
(NAUTILUS_VIEW (view),
uri, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0, NULL);
g_free (uri);
}
......
......@@ -281,7 +281,12 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
/* Non-local executables don't get launched. They act like non-executables. */
if (file_uri == NULL) {
nautilus_view_open_location_in_this_window (NAUTILUS_VIEW (view), uri);
nautilus_view_open_location
(NAUTILUS_VIEW (view),
uri,
Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
0,
NULL);
} else {
nautilus_launch_application_from_command (screen, NULL, file_uri, NULL, FALSE);
g_free (file_uri);
......@@ -294,7 +299,12 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
g_free (view->details->selection_location);
}
view->details->selection_location = g_strdup (uri);
nautilus_view_open_location_in_this_window (NAUTILUS_VIEW (view), uri);
nautilus_view_open_location
(NAUTILUS_VIEW (view),
uri,
Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
0,
NULL);
}
}
......
......@@ -393,10 +393,6 @@ static const PreferenceDefault preference_defaults[] = {
NULL, NULL,
"search_bar_type"
},
{ NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS,
PREFERENCE_STRING_LIST,
"size,date_modified,type",
......@@ -412,10 +408,6 @@ static const PreferenceDefault preference_defaults[] = {
PREFERENCE_INTEGER,
GINT_TO_POINTER (148)
},
{ NAUTILUS_PREFERENCES_START_WITH_TOOLBAR,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)
......
......@@ -46,9 +46,6 @@ G_BEGIN_DECLS
/* How wide the sidebar is (or how wide it will be when expanded) */
#define NAUTILUS_PREFERENCES_SIDEBAR_WIDTH "preferences/sidebar_width"
/* Window options */
#define NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW "preferences/window_always_new"
/* Trash options */
#define NAUTILUS_PREFERENCES_CONFIRM_TRASH "preferences/confirm_trash"
#define NAUTILUS_PREFERENCES_ENABLE_DELETE "preferences/enable_delete"
......@@ -77,7 +74,6 @@ G_BEGIN_DECLS
#define NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION "preferences/executable_text_activation"
/* Which views should be displayed for new windows */
#define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR "preferences/start_with_toolbar"
#define NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR "preferences/start_with_location_bar"
#define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR "preferences/start_with_status_bar"
#define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR "preferences/start_with_sidebar"
......
......@@ -148,6 +148,7 @@ typedef struct {
static GType nautilus_icon_container_accessible_get_type (void);
static void activate_selected_items (NautilusIconContainer *container);
static void activate_selected_items_alternate (NautilusIconContainer *container);
static void nautilus_icon_container_theme_changed (gpointer user_data);
static void compute_stretch (StretchState *start,
StretchState *current);
......@@ -204,6 +205,7 @@ GNOME_CLASS_BOILERPLATE (NautilusIconContainer, nautilus_icon_container,
/* The NautilusIconContainer signals. */
enum {
ACTIVATE,
ACTIVATE_ALTERNATE,
BAND_SELECT_STARTED,
BAND_SELECT_ENDED,
BUTTON_PRESS,
......@@ -3209,7 +3211,11 @@ nautilus_icon_container_did_not_drag (NautilusIconContainer *container,
* NautilusList goes the other way because its "links" seem
* much more link-like.
*/
activate_selected_items (container);
if (event->button == MIDDLE_BUTTON) {
activate_selected_items_alternate (container);
} else {
activate_selected_items (container);
}
}
}
}
......@@ -3827,6 +3833,16 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
signals[ACTIVATE_ALTERNATE]
= g_signal_new ("activate_alternate",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (NautilusIconContainerClass,
activate_alternate),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
signals[CONTEXT_CLICK_SELECTION]
= g_signal_new ("context_click_selection",
G_TYPE_FROM_CLASS (class),
......@@ -4237,25 +4253,28 @@ handle_icon_button_press (NautilusIconContainer *container,
return TRUE;
}
if (event->button == DRAG_BUTTON &&
if ((event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON) &&
event->type == GDK_BUTTON_PRESS) {
/* The next double click has to be on this icon */
details->double_click_icon[1] = details->double_click_icon[0];
details->double_click_icon[0] = icon;
}
if (event->type == GDK_2BUTTON_PRESS &&
event->button == DRAG_BUTTON) {
(event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON)) {
/* Double clicking does not trigger a D&D action. */
details->drag_button = 0;
details->drag_icon = NULL;
if (icon == details->double_click_icon[1] &&
!button_event_modifies_selection (event)) {
activate_selected_items (container);
if (event->button == MIDDLE_BUTTON) {
activate_selected_items_alternate (container);
} else {
activate_selected_items (container);
}
}
return TRUE;
}
if (event->button == DRAG_BUTTON
|| event->button == DRAG_MENU_BUTTON) {
details->drag_button = event->button;
......@@ -4572,6 +4591,22 @@ activate_selected_items (NautilusIconContainer *container)
g_list_free (selection);
}
static void
activate_selected_items_alternate (NautilusIconContainer *container)
{
GList *selection;
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
selection = nautilus_icon_container_get_selection (container);
if (selection != NULL) {
g_signal_emit (container,
signals[ACTIVATE_ALTERNATE], 0,
selection);
}
g_list_free (selection);
}
static NautilusIcon *
get_icon_being_renamed (NautilusIconContainer *container)
{
......
......@@ -87,6 +87,8 @@ typedef struct {
/* Operations on icons. */
void (* activate) (NautilusIconContainer *container,
NautilusIconData *data);
void (* activate_alternate) (NautilusIconContainer *container,
NautilusIconData *data);
void (* context_click_selection) (NautilusIconContainer *container,
GdkEventButton *event);
void (* move_copy_items) (NautilusIconContainer *container,
......
......@@ -60,6 +60,7 @@
#define NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED "list_view_sort_reversed"
#define NAUTILUS_METADATA_KEY_WINDOW_GEOMETRY "window_geometry"
#define NAUTILUS_METADATA_KEY_WINDOW_SCROLL_POSITION "window_scroll_position"
#define NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR "sidebar_background_color"
#define NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE "sidebar_background_tile_image"
......
......@@ -87,18 +87,19 @@ module Nautilus {
* 'selection' - ro - URIList - the selection
*/
interface ViewFrame : ::Bonobo::Unknown {
/* Called by the view component to change the location
* shown in the window, or to open a window. The
* "prefer existing window" variant will use an
* existing window if one exists for that location and
* will otherwise open a new window (with no
* selection). In the case where you force a new
* window, you can specify the initial selection.
*/
oneway void open_location_in_this_window (in URI location);
oneway void open_location_prefer_existing_window (in URI location);
oneway void open_location_force_new_window (in URI location,
in URIList selection);
enum OpenMode {
OPEN_ACCORDING_TO_MODE,
OPEN_IN_SPATIAL,
OPEN_IN_NAVIGATION
};
typedef long OpenFlags;
const OpenFlags OPEN_FLAG_CLOSE_BEHIND = 1;
oneway void open_location (in URI location,
in OpenMode mode,
in OpenFlags flags,
in URIList selection);
/* Called by a view component when the location
* changes, but the view component is handling it
......
......@@ -76,6 +76,8 @@ typedef struct {
char *location;
GList *selection;
char *title;
Nautilus_ViewFrame_OpenMode mode;
Nautilus_ViewFrame_OpenFlags flags;
} LocationPlus;
BONOBO_CLASS_BOILERPLATE_FULL (NautilusView, nautilus_view, Nautilus_View,
......@@ -556,38 +558,8 @@ free_location_plus_callback (gpointer callback_data)
}
static void
call_open_location_in_this_window (NautilusView *view,
gpointer callback_data)
{
CORBA_Environment ev;
Nautilus_ViewFrame view_frame;
view_frame = view_frame_call_begin (view, &ev);
if (view_frame != CORBA_OBJECT_NIL) {
Nautilus_ViewFrame_open_location_in_this_window
(view_frame, callback_data, &ev);
}
view_frame_call_end (view_frame, &ev);
}
static void
call_open_location_prefer_existing_window (NautilusView *view,
gpointer callback_data)
{
CORBA_Environment ev;
Nautilus_ViewFrame view_frame;
view_frame = view_frame_call_begin (view, &ev);
if (view_frame != CORBA_OBJECT_NIL) {
Nautilus_ViewFrame_open_location_prefer_existing_window
(view_frame, callback_data, &ev);
}
view_frame_call_end (view_frame, &ev);
}
static void
call_open_location_force_new_window (NautilusView *view,
gpointer callback_data)
call_open_location (NautilusView *view,
gpointer callback_data)
{
LocationPlus *location_plus;
CORBA_Environment ev;
......@@ -599,13 +571,14 @@ call_open_location_force_new_window (NautilusView *view,
view_frame = view_frame_call_begin (view, &ev);
if (view_frame != CORBA_OBJECT_NIL) {
uri_list = nautilus_uri_list_from_g_list (location_plus->selection);
Nautilus_ViewFrame_open_location_force_new_window
(view_frame, location_plus->location, uri_list, &ev);
Nautilus_ViewFrame_open_location
(view_frame, location_plus->location, location_plus->mode, location_plus->flags, uri_list, &ev);
CORBA_free (uri_list);
}
view_frame_call_end (view_frame, &ev);
}
static void
call_report_location_change (NautilusView *view,
gpointer callback_data)
......@@ -788,40 +761,23 @@ call_close_window (NautilusView *view,
view_frame_call_end (view_frame, &ev);
}
void
nautilus_view_open_location_in_this_window (NautilusView *view,
const char *location)
{
queue_outgoing_call (view,
call_open_location_in_this_window,
g_strdup (location),
g_free);
}
void
nautilus_view_open_location_prefer_existing_window (NautilusView *view,
const char *location)
{
queue_outgoing_call (view,
call_open_location_prefer_existing_window,
g_strdup (location),
g_free);
}
void
nautilus_view_open_location_force_new_window (NautilusView *view,
const char *location,
GList *selection)
nautilus_view_open_location (NautilusView *view,
const char *location,
Nautilus_ViewFrame_OpenMode mode,
Nautilus_ViewFrame_OpenFlags flags,
GList *selection)
{
LocationPlus *location_plus;
location_plus = g_new0 (LocationPlus, 1);
location_plus->location = g_strdup (location);
location_plus->selection = str_list_copy (selection);
location_plus->mode = mode;
location_plus->flags = flags;
queue_outgoing_call (view,
call_open_location_force_new_window,
call_open_location,
location_plus,
free_location_plus_callback);
}
......
......@@ -70,13 +70,11 @@ NautilusView * nautilus_view_new_from_bonobo_control (BonoboCon
BonoboControl * nautilus_view_get_bonobo_control (NautilusView *view);
/* Calls to the Nautilus shell via the view frame. See the IDL for detailed comments. */
void nautilus_view_open_location_in_this_window (NautilusView *view,
const char *location_uri);
void nautilus_view_open_location_prefer_existing_window (NautilusView *view,
const char *location_uri);
void nautilus_view_open_location_force_new_window (NautilusView *view,
void nautilus_view_open_location (NautilusView *view,
const char *location_uri,
GList *selection); /* list of URI char *s */
Nautilus_ViewFrame_OpenMode mode,
Nautilus_ViewFrame_OpenFlags flags,
GList *selection);
void nautilus_view_report_location_change (NautilusView *view,
const char *location_uri,
GList *selection, /* list of URI char *s */
......
......@@ -72,6 +72,8 @@ nautilus_SOURCES = \
nautilus-location-bar.c \
nautilus-main.c \
nautilus-navigation-bar.c \
nautilus-navigation-window.c \
nautilus-navigation-window-menus.c \
nautilus-profiler.c \
nautilus-property-browser.c \
nautilus-search-bar-criterion.c \
......@@ -82,13 +84,14 @@ nautilus_SOURCES = \
nautilus-sidebar-title.c \
nautilus-signaller.c \
nautilus-simple-search-bar.c \
nautilus-spatial-window.c \
nautilus-switchable-navigation-bar.c \
nautilus-switchable-search-bar.c \
nautilus-window-toolbars.c \
nautilus-view-frame-corba.c \
nautilus-view-frame.c \
nautilus-window-manage-views.c \
nautilus-window-menus.c \
nautilus-window-toolbars.c \
nautilus-window.c \
nautilus-zoom-control.c \
nautilus-applicable-views.h \
......@@ -104,6 +107,7 @@ nautilus_SOURCES = \
nautilus-location-bar.h \
nautilus-main.h \
nautilus-navigation-bar.h \
nautilus-navigation-window.h \
nautilus-profiler.h \
nautilus-property-browser.h \
nautilus-search-bar-criterion-private.h \
......@@ -116,6 +120,7 @@ nautilus_SOURCES = \
nautilus-sidebar-title.h \
nautilus-signaller.h \
nautilus-simple-search-bar.h \
nautilus-spatial-window.h \
nautilus-switchable-navigation-bar.h \
nautilus-switchable-search-bar.h \
nautilus-view-frame-private.h \
......@@ -152,6 +157,8 @@ server_DATA = $(server_in_files:.server.in=.server)
uidir = $(datadir)/gnome-2.0/ui
ui_DATA = \
nautilus-shell-ui.xml \
nautilus-navigation-window-ui.xml \
nautilus-spatial-window-ui.xml \
$(NULL)
gladedir = $(datadir)/nautilus/glade
......
......@@ -188,7 +188,6 @@ static GdkAtom copied_files_atom;
static gboolean show_delete_command_auto_value;
static gboolean confirm_trash_auto_value;
static gboolean use_new_window_auto_value;
static char *scripts_directory_uri;
static int scripts_directory_uri_length;
......@@ -249,12 +248,6 @@ struct FMDirectoryViewDetails
NautilusFile *file_monitored_for_open_with;
};
typedef enum {
RESPECT_PREFERENCE,
PREFER_EXISTING_WINDOW,
FORCE_NEW_WINDOW
} WindowChoice;
typedef enum {
ACTIVATION_ACTION_LAUNCH,
ACTIVATION_ACTION_LAUNCH_IN_TERMINAL,
......@@ -265,7 +258,8 @@ typedef enum {
typedef struct {
FMDirectoryView *view;
NautilusFile *file;
WindowChoice choice;
Nautilus_ViewFrame_OpenMode mode;
Nautilus_ViewFrame_OpenFlags flags;
NautilusFileCallback callback;
} ActivateParameters;
......@@ -303,7 +297,8 @@ static void trash_or_delete_files (FMDirectoryView
const GList *files);
static void fm_directory_view_activate_file (FMDirectoryView *view,
NautilusFile *file,
WindowChoice choice);
Nautilus_ViewFrame_OpenMode mode,
Nautilus_ViewFrame_OpenFlags flags);
static void load_directory (FMDirectoryView *view,
NautilusDirectory *directory);
static void fm_directory_view_merge_menus (FMDirectoryView *view);
......@@ -549,7 +544,7 @@ open_callback (BonoboUIComponent *component, gpointer callback_data, const char
view = FM_DIRECTORY_VIEW (callback_data);
selection = fm_directory_view_get_selection (view);
fm_directory_view_activate_files (view, selection);
fm_directory_view_activate_files (view, selection, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0);
nautilus_file_list_free (selection);
}
......@@ -558,25 +553,12 @@ open_alternate_callback (BonoboUIComponent *component, gpointer callback_data, c
{
FMDirectoryView *view;
GList *selection;
char *uri;
view = FM_DIRECTORY_VIEW (callback_data);
selection = fm_directory_view_get_selection (view);
if (use_new_window_auto_value) {
/* UI should have prevented this from being called unless exactly
* one item is selected.
*/
if (selection_contains_one_item_in_menu_callback (view, selection)) {
uri = nautilus_file_get_uri (NAUTILUS_FILE (selection->data));
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, uri);
g_free (uri);
}
} else {
if (fm_directory_view_confirm_multiple_windows (view, g_list_length (selection))) {
g_list_foreach (selection, open_one_in_new_window, view);
}
if (fm_directory_view_confirm_multiple_windows (view, g_list_length (selection))) {
g_list_foreach (selection, open_one_in_new_window, view);
}
nautilus_file_list_free (selection);
......@@ -628,30 +610,14 @@ fm_directory_view_chose_application_callback (GnomeVFSMimeApplication *applicati
static void
open_location (FMDirectoryView *directory_view,
const char *new_uri,
WindowChoice choice)
Nautilus_ViewFrame_OpenMode mode,
Nautilus_ViewFrame_OpenFlags flags)
{
g_assert (FM_IS_DIRECTORY_VIEW (directory_view));
g_assert (new_uri != NULL);
switch (choice) {
case RESPECT_PREFERENCE:
if (use_new_window_auto_value) {
nautilus_view_open_location_prefer_existing_window
(directory_view->details->nautilus_view, new_uri);
} else {
nautilus_view_open_location_in_this_window
(directory_view->details->nautilus_view, new_uri);
}
break;
case PREFER_EXISTING_WINDOW:
nautilus_view_open_location_prefer_existing_window
(directory_view->details->nautilus_view, new_uri);
break;
case FORCE_NEW_WINDOW:
nautilus_view_open_location_force_new_window
(directory_view->details->nautilus_view, new_uri, NULL);
break;
}
nautilus_view_open_location (directory_view->details->nautilus_view,
new_uri, mode, flags, NULL);
}
static void
......@@ -676,7 +642,7 @@ switch_location_and_view (NautilusViewIdentifier *identifier,
nautilus_mime_set_default_component_for_file (file, identifier->iid);
nautilus_file_unref (file);
open_location (directory_view, new_uri, RESPECT_PREFERENCE);
open_location (directory_view, new_uri, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0);
}
static void
......@@ -1385,8 +1351,6 @@ fm_directory_view_init (FMDirectoryView *view)
&confirm_trash_auto_value);
eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_ENABLE_DELETE,
&show_delete_command_auto_value);
eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
&use_new_window_auto_value);
}
view->details = g_new0 (FMDirectoryViewDetails, 1);
......@@ -1451,12 +1415,6 @@ fm_directory_view_init (FMDirectoryView *view)
filtering_changed_callback (view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
schedule_update_menus_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
filtering_changed_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
filtering_changed_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
schedule_update_menus_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_ENABLE_DELETE,
......@@ -1522,8 +1480,6 @@ fm_directory_view_finalize (GObject *object)
fm_directory_view_ignore_hidden_file_preferences (view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
schedule_update_menus_callback, view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
filtering_changed_callback, view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
......@@ -3299,7 +3255,8 @@ open_one_in_new_window (gpointer data, gpointer callback_data)
fm_directory_view_activate_file (FM_DIRECTORY_VIEW (callback_data),
NAUTILUS_FILE (data),
FORCE_NEW_WINDOW);
Nautilus_ViewFrame_OPEN_IN_NAVIGATION,
0);
}
NautilusFile *
......@@ -4356,7 +4313,7 @@ open_scripts_folder_callback (BonoboUIComponent *component,
view = FM_DIRECTORY_VIEW (callback_data);
open_location (view, scripts_directory_uri, RESPECT_PREFERENCE);
open_location (view, scripts_directory_uri, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0);
eel_show_info_dialog_with_details
(_("All executable files in this folder will appear in the "
......@@ -4828,31 +4785,20 @@ real_update_menus (FMDirectoryView *view)
FM_DIRECTORY_VIEW_COMMAND_OPEN,
selection_count != 0);
if (use_new_window_auto_value) {
nautilus_bonobo_set_sensitive (view->details->ui,
FM_DIRECTORY_VIEW_COMMAND_OPEN_ALTERNATE,
selection_count == 1);