[nautilus] Don't show the window until all views in it are visible
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus] Don't show the window until all views in it are visible
- Date: Fri, 11 Dec 2009 15:54:27 +0000 (UTC)
commit 1a6db1b3ff79971f75ad309c22d60c14b2af2857
Author: Alexander Larsson <alexl redhat com>
Date: Fri Dec 11 16:50:39 2009 +0100
Don't show the window until all views in it are visible
For the dual-pane at startup case we want to delay window
change until all views are loaded. Also when switching to
split view we want to delay showing until the view is loaded.
libnautilus-private/nautilus-window-info.c | 5 +-
libnautilus-private/nautilus-window-info.h | 6 ++-
src/file-manager/fm-directory-view.c | 4 +-
src/nautilus-navigation-window-pane.c | 9 ++++
src/nautilus-window-pane.c | 9 ++++
src/nautilus-window-pane.h | 4 ++
src/nautilus-window-slot.h | 2 +
src/nautilus-window.c | 61 ++++++++++++++++++++++++----
src/nautilus-window.h | 1 -
9 files changed, 86 insertions(+), 15 deletions(-)
---
diff --git a/libnautilus-private/nautilus-window-info.c b/libnautilus-private/nautilus-window-info.c
index 787e398..60da170 100644
--- a/libnautilus-private/nautilus-window-info.c
+++ b/libnautilus-private/nautilus-window-info.c
@@ -152,11 +152,12 @@ nautilus_window_info_report_selection_changed (NautilusWindowInfo *window)
}
void
-nautilus_window_info_show_window (NautilusWindowInfo *window)
+nautilus_window_info_view_visible (NautilusWindowInfo *window,
+ NautilusView *view)
{
g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
- (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->show_window) (window);
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->view_visible) (window, view);
}
void
diff --git a/libnautilus-private/nautilus-window-info.h b/libnautilus-private/nautilus-window-info.h
index 63a7325..3c2bdec 100644
--- a/libnautilus-private/nautilus-window-info.h
+++ b/libnautilus-private/nautilus-window-info.h
@@ -138,7 +138,8 @@ struct _NautilusWindowInfoIface
NautilusWindowSlotInfo * (* get_active_slot) (NautilusWindowInfo *window);
- void (* show_window) (NautilusWindowInfo *window);
+ void (* view_visible) (NautilusWindowInfo *window,
+ NautilusView *view);
void (* close_window) (NautilusWindowInfo *window);
GtkUIManager * (* get_ui_manager) (NautilusWindowInfo *window);
/* return TRUE if other pane is writable (files can be moved/copied
@@ -158,7 +159,8 @@ void nautilus_window_info_report_view_failed
NautilusView *view);
void nautilus_window_info_report_selection_changed (NautilusWindowInfo *window);
NautilusWindowSlotInfo * nautilus_window_info_get_active_slot (NautilusWindowInfo *window);
-void nautilus_window_info_show_window (NautilusWindowInfo *window);
+void nautilus_window_info_view_visible (NautilusWindowInfo *window,
+ NautilusView *view);
void nautilus_window_info_close (NautilusWindowInfo *window);
void nautilus_window_info_push_status (NautilusWindowInfo *window,
const char *status);
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index df20d98..4b38a54 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -9394,9 +9394,9 @@ finish_loading (FMDirectoryView *view)
* Subclasses use this to know that the new metadata is now available.
*/
fm_directory_view_begin_loading (view);
-
+
/* Assume we have now all information to show window */
- nautilus_window_info_show_window (view->details->window);
+ nautilus_window_info_view_visible (view->details->window, NAUTILUS_VIEW (view));
if (nautilus_directory_are_all_files_seen (view->details->model)) {
/* Unschedule a pending update and schedule a new one with the minimal
diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c
index 26c2c04..106057a 100644
--- a/src/nautilus-navigation-window-pane.c
+++ b/src/nautilus-navigation-window-pane.c
@@ -797,9 +797,18 @@ nautilus_navigation_window_pane_init (NautilusNavigationWindowPane *pane)
}
static void
+nautilus_navigation_window_pane_show (NautilusWindowPane *pane)
+{
+ NautilusNavigationWindowPane *npane = NAUTILUS_NAVIGATION_WINDOW_PANE (pane);
+
+ gtk_widget_show (npane->widget);
+}
+
+static void
nautilus_navigation_window_pane_class_init (NautilusNavigationWindowPaneClass *class)
{
G_OBJECT_CLASS (class)->dispose = nautilus_navigation_window_pane_dispose;
+ NAUTILUS_WINDOW_PANE_CLASS (class)->show = nautilus_navigation_window_pane_show;
}
static void
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index 25cc528..4b910b3 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -26,6 +26,7 @@
#include "nautilus-window-private.h"
#include "nautilus-navigation-window-pane.h"
#include "nautilus-window-manage-views.h"
+#include <eel/eel-gtk-macros.h>
static void nautilus_window_pane_init (NautilusWindowPane *pane);
static void nautilus_window_pane_class_init (NautilusWindowPaneClass *class);
@@ -54,6 +55,14 @@ get_first_inactive_slot (NautilusWindowPane *pane)
}
void
+nautilus_window_pane_show (NautilusWindowPane *pane)
+{
+ pane->visible = TRUE;
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_PANE_CLASS, pane,
+ show, (pane));
+}
+
+void
nautilus_window_pane_zoom_in (NautilusWindowPane *pane)
{
NautilusWindowSlot *slot;
diff --git a/src/nautilus-window-pane.h b/src/nautilus-window-pane.h
index e73a2fe..77895b5 100644
--- a/src/nautilus-window-pane.h
+++ b/src/nautilus-window-pane.h
@@ -38,6 +38,8 @@ typedef struct _NautilusWindowPaneClass NautilusWindowPaneClass;
struct _NautilusWindowPaneClass {
GObjectClass parent_class;
+
+ void (*show) (NautilusWindowPane *pane);
};
/* A NautilusWindowPane is a layer between a slot and a window.
@@ -55,6 +57,7 @@ struct _NautilusWindowPane {
/* hosting window */
NautilusWindow *window;
+ gboolean visible;
/* available slots, and active slot.
* Both of them may never be NULL. */
@@ -70,6 +73,7 @@ GType nautilus_window_pane_get_type (void);
NautilusWindowPane *nautilus_window_pane_new (NautilusWindow *window);
+void nautilus_window_pane_show (NautilusWindowPane *pane);
void nautilus_window_pane_zoom_in (NautilusWindowPane *pane);
void nautilus_window_pane_zoom_to_level (NautilusWindowPane *pane, NautilusZoomLevel level);
void nautilus_window_pane_zoom_out (NautilusWindowPane *pane);
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 3b06f7b..ce276d8 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -108,6 +108,8 @@ struct NautilusWindowSlot {
gboolean tried_mount;
GCancellable *find_mount_cancellable;
+
+ gboolean visible;
};
GType nautilus_window_slot_get_type (void);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 10d87f6..eaaefdb 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -648,18 +648,14 @@ nautilus_window_constructor (GType type,
}
void
-nautilus_window_show_window (NautilusWindow *window)
+nautilus_window_show_window (NautilusWindow *window)
{
NautilusWindowSlot *slot;
+ NautilusWindowPane *pane;
GList *l, *walk;
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- show_window, (window));
-
for (walk = window->details->panes; walk; walk = walk->next) {
- NautilusWindowPane *pane = walk->data;
+ pane = walk->data;
for (l = pane->slots; l != NULL; l = l->next) {
slot = l->data;
@@ -679,6 +675,55 @@ nautilus_window_show_window (NautilusWindow *window)
}
}
+static void
+nautilus_window_view_visible (NautilusWindow *window,
+ NautilusView *view)
+{
+ NautilusWindowSlot *slot;
+ NautilusWindowPane *pane;
+ GList *l, *walk;
+
+ g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+
+ slot = nautilus_window_get_slot_for_view (window, view);
+
+ if (slot->visible) {
+ return;
+ }
+
+ slot->visible = TRUE;
+
+ pane = slot->pane;
+
+ if (pane->visible) {
+ return;
+ }
+
+ /* Look for other non-visible slots */
+ for (l = pane->slots; l != NULL; l = l->next) {
+ slot = l->data;
+
+ if (!slot->visible) {
+ return;
+ }
+ }
+
+ /* None, this pane is visible */
+ nautilus_window_pane_show (pane);
+
+ /* Look for other non-visible panes */
+ for (walk = window->details->panes; walk; walk = walk->next) {
+ pane = walk->data;
+
+ if (!pane->visible) {
+ return;
+ }
+ }
+
+ /* All slots and panes visible, show window */
+ nautilus_window_show_window (window);
+}
+
void
nautilus_window_close (NautilusWindow *window)
{
@@ -1932,7 +1977,7 @@ nautilus_window_info_iface_init (NautilusWindowInfoIface *iface)
iface->report_load_complete = nautilus_window_report_load_complete;
iface->report_selection_changed = nautilus_window_report_selection_changed;
iface->report_view_failed = nautilus_window_report_view_failed;
- iface->show_window = nautilus_window_show_window;
+ iface->view_visible = nautilus_window_view_visible;
iface->close_window = nautilus_window_close;
iface->push_status = nautilus_window_push_status;
iface->get_window_type = nautilus_window_get_window_type;
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 3b53f8e..ada3560 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -101,7 +101,6 @@ typedef struct {
void (* prompt_for_location) (NautilusWindow *window, const char *initial);
void (* sync_search_widgets) (NautilusWindow *window);
void (* get_default_size) (NautilusWindow *window, guint *default_width, guint *default_height);
- void (* show_window) (NautilusWindow *window);
void (* close) (NautilusWindow *window);
NautilusWindowSlot * (* open_slot) (NautilusWindowPane *pane,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]