[nautilus] Remove all traces of old view-as and zoom widgets



commit 8e69e90733dcb1bd65d2fdcc2a026cb458c25ed2
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Dec 9 21:23:31 2009 +0100

    Remove all traces of old view-as and zoom widgets

 src/nautilus-navigation-window.c |  203 --------------------------------------
 src/nautilus-navigation-window.h |    4 -
 src/nautilus-window.c            |   19 +---
 src/nautilus-window.h            |    3 -
 4 files changed, 4 insertions(+), 225 deletions(-)
---
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index cd48f7e..42913bd 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -42,7 +42,6 @@
 #include "nautilus-navigation-window-slot.h"
 #include "nautilus-notebook.h"
 #include "nautilus-window-manage-views.h"
-#include "nautilus-zoom-control.h"
 #include <eel/eel-gtk-extensions.h>
 #include <eel/eel-gtk-macros.h>
 #include <eel/eel-string.h>
@@ -98,7 +97,6 @@ static int mouse_forward_button = 9;
 static int mouse_back_button = 8;
 
 static void add_sidebar_panels                       (NautilusNavigationWindow *window);
-static void load_view_as_menu                        (NautilusWindow           *window);
 static void side_panel_image_changed_callback        (NautilusSidebar          *side_panel,
 						      gpointer                  callback_data);
 static void navigation_bar_location_changed_callback (GtkWidget                *widget,
@@ -128,9 +126,6 @@ static void search_bar_cancel_callback               (GtkWidget                *
 
 static void nautilus_navigation_window_show_location_bar_temporarily (NautilusNavigationWindow *window);
 
-static void view_as_menu_switch_views_callback	     (GtkComboBox              *combo_box,
-						      NautilusWindow           *window);
-
 G_DEFINE_TYPE (NautilusNavigationWindow, nautilus_navigation_window, NAUTILUS_TYPE_WINDOW)
 #define parent_class nautilus_navigation_window_parent_class
 
@@ -349,7 +344,6 @@ nautilus_navigation_window_init (NautilusNavigationWindow *window)
 	GtkUIManager *ui_manager;
 	GtkWidget *toolbar;
 	GtkWidget *location_bar;
-	GtkWidget *view_as_menu_vbox;
 	GtkToolItem *item;
 	GtkWidget *hbox;
 
@@ -466,50 +460,6 @@ nautilus_navigation_window_init (NautilusNavigationWindow *window)
 			    window->search_bar,
 			    TRUE, TRUE, 0);
 
-	/* Option menu for content view types; it's empty here, filled in when a uri is set.
-	 * Pack it into vbox so it doesn't grow vertically when location bar does. 
-	 */
-	view_as_menu_vbox = gtk_vbox_new (FALSE, 4);
-	gtk_widget_show (view_as_menu_vbox);
-
-	item = gtk_tool_item_new ();
-	gtk_container_set_border_width (GTK_CONTAINER (item), 4);
-	gtk_widget_show (GTK_WIDGET (item));
-	gtk_container_add (GTK_CONTAINER (item), view_as_menu_vbox);
-	gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
-			    item, -1);
-	
-	window->view_as_combo_box = gtk_combo_box_new_text ();
-	gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (window->view_as_combo_box), FALSE);
-	gtk_box_pack_end (GTK_BOX (view_as_menu_vbox), window->view_as_combo_box, TRUE, FALSE, 0);
-	gtk_widget_show (window->view_as_combo_box);
-	g_signal_connect_object (window->view_as_combo_box, "changed",
-				 G_CALLBACK (view_as_menu_switch_views_callback), window, 0);
-
-	/* Allocate the zoom control and place on the right next to the menu.
-	 * It gets shown later, if the view-frame contains something zoomable.
-	 */
-	window->zoom_control = nautilus_zoom_control_new ();
-	g_signal_connect_object (window->zoom_control, "zoom_in",
-				 G_CALLBACK (nautilus_window_zoom_in),
-				 window, G_CONNECT_SWAPPED);
-	g_signal_connect_object (window->zoom_control, "zoom_out",
-				 G_CALLBACK (nautilus_window_zoom_out),
-				 window, G_CONNECT_SWAPPED);
-	g_signal_connect_object (window->zoom_control, "zoom_to_level",
-				 G_CALLBACK (nautilus_window_zoom_to_level),
-				 window, G_CONNECT_SWAPPED);
-	g_signal_connect_object (window->zoom_control, "zoom_to_default",
-				 G_CALLBACK (nautilus_window_zoom_to_default),
-				 window, G_CONNECT_SWAPPED);
-	
-	item = gtk_tool_item_new ();
-	gtk_container_set_border_width (GTK_CONTAINER (item), 4);
-	gtk_widget_show (GTK_WIDGET (item));
-	gtk_container_add (GTK_CONTAINER (item),  window->zoom_control);
-	gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
-			    item, 1);
-
 	gtk_widget_show (location_bar);
 
 	gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
