summaryrefslogtreecommitdiff
path: root/src/nautilus-location-bar.c
diff options
context:
space:
mode:
authorSeth Nickell <seth@eazel.com>2000-06-13 18:36:14 +0000
committerSeth Nickell <seth@src.gnome.org>2000-06-13 18:36:14 +0000
commit1f5d97e68ff347057a24a23f4b31adbc09d39ca2 (patch)
tree0444f3418add80b0c508706e70d2b9cd6aa85ce5 /src/nautilus-location-bar.c
parent9bcb90f331e12c9350d4ad3ae7a7483e8a15116b (diff)
downloadnautilus-1f5d97e68ff347057a24a23f4b31adbc09d39ca2.tar.gz
Minor assertion changes.
2000-06-13 Seth Nickell <seth@eazel.com> * libnautilus-extensions/nautilus-directory.c: (nautilus_directory_get): Minor assertion changes. * libnautilus-extensions/nautilus-file-utilities.h: * libnautilus-extensions/nautilus-file-utilities.c: (nautilus_format_uri_for_display), (nautilus_make_uri_from_input): Created two functions for preparing data to display to the user (unescape, filter file://, probably more stuff later), and dealing with URIs inputed by the user (currently tacks on a file:// if the "uri" starts with a /) * src/nautilus-location-bar.c: (editable_activated_callback), (nautilus_location_bar_set_location): Changed to use nautilus_format_uri_for_display and nautilus_make_uri_from_input.
Diffstat (limited to 'src/nautilus-location-bar.c')
-rw-r--r--src/nautilus-location-bar.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index bc242919e..0d73fa922 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -44,6 +44,7 @@
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
#define NAUTILUS_DND_URI_LIST_TYPE "text/uri-list"
#define NAUTILUS_DND_TEXT_PLAIN_TYPE "text/plain"
@@ -78,7 +79,6 @@ static GtkTargetEntry drop_types [] = {
static void nautilus_location_bar_initialize_class (NautilusLocationBarClass *class);
static void nautilus_location_bar_initialize (NautilusLocationBar *bar);
-
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusLocationBar, nautilus_location_bar, GTK_TYPE_HBOX)
@@ -153,12 +153,16 @@ static void
editable_activated_callback (GtkEditable *editable,
NautilusLocationBar *bar)
{
+ gchar *uri;
+
g_assert (GTK_IS_EDITABLE (editable));
g_assert (NAUTILUS_IS_LOCATION_BAR (bar));
+ uri = nautilus_make_uri_from_input (gtk_entry_get_text (GTK_ENTRY (editable)));
gtk_signal_emit (GTK_OBJECT (bar),
signals[LOCATION_CHANGED],
- gtk_entry_get_text (GTK_ENTRY (editable)));
+ uri);
+ g_free (uri);
}
/* utility routine to determine the string to expand to. If we don't have anything yet, accept
@@ -353,6 +357,7 @@ nautilus_location_bar_new (void)
return gtk_widget_new (nautilus_location_bar_get_type (), NULL);
}
+
/**
* nautilus_location_bar_set_location
*
@@ -365,10 +370,16 @@ void
nautilus_location_bar_set_location (NautilusLocationBar *bar,
const char *location)
{
+ gchar *formatted_location;
+ g_assert (location != NULL);
g_return_if_fail (NAUTILUS_IS_LOCATION_BAR (bar));
/* Note: This is called in reaction to external changes, and
* thus should not emit the LOCATION_CHANGED signal.*/
+
+ formatted_location = nautilus_format_uri_for_display (location);
nautilus_entry_set_text (NAUTILUS_ENTRY (bar->entry),
- location == NULL ? "" : location);
+ formatted_location);
+ g_free (formatted_location);
}
+