Commit 4211fdc0 authored by Dave Camp's avatar Dave Camp Committed by Dave Camp

When opening a spatial window for the first time, place it over the parent

2004-03-29  Dave Camp  <dave@ximian.com>

	* src/nautilus-application.c:
	(nautilus_application_present_spatial_window):
	* src/nautilus-application.h:
	* src/nautilus-shell.c: (open_window),
	(restore_one_window_callback):
	* src/nautilus-window-manage-views.c: (open_location): When
	opening a spatial window for the first time, place it over the
	parent window.
parent 499cc0f8
2004-03-29 Dave Camp <dave@ximian.com>
* src/nautilus-application.c:
(nautilus_application_present_spatial_window):
* src/nautilus-application.h:
* src/nautilus-shell.c: (open_window),
(restore_one_window_callback):
* src/nautilus-window-manage-views.c: (open_location): When
opening a spatial window for the first time, place it over the
parent window.
2004-03-26 Alexander Larsson <alexl@redhat.com>
* src/file-manager/fm-properties-window.c (get_target_file_for_original_file):
......
......@@ -57,6 +57,7 @@
#include <gdk/gdkx.h>
#include <gtk/gtkinvisible.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
......@@ -972,8 +973,9 @@ spatial_window_destroyed_callback (void *user_data, GObject *window)
NautilusWindow *
nautilus_application_present_spatial_window (NautilusApplication *application,
const char *location,
GdkScreen *screen)
NautilusWindow *requesting_window,
const char *location,
GdkScreen *screen)
{
NautilusWindow *window;
GList *l;
......@@ -999,6 +1001,29 @@ nautilus_application_present_spatial_window (NautilusApplication *application,
}
window = create_window (application, NAUTILUS_TYPE_SPATIAL_WINDOW, screen);
if (requesting_window) {
/* Center the window over the requesting window by default */
int orig_x, orig_y, orig_width, orig_height;
int new_x, new_y, new_width, new_height;
gtk_window_get_position (GTK_WINDOW (requesting_window),
&orig_x, &orig_y);
gtk_window_get_size (GTK_WINDOW (requesting_window),
&orig_width, &orig_height);
gtk_window_get_default_size (GTK_WINDOW (window),
&new_width, &new_height);
new_x = orig_x + (orig_width - new_width) / 2;
new_y = orig_y + (orig_height - new_height) / 2;
if (orig_width - new_width < 10) {
new_x += 10;
new_y += 10;
}
gtk_window_move (GTK_WINDOW (window), new_x, new_y);
}
nautilus_application_spatial_window_list = g_list_prepend (nautilus_application_spatial_window_list, window);
g_object_weak_ref (G_OBJECT (window),
spatial_window_destroyed_callback, NULL);
......
......@@ -73,10 +73,12 @@ GList * nautilus_application_get_window_list (void);
GList * nautilus_application_get_spatial_window_list (void);
NautilusWindow * nautilus_application_present_spatial_window (NautilusApplication *application,
NautilusWindow *requesting_window,
const char *location,
GdkScreen *screen);
NautilusWindow * nautilus_application_create_navigation_window (NautilusApplication *application,
GdkScreen *screen);
void nautilus_application_close_all_navigation_windows (void);
void nautilus_application_close_parent_windows (NautilusSpatialWindow *window);
void nautilus_application_open_desktop (NautilusApplication *application);
......
......@@ -152,8 +152,9 @@ open_window (NautilusShell *shell, const char *uri, const char *geometry,
}
window = nautilus_application_present_spatial_window (shell->details->application,
uri,
gdk_screen_get_default ());
NULL,
uri,
gdk_screen_get_default ());
g_free (home_uri);
}
......@@ -347,6 +348,7 @@ restore_one_window_callback (const char *attributes,
#endif
if (eel_strlen (location) > 0) {
window = nautilus_application_present_spatial_window (shell->details->application,
NULL,
location,
screen);
} else {
......
......@@ -685,6 +685,7 @@ open_location (NautilusWindow *window,
if (!NAUTILUS_SPATIAL_WINDOW (window)->affect_spatial_window_on_next_location_change) {
target_window = nautilus_application_present_spatial_window (
window->application,
window,
location,
gtk_window_get_screen (GTK_WINDOW (window)));
do_load_location = FALSE;
......@@ -699,6 +700,7 @@ open_location (NautilusWindow *window,
case Nautilus_ViewFrame_OPEN_IN_SPATIAL :
target_window = nautilus_application_present_spatial_window (
window->application,
window,
location,
gtk_window_get_screen (GTK_WINDOW (window)));
break;
......
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