@@ -1028,10 +978,8 @@ nautilus_navigation_window_destroy (GtkObject *object)
 	g_list_free (window->sidebar_panels);
 	window->sidebar_panels = NULL;
 
-	window->view_as_combo_box = NULL;
 	window->navigation_bar = NULL;
 	window->path_bar = NULL;
-	window->zoom_control = NULL;
 
 	window->details->content_paned = NULL;
 
@@ -1156,110 +1104,6 @@ nautilus_navigation_window_allow_forward (NautilusNavigationWindow *window, gboo
 }
 
 static void
-activate_nth_short_list_item (NautilusWindow *window, guint index)
-{
-	NautilusWindowSlot *slot;
-
-	g_assert (NAUTILUS_IS_WINDOW (window));
-
-	slot = window->details->active_slot;
-	g_assert (index < g_list_length (window->details->short_list_viewers));
-
-	nautilus_window_slot_set_content_view (slot,
-					       g_list_nth_data (window->details->short_list_viewers, index));
-}
-
-static void
-activate_extra_viewer (NautilusWindow *window)
-{
-	NautilusWindowSlot *slot;
-
-	g_assert (NAUTILUS_IS_WINDOW (window));
-
-	slot = window->details->active_slot;
-	g_assert (window->details->extra_viewer != NULL);
-
-	nautilus_window_slot_set_content_view (slot, window->details->extra_viewer);
-}
-
-static void
-view_as_menu_switch_views_callback (GtkComboBox *combo_box, NautilusWindow *window)
-{         
-	int active;
-	g_assert (GTK_IS_COMBO_BOX (combo_box));
-	g_assert (NAUTILUS_IS_WINDOW (window));
-
-	active = gtk_combo_box_get_active (combo_box);
-
-	if (active < 0) {
-		return;
-	} else if (active < GPOINTER_TO_INT (g_object_get_data (G_OBJECT (combo_box), "num viewers"))) {
-		activate_nth_short_list_item (window, active);
-	} else {
-		activate_extra_viewer (window);
-	}
-}
-
-static void
-load_view_as_menu (NautilusWindow *window)
-{
-	NautilusWindowSlot *slot;
-	GList *node;
-	int index;
-	int selected_index = -1;
-	GtkTreeModel *model;
-	GtkListStore *store;
-	const NautilusViewInfo *info;
-	GtkComboBox* combo_box;
-	
-    	combo_box = GTK_COMBO_BOX (NAUTILUS_NAVIGATION_WINDOW (window)->view_as_combo_box);
-	/* Clear the contents of ComboBox in a wacky way because there
-	 * is no function to clear all items and also no function to obtain
-	 * the number of items in a combobox.
-	 */
-	model = gtk_combo_box_get_model (combo_box);
-	g_return_if_fail (GTK_IS_LIST_STORE (model));
-	store = GTK_LIST_STORE (model);
-	gtk_list_store_clear (store);
-
-	slot = window->details->active_slot;
-
-        /* Add a menu item for each view in the preferred list for this location. */
-        for (node = window->details->short_list_viewers, index = 0; 
-             node != NULL; 
-             node = node->next, ++index) {
-		info = nautilus_view_factory_lookup (node->data);
-		gtk_combo_box_append_text (combo_box, _(info->view_combo_label));
-
-		if (nautilus_window_slot_content_view_matches_iid (slot, (char *)node->data)) {
-			selected_index = index;
-		}
-        }
-	g_object_set_data (G_OBJECT (combo_box), "num viewers", GINT_TO_POINTER (index));
-	if (selected_index == -1) {
-		const char *id;
-		/* We're using an extra viewer, add a menu item for it */
-
-		id = nautilus_window_slot_get_content_view_id (slot);
-		info = nautilus_view_factory_lookup (id);
-		gtk_combo_box_append_text (GTK_COMBO_BOX (NAUTILUS_NAVIGATION_WINDOW (window)->view_as_combo_box),
-					   _(info->view_combo_label));
-		selected_index = index;
-	}
-
-	gtk_combo_box_set_active (GTK_COMBO_BOX (NAUTILUS_NAVIGATION_WINDOW (window)->view_as_combo_box), selected_index);
-}
-
-static void
-real_load_view_as_menu (NautilusWindow *window)
-{
-	EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
-			 load_view_as_menu, (window));
-
-	load_view_as_menu (window);
-}
-
-static void
 real_sync_title (NautilusWindow *window,
 		 NautilusWindowSlot *slot)
 {
@@ -1583,51 +1427,6 @@ real_sync_search_widgets (NautilusWindow *window)
 	nautilus_directory_unref (directory);
 }
 
