mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
Remove direct deps on bonobo, bonobo-activation, orbit2,
2008-10-01 Alexander Larsson <alexl@redhat.com> * configure.in: Remove direct deps on bonobo, bonobo-activation, orbit2, startup-notification Add dependency on libunique * src/Makefile.am: * src/nautilus-shell-interface.idl: * src/nautilus-shell.[ch]: Remove NautilusShell * src/nautilus-application.[ch]: Make NautilusApplication a normal GObject Remove NautilusShell use. Implement unique application functionallity using libunique Remove manual startup notification handling (mostly handled by libunique) * src/nautilus-main.c: Remove bonobo initialization Remove manual startup notification handling Move command line arg to uri parsing here Remove weird idle handling now that we don't use bonobo anymore * libnautilus-private/nautilus-undo-manager.c: * libnautilus-private/nautilus-undo-manager.h: * libnautilus-private/nautilus-undo.c: * src/nautilus-window-private.h: Remove all leftover spurious use of bonobo * src/nautilus-window-slot.h: * src/nautilus-desktop-window.c: * src/nautilus-location-dialog.c: * src/nautilus-window-bookmarks.c: Add required includes of gi18n.h svn path=/trunk/; revision=14677
This commit is contained in:
parent
c95d75310d
commit
0755d50a8c
35
ChangeLog
35
ChangeLog
|
@ -1,3 +1,38 @@
|
|||
2008-10-01 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* configure.in:
|
||||
Remove direct deps on bonobo, bonobo-activation, orbit2, startup-notification
|
||||
Add dependency on libunique
|
||||
|
||||
* src/Makefile.am:
|
||||
* src/nautilus-shell-interface.idl:
|
||||
* src/nautilus-shell.[ch]:
|
||||
Remove NautilusShell
|
||||
|
||||
* src/nautilus-application.[ch]:
|
||||
Make NautilusApplication a normal GObject
|
||||
Remove NautilusShell use.
|
||||
Implement unique application functionallity using libunique
|
||||
Remove manual startup notification handling (mostly handled by libunique)
|
||||
|
||||
* src/nautilus-main.c:
|
||||
Remove bonobo initialization
|
||||
Remove manual startup notification handling
|
||||
Move command line arg to uri parsing here
|
||||
Remove weird idle handling now that we don't use bonobo anymore
|
||||
|
||||
* libnautilus-private/nautilus-undo-manager.c:
|
||||
* libnautilus-private/nautilus-undo-manager.h:
|
||||
* libnautilus-private/nautilus-undo.c:
|
||||
* src/nautilus-window-private.h:
|
||||
Remove all leftover spurious use of bonobo
|
||||
|
||||
* src/nautilus-window-slot.h:
|
||||
* src/nautilus-desktop-window.c:
|
||||
* src/nautilus-location-dialog.c:
|
||||
* src/nautilus-window-bookmarks.c:
|
||||
Add required includes of gi18n.h
|
||||
|
||||
2008-10-01 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* configure.in:
|
||||
|
|
42
configure.in
42
configure.in
|
@ -2,19 +2,15 @@ AC_PREREQ(2.54)
|
|||
|
||||
dnl ===========================================================================
|
||||
|
||||
m4_define(bonobo_activation_minver, 2.1.0)
|
||||
m4_define(bonobo_minver, 2.1.0)
|
||||
m4_define(eel_minver, 2.24.0)
|
||||
m4_define(glib_minver, 2.17.5)
|
||||
m4_define(gnome_desktop_minver, 2.9.91)
|
||||
m4_define(gnome_minver, 2.14.0)
|
||||
m4_define(gnome_ui_minver, 2.6.0)
|
||||
m4_define(orbit_minver, 2.4.0)
|
||||
m4_define(pango_minver, 1.1.2)
|
||||
m4_define(gtk_minver, 2.13.0)
|
||||
m4_define(rsvg_minver, 2.0.1)
|
||||
m4_define(xml_minver, 2.4.7)
|
||||
m4_define(startup_notification_minver, 0.8)
|
||||
m4_define(exif_minver, 0.5.12)
|
||||
m4_define(beagle_minver, 0.2.4)
|
||||
m4_define(tracker_minver, 0.0.1)
|
||||
|
@ -39,19 +35,15 @@ AM_INIT_AUTOMAKE([1.9 tar-ustar])
|
|||
AM_MAINTAINER_MODE
|
||||
AC_SUBST([ACLOCAL_AMFLAGS], ["\${ACLOCAL_FLAGS}"])
|
||||
|
||||
AC_SUBST(BONOBO_ACTIVATION_REQUIRED, [bonobo_activation_minver])
|
||||
AC_SUBST(BONOBO_REQUIRED, [bonobo_minver])
|
||||
AC_SUBST(EEL_REQUIRED, [eel_minver])
|
||||
AC_SUBST(GLIB_REQUIRED, [glib_minver])
|
||||
AC_SUBST(GNOME_DESKTOP_REQUIRED, [gnome_desktop_minver])
|
||||
AC_SUBST(GNOME_REQUIRED, [gnome_minver])
|
||||
AC_SUBST(GNOME_UI_REQUIRED, [gnome_ui_minver])
|
||||
AC_SUBST(ORBIT_REQUIRED, [orbit_minver])
|
||||
AC_SUBST(PANGO_REQUIRED, [pango_minver])
|
||||
AC_SUBST(GTK_REQUIRED, [gtk_minver])
|
||||
AC_SUBST(RSVG_REQUIRED, [rsvg_minver])
|
||||
AC_SUBST(XML_REQUIRED, [xml_minver])
|
||||
AC_SUBST(STARTUP_NOTIFICATION_REQUIRED, [startup_notification_minver])
|
||||
|
||||
dnl We need to decrement current by one in the calculation of the age because
|
||||
dnl the library was started with version "1:0:0" instead of "0:0:0"
|
||||
|
@ -69,37 +61,19 @@ AC_LIBTOOL_WIN32_DLL
|
|||
AM_PROG_LIBTOOL
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
|
||||
if $PKG_CONFIG --atleast-version startup_notification_minver libstartup-notification-1.0; then
|
||||
echo "Building with libstartup-notification"
|
||||
AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1,
|
||||
[define to enable startup notification support])
|
||||
with_startup_notification=yes
|
||||
STARTUP_NOTIFICATION_PACKAGE=libstartup-notification-1.0
|
||||
EXTRA_CORE_MODULES="$EXTRA_CORE_MODULES libstartup-notification-1.0"
|
||||
else
|
||||
echo "***** WARNING: Building without libstartup-notification"
|
||||
with_startup_notification=no
|
||||
STARTUP_NOTIFICATION_PACKAGE=
|
||||
fi
|
||||
|
||||
AC_SUBST(STARTUP_NOTIFICATION_PACKAGE)
|
||||
|
||||
PKG_CHECK_MODULES(ALL, [
|
||||
bonobo-activation-2.0 >= bonobo_activation_minver
|
||||
eel-2.0 >= eel_minver
|
||||
glib-2.0 >= glib_minver
|
||||
gnome-desktop-2.0 >= gnome_desktop_minver
|
||||
gio-unix-2.0
|
||||
gio-2.0
|
||||
ORBit-2.0 >= orbit_minver
|
||||
pango >= pango_minver
|
||||
gtk+-2.0 >= gtk_minver
|
||||
libbonobo-2.0 >= bonobo_minver
|
||||
libgnome-2.0 >= gnome_minver
|
||||
libgnomeui-2.0 >= gnome_ui_minver
|
||||
librsvg-2.0 >= rsvg_minver
|
||||
libxml-2.0 >= xml_minver
|
||||
$STARTUP_NOTIFICATION_PACKAGE
|
||||
unique-1.0
|
||||
])
|
||||
dnl ==========================================================================
|
||||
|
||||
|
@ -142,11 +116,6 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
|
|||
|
||||
dnl ==========================================================================
|
||||
|
||||
ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
|
||||
AC_SUBST(ORBIT_IDL)
|
||||
|
||||
dnl ==========================================================================
|
||||
|
||||
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/param.h)
|
||||
|
||||
dnl ==========================================================================
|
||||
|
@ -412,14 +381,12 @@ AC_SUBST(LIBNAUTILUS_EXTENSION_CFLAGS)
|
|||
LIBNAUTILUS_EXTENSION_LIBS="`$PKG_CONFIG --libs $LIBNAUTILUS_EXTENSION_MODULES`"
|
||||
AC_SUBST(LIBNAUTILUS_EXTENSION_LIBS)
|
||||
|
||||
dnl core nautilus (must list bonobo-activation and libbonobo because idldir does not respect "requires")
|
||||
CORE_MODULES="glib-2.0 eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 gnome-desktop-2.0 gio-2.0 gio-unix-2.0 $EXTRA_CORE_MODULES"
|
||||
dnl core nautilus
|
||||
CORE_MODULES="glib-2.0 eel-2.0 librsvg-2.0 gnome-desktop-2.0 gio-2.0 gio-unix-2.0 unique-1.0 $EXTRA_CORE_MODULES"
|
||||
CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES` $x_cflags $WARNING_CFLAGS"
|
||||
AC_SUBST(CORE_CFLAGS)
|
||||
CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES` $x_libs"
|
||||
AC_SUBST(CORE_LIBS)
|
||||
CORE_IDL_INCLUDES="`$PKG_CONFIG --variable=idldir $CORE_MODULES | $srcdir/add-include-prefix`"
|
||||
AC_SUBST(CORE_IDL_INCLUDES)
|
||||
|
||||
DISABLE_DEPRECATED_CFLAGS="-DG_DISABLE_DEPRECATED"
|
||||
|
||||
|
@ -433,9 +400,6 @@ dnl -DGDK_PIXBUF_DISABLE_DEPRECATED \
|
|||
dnl -DGTK_DISABLE_DEPRECATED \
|
||||
dnl -DGNOME_DISABLE_DEPRECATED"
|
||||
|
||||
dnl FIXME: put this back once the registration_id stuff is cleared up.
|
||||
dnl -DBONOBO_DISABLE_DEPRECATED
|
||||
|
||||
AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
dnl libbackground
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-gtk-extensions.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <bonobo/bonobo-main.h>
|
||||
#include "nautilus-undo-private.h"
|
||||
|
||||
struct NautilusUndoManagerDetails {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#ifndef NAUTILUS_UNDO_MANAGER_H
|
||||
#define NAUTILUS_UNDO_MANAGER_H
|
||||
|
||||
#include <bonobo/bonobo-object.h>
|
||||
#include <libnautilus-private/nautilus-undo.h>
|
||||
|
||||
#define NAUTILUS_TYPE_UNDO_MANAGER \
|
||||
|
|
|
@ -141,7 +141,7 @@ nautilus_undo_get_undo_manager (GObject *start_object)
|
|||
GtkWindow *transient_parent;
|
||||
|
||||
if (start_object == NULL) {
|
||||
return CORBA_OBJECT_NIL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (G_IS_OBJECT (start_object), NULL);
|
||||
|
|
|
@ -45,14 +45,7 @@ desktopdir = $(datadir)/gnome/network/
|
|||
schemedir = $(datadir)/applications
|
||||
scheme_DATA = network-scheme.desktop
|
||||
|
||||
nautilus_shell_interface_idl_sources = \
|
||||
nautilus-shell-interface-stubs.c \
|
||||
nautilus-shell-interface-skels.c \
|
||||
nautilus-shell-interface.h \
|
||||
nautilus-shell-interface-common.c
|
||||
|
||||
nautilus_SOURCES = \
|
||||
$(nautilus_shell_interface_idl_sources) \
|
||||
ephy-spinner.h \
|
||||
ephy-spinner.c \
|
||||
nautilus-actions.h \
|
||||
|
@ -110,8 +103,6 @@ nautilus_SOURCES = \
|
|||
nautilus-search-bar.h \
|
||||
nautilus-self-check-functions.c \
|
||||
nautilus-self-check-functions.h \
|
||||
nautilus-shell.c \
|
||||
nautilus-shell.h \
|
||||
nautilus-side-pane.c \
|
||||
nautilus-side-pane.h \
|
||||
nautilus-sidebar-title.c \
|
||||
|
@ -159,19 +150,8 @@ nautilus_connect_server_SOURCES= \
|
|||
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) $<
|
||||
touch $@
|
||||
|
||||
$(nautilus_OBJECTS): nautilus_shell_interface_idl_stamp
|
||||
|
||||
TESTS=check-nautilus
|
||||
|
||||
serverdir = $(libdir)/bonobo/servers
|
||||
server_in_files = Nautilus_shell.server.in
|
||||
server_DATA = $(server_in_files:.server.in=.server)
|
||||
|
||||
@INTLTOOL_SERVER_RULE@
|
||||
|
||||
uidir = $(datadir)/nautilus/ui
|
||||
|
@ -188,8 +168,6 @@ glade_DATA = \
|
|||
$(NULL)
|
||||
|
||||
CLEANFILES = \
|
||||
$(nautilus_shell_interface_idl_sources) \
|
||||
nautilus_shell_interface_idl_stamp \
|
||||
$(desktop_files) \
|
||||
$(server_DATA) \
|
||||
$(NULL)
|
||||
|
@ -199,12 +177,10 @@ EXTRA_DIST = \
|
|||
$(glade_DATA) \
|
||||
$(ui_DATA) \
|
||||
check-nautilus \
|
||||
nautilus-shell-interface.idl \
|
||||
$(desktop_in_files) \
|
||||
$(NULL)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
$(nautilus_shell_interface_idl_sources) \
|
||||
$(NULL)
|
||||
|
||||
dist-hook:
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <config.h>
|
||||
#include "nautilus-application.h"
|
||||
|
||||
|
||||
#include "file-manager/fm-desktop-icon-view.h"
|
||||
#include "file-manager/fm-icon-view.h"
|
||||
#include "file-manager/fm-list-view.h"
|
||||
|
@ -52,8 +51,6 @@
|
|||
#include "nautilus-navigation-window.h"
|
||||
#include "nautilus-window-slot.h"
|
||||
#include "nautilus-navigation-window-slot.h"
|
||||
#include "nautilus-shell-interface.h"
|
||||
#include "nautilus-shell.h"
|
||||
#include "nautilus-window-bookmarks.h"
|
||||
#include "libnautilus-private/nautilus-file-operations.h"
|
||||
#include "nautilus-window-private.h"
|
||||
|
@ -62,8 +59,6 @@
|
|||
#include <glib/gstdio.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gio/gio.h>
|
||||
#include <bonobo/bonobo-main.h>
|
||||
#include <bonobo/bonobo-object.h>
|
||||
#include <eel/eel-gtk-extensions.h>
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-stock-dialogs.h>
|
||||
|
@ -81,22 +76,28 @@
|
|||
#include <libnautilus-private/nautilus-directory-private.h>
|
||||
#include <libnautilus-private/nautilus-signaller.h>
|
||||
#include <libnautilus-extension/nautilus-menu-provider.h>
|
||||
#include <bonobo-activation/bonobo-activation.h>
|
||||
#include <libnautilus-private/nautilus-autorun.h>
|
||||
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
#define SN_API_NOT_YET_FROZEN Yes_i_know_DO_IT
|
||||
#include <libsn/sn-launchee.h>
|
||||
#endif
|
||||
enum
|
||||
{
|
||||
COMMAND_0, /* unused: 0 is an invalid command */
|
||||
|
||||
COMMAND_RESTART,
|
||||
COMMAND_START_DESKTOP,
|
||||
COMMAND_STOP_DESKTOP,
|
||||
COMMAND_OPEN_BROWSER,
|
||||
COMMAND_LOAD_SESSION
|
||||
};
|
||||
|
||||
/* Needed for the is_kdesktop_present check */
|
||||
#include <gdk/gdkx.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#define FACTORY_IID "OAFIID:Nautilus_Factory"
|
||||
#define SEARCH_LIST_VIEW_IID "OAFIID:Nautilus_File_Manager_Search_List_View"
|
||||
#define SHELL_IID "OAFIID:Nautilus_Shell"
|
||||
#define TREE_VIEW_IID "OAFIID:Nautilus_File_Manager_Tree_View"
|
||||
/* Keep window from shrinking down ridiculously small; numbers are somewhat arbitrary */
|
||||
#define APPLICATION_WINDOW_MIN_WIDTH 300
|
||||
#define APPLICATION_WINDOW_MIN_HEIGHT 100
|
||||
|
||||
#define START_STATE_CONFIG "start-state"
|
||||
|
||||
/* Keeps track of all the desktop windows. */
|
||||
static GList *nautilus_application_desktop_windows;
|
||||
|
@ -127,27 +128,94 @@ static void update_session (gpointer cal
|
|||
static void init_session (void);
|
||||
static gboolean is_kdesktop_present (void);
|
||||
|
||||
BONOBO_CLASS_BOILERPLATE (NautilusApplication, nautilus_application,
|
||||
BonoboGenericFactory, BONOBO_TYPE_GENERIC_FACTORY)
|
||||
G_DEFINE_TYPE (NautilusApplication, nautilus_application, G_TYPE_OBJECT);
|
||||
|
||||
static CORBA_Object
|
||||
create_object (PortableServer_Servant servant,
|
||||
const CORBA_char *iid,
|
||||
CORBA_Environment *ev)
|
||||
static gboolean
|
||||
_unique_message_data_set_geometry_and_uris (UniqueMessageData *message_data,
|
||||
const char *geometry,
|
||||
char **uris)
|
||||
{
|
||||
BonoboObject *object;
|
||||
NautilusApplication *application;
|
||||
GString *list;
|
||||
gint i;
|
||||
gchar *result;
|
||||
gsize length;
|
||||
|
||||
if (strcmp (iid, SHELL_IID) == 0) {
|
||||
application = NAUTILUS_APPLICATION (bonobo_object_from_servant (servant));
|
||||
object = BONOBO_OBJECT (nautilus_shell_new (application));
|
||||
} else {
|
||||
object = CORBA_OBJECT_NIL;
|
||||
}
|
||||
list = g_string_new (NULL);
|
||||
if (geometry != NULL) {
|
||||
g_string_append (list, geometry);
|
||||
}
|
||||
g_string_append (list, "\r\n");
|
||||
|
||||
for (i = 0; uris != NULL && uris[i]; i++) {
|
||||
g_string_append (list, uris[i]);
|
||||
g_string_append (list, "\r\n");
|
||||
}
|
||||
|
||||
return CORBA_Object_duplicate (BONOBO_OBJREF (object), ev);
|
||||
result = g_convert (list->str, list->len,
|
||||
"ASCII", "UTF-8",
|
||||
NULL, &length, NULL);
|
||||
g_string_free (list, TRUE);
|
||||
|
||||
if (result) {
|
||||
unique_message_data_set (message_data, (guchar *) result, length);
|
||||
g_free (result);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gchar **
|
||||
_unique_message_data_get_geometry_and_uris (UniqueMessageData *message_data,
|
||||
char **geometry)
|
||||
{
|
||||
gchar **result = NULL;
|
||||
|
||||
*geometry = NULL;
|
||||
|
||||
gchar *text, *newline, *uris;
|
||||
text = unique_message_data_get_text (message_data);
|
||||
if (text) {
|
||||
newline = strchr (text, '\n');
|
||||
if (newline) {
|
||||
*geometry = g_strndup (text, newline-text);
|
||||
uris = newline+1;
|
||||
} else {
|
||||
uris = text;
|
||||
}
|
||||
|
||||
result = g_uri_list_extract_uris (uris);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This is a hack, because there is no unique_message_data_get()... */
|
||||
|
||||
typedef struct {
|
||||
guchar *data;
|
||||
gint length;
|
||||
|
||||
/* etc... */
|
||||
} UniqueMessageDataInternal;
|
||||
|
||||
static char *
|
||||
_unique_message_data_get_filename (UniqueMessageData *message_data)
|
||||
{
|
||||
UniqueMessageDataInternal *internal;
|
||||
internal = (UniqueMessageDataInternal *)message_data;
|
||||
return g_strndup (internal->data, internal->length);
|
||||
}
|
||||
|
||||
static void
|
||||
_unique_message_data_set_filename (UniqueMessageData *message_data,
|
||||
const char *filename)
|
||||
{
|
||||
unique_message_data_set (message_data, filename, strlen (filename));
|
||||
}
|
||||
|
||||
|
||||
GList *
|
||||
nautilus_application_get_window_list (void)
|
||||
{
|
||||
|
@ -208,12 +276,18 @@ automount_all_volumes (NautilusApplication *application)
|
|||
}
|
||||
|
||||
static void
|
||||
nautilus_application_instance_init (NautilusApplication *application)
|
||||
nautilus_application_init (NautilusApplication *application)
|
||||
{
|
||||
/* Create an undo manager */
|
||||
application->undo_manager = nautilus_undo_manager_new ();
|
||||
|
||||
application->shell = nautilus_shell_new (application);
|
||||
application->unique_app = unique_app_new_with_commands ("org.gnome.Nautilus", NULL,
|
||||
"restart", COMMAND_RESTART,
|
||||
"start_desktop", COMMAND_START_DESKTOP,
|
||||
"stop_desktop", COMMAND_STOP_DESKTOP,
|
||||
"open_browser", COMMAND_OPEN_BROWSER,
|
||||
"load_session", COMMAND_LOAD_SESSION,
|
||||
NULL);
|
||||
|
||||
/* register views */
|
||||
fm_icon_view_register ();
|
||||
|
@ -239,19 +313,11 @@ nautilus_application_instance_init (NautilusApplication *application)
|
|||
NautilusApplication *
|
||||
nautilus_application_new (void)
|
||||
{
|
||||
NautilusApplication *application;
|
||||
|
||||
application = g_object_new (NAUTILUS_TYPE_APPLICATION, NULL);
|
||||
|
||||
bonobo_generic_factory_construct_noreg (BONOBO_GENERIC_FACTORY (application),
|
||||
FACTORY_IID,
|
||||
NULL);
|
||||
|
||||
return application;
|
||||
return g_object_new (NAUTILUS_TYPE_APPLICATION, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_application_destroy (BonoboObject *object)
|
||||
nautilus_application_finalize (GObject *object)
|
||||
{
|
||||
NautilusApplication *application;
|
||||
|
||||
|
@ -265,18 +331,15 @@ nautilus_application_destroy (BonoboObject *object)
|
|||
g_object_unref (application->volume_monitor);
|
||||
application->volume_monitor = NULL;
|
||||
}
|
||||
|
||||
if (application->shell_registered) {
|
||||
bonobo_activation_unregister_active_server (SHELL_IID, BONOBO_OBJREF (application->shell));
|
||||
}
|
||||
bonobo_object_unref (application->shell);
|
||||
|
||||
g_object_unref (application->unique_app);
|
||||
|
||||
if (application->automount_idle_id != 0) {
|
||||
g_source_remove (application->automount_idle_id);
|
||||
application->automount_idle_id = 0;
|
||||
}
|
||||
|
||||
EEL_CALL_PARENT (BONOBO_OBJECT_CLASS, destroy, (object));
|
||||
G_OBJECT_CLASS (nautilus_application_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -348,33 +411,6 @@ check_required_directories (NautilusApplication *application)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static Nautilus_URIList *
|
||||
nautilus_make_uri_list_from_shell_strv (const char * const *strv)
|
||||
{
|
||||
int length, i;
|
||||
Nautilus_URIList *uri_list;
|
||||
GFile *file;
|
||||
char *translated_uri;
|
||||
|
||||
length = g_strv_length ((char **) strv);
|
||||
|
||||
uri_list = Nautilus_URIList__alloc ();
|
||||
uri_list->_maximum = length;
|
||||
uri_list->_length = length;
|
||||
uri_list->_buffer = CORBA_sequence_Nautilus_URI_allocbuf (length);
|
||||
for (i = 0; i < length; i++) {
|
||||
file = g_file_new_for_commandline_arg (strv[i]);
|
||||
translated_uri = g_file_get_uri (file);
|
||||
g_object_unref (file);
|
||||
uri_list->_buffer[i] = CORBA_string_dup (translated_uri);
|
||||
g_free (translated_uri);
|
||||
translated_uri = NULL;
|
||||
}
|
||||
CORBA_sequence_set_release (uri_list, CORBA_TRUE);
|
||||
|
||||
return uri_list;
|
||||
}
|
||||
|
||||
static void
|
||||
menu_provider_items_updated_handler (NautilusMenuProvider *provider, GtkWidget* parent_window, gpointer data)
|
||||
{
|
||||
|
@ -514,21 +550,134 @@ initialize_kde_trash_hack (void)
|
|||
g_free (desktop_dir);
|
||||
}
|
||||
|
||||
|
||||
static Bonobo_RegistrationResult
|
||||
nautilus_bonobo_activation_register_for_display (const char *iid,
|
||||
Bonobo_Unknown ref)
|
||||
static void
|
||||
open_window (NautilusApplication *application,
|
||||
const char *startup_id,
|
||||
const char *uri, const char *geometry, gboolean browser_window)
|
||||
{
|
||||
const char *display_name;
|
||||
GSList *reg_env ;
|
||||
Bonobo_RegistrationResult result;
|
||||
GFile *location;
|
||||
NautilusWindow *window;
|
||||
|
||||
if (browser_window ||
|
||||
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
|
||||
window = nautilus_application_create_navigation_window (application,
|
||||
startup_id,
|
||||
gdk_screen_get_default ());
|
||||
if (uri == NULL) {
|
||||
nautilus_window_go_home (window);
|
||||
} else {
|
||||
location = g_file_new_for_uri (uri);
|
||||
nautilus_window_go_to (window, location);
|
||||
g_object_unref (location);
|
||||
}
|
||||
} else {
|
||||
if (uri == NULL) {
|
||||
location = g_file_new_for_path (g_get_home_dir ());
|
||||
} else {
|
||||
location = g_file_new_for_uri (uri);
|
||||
}
|
||||
|
||||
window = nautilus_application_present_spatial_window (application,
|
||||
NULL,
|
||||
startup_id,
|
||||
location,
|
||||
gdk_screen_get_default ());
|
||||
g_object_unref (location);
|
||||
}
|
||||
|
||||
display_name = gdk_display_get_name (gdk_display_get_default());
|
||||
reg_env = bonobo_activation_registration_env_set (NULL,
|
||||
"DISPLAY", display_name);
|
||||
result = bonobo_activation_register_active_server (iid, ref, reg_env);
|
||||
bonobo_activation_registration_env_free (reg_env);
|
||||
return result;
|
||||
if (geometry != NULL && !GTK_WIDGET_VISIBLE (window)) {
|
||||
/* never maximize windows opened from shell if a
|
||||
* custom geometry has been requested.
|
||||
*/
|
||||
gtk_window_unmaximize (GTK_WINDOW (window));
|
||||
eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window),
|
||||
geometry,
|
||||
APPLICATION_WINDOW_MIN_WIDTH,
|
||||
APPLICATION_WINDOW_MIN_HEIGHT,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
open_windows (NautilusApplication *application,
|
||||
const char *startup_id,
|
||||
char **uris,
|
||||
const char *geometry,
|
||||
gboolean browser_window)
|
||||
{
|
||||
guint i;
|
||||
|
||||
if (uris == NULL || uris[0] == NULL) {
|
||||
/* Open a window pointing at the default location. */
|
||||
open_window (application, startup_id, NULL, geometry, browser_window);
|
||||
} else {
|
||||
/* Open windows at each requested location. */
|
||||
for (i = 0; uris[i] != NULL; i++) {
|
||||
open_window (application, startup_id, uris[i], geometry, browser_window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static UniqueResponse
|
||||
message_received_cb (UniqueApp *unique_app,
|
||||
UniqueCommand command,
|
||||
UniqueMessageData *message,
|
||||
guint time_,
|
||||
gpointer user_data)
|
||||
{
|
||||
NautilusApplication *application;
|
||||
UniqueResponse res;
|
||||
char *filename;
|
||||
char **uris;
|
||||
char *geometry;
|
||||
|
||||
application = user_data;
|
||||
res = UNIQUE_RESPONSE_OK;
|
||||
|
||||
switch (command) {
|
||||
case UNIQUE_CLOSE:
|
||||
res = UNIQUE_RESPONSE_OK;
|
||||
nautilus_main_event_loop_quit (TRUE);
|
||||
|
||||
break;
|
||||
case COMMAND_RESTART:
|
||||
filename = nautilus_application_save_session_to_file ();
|
||||
if (filename != NULL) {
|
||||
nautilus_main_event_loop_quit (TRUE);
|
||||
g_setenv ("_NAUTILUS_RESTART_SESSION_FILENAME", filename, 1);
|
||||
g_free (filename);
|
||||
} else {
|
||||
g_message ("Could not save session. Not restarting.");
|
||||
}
|
||||
break;
|
||||
case UNIQUE_OPEN:
|
||||
case COMMAND_OPEN_BROWSER:
|
||||
uris = _unique_message_data_get_geometry_and_uris (message, &geometry);
|
||||
open_windows (application,
|
||||
unique_message_data_get_startup_id (message),
|
||||
uris,
|
||||
geometry,
|
||||
command == COMMAND_OPEN_BROWSER);
|
||||
g_strfreev (uris);
|
||||
g_free (geometry);
|
||||
break;
|
||||
case COMMAND_START_DESKTOP:
|
||||
nautilus_application_open_desktop (application);
|
||||
break;
|
||||
case COMMAND_STOP_DESKTOP:
|
||||
nautilus_application_close_desktop ();
|
||||
break;
|
||||
case COMMAND_LOAD_SESSION:
|
||||
filename = _unique_message_data_get_filename (message);
|
||||
nautilus_application_load_session (application, filename);
|
||||
g_free (filename);
|
||||
break;
|
||||
default:
|
||||
res = UNIQUE_RESPONSE_PASSTHROUGH;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -538,23 +687,12 @@ nautilus_application_startup (NautilusApplication *application,
|
|||
gboolean no_default_window,
|
||||
gboolean no_desktop,
|
||||
gboolean browser_window,
|
||||
const char *startup_id,
|
||||
const char *geometry,
|
||||
const char *session_to_load,
|
||||
const char *urls[])
|
||||
char **urls)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Shell shell;
|
||||
Bonobo_RegistrationResult result;
|
||||
const char *message, *detailed_message;
|
||||
GtkDialog *dialog;
|
||||
Nautilus_URIList *url_list;
|
||||
const CORBA_char *corba_startup_id;
|
||||
const CORBA_char *corba_geometry;
|
||||
int num_failures;
|
||||
|
||||
num_failures = 0;
|
||||
|
||||
UniqueMessageData *message;
|
||||
|
||||
/* Check the user's ~/.nautilus directories and post warnings
|
||||
* if there are problems.
|
||||
*/
|
||||
|
@ -564,120 +702,18 @@ nautilus_application_startup (NautilusApplication *application,
|
|||
|
||||
initialize_kde_trash_hack ();
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
/* Start up the factory. */
|
||||
while (TRUE) {
|
||||
/* Try to register the file manager view factory. */
|
||||
result = nautilus_bonobo_activation_register_for_display
|
||||
(SHELL_IID, BONOBO_OBJREF (application->shell));
|
||||
|
||||
switch (result) {
|
||||
case Bonobo_ACTIVATION_REG_SUCCESS:
|
||||
/* We are registered and all is right with the world. */
|
||||
application->shell_registered = TRUE;
|
||||
finish_startup (application);
|
||||
message = NULL;
|
||||
detailed_message = NULL;
|
||||
break;
|
||||
case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
|
||||
/* Another copy of nautilus already is running and registered. */
|
||||
message = NULL;
|
||||
detailed_message = NULL;
|
||||
break;
|
||||
case Bonobo_ACTIVATION_REG_NOT_LISTED:
|
||||
/* Can't register myself due to trouble locating the
|
||||
* Nautilus_Shell.server file. This has happened when you
|
||||
* launch Nautilus with an LD_LIBRARY_PATH that
|
||||
* doesn't include the directory containing the oaf
|
||||
* library. It could also happen if the
|
||||
* Nautilus_Shell.server file was not present for some
|
||||
* reason. Sometimes killing oafd and gconfd fixes
|
||||
* this problem but we don't exactly understand why,
|
||||
* since neither of the above causes explain it.
|
||||
*/
|
||||
message = _("Nautilus cannot be used now. "
|
||||
"Running the command \"bonobo-slay\""
|
||||
" from the console may fix the problem. If not,"
|
||||
" you can try rebooting the computer or"
|
||||
" installing Nautilus again.");
|
||||
/* FIXME bugzilla.gnome.org 42536: The guesses and stuff here are lame. */
|
||||
detailed_message = _("Nautilus cannot be used now. "
|
||||
"Running the command \"bonobo-slay\" "
|
||||
"from the console may fix the problem. If not, "
|
||||
"you can try rebooting the computer or "
|
||||
"installing Nautilus again.\n\n"
|
||||
"Bonobo could not locate the Nautilus_shell.server file. "
|
||||
"One cause of this seems to be an LD_LIBRARY_PATH "
|
||||
"that does not include the bonobo-activation library's directory. "
|
||||
"Another possible cause would be bad install "
|
||||
"with a missing Nautilus_Shell.server file.\n\n"
|
||||
"Running \"bonobo-slay\" will kill all "
|
||||
"Bonobo Activation and GConf processes, which may be needed by "
|
||||
"other applications.\n\n"
|
||||
"Sometimes killing bonobo-activation-server and gconfd fixes "
|
||||
"the problem, but we do not know why.\n\n"
|
||||
"We have also seen this error when a faulty "
|
||||
"version of bonobo-activation was installed.");
|
||||
break;
|
||||
default:
|
||||
/* This should never happen. */
|
||||
g_warning ("bad error code from bonobo_activation_active_server_register");
|
||||
case Bonobo_ACTIVATION_REG_ERROR:
|
||||
/* Some misc. error (can never happen with current
|
||||
* version of bonobo-activation). Show dialog and terminate the
|
||||
* program.
|
||||
*/
|
||||
/* FIXME bugzilla.gnome.org 42537: Looks like this does happen with the
|
||||
* current OAF. I guess I read the code wrong. Need to figure out when and make a
|
||||
* good message.
|
||||
*/
|
||||
message = _("Nautilus cannot be used now, due to an unexpected error.");
|
||||
detailed_message = _("Nautilus cannot be used now, due to an unexpected error "
|
||||
"from Bonobo when attempting to register the file manager view server.");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get the shell object. */
|
||||
if (message == NULL) {
|
||||
shell = bonobo_activation_activate_from_id (SHELL_IID, Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, NULL);
|
||||
if (!CORBA_Object_is_nil (shell, &ev)) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we couldn't find ourselves it's a bad problem so
|
||||
* we better stop looping.
|
||||
*/
|
||||
if (result == Bonobo_ACTIVATION_REG_SUCCESS) {
|
||||
/* FIXME bugzilla.gnome.org 42538: When can this happen? */
|
||||
message = _("Nautilus cannot be used now, due to an unexpected error.");
|
||||
detailed_message = _("Nautilus cannot be used now, due to an unexpected error "
|
||||
"from Bonobo when attempting to locate the factory. "
|
||||
"Killing bonobo-activation-server and restarting Nautilus may help fix the problem.");
|
||||
} else {
|
||||
num_failures++;
|
||||
if (num_failures > 20) {
|
||||
message = _("Nautilus cannot be used now, due to an unexpected error.");
|
||||
detailed_message = _("Nautilus cannot be used now, due to an unexpected error "
|
||||
"from Bonobo when attempting to locate the shell object. "
|
||||
"Killing bonobo-activation-server and restarting Nautilus may help fix the problem.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (message != NULL) {
|
||||
dialog = eel_show_error_dialog_with_details (message, NULL, detailed_message, NULL);
|
||||
/* We need the main event loop so the user has a chance to see the dialog. */
|
||||
nautilus_main_event_loop_register (GTK_OBJECT (dialog));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (kill_shell) {
|
||||
Nautilus_Shell_quit (shell, &ev);
|
||||
if (unique_app_is_running (application->unique_app)) {
|
||||
unique_app_send_message (application->unique_app,
|
||||
UNIQUE_CLOSE, NULL);
|
||||
|
||||
}
|
||||
} else if (restart_shell) {
|
||||
Nautilus_Shell_restart (shell, &ev);
|
||||
if (unique_app_is_running (application->unique_app)) {
|
||||
unique_app_send_message (application->unique_app,
|
||||
COMMAND_RESTART, NULL);
|
||||
|
||||
}
|
||||
} else {
|
||||
/* If KDE desktop is running, then force no_desktop */
|
||||
if (is_kdesktop_present ()) {
|
||||
|
@ -685,7 +721,17 @@ nautilus_application_startup (NautilusApplication *application,
|
|||
}
|
||||
|
||||
if (!no_desktop && eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_DESKTOP)) {
|
||||
Nautilus_Shell_start_desktop (shell, &ev);
|
||||
if (unique_app_is_running (application->unique_app)) {
|
||||
unique_app_send_message (application->unique_app,
|
||||
COMMAND_START_DESKTOP, NULL);
|
||||
} else {
|
||||
nautilus_application_open_desktop (application);
|
||||
}
|
||||
}
|
||||
|
||||
if (!unique_app_is_running (application->unique_app)) {
|
||||
finish_startup (application);
|
||||
g_signal_connect (application->unique_app, "message-received", G_CALLBACK (message_received_cb), application);
|
||||
}
|
||||
|
||||
/* Monitor the preference to show or hide the desktop */
|
||||
|
@ -701,31 +747,46 @@ nautilus_application_startup (NautilusApplication *application,
|
|||
NULL,
|
||||
G_OBJECT (application));
|
||||
|
||||
/* CORBA C mapping doesn't allow NULL to be passed
|
||||
for string parameters */
|
||||
corba_geometry = (geometry != NULL) ? geometry : "";
|
||||
corba_startup_id = (startup_id != NULL) ? startup_id : "";
|
||||
|
||||
/* Create the other windows. */
|
||||
if (urls != NULL) {
|
||||
url_list = nautilus_make_uri_list_from_shell_strv (urls);
|
||||
Nautilus_Shell_open_windows (shell, url_list, corba_startup_id, corba_geometry, browser_window, &ev);
|
||||
CORBA_free (url_list);
|
||||
} else if (!no_default_window) {
|
||||
g_assert (session_to_load == NULL);
|
||||
Nautilus_Shell_open_default_window (shell, corba_startup_id, corba_geometry, browser_window, &ev);
|
||||
if (urls != NULL || !no_default_window) {
|
||||
if (urls == NULL) {
|
||||
g_assert (session_to_load == NULL);
|
||||
}
|
||||
|
||||
if (unique_app_is_running (application->unique_app)) {
|
||||
message = unique_message_data_new ();
|
||||
_unique_message_data_set_geometry_and_uris (message, geometry, urls);
|
||||
if (browser_window) {
|
||||
unique_app_send_message (application->unique_app,
|
||||
COMMAND_OPEN_BROWSER, message);
|
||||
} else {
|
||||
unique_app_send_message (application->unique_app,
|
||||
UNIQUE_OPEN, message);
|
||||
}
|
||||
unique_message_data_free (message);
|
||||
} else {
|
||||
open_windows (application, NULL,
|
||||
urls,
|
||||
geometry,
|
||||
browser_window);
|
||||
}
|
||||
}
|
||||
|
||||
if (session_to_load != NULL) {
|
||||
Nautilus_Shell_load_session (shell, session_to_load, &ev);
|
||||
if (unique_app_is_running (application->unique_app)) {
|
||||
message = unique_message_data_new ();
|
||||
_unique_message_data_set_filename (message, session_to_load);
|
||||
unique_app_send_message (application->unique_app,
|
||||
COMMAND_LOAD_SESSION, message);
|
||||
unique_message_data_free (message);
|
||||
} else {
|
||||
nautilus_application_load_session (application, session_to_load);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add ourselves to the session */
|
||||
init_session ();
|
||||
}
|
||||
|
||||
out:
|
||||
CORBA_exception_free (&ev);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1031,6 +1092,11 @@ create_window (NautilusApplication *application,
|
|||
/* Must be called after construction finished */
|
||||
nautilus_window_constructed (window);
|
||||
|
||||
unique_app_watch_window (application->unique_app, GTK_WINDOW (window));
|
||||
if (startup_id) {
|
||||
gtk_window_set_startup_id (GTK_WINDOW (window), startup_id);
|
||||
}
|
||||
|
||||
g_signal_connect_data (window, "delete_event",
|
||||
G_CALLBACK (nautilus_window_delete_event_callback), NULL, NULL,
|
||||
G_CONNECT_AFTER);
|
||||
|
@ -1070,83 +1136,6 @@ nautilus_application_present_spatial_window (NautilusApplication *application,
|
|||
screen);
|
||||
}
|
||||
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
|
||||
static void
|
||||
sn_error_trap_push (SnDisplay *display,
|
||||
Display *xdisplay)
|
||||
{
|
||||
gdk_error_trap_push ();
|
||||
}
|
||||
|
||||
static void
|
||||
sn_error_trap_pop (SnDisplay *display,
|
||||
Display *xdisplay)
|
||||
{
|
||||
gdk_error_trap_pop ();
|
||||
}
|
||||
|
||||
static void
|
||||
end_startup_notification (GtkWidget *widget,
|
||||
const char *startup_id)
|
||||
{
|
||||
SnDisplay *sn_display;
|
||||
SnLauncheeContext *context;
|
||||
GdkDisplay *display;
|
||||
GdkScreen *screen;
|
||||
|
||||
if (startup_id == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_REALIZED (widget)) {
|
||||
gtk_widget_realize (widget);
|
||||
}
|
||||
|
||||
context = NULL;
|
||||
sn_display = NULL;
|
||||
|
||||
/* Set up window for launch notification */
|
||||
/* FIXME In principle all transient children of this
|
||||
* window should get the same startup_id
|
||||
*/
|
||||
|
||||
screen = gtk_widget_get_screen (widget);
|
||||
display = gdk_screen_get_display (screen);
|
||||
|
||||
sn_display = sn_display_new (gdk_x11_display_get_xdisplay (display),
|
||||
sn_error_trap_push,
|
||||
sn_error_trap_pop);
|
||||
|
||||
context = sn_launchee_context_new (sn_display,
|
||||
gdk_screen_get_number (screen),
|
||||
startup_id);
|
||||
|
||||
/* Handle the setup for the window if the startup_id is valid;
|
||||
* I don't think it can hurt to do this even if it was
|
||||
* invalid, but why do the extra work...
|
||||
*/
|
||||
if (strncmp (sn_launchee_context_get_startup_id (context), "_TIME", 5) != 0) {
|
||||
sn_launchee_context_setup_window (context,
|
||||
GDK_WINDOW_XWINDOW (widget->window));
|
||||
}
|
||||
|
||||
/* Now, set the _NET_WM_USER_TIME for the new window to the timestamp
|
||||
* that caused the window to be launched.
|
||||
*/
|
||||
if (sn_launchee_context_get_id_has_timestamp (context)) {
|
||||
gulong startup_id_timestamp;
|
||||
startup_id_timestamp = sn_launchee_context_get_timestamp (context);
|
||||
gdk_x11_window_set_user_time (widget->window, startup_id_timestamp);
|
||||
}
|
||||
|
||||
sn_launchee_context_complete (context);
|
||||
sn_launchee_context_unref (context);
|
||||
sn_display_unref (sn_display);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
NautilusWindow *
|
||||
nautilus_application_present_spatial_window_with_selection (NautilusApplication *application,
|
||||
NautilusWindow *requesting_window,
|
||||
|
@ -1176,11 +1165,6 @@ nautilus_application_present_spatial_window_with_selection (NautilusApplication
|
|||
}
|
||||
|
||||
if (g_file_equal (existing_location, location)) {
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
end_startup_notification (GTK_WIDGET (existing_window),
|
||||
startup_id);
|
||||
#endif
|
||||
|
||||
gtk_window_present (GTK_WINDOW (existing_window));
|
||||
if (new_selection &&
|
||||
slot->content_view != NULL) {
|
||||
|
@ -1197,10 +1181,6 @@ nautilus_application_present_spatial_window_with_selection (NautilusApplication
|
|||
}
|
||||
|
||||
window = create_window (application, NAUTILUS_TYPE_SPATIAL_WINDOW, startup_id, screen);
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
end_startup_notification (GTK_WIDGET (window),
|
||||
startup_id);
|
||||
#endif
|
||||
if (requesting_window) {
|
||||
/* Center the window over the requesting window by default */
|
||||
int orig_x, orig_y, orig_width, orig_height;
|
||||
|
@ -1267,10 +1247,6 @@ nautilus_application_create_navigation_window (NautilusApplication *application,
|
|||
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (application), NULL);
|
||||
|
||||
window = create_window (application, NAUTILUS_TYPE_NAVIGATION_WINDOW, startup_id, screen);
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
end_startup_notification (GTK_WIDGET (window),
|
||||
startup_id);
|
||||
#endif
|
||||
|
||||
maximized = eel_preferences_get_boolean
|
||||
(NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED);
|
||||
|
@ -2131,6 +2107,8 @@ is_kdesktop_present (void)
|
|||
static void
|
||||
nautilus_application_class_init (NautilusApplicationClass *class)
|
||||
{
|
||||
BONOBO_OBJECT_CLASS (class)->destroy = nautilus_application_destroy;
|
||||
BONOBO_GENERIC_FACTORY_CLASS (class)->epv.createObject = create_object;
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (class);
|
||||
object_class->finalize = nautilus_application_finalize;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gio/gio.h>
|
||||
#include <bonobo/bonobo-generic-factory.h>
|
||||
#include <unique/unique.h>
|
||||
#include <libnautilus-private/nautilus-undo-manager.h>
|
||||
|
||||
#define NAUTILUS_DESKTOP_ICON_VIEW_IID "OAFIID:Nautilus_File_Manager_Desktop_Icon_View"
|
||||
|
@ -53,16 +53,15 @@ typedef struct _NautilusSpatialWindow NautilusSpatialWindow;
|
|||
typedef struct NautilusShell NautilusShell;
|
||||
|
||||
typedef struct {
|
||||
BonoboGenericFactory parent;
|
||||
GObject parent;
|
||||
UniqueApp *unique_app;
|
||||
NautilusUndoManager *undo_manager;
|
||||
NautilusShell *shell;
|
||||
gboolean shell_registered;
|
||||
GVolumeMonitor *volume_monitor;
|
||||
unsigned int automount_idle_id;
|
||||
} NautilusApplication;
|
||||
|
||||
typedef struct {
|
||||
BonoboGenericFactoryClass parent_class;
|
||||
GObjectClass parent_class;
|
||||
} NautilusApplicationClass;
|
||||
|
||||
GType nautilus_application_get_type (void);
|
||||
|
@ -73,10 +72,9 @@ void nautilus_application_startup (NautilusApplication
|
|||
gboolean no_default_window,
|
||||
gboolean no_desktop,
|
||||
gboolean browser_window,
|
||||
const char *startup_id,
|
||||
const char *default_geometry,
|
||||
const char *session_to_load,
|
||||
const char *urls[]);
|
||||
char **urls);
|
||||
GList * nautilus_application_get_window_list (void);
|
||||
GList * nautilus_application_get_spatial_window_list (void);
|
||||
unsigned int nautilus_application_get_n_windows (void);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include <libnautilus-private/nautilus-icon-names.h>
|
||||
#include <gio/gio.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
struct NautilusDesktopWindowDetails {
|
||||
int dummy;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include "nautilus-location-entry.h"
|
||||
#include "nautilus-desktop-window.h"
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
struct _NautilusLocationDialogDetails {
|
||||
GtkWidget *entry;
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include "nautilus-application.h"
|
||||
#include "nautilus-self-check-functions.h"
|
||||
#include "nautilus-window.h"
|
||||
#include <bonobo-activation/bonobo-activation.h>
|
||||
#include <bonobo/bonobo-main.h>
|
||||
#include <dlfcn.h>
|
||||
#include <signal.h>
|
||||
#include <eel/eel-debug.h>
|
||||
|
@ -113,15 +111,6 @@ event_loop_unregister (GtkObject *object)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
initial_event_loop_needed (gpointer data)
|
||||
{
|
||||
if (!is_event_loop_needed ()) {
|
||||
eel_gtk_main_quit_all ();
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_main_event_loop_register (GtkObject *object)
|
||||
{
|
||||
|
@ -149,59 +138,6 @@ nautilus_main_event_loop_quit (gboolean explicit)
|
|||
}
|
||||
}
|
||||
|
||||
/* Copied from libnautilus/nautilus-program-choosing.c; In this case,
|
||||
* though, it's really needed because we have no real alternative when
|
||||
* no DESKTOP_STARTUP_ID (with its accompanying timestamp) is
|
||||
* provided...
|
||||
*/
|
||||
static Time
|
||||
slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
|
||||
{
|
||||
Window xwindow;
|
||||
XEvent event;
|
||||
|
||||
{
|
||||
XSetWindowAttributes attrs;
|
||||
Atom atom_name;
|
||||
Atom atom_type;
|
||||
char* name;
|
||||
|
||||
attrs.override_redirect = True;
|
||||
attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
|
||||
|
||||
xwindow =
|
||||
XCreateWindow (xdisplay,
|
||||
RootWindow (xdisplay, 0),
|
||||
-100, -100, 1, 1,
|
||||
0,
|
||||
CopyFromParent,
|
||||
CopyFromParent,
|
||||
(Visual *)CopyFromParent,
|
||||
CWOverrideRedirect | CWEventMask,
|
||||
&attrs);
|
||||
|
||||
atom_name = XInternAtom (xdisplay, "WM_NAME", TRUE);
|
||||
g_assert (atom_name != None);
|
||||
atom_type = XInternAtom (xdisplay, "STRING", TRUE);
|
||||
g_assert (atom_type != None);
|
||||
|
||||
name = "Fake Window";
|
||||
XChangeProperty (xdisplay,
|
||||
xwindow, atom_name,
|
||||
atom_type,
|
||||
8, PropModeReplace, name, strlen (name));
|
||||
}
|
||||
|
||||
XWindowEvent (xdisplay,
|
||||
xwindow,
|
||||
PropertyChangeMask,
|
||||
&event);
|
||||
|
||||
XDestroyWindow(xdisplay, xwindow);
|
||||
|
||||
return event.xproperty.time;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_debug_log (void)
|
||||
{
|
||||
|
@ -372,8 +308,7 @@ main (int argc, char *argv[])
|
|||
gboolean no_desktop;
|
||||
gboolean autostart_mode;
|
||||
gboolean has_sm_argv;
|
||||
const char *startup_id, *autostart_id;
|
||||
char *startup_id_copy;
|
||||
const char *autostart_id;
|
||||
char *session_to_load;
|
||||
gchar *geometry;
|
||||
const gchar **remaining;
|
||||
|
@ -383,6 +318,11 @@ main (int argc, char *argv[])
|
|||
NautilusApplication *application;
|
||||
char **argv_copy;
|
||||
GnomeProgram *program;
|
||||
GFile *file;
|
||||
char *uri;
|
||||
char **uris;
|
||||
GPtrArray *uris_array;
|
||||
int i;
|
||||
|
||||
const GOptionEntry options[] = {
|
||||
#ifndef NAUTILUS_OMIT_SELF_CHECK
|
||||
|
@ -425,14 +365,6 @@ main (int argc, char *argv[])
|
|||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
startup_id = g_getenv ("DESKTOP_STARTUP_ID");
|
||||
startup_id_copy = NULL;
|
||||
if (startup_id != NULL && *startup_id != '\0') {
|
||||
/* Clear the DESKTOP_STARTUP_ID, but make sure to copy it first */
|
||||
startup_id_copy = g_strdup (startup_id);
|
||||
g_unsetenv ("DESKTOP_STARTUP_ID");
|
||||
}
|
||||
|
||||
autostart_mode = FALSE;
|
||||
|
||||
autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
|
||||
|
@ -448,9 +380,6 @@ main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* we'll do it ourselves due to complicated factory setup */
|
||||
gtk_window_set_auto_startup_notification (FALSE);
|
||||
|
||||
/* Get parameters. */
|
||||
remaining = NULL;
|
||||
geometry = NULL;
|
||||
|
@ -496,24 +425,9 @@ main (int argc, char *argv[])
|
|||
no_desktop = FALSE;
|
||||
}
|
||||
|
||||
/* Do this here so that gdk_display is initialized */
|
||||
if (startup_id_copy == NULL) {
|
||||
/* Create a fake one containing a timestamp that we can use */
|
||||
Time timestamp;
|
||||
timestamp = slowly_and_stupidly_obtain_timestamp (gdk_display);
|
||||
startup_id_copy = g_strdup_printf ("_TIME%lu",
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/* Set default icon for all nautilus windows */
|
||||
gtk_window_set_default_icon_name (NAUTILUS_ICON_FOLDER);
|
||||
|
||||
/* Need to set this to the canonical DISPLAY value, since
|
||||
thats where we're registering per-display components */
|
||||
bonobo_activation_set_activation_env_value ("DISPLAY",
|
||||
gdk_display_get_name (gdk_display_get_default()));
|
||||
|
||||
|
||||
if (perform_self_check && remaining != NULL) {
|
||||
/* translators: %s is an option (e.g. --check) */
|
||||
fprintf (stderr, _("nautilus: %s cannot be used with URIs.\n"),
|
||||
|
@ -559,10 +473,8 @@ main (int argc, char *argv[])
|
|||
no_default_window = TRUE;
|
||||
}
|
||||
|
||||
bonobo_activate (); /* do now since we need it before main loop */
|
||||
|
||||
application = NULL;
|
||||
|
||||
|
||||
/* Do either the self-check or the real work. */
|
||||
if (perform_self_check) {
|
||||
#ifndef NAUTILUS_OMIT_SELF_CHECK
|
||||
|
@ -577,29 +489,44 @@ main (int argc, char *argv[])
|
|||
eel_exit_if_self_checks_failed ();
|
||||
#endif
|
||||
} else {
|
||||
/* Convert args to URIs */
|
||||
uris = NULL;
|
||||
if (remaining != NULL) {
|
||||
uris_array = g_ptr_array_new ();
|
||||
for (i = 0; remaining[i] != NULL; i++) {
|
||||
file = g_file_new_for_commandline_arg (remaining[i]);
|
||||
if (file != NULL) {
|
||||
uri = g_file_get_uri (file);
|
||||
g_object_unref (file);
|
||||
if (uri) {
|
||||
g_ptr_array_add (uris_array, uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
uris = (char **)g_ptr_array_free (uris_array, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* Run the nautilus application. */
|
||||
application = nautilus_application_new ();
|
||||
nautilus_application_startup
|
||||
(application,
|
||||
kill_shell, restart_shell, no_default_window, no_desktop,
|
||||
browser_window,
|
||||
startup_id_copy,
|
||||
geometry,
|
||||
session_to_load,
|
||||
remaining);
|
||||
g_free (startup_id_copy);
|
||||
uris);
|
||||
g_strfreev (uris);
|
||||
|
||||
/* The application startup does things in an idle, so
|
||||
we need to check whether the main loop is needed in an idle
|
||||
*/
|
||||
g_idle_add (initial_event_loop_needed, NULL);
|
||||
gtk_main ();
|
||||
if (is_event_loop_needed ()) {
|
||||
gtk_main ();
|
||||
}
|
||||
}
|
||||
|
||||
nautilus_icon_info_clear_caches ();
|
||||
|
||||
if (application != NULL) {
|
||||
bonobo_object_unref (application);
|
||||
g_object_unref (application);
|
||||
}
|
||||
|
||||
eel_debug_shut_down ();
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
|
||||
|
||||
#ifndef NAUTILUS_SHELL_INTERFACE_IDL
|
||||
#define NAUTILUS_SHELL_INTERFACE_IDL
|
||||
|
||||
#include <Bonobo.idl>
|
||||
|
||||
module Nautilus {
|
||||
typedef string URI;
|
||||
typedef sequence<URI> URIList;
|
||||
|
||||
interface Shell : ::Bonobo::Unknown {
|
||||
void open_windows (in URIList uris, in string startup_id, in string geometry, in boolean browser_window);
|
||||
void open_default_window (in string startup_id, in string geometry, in boolean browser_window);
|
||||
void start_desktop ();
|
||||
void stop_desktop ();
|
||||
void quit ();
|
||||
void restart ();
|
||||
void load_session (in string filename);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif /* NAUTILUS_SHELL_INTERFACE_IDL */
|
|
@ -1,372 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/*
|
||||
* Nautilus
|
||||
*
|
||||
* Copyright (C) 2000 Eazel, 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, 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"
|
||||
|
||||
#include "nautilus-desktop-window.h"
|
||||
#include "nautilus-main.h"
|
||||
#include "nautilus-window-private.h"
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
#include <eel/eel-gtk-extensions.h>
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-stock-dialogs.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <libgnomeui/gnome-stock-icons.h>
|
||||
#include <libgnomeui/gnome-uidefs.h>
|
||||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include <libnautilus-private/nautilus-global-preferences.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Keep window from shrinking down ridiculously small; numbers are somewhat arbitrary */
|
||||
#define APPLICATION_WINDOW_MIN_WIDTH 300
|
||||
#define APPLICATION_WINDOW_MIN_HEIGHT 100
|
||||
|
||||
#define START_STATE_CONFIG "start-state"
|
||||
|
||||
struct NautilusShellDetails {
|
||||
NautilusApplication *application;
|
||||
};
|
||||
|
||||
static void finalize (GObject *shell);
|
||||
static void corba_open_windows (PortableServer_Servant servant,
|
||||
const Nautilus_URIList *list,
|
||||
const CORBA_char *startup_id,
|
||||
const CORBA_char *geometry,
|
||||
CORBA_boolean browser_window,
|
||||
CORBA_Environment *ev);
|
||||
static void corba_open_default_window (PortableServer_Servant servant,
|
||||
const CORBA_char *startup_id,
|
||||
const CORBA_char *geometry,
|
||||
CORBA_boolean browser_window,
|
||||
CORBA_Environment *ev);
|
||||
static void corba_load_session (PortableServer_Servant servant,
|
||||
const CORBA_char *filename,
|
||||
CORBA_Environment *ev);
|
||||
static void corba_start_desktop (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev);
|
||||
static void corba_stop_desktop (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev);
|
||||
static void corba_quit (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev);
|
||||
static void corba_restart (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev);
|
||||
|
||||
BONOBO_CLASS_BOILERPLATE_FULL (NautilusShell, nautilus_shell,
|
||||
Nautilus_Shell,
|
||||
BonoboObject, BONOBO_OBJECT_TYPE)
|
||||
|
||||
static void
|
||||
nautilus_shell_class_init (NautilusShellClass *klass)
|
||||
{
|
||||
G_OBJECT_CLASS (klass)->finalize = finalize;
|
||||
|
||||
klass->epv.open_windows = corba_open_windows;
|
||||
klass->epv.open_default_window = corba_open_default_window;
|
||||
klass->epv.load_session = corba_load_session;
|
||||
klass->epv.start_desktop = corba_start_desktop;
|
||||
klass->epv.stop_desktop = corba_stop_desktop;
|
||||
klass->epv.quit = corba_quit;
|
||||
klass->epv.restart = corba_restart;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_shell_instance_init (NautilusShell *shell)
|
||||
{
|
||||
shell->details = g_new0 (NautilusShellDetails, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NautilusShell *shell;
|
||||
|
||||
shell = NAUTILUS_SHELL (object);
|
||||
g_free (shell->details);
|
||||
|
||||
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
NautilusShell *
|
||||
nautilus_shell_new (NautilusApplication *application)
|
||||
{
|
||||
NautilusShell *shell;
|
||||
|
||||
shell = NAUTILUS_SHELL (g_object_new (NAUTILUS_TYPE_SHELL, NULL));
|
||||
shell->details->application = application;
|
||||
return shell;
|
||||
}
|
||||
|
||||
static void
|
||||
open_window (NautilusShell *shell, const char *uri, const char *startup_id,
|
||||
const char *geometry, gboolean browser_window)
|
||||
{
|
||||
GFile *location;
|
||||
NautilusWindow *window;
|
||||
|
||||
if (browser_window ||
|
||||
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
|
||||
window = nautilus_application_create_navigation_window (shell->details->application,
|
||||
startup_id,
|
||||
gdk_screen_get_default ());
|
||||
if (uri == NULL) {
|
||||
nautilus_window_go_home (window);
|
||||
} else {
|
||||
location = g_file_new_for_uri (uri);
|
||||
nautilus_window_go_to (window, location);
|
||||
g_object_unref (location);
|
||||
}
|
||||
} else {
|
||||
if (uri == NULL) {
|
||||
location = g_file_new_for_path (g_get_home_dir ());
|
||||
} else {
|
||||
location = g_file_new_for_uri (uri);
|
||||
}
|
||||
|
||||
window = nautilus_application_present_spatial_window (shell->details->application,
|
||||
NULL,
|
||||
startup_id,
|
||||
location,
|
||||
gdk_screen_get_default ());
|
||||
g_object_unref (location);
|
||||
}
|
||||
|
||||
if (geometry != NULL && !GTK_WIDGET_VISIBLE (window)) {
|
||||
/* never maximize windows opened from shell if a
|
||||
* custom geometry has been requested.
|
||||
*/
|
||||
gtk_window_unmaximize (GTK_WINDOW (window));
|
||||
eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window),
|
||||
geometry,
|
||||
APPLICATION_WINDOW_MIN_WIDTH,
|
||||
APPLICATION_WINDOW_MIN_HEIGHT,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
NautilusShell *shell;
|
||||
char *startup_id;
|
||||
char *geometry;
|
||||
GList *uris;
|
||||
gboolean browser_window;
|
||||
} OpenWindowData;
|
||||
|
||||
static gboolean
|
||||
open_windows_at_idle (gpointer _data)
|
||||
{
|
||||
OpenWindowData *data = _data;
|
||||
char *uri;
|
||||
GList *l;
|
||||
|
||||
if (data->uris == NULL) {
|
||||
/* Open a window pointing at the default location. */
|
||||
open_window (data->shell, NULL, data->startup_id,
|
||||
data->geometry, data->browser_window);
|
||||
} else {
|
||||
/* Open windows at each requested location. */
|
||||
for (l = data->uris; l != NULL; l = l->next) {
|
||||
uri = (char *)l->data;
|
||||
open_window (data->shell, uri, data->startup_id,
|
||||
data->geometry, data->browser_window);
|
||||
g_free (uri);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (data->startup_id);
|
||||
g_free (data->geometry);
|
||||
g_list_free (data->uris);
|
||||
g_free (data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
corba_open_windows (PortableServer_Servant servant,
|
||||
const Nautilus_URIList *list,
|
||||
const CORBA_char *startup_id,
|
||||
const CORBA_char *geometry,
|
||||
CORBA_boolean browser_window,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
OpenWindowData *data;
|
||||
guint i;
|
||||
|
||||
data = g_new0 (OpenWindowData, 1);
|
||||
|
||||
data->shell = NAUTILUS_SHELL (bonobo_object_from_servant (servant));
|
||||
data->startup_id = strcmp (startup_id, "") ? g_strdup (startup_id) : NULL;
|
||||
data->geometry = strcmp (geometry, "") ? g_strdup (geometry) : NULL;
|
||||
data->browser_window = browser_window;
|
||||
|
||||
for (i = 0; i < list->_length; i++) {
|
||||
g_assert (list->_buffer[i] != NULL);
|
||||
data->uris = g_list_prepend (data->uris,
|
||||
g_strdup (list->_buffer[i]));
|
||||
}
|
||||
data->uris = g_list_reverse (data->uris);
|
||||
|
||||
g_idle_add (open_windows_at_idle, data);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
corba_open_default_window (PortableServer_Servant servant,
|
||||
const CORBA_char *startup_id,
|
||||
const CORBA_char *geometry,
|
||||
CORBA_boolean browser_window,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
OpenWindowData *data;
|
||||
|
||||
data = g_new0 (OpenWindowData, 1);
|
||||
|
||||
data->shell = NAUTILUS_SHELL (bonobo_object_from_servant (servant));
|
||||
data->startup_id = strcmp (startup_id, "") ? g_strdup (startup_id) : NULL;
|
||||
data->geometry = strcmp (geometry, "") ? g_strdup (geometry) : NULL;
|
||||
data->browser_window = browser_window;
|
||||
|
||||
g_idle_add (open_windows_at_idle, data);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
NautilusShell *shell;
|
||||
char *filename;
|
||||
} LoadSessionData;
|
||||
|
||||
static gboolean
|
||||
load_session_at_idle (gpointer _data)
|
||||
{
|
||||
NautilusApplication *application;
|
||||
LoadSessionData *data = _data;
|
||||
|
||||
application = NAUTILUS_APPLICATION (data->shell->details->application);
|
||||
nautilus_application_load_session (application, data->filename);
|
||||
|
||||
g_free (data->filename);
|
||||
g_free (data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
corba_load_session (PortableServer_Servant servant,
|
||||
const CORBA_char *filename,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
LoadSessionData *data;
|
||||
|
||||
data = g_new0 (LoadSessionData, 1);
|
||||
data->shell = NAUTILUS_SHELL (bonobo_object_from_servant (servant));
|
||||
data->filename = g_strdup (filename);
|
||||
|
||||
g_idle_add (load_session_at_idle, data);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
NautilusShell *shell;
|
||||
} StartDesktopData;
|
||||
|
||||
static gboolean
|
||||
start_desktop_at_idle (gpointer _data)
|
||||
{
|
||||
StartDesktopData *data = _data;
|
||||
NautilusApplication *application;
|
||||
|
||||
application = NAUTILUS_APPLICATION (data->shell->details->application);
|
||||
nautilus_application_open_desktop (application);
|
||||
|
||||
g_free (data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
corba_start_desktop (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
StartDesktopData *data;
|
||||
|
||||
data = g_new0 (StartDesktopData, 1);
|
||||
data->shell = NAUTILUS_SHELL (bonobo_object_from_servant (servant));
|
||||
|
||||
g_idle_add (start_desktop_at_idle, data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
stop_desktop_at_idle (gpointer data)
|
||||
{
|
||||
nautilus_application_close_desktop ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
corba_stop_desktop (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
g_idle_add (stop_desktop_at_idle, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
quit_at_idle (gpointer data)
|
||||
{
|
||||
nautilus_main_event_loop_quit (TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
corba_quit (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
g_idle_add (quit_at_idle, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
restart_at_idle (gpointer data)
|
||||
{
|
||||
char *filename;
|
||||
|
||||
filename = nautilus_application_save_session_to_file ();
|
||||
if (filename != NULL) {
|
||||
nautilus_main_event_loop_quit (TRUE);
|
||||
g_setenv ("_NAUTILUS_RESTART_SESSION_FILENAME", filename, 1);
|
||||
g_free (filename);
|
||||
} else {
|
||||
g_message ("Could not save session. Not restarting.");
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
corba_restart (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
g_idle_add (restart_at_idle, NULL);
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/*
|
||||
* Nautilus
|
||||
*
|
||||
* Copyright (C) 2000 Eazel, 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, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* nautilus-shell.h: Server side of Nautilus:Shell CORBA object that
|
||||
* represents the shell across processes.
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_SHELL_H
|
||||
#define NAUTILUS_SHELL_H
|
||||
|
||||
#include "nautilus-application.h"
|
||||
#include "nautilus-shell-interface.h"
|
||||
|
||||
#define NAUTILUS_TYPE_SHELL (nautilus_shell_get_type ())
|
||||
#define NAUTILUS_SHELL(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SHELL, NautilusShell))
|
||||
#define NAUTILUS_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SHELL, NautilusShellClass))
|
||||
#define NAUTILUS_IS_SHELL(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SHELL))
|
||||
#define NAUTILUS_IS_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SHELL))
|
||||
|
||||
typedef struct NautilusShellDetails NautilusShellDetails;
|
||||
|
||||
struct NautilusShell {
|
||||
BonoboObject parent_slot;
|
||||
NautilusShellDetails *details;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
BonoboObjectClass parent_slot;
|
||||
POA_Nautilus_Shell__epv epv;
|
||||
} NautilusShellClass;
|
||||
|
||||
GType nautilus_shell_get_type (void);
|
||||
NautilusShell *nautilus_shell_new (NautilusApplication *application);
|
||||
|
||||
#endif /* NAUTILUS_SHELL_H */
|
|
@ -38,6 +38,7 @@
|
|||
#include <eel/eel-stock-dialogs.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <eel/eel-gtk-extensions.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#define MENU_ITEM_MAX_WIDTH_CHARS 32
|
||||
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
#include "nautilus-spatial-window.h"
|
||||
#include "nautilus-navigation-window.h"
|
||||
|
||||
#include <bonobo/bonobo-ui-component.h>
|
||||
#include <bonobo/bonobo-ui-container.h>
|
||||
#include <bonobo/bonobo-ui-toolbar-button-item.h>
|
||||
#include <libnautilus-private/nautilus-directory.h>
|
||||
|
||||
/* FIXME bugzilla.gnome.org 42575: Migrate more fields into here. */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "nautilus-window.h"
|
||||
#include "nautilus-query-editor.h"
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#define NAUTILUS_TYPE_WINDOW_SLOT (nautilus_window_slot_get_type())
|
||||
#define NAUTILUS_WINDOW_SLOT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_WINDOW_SLOT, NautilusWindowSlotClass))
|
||||
|
|
Loading…
Reference in a new issue