nautilus r14454 - in trunk: . src
- From: cneumair svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14454 - in trunk: . src
- Date: Wed, 6 Aug 2008 10:11:22 +0000 (UTC)
Author: cneumair
Date: Wed Aug 6 10:11:22 2008
New Revision: 14454
URL: http://svn.gnome.org/viewvc/nautilus?rev=14454&view=rev
Log:
2008-08-06 Christian Neumair <cneumair gnome org>
* src/nautilus-navigation-window.c (real_sync_zoom_widgets),
(nautilus_navigation_window_class_init):
* src/nautilus-window-manage-views.c (create_content_view),
(location_has_really_changed), (update_for_new_location),
(free_location_change), (nautilus_window_report_view_failed),
(nautilus_window_manage_views_destroy),
(nautilus_window_manage_views_close_slot):
* src/nautilus-window-private.h:
* src/nautilus-window-slot.c (real_active),
(title_changed_callback),
(nautilus_window_slot_connect_content_view),
(nautilus_window_slot_disconnect_content_view),
(nautilus_window_slot_set_content_view_widget):
* src/nautilus-window-slot.h:
* src/nautilus-window.c (nautilus_window_set_active_slot),
(real_sync_zoom_widgets), (nautilus_window_sync_zoom_widgets),
(zoom_level_changed_callback),
(nautilus_window_connect_content_view),
(nautilus_window_disconnect_content_view),
(nautilus_window_class_init):
* src/nautilus-window.h:
Consolidate zoom handling. Add nautilus_window_sync_zoom_level(),
and sync_zoom_level() method to NautilusWindow. Use it to sync both
the menu state, and the toolbar state. Remove NautilusWindow's
(dis)connect_content_view(), and use unified code in
nautilus_window_(dis)connect_content_view(), wrapped by
nautilus_window_slot_(dis)connect_content_view(), which also handles
the (notebook) title sync. Fixes #546333.
Modified:
trunk/ChangeLog
trunk/src/nautilus-navigation-window.c
trunk/src/nautilus-window-manage-views.c
trunk/src/nautilus-window-private.h
trunk/src/nautilus-window-slot.c
trunk/src/nautilus-window-slot.h
trunk/src/nautilus-window.c
trunk/src/nautilus-window.h
Modified: trunk/src/nautilus-navigation-window.c
==============================================================================
--- trunk/src/nautilus-navigation-window.c (original)
+++ trunk/src/nautilus-navigation-window.c Wed Aug 6 10:11:22 2008
@@ -1225,78 +1225,6 @@
}
static void
-zoom_level_changed_callback (NautilusView *view,
- NautilusNavigationWindow *window)
-{
- g_assert (NAUTILUS_WINDOW (window)->details->active_slot->content_view == view);
-
- /* This is called each time the component successfully completed
- * a zooming operation.
- */
- nautilus_zoom_control_set_zoom_level (NAUTILUS_ZOOM_CONTROL (window->zoom_control),
- nautilus_view_get_zoom_level (view));
-}
-
-static void
-real_connect_content_view (NautilusWindow *nautilus_window,
- NautilusView *view)
-{
- NautilusNavigationWindow *window;
- NautilusWindowSlot *slot;
-
- window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
- slot = nautilus_window->details->active_slot;
-
- EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
- connect_content_view,
- (nautilus_window, view));
-
- g_signal_connect (view, "zoom_level_changed",
- G_CALLBACK (zoom_level_changed_callback),
- window);
-
- if (nautilus_view_supports_zooming (view)) {
- gtk_widget_show (window->zoom_control);
- } else {
- gtk_widget_hide (window->zoom_control);
- }
-
- /* Update displayed view in menu. Only do this if we're not switching
- * locations though, because if we are switching locations we'll
- * install a whole new set of views in the menu later (the current
- * views in the menu are for the old location).
- */
- if (slot->pending_location == NULL) {
- load_view_as_menu (nautilus_window);
- }
-}
-
-static void
-real_disconnect_content_view (NautilusWindow *nautilus_window,
- NautilusView *view)
-{
- NautilusNavigationWindow *window;
-
- window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
-
- EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
- disconnect_content_view,
- (nautilus_window, view));
-
- g_signal_handlers_disconnect_by_func
- (view,
- G_CALLBACK (zoom_level_changed_callback),
- window);
-
- if (window->zoom_control != NULL) {
- /* if we run in destroy(), the
- * zoom control is already gone
- */
- gtk_widget_hide (window->zoom_control);
- }
-}
-
-static void
real_sync_allow_stop (NautilusWindow *window,
NautilusWindowSlot *slot)
{
@@ -1563,6 +1491,50 @@
}
}
+
+static void
+real_sync_zoom_widgets (NautilusWindow *nautilus_window)
+{
+ NautilusNavigationWindow *window;
+ NautilusWindowSlot *slot;
+ NautilusView *view;
+ gboolean supports_zooming, can_zoom;
+
+ window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
+
+ slot = nautilus_window->details->active_slot;
+ view = slot->content_view;
+
+ EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
+ sync_zoom_widgets, (nautilus_window));
+
+ if (view == NULL) {
+ /* don't toggle UI state at all. This might be
+ * wrong, but it prevents flickering when opening
+ * a new tab and immediately switching to it -
+ * before view selection.
+ */
+ return;
+ }
+
+ supports_zooming = nautilus_view_supports_zooming (view);
+ can_zoom = supports_zooming &&
+ nautilus_view_get_zoom_level (view) != 0.0;
+
+ if (window->zoom_control != NULL) {
+ if (supports_zooming) {
+ gtk_widget_set_sensitive (window->zoom_control, can_zoom);
+ gtk_widget_show (window->zoom_control);
+ if (can_zoom) {
+ nautilus_zoom_control_set_zoom_level (NAUTILUS_ZOOM_CONTROL (window->zoom_control),
+ nautilus_view_get_zoom_level (view));
+ }
+ } else {
+ gtk_widget_hide (window->zoom_control);
+ }
+ }
+}
+
static void
side_panel_image_changed_callback (NautilusSidebar *side_panel,
gpointer callback_data)
@@ -2017,11 +1989,10 @@
GTK_WIDGET_CLASS (class)->window_state_event = nautilus_navigation_window_state_event;
GTK_WIDGET_CLASS (class)->key_press_event = nautilus_navigation_window_key_press_event;
NAUTILUS_WINDOW_CLASS (class)->load_view_as_menu = real_load_view_as_menu;
- NAUTILUS_WINDOW_CLASS (class)->connect_content_view = real_connect_content_view;
- NAUTILUS_WINDOW_CLASS (class)->disconnect_content_view = real_disconnect_content_view;
NAUTILUS_WINDOW_CLASS (class)->sync_allow_stop = real_sync_allow_stop;
NAUTILUS_WINDOW_CLASS (class)->prompt_for_location = real_prompt_for_location;
NAUTILUS_WINDOW_CLASS (class)->sync_search_widgets = real_sync_search_widgets;
+ NAUTILUS_WINDOW_CLASS (class)->sync_zoom_widgets = real_sync_zoom_widgets;
NAUTILUS_WINDOW_CLASS (class)->sync_title = real_sync_title;
NAUTILUS_WINDOW_CLASS (class)->get_icon = real_get_icon;
NAUTILUS_WINDOW_CLASS (class)->get_default_size = real_get_default_size;
Modified: trunk/src/nautilus-window-manage-views.c
==============================================================================
--- trunk/src/nautilus-window-manage-views.c (original)
+++ trunk/src/nautilus-window-manage-views.c Wed Aug 6 10:11:22 2008
@@ -82,10 +82,6 @@
*/
#define MAX_URI_IN_DIALOG_LENGTH 60
-static void slot_connect_view (NautilusWindowSlot *slot,
- NautilusView *view);
-static void slot_disconnect_view (NautilusWindowSlot *slot,
- NautilusView *view);
static void begin_location_change (NautilusWindowSlot *slot,
GFile *location,
GList *new_selection,
@@ -110,8 +106,6 @@
gboolean tell_new_content_view);
static void location_has_really_changed (NautilusWindowSlot *slot);
static void update_for_new_location (NautilusWindowSlot *slot);
-static void zoom_parameters_changed_callback (NautilusView *view,
- NautilusWindowSlot *window);
void
nautilus_window_report_selection_changed (NautilusWindowInfo *window)
@@ -1194,7 +1188,6 @@
NautilusWindow *window;
NautilusView *view;
GList *selection;
- GtkAction *action;
window = slot->window;
@@ -1209,16 +1202,6 @@
*/
view_id = NAUTILUS_DESKTOP_ICON_VIEW_IID;
}
-
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_IN);
- gtk_action_set_sensitive (action, FALSE);
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_OUT);
- gtk_action_set_sensitive (action, FALSE);
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_NORMAL);
- gtk_action_set_sensitive (action, FALSE);
if (slot->content_view != NULL &&
eel_strcmp (nautilus_view_get_view_id (slot->content_view),
@@ -1234,10 +1217,9 @@
eel_accessibility_set_name (view, _("Content View"));
eel_accessibility_set_description (view, _("View of the current folder"));
-
- slot_connect_view (slot, view);
-
+
slot->new_content_view = view;
+ nautilus_window_slot_connect_content_view (slot, slot->new_content_view);
}
/* Actually load the pending location and selection: */
@@ -1395,7 +1377,9 @@
widget = nautilus_view_get_widget (slot->new_content_view);
/* Switch to the new content view. */
if (widget->parent == NULL) {
- slot_disconnect_view (slot, slot->content_view);
+ if (slot->content_view != NULL) {
+ nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
+ }
nautilus_window_slot_set_content_view_widget (slot, slot->new_content_view);
}
g_object_unref (slot->new_content_view);
@@ -1635,12 +1619,9 @@
/* Check if we can go up. */
update_up_button (window);
}
-
- /* Set up the initial zoom levels */
- zoom_parameters_changed_callback (slot->content_view,
- slot);
if (slot == window->details->active_slot) {
+ nautilus_window_sync_zoom_widgets (window);
/* Set up the content view menu for this new location. */
nautilus_window_load_view_as_menus (window);
@@ -1786,7 +1767,7 @@
nautilus_view_stop_loading (slot->new_content_view);
window->details->temporarily_ignore_view_signals = FALSE;
- slot_disconnect_view (slot, slot->new_content_view);
+ nautilus_window_slot_disconnect_content_view (slot, slot->new_content_view);
g_object_unref (slot->new_content_view);
slot->new_content_view = NULL;
}
@@ -1839,7 +1820,7 @@
fallback_load_location = NULL;
if (view == slot->content_view) {
- slot_disconnect_view (slot, slot->content_view);
+ nautilus_window_slot_disconnect_content_view (slot, view);
nautilus_window_slot_set_content_view_widget (slot, NULL);
report_current_content_view_failure_to_user (slot);
@@ -2037,123 +2018,6 @@
create_content_view (slot, id);
}
-static void
-zoom_level_changed_callback (NautilusView *view,
- NautilusWindowSlot *slot)
-{
- NautilusWindow *window;
- GtkAction *action;
- gboolean supports_zooming;
-
- window = slot->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- if (slot != nautilus_window_get_active_slot (window)) {
- return;
- }
-
- /* This is called each time the component successfully completed
- * a zooming operation.
- */
-
- supports_zooming = nautilus_view_supports_zooming (view);
-
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_IN);
- gtk_action_set_visible (action, supports_zooming);
- gtk_action_set_sensitive (action,
- nautilus_view_can_zoom_in (view));
-
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_OUT);
- gtk_action_set_visible (action, supports_zooming);
- gtk_action_set_sensitive (action,
- nautilus_view_can_zoom_out (view));
-
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_NORMAL);
- gtk_action_set_visible (action, supports_zooming);
- gtk_action_set_sensitive (action, supports_zooming);
-}
-
-static void
-zoom_parameters_changed_callback (NautilusView *view,
- NautilusWindowSlot *slot)
-{
- NautilusWindow *window;
- float zoom_level;
- GtkAction *action;
-
- window = slot->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- if (slot != window->details->active_slot) {
- return;
- }
-
- /* The initial zoom level of a component is allowed to be 0.0 if
- * there is no file loaded yet. In this case we need to set the
- * commands insensitive but display the zoom control nevertheless
- * (the component is just temporarily unable to zoom, but the
- * zoom control will "do the right thing" here).
- */
- zoom_level = nautilus_view_get_zoom_level (view);
- if (zoom_level == 0.0) {
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_IN);
- gtk_action_set_sensitive (action, FALSE);
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_OUT);
- gtk_action_set_sensitive (action, FALSE);
- action = gtk_action_group_get_action (window->details->main_action_group,
- NAUTILUS_ACTION_ZOOM_NORMAL);
- gtk_action_set_sensitive (action, FALSE);
-
- /* Don't attempt to set 0.0 as zoom level. */
- return;
- }
-
- /* "zoom_parameters_changed" always implies "zoom_level_changed",
- * but you won't get both signals, so we need to pass it down.
- */
- zoom_level_changed_callback (view, slot);
-}
-
-static void
-title_changed_callback (NautilusView *view,
- NautilusWindowSlot *slot)
-{
- g_assert (NAUTILUS_IS_WINDOW (slot->window));
-
- nautilus_window_slot_update_title (slot);
- nautilus_window_slot_update_icon (slot);
-}
-
-static void
-slot_connect_view (NautilusWindowSlot *slot,
- NautilusView *view)
-{
- g_signal_connect (view, "title_changed",
- G_CALLBACK (title_changed_callback), slot);
- g_signal_connect (view, "zoom_level_changed",
- G_CALLBACK (zoom_level_changed_callback), slot);
- g_signal_connect (view, "zoom_parameters_changed",
- G_CALLBACK (zoom_parameters_changed_callback), slot);
-}
-
-static void
-slot_disconnect_view (NautilusWindowSlot *slot,
- NautilusView *view)
-{
- if (view == NULL) {
- return;
- }
-
- g_signal_handlers_disconnect_by_func (view, title_changed_callback, slot);
- g_signal_handlers_disconnect_by_func (view, zoom_level_changed_callback, slot);
- g_signal_handlers_disconnect_by_func (view, zoom_parameters_changed_callback, slot);
-}
-
void
nautilus_window_manage_views_destroy (NautilusWindow *window)
{
@@ -2168,10 +2032,10 @@
slot = l->data;
if (slot->content_view != NULL) {
- slot_disconnect_view (slot, slot->content_view);
+ nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
}
if (slot->new_content_view != NULL) {
- slot_disconnect_view (slot, slot->new_content_view);
+ nautilus_window_slot_disconnect_content_view (slot, slot->new_content_view);
}
}
}
@@ -2180,6 +2044,9 @@
nautilus_window_manage_views_close_slot (NautilusWindow *window,
NautilusWindowSlot *slot)
{
+ if (slot->content_view != NULL) {
+ nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
+ }
free_location_change (slot);
cancel_viewed_file_changed_callback (slot);
Modified: trunk/src/nautilus-window-private.h
==============================================================================
--- trunk/src/nautilus-window-private.h (original)
+++ trunk/src/nautilus-window-private.h Wed Aug 6 10:11:22 2008
@@ -224,6 +224,7 @@
void nautilus_window_sync_title (NautilusWindow *window,
NautilusWindowSlot *slot);
void nautilus_window_sync_location_widgets (NautilusWindow *window);
+void nautilus_window_sync_zoom_widgets (NautilusWindow *window);
/* Navigation window menus */
void nautilus_navigation_window_initialize_actions (NautilusNavigationWindow *window);
Modified: trunk/src/nautilus-window-slot.c
==============================================================================
--- trunk/src/nautilus-window-slot.c (original)
+++ trunk/src/nautilus-window-slot.c Wed Aug 6 10:11:22 2008
@@ -114,6 +114,7 @@
nautilus_window_sync_status (window);
nautilus_window_sync_allow_stop (window, slot);
nautilus_window_sync_title (window, slot);
+ nautilus_window_sync_zoom_widgets (window);
nautilus_window_sync_location_widgets (window);
nautilus_window_sync_search_widgets (window);
@@ -359,24 +360,60 @@
}
}
+static void
+title_changed_callback (NautilusView *view,
+ NautilusWindowSlot *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW (slot->window));
+
+ nautilus_window_slot_update_title (slot);
+ nautilus_window_slot_update_icon (slot);
+}
+
+
+void
+nautilus_window_slot_connect_content_view (NautilusWindowSlot *slot,
+ NautilusView *view)
+{
+ NautilusWindow *window;
+
+ g_signal_connect (view, "title-changed",
+ G_CALLBACK (title_changed_callback),
+ slot);
+
+ window = slot->window;
+ if (window != NULL && slot == nautilus_window_get_active_slot (window)) {
+ nautilus_window_connect_content_view (window, view);
+ }
+}
+
+void
+nautilus_window_slot_disconnect_content_view (NautilusWindowSlot *slot,
+ NautilusView *view)
+{
+ NautilusWindow *window;
+
+ g_signal_handlers_disconnect_by_func (view, G_CALLBACK (title_changed_callback), slot);
+
+ window = slot->window;
+ if (window != NULL && slot == nautilus_window_get_active_slot (window)) {
+ nautilus_window_disconnect_content_view (window, view);
+ }
+}
+
void
nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
NautilusView *new_view)
{
NautilusWindow *window;
GtkWidget *widget;
- gboolean inform_window;
window = slot->window;
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- inform_window = slot == window->details->active_slot;
+ g_assert (NAUTILUS_IS_WINDOW (window));
if (slot->content_view != NULL) {
/* disconnect old view */
- if (inform_window) {
- nautilus_window_disconnect_content_view (window, slot->content_view);
- }
+ nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
widget = nautilus_view_get_widget (slot->content_view);
gtk_widget_destroy (widget);
@@ -395,9 +432,7 @@
g_object_ref (slot->content_view);
/* connect new view */
- if (inform_window) {
- nautilus_window_connect_content_view (window, new_view);
- }
+ nautilus_window_slot_connect_content_view (slot, new_view);
}
}
Modified: trunk/src/nautilus-window-slot.h
==============================================================================
--- trunk/src/nautilus-window-slot.h (original)
+++ trunk/src/nautilus-window-slot.h Wed Aug 6 10:11:22 2008
@@ -142,6 +142,11 @@
gboolean nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
const char *iid);
+void nautilus_window_slot_connect_content_view (NautilusWindowSlot *slot,
+ NautilusView *view);
+void nautilus_window_slot_disconnect_content_view (NautilusWindowSlot *slot,
+ NautilusView *view);
+
#define nautilus_window_slot_go_to(slot,location, new_tab) \
nautilus_window_slot_open_location_full(slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, \
(new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
Modified: trunk/src/nautilus-window.c
==============================================================================
--- trunk/src/nautilus-window.c (original)
+++ trunk/src/nautilus-window.c Wed Aug 6 10:11:22 2008
@@ -762,7 +762,7 @@
if (old_slot != NULL) {
/* inform window */
if (old_slot->content_view != NULL) {
- nautilus_window_disconnect_content_view (window, old_slot->content_view);
+ nautilus_window_slot_disconnect_content_view (old_slot, old_slot->content_view);
}
/* inform slot & view */
@@ -782,7 +782,7 @@
if (new_slot->content_view != NULL) {
/* inform window */
- nautilus_window_connect_content_view (window, new_slot->content_view);
+ nautilus_window_slot_connect_content_view (new_slot, new_slot->content_view);
}
/* inform slot & view */
@@ -1313,55 +1313,112 @@
}
static void
-real_connect_content_view (NautilusWindow *window,
- NautilusView *view)
+real_sync_zoom_widgets (NautilusWindow *window)
{
NautilusWindowSlot *slot;
+ NautilusView *view;
+ GtkAction *action;
+ gboolean supports_zooming;
+ gboolean can_zoom, can_zoom_in, can_zoom_out;
slot = window->details->active_slot;
+ view = slot->content_view;
- /* Update displayed view in menu. Only do this if we're not switching
- * locations though, because if we are switching locations we'll
- * install a whole new set of views in the menu later (the current
- * views in the menu are for the old location).
- */
- if (slot->pending_location == NULL) {
- nautilus_window_load_view_as_menus (window);
+ if (view != NULL) {
+ supports_zooming = nautilus_view_supports_zooming (view);
+ can_zoom = supports_zooming && nautilus_view_get_zoom_level (view) != 0.0;
+ can_zoom_in = can_zoom && nautilus_view_can_zoom_in (view);
+ can_zoom_out = can_zoom && nautilus_view_can_zoom_out (view);
+ } else {
+ supports_zooming = FALSE;
+ can_zoom = FALSE;
+ can_zoom_in = FALSE;
+ can_zoom_out = FALSE;
}
- nautilus_view_grab_focus (view);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_IN);
+ gtk_action_set_visible (action, supports_zooming);
+ gtk_action_set_sensitive (action, can_zoom_in);
+
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_OUT);
+ gtk_action_set_visible (action, supports_zooming);
+ gtk_action_set_sensitive (action, can_zoom_out);
+
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_NORMAL);
+ gtk_action_set_visible (action, supports_zooming);
+ gtk_action_set_sensitive (action, can_zoom);
+}
+
+void
+nautilus_window_sync_zoom_widgets (NautilusWindow *window)
+{
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
+ sync_zoom_widgets, (window));
}
static void
-real_disconnect_content_view (NautilusWindow *window,
- NautilusView *view)
+zoom_level_changed_callback (NautilusView *view,
+ NautilusWindow *window)
{
g_assert (NAUTILUS_IS_WINDOW (window));
- g_assert (NAUTILUS_IS_VIEW (view));
- /* nothing to do... */
+ /* This is called each time the component in
+ * the active slot successfully completed
+ * a zooming operation.
+ */
+ nautilus_window_sync_zoom_widgets (window);
}
+
+/* These are called
+ * A) when switching the view within the active slot
+ * B) when switching the active slot
+ * C) when closing the active slot (disconnect)
+*/
void
nautilus_window_connect_content_view (NautilusWindow *window,
NautilusView *view)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (NAUTILUS_IS_VIEW (view));
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- connect_content_view, (window, view));
+ slot = nautilus_window_get_slot_for_view (window, view);
+ g_assert (slot == nautilus_window_get_active_slot (window));
+
+ g_signal_connect (view, "zoom-level-changed",
+ G_CALLBACK (zoom_level_changed_callback),
+ window);
+
+ /* Update displayed view in menu. Only do this if we're not switching
+ * locations though, because if we are switching locations we'll
+ * install a whole new set of views in the menu later (the current
+ * views in the menu are for the old location).
+ */
+ if (slot->pending_location == NULL) {
+ nautilus_window_load_view_as_menus (window);
+ }
+
+ nautilus_view_grab_focus (view);
}
void
nautilus_window_disconnect_content_view (NautilusWindow *window,
NautilusView *view)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (NAUTILUS_IS_VIEW (view));
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- disconnect_content_view, (window, view));
+ slot = nautilus_window_get_slot_for_view (window, view);
+ g_assert (slot == nautilus_window_get_active_slot (window));
+
+ g_signal_handlers_disconnect_by_func (view, G_CALLBACK (zoom_level_changed_callback), window);
}
/**
@@ -1772,8 +1829,7 @@
GTK_WIDGET_CLASS (class)->key_press_event = nautilus_window_key_press_event;
class->get_title = real_get_title;
class->sync_title = real_sync_title;
- class->connect_content_view = real_connect_content_view;
- class->disconnect_content_view = real_disconnect_content_view;
+ class->sync_zoom_widgets = real_sync_zoom_widgets;
class->load_view_as_menu = real_load_view_as_menu;
class->set_allow_up = real_set_allow_up;
class->close_slot = real_close_slot;
Modified: trunk/src/nautilus-window.h
==============================================================================
--- trunk/src/nautilus-window.h (original)
+++ trunk/src/nautilus-window.h Wed Aug 6 10:11:22 2008
@@ -89,21 +89,13 @@
void (* load_view_as_menu) (NautilusWindow *window);
- /* these are called
- * A) when switching the view within the active slot
- * B) when switching the active slot
- */
- void (* connect_content_view) (NautilusWindow *window,
- NautilusView *new_view);
- void (* disconnect_content_view) (NautilusWindow *window,
- NautilusView *new_view);
-
void (* sync_allow_stop) (NautilusWindow *window,
NautilusWindowSlot *slot);
void (* set_allow_up) (NautilusWindow *window, gboolean allow);
void (* reload) (NautilusWindow *window);
void (* prompt_for_location) (NautilusWindow *window, const char *initial);
void (* sync_search_widgets) (NautilusWindow *window);
+ void (* sync_zoom_widgets) (NautilusWindow *window);
void (* get_default_size) (NautilusWindow *window, guint *default_width, guint *default_height);
void (* show_window) (NautilusWindow *window);
void (* close) (NautilusWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]