-
-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) >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
-		   nautilus_view_get_zoom_level (view) <= NAUTILUS_ZOOM_LEVEL_LARGEST;
-
-	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)
@@ -2111,11 +1910,9 @@ nautilus_navigation_window_class_init (NautilusNavigationWindowClass *class)
 	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;
 	GTK_WIDGET_CLASS (class)->button_press_event = nautilus_navigation_window_button_press_event;
-	NAUTILUS_WINDOW_CLASS (class)->load_view_as_menu = real_load_view_as_menu;
 	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;
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index 9c6a5f8..791c66b 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -63,7 +63,6 @@ struct _NautilusNavigationWindow {
         
         /** UI stuff **/
         NautilusSidePane *sidebar;
-        GtkWidget *view_as_combo_box;
 
         GtkSizeGroup *navigation_group;
         GtkWidget *navigation_bar;
@@ -74,9 +73,6 @@ struct _NautilusNavigationWindow {
 
         /* Current views stuff */
         GList *sidebar_panels;
-        
-        /* Widgets to keep track of (for state changes, etc) */      
-        GtkWidget *zoom_control;
 };
 
 
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 75ded8b..11f95d2 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1167,7 +1167,7 @@ refresh_stored_viewers (NautilusWindow *window)
 }
 
 static void
-real_load_view_as_menu (NautilusWindow *window)
+load_view_as_menu (NautilusWindow *window)
 {
 	NautilusWindowSlot *slot;
 	GList *node;
@@ -1236,9 +1236,7 @@ load_view_as_menus_callback (NautilusFile *file,
 	window = NAUTILUS_WINDOW (slot->window);
 
 	if (slot == window->details->active_slot) {
-		/* slot may have changed in the meantime */
-		EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
-				 load_view_as_menu, (window));
+		load_view_as_menu (window);
 	}
 }
 
@@ -1311,8 +1309,8 @@ nautilus_window_sync_title (NautilusWindow *window,
 			 sync_title, (window, slot));
 }
 
-static void
-real_sync_zoom_widgets (NautilusWindow *window)
+void
+nautilus_window_sync_zoom_widgets (NautilusWindow *window)
 {
 	NautilusWindowSlot *slot;
 	NautilusView *view;
@@ -1360,13 +1358,6 @@ real_sync_zoom_widgets (NautilusWindow *window)
 		       can_zoom_in, can_zoom_out);
 }
 
-void
-nautilus_window_sync_zoom_widgets (NautilusWindow *window)
-{
-	EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
-			 sync_zoom_widgets, (window));
-}
-
 static void
 zoom_level_changed_callback (NautilusView *view,
                              NautilusWindow *window)
@@ -1837,8 +1828,6 @@ nautilus_window_class_init (NautilusWindowClass *class)
 	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->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;
 
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 2c5e27e..52ea2d5 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -92,15 +92,12 @@ typedef struct {
         NautilusIconInfo * (* get_icon) (NautilusWindow *window,
 					 NautilusWindowSlot *slot);
 
-        void   (* load_view_as_menu) (NautilusWindow *window);
-
         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]