summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neumair <chris@gnome-de.org>2005-08-03 11:28:59 +0000
committerChristian Neumair <cneumair@src.gnome.org>2005-08-03 11:28:59 +0000
commit47e628dd0f0d42c2bb0808a006ede5456fbb41c0 (patch)
tree22b9495301a8fd678ec9d2d731face27dc40aa9c
parente3004487a7204f6d3013849f027f3aec2b6a5f88 (diff)
downloadnautilus-47e628dd0f0d42c2bb0808a006ede5456fbb41c0.tar.gz
Be smarter about GtkTreeView-bound expand/collapse characters. Thanks to
2005-08-03 Christian Neumair <chris@gnome-de.org> * src/file-manager/fm-list-view.c: (handle_typeahead): Be smarter about GtkTreeView-bound expand/collapse characters. Thanks to Wouter Bolsterlee <uws+gnome@xs4all.nl>. Fixes #312046. * src/nautilus-location-bar.c: (real_cancel), (nautilus_location_bar_class_init), (nautilus_location_bar_set_location) * src/nautilus-navigation-bar.c: (nautilus_navigation_bar_class_init): * src/nautilus-navigation-bar.h: * src/nautilus-navigation-window.c: (navigation_bar_cancel_callback), (navigation_bar_location_changed_callback): Hide temporary bars when pressing the escape key. Fixes #311652.
-rw-r--r--ChangeLog15
-rw-r--r--src/file-manager/fm-list-view.c27
-rw-r--r--src/nautilus-location-bar.c17
-rw-r--r--src/nautilus-navigation-bar.c18
-rw-r--r--src/nautilus-navigation-bar.h1
-rw-r--r--src/nautilus-navigation-window.c24
6 files changed, 94 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 66c0be4ae..ee8a1d376 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-08-03 Christian Neumair <chris@gnome-de.org>
+
+ * src/file-manager/fm-list-view.c: (handle_typeahead): Be smarter
+ about GtkTreeView-bound expand/collapse characters. Thanks to Wouter
+ Bolsterlee <uws+gnome@xs4all.nl>. Fixes #312046.
+
+ * src/nautilus-location-bar.c: (real_cancel),
+ (nautilus_location_bar_class_init),
+ (nautilus_location_bar_set_location)
+ * src/nautilus-navigation-bar.c: (nautilus_navigation_bar_class_init):
+ * src/nautilus-navigation-bar.h:
+ * src/nautilus-navigation-window.c: (navigation_bar_cancel_callback),
+ (navigation_bar_location_changed_callback): Hide temporary bars when
+ pressing the escape key. Fixes #311652.
+
2005-08-03 Martin Wehner <martin.wehner@gmail.com>
* src/nautilus-sidebar-title.c: (nautilus_sidebar_title_init):
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 87fe83e03..d9055ea39 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -804,9 +804,34 @@ handle_typeahead (FMListView *view,
*flush_typeahead = TRUE;
return FALSE;
}
-
+
+ /* don't handle '+', '*', '/' at all because they are used by the GTK+ tree
+ * view code for expanding/collapsing rows. These characters are quite
+ * unlikely to be in a filename, so this will not confuse users. The '-'
+ * which is used for collapsing in the treeview is special-cased below. */
+ switch (event->keyval) {
+ case GDK_plus:
+ case GDK_asterisk:
+ case GDK_slash:
+ case GDK_KP_Add:
+ case GDK_KP_Multiply:
+ case GDK_KP_Divide:
+ return FALSE;
+
+ default:
+ break;
+ }
+
+
/* lazily allocate the typeahead state */
if (view->details->type_select_state == NULL) {
+
+ /* Special-case for '-', because this character is likely to be in a
+ * filename. */
+ if ((event->keyval == GDK_minus) || (event->keyval == GDK_KP_Subtract)) {
+ return FALSE;
+ }
+
view->details->type_select_state = g_new0 (TypeSelectState, 1);
}
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index 94d2c58df..1887ad474 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -330,6 +330,15 @@ real_activate (NautilusNavigationBar *navigation_bar)
}
static void
+real_cancel (NautilusNavigationBar *navigation_bar)
+{
+ char *last_location;
+
+ last_location = NAUTILUS_LOCATION_BAR (navigation_bar)->details->last_location;
+ nautilus_navigation_bar_set_location (navigation_bar, last_location);
+}
+
+static void
finalize (GObject *object)
{
NautilusLocationBar *bar;
@@ -384,6 +393,7 @@ nautilus_location_bar_class_init (NautilusLocationBarClass *class)
navigation_bar_class = NAUTILUS_NAVIGATION_BAR_CLASS (class);
navigation_bar_class->activate = real_activate;
+ navigation_bar_class->cancel = real_cancel;
navigation_bar_class->get_location = nautilus_location_bar_get_location;
navigation_bar_class->set_location = nautilus_location_bar_set_location;
}
@@ -503,8 +513,11 @@ nautilus_location_bar_set_location (NautilusNavigationBar *navigation_bar,
/* remember the original location for later comparison */
- g_free (bar->details->last_location);
- bar->details->last_location = g_strdup (location);
+ if (bar->details->last_location != location) {
+ g_free (bar->details->last_location);
+ bar->details->last_location = g_strdup (location);
+ }
+
nautilus_location_bar_update_label (bar);
}
diff --git a/src/nautilus-navigation-bar.c b/src/nautilus-navigation-bar.c
index 65709d395..32ba12852 100644
--- a/src/nautilus-navigation-bar.c
+++ b/src/nautilus-navigation-bar.c
@@ -30,11 +30,14 @@
#include "nautilus-navigation-bar.h"
#include <eel/eel-gtk-macros.h>
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtksignal.h>
+#include <gtk/gtkbindings.h>
#include <string.h>
enum {
ACTIVATE,
+ CANCEL,
LOCATION_CHANGED,
LAST_SIGNAL
};
@@ -52,6 +55,7 @@ static void
nautilus_navigation_bar_class_init (NautilusNavigationBarClass *klass)
{
GtkObjectClass *object_class;
+ GtkBindingSet *binding_set;
object_class = GTK_OBJECT_CLASS (klass);
@@ -65,6 +69,16 @@ nautilus_navigation_bar_class_init (NautilusNavigationBarClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ signals[CANCEL] = g_signal_new
+ ("cancel",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | GTK_RUN_ACTION,
+ G_STRUCT_OFFSET (NautilusNavigationBarClass,
+ cancel),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
signals[LOCATION_CHANGED] = g_signal_new
("location_changed",
G_TYPE_FROM_CLASS (object_class),
@@ -76,6 +90,10 @@ nautilus_navigation_bar_class_init (NautilusNavigationBarClass *klass)
G_TYPE_NONE, 1, G_TYPE_STRING);
klass->activate = NULL;
+ klass->cancel = NULL;
+
+ binding_set = gtk_binding_set_by_class (klass);
+ gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, "cancel", 0);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_navigation_bar, get_location);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_navigation_bar, set_location);
diff --git a/src/nautilus-navigation-bar.h b/src/nautilus-navigation-bar.h
index a5bcd8fc5..1af10ae3a 100644
--- a/src/nautilus-navigation-bar.h
+++ b/src/nautilus-navigation-bar.h
@@ -49,6 +49,7 @@ typedef struct {
/* signals */
void (* location_changed) (NautilusNavigationBar *bar,
const char *location);
+ void (* cancel) (NautilusNavigationBar *bar);
/* virtual methods */
void (* activate) (NautilusNavigationBar *bar);
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 3b378a5dc..29a0bf010 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -112,6 +112,8 @@ static void side_panel_image_changed_callback (NautilusSidebar *
static void navigation_bar_location_changed_callback (GtkWidget *widget,
const char *uri,
NautilusNavigationWindow *window);
+static void navigation_bar_cancel_callback (GtkWidget *widget,
+ NautilusNavigationWindow *window);
static void path_bar_location_changed_callback (GtkWidget *widget,
const char *uri,
NautilusNavigationWindow *window);
@@ -196,6 +198,8 @@ nautilus_navigation_window_instance_init (NautilusNavigationWindow *window)
window->navigation_bar = nautilus_location_bar_new (window);
g_signal_connect_object (window->navigation_bar, "location_changed",
G_CALLBACK (navigation_bar_location_changed_callback), window, 0);
+ g_signal_connect_object (window->navigation_bar, "cancel",
+ G_CALLBACK (navigation_bar_cancel_callback), window, 0);
gtk_box_pack_start (GTK_BOX (hbox),
window->navigation_bar,
@@ -313,11 +317,8 @@ path_bar_location_changed_callback (GtkWidget *widget,
}
}
-
static void
-navigation_bar_location_changed_callback (GtkWidget *widget,
- const char *uri,
- NautilusNavigationWindow *window)
+hide_temporary_bars (NautilusNavigationWindow *window)
{
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
@@ -333,12 +334,25 @@ navigation_bar_location_changed_callback (GtkWidget *widget,
}
window->details->temporary_navigation_bar = FALSE;
}
+}
-
+static void
+navigation_bar_location_changed_callback (GtkWidget *widget,
+ const char *uri,
+ NautilusNavigationWindow *window)
+{
+ hide_temporary_bars (window);
nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
}
static void
+navigation_bar_cancel_callback (GtkWidget *widget,
+ NautilusNavigationWindow *window)
+{
+ hide_temporary_bars (window);
+}
+
+static void
side_pane_close_requested_callback (GtkWidget *widget,
gpointer user_data)
{