summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-entry.h
diff options
context:
space:
mode:
authorJohn Sullivan <sullivan@src.gnome.org>2000-04-17 18:25:56 +0000
committerJohn Sullivan <sullivan@src.gnome.org>2000-04-17 18:25:56 +0000
commitc4002e6e1504ecdc09a8bd8a327f1489363aba4f (patch)
treef5f7e9bf8be2a996659cdf3c786cdf014f045b42 /libnautilus-private/nautilus-entry.h
parenteab6fb37e1af5069b0e1c96bb70a7f84ffa42c7c (diff)
downloadnautilus-c4002e6e1504ecdc09a8bd8a327f1489363aba4f.tar.gz
Fixed bugs, mostly related to editable text fields.
* README: Made the contents of this file slightly helpful. * data/mime/nautilus.keys: Added an obscure MIME type that someone reported running into. * libnautilus-extensions/nautilus-entry.h, * libnautilus-extensions/nautilus-entry.c: New files. Define a subclass of GtkEntry (one-line text editing field) that fixes bugs and adds convenience functions. (nautilus_entry_key_press): Override key_press handler to treat the keypad Enter key the same as the other Enter key (in GtkEntry it inserts a "/r" into the text). (nautilus_entry_select_all): Select all text, and move the text cursor position to the end. (nautilus_entry_select_all_at_idle): Same, but do it at the next idle opportunity. Useful since nautilus_entry_select_all won't work right if called in a key_press signal handler. * libnautilus-extensions/Makefile.am: Build these two new files. * src/file-manager/fm-properties-window.c: (name_field_activate): New function, updates file name and selects all text. (create_properties_window): Make name_field be a NautilusEntry. This fixes half of bug 433 (Enter keys don't work properly in properties window). Also attach to "activate" signal and update name change then. This fixes other half of bug 433. Also start with name field selected & focused. This fixes bug 432 (properties window should appear with name text selected). (name_field_update_to_match_file): Only update the displayed text if the new name coming in is different. This was needed to make select-all-on-activate work. (name_field_done_editing): Don't accept empty string as name; silently revert back to original name. * src/nautilus-bookmarks-window.c: (create_bookmarks_window): Change name & uri text fields to NautilusEntry; this causes keypad Enter key to behave like other Enter key. Also connect to focus_in and activate signals. (update_bookmark_from_text): New function, extracted from on_text_field_focus_out_event. (on_text_field_focus_out_event): Deselect all text after updating bookmark. (on_text_field_focus_in_event): New function, select all text. (name_or_uri_field_activate): New function, update bookmark and select all text. * src/nautilus-location-bar.c: (nautilus_location_bar_initialize): Use NautilusEntry instead of GtkEntry. This makes keypad Enter act like other Enter in uri-entry field. * src/ntl-window-msgs.c: (nautilus_window_end_location_change_callback): Make "Nautilus can't handle this type of file" message mention (human-readable version of) file type.
Diffstat (limited to 'libnautilus-private/nautilus-entry.h')
-rw-r--r--libnautilus-private/nautilus-entry.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-entry.h b/libnautilus-private/nautilus-entry.h
new file mode 100644
index 000000000..373561ab7
--- /dev/null
+++ b/libnautilus-private/nautilus-entry.h
@@ -0,0 +1,65 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* NautilusEntry: one-line text editing widget. This consists of bug fixes
+ * and other improvements to GtkEntry, and all the changes could be rolled
+ * into GtkEntry some day.
+ *
+ * Copyright (C) 2000 Eazel, Inc.
+ *
+ * Author: John Sullivan <sullivan@eazel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef NAUTILUS_ENTRY_H
+#define NAUTILUS_ENTRY_H
+
+#include <libgnome/gnome-defs.h>
+#include <gtk/gtkentry.h>
+
+BEGIN_GNOME_DECLS
+
+#define NAUTILUS_TYPE_ENTRY \
+ (nautilus_entry_get_type ())
+#define NAUTILUS_ENTRY(obj) \
+ (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ENTRY, NautilusEntry))
+#define NAUTILUS_ENTRY_CLASS(klass) \
+ (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ENTRY, NautilusEntryClass))
+#define NAUTILUS_IS_ENTRY(obj) \
+ (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ENTRY))
+#define NAUTILUS_IS_ENTRY_CLASS(klass) \
+ (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ENTRY))
+
+typedef struct NautilusEntry NautilusEntry;
+typedef struct NautilusEntryClass NautilusEntryClass;
+
+struct NautilusEntry {
+ GtkEntry parent;
+};
+
+struct NautilusEntryClass {
+ GtkEntryClass parent_class;
+};
+
+GtkType nautilus_entry_get_type (void);
+GtkWidget* nautilus_entry_new (void);
+
+void nautilus_entry_select_all (NautilusEntry *entry);
+void nautilus_entry_select_all_at_idle (NautilusEntry *entry);
+
+END_GNOME_DECLS
+
+#endif /* NAUTILUS_ENTRY_H */