Commit ac2ec5b5 authored by Darin Adler's avatar Darin Adler
Browse files

reviewed by: John Sullivan <sullivan@eazel.com>

	Fixed bug 1948 ("Open in New Window" menu item reuses existing
	window if it exists) by separating the explicit "open in new
	window" feature (always gives a new window) from the "open all
	items in new windows" preference (reuses window if one with the
	right location already exists).

	* libnautilus/nautilus-view-component.idl: Added new
	open_location_prefer_existing_window call. Renamed open_location
	to open_location_in_this_window and open_location_in_new_window to
	open_location_force_new_window for clarity.

	* libnautilus/nautilus-view.h:
	* libnautilus/nautilus-view.c:
	(nautilus_view_open_location_in_this_window),
	(nautilus_view_open_location_prefer_existing_window),
	(nautilus_view_open_location_force_new_window):
	* src/nautilus-view-frame-corba.c:
	(impl_Nautilus_ViewFrame_open_location_in_this_window),
	(impl_Nautilus_ViewFrame_open_location_prefer_existing_window),
	(impl_Nautilus_ViewFrame_open_location_force_new_window):
	* src/nautilus-view-frame-private.h:
	* src/nautilus-view-frame.c:
	(nautilus_view_frame_initialize_class),
	(nautilus_view_frame_open_location_in_this_window),
	(nautilus_view_frame_open_location_prefer_existing_window),
	(nautilus_view_frame_open_location_force_new_window):
	* src/nautilus-view-frame.h:
	Add new call, rename old ones.

	* src/file-manager/fm-directory-view.c: (open_callback): Pass parameter
	to tell the open code to respect the "use new windows" preference.
	(open_location): Take new WindowChoice parameter to respect preference
	as appropriate.
	(switch_location_and_view): Tell the code to respect the preference in
	this case (opening from Open With).
	(show_trash_callback): Use code that respects the preference instead of
	always opening in this case.
	(open_one_in_new_window): Always force a new window (used by Open
	in New Window command).
	(activate_callback): Pass through new WindowChoice instead of boolean.
	(fm_directory_view_activate_file): Pass through new WindowChoice
	instead of boolean.,
	(fm_directory_view_activate_files): Respect the user preference if
	opening only one file, do the "use existing window or make new one"
	mode if opening more than one.

	* src/nautilus-window-manage-views.c: (handle_unreadable_location):
	Move check for empty location string in here.
	(open_location): Moved the code for reusing existing windows out
	of here. Also changed code structure to avoid redoing the
	handle_unreadable_location check.
	(open_location_in_this_window_callback): Renamed.
	(open_location_prefer_existing_window_callback): Here's where
	the code for reusing existing windows went. New callback for the
	new call/signal.
	(open_location_force_new_window_callback): Renamed.

	* src/file-manager/fm-search-list-view.c:
	(reveal_selected_items_callback): Change to use
	nautilus_view_open_location_force_new_window by its new name.

	* src/nautilus-window-manage-views.h: Got rid of
	nautilus_window_open_location_in_new_window, which was public and
	unused.

	* components/adapter/nautilus-adapter.c:
	(nautilus_adapter_open_location_callback):
	* components/help/hyperbola-nav-index.c:
	(hyperbola_navigation_index_select_row):
	* components/help/hyperbola-nav-search.c:
	(hyperbola_navigation_search_select_row):
	* components/help/hyperbola-nav-tree.c:
	(hyperbola_navigation_tree_select_row):
	* components/history/nautilus-history-view.c:
	(history_button_release):
	* components/mozilla/nautilus-mozilla-content-view.c:
	(mozilla_open_uri_callback), (mozilla_dom_mouse_click_callback):
	* components/rpmview/nautilus-rpm-view.c: (go_to_button_callback):
	* components/services/login/nautilus-view/nautilus-change-password-view.c:
	(run_away_timer), (authn_failed), (maintenance_button_cb):
	* components/services/summary/nautilus-view/nautilus-summary-callbacks.c:
	(logged_in_callback), (logged_out_callback),
	(preferences_button_cb), (forgot_password_button_cb),
	(register_button_cb):
	* components/services/summary/nautilus-view/nautilus-summary-dialogs.c:
	(error_dialog_cancel_cb):
	* components/services/summary/nautilus-view/nautilus-summary-footer.c:
	(footer_item_clicked_callback):
	* components/services/summary/nautilus-view/nautilus-summary-view.c:
	(goto_service_cb), (goto_update_cb):
	* components/text/nautilus-text-view.c: (handle_service_menu_item):
	* components/tree/nautilus-tree-view.c: (tree_select_row_callback):
	Change to use new nautilus_view_open_location_in_this_window
	name. It's better because it's more explicit, but also, it's the
	new name!

	* libnautilus-extensions/nautilus-gdk-extensions.c:
	(nautilus_gdk_window_bring_to_front): Fixed indentation.

	* libnautilus-extensions/nautilus-gtk-extensions.c:
	(nautilus_gtk_window_present): Put in a new implementation that
	uses nautilus_gdk_window_bring_to_front instead of the old one
	that did a hide followed by a show. Corrected an assert that
	should have been a return_if_fail.
