summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2008-02-21 14:14:00 +0000
committerVincent Untz <vuntz@src.gnome.org>2008-02-21 14:14:00 +0000
commitbe25fa77ebf1c79f674147607688af80dd7b9157 (patch)
treee8798fdea28a906312a86d52bf8297b440cbdda8
parent9a5a936cb7200b245e97f5b4d3652a6a9d43f648 (diff)
downloadnautilus-be25fa77ebf1c79f674147607688af80dd7b9157.tar.gz
Bring back the Connect to dialog. It still needs some work, but it's
2008-02-21 Vincent Untz <vuntz@gnome.org> Bring back the Connect to dialog. It still needs some work, but it's better than nothing. * libnautilus-private/nautilus-bookmark.c: (nautilus_bookmark_new): Actually save the name in the bookmark, instead of forgetting it. * src/Makefile.am: Updated to build the connect dialog stuff. * src/nautilus-connect-server-dialog-main.c: (show_uri), (nautilus_connect_server_dialog_present_uri), (main): Port to gio. We use g_app_info_launch_default_for_uri() to open the URI, but it will need some more work because it doesn't automount the URI. * src/nautilus-connect-server-dialog-nonmain.c: (nautilus_connect_server_dialog_present_uri): Trivial update. * src/nautilus-connect-server-dialog.[ch]: (get_method_description), (nautilus_connect_server_dialog_finalize), (connect_to_server), (response_callback), (setup_for_type), (display_server_location), (nautilus_connect_server_dialog_init), (nautilus_connect_server_dialog_new): Port to gio. Add bookmark saving feature, to replace the old gnome-vfs network volumes. Remove the Browse button, which isn't really needed there. Needs some more polish. * src/nautilus-shell-ui.xml: Uncomment the "Connect to" action * src/nautilus-window-menus.c: (action_connect_to_server_callback): Uncomment code to make use of the dialog svn path=/trunk/; revision=13797
-rw-r--r--ChangeLog27
-rw-r--r--libnautilus-private/nautilus-bookmark.c2
-rw-r--r--src/Makefile.am25
-rw-r--r--src/nautilus-connect-server-dialog-main.c31
-rw-r--r--src/nautilus-connect-server-dialog-nonmain.c8
-rw-r--r--src/nautilus-connect-server-dialog.c244
-rw-r--r--src/nautilus-connect-server-dialog.h5
-rw-r--r--src/nautilus-shell-ui.xml2
-rw-r--r--src/nautilus-window-menus.c16
9 files changed, 194 insertions, 166 deletions
diff --git a/ChangeLog b/ChangeLog
index 57cae58a1..357b93dbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2008-02-21 Vincent Untz <vuntz@gnome.org>
+
+ Bring back the Connect to dialog. It still needs some work, but it's
+ better than nothing.
+
+ * libnautilus-private/nautilus-bookmark.c: (nautilus_bookmark_new):
+ Actually save the name in the bookmark, instead of forgetting it.
+
+ * src/Makefile.am: Updated to build the connect dialog stuff.
+ * src/nautilus-connect-server-dialog-main.c: (show_uri),
+ (nautilus_connect_server_dialog_present_uri), (main):
+ Port to gio. We use g_app_info_launch_default_for_uri() to open the
+ URI, but it will need some more work because it doesn't automount the
+ URI.
+ * src/nautilus-connect-server-dialog-nonmain.c:
+ (nautilus_connect_server_dialog_present_uri): Trivial update.
+ * src/nautilus-connect-server-dialog.[ch]: (get_method_description),
+ (nautilus_connect_server_dialog_finalize), (connect_to_server),
+ (response_callback), (setup_for_type), (display_server_location),
+ (nautilus_connect_server_dialog_init),
+ (nautilus_connect_server_dialog_new): Port to gio. Add bookmark saving
+ feature, to replace the old gnome-vfs network volumes. Remove the
+ Browse button, which isn't really needed there. Needs some more polish.
+ * src/nautilus-shell-ui.xml: Uncomment the "Connect to" action
+ * src/nautilus-window-menus.c: (action_connect_to_server_callback):
+ Uncomment code to make use of the dialog
+
2008-02-21 David Zeuthen <davidz@redhat.com>
* libnautilus-private/nautilus-autorun.c: (should_autorun_mount):
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c
index 852b4d496..f1949f5ca 100644
--- a/libnautilus-private/nautilus-bookmark.c
+++ b/libnautilus-private/nautilus-bookmark.c
@@ -471,7 +471,7 @@ nautilus_bookmark_set_icon_to_default (NautilusBookmark *bookmark)
NautilusBookmark *
nautilus_bookmark_new (GFile *location, const char *name)
{
- return nautilus_bookmark_new_with_icon (location, name, FALSE, NULL);
+ return nautilus_bookmark_new_with_icon (location, name, TRUE, NULL);
}
static void
diff --git a/src/Makefile.am b/src/Makefile.am
index 53740a20a..12314e341 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,10 +6,9 @@ bin_PROGRAMS= \
nautilus \
nautilus-file-management-properties \
nautilus-autorun-software \
+ nautilus-connect-server
$(NULL)
-# nautilus-connect-server
-
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/cut-n-paste-code \
@@ -67,6 +66,9 @@ nautilus_SOURCES = \
nautilus-bookmark-list.h \
nautilus-bookmarks-window.c \
nautilus-bookmarks-window.h \
+ nautilus-connect-server-dialog.c \
+ nautilus-connect-server-dialog.h \
+ nautilus-connect-server-dialog-nonmain.c \
nautilus-desktop-window.c \
nautilus-desktop-window.h \
nautilus-emblem-sidebar.c \
@@ -147,14 +149,15 @@ nautilus_autorun_software_SOURCES= \
nautilus-autorun-software.c \
$(NULL)
-# Disabled for now in the gio world
-#nautilus_connect_server_SOURCES= \
-# nautilus-connect-server-dialog.c \
-# nautilus-connect-server-dialog.h \
-# nautilus-connect-server-dialog-main.c \
-# nautilus-location-entry.c \
-# nautilus-location-entry.h \
-# $(NULL)
+nautilus_connect_server_SOURCES= \
+ nautilus-bookmark-list.c \
+ nautilus-bookmark-list.h \
+ nautilus-connect-server-dialog.c \
+ nautilus-connect-server-dialog.h \
+ nautilus-connect-server-dialog-main.c \
+ nautilus-location-entry.c \
+ nautilus-location-entry.h \
+ $(NULL)
$(nautilus_shell_interface_idl_sources): nautilus_shell_interface_idl_stamp
nautilus_shell_interface_idl_stamp: nautilus-shell-interface.idl $(ORBIT_IDL)
@@ -198,8 +201,6 @@ EXTRA_DIST = \
check-nautilus \
nautilus-shell-interface.idl \
$(desktop_in_files) \
- nautilus-connect-server-dialog-main.c \
- nautilus-connect-server-dialog.c \
$(NULL)
BUILT_SOURCES = \
diff --git a/src/nautilus-connect-server-dialog-main.c b/src/nautilus-connect-server-dialog-main.c
index d86cd694d..8b409981b 100644
--- a/src/nautilus-connect-server-dialog-main.c
+++ b/src/nautilus-connect-server-dialog-main.c
@@ -33,9 +33,9 @@
#include <libgnome/gnome-program.h>
#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomeui/gnome-url.h>
#include <libgnomeui/gnome-authentication-manager.h>
+#include <eel/eel-app-launch-context.h>
#include <eel/eel-preferences.h>
#include <eel/eel-stock-dialogs.h>
@@ -61,9 +61,18 @@ show_uri (const char *uri,
GtkDialog *error_dialog;
GError *error;
char *error_message;
+ EelAppLaunchContext *launch_context;
+
+ launch_context = eel_app_launch_context_new ();
+ eel_app_launch_context_set_screen (launch_context, screen);
error = NULL;
- gnome_url_show_on_screen (uri, screen, &error);
+ /* FIXME: doesn't automount */
+ g_app_info_launch_default_for_uri (uri,
+ G_APP_LAUNCH_CONTEXT (launch_context),
+ &error);
+
+ g_object_unref (launch_context);
if (error) {
error_message = g_strdup_printf (_("Can't display location \"%s\""),
@@ -87,10 +96,14 @@ show_uri (const char *uri,
void
nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
- const char *uri,
+ GFile *location,
GtkWidget *widget)
{
+ char *uri;
+
+ uri = g_file_get_uri (location);
show_uri (uri, gtk_widget_get_screen (widget));
+ g_free (uri);
}
int
@@ -100,6 +113,7 @@ main (int argc, char *argv[])
GtkWidget *dialog;
GOptionContext *context;
const char **args;
+ GFile *location;
const GOptionEntry options[] = {
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL, N_("[URI]") },
{ NULL }
@@ -130,7 +144,16 @@ main (int argc, char *argv[])
/* command line arguments, null terminated array */
- dialog = nautilus_connect_server_dialog_new (NULL, args != NULL ? *args : NULL);
+ location = NULL;
+ if (args) {
+ location = g_file_new_for_commandline_arg (*args);
+ }
+
+ dialog = nautilus_connect_server_dialog_new (NULL, location);
+
+ if (location) {
+ g_object_unref (location);
+ }
open_dialogs = 1;
g_signal_connect (dialog, "destroy",
diff --git a/src/nautilus-connect-server-dialog-nonmain.c b/src/nautilus-connect-server-dialog-nonmain.c
index 3831a73a4..c603de436 100644
--- a/src/nautilus-connect-server-dialog-nonmain.c
+++ b/src/nautilus-connect-server-dialog-nonmain.c
@@ -22,6 +22,7 @@
*/
#include <config.h>
+#include <gio/gio.h>
#include "nautilus-connect-server-dialog.h"
#include <libnautilus-private/nautilus-global-preferences.h>
@@ -32,13 +33,11 @@
void
nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
- const char *uri,
+ GFile *location,
GtkWidget *widget)
{
NautilusWindow *window;
- GFile *location;
-
- location = g_file_new_for_uri (uri);
+
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
window = nautilus_application_create_navigation_window (application,
NULL,
@@ -51,5 +50,4 @@ nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
location,
gtk_widget_get_screen (widget));
}
- g_object_unref (location);
}
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
index c7842dfee..cab8503c7 100644
--- a/src/nautilus-connect-server-dialog.c
+++ b/src/nautilus-connect-server-dialog.c
@@ -29,12 +29,11 @@
#include <eel/eel-stock-dialogs.h>
#include <eel/eel-vfs-extensions.h>
#include <libgnomeui/gnome-help.h>
-#include <libgnomevfs/gnome-vfs-method.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-volume.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <gtk/gtkcelllayout.h>
#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtktable.h>
@@ -53,6 +52,11 @@
* - folder browse function
*/
+/* TODO gio port:
+ * - see FIXME here
+ * - see FIXME in nautilus-connect-server-dialog-main.c
+ */
+
struct _NautilusConnectServerDialogDetails {
NautilusApplication *application;
@@ -67,6 +71,7 @@ struct _NautilusConnectServerDialogDetails {
GtkWidget *domain_entry;
GtkWidget *user_entry;
+ GtkWidget *bookmark_check;
GtkWidget *name_entry;
};
@@ -77,12 +82,11 @@ EEL_CLASS_BOILERPLATE (NautilusConnectServerDialog,
nautilus_connect_server_dialog,
GTK_TYPE_DIALOG)
enum {
- RESPONSE_BROWSE,
RESPONSE_CONNECT
};
struct MethodInfo {
- const char *method;
+ const char *scheme;
guint flags;
};
@@ -101,11 +105,13 @@ enum {
/* Remember to fill in descriptions below */
static struct MethodInfo methods[] = {
- { "ssh", SHOW_PORT | SHOW_USER },
+ /* FIXME: we need to alias ssh to sftp */
+ { "sftp", SHOW_PORT | SHOW_USER },
{ "ftp", SHOW_PORT | SHOW_USER },
{ "ftp", DEFAULT_METHOD | IS_ANONYMOUS | SHOW_PORT},
{ "smb", SHOW_SHARE | SHOW_USER | SHOW_DOMAIN },
{ "dav", SHOW_PORT | SHOW_USER },
+ /* FIXME: hrm, shouldn't it work? */
{ "davs", SHOW_PORT | SHOW_USER },
{ NULL, 0 }, /* Custom URI method */
};
@@ -114,26 +120,26 @@ static struct MethodInfo methods[] = {
static const char*
get_method_description (struct MethodInfo *meth)
{
- if (!meth->method) {
+ if (!meth->scheme) {
return _("Custom Location");
- } else if (strcmp (meth->method, "ssh") == 0) {
+ } else if (strcmp (meth->scheme, "sftp") == 0) {
return _("SSH");
- } else if (strcmp (meth->method, "ftp") == 0) {
+ } else if (strcmp (meth->scheme, "ftp") == 0) {
if (meth->flags & IS_ANONYMOUS) {
return _("Public FTP");
} else {
return _("FTP (with login)");
}
- } else if (strcmp (meth->method, "smb") == 0) {
+ } else if (strcmp (meth->scheme, "smb") == 0) {
return _("Windows share");
- } else if (strcmp (meth->method, "dav") == 0) {
+ } else if (strcmp (meth->scheme, "dav") == 0) {
return _("WebDAV (HTTP)");
- } else if (strcmp (meth->method, "davs") == 0) {
+ } else if (strcmp (meth->scheme, "davs") == 0) {
return _("Secure WebDAV (HTTPS)");
/* No descriptive text */
} else {
- return meth->method;
+ return meth->scheme;
}
}
@@ -151,6 +157,7 @@ nautilus_connect_server_dialog_finalize (GObject *object)
g_object_unref (dialog->details->folder_entry);
g_object_unref (dialog->details->domain_entry);
g_object_unref (dialog->details->user_entry);
+ g_object_unref (dialog->details->bookmark_check);
g_object_unref (dialog->details->name_entry);
g_free (dialog->details);
@@ -173,11 +180,7 @@ connect_to_server (NautilusConnectServerDialog *dialog)
{
struct MethodInfo *meth;
char *uri;
- char *user_uri;
- GnomeVFSURI *vfs_uri;
- char *error_message;
- char *name;
- char *icon;
+ GFile *location;
int index;
GtkTreeIter iter;
@@ -188,24 +191,9 @@ connect_to_server (NautilusConnectServerDialog *dialog)
g_assert (index < G_N_ELEMENTS (methods) && index >= 0);
meth = &(methods[index]);
- if (meth->method == NULL) {
- user_uri = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->uri_entry), 0, -1);
- uri = gnome_vfs_make_uri_from_input (user_uri);
- g_free (user_uri);
-
- vfs_uri = gnome_vfs_uri_new (uri);
-
- if (vfs_uri == NULL) {
- error_message = g_strdup_printf
- (_("Can't Connect to Server. \"%s\" is not a valid location."),
- uri);
- eel_show_error_dialog (error_message, _("Please check the spelling and try again."),
- GTK_WINDOW (dialog));
- g_free (error_message);
- return;
- } else {
- gnome_vfs_uri_unref (vfs_uri);
- }
+ if (meth->scheme == NULL) {
+ uri = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->uri_entry), 0, -1);
+ /* FIXME: we should validate it in some way? */
} else {
char *user, *port, *initial_path, *server, *folder ,*domain ;
char *t, *join;
@@ -234,7 +222,7 @@ connect_to_server (NautilusConnectServerDialog *dialog)
user = "anonymous";
/* SMB special case */
- } else if (strcmp (meth->method, "smb") == 0) {
+ } else if (strcmp (meth->scheme, "smb") == 0) {
t = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->share_entry), 0, -1);
initial_path = g_strconcat ("/", t, NULL);
free_initial_path = TRUE;
@@ -251,7 +239,7 @@ connect_to_server (NautilusConnectServerDialog *dialog)
t = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->user_entry), 0, -1);
- user = gnome_vfs_escape_string (t);
+ user = g_uri_escape_string (t, G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO, FALSE);
g_free (t);
}
@@ -285,11 +273,11 @@ connect_to_server (NautilusConnectServerDialog *dialog)
g_free (t);
t = folder;
- folder = gnome_vfs_escape_path_string (t);
+ folder = g_uri_escape_string (t, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
g_free (t);
uri = g_strdup_printf ("%s://%s%s%s%s%s%s",
- meth->method,
+ meth->scheme,
user, (user[0] != 0) ? "@" : "",
server,
(port[0] != 0) ? ":" : "", port,
@@ -310,63 +298,37 @@ connect_to_server (NautilusConnectServerDialog *dialog)
g_free (domain);
}
}
+
+ gtk_widget_hide (GTK_WIDGET (dialog));
- name = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->name_entry), 0, -1);
- if (strlen (name) == 0) {
- const char *host, *path;
- char *path_utf8, *basename;
-
- g_free (name);
-
- vfs_uri = gnome_vfs_uri_new (uri);
-
- if (vfs_uri == NULL) {
- g_warning ("Illegal uri in connect to server!\n");
- g_free (uri);
- g_free (name);
- return;
- }
-
- host = gnome_vfs_uri_get_host_name (vfs_uri);
- path = gnome_vfs_uri_get_path (vfs_uri);
- if (path != NULL &&
- strlen (path) > 0 &&
- strcmp (path, "/") != 0) {
- path_utf8 = eel_format_uri_for_display (uri);
- basename = g_path_get_basename (path_utf8);
- name = g_strdup_printf (_("%s on %s"), basename, host);
- g_free (path_utf8);
- g_free (basename);
- } else {
- name = g_strdup (host);
+ location = g_file_new_for_uri (uri);
+ g_free (uri);
+
+ /* FIXME: sensitivity */
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->details->bookmark_check))) {
+ char *name;
+ NautilusBookmark *bookmark;
+ NautilusBookmarkList *list;
+
+ name = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->name_entry), 0, -1);
+ bookmark = nautilus_bookmark_new (location, strlen (name) ? name : NULL);
+ list = nautilus_bookmark_list_new ();
+ if (!nautilus_bookmark_list_contains (list, bookmark)) {
+ nautilus_bookmark_list_append (list, bookmark);
}
- gnome_vfs_uri_unref (vfs_uri);
- }
-
- if (g_str_has_prefix (uri, "smb:")) {
- icon = "gnome-fs-smb";
- } else if (g_str_has_prefix (uri, "ssh:") ||
- g_str_has_prefix (uri, "sftp:")) {
- icon = "gnome-fs-ssh";
- } else if (g_str_has_prefix (uri, "ftp:")) {
- icon = "gnome-fs-ftp";
- } else {
- icon = "gnome-fs-share";
- }
-
- gnome_vfs_connect_to_server (uri, name, icon);
- gtk_widget_hide (GTK_WIDGET (dialog));
- if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
- nautilus_connect_server_dialog_present_uri (dialog->details->application,
- uri,
- GTK_WIDGET (dialog));
+ g_object_unref (bookmark);
+ g_object_unref (list);
+ g_free (name);
}
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ nautilus_connect_server_dialog_present_uri (dialog->details->application,
+ location,
+ GTK_WIDGET (dialog));
- g_free (uri);
- g_free (name);
+ g_object_unref (location);
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -377,12 +339,6 @@ response_callback (NautilusConnectServerDialog *dialog,
GError *error;
switch (response_id) {
- case RESPONSE_BROWSE:
- nautilus_connect_server_dialog_present_uri (dialog->details->application,
- "network:///",
- GTK_WIDGET (dialog));
- gtk_widget_destroy (GTK_WIDGET (dialog));
- break;
case RESPONSE_CONNECT:
connect_to_server (dialog);
break;
@@ -464,6 +420,10 @@ setup_for_type (NautilusConnectServerDialog *dialog)
gtk_container_remove (GTK_CONTAINER (dialog->details->table),
dialog->details->domain_entry);
}
+ if (dialog->details->bookmark_check->parent != NULL) {
+ gtk_container_remove (GTK_CONTAINER (dialog->details->table),
+ dialog->details->bookmark_check);
+ }
if (dialog->details->name_entry->parent != NULL) {
gtk_container_remove (GTK_CONTAINER (dialog->details->table),
dialog->details->name_entry);
@@ -476,7 +436,7 @@ setup_for_type (NautilusConnectServerDialog *dialog)
i = 1;
table = dialog->details->table;
- if (meth->method == NULL) {
+ if (meth->scheme == NULL) {
label = gtk_label_new_with_mnemonic (_("_Location (URI):"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
@@ -636,7 +596,15 @@ setup_for_type (NautilusConnectServerDialog *dialog)
connection_name:
- label = gtk_label_new_with_mnemonic (_("_Name to use for connection:"));
+ gtk_widget_show (dialog->details->bookmark_check);
+ gtk_table_attach (GTK_TABLE (table), dialog->details->bookmark_check,
+ 0, 1,
+ i, i+1,
+ GTK_FILL, GTK_FILL,
+ 0, 0);
+ i++;
+
+ label = gtk_label_new_with_mnemonic (_("Bookmark _name:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label,
@@ -658,29 +626,30 @@ setup_for_type (NautilusConnectServerDialog *dialog)
}
static void
-display_server_uri (NautilusConnectServerDialog *dialog, GnomeVFSURI *uri)
+display_server_location (NautilusConnectServerDialog *dialog, GFile *location)
{
+#if 0 /*FIXME */
struct MethodInfo *meth = NULL;
- const char *method;
+ char *scheme;
int i, index = 0;
- const char *folder;
+ char *folder;
const char *t;
/* Find an appropriate method */
- method = gnome_vfs_uri_get_scheme (uri);
- g_return_if_fail (method != NULL);
+ scheme = g_file_get_uri_scheme (location);
+ g_return_if_fail (scheme != NULL);
for (i = 0; i < G_N_ELEMENTS (methods); i++) {
/* The default is 'Custom URI' */
- if (methods[i].method == NULL) {
+ if (methods[i].scheme == NULL) {
meth = &(methods[i]);
index = i;
- } else if (strcmp (methods[i].method, method) == 0) {
+ } else if (strcmp (methods[i].scheme, scheme) == 0) {
/* FTP Special case: If no user keep searching for public ftp */
- if (strcmp (method, "ftp") == 0) {
+ if (strcmp (scheme, "ftp") == 0) {
t = gnome_vfs_uri_get_user_name (uri);
if ((!t || !t[0] || strcmp (t, "anonymous") == 0) &&
(!(methods[i].flags & IS_ANONYMOUS))) {
@@ -693,22 +662,26 @@ display_server_uri (NautilusConnectServerDialog *dialog, GnomeVFSURI *uri)
break;
}
}
-
+
+ g_free (scheme);
g_assert (meth);
gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->details->type_combo), index);
setup_for_type (dialog);
/* Custom URI */
- if (meth->method == NULL) {
- gchar *suri = gnome_vfs_uri_to_string (uri,
- GNOME_VFS_URI_HIDE_PASSWORD | GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER);
- gtk_entry_set_text (GTK_ENTRY (dialog->details->uri_entry), suri);
- g_free (suri);
+ if (meth->scheme == NULL) {
+ gchar *uri;
+
+ /* FIXME: with gnome-vfs, we had GNOME_VFS_URI_HIDE_PASSWORD |
+ * GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER */
+ uri = g_file_get_uri (location)
+ gtk_entry_set_text (GTK_ENTRY (dialog->details->uri_entry), uri);
+ g_free (uri);
} else {
- folder = gnome_vfs_uri_get_path (uri);
+ folder = g_file_get_path (location);
if (!folder) {
folder = "";
} else if (folder[0] == '/') {
@@ -744,6 +717,7 @@ display_server_uri (NautilusConnectServerDialog *dialog, GnomeVFSURI *uri)
/* Folder */
gtk_entry_set_text (GTK_ENTRY (dialog->details->folder_entry), folder);
+ g_free (folder);
/* User */
if (meth->flags & SHOW_USER) {
@@ -770,6 +744,7 @@ display_server_uri (NautilusConnectServerDialog *dialog, GnomeVFSURI *uri)
}
}
}
+#endif
}
static void
@@ -854,10 +829,26 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
for (i = 0; i < G_N_ELEMENTS (methods); i++) {
GtkTreeIter iter;
+ const gchar * const *supported;
+ int j;
+
+ /* skip methods that don't have corresponding GnomeVFSMethods */
+ supported = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
- if (methods[i].method != NULL && gnome_vfs_method_get (methods[i].method) == NULL) {
- /* skip methods that don't have corresponding GnomeVFSMethods */
- continue;
+ if (methods[i].scheme != NULL) {
+ gboolean found;
+
+ found = FALSE;
+ for (j = 0; supported[j] != NULL; j++) {
+ if (strcmp (methods[i].scheme, supported[j]) == 0) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found) {
+ continue;
+ }
}
gtk_list_store_append (store, &iter);
@@ -913,6 +904,7 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
dialog->details->folder_entry = gtk_entry_new ();
dialog->details->domain_entry = gtk_entry_new ();
dialog->details->user_entry = gtk_entry_new ();
+ dialog->details->bookmark_check = gtk_check_button_new_with_mnemonic (_("Add _bookmark"));
dialog->details->name_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->uri_entry), TRUE);
@@ -932,6 +924,7 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
g_object_ref (dialog->details->folder_entry);
g_object_ref (dialog->details->domain_entry);
g_object_ref (dialog->details->user_entry);
+ g_object_ref (dialog->details->bookmark_check);
g_object_ref (dialog->details->name_entry);
setup_for_type (dialog);
@@ -940,9 +933,6 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
GTK_STOCK_HELP,
GTK_RESPONSE_HELP);
gtk_dialog_add_button (GTK_DIALOG (dialog),
- _("Browse _Network"),
- RESPONSE_BROWSE);
- gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (dialog),
@@ -959,11 +949,10 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
}
GtkWidget *
-nautilus_connect_server_dialog_new (NautilusWindow *window, const gchar *location)
+nautilus_connect_server_dialog_new (NautilusWindow *window, GFile *location)
{
NautilusConnectServerDialog *conndlg;
GtkWidget *dialog;
- GnomeVFSURI *uri;
dialog = gtk_widget_new (NAUTILUS_TYPE_CONNECT_SERVER_DIALOG, NULL);
conndlg = NAUTILUS_CONNECT_SERVER_DIALOG (dialog);
@@ -975,15 +964,10 @@ nautilus_connect_server_dialog_new (NautilusWindow *window, const gchar *locatio
}
if (location) {
- uri = gnome_vfs_uri_new (location);
- g_return_val_if_fail (uri != NULL, dialog);
-
/* If it's a remote URI, then load as the default */
- if (!g_str_equal (gnome_vfs_uri_get_scheme (uri), "file") &&
- !gnome_vfs_uri_is_local (uri))
- display_server_uri (conndlg, uri);
-
- gnome_vfs_uri_unref (uri);
+ if (!g_file_is_native (location)) {
+ display_server_location (conndlg, location);
+ }
}
return dialog;
diff --git a/src/nautilus-connect-server-dialog.h b/src/nautilus-connect-server-dialog.h
index f84e35b53..e4dcf873e 100644
--- a/src/nautilus-connect-server-dialog.h
+++ b/src/nautilus-connect-server-dialog.h
@@ -24,6 +24,7 @@
#ifndef NAUTILUS_CONNECT_SERVER_DIALOG_H
#define NAUTILUS_CONNECT_SERVER_DIALOG_H
+#include <gio/gio.h>
#include <gtk/gtkdialog.h>
#include "nautilus-window.h"
@@ -47,12 +48,12 @@ struct _NautilusConnectServerDialogClass {
GType nautilus_connect_server_dialog_get_type (void);
GtkWidget* nautilus_connect_server_dialog_new (NautilusWindow *window,
- const gchar *uri);
+ GFile *location);
/* Private internal calls */
void nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
- const char *uri,
+ GFile *location,
GtkWidget *widget);
#endif /* NAUTILUS_CONNECT_SERVER_DIALOG_H */
diff --git a/src/nautilus-shell-ui.xml b/src/nautilus-shell-ui.xml
index 835784ab4..343f7b59d 100644
--- a/src/nautilus-shell-ui.xml
+++ b/src/nautilus-shell-ui.xml
@@ -9,7 +9,7 @@
<placeholder name="Open Placeholder"/>
<separator/>
<placeholder name="Location Placeholder"/>
-<!-- <menuitem name="Connect to Server" action="Connect to Server"/> -->
+ <menuitem name="Connect to Server" action="Connect to Server"/>
<separator/>
<placeholder name="File Items Placeholder"/>
<separator/>
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index de660ba9c..14a33f603 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -31,9 +31,7 @@
#include "nautilus-actions.h"
#include "nautilus-application.h"
-#ifdef GIO_CONVERSION_DONE
#include "nautilus-connect-server-dialog.h"
-#endif
#include "nautilus-file-management-properties.h"
#include "nautilus-property-browser.h"
#include "nautilus-window-manage-views.h"
@@ -196,24 +194,22 @@ action_close_window_callback (GtkAction *action,
nautilus_window_close (NAUTILUS_WINDOW (user_data));
}
-#ifdef GIO_CONVERSION_DONE
-
static void
action_connect_to_server_callback (GtkAction *action,
gpointer user_data)
{
NautilusWindow *window = NAUTILUS_WINDOW (user_data);
GtkWidget *dialog;
- char *location;
- location = nautilus_window_get_location_uri (window);
+ GFile *location;
+ location = nautilus_window_get_location (window);
dialog = nautilus_connect_server_dialog_new (window, location);
- g_free (location);
+ if (location) {
+ g_object_unref (location);
+ }
gtk_widget_show (dialog);
}
-#endif
-
static gboolean
have_burn_uri (void)
{
@@ -660,12 +656,10 @@ static const GtkActionEntry main_entries[] = {
/* label, accelerator */ N_("Normal Si_ze"), "<control>0",
/* tooltip */ N_("Show the contents at the normal size"),
G_CALLBACK (action_zoom_normal_callback) },
-#ifdef GIO_CONVERSION_DONE
/* name, stock id */ { "Connect to Server", NULL,
/* label, accelerator */ N_("Connect to _Server..."), NULL,
/* tooltip */ N_("Connect to a remote computer or shared disk"),
G_CALLBACK (action_connect_to_server_callback) },
-#endif
/* name, stock id */ { "Home", NAUTILUS_ICON_HOME,
/* label, accelerator */ N_("_Home Folder"), "<alt>Home",
/* tooltip */ N_("Open your personal folder"),