Commit 67e2a42f authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Merge bonobo-slay-branch

2004-11-22  Alexander Larsson  <alexl@redhat.com>
        * Merge bonobo-slay-branch
parent 8dc115c3
This diff is collapsed.
......@@ -11,15 +11,12 @@ desktop_in_files = \
nautilus-file-management-properties.desktop.in
SUBDIRS = \
libnautilus \
libnautilus-extension \
cut-n-paste-code \
libbackground \
libnautilus-private \
libnautilus-adapter \
src \
test \
components \
po \
data \
icons \
......
NULL=
SUBDIRS = \
adapter \
history \
notes \
text \
throbber \
emblem \
image_properties \
$(NULL)
# loser \
# sample \
# These should only be built by people that know what they do
# news \
# Disable the news-sidebar for now, It has lots of bugs and doesn't
# really fit into a file manager.
NULL =
INCLUDES = \
-DG_LOG_DOMAIN=\"Nautilus-Adapter\" \
-DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \
-I$(top_srcdir) \
$(DISABLE_DEPRECATED_CFLAGS) \
$(COMPONENT_CFLAGS) \
$(NULL)
serverdir = $(libdir)/bonobo/servers
server_in_files = Nautilus_ComponentAdapterFactory_std.server.in
server_DATA = $(server_in_files:.server.in=.server)
$(server_in_files): $(server_in_files).in
sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
@INTLTOOL_SERVER_RULE@
libexec_PROGRAMS=nautilus-adapter
nautilus_adapter_SOURCES = \
main.c \
nautilus-adapter-control-embed-strategy.c \
nautilus-adapter-control-embed-strategy.h \
nautilus-adapter-embed-strategy-private.h \
nautilus-adapter-embed-strategy.c \
nautilus-adapter-embed-strategy.h \
nautilus-adapter-control-factory-embed-strategy.c \
nautilus-adapter-control-factory-embed-strategy.h \
nautilus-adapter-factory-server.c \
nautilus-adapter-factory-server.h \
nautilus-adapter-file-load-strategy.c \
nautilus-adapter-file-load-strategy.h \
nautilus-adapter-load-strategy.c \
nautilus-adapter-load-strategy.h \
nautilus-adapter-load-strategy.h \
nautilus-adapter-stream-load-strategy.c \
nautilus-adapter-stream-load-strategy.h \
nautilus-zoomable-proxy.c \
nautilus-zoomable-proxy.h \
nautilus-adapter.c \
nautilus-adapter.h \
$(NULL)
nautilus_adapter_LDADD = \
$(top_builddir)/libnautilus/libnautilus.la \
$(top_builddir)/libnautilus-adapter/libnautilus-adapter.la \
$(COMPONENT_LIBS) \
$(NULL)
EXTRA_DIST = $(server_in_files).in
CLEANFILES = $(server_in_files) $(server_DATA)
<oaf_info>
<oaf_server iid="OAFIID:Nautilus_Adapter_Factory_Factory"
type="exe" location="@LIBEXECDIR@/nautilus-adapter">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/ObjectFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="Factory for Nautilus component adapter factories"/>
<oaf_attribute name="description" type="string" _value="Factory for Nautilus component adapter factories "/>
</oaf_server>
<oaf_server iid="OAFIID:Nautilus_Adapter_Factory" type="factory" location="OAFIID:Nautilus_Adapter_Factory_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Nautilus/ComponentAdapterFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="Nautilus component adapter factory"/>
<oaf_attribute name="description" type="string" _value="Factory for objects that wrap ordinary Bonobo Controls or Embeddables to look like Nautilus Views"/>
</oaf_server>
</oaf_info>
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright (C) 2000 Eazel, Inc
*
* This program 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.
*
* Author: Maciej Stachowiak <mjs@eazel.com>
*/
/* main.c - Main function and object activation function for component adapter
*/
#include <config.h>
#include "nautilus-adapter-factory-server.h"
#include <bonobo-activation/bonobo-activation.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-ui-main.h>
#include <eel/eel-debug.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-init.h>
#include <libgnomeui/gnome-authentication-manager.h>
#include <libgnomeui/gnome-client.h>
#include <libgnomevfs/gnome-vfs-init.h>
#include <eel/eel-gnome-extensions.h>
#include <stdlib.h>
#include <string.h>
#define META_FACTORY_IID "OAFIID:Nautilus_Adapter_Factory_Factory"
#define FACTORY_OBJECT_IID "OAFIID:Nautilus_Adapter_Factory"
static int object_count = 0;
static void
adapter_factory_object_weak_notify (gpointer data, GObject *object)
{
object_count--;
if (object_count <= 0) {
bonobo_main_quit ();
}
}
static BonoboObject *
adapter_factory_make_object (BonoboGenericFactory *factory,
const char *iid,
gpointer callback_data)
{
NautilusAdapterFactoryServer *adapter;
g_assert (BONOBO_IS_GENERIC_FACTORY (factory));
g_assert (iid != NULL);
g_assert (callback_data == NULL);
/* Check that this is the one type of object we know how to
* create.
*/
if (strcmp (iid, FACTORY_OBJECT_IID) != 0) {
return NULL;
}
adapter = NAUTILUS_ADAPTER_FACTORY_SERVER (g_object_new (NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NULL));
/* Connect a handler that will get us out of the main loop
* when there are no more objects outstanding.
*/
object_count++;
g_object_weak_ref (G_OBJECT (adapter),
adapter_factory_object_weak_notify,
NULL);
return BONOBO_OBJECT (adapter);
}
int
main (int argc, char *argv[])
{
BonoboGenericFactory *factory;
char *registration_id;
if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
eel_make_warnings_and_criticals_stop_in_debugger ();
}
if (!bonobo_ui_init ("nautilus-adapter", VERSION, &argc, argv)) {
g_error (_("bonobo_ui_init() failed."));
}
/* Disable session manager connection */
g_object_set (G_OBJECT (gnome_program_get()),
GNOME_CLIENT_PARAM_SM_CONNECT, FALSE, NULL);
/* Create the factory. */
registration_id = eel_bonobo_make_registration_id (META_FACTORY_IID);
factory = bonobo_generic_factory_new (registration_id, adapter_factory_make_object, NULL);
g_free (registration_id);
gnome_authentication_manager_init ();
/* Loop until we have no more objects. */
do {
bonobo_main ();
} while (object_count > 0);
/* Let the factory go. */
bonobo_object_unref (factory);
gnome_vfs_shutdown ();
return EXIT_SUCCESS;
}
/* -*- 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; see the file COPYING. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Maciej Stachowiak <mjs@eazel.com>
*/
/* nautilus-adapter-control-embed-strategy.c -
*/
#include <config.h>
#include "nautilus-adapter-control-embed-strategy.h"
#include "nautilus-adapter-embed-strategy-private.h"
#include "nautilus-zoomable-proxy.h"
#include <gtk/gtkobject.h>
#include <gtk/gtksignal.h>
#include <eel/eel-gtk-macros.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-control-frame.h>
struct NautilusAdapterControlEmbedStrategyDetails {
BonoboControlFrame *control_frame;
BonoboObject *zoomable;
GtkWidget *widget;
};
static void nautilus_adapter_control_embed_strategy_class_init (NautilusAdapterControlEmbedStrategyClass *klass);
static void nautilus_adapter_control_embed_strategy_init (NautilusAdapterControlEmbedStrategy *strategy);
static void nautilus_adapter_control_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
gpointer ui_container);
static void nautilus_adapter_control_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *object);
static void nautilus_adapter_control_embed_strategy_destroy (GtkObject *object);
static GtkWidget *nautilus_adapter_control_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
static BonoboObject *nautilus_adapter_control_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
EEL_CLASS_BOILERPLATE (NautilusAdapterControlEmbedStrategy, nautilus_adapter_control_embed_strategy, NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY)
static void
nautilus_adapter_control_embed_strategy_class_init (NautilusAdapterControlEmbedStrategyClass *klass)
{
GtkObjectClass *object_class;
NautilusAdapterEmbedStrategyClass *adapter_embed_strategy_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = nautilus_adapter_control_embed_strategy_destroy;
adapter_embed_strategy_class = NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS (klass);
adapter_embed_strategy_class->get_widget = nautilus_adapter_control_embed_strategy_get_widget;
adapter_embed_strategy_class->get_zoomable = nautilus_adapter_control_embed_strategy_get_zoomable;
adapter_embed_strategy_class->activate = nautilus_adapter_control_embed_strategy_activate;
adapter_embed_strategy_class->deactivate = nautilus_adapter_control_embed_strategy_deactivate;
}
static void
nautilus_adapter_control_embed_strategy_init (NautilusAdapterControlEmbedStrategy *strategy)
{
strategy->details = g_new0 (NautilusAdapterControlEmbedStrategyDetails, 1);
}
static void
nautilus_adapter_control_embed_strategy_destroy (GtkObject *object)
{
NautilusAdapterControlEmbedStrategy *strategy;
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (object);
bonobo_object_unref (strategy->details->control_frame);
g_free (strategy->details);
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
static void
nautilus_adapter_control_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
gpointer ui_container)
{
NautilusAdapterControlEmbedStrategy *strategy;
Bonobo_UIContainer corba_container = ui_container;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY (object));
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (object);
bonobo_control_frame_set_ui_container (strategy->details->control_frame,
corba_container, NULL);
bonobo_control_frame_control_activate (strategy->details->control_frame);
}
static void
nautilus_adapter_control_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *object)
{
NautilusAdapterControlEmbedStrategy *strategy;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY (object));
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (object);
/* This is not strictly necessary, but it makes sure that the component's menus
* and toolbars are really unmerged even if our component is badly behaving or
* leaking a reference somewhere. */
bonobo_control_frame_control_deactivate (strategy->details->control_frame);
}
static void
activate_uri_callback (BonoboControlFrame *frame,
const char *uri,
gboolean relative,
NautilusAdapterControlEmbedStrategy *strategy)
{
/* FIXME bugzilla.gnome.org 44404: ignoring `relative' parameter as
* the concept is kind of broken.
*/
nautilus_adapter_embed_strategy_emit_open_location (NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy),
uri);
}
NautilusAdapterEmbedStrategy *
nautilus_adapter_control_embed_strategy_new (Bonobo_Control control,
Bonobo_UIContainer ui_container)
{
NautilusAdapterControlEmbedStrategy *strategy;
Bonobo_Zoomable corba_zoomable;
CORBA_Environment ev;
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (g_object_new (NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY, NULL));
g_object_ref (strategy);
gtk_object_sink (GTK_OBJECT (strategy));
strategy->details->control_frame = bonobo_control_frame_new (ui_container);
bonobo_control_frame_bind_to_control (strategy->details->control_frame, control, NULL);
strategy->details->widget = bonobo_control_frame_get_widget (strategy->details->control_frame);
g_signal_connect_object (strategy->details->control_frame, "activate_uri",
G_CALLBACK (activate_uri_callback), strategy, 0);
CORBA_exception_init (&ev);
corba_zoomable = Bonobo_Unknown_queryInterface (control,
"IDL:Bonobo/Zoomable:1.0",
&ev);
if ((ev._major == CORBA_NO_EXCEPTION) &&
!CORBA_Object_is_nil (corba_zoomable, &ev)) {
strategy->details->zoomable = nautilus_zoomable_proxy_get
(corba_zoomable);
bonobo_object_release_unref (corba_zoomable, &ev);
}
CORBA_exception_free (&ev);
return NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy);
}
static GtkWidget *
nautilus_adapter_control_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *abstract_strategy)
{
NautilusAdapterControlEmbedStrategy *strategy;
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (abstract_strategy);
return strategy->details->widget;
}
static BonoboObject *
nautilus_adapter_control_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *abstract_strategy)
{
NautilusAdapterControlEmbedStrategy *strategy;
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (abstract_strategy);
return strategy->details->zoomable;
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright (C) 2000 Eazel, Inc
*
* This program 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.
*
* Author: Maciej Stachowiak <mjs@eazel.com>
*/
/* nautilus-adapter-control-embed-strategy.h
*/
#ifndef NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_H
#define NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_H
#include "nautilus-adapter-embed-strategy.h"
#define NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY (nautilus_adapter_control_embed_strategy_get_type ())
#define NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY, NautilusAdapterControlEmbedStrategy))
#define NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY, NautilusAdapterControlEmbedStrategyClass))
#define NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY))
#define NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY))
typedef struct NautilusAdapterControlEmbedStrategyDetails NautilusAdapterControlEmbedStrategyDetails;
typedef struct {
NautilusAdapterEmbedStrategy parent;
NautilusAdapterControlEmbedStrategyDetails *details;
} NautilusAdapterControlEmbedStrategy;
typedef struct {
NautilusAdapterEmbedStrategyClass parent;
} NautilusAdapterControlEmbedStrategyClass;
/* GObject support */
GType nautilus_adapter_control_embed_strategy_get_type (void);
NautilusAdapterEmbedStrategy *nautilus_adapter_control_embed_strategy_new (Bonobo_Control control,
Bonobo_UIContainer ui_container);
#endif /* NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_H */
/* -*- 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; see the file COPYING. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Maciej Stachowiak <mjs@eazel.com>
*/
/* nautilus-adapter-control_factory-embed-strategy.c -
*/
#include <config.h>
#include "nautilus-adapter-control-factory-embed-strategy.h"
#include "nautilus-adapter-embed-strategy-private.h"
#include "nautilus-zoomable-proxy.h"
#include <bonobo/bonobo-control-frame.h>
#include <eel/eel-gtk-macros.h>
#include <libnautilus/nautilus-view.h>
struct NautilusAdapterControlFactoryEmbedStrategyDetails {
Bonobo_ControlFactory control_factory;
BonoboControlFrame *control_frame;
GtkWidget *client_widget;
BonoboObject *zoomable;
};
static void nautilus_adapter_control_factory_embed_strategy_class_init (NautilusAdapterControlFactoryEmbedStrategyClass *klass);
static void nautilus_adapter_control_factory_embed_strategy_init (NautilusAdapterControlFactoryEmbedStrategy *strategy);
static void nautilus_adapter_control_factory_embed_strategy_destroy (GtkObject *object);
static void nautilus_adapter_control_factory_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
gpointer ui_container);
static void nautilus_adapter_control_factory_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *object);
static GtkWidget *nautilus_adapter_control_factory_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
static BonoboObject *nautilus_adapter_control_factory_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
EEL_CLASS_BOILERPLATE (NautilusAdapterControlFactoryEmbedStrategy, nautilus_adapter_control_factory_embed_strategy, NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY)
static void
nautilus_adapter_control_factory_embed_strategy_class_init (NautilusAdapterControlFactoryEmbedStrategyClass *klass)
{
GtkObjectClass *object_class;
NautilusAdapterEmbedStrategyClass *adapter_embed_strategy_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = nautilus_adapter_control_factory_embed_strategy_destroy;
adapter_embed_strategy_class = NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS (klass);
adapter_embed_strategy_class->get_widget = nautilus_adapter_control_factory_embed_strategy_get_widget;
adapter_embed_strategy_class->get_zoomable = nautilus_adapter_control_factory_embed_strategy_get_zoomable;
adapter_embed_strategy_class->activate = nautilus_adapter_control_factory_embed_strategy_activate;
adapter_embed_strategy_class->deactivate = nautilus_adapter_control_factory_embed_strategy_deactivate;
}
static void
nautilus_adapter_control_factory_embed_strategy_init (NautilusAdapterControlFactoryEmbedStrategy *strategy)
{
strategy->details = g_new0 (NautilusAdapterControlFactoryEmbedStrategyDetails, 1);
}
static void
nautilus_adapter_control_factory_embed_strategy_destroy (GtkObject *object)
{
NautilusAdapterControlFactoryEmbedStrategy *strategy;
strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (object);
bonobo_object_unref (strategy->details->control_frame);
g_free (strategy->details);
strategy->details = NULL;
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
static void
nautilus_adapter_control_factory_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
gpointer ui_container)
{
NautilusAdapterControlFactoryEmbedStrategy *strategy;