[nautilus] Make location bar more reactive: path bar, toggle button and zoom control



commit 689fd8e7ac943f1bed48dc0f6aad4b0e418e1005
Author: Holger Berndt <berndth gmx de>
Date:   Thu Jun 11 17:35:37 2009 +0200

    Make location bar more reactive: path bar, toggle button and zoom control
    
    The buttons in the directory button bar are made inactive when the
    corresponding pane is inactive. This means that the buttons have an
    insensitive appearance, but are in fact clickable. Clicking on them
    will make the corresponding pane active while changing into the
    respective directory.
    
    This required the pathbar to export the button widget, done with the
    new function nautilus_path_bar_get_button_from_button_list_entry().

 src/nautilus-navigation-window-pane.c |    9 ++++++++-
 src/nautilus-pathbar.c                |    6 ++++++
 src/nautilus-pathbar.h                |    2 ++
 src/nautilus-zoom-control.c           |    8 ++++++++
 src/nautilus-zoom-control.h           |    2 ++
 5 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c
index ce208bf..41684c9 100644
--- a/src/nautilus-navigation-window-pane.c
+++ b/src/nautilus-navigation-window-pane.c
@@ -50,6 +50,8 @@ G_DEFINE_TYPE (NautilusNavigationWindowPane,
 void
 nautilus_navigation_window_pane_set_active (NautilusNavigationWindowPane *pane, gboolean is_active)
 {
+	GList *walk;
+
 	if (NAUTILUS_WINDOW_PANE (pane)->is_active == is_active) {
 		return;
 	}
@@ -58,7 +60,10 @@ nautilus_navigation_window_pane_set_active (NautilusNavigationWindowPane *pane,
 	/* location button */
 	gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (pane->location_button)), is_active);
 
-	/* hhb: TODO: deal with path bar */
+	/* path bar */
+	for (walk = NAUTILUS_PATH_BAR (pane->path_bar)->button_list; walk; walk = walk->next) {
+		gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (nautilus_path_bar_get_button_from_button_list_entry (walk->data))), is_active);
+	}
 
 	/* hhb: TODO: deal with navigation bar (manual entry) */
 }
@@ -247,6 +252,8 @@ path_bar_button_pressed_callback (GtkWidget *widget,
 	GFile *location;
 	char *uri;
 
+	nautilus_window_set_active_pane (NAUTILUS_WINDOW_PANE (pane)->window, NAUTILUS_WINDOW_PANE (pane));
+
 	g_object_set_data (G_OBJECT (widget), "handle-button-release",
 			   GINT_TO_POINTER (TRUE));
 
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index b537625..3ec1998 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -1893,3 +1893,9 @@ nautilus_path_bar_down (NautilusPathBar *path_bar)
 		}
         }
 }
+
+GtkWidget *
+nautilus_path_bar_get_button_from_button_list_entry (gpointer entry)
+{
+  return BUTTON_DATA(entry)->button;
+}
diff --git a/src/nautilus-pathbar.h b/src/nautilus-pathbar.h
index 8feb585..045e100 100644
--- a/src/nautilus-pathbar.h
+++ b/src/nautilus-pathbar.h
@@ -85,4 +85,6 @@ void     nautilus_path_bar_clear_buttons (NautilusPathBar *path_bar);
 void     nautilus_path_bar_up              (NautilusPathBar *path_bar);
 void     nautilus_path_bar_down            (NautilusPathBar *path_bar);
 
+GtkWidget * nautilus_path_bar_get_button_from_button_list_entry (gpointer entry);
+
 #endif /* NAUTILUS_PATHBAR_H */
diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c
index e2f5040..e0b7a97 100644
--- a/src/nautilus-zoom-control.c
+++ b/src/nautilus-zoom-control.c
@@ -945,3 +945,11 @@ nautilus_zoom_control_accessible_get_type (void)
 
 	return type;
 }
+
+void
+nautilus_zoom_control_set_active_appearance (NautilusZoomControl *zoom_control, gboolean is_active)
+{
+	gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (zoom_control->details->zoom_in)), is_active);
+	gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (zoom_control->details->zoom_out)), is_active);
+	gtk_widget_set_sensitive (zoom_control->details->zoom_label, is_active);
+}
diff --git a/src/nautilus-zoom-control.h b/src/nautilus-zoom-control.h
index 6545725..01b4d9c 100644
--- a/src/nautilus-zoom-control.h
+++ b/src/nautilus-zoom-control.h
@@ -84,4 +84,6 @@ gboolean          nautilus_zoom_control_has_max_zoom_level (NautilusZoomControl
 gboolean          nautilus_zoom_control_can_zoom_in        (NautilusZoomControl *zoom_control);
 gboolean          nautilus_zoom_control_can_zoom_out       (NautilusZoomControl *zoom_control);
 
+void              nautilus_zoom_control_set_active_appearance (NautilusZoomControl *zoom_control, gboolean is_active);
+
 #endif /* NAUTILUS_ZOOM_CONTROL_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]