summaryrefslogtreecommitdiff
path: root/src/nautilus-window-slot.c
diff options
context:
space:
mode:
authorChristian Neumair <cneumair@gnome.org>2008-08-06 10:11:22 +0000
committerChristian Neumair <cneumair@src.gnome.org>2008-08-06 10:11:22 +0000
commitbd8931b3545a809f0b70624dda641524e7298234 (patch)
tree3731296c9797d1f5ae58b60bcd556929fe83c5c3 /src/nautilus-window-slot.c
parentc0a2bfa0fc98c499c51a972e49c8dbc270bfc5c9 (diff)
downloadnautilus-bd8931b3545a809f0b70624dda641524e7298234.tar.gz
Consolidate zoom handling. Add nautilus_window_sync_zoom_level(), and
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. svn path=/trunk/; revision=14454
Diffstat (limited to 'src/nautilus-window-slot.c')
-rw-r--r--src/nautilus-window-slot.c55
1 files changed, 45 insertions, 10 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index b37aa6552..5854f8650 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -114,6 +114,7 @@ real_active (NautilusWindowSlot *slot)
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 @@ nautilus_window_slot_update_icon (NautilusWindowSlot *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);
+}
+
+
+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 @@ nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
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);
}
}