Commit 0755d50a authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

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
parent c95d7531
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:
......
......@@ -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 gboolean
_unique_message_data_set_geometry_and_uris (UniqueMessageData *message_data,
const char *geometry,
char **uris)
{
GString *list;
gint i;
gchar *result;
gsize length;
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");
}
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 CORBA_Object
create_object (PortableServer_Servant servant,
const CORBA_char *iid,
CORBA_Environment *ev)
static gchar **
_unique_message_data_get_geometry_and_uris (UniqueMessageData *message_data,
char **geometry)
{
BonoboObject *object;
NautilusApplication *application;
gchar **result = NULL;
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;
}
*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);
}
return CORBA_Object_duplicate (BONOBO_OBJREF (object), ev);
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 void
open_window (NautilusApplication *application,
const char *startup_id,
const char *uri, 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 (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);
}
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;
static Bonobo_RegistrationResult
nautilus_bonobo_activation_register_for_display (const char *iid,
Bonobo_Unknown ref)
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)
{
const char *display_name;
GSList *reg_env ;
Bonobo_RegistrationResult result;
NautilusApplication *application;
UniqueResponse res;
char *filename;
char **uris;
char *geometry;
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;
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);