summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2005-01-14 11:11:38 +0000
committerAlexander Larsson <alexl@src.gnome.org>2005-01-14 11:11:38 +0000
commit5390cc255bcd15ca2986ffe467b882b94ccd9c0b (patch)
treed8b27759979374968208f654ced9c1ec04212053
parent4553e1c81e759416c72e7f2b48af5eece4eb907f (diff)
downloadnautilus-5390cc255bcd15ca2986ffe467b882b94ccd9c0b.tar.gz
Make connect to server dialog availible as separate application.
2005-01-14 Alexander Larsson <alexl@redhat.com> * Makefile.am: * src/.cvsignore: * src/Makefile.am: * src/nautilus-connect-server-dialog-main.c: (dialog_destroyed), (show_uri), (nautilus_connect_server_dialog_present_uri), (main): * src/nautilus-connect-server-dialog-nonmain.c: (nautilus_connect_server_dialog_present_uri): * src/nautilus-connect-server-dialog.c: (connect_to_server), (response_callback), (nautilus_connect_server_dialog_new): * src/nautilus-connect-server-dialog.h: Make connect to server dialog availible as separate application. Patch from Vincent Untz <vincent@vuntz.net>
-rw-r--r--ChangeLog16
-rw-r--r--Makefile.am14
-rw-r--r--src/.cvsignore3
-rw-r--r--src/Makefile.am10
-rw-r--r--src/nautilus-connect-server-dialog-main.c120
-rw-r--r--src/nautilus-connect-server-dialog-nonmain.c50
-rw-r--r--src/nautilus-connect-server-dialog.c28
-rw-r--r--src/nautilus-connect-server-dialog.h6
8 files changed, 227 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d7615af0..8058f8181 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2005-01-14 Alexander Larsson <alexl@redhat.com>
+ * Makefile.am:
+ * src/.cvsignore:
+ * src/Makefile.am:
+ * src/nautilus-connect-server-dialog-main.c: (dialog_destroyed),
+ (show_uri), (nautilus_connect_server_dialog_present_uri), (main):
+ * src/nautilus-connect-server-dialog-nonmain.c:
+ (nautilus_connect_server_dialog_present_uri):
+ * src/nautilus-connect-server-dialog.c: (connect_to_server),
+ (response_callback), (nautilus_connect_server_dialog_new):
+ * src/nautilus-connect-server-dialog.h:
+ Make connect to server dialog availible as separate application.
+
+ Patch from Vincent Untz <vincent@vuntz.net>
+
+2005-01-14 Alexander Larsson <alexl@redhat.com>
+
* libnautilus-private/nautilus-file-utilities.[ch]:
New function nautilus_ensure_unique_file_name
diff --git a/Makefile.am b/Makefile.am
index 7e1928cc5..b57c3273b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -44,6 +44,20 @@ EXTRA_DIST= \
$(desktop_in_files) \
$(NULL)
+nautilus_connect_server_SOURCES= \
+ nautilus-connect-server-dialog.c \
+ nautilus-connect-server-dialog.h \
+ nautilus-connect-server-dialog-main.c \
+ nautilus-connect-server-dialog-main.h \
+ nautilus-location-entry.c \
+ nautilus-location-entry.h \
+ $(NULL)
+
+nautilus_connect_server_CFLAGS= \
+ -DNAUTILUS_CONNECT_SERVER_PROGRAM \
+ $(NULL)
+
+
CLEANFILES = $(desktop_DATA)
DISTCLEANFILES = \
diff --git a/src/.cvsignore b/src/.cvsignore
index 07375eb28..6260b3bc1 100644
--- a/src/.cvsignore
+++ b/src/.cvsignore
@@ -4,8 +4,7 @@ Makefile
Makefile.in
nautilus
nautilus-file-management-properties
-nautilus-server-connect
-nautilus-server-connect.desktop
+nautilus-connect-server
nautilus-shell-interface-common.c
nautilus-shell-interface-skels.c
nautilus-shell-interface-stubs.c
diff --git a/src/Makefile.am b/src/Makefile.am
index f96ba4ff2..723ae2236 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS=file-manager
bin_PROGRAMS= \
nautilus \
nautilus-file-management-properties \
+ nautilus-connect-server \
$(NULL)
INCLUDES = \
@@ -62,6 +63,7 @@ nautilus_SOURCES = \
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 \
@@ -126,6 +128,14 @@ nautilus_file_management_properties_SOURCES= \
nautilus-file-management-properties-main.c \
$(NULL)
+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_shell_interface_idl_sources): nautilus_shell_interface_idl_stamp
nautilus_shell_interface_idl_stamp: nautilus-shell-interface.idl $(ORBIT_IDL)
$(ORBIT_IDL) $(CORE_IDL_INCLUDES) -I$(top_srcdir) $<
diff --git a/src/nautilus-connect-server-dialog-main.c b/src/nautilus-connect-server-dialog-main.c
new file mode 100644
index 000000000..7e734cb87
--- /dev/null
+++ b/src/nautilus-connect-server-dialog-main.c
@@ -0,0 +1,120 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-connect-server-main.c - Start the "Connect to Server" dialog.
+ * Nautilus
+ *
+ * Copyright (C) 2005 Vincent Untz
+ *
+ * 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,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Vincent Untz <vincent@vuntz.net>
+ */
+
+#include <config.h>
+
+#include <glib/gi18n.h>
+
+#include <gtk/gtkmain.h>
+#include <gtk/gtkwidget.h>
+
+#include <libgnome/gnome-program.h>
+#include <libgnomeui/gnome-ui-init.h>
+#include <libgnomeui/gnome-url.h>
+
+#include <eel/eel-preferences.h>
+#include <eel/eel-stock-dialogs.h>
+
+#include "nautilus-window.h"
+#include "nautilus-connect-server-dialog.h"
+
+static int open_dialogs;
+
+static void
+dialog_destroyed (GtkWidget *widget,
+ gpointer user_data)
+{
+ if (--open_dialogs <= 0)
+ gtk_main_quit ();
+}
+
+static void
+show_uri (const char *uri,
+ GdkScreen *screen)
+{
+ GtkDialog *error_dialog;
+ GError *error;
+ char *error_message;
+
+ error = NULL;
+ gnome_url_show_on_screen (uri, screen, &error);
+
+ if (error) {
+ error_message = g_strdup_printf (_("Can't display location \"%s\""),
+ uri);
+
+ error_dialog = eel_show_error_dialog (error_message,
+ error->message,
+ _("Can't Display Location"),
+ NULL);
+
+ open_dialogs++;
+
+ g_signal_connect (error_dialog, "destroy",
+ G_CALLBACK (dialog_destroyed), NULL);
+
+ gtk_window_set_screen (GTK_WINDOW (error_dialog), screen);
+
+ g_error_free (error);
+ g_free (error_message);
+ }
+}
+
+void
+nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
+ const char *uri,
+ GtkWidget *widget)
+{
+ show_uri (uri, gtk_widget_get_screen (widget));
+}
+
+int
+main (int argc, char *argv[])
+{
+ GtkWidget *dialog;
+
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ gnome_program_init ("nautilus-connect-server", VERSION,
+ LIBGNOMEUI_MODULE, argc, argv,
+ NULL);
+
+ eel_preferences_init ("/apps/nautilus");
+
+ dialog = nautilus_connect_server_dialog_new (NULL);
+
+ open_dialogs = 1;
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (dialog_destroyed), NULL);
+
+ gtk_widget_show (dialog);
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/src/nautilus-connect-server-dialog-nonmain.c b/src/nautilus-connect-server-dialog-nonmain.c
new file mode 100644
index 000000000..0481afb95
--- /dev/null
+++ b/src/nautilus-connect-server-dialog-nonmain.c
@@ -0,0 +1,50 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 2005 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; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "nautilus-connect-server-dialog.h"
+#include <libnautilus-private/nautilus-global-preferences.h>
+
+/* This file contains the glue for the calls from the connect to server dialog
+ * to the main nautilus binary. A different version of this glue is in
+ * nautilus-connect-server-dialog-main.c for the standalone version.
+ */
+
+void
+nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
+ const char *uri,
+ GtkWidget *widget)
+{
+ NautilusWindow *window;
+
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
+ window = nautilus_application_create_navigation_window (application,
+ gtk_widget_get_screen (widget));
+ nautilus_window_go_to (window, uri);
+ } else {
+ nautilus_application_present_spatial_window (application,
+ NULL,
+ uri,
+ gtk_widget_get_screen (widget));
+ }
+}
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
index e859c6d44..6701e5635 100644
--- a/src/nautilus-connect-server-dialog.c
+++ b/src/nautilus-connect-server-dialog.c
@@ -29,7 +29,10 @@
#include <eel/eel-stock-dialogs.h>
#include <eel/eel-vfs-extensions.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomevfs/gnome-vfs-volume.h>
+#include <glib/gi18n.h>
#include <gtk/gtkhbox.h>
+#include <gtk/gtkvbox.h>
#include <gtk/gtktable.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkstock.h>
@@ -288,10 +291,9 @@ connect_to_server (NautilusConnectServerDialog *dialog)
if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
- nautilus_application_present_spatial_window (dialog->details->application,
- NULL,
- uri,
- gtk_widget_get_screen (GTK_WIDGET (dialog)));
+ nautilus_connect_server_dialog_present_uri (dialog->details->application,
+ uri,
+ GTK_WIDGET (dialog));
}
g_free (uri);
@@ -303,20 +305,11 @@ response_callback (NautilusConnectServerDialog *dialog,
int response_id,
gpointer data)
{
- NautilusWindow *window;
-
switch (response_id) {
case RESPONSE_BROWSE:
- if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
- window = nautilus_application_create_navigation_window (dialog->details->application,
- gtk_widget_get_screen (GTK_WIDGET (dialog)));
- nautilus_window_go_to (window, "network:///");
- } else {
- nautilus_application_present_spatial_window (dialog->details->application,
- NULL,
- "network:///",
- gtk_widget_get_screen (GTK_WIDGET (dialog)));
- }
+ nautilus_connect_server_dialog_present_uri (dialog->details->application,
+ "network:///",
+ GTK_WIDGET (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
break;
case RESPONSE_CONNECT:
@@ -724,9 +717,8 @@ nautilus_connect_server_dialog_new (NautilusWindow *window)
if (window) {
gtk_window_set_screen (GTK_WINDOW (dialog),
gtk_window_get_screen (GTK_WINDOW (window)));
+ NAUTILUS_CONNECT_SERVER_DIALOG (dialog)->details->application = window->application;
}
- NAUTILUS_CONNECT_SERVER_DIALOG (dialog)->details->application = window->application;
-
return dialog;
}
diff --git a/src/nautilus-connect-server-dialog.h b/src/nautilus-connect-server-dialog.h
index 0184855b6..c9bea7f41 100644
--- a/src/nautilus-connect-server-dialog.h
+++ b/src/nautilus-connect-server-dialog.h
@@ -48,4 +48,10 @@ struct _NautilusConnectServerDialogClass {
GType nautilus_connect_server_dialog_get_type (void);
GtkWidget* nautilus_connect_server_dialog_new (NautilusWindow *window);
+/* Private internal calls */
+
+void nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
+ const char *uri,
+ GtkWidget *widget);
+
#endif /* NAUTILUS_CONNECT_SERVER_DIALOG_H */