summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2015-08-18 17:44:37 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2015-08-20 15:27:11 -0300
commit0fae67378d5205b49b6fca72fa63c89ad473b743 (patch)
tree9111e3c68fe29356f7a76e91a8ddc5ad01cd2ef6
parent36848e98e21f7067f85ff7d5b0c8993c4ba41c2b (diff)
downloadnautilus-wip/gbsneto/files-view.tar.gz
connect-server: remove legacy codewip/gbsneto/files-view
nautilus-connect-server is a legacy application from GNOME 2 era, where we had no consistent way to manage servers. With the introduction of NautilusPlacesView, this code becomes obsolete, as the network management logic is moved to the places view. Remove the legacy code. https://bugzilla.gnome.org/show_bug.cgi?id=753778 https://bugzilla.gnome.org/show_bug.cgi?id=753871
-rw-r--r--src/Makefile.am9
-rw-r--r--src/nautilus-app-menu.ui4
-rw-r--r--src/nautilus-application-actions.c12
-rw-r--r--src/nautilus-application.c68
-rw-r--r--src/nautilus-connect-server-dialog.c729
-rw-r--r--src/nautilus-connect-server-dialog.h64
-rw-r--r--src/nautilus-connect-server.c182
-rw-r--r--src/nautilus-window.c15
8 files changed, 0 insertions, 1083 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 56972248b..e15295e00 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,6 @@ include $(top_srcdir)/Makefile.shared
bin_PROGRAMS= \
nautilus \
nautilus-autorun-software \
- nautilus-connect-server \
$(NULL)
libexec_PROGRAMS= \
@@ -155,8 +154,6 @@ nautilus_SOURCES = \
nautilus-canvas-view.h \
nautilus-canvas-view-container.c \
nautilus-canvas-view-container.h \
- nautilus-connect-server-dialog.c \
- nautilus-connect-server-dialog.h \
nautilus-dbus-manager.c \
nautilus-dbus-manager.h \
nautilus-desktop-canvas-view.c \
@@ -243,12 +240,6 @@ nautilus_autorun_software_SOURCES= \
nautilus-autorun-software.c \
$(NULL)
-nautilus_connect_server_SOURCES= \
- nautilus-connect-server-dialog.c \
- nautilus-connect-server-dialog.h \
- nautilus-connect-server.c \
- $(NULL)
-
nautilus_convert_metadata_SOURCES= \
nautilus-convert-metadata.c \
$(NULL)
diff --git a/src/nautilus-app-menu.ui b/src/nautilus-app-menu.ui
index 514dc5d33..ced0d77fb 100644
--- a/src/nautilus-app-menu.ui
+++ b/src/nautilus-app-menu.ui
@@ -14,10 +14,6 @@
</item>
</section>
<section>
- <item>
- <attribute name="action">app.connect-to-server</attribute>
- <attribute name="label" translatable="yes">Connect to _Server…</attribute>
- </item>
</section>
<section>
<item>
diff --git a/src/nautilus-application-actions.c b/src/nautilus-application-actions.c
index 17c4b6802..1fc8ee235 100644
--- a/src/nautilus-application-actions.c
+++ b/src/nautilus-application-actions.c
@@ -50,17 +50,6 @@ action_new_window (GSimpleAction *action,
}
static void
-action_connect_to_server (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GtkApplication *application = user_data;
-
- nautilus_application_connect_server (NAUTILUS_APPLICATION (application),
- NAUTILUS_WINDOW (gtk_application_get_active_window (application)));
-}
-
-static void
action_bookmarks (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -238,7 +227,6 @@ action_show_hide_sidebar (GSimpleAction *action,
static GActionEntry app_entries[] = {
{ "new-window", action_new_window, NULL, NULL, NULL },
- { "connect-to-server", action_connect_to_server, NULL, NULL, NULL },
{ "bookmarks", action_bookmarks, NULL, NULL, NULL },
{ "preferences", action_preferences, NULL, NULL, NULL },
{ "show-hide-sidebar", NULL, NULL, "true", action_show_hide_sidebar },
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 1c74ef561..721e5c5b3 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -31,7 +31,6 @@
#include "nautilus-application-actions.h"
#include "nautilus-bookmarks-window.h"
-#include "nautilus-connect-server-dialog.h"
#include "nautilus-dbus-manager.h"
#include "nautilus-desktop-window.h"
#include "nautilus-freedesktop-dbus.h"
@@ -79,8 +78,6 @@ struct _NautilusApplicationPriv {
NautilusBookmarkList *bookmark_list;
- GtkWidget *connect_server_window;
-
NautilusShellSearchProvider *search_provider;
GList *windows;
@@ -516,71 +513,6 @@ nautilus_application_open (GApplication *app,
}
}
-static gboolean
-go_to_server_cb (NautilusWindow *window,
- GFile *location,
- GError *error,
- gpointer user_data)
-{
- gboolean retval;
- NautilusFile *file;
-
- if (error == NULL) {
- file = nautilus_file_get_existing (location);
- nautilus_connect_server_dialog_add_server (file);
- nautilus_file_unref (file);
-
- retval = TRUE;
- } else {
- retval = FALSE;
- }
-
- return retval;
-}
-
-static void
-on_connect_server_response (GtkDialog *dialog,
- int response,
- GtkApplication *application)
-{
- if (response == GTK_RESPONSE_OK) {
- GFile *location;
- NautilusWindow *window = NAUTILUS_WINDOW (gtk_application_get_active_window (application));
-
- location = nautilus_connect_server_dialog_get_location (NAUTILUS_CONNECT_SERVER_DIALOG (dialog));
- if (location != NULL) {
- nautilus_window_slot_open_location_full (nautilus_window_get_active_slot (window),
- location,
- NAUTILUS_WINDOW_OPEN_FLAG_USE_DEFAULT_LOCATION,
- NULL, go_to_server_cb, application);
- }
- }
-
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-GtkWidget *
-nautilus_application_connect_server (NautilusApplication *application,
- NautilusWindow *window)
-{
- GtkWidget *dialog;
-
- dialog = application->priv->connect_server_window;
-
- if (dialog == NULL) {
- dialog = nautilus_connect_server_dialog_new (window);
- g_signal_connect (dialog, "response", G_CALLBACK (on_connect_server_response), application);
- application->priv->connect_server_window = dialog;
-
- g_object_add_weak_pointer (G_OBJECT (dialog),
- (gpointer *) &application->priv->connect_server_window);
- }
-
- gtk_window_present (GTK_WINDOW (dialog));
-
- return dialog;
-}
-
static void
nautilus_application_finalize (GObject *object)
{
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
deleted file mode 100644
index 1c1a3628a..000000000
--- a/src/nautilus-connect-server-dialog.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Nautilus
- *
- * Copyright (C) 2003 Red Hat, Inc.
- * Copyright (C) 2010 Cosimo Cecchi <cosimoc@gnome.org>
- *
- * Nautilus is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * Nautilus 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; see the file COPYING. If not,
- * see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include "nautilus-connect-server-dialog.h"
-
-#include <string.h>
-#include <eel/eel-stock-dialogs.h>
-#include <eel/eel-gtk-extensions.h>
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-#include <gtk/gtk.h>
-
-#include "nautilus-window.h"
-
-struct _NautilusConnectServerDialogDetails {
- GtkTreeView *view;
- GtkListStore *store;
- GtkWidget *primary_grid;
-
- GtkWidget *uri_entry;
- GtkWidget *error_label;
-
- GtkWidget *menu;
- GtkWidget *remove_menu_item;
- GtkWidget *clear_menu_item;
-
- char **supported;
-};
-
-enum {
- COLUMN_NAME,
- COLUMN_URI,
- NUM_COLUMNS
-};
-
-
-G_DEFINE_TYPE (NautilusConnectServerDialog, nautilus_connect_server_dialog,
- GTK_TYPE_DIALOG)
-
-GFile *
-nautilus_connect_server_dialog_get_location (NautilusConnectServerDialog *dialog)
-{
- const char *uri;
- GFile *file = NULL;
-
- uri = gtk_entry_get_text (GTK_ENTRY (dialog->details->uri_entry));
- if (uri != NULL && uri[0] != '\0') {
- file = g_file_new_for_commandline_arg (uri);
- }
-
- return file;
-}
-
-static gboolean
-is_scheme_supported (NautilusConnectServerDialog *dialog,
- const char *scheme)
-{
- int i;
-
- if (dialog->details->supported == NULL) {
- return FALSE;
- }
-
- for (i = 0; dialog->details->supported[i] != NULL; i++) {
- if (strcmp (scheme, dialog->details->supported[i]) == 0) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-validate_uri (NautilusConnectServerDialog *dialog,
- const char *uri,
- GError **error)
-{
- gboolean valid = FALSE;
- char *scheme;
-
- scheme = g_uri_parse_scheme (uri);
- if (scheme != NULL) {
- valid = is_scheme_supported (dialog, scheme);
- if (! valid) {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_NOT_SUPPORTED,
- _("This file server type is not recognized."));
- }
- g_free (scheme);
- } else {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- _("This doesn't look like an address."));
-
- }
-
- return valid;
-}
-
-static void
-on_uri_entry_clear (GtkEntry *entry,
- NautilusConnectServerDialog *dialog)
-{
- gtk_entry_set_text (entry, "");
-}
-
-static const char *
-get_default_schema (NautilusConnectServerDialog *dialog)
-{
- if (dialog->details->supported == NULL) {
- return NULL;
- }
-
- return dialog->details->supported[0];
-}
-
-static int
-get_index (const char **names,
- const char *needle)
-{
- int i;
- int index = G_MAXINT;
- for (i = 0; names[i] != NULL; i++) {
- if (strcmp (needle, names[i]) == 0) {
- index = i;
- break;
- }
- }
-
- return index;
-}
-
-static int
-sort_supported (gconstpointer a,
- gconstpointer b,
- gpointer user_data)
-{
- const char **preferred = user_data;
- const char *s_a = *((char **)a);
- const char *s_b = *((char **)b);
- int i_a;
- int i_b;
-
- i_a = get_index (preferred, s_a);
- i_b = get_index (preferred, s_b);
-
- if (i_b == i_a) {
- return 0;
- } else if (i_a > i_b) {
- return 1;
- } else {
- return -1;
- }
-}
-
-static void
-populate_supported_list (NautilusConnectServerDialog *dialog)
-{
- const char * const *supported;
- GPtrArray *good;
- int i;
- int j;
- const char * unsupported[] = { "file", "afc", "obex", "http", "trash", "burn", "computer", "archive", "recent", "localtest", NULL };
- const char * preferred[] = { "smb", "afp", "sftp", "ssh", "davs", "dav", "ftp", NULL };
-
- supported = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
- if (supported == NULL) {
- return;
- }
-
- good = g_ptr_array_new ();
- for (i = 0; supported[i] != NULL; i++) {
- gboolean support = TRUE;
- for (j = 0; unsupported[j] != NULL; j++) {
- if (strcmp (supported[i], unsupported[j]) == 0) {
- support = FALSE;
- break;
- }
- }
- if (support) {
- g_ptr_array_add (good, g_strdup (supported[i]));
- }
- }
- g_ptr_array_sort_with_data (good, sort_supported, preferred);
-
- g_ptr_array_add (good, NULL);
-
- dialog->details->supported = (char **)g_ptr_array_free (good, FALSE);
-}
-
-static void
-reset_example_label (NautilusConnectServerDialog *dialog)
-{
- char *text;
- char *uri;
- const char *schema;
-
- schema = get_default_schema (dialog);
- if (schema != NULL) {
- uri = g_strdup_printf ("%s://foo.example.org", schema);
- /* Translators: %s is a URI of the form "smb://foo.example.com" */
- text = g_strdup_printf (_("For example, %s"), uri);
- g_free (uri);
- } else {
- text = g_strdup ("");
- }
- gtk_label_set_text (GTK_LABEL (dialog->details->error_label), text);
- g_free (text);
-}
-
-static void
-check_uri_entry (NautilusConnectServerDialog *dialog)
-{
- guint length;
- gboolean button_active = FALSE;
- gboolean icon_active = FALSE;
- const char *text = NULL;
-
- length = gtk_entry_get_text_length (GTK_ENTRY (dialog->details->uri_entry));
- if (length > 0) {
- GError *error = NULL;
-
- text = gtk_entry_get_text (GTK_ENTRY (dialog->details->uri_entry));
- button_active = validate_uri (dialog, text, &error);
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)) {
- gtk_label_set_text (GTK_LABEL (dialog->details->error_label), error->message);
- } else {
- reset_example_label (dialog);
- }
- g_clear_error (&error);
- icon_active = TRUE;
- }
-
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, button_active);
-
- g_object_set (dialog->details->uri_entry,
- "secondary-icon-name", icon_active ? ("edit-clear-symbolic") : NULL,
- "secondary-icon-activatable", icon_active,
- "secondary-icon-sensitive", icon_active,
- NULL);
-}
-
-static void
-on_uri_entry_changed (GtkEditable *editable,
- NautilusConnectServerDialog *dialog)
-{
- GtkTreeSelection *selection;
-
- /* if the uri is changed at all it isn't the selected on anymore */
- selection = gtk_tree_view_get_selection (dialog->details->view);
- gtk_tree_selection_unselect_all (selection);
-
- check_uri_entry (dialog);
-}
-
-static char *
-get_selected (NautilusConnectServerDialog *dialog,
- GtkTreeIter *iter_out)
-{
- GtkTreeSelection *selection;
- GtkTreeIter iter;
- char *uri = NULL;
-
- selection = gtk_tree_view_get_selection (dialog->details->view);
- if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->details->store),
- &iter,
- COLUMN_URI, &uri,
- -1);
- if (iter_out) {
- *iter_out = iter;
- }
- }
-
- return uri;
-}
-
-static void
-on_selection_changed (GtkTreeSelection *selection,
- NautilusConnectServerDialog *dialog)
-{
- char *uri;
-
- uri = get_selected (dialog, NULL);
- if (uri != NULL) {
- g_signal_handlers_block_by_func (dialog->details->uri_entry, on_uri_entry_changed, dialog);
- gtk_entry_set_text (GTK_ENTRY (dialog->details->uri_entry), uri);
- g_signal_handlers_unblock_by_func (dialog->details->uri_entry, on_uri_entry_changed, dialog);
- check_uri_entry (dialog);
- g_free (uri);
- gtk_widget_set_sensitive (dialog->details->remove_menu_item, TRUE);
- } else {
- gtk_widget_set_sensitive (dialog->details->remove_menu_item, FALSE);
- }
-}
-
-static GBookmarkFile *
-server_list_load (void)
-{
- GBookmarkFile *bookmarks;
- GError *error = NULL;
- char *datadir;
- char *filename;
-
- bookmarks = g_bookmark_file_new ();
- datadir = g_build_filename (g_get_user_config_dir (), "nautilus", NULL);
- filename = g_build_filename (datadir, "servers", NULL);
- g_mkdir_with_parents (datadir, 0700);
- g_free (datadir);
- g_bookmark_file_load_from_file (bookmarks,
- filename,
- &error);
- g_free (filename);
- if (error != NULL) {
- if (! g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
- /* only warn if the file exists */
- g_warning ("Unable to open server bookmarks: %s", error->message);
- }
- g_error_free (error);
- g_bookmark_file_free (bookmarks);
- bookmarks = NULL;
- }
-
- return bookmarks;
-}
-
-static void
-server_list_save (GBookmarkFile *bookmarks)
-{
- char *filename;
-
- filename = g_build_filename (g_get_user_config_dir (), "nautilus", "servers", NULL);
- g_bookmark_file_to_file (bookmarks, filename, NULL);
- g_free (filename);
-}
-
-static void
-populate_server_list (NautilusConnectServerDialog *dialog)
-{
- GBookmarkFile *bookmarks;
- GtkTreeIter iter;
- char **uris;
- int i;
-
- bookmarks = server_list_load ();
- if (bookmarks == NULL) {
- return;
- }
- uris = g_bookmark_file_get_uris (bookmarks, NULL);
- if (uris != NULL) {
- for (i = 0; uris[i] != NULL; i++) {
- char *name;
-
- name = g_bookmark_file_get_title (bookmarks, uris[i], NULL);
- gtk_list_store_append (dialog->details->store, &iter);
- gtk_list_store_set (dialog->details->store, &iter,
- COLUMN_URI, uris[i],
- COLUMN_NAME, name,
- -1);
- g_free (name);
- }
- g_strfreev (uris);
- gtk_widget_set_sensitive (dialog->details->clear_menu_item, TRUE);
- } else {
- gtk_widget_set_sensitive (dialog->details->clear_menu_item, FALSE);
- }
-
- g_bookmark_file_free (bookmarks);
-}
-
-static void
-server_list_remove (NautilusConnectServerDialog *dialog,
- const char *uri)
-{
- GBookmarkFile *bookmarks;
-
- bookmarks = server_list_load ();
- if (bookmarks == NULL) {
- return;
- }
-
- g_bookmark_file_remove_item (bookmarks, uri, NULL);
- server_list_save (bookmarks);
- g_bookmark_file_free (bookmarks);
-}
-
-static void
-server_list_remove_all (NautilusConnectServerDialog *dialog)
-{
- GBookmarkFile *bookmarks;
-
- bookmarks = g_bookmark_file_new ();
- if (bookmarks == NULL) {
- return;
- }
- server_list_save (bookmarks);
- g_bookmark_file_free (bookmarks);
-}
-
-static void
-boldify_label (GtkLabel *label)
-{
- PangoAttrList *attrs;
- attrs = pango_attr_list_new ();
- pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
- gtk_label_set_attributes (label, attrs);
- pango_attr_list_unref (attrs);
-}
-
-static void
-on_clear_item_activated (GtkMenuItem *item,
- NautilusConnectServerDialog *dialog)
-{
- server_list_remove_all (dialog);
- gtk_list_store_clear (dialog->details->store);
- gtk_widget_set_sensitive (dialog->details->clear_menu_item, FALSE);
-}
-
-static void
-on_remove_item_activated (GtkMenuItem *item,
- NautilusConnectServerDialog *dialog)
-{
- char *uri;
- GtkTreeIter iter;
-
- uri = get_selected (dialog, &iter);
- if (uri != NULL) {
- server_list_remove (dialog, uri);
- gtk_list_store_remove (dialog->details->store, &iter);
- g_free (uri);
- }
-}
-
-static void
-on_row_activated (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- NautilusConnectServerDialog *dialog)
-{
- gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-}
-
-static void
-on_popup_menu_detach (GtkWidget *attach_widget,
- GtkMenu *menu)
-{
- NautilusConnectServerDialog *dialog = NAUTILUS_CONNECT_SERVER_DIALOG (attach_widget);
-
- dialog->details->menu = NULL;
- dialog->details->remove_menu_item = NULL;
- dialog->details->clear_menu_item = NULL;
-}
-
-static void
-create_popup_menu (NautilusConnectServerDialog *dialog)
-{
- GtkWidget *menu;
- GtkWidget *item;
-
- if (dialog->details->menu != NULL) {
- return;
- }
-
- menu = gtk_menu_new ();
- dialog->details->menu = menu;
- gtk_menu_attach_to_widget (GTK_MENU (menu),
- GTK_WIDGET (dialog),
- on_popup_menu_detach);
-
- item = gtk_menu_item_new_with_mnemonic (_("_Remove"));
- dialog->details->remove_menu_item = item;
- g_signal_connect (item, "activate",
- G_CALLBACK (on_remove_item_activated), dialog);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- eel_gtk_menu_append_separator (GTK_MENU (menu));
-
- item = gtk_menu_item_new_with_mnemonic (_("_Clear All"));
- dialog->details->clear_menu_item = item;
- g_signal_connect (item, "activate",
- G_CALLBACK (on_clear_item_activated), dialog);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-}
-
-static void
-history_popup_menu (NautilusConnectServerDialog *dialog)
-{
- create_popup_menu (dialog);
- eel_pop_up_context_menu (GTK_MENU (dialog->details->menu), NULL);
-}
-
-static gboolean
-on_popup_menu (GtkWidget *widget,
- NautilusConnectServerDialog *dialog)
-{
- history_popup_menu (dialog);
- return TRUE;
-}
-
-static void
-nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
-{
- GtkWidget *label;
- GtkWidget *sw;
- GtkWidget *view;
- GtkWidget *box;
- GtkWidget *content_area;
- GtkWidget *grid;
- int row;
- GtkCellRenderer *cell;
- GtkTreeSelection *selection;
- GtkListStore *store;
-
- dialog->details = G_TYPE_INSTANCE_GET_PRIVATE (dialog, NAUTILUS_TYPE_CONNECT_SERVER_DIALOG,
- NautilusConnectServerDialogDetails);
-
- populate_supported_list (dialog);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
- /* set dialog properties */
- gtk_window_set_title (GTK_WINDOW (dialog), _("Connect to Server"));
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-
- grid = gtk_grid_new ();
- gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
- gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
- gtk_widget_set_margin_bottom (grid, 12);
- gtk_container_set_border_width (GTK_CONTAINER (grid), 5);
- gtk_container_add (GTK_CONTAINER (content_area), grid);
- gtk_widget_show (grid);
-
- dialog->details->primary_grid = grid;
-
- row = 0;
-
- label = gtk_label_new_with_mnemonic (_("_Server Address"));
- boldify_label (GTK_LABEL (label));
- gtk_label_set_xalign (GTK_LABEL (label), 0);
- gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
- gtk_widget_show (label);
-
- dialog->details->uri_entry = gtk_entry_new ();
-
- gtk_widget_set_hexpand (dialog->details->uri_entry, TRUE);
- gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->uri_entry), TRUE);
- gtk_grid_attach (GTK_GRID (grid), dialog->details->uri_entry, 0, row++, 1, 1);
-
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->uri_entry);
- gtk_widget_show (dialog->details->uri_entry);
-
- label = gtk_label_new (NULL);
- gtk_label_set_xalign (GTK_LABEL (label), 0);
- gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
- gtk_widget_show (label);
- dialog->details->error_label = label;
- reset_example_label (dialog);
- gtk_widget_set_margin_bottom (label, 12);
- gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
-
- label = gtk_label_new_with_mnemonic (_("_Recent Servers"));
- boldify_label (GTK_LABEL (label));
- gtk_label_set_xalign (GTK_LABEL (label), 0);
- gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
- gtk_widget_show (label);
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_set_hexpand (box, TRUE);
- gtk_widget_set_vexpand (box, TRUE);
- gtk_grid_attach (GTK_GRID (grid), box, 0, row++, 1, 1);
- gtk_widget_show (box);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_widget_set_size_request (sw, 400, 150);
- gtk_widget_show (sw);
- gtk_widget_set_hexpand (sw, TRUE);
- gtk_widget_set_vexpand (sw, TRUE);
- gtk_container_add (GTK_CONTAINER (box), sw);
-
- view = gtk_tree_view_new ();
- gtk_widget_show (view);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
- gtk_container_add (GTK_CONTAINER (sw), view);
-
- g_signal_connect (view, "row-activated",
- G_CALLBACK (on_row_activated),
- dialog);
- g_signal_connect (view, "popup-menu",
- G_CALLBACK (on_popup_menu),
- dialog);
-
- store = gtk_list_store_new (NUM_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_STRING);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (view),
- GTK_TREE_MODEL (store));
- g_object_unref (store);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
- g_signal_connect (selection, "changed",
- G_CALLBACK (on_selection_changed),
- dialog);
-
- cell = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
- -1,
- NULL,
- cell,
- "text", COLUMN_NAME,
- NULL);
- cell = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
- -1,
- NULL,
- cell,
- "text", COLUMN_URI,
- NULL);
- dialog->details->view = GTK_TREE_VIEW (view);
- dialog->details->store = store;
-
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- _("_Cancel"),
- GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- _("C_onnect"),
- GTK_RESPONSE_OK);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog),
- GTK_RESPONSE_OK);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
- GTK_RESPONSE_OK,
- FALSE);
-
- g_signal_connect (dialog->details->uri_entry, "changed",
- G_CALLBACK (on_uri_entry_changed),
- dialog);
- g_signal_connect (dialog->details->uri_entry, "icon-release",
- G_CALLBACK (on_uri_entry_clear),
- dialog);
-
- create_popup_menu (dialog);
- populate_server_list (dialog);
-}
-
-static void
-nautilus_connect_server_dialog_finalize (GObject *object)
-{
- NautilusConnectServerDialog *dialog;
-
- dialog = NAUTILUS_CONNECT_SERVER_DIALOG (object);
-
- g_strfreev (dialog->details->supported);
-
- G_OBJECT_CLASS (nautilus_connect_server_dialog_parent_class)->finalize (object);
-}
-
-static void
-nautilus_connect_server_dialog_class_init (NautilusConnectServerDialogClass *class)
-{
- GObjectClass *oclass;
-
- oclass = G_OBJECT_CLASS (class);
- oclass->finalize = nautilus_connect_server_dialog_finalize;
-
- g_type_class_add_private (class, sizeof (NautilusConnectServerDialogDetails));
-}
-
-GtkWidget *
-nautilus_connect_server_dialog_new (NautilusWindow *window)
-{
- return g_object_new (NAUTILUS_TYPE_CONNECT_SERVER_DIALOG,
- "transient-for", window,
- "use-header-bar", TRUE,
- NULL);
-}
-
-void
-nautilus_connect_server_dialog_add_server (NautilusFile *file)
-{
- GBookmarkFile *bookmarks;
- char *uri;
- char *title;
-
- bookmarks = server_list_load ();
- if (bookmarks == NULL) {
- return;
- }
-
- uri = nautilus_file_get_uri (file);
- title = nautilus_file_get_display_name (file);
- g_bookmark_file_set_title (bookmarks, uri, title);
- g_bookmark_file_set_visited (bookmarks, uri, -1);
- g_bookmark_file_add_application (bookmarks, uri, NULL, NULL);
- g_free (uri);
- g_free (title);
-
- server_list_save (bookmarks);
- g_bookmark_file_free (bookmarks);
-}
diff --git a/src/nautilus-connect-server-dialog.h b/src/nautilus-connect-server-dialog.h
deleted file mode 100644
index cf7b66c9f..000000000
--- a/src/nautilus-connect-server-dialog.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Nautilus
- *
- * Copyright (C) 2003 Red Hat, Inc.
- * Copyright (C) 2010 Cosimo Cecchi <cosimoc@gnome.org>
- *
- * Nautilus is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * Nautilus 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; see the file COPYING. If not,
- * see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NAUTILUS_CONNECT_SERVER_DIALOG_H
-#define NAUTILUS_CONNECT_SERVER_DIALOG_H
-
-#include <gio/gio.h>
-#include <gtk/gtk.h>
-
-#include "nautilus-application.h"
-#include "nautilus-window.h"
-
-#define NAUTILUS_TYPE_CONNECT_SERVER_DIALOG\
- (nautilus_connect_server_dialog_get_type ())
-#define NAUTILUS_CONNECT_SERVER_DIALOG(obj)\
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_CONNECT_SERVER_DIALOG,\
- NautilusConnectServerDialog))
-#define NAUTILUS_CONNECT_SERVER_DIALOG_CLASS(klass)\
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CONNECT_SERVER_DIALOG,\
- NautilusConnectServerDialogClass))
-#define NAUTILUS_IS_CONNECT_SERVER_DIALOG(obj)\
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_CONNECT_SERVER_DIALOG)
-
-typedef struct _NautilusConnectServerDialog NautilusConnectServerDialog;
-typedef struct _NautilusConnectServerDialogClass NautilusConnectServerDialogClass;
-typedef struct _NautilusConnectServerDialogDetails NautilusConnectServerDialogDetails;
-
-struct _NautilusConnectServerDialog {
- GtkDialog parent;
- NautilusConnectServerDialogDetails *details;
-};
-
-struct _NautilusConnectServerDialogClass {
- GtkDialogClass parent_class;
-};
-
-GType nautilus_connect_server_dialog_get_type (void);
-
-GtkWidget * nautilus_connect_server_dialog_new (NautilusWindow *window);
-GFile * nautilus_connect_server_dialog_get_location (NautilusConnectServerDialog *dialog);
-void nautilus_connect_server_dialog_set_show_browse (NautilusConnectServerDialog *dialog,
- gboolean show);
-void nautilus_connect_server_dialog_add_server (NautilusFile *file);
-
-#endif /* NAUTILUS_CONNECT_SERVER_DIALOG_H */
diff --git a/src/nautilus-connect-server.c b/src/nautilus-connect-server.c
deleted file mode 100644
index 742f53250..000000000
--- a/src/nautilus-connect-server.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
- *
- * Copyright (C) 2005 Vincent Untz
- * Copyright (C) 2012 Red Hat, Inc.
- *
- * Nautilus is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * Nautilus 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "nautilus-connect-server-dialog.h"
-#include <eel/eel-stock-dialogs.h>
-
-static gboolean just_print_uri = FALSE;
-
-static void
-mount_ready_callback (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- GError *error;
- GFile *location;
- gboolean show = TRUE;
- GtkWidget *dialog = user_data;
-
- location = G_FILE (source_object);
-
- error = NULL;
- if (!g_file_mount_enclosing_volume_finish (location, res, &error)) {
- show = FALSE;
- if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_ALREADY_MOUNTED) {
- show = TRUE;
- } else if (error->domain != G_IO_ERROR ||
- (error->code != G_IO_ERROR_CANCELLED &&
- error->code != G_IO_ERROR_FAILED_HANDLED)) {
- /* if it wasn't cancelled show a dialog */
- eel_show_error_dialog (_("Unable to access location"), error->message, GTK_WINDOW (dialog));
- }
- g_clear_error (&error);
- }
-
- if (show) {
- char *uri;
- uri = g_file_get_uri (location);
- if (just_print_uri) {
- g_print ("%s\n", uri);
- } else {
- GdkAppLaunchContext *launch_context;
-
- launch_context = gdk_display_get_app_launch_context (gtk_widget_get_display (dialog));
- gdk_app_launch_context_set_screen (launch_context,
- gtk_widget_get_screen (dialog));
- error = NULL;
- g_app_info_launch_default_for_uri (uri,
- G_APP_LAUNCH_CONTEXT (launch_context),
- &error);
- if (error != NULL) {
- eel_show_error_dialog (_("Unable to display location"), error->message, GTK_WINDOW (dialog));
- g_clear_error (&error);
- }
- g_object_unref (launch_context);
- }
- g_free (uri);
- }
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-static void
-mount_location (GtkWidget *dialog,
- GFile *location)
-{
- GMountOperation *mount_op;
-
- mount_op = gtk_mount_operation_new (GTK_WINDOW (dialog));
- g_mount_operation_set_password_save (mount_op, G_PASSWORD_SAVE_FOR_SESSION);
- g_file_mount_enclosing_volume (location,
- 0,
- mount_op,
- NULL,
- mount_ready_callback,
- dialog);
- /* unref mount_op here - g_file_mount_enclosing_volume() does ref for itself */
- g_object_unref (mount_op);
-}
-
-static void
-on_connect_server_destroy (GtkWidget *widget,
- gpointer user_data)
-{
- /* this only happens when user clicks "cancel"
- * on the main dialog or when we are all done.
- */
- gtk_main_quit ();
-}
-
-static void
-on_connect_server_response (GtkDialog *dialog,
- int response,
- gpointer user_data)
-{
- if (response == GTK_RESPONSE_OK) {
- GFile *location;
-
- location = nautilus_connect_server_dialog_get_location (NAUTILUS_CONNECT_SERVER_DIALOG (dialog));
- if (location != NULL) {
- mount_location (GTK_WIDGET (dialog), location);
- g_object_unref (location);
- } else {
- g_warning ("Unable to get remote server location");
- gtk_widget_destroy (GTK_WIDGET (dialog));
- }
- } else {
- gtk_widget_destroy (GTK_WIDGET (dialog));
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *dialog;
- GOptionContext *context;
- GError *error;
- const GOptionEntry options[] = {
- { "print-uri", 0, 0, G_OPTION_ARG_NONE, &just_print_uri, N_("Print but do not open the URI"), NULL },
- { NULL }
- };
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- g_set_prgname ("nautilus-connect-server");
-
- /* Translators: This is the --help description for the connect to server app,
- the initial newlines are between the command line arg and the description */
- context = g_option_context_new (N_("\n\nAdd connect to server mount"));
- g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
- g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
-
- error = NULL;
- if (!g_option_context_parse (context, &argc, &argv, &error)) {
- g_critical ("Failed to parse arguments: %s", error->message);
- g_error_free (error);
- g_option_context_free (context);
- exit (1);
- }
-
- g_option_context_free (context);
-
- dialog = nautilus_connect_server_dialog_new (NULL);
-
- gtk_window_set_default_icon_name ("folder-remote-symbolic");
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (on_connect_server_response),
- NULL);
- g_signal_connect (dialog, "destroy",
- G_CALLBACK (on_connect_server_destroy),
- NULL);
-
- gtk_widget_show (dialog);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index f9ff80ac0..3b199c215 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -973,19 +973,6 @@ places_sidebar_show_error_message_cb (GtkPlacesSidebar *sidebar,
eel_show_error_dialog (primary, secondary, GTK_WINDOW (window));
}
-/* Callback used when the places sidebar needs us to present the Connect to Server dialog */
-static void
-places_sidebar_show_connect_to_server_cb (GtkPlacesSidebar *sidebar,
- gpointer user_data)
-{
- NautilusWindow *window = NAUTILUS_WINDOW (user_data);
- NautilusApplication *application = NAUTILUS_APPLICATION (g_application_get_default ());
- GtkWidget *dialog;
-
- dialog = nautilus_application_connect_server (application, window);
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-}
-
static void
places_sidebar_show_other_locations (NautilusWindow *window)
{
@@ -1288,8 +1275,6 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
G_CALLBACK (open_location_cb), window);
g_signal_connect (window->priv->places_sidebar, "show-error-message",
G_CALLBACK (places_sidebar_show_error_message_cb), window);
- g_signal_connect (window->priv->places_sidebar, "show-connect-to-server",
- G_CALLBACK (places_sidebar_show_connect_to_server_cb), window);
g_signal_connect (window->priv->places_sidebar, "drag-action-requested",
G_CALLBACK (places_sidebar_drag_action_requested_cb), window);
g_signal_connect (window->priv->places_sidebar, "drag-action-ask",