parent 366f425a
2000-12-12 Darin Adler <darin@eazel.com>
reviewed by: John Sullivan <sullivan@eazel.com>
Fixed bug 1948 ("Open in New Window" menu item reuses existing
window if it exists) by separating the explicit "open in new
window" feature (always gives a new window) from the "open all
items in new windows" preference (reuses window if one with the
right location already exists).
* libnautilus/nautilus-view-component.idl: Added new
open_location_prefer_existing_window call. Renamed open_location
to open_location_in_this_window and open_location_in_new_window to
open_location_force_new_window for clarity.
* libnautilus/nautilus-view.h:
* libnautilus/nautilus-view.c:
(nautilus_view_open_location_in_this_window),
(nautilus_view_open_location_prefer_existing_window),
(nautilus_view_open_location_force_new_window):
* src/nautilus-view-frame-corba.c:
(impl_Nautilus_ViewFrame_open_location_in_this_window),
(impl_Nautilus_ViewFrame_open_location_prefer_existing_window),
(impl_Nautilus_ViewFrame_open_location_force_new_window):
* src/nautilus-view-frame-private.h:
* src/nautilus-view-frame.c:
(nautilus_view_frame_initialize_class),
(nautilus_view_frame_open_location_in_this_window),
(nautilus_view_frame_open_location_prefer_existing_window),
(nautilus_view_frame_open_location_force_new_window):
* src/nautilus-view-frame.h:
Add new call, rename old ones.
* src/file-manager/fm-directory-view.c: (open_callback): Pass parameter
to tell the open code to respect the "use new windows" preference.
(open_location): Take new WindowChoice parameter to respect preference
as appropriate.
(switch_location_and_view): Tell the code to respect the preference in
this case (opening from Open With).
(show_trash_callback): Use code that respects the preference instead of
always opening in this case.
(open_one_in_new_window): Always force a new window (used by Open
in New Window command).
(activate_callback): Pass through new WindowChoice instead of boolean.
(fm_directory_view_activate_file): Pass through new WindowChoice
instead of boolean.,
(fm_directory_view_activate_files): Respect the user preference if
opening only one file, do the "use existing window or make new one"
mode if opening more than one.
* src/nautilus-window-manage-views.c: (handle_unreadable_location):
Move check for empty location string in here.
(open_location): Moved the code for reusing existing windows out
of here. Also changed code structure to avoid redoing the
handle_unreadable_location check.
(open_location_in_this_window_callback): Renamed.
(open_location_prefer_existing_window_callback): Here's where
the code for reusing existing windows went. New callback for the
new call/signal.
(open_location_force_new_window_callback): Renamed.
* src/file-manager/fm-search-list-view.c:
(reveal_selected_items_callback): Change to use
nautilus_view_open_location_force_new_window by its new name.
* src/nautilus-window-manage-views.h: Got rid of
nautilus_window_open_location_in_new_window, which was public and
unused.
* components/adapter/nautilus-adapter.c:
(nautilus_adapter_open_location_callback):
* components/help/hyperbola-nav-index.c:
(hyperbola_navigation_index_select_row):
* components/help/hyperbola-nav-search.c:
(hyperbola_navigation_search_select_row):
* components/help/hyperbola-nav-tree.c:
(hyperbola_navigation_tree_select_row):
* components/history/nautilus-history-view.c:
(history_button_release):
* components/mozilla/nautilus-mozilla-content-view.c:
(mozilla_open_uri_callback), (mozilla_dom_mouse_click_callback):
* components/rpmview/nautilus-rpm-view.c: (go_to_button_callback):
* components/services/login/nautilus-view/nautilus-change-password-view.c:
(run_away_timer), (authn_failed), (maintenance_button_cb):
* components/services/summary/nautilus-view/nautilus-summary-callbacks.c:
(logged_in_callback), (logged_out_callback),
(preferences_button_cb), (forgot_password_button_cb),
(register_button_cb):
* components/services/summary/nautilus-view/nautilus-summary-dialogs.c:
(error_dialog_cancel_cb):
* components/services/summary/nautilus-view/nautilus-summary-footer.c:
(footer_item_clicked_callback):
* components/services/summary/nautilus-view/nautilus-summary-view.c:
(goto_service_cb), (goto_update_cb):
* components/text/nautilus-text-view.c: (handle_service_menu_item):
* components/tree/nautilus-tree-view.c: (tree_select_row_callback):
Change to use new nautilus_view_open_location_in_this_window
name. It's better because it's more explicit, but also, it's the
new name!
* libnautilus-extensions/nautilus-gdk-extensions.c:
(nautilus_gdk_window_bring_to_front): Fixed indentation.
* libnautilus-extensions/nautilus-gtk-extensions.c:
(nautilus_gtk_window_present): Put in a new implementation that
uses nautilus_gdk_window_bring_to_front instead of the old one
that did a hide followed by a show. Corrected an assert that
should have been a return_if_fail.
2000-12-12 John Sullivan <sullivan@eazel.com>
reviewed by: Darin Adler <darin@eazel.com>
......
......@@ -281,8 +281,8 @@ nautilus_adapter_open_location_callback (NautilusAdapterEmbedStrategy *strategy
const char *uri,
NautilusAdapter *adapter)
{
nautilus_view_open_location (adapter->details->nautilus_view,
uri);
nautilus_view_open_location_in_this_window
(adapter->details->nautilus_view, uri);
}
......
......@@ -241,7 +241,7 @@ hyperbola_navigation_index_select_row(GtkWidget *clist, gint row, gint column, G
if(!ii->uri)
return;
nautilus_view_open_location (hni->view_frame, ii->uri);
nautilus_view_open_location_in_this_window (hni->view_frame, ii->uri);
}
typedef struct {
......
......@@ -138,7 +138,7 @@ hyperbola_navigation_search_select_row(GtkWidget *clist, gint row, gint column,
if(gtk_clist_get_text(GTK_CLIST(clist), row, 0, &uri))
return;
nautilus_view_open_location (hns->nautilus_view, uri);
nautilus_view_open_location_in_this_window (hns->nautilus_view, uri);
}
BonoboObject *hyperbola_navigation_search_new(void)
......
......@@ -138,7 +138,7 @@ static void hyperbola_navigation_tree_select_row(GtkCTree *ctree, GtkCTreeNode *
view->notify_count++;
nautilus_view_open_location (view->view_frame, tnode->uri);
nautilus_view_open_location_in_this_window (view->view_frame, tnode->uri);
view->notify_count--;
}
......@@ -247,7 +247,7 @@ history_button_release (GtkCList *clist, GdkEventButton *event, HistoryView *hvi
/* Navigate to uri */
uri = get_uri_from_row (clist, row);
nautilus_view_open_location (hview->view, uri);
nautilus_view_open_location_in_this_window (hview->view, uri);
g_free (uri);
}
......
......@@ -796,7 +796,8 @@ mozilla_open_uri_callback (GtkMozEmbed *mozilla,
/*do untranslate here*/
untranslated_uri = mozilla_untranslate_uri_if_needed (view, uri);
nautilus_view_open_location (view->details->nautilus_view, untranslated_uri);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, untranslated_uri);
g_free (untranslated_uri);
bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view));
......@@ -1102,7 +1103,8 @@ mozilla_dom_mouse_click_callback (GtkMozEmbed *mozilla,
g_print ("%s() href = %s\n", __FUNCTION__, href);
#endif
bonobo_object_ref (BONOBO_OBJECT (view->details->nautilus_view));
nautilus_view_open_location (view->details->nautilus_view, href);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, href);
bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view));
g_free (href);
......
......@@ -450,7 +450,8 @@ go_to_button_callback (GtkWidget * widget, NautilusRPMView *rpm_view)
gtk_clist_get_text (GTK_CLIST(rpm_view->details->package_file_list),
rpm_view->details->selected_file, 0, &path_name);
nautilus_view_open_location (rpm_view->details->nautilus_view, path_name);
nautilus_view_open_location_in_this_window
(rpm_view->details->nautilus_view, path_name);
}
static void
......
......@@ -123,7 +123,8 @@ user_logged_in (NautilusChangePasswordView *view)
static gboolean
run_away_timer (NautilusChangePasswordView *view)
{
nautilus_view_open_location (view->details->nautilus_view, SERVICE_SUMMARY_LOCATION);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, SERVICE_SUMMARY_LOCATION);
return FALSE; /* don't run this timer again */
}
......@@ -336,7 +337,8 @@ authn_failed (const EazelProxy_User *user, const EazelProxy_AuthnFailInfo *info,
if (info->code == EAZELPROXY_AUTHN_FAIL_SERVER) {
/* not sure what to do here. apparently there's no way to start over. */
nautilus_view_open_location (view->details->nautilus_view, SERVICE_SUMMARY_LOCATION);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, SERVICE_SUMMARY_LOCATION);
}
}
......@@ -416,10 +418,11 @@ change_password_button_cb (GtkWidget *button, NautilusChangePasswordView *view)
/* callback to point account maintenance button to webpage */
static void
maintenance_button_cb (GtkWidget *button, NautilusChangePasswordView *view)
maintenance_button_cb (GtkWidget *button, NautilusChangePasswordView *view)
{
nautilus_view_open_location (view->details->nautilus_view, SERVICE_HELP_LOCATION);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, SERVICE_HELP_LOCATION);
}
......
......@@ -210,7 +210,8 @@ logged_in_callback (gpointer raw)
view->details->logged_in = TRUE;
update_menu_items (view, TRUE);
nautilus_view_open_location (view->details->nautilus_view, "eazel:");
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, "eazel:");
return (FALSE);
}
......@@ -225,7 +226,8 @@ logged_out_callback (gpointer raw)
view->details->logged_in = FALSE;
update_menu_items (view, FALSE);
nautilus_view_open_location (view->details->nautilus_view, "eazel:");
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, "eazel:");
return (FALSE);
}
......@@ -239,10 +241,11 @@ preferences_button_cb (GtkWidget *button, NautilusSummaryView *view)
url = trilobite_redirect_lookup (PREFERENCES_KEY);
if (!url) {
g_assert ("Failed to load Registration url!\n");
g_error ("Failed to load Registration url!");
}
nautilus_view_open_location (view->details->nautilus_view, url);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, url);
g_free (url);
}
......@@ -252,7 +255,8 @@ void
forgot_password_button_cb (GtkWidget *button, NautilusSummaryView *view)
{
nautilus_view_open_location (view->details->nautilus_view, SUMMARY_CHANGE_PWD_FORM);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, SUMMARY_CHANGE_PWD_FORM);
}
......@@ -265,10 +269,11 @@ register_button_cb (GtkWidget *button, NautilusSummaryView *view)
url = trilobite_redirect_lookup (REGISTER_KEY);
if (!url) {
g_assert ("Failed to load Registration url!\n");
g_error ("Failed to load Registration url!");
}
nautilus_view_open_location (view->details->nautilus_view, url);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, url);
g_free (url);
}
......
......@@ -211,7 +211,7 @@ error_dialog_cancel_cb (GtkWidget *button, NautilusSummaryView *view)
{
char *user_home;
user_home = nautilus_get_user_main_directory ();
nautilus_view_open_location (view->details->nautilus_view, user_home);
nautilus_view_open_location_in_this_window (view->details->nautilus_view, user_home);
g_free (user_home);
}
......
......@@ -99,11 +99,11 @@ footer_item_clicked_callback (GtkWidget *widget, int index, gpointer callback_da
break;
case FOOTER_TERMS_OF_USER:
nautilus_view_open_location (view->details->nautilus_view, SUMMARY_TERMS_OF_USE_URI);
nautilus_view_open_location_in_this_window (view->details->nautilus_view, SUMMARY_TERMS_OF_USE_URI);
break;
case FOOTER_PRIVACY_STATEMENT:
nautilus_view_open_location (view->details->nautilus_view, SUMMARY_PRIVACY_STATEMENT_URI);
nautilus_view_open_location_in_this_window (view->details->nautilus_view, SUMMARY_PRIVACY_STATEMENT_URI);
break;
default:
......
......@@ -749,7 +749,7 @@ static void
goto_service_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata)
{
nautilus_view_open_location (cbdata->nautilus_view, cbdata->uri);
nautilus_view_open_location_in_this_window (cbdata->nautilus_view, cbdata->uri);
}
......@@ -758,7 +758,7 @@ static void
goto_update_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata)
{
nautilus_view_open_location (cbdata->nautilus_view, cbdata->uri);
nautilus_view_open_location_in_this_window (cbdata->nautilus_view, cbdata->uri);
}
......
......@@ -210,7 +210,8 @@ logged_in_callback (gpointer raw)
view->details->logged_in = TRUE;
update_menu_items (view, TRUE);
nautilus_view_open_location (view->details->nautilus_view, "eazel:");
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, "eazel:");
return (FALSE);
}
......@@ -225,7 +226,8 @@ logged_out_callback (gpointer raw)
view->details->logged_in = FALSE;
update_menu_items (view, FALSE);
nautilus_view_open_location (view->details->nautilus_view, "eazel:");
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, "eazel:");
return (FALSE);
}
......@@ -239,10 +241,11 @@ preferences_button_cb (GtkWidget *button, NautilusSummaryView *view)
url = trilobite_redirect_lookup (PREFERENCES_KEY);
if (!url) {
g_assert ("Failed to load Registration url!\n");
g_error ("Failed to load Registration url!");
}
nautilus_view_open_location (view->details->nautilus_view, url);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, url);
g_free (url);
}
......@@ -252,7 +255,8 @@ void
forgot_password_button_cb (GtkWidget *button, NautilusSummaryView *view)
{
nautilus_view_open_location (view->details->nautilus_view, SUMMARY_CHANGE_PWD_FORM);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, SUMMARY_CHANGE_PWD_FORM);
}
......@@ -265,10 +269,11 @@ register_button_cb (GtkWidget *button, NautilusSummaryView *view)
url = trilobite_redirect_lookup (REGISTER_KEY);
if (!url) {
g_assert ("Failed to load Registration url!\n");
g_error ("Failed to load Registration url!");
}
nautilus_view_open_location (view->details->nautilus_view, url);
nautilus_view_open_location_in_this_window
(view->details->nautilus_view, url);
g_free (url);
}
......
......@@ -211,7 +211,7 @@ error_dialog_cancel_cb (GtkWidget *button, NautilusSummaryView *view)
{
char *user_home;
user_home = nautilus_get_user_main_directory ();
nautilus_view_open_location (view->details->nautilus_view, user_home);
nautilus_view_open_location_in_this_window (view->details->nautilus_view, user_home);
g_free (user_home);
}
......
......@@ -99,11 +99,11 @@ footer_item_clicked_callback (GtkWidget *widget, int index, gpointer callback_da
break;
case FOOTER_TERMS_OF_USER:
nautilus_view_open_location (view->details->nautilus_view, SUMMARY_TERMS_OF_USE_URI);
nautilus_view_open_location_in_this_window (view->details->nautilus_view, SUMMARY_TERMS_OF_USE_URI);
break;
case FOOTER_PRIVACY_STATEMENT:
nautilus_view_open_location (view->details->nautilus_view, SUMMARY_PRIVACY_STATEMENT_URI);
nautilus_view_open_location_in_this_window (view->details->nautilus_view, SUMMARY_PRIVACY_STATEMENT_URI);
break;
default:
......
......@@ -749,7 +749,7 @@ static void
goto_service_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata)
{
nautilus_view_open_location (cbdata->nautilus_view, cbdata->uri);
nautilus_view_open_location_in_this_window (cbdata->nautilus_view, cbdata->uri);
}
......@@ -758,7 +758,7 @@ static void
goto_update_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata)
{
nautilus_view_open_location (cbdata->nautilus_view, cbdata->uri);
nautilus_view_open_location_in_this_window (cbdata->nautilus_view, cbdata->uri);
}
......
......@@ -368,7 +368,7 @@ handle_service_menu_item (BonoboUIComponent *ui, gpointer user_data, const char
uri = g_strdup_printf (parameters->service_template, mapped_text);
/* goto the url */
nautilus_view_open_location (parameters->text_view->details->nautilus_view, uri);
nautilus_view_open_location_in_this_window (parameters->text_view->details->nautilus_view, uri);
g_free (uri);
g_free (selected_text);
......
......@@ -1165,7 +1165,7 @@ tree_select_row_callback (NautilusCTree *tree,
if (uri != NULL &&
nautilus_strcmp (view->details->current_main_view_uri, uri) != 0) {
nautilus_view_open_location (NAUTILUS_VIEW (view->details->nautilus_view), uri);
nautilus_view_open_location_in_this_window (NAUTILUS_VIEW (view->details->nautilus_view), uri);
g_free (view->details->selected_uri);
view->details->selected_uri = g_strdup (uri);
......
......@@ -640,9 +640,9 @@ nautilus_gdk_window_bring_to_front (GdkWindow *window)
gdk_error_trap_push ();
XSetInputFocus (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (window),
RevertToPointerRoot,
GDK_CURRENT_TIME);
GDK_WINDOW_XWINDOW (window),
RevertToPointerRoot,
GDK_CURRENT_TIME);
gdk_flush();
gdk_error_trap_pop ();
}
......
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