summaryrefslogtreecommitdiff
path: root/src/nautilus-shell.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-07-07 20:06:04 +0000
committerDarin Adler <darin@src.gnome.org>2000-07-07 20:06:04 +0000
commitc717f714b4c293e19ac06ae0a46ba2b1eb5b04d7 (patch)
tree1bc9975d4088ae340fecf2d39524a4b8c39788f0 /src/nautilus-shell.c
parentc2cfad09b8fc6227962e375a9b3a6d44f8d52216 (diff)
downloadnautilus-c717f714b4c293e19ac06ae0a46ba2b1eb5b04d7.tar.gz
Removed the obsolete Nautilus/ContentView and Nautilus/MetaView.
* components/hardware/nautilus-hardware-view.oafinfo: * components/help/help-contents.oafinfo: * components/help/help-index.oafinfo: * components/help/help-search.oafinfo: * components/history/nautilus-history-view.oafinfo: * components/html/ntl-web-browser.oafinfo: * components/loser/content/nautilus-content-loser.oafinfo: * components/loser/sidebar/nautilus-sidebar-loser.oafinfo: * components/mozilla/nautilus-mozilla-content-view.oafinfo: * components/music/nautilus-music-view.oafinfo: * components/notes/nautilus-notes.oafinfo: * components/rpmview/nautilus-rpm-view.oafinfo: * components/sample/nautilus-sample-content-view.oafinfo: * components/services/inventory/nautilus-view/nautilus-inventory-view.oafinfo: * components/services/login/nautilus-view/nautilus-login-view.oafinfo: * components/services/startup/nautilus-view/nautilus-service-startup-view.oafinfo: * components/services/summary/nautilus-view/nautilus-summary-view.oafinfo: * components/services/time/nautilus-view/trilobite-eazel-time-view.oafinfo: * components/services/trilobite/sample/nautilus-view/nautilus-sample-service-view.oafinfo: * components/shell/shell.oafinfo: * components/tree/nautilus-tree-view.oafinfo: * components/websearch/ntl-web-search.oafinfo: Removed the obsolete Nautilus/ContentView and Nautilus/MetaView. * components/services/install/command-line/.cvsignore: Added a generated file. * libnautilus-extensions/nautilus-directory-async.c: (metafile_read_done), (allow_metafile), (nautilus_directory_request_read_metafile): Another quick cut at leaving out metafiles for some schemes. (dequeue_pending_idle_callback): Get rid of "pending file info is NULL!" message and "approve" the change that made Maciej put it in. * libnautilus/nautilus-view.c: (nautilus_uri_list_from_g_list): Use CORBA_TRUE to truly use CORBA correctly. * src/nautilus-shell-interface.idl: * src/.cvsignore: * src/Makefile.am: * src/nautilus.oafinfo: * src/nautilus-shell.h: * src/nautilus-shell.c: (nautilus_shell_initialize_class), (nautilus_shell_get_epv), (nautilus_shell_get_vepv), (nautilus_shell_create_servant), (nautilus_shell_initialize), (destroy), (nautilus_shell_new), (display_caveat), (display_caveat_first_time), (open_window), (corba_open_windows), (corba_open_default_window), (corba_manage_desktop): Added a new CORBA file for the interface of the Nautilus shell itself and a class for a server side of it. Moved some code in here from NautilusApplication. * src/nautilus-application.c: (manufactures), (create_object), (create_factory), (nautilus_application_initialize), (nautilus_strv_length), (nautilus_make_uri_list_from_strv), (nautilus_application_startup): Moved the IID strings into constants for easier code reading. Added the code that can yield up the shell object, although it's not used yet. Changed startup code to use the NautilusShell object to do the work. This doesn't work cross-process yet, but it's ready to. * src/nautilus-window.h: * src/nautilus-window.c: (nautilus_window_initialize_class), (nautilus_window_initialize), (goto_uri_callback), (navigation_bar_mode_changed_callback), (nautilus_window_constructed), (nautilus_window_destroy), (nautilus_window_realize): Misc. cleanup, including getting rid of the strange old way of doing parent_class.
Diffstat (limited to 'src/nautilus-shell.c')
-rw-r--r--src/nautilus-shell.c271
1 files changed, 271 insertions, 0 deletions
diff --git a/src/nautilus-shell.c b/src/nautilus-shell.c
new file mode 100644
index 000000000..34308842c
--- /dev/null
+++ b/src/nautilus-shell.c
@@ -0,0 +1,271 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* Nautilus
+ *
+ * Copyright (C) 2000 Eazel, Inc.
+ *
+ * This library 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.
+ *
+ * This program 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* nautilus-shell.h: Server side of the Nautilus:Shell CORBA object
+ * that represents the shell across processes.
+ */
+
+#include <config.h>
+#include "nautilus-shell.h"
+
+/* FIXME: This is a workaround for ORBit bug where including idl files
+ * in other idl files causes trouble.
+ */
+#include "nautilus-shell-interface.h"
+#define nautilus_view_component_H
+
+#include "nautilus-desktop-window.h"
+#include <gtk/gtklabel.h>
+#include <gtk/gtkframe.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-stock.h>
+#include <libgnomeui/gnome-uidefs.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-stock-dialogs.h>
+
+struct NautilusShellDetails {
+ NautilusApplication *application;
+ NautilusDesktopWindow *desktop_window;
+ gboolean showed_caveat;
+};
+
+static void nautilus_shell_initialize (NautilusShell *shell);
+static void nautilus_shell_initialize_class (NautilusShellClass *klass);
+static void destroy (GtkObject *shell);
+static void corba_open_windows (PortableServer_Servant servant,
+ const Nautilus_URIList *list,
+ CORBA_Environment *ev);
+static void corba_open_default_window (PortableServer_Servant servant,
+ CORBA_Environment *ev);
+static void corba_manage_desktop (PortableServer_Servant servant,
+ CORBA_Environment *ev);
+
+NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusShell, nautilus_shell, BONOBO_OBJECT_TYPE)
+
+static void
+nautilus_shell_initialize_class (NautilusShellClass *klass)
+{
+ GTK_OBJECT_CLASS (klass)->destroy = destroy;
+}
+
+static POA_Nautilus_Shell__epv *
+nautilus_shell_get_epv (void)
+{
+ static POA_Nautilus_Shell__epv epv;
+ epv.open_windows = corba_open_windows;
+ epv.open_default_window = corba_open_default_window;
+ epv.manage_desktop = corba_manage_desktop;
+ return &epv;
+}
+
+static POA_Nautilus_Shell__vepv *
+nautilus_shell_get_vepv (void)
+{
+ static POA_Nautilus_Shell__vepv vepv;
+ vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
+ vepv.Nautilus_Shell_epv = nautilus_shell_get_epv ();
+ return &vepv;
+}
+
+static POA_Nautilus_Shell *
+nautilus_shell_create_servant (void)
+{
+ POA_Nautilus_Shell *servant;
+ CORBA_Environment ev;
+
+ servant = (POA_Nautilus_Shell *) g_new0 (BonoboObjectServant, 1);
+ servant->vepv = nautilus_shell_get_vepv ();
+ CORBA_exception_init (&ev);
+ POA_Nautilus_Shell__init ((PortableServer_Servant) servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION){
+ g_error ("can't initialize Nautilus shell");
+ }
+ CORBA_exception_free (&ev);
+
+ return servant;
+}
+
+static void
+nautilus_shell_initialize (NautilusShell *shell)
+{
+ Nautilus_Shell corba_shell;
+
+ shell->details = g_new0 (NautilusShellDetails, 1);
+
+ corba_shell = bonobo_object_activate_servant
+ (BONOBO_OBJECT (shell), nautilus_shell_create_servant ());
+ bonobo_object_construct (BONOBO_OBJECT (shell), corba_shell);
+}
+
+static void
+destroy (GtkObject *object)
+{
+ NautilusShell *shell;
+
+ shell = NAUTILUS_SHELL (object);
+ g_free (shell->details);
+
+ NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
+}
+
+NautilusShell *
+nautilus_shell_new (NautilusApplication *application)
+{
+ NautilusShell *shell;
+
+ shell = gtk_type_new (NAUTILUS_TYPE_SHELL);
+ shell->details->application = application;
+ return shell;
+}
+
+static void
+display_caveat (GtkWindow *parent_window)
+{
+ GtkWidget *dialog;
+ GtkWidget *frame;
+ GtkWidget *pixmap;
+ GtkWidget *hbox;
+ GtkWidget *text;
+ char *file_name;
+
+ dialog = gnome_dialog_new (_("Nautilus: caveat"),
+ GNOME_STOCK_BUTTON_OK,
+ NULL);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), GNOME_PAD);
+ gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, FALSE, FALSE);
+
+ hbox = gtk_hbox_new (FALSE, GNOME_PAD);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
+ hbox,
+ FALSE, FALSE, 0);
+
+ frame = gtk_frame_new (NULL);
+ gtk_widget_show (frame);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+ gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
+
+ file_name = nautilus_pixmap_file ("About_Image.png");
+ pixmap = gnome_pixmap_new_from_file (file_name);
+ g_free (file_name);
+ gtk_widget_show (pixmap);
+ gtk_container_add (GTK_CONTAINER (frame), pixmap);
+
+ text = gtk_label_new
+ (_("The Nautilus shell is under development; it's not "
+ "ready for daily use. Many features, including some "
+ "of the best ones, are not yet done, partly done, or "
+ "unstable. The program doesn't look or act the way "
+ "it will in version 1.0."
+ "\n\n"
+ "If you do decide to test this version of Nautilus, "
+ "beware. The program could do something "
+ "unpredictable and may even delete or overwrite "
+ "files on your computer."
+ "\n\n"
+ "For more information, visit http://nautilus.eazel.com."));
+ gtk_label_set_line_wrap (GTK_LABEL (text), TRUE);
+ gtk_widget_show (text);
+ gtk_box_pack_start (GTK_BOX (hbox), text, FALSE, FALSE, 0);
+
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent_window);
+
+ gtk_widget_show (GTK_WIDGET (dialog));
+}
+
+static void
+display_caveat_first_time (NautilusShell *shell, NautilusWindow *window)
+{
+ /* Show the "not ready for prime time" dialog after the first
+ * window appears, so it's on top.
+ */
+ /* FIXME bugzilla.eazel.com 1256: It's not on top of the
+ * windows other than the first one.
+ */
+ if (!shell->details->showed_caveat
+ && g_getenv ("NAUTILUS_NO_CAVEAT_DIALOG") == NULL) {
+ gtk_signal_connect (GTK_OBJECT (window), "show",
+ display_caveat, window);
+ }
+ shell->details->showed_caveat = TRUE;
+}
+
+static void
+open_window (NautilusShell *shell, const char *uri)
+{
+ NautilusWindow *window;
+
+ window = nautilus_application_create_window (shell->details->application);
+ if (uri == NULL) {
+ nautilus_window_go_home (window);
+ } else {
+ nautilus_window_goto_uri (window, uri);
+ }
+ display_caveat_first_time (shell, window);
+}
+
+static void
+corba_open_windows (PortableServer_Servant servant,
+ const Nautilus_URIList *list,
+ CORBA_Environment *ev)
+{
+ NautilusShell *shell;
+ int i;
+
+ shell = NAUTILUS_SHELL (((BonoboObjectServant *) servant)->bonobo_object);
+
+ /* Open windows at each requested location. */
+ for (i = 0; i < list->_length; i++) {
+ g_assert (list->_buffer[i] != NULL);
+ open_window (shell, list->_buffer[i]);
+ }
+}
+
+static void
+corba_open_default_window (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ NautilusShell *shell;
+
+ shell = NAUTILUS_SHELL (((BonoboObjectServant *) servant)->bonobo_object);
+
+ /* Open a window pointing at the default location. */
+ open_window (shell, NULL);
+}
+
+static void
+corba_manage_desktop (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ NautilusShell *shell;
+
+ shell = NAUTILUS_SHELL (((BonoboObjectServant *) servant)->bonobo_object);
+
+ /* Create a desktop window. */
+ if (shell->details->desktop_window == NULL) {
+ shell->details->desktop_window = nautilus_desktop_window_new (shell->details->application);
+ }
+ gtk_widget_show (GTK_WIDGET (shell->details->desktop_window));
+}