Commit df81a1e4 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson
Browse files

Only display toplevel window when it's fully constructed.

2002-04-21  Alexander Larsson  <alla@lysator.liu.se>

	* src/nautilus-window.h:
	* src/nautilus-window-manage-views.c:
	Only display toplevel window when it's fully constructed.

	* src/nautilus-desktop-window.c (nautilus_desktop_window_new):
	* src/nautilus-application.c (nautilus_application_create_desktop_window):
	Don't show desktop window here. It's shown later when the view
	is loaded.

	* libnautilus-private/nautilus-horizontal-splitter.c
	(nautilus_horizontal_splitter_pack2): Remove old code that is
	not neccesary when we display the window fully constructed.
parent 3baf2e62
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
* src/nautilus-window.h:
* src/nautilus-window-manage-views.c:
Only display toplevel window when it's fully constructed.
* src/nautilus-desktop-window.c (nautilus_desktop_window_new):
* src/nautilus-application.c (nautilus_application_create_desktop_window):
Don't show desktop window here. It's shown later when the view
is loaded.
* libnautilus-private/nautilus-horizontal-splitter.c
(nautilus_horizontal_splitter_pack2): Remove old code that is
not neccesary when we display the window fully constructed.
2002-04-21 Anders Carlsson <andersca@gnu.org>
* libnautilus-private/nautilus-icon-container.c:
......
......@@ -283,34 +283,11 @@ void
nautilus_horizontal_splitter_pack2 (NautilusHorizontalSplitter *splitter,
GtkWidget *child2)
{
gboolean re_expose;
GtkPaned *paned;
g_return_if_fail (GTK_IS_WIDGET (child2));
g_return_if_fail (NAUTILUS_IS_HORIZONTAL_SPLITTER (splitter));
paned = GTK_PANED (splitter);
re_expose = (paned->child2 == NULL ||
!GTK_WIDGET_VISIBLE (paned->child2));
gtk_paned_pack2 (paned, child2, TRUE, TRUE);
if (re_expose) {
/* We have to expose the divider, since the pane relies
* on a resize when you add the 2nd item to get it's
* rendering right */
/* this calculates the handle positon correctly */
gtk_widget_size_allocate (GTK_WIDGET (splitter),
&GTK_WIDGET (splitter)->allocation);
/* and this renders it */
gtk_widget_queue_draw_area (GTK_WIDGET (splitter),
paned->handle_pos.x,
paned->handle_pos.y,
paned->handle_pos.width,
paned->handle_pos.height);
}
}
......@@ -590,8 +590,6 @@ nautilus_application_create_desktop_window (NautilusApplication *application)
nautilus_application_desktop_window = nautilus_desktop_window_new (application);
create_in_progress = FALSE;
gtk_widget_show (GTK_WIDGET (nautilus_application_desktop_window));
}
void
......
......@@ -117,8 +117,6 @@ nautilus_desktop_window_new (NautilusApplication *application)
*/
nautilus_desktop_window_update_directory (window);
gtk_widget_show (GTK_WIDGET (window));
return window;
}
......
......@@ -62,6 +62,12 @@ typedef struct {
void (* add_current_location_to_history_list) (NautilusWindow *window);
} NautilusWindowClass;
typedef enum {
NAUTILUS_WINDOW_NOT_SHOWN,
NAUTILUS_WINDOW_POSITION_SET,
NAUTILUS_WINDOW_SHOULD_SHOW
} NautilusWindowShowState;
typedef struct NautilusWindowDetails NautilusWindowDetails;
struct NautilusWindow {
......@@ -101,6 +107,9 @@ struct NautilusWindow {
/* Pending changes */
NautilusViewFrame *new_content_view;
/* Window showed state (for saved_window_positions) */
NautilusWindowShowState show_state;
};
GtkType nautilus_window_get_type (void);
......
......@@ -62,6 +62,12 @@ typedef struct {
void (* add_current_location_to_history_list) (NautilusWindow *window);
} NautilusWindowClass;
typedef enum {
NAUTILUS_WINDOW_NOT_SHOWN,
NAUTILUS_WINDOW_POSITION_SET,
NAUTILUS_WINDOW_SHOULD_SHOW
} NautilusWindowShowState;
typedef struct NautilusWindowDetails NautilusWindowDetails;
struct NautilusWindow {
......@@ -101,6 +107,9 @@ struct NautilusWindow {
/* Pending changes */
NautilusViewFrame *new_content_view;
/* Window showed state (for saved_window_positions) */
NautilusWindowShowState show_state;
};
GtkType nautilus_window_get_type (void);
......
......@@ -62,6 +62,12 @@ typedef struct {
void (* add_current_location_to_history_list) (NautilusWindow *window);
} NautilusWindowClass;
typedef enum {
NAUTILUS_WINDOW_NOT_SHOWN,
NAUTILUS_WINDOW_POSITION_SET,
NAUTILUS_WINDOW_SHOULD_SHOW
} NautilusWindowShowState;
typedef struct NautilusWindowDetails NautilusWindowDetails;
struct NautilusWindow {
......@@ -101,6 +107,9 @@ struct NautilusWindow {
/* Pending changes */
NautilusViewFrame *new_content_view;
/* Window showed state (for saved_window_positions) */
NautilusWindowShowState show_state;
};
GtkType nautilus_window_get_type (void);
......
......@@ -608,6 +608,12 @@ 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)
......@@ -646,12 +652,18 @@ location_has_really_changed (NautilusWindow *window)
free_location_change (window);
update_title (window);
}
static gboolean
use_saved_window_positions (void)
{
return eel_preferences_get_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW);
/* The whole window has been finished. Now show it, unless
* we're still waiting for the saved positions from the
* metadata. Then tell the callback it needs to show the
* window
*/
if (!use_saved_window_positions () ||
window->show_state == NAUTILUS_WINDOW_POSITION_SET) {
gtk_widget_show (GTK_WIDGET (window));
} else {
window->show_state = NAUTILUS_WINDOW_SHOULD_SHOW;
}
}
static void
......@@ -687,9 +699,6 @@ open_location (NautilusWindow *window,
if (create_new_window) {
target_window = nautilus_application_create_window (window->application);
if (!use_saved_window_positions ()) {
gtk_widget_show (GTK_WIDGET (target_window));
}
}
eel_g_list_free_deep (target_window->details->pending_selection);
......@@ -1124,8 +1133,14 @@ position_and_show_window_callback (NautilusFile *file,
g_free (geometry_string);
}
gtk_widget_show (GTK_WIDGET (window));
/* If we finished constructing the window by now we need
* to show the window here.
*/
if (window->show_state == NAUTILUS_WINDOW_SHOULD_SHOW) {
gtk_widget_show (GTK_WIDGET (window));
}
window->show_state = NAUTILUS_WINDOW_POSITION_SET;
/* This object was ref'd when starting the callback. */
nautilus_file_unref (file);
}
......@@ -1171,9 +1186,8 @@ 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 ()) {
gtk_widget_show (GTK_WIDGET (window));
} else {
if (use_saved_window_positions ()) {
window->show_state = NAUTILUS_WINDOW_NOT_SHOWN;
if (!GTK_WIDGET_VISIBLE (window)) {
file = nautilus_file_get (location);
......
......@@ -62,6 +62,12 @@ typedef struct {
void (* add_current_location_to_history_list) (NautilusWindow *window);
} NautilusWindowClass;
typedef enum {
NAUTILUS_WINDOW_NOT_SHOWN,
NAUTILUS_WINDOW_POSITION_SET,
NAUTILUS_WINDOW_SHOULD_SHOW
} NautilusWindowShowState;
typedef struct NautilusWindowDetails NautilusWindowDetails;
struct NautilusWindow {
......@@ -101,6 +107,9 @@ struct NautilusWindow {
/* Pending changes */
NautilusViewFrame *new_content_view;
/* Window showed state (for saved_window_positions) */
NautilusWindowShowState show_state;
};
GtkType nautilus_window_get_type (void);
......
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