Commit 97c03823 authored by Frank Worsley's avatar Frank Worsley Committed by Frank Worsley
Browse files

always load the saved window geometry and save the geometry whenever a

2002-06-10  Frank Worsley  <fworsley@shaw.ca>

	* src/nautilus-application.c:
	* src/nautilus-window-manage-views.c:
	* src/nautilus-window.c:
	* src/nautilus-window.h:
	always load the saved window geometry and save the geometry
	whenever a window is resized
parent 8e5c3794
2002-06-10 Frank Worsley <fworsley@shaw.ca>
* src/nautilus-application.c:
* src/nautilus-window-manage-views.c:
* src/nautilus-window.c:
* src/nautilus-window.h:
always load the saved window geometry and save the geometry
whenever a window is resized
2002-06-10 Rajeev Karale <rajeev.karale@wipro.com>
* libnautilus-private/nautilus-volume-monitor.c:finish_creating_volume() zip disk mount path fix for solaris.
......
......@@ -641,6 +641,57 @@ nautilus_window_delete_event_callback (GtkWidget *widget,
return TRUE;
}
static gboolean
save_window_geometry_idle (gpointer callback_data)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (callback_data);
nautilus_window_save_geometry (window);
window->save_geometry_idle_id = 0;
return FALSE;
}
static gboolean
nautilus_window_configure_event_callback (GtkWidget *widget,
GdkEventConfigure *event,
gpointer callback_data)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (widget);
/* Only save the geometry when we are idle,
* since we receive configure events all the time.
*/
if (window->save_geometry_idle_id == 0) {
window->save_geometry_idle_id =
g_idle_add (save_window_geometry_idle, window);
}
return FALSE;
}
static gboolean
nautilus_window_unrealize_event_callback (GtkWidget *widget,
GdkEvent *event,
gpointer callback_data)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (widget);
if (window->save_geometry_idle_id != 0) {
g_source_remove (window->save_geometry_idle_id);
window->save_geometry_idle_id = 0;
nautilus_window_save_geometry (window);
}
return FALSE;
}
NautilusWindow *
nautilus_application_create_window (NautilusApplication *application)
{
......@@ -658,6 +709,12 @@ nautilus_application_create_window (NautilusApplication *application)
g_signal_connect_object (window, "destroy",
G_CALLBACK (nautilus_application_destroyed_window), application, 0);
g_signal_connect (window, "configure_event",
G_CALLBACK (nautilus_window_configure_event_callback), NULL);
g_signal_connect (window, "unrealize",
G_CALLBACK (nautilus_window_unrealize_event_callback), NULL);
nautilus_application_window_list = g_list_prepend (nautilus_application_window_list, window);
/* Do not yet show the window. It will be shown later on if it can
......
......@@ -864,13 +864,12 @@ nautilus_window_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
void
nautilus_window_save_geometry (NautilusWindow *window)
{
char *geometry_string;
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (GTK_WIDGET_VISIBLE (window));
geometry_string = eel_gtk_window_get_geometry_string (GTK_WINDOW (window));
......@@ -886,14 +885,6 @@ nautilus_window_close (NautilusWindow *window)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
/* Save the window position in the directory's metadata only if
* we're in every-location-in-its-own-window mode. Otherwise it
* would be too apparently random when the stored positions change.
*/
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW)) {
nautilus_window_save_geometry (window);
}
gtk_widget_destroy (GTK_WIDGET (window));
}
......
......@@ -82,6 +82,7 @@ struct NautilusWindow {
GtkWidget *navigation_bar;
guint status_bar_clear_id;
guint save_geometry_idle_id;
/** CORBA-related elements **/
NautilusApplication *application;
......@@ -153,5 +154,6 @@ gboolean nautilus_window_sidebar_showing (NautilusWindow *window);
void nautilus_window_hide_status_bar (NautilusWindow *window);
void nautilus_window_show_status_bar (NautilusWindow *window);
gboolean nautilus_window_status_bar_showing (NautilusWindow *window);
void nautilus_window_save_geometry (NautilusWindow *window);
#endif
......@@ -864,13 +864,12 @@ nautilus_window_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
void
nautilus_window_save_geometry (NautilusWindow *window)
{
char *geometry_string;
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (GTK_WIDGET_VISIBLE (window));
geometry_string = eel_gtk_window_get_geometry_string (GTK_WINDOW (window));
......@@ -886,14 +885,6 @@ nautilus_window_close (NautilusWindow *window)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
/* Save the window position in the directory's metadata only if
* we're in every-location-in-its-own-window mode. Otherwise it
* would be too apparently random when the stored positions change.
*/
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW)) {
nautilus_window_save_geometry (window);
}
gtk_widget_destroy (GTK_WIDGET (window));
}
......
......@@ -82,6 +82,7 @@ struct NautilusWindow {
GtkWidget *navigation_bar;
guint status_bar_clear_id;
guint save_geometry_idle_id;
/** CORBA-related elements **/
NautilusApplication *application;
......@@ -153,5 +154,6 @@ gboolean nautilus_window_sidebar_showing (NautilusWindow *window);
void nautilus_window_hide_status_bar (NautilusWindow *window);
void nautilus_window_show_status_bar (NautilusWindow *window);
gboolean nautilus_window_status_bar_showing (NautilusWindow *window);
void nautilus_window_save_geometry (NautilusWindow *window);
#endif
......@@ -864,13 +864,12 @@ nautilus_window_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
void
nautilus_window_save_geometry (NautilusWindow *window)
{
char *geometry_string;
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (GTK_WIDGET_VISIBLE (window));
geometry_string = eel_gtk_window_get_geometry_string (GTK_WINDOW (window));
......@@ -886,14 +885,6 @@ nautilus_window_close (NautilusWindow *window)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
/* Save the window position in the directory's metadata only if
* we're in every-location-in-its-own-window mode. Otherwise it
* would be too apparently random when the stored positions change.
*/
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW)) {
nautilus_window_save_geometry (window);
}
gtk_widget_destroy (GTK_WIDGET (window));
}
......
......@@ -82,6 +82,7 @@ struct NautilusWindow {
GtkWidget *navigation_bar;
guint status_bar_clear_id;
guint save_geometry_idle_id;
/** CORBA-related elements **/
NautilusApplication *application;
......@@ -153,5 +154,6 @@ gboolean nautilus_window_sidebar_showing (NautilusWindow *window);
void nautilus_window_hide_status_bar (NautilusWindow *window);
void nautilus_window_show_status_bar (NautilusWindow *window);
gboolean nautilus_window_status_bar_showing (NautilusWindow *window);
void nautilus_window_save_geometry (NautilusWindow *window);
#endif
......@@ -608,12 +608,6 @@ ref_now_unref_at_idle_time (GObject *object)
g_idle_add (unref_callback, object);
}
static gboolean
use_saved_window_positions (void)
{
return eel_preferences_get_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW);
}
/* This is called when we have decided we can actually change to the new view/location situation. */
static void
location_has_really_changed (NautilusWindow *window)
......@@ -658,8 +652,7 @@ location_has_really_changed (NautilusWindow *window)
* metadata. Then tell the callback it needs to show the
* window
*/
if (!use_saved_window_positions () ||
window->show_state == NAUTILUS_WINDOW_POSITION_SET) {
if (window->show_state == NAUTILUS_WINDOW_POSITION_SET) {
gtk_widget_show (GTK_WIDGET (window));
} else {
window->show_state = NAUTILUS_WINDOW_SHOULD_SHOW;
......@@ -1124,7 +1117,7 @@ position_and_show_window_callback (NautilusFile *file,
window = NAUTILUS_WINDOW (callback_data);
if (use_saved_window_positions ()) {
/* load the saved window geometry */
geometry_string = nautilus_file_get_metadata
(file, NAUTILUS_METADATA_KEY_WINDOW_GEOMETRY, NULL);
if (geometry_string != NULL) {
......@@ -1135,7 +1128,6 @@ position_and_show_window_callback (NautilusFile *file,
NAUTILUS_WINDOW_MIN_HEIGHT);
}
g_free (geometry_string);
}
/* If we finished constructing the window by now we need
* to show the window here.
......@@ -1190,7 +1182,6 @@ determined_initial_view_callback (NautilusDetermineViewHandle *handle,
* windows), position and show it only after we've got the
* metadata (since position info is stored there).
*/
if (use_saved_window_positions ()) {
window->show_state = NAUTILUS_WINDOW_NOT_SHOWN;
if (!GTK_WIDGET_VISIBLE (window)) {
file = nautilus_file_get (location);
......@@ -1202,7 +1193,6 @@ determined_initial_view_callback (NautilusDetermineViewHandle *handle,
window);
g_list_free (attributes);
}
}
load_content_view (window, initial_view);
return;
......
......@@ -864,13 +864,12 @@ nautilus_window_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
void
nautilus_window_save_geometry (NautilusWindow *window)
{
char *geometry_string;
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (GTK_WIDGET_VISIBLE (window));
geometry_string = eel_gtk_window_get_geometry_string (GTK_WINDOW (window));
......@@ -886,14 +885,6 @@ nautilus_window_close (NautilusWindow *window)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
/* Save the window position in the directory's metadata only if
* we're in every-location-in-its-own-window mode. Otherwise it
* would be too apparently random when the stored positions change.
*/
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW)) {
nautilus_window_save_geometry (window);
}
gtk_widget_destroy (GTK_WIDGET (window));
}
......
......@@ -82,6 +82,7 @@ struct NautilusWindow {
GtkWidget *navigation_bar;
guint status_bar_clear_id;
guint save_geometry_idle_id;
/** CORBA-related elements **/
NautilusApplication *application;
......@@ -153,5 +154,6 @@ gboolean nautilus_window_sidebar_showing (NautilusWindow *window);
void nautilus_window_hide_status_bar (NautilusWindow *window);
void nautilus_window_show_status_bar (NautilusWindow *window);
gboolean nautilus_window_status_bar_showing (NautilusWindow *window);
void nautilus_window_save_geometry (NautilusWindow *window);
#endif
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