diff options
author | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-09-15 08:33:12 +0000 |
---|---|---|
committer | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-09-15 08:33:12 +0000 |
commit | c270eb7275d301890441f1ce46db813a0a410603 (patch) | |
tree | 6ff03571d305b42a246e493abde34b4016418797 | |
parent | 61b06c94a3b9f783c6ca6b91c607b83c7e64328b (diff) | |
download | nautilus-c270eb7275d301890441f1ce46db813a0a410603.tar.gz |
Some work towards 1994.
* libnautilus-adapter/nautilus-adapter-factory.idl: Changed
`object' argument to `component'.
* configure.in: Generate Makefile for components/adapter
directory.
* components/Makefile.am: Add adapter subdir to build.
* components/adapter/Makefile.am, components/adapter/main.c,
components/adapter/nautilus-adapter-factory-server.c,
components/adapter/nautilus-adapter-factory-server.h,
components/adapter/nautilus-adapter.oafinfo: Skeleton for the
adapter component.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | components/Makefile.am | 1 | ||||
-rw-r--r-- | components/adapter/Makefile.am | 37 | ||||
-rw-r--r-- | components/adapter/Nautilus_ComponentAdapterFactory_std.oaf.in | 12 | ||||
-rw-r--r-- | components/adapter/Nautilus_ComponentAdapterFactory_std.server.in | 12 | ||||
-rw-r--r-- | components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in | 12 | ||||
-rw-r--r-- | components/adapter/main.c | 117 | ||||
-rw-r--r-- | components/adapter/nautilus-adapter-factory-server.c | 183 | ||||
-rw-r--r-- | components/adapter/nautilus-adapter-factory-server.h | 57 | ||||
-rw-r--r-- | components/adapter/nautilus-adapter.oafinfo | 12 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | libnautilus-adapter/nautilus-adapter-factory.idl | 2 |
12 files changed, 463 insertions, 2 deletions
@@ -1,3 +1,19 @@ +2000-09-15 Maciej Stachowiak <mjs@eazel.com> + + Some work towards 1994. + + * libnautilus-adapter/nautilus-adapter-factory.idl: Changed + `object' argument to `component'. + * configure.in: Generate Makefile for components/adapter + directory. + * components/Makefile.am: Add adapter subdir to build. + + * components/adapter/Makefile.am, components/adapter/main.c, + components/adapter/nautilus-adapter-factory-server.c, + components/adapter/nautilus-adapter-factory-server.h, + components/adapter/nautilus-adapter.oafinfo: Skeleton for the + adapter component. + 2000-09-14 Pavel Cisler <pavel@eazel.com> * libnautilus-extensions/nautilus-file-operations.c: diff --git a/components/Makefile.am b/components/Makefile.am index c1329894e..07c2cfe6a 100644 --- a/components/Makefile.am +++ b/components/Makefile.am @@ -18,6 +18,7 @@ endif # SUBDIRS = \ + adapter \ hardware \ help \ history \ diff --git a/components/adapter/Makefile.am b/components/adapter/Makefile.am new file mode 100644 index 000000000..bfa76b402 --- /dev/null +++ b/components/adapter/Makefile.am @@ -0,0 +1,37 @@ +CPPFLAGS = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-Adapter\" \ + -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" + +INCLUDES=-I$(top_srcdir) -I$(top_builddir) -I. \ + $(GNOMEUI_CFLAGS) \ + $(BONOBOX_CFLAGS) \ + $(OAF_CFLAGS) \ + $(XML_CFLAGS) \ + -D_REENTRANT + +oafdir = $(datadir)/oaf + +oaf_DATA = \ + nautilus-adapter.oafinfo + +bin_PROGRAMS = \ + nautilus-adapter + +nautilus_adapter_SOURCES = \ + main.c \ + nautilus-adapter-factory-server.h \ + nautilus-adapter-factory-server.c + +nautilus_adapter_LDADD = \ + $(top_builddir)/libnautilus/libnautilus.la \ + $(top_builddir)/libnautilus-adapter/libnautilus-adapter.la \ + $(GNOMEUI_LIBS) \ + $(OAF_LIBS) \ + $(BONOBOX_LIBS) \ + $(VFS_LIBS) \ + $(XML_LIBS) \ + $(LIBPNG) + + +EXTRA_DIST = $(oaf_DATA) diff --git a/components/adapter/Nautilus_ComponentAdapterFactory_std.oaf.in b/components/adapter/Nautilus_ComponentAdapterFactory_std.oaf.in new file mode 100644 index 000000000..4810ac951 --- /dev/null +++ b/components/adapter/Nautilus_ComponentAdapterFactory_std.oaf.in @@ -0,0 +1,12 @@ +<oaf_info> + +<oaf_server iid="OAFIID:nautilus_adapter:fd24ecfc-0a6e-47ab-bc53-69d7487c6ad4" type="exe" location="nautilus-adapter"> +<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> diff --git a/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in b/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in new file mode 100644 index 000000000..4810ac951 --- /dev/null +++ b/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in @@ -0,0 +1,12 @@ +<oaf_info> + +<oaf_server iid="OAFIID:nautilus_adapter:fd24ecfc-0a6e-47ab-bc53-69d7487c6ad4" type="exe" location="nautilus-adapter"> +<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> diff --git a/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in b/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in new file mode 100644 index 000000000..4810ac951 --- /dev/null +++ b/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in @@ -0,0 +1,12 @@ +<oaf_info> + +<oaf_server iid="OAFIID:nautilus_adapter:fd24ecfc-0a6e-47ab-bc53-69d7487c6ad4" type="exe" location="nautilus-adapter"> +<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> diff --git a/components/adapter/main.c b/components/adapter/main.c new file mode 100644 index 000000000..cbb060391 --- /dev/null +++ b/components/adapter/main.c @@ -0,0 +1,117 @@ +/* -*- 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 <stdlib.h> +#include <gtk/gtkmain.h> +#include <libgnome/gnome-defs.h> /* must come before gnome-init.h */ +#include <libgnomeui/gnome-init.h> /* must come before liboaf.h */ +#include <liboaf/liboaf.h> +#include <bonobo/bonobo-generic-factory.h> +#include <bonobo/bonobo-main.h> +#include "nautilus-adapter-factory-server.h" + +#define META_FACTORY_IID "OAFIID:nautilus_adapter_factory_generic_factory:8e62e106-807d-4d37-b14a-00dc82ecf88f" + + +#define FACTORY_OBJECT_IID "OAFIID:nautilus_adapter_factory:fd24ecfc-0a6e-47ab-bc53-69d7487c6ad4" + +static int object_count = 0; + +static void +adapter_factory_object_destroyed (GtkObject *object) +{ + g_assert (GTK_IS_OBJECT (object)); + + object_count--; + if (object_count <= 0) { + gtk_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; + } + + /* Create the view. The way this sample is set up, we create a + * widget which makes the NautilusView object as part of it's + * initialization. This is a bit backwards as it's the view + * that owns the widget. + */ + adapter = NAUTILUS_ADAPTER_FACTORY_SERVER (gtk_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++; + gtk_signal_connect (GTK_OBJECT (adapter), "destroy", + adapter_factory_object_destroyed, NULL); + + return BONOBO_OBJECT (adapter); +} + +int +main (int argc, char *argv[]) +{ + CORBA_ORB orb; + BonoboGenericFactory *factory; + + /* Initialize libraries. */ + gnome_init_with_popt_table ("nautilus-adapter", VERSION, + argc, argv, + oaf_popt_options, 0, NULL); + orb = oaf_init (argc, argv); + bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL); + + /* Create the factory. */ + factory = bonobo_generic_factory_new_multi (META_FACTORY_IID, adapter_factory_make_object, NULL); + + /* Loop until we have no more objects. */ + do { + bonobo_main (); + } while (object_count > 0); + + /* Let the factory go. */ + bonobo_object_unref (BONOBO_OBJECT (factory)); + + return EXIT_SUCCESS; +} diff --git a/components/adapter/nautilus-adapter-factory-server.c b/components/adapter/nautilus-adapter-factory-server.c new file mode 100644 index 000000000..a586a5e2d --- /dev/null +++ b/components/adapter/nautilus-adapter-factory-server.c @@ -0,0 +1,183 @@ +/* -*- 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-factory-server.c - + */ + +#include <config.h> +#include "nautilus-adapter-factory-server.h" + +#include <bonobo/bonobo-control.h> +#include <bonobo/bonobo-main.h> +#include <gtk/gtksignal.h> +#include <gdk-pixbuf/gdk-pixbuf.h> +#include <libgnome/gnome-i18n.h> +#include <libgnomeui/gnome-stock.h> +#include <libnautilus/nautilus-bonobo-ui.h> +#include <libnautilus-extensions/nautilus-gtk-macros.h> +#include <libnautilus-adapter/nautilus-adapter-factory.h> + + +struct NautilusAdapterFactoryServerDetails { +}; + +typedef struct { + POA_Nautilus_ComponentAdapterFactory servant; + NautilusAdapterFactoryServer *bonobo_object; +} impl_POA_Nautilus_ComponentAdapterFactory; + + + +static Nautilus_View +impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant servant, + const Bonobo_Unknown component, + CORBA_Environment *ev); + +static void +impl_Nautilus_ComponentAdapterFactory__destroy (BonoboObject *object, + PortableServer_Servant servant); + +static Nautilus_ComponentAdapterFactory +impl_Nautilus_ComponentAdapterFactory__create (NautilusAdapterFactoryServer *bonobo_object, + CORBA_Environment *ev); + + +POA_Nautilus_ComponentAdapterFactory__epv impl_Nautilus_ComponentAdapterFactory_epv = +{ + NULL, + &impl_Nautilus_ComponentAdapterFactory_create_adapter +}; + + +static PortableServer_ServantBase__epv base_epv; + +static POA_Nautilus_ComponentAdapterFactory__vepv impl_Nautilus_ComponentAdapterFactory_vepv = +{ + &base_epv, + NULL, + &impl_Nautilus_ComponentAdapterFactory_epv +}; + + + +static void nautilus_adapter_factory_server_initialize_class (NautilusAdapterFactoryServerClass *klass); +static void nautilus_adapter_factory_server_initialize (NautilusAdapterFactoryServer *server); +static void nautilus_adapter_factory_server_destroy (GtkObject *object); + + +NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusAdapterFactoryServer, + nautilus_adapter_factory_server, + BONOBO_OBJECT_TYPE) + + + +static void +nautilus_adapter_factory_server_initialize_class (NautilusAdapterFactoryServerClass *klass) +{ + GtkObjectClass *object_class; + + g_assert (NAUTILUS_IS_ADAPTER_FACTORY_SERVER_CLASS (klass)); + + object_class = GTK_OBJECT_CLASS (klass); + + object_class->destroy = nautilus_adapter_factory_server_destroy; +} + +static void +nautilus_adapter_factory_server_initialize (NautilusAdapterFactoryServer *server) +{ + CORBA_Environment ev; + + CORBA_exception_init (&ev); + + g_assert (NAUTILUS_IS_ADAPTER_FACTORY_SERVER (server)); + + server->details = g_new0 (NautilusAdapterFactoryServerDetails, 1); + + bonobo_object_construct + (BONOBO_OBJECT (server), + impl_Nautilus_ComponentAdapterFactory__create (server, &ev)); + + CORBA_exception_free (&ev); +} + +static void +nautilus_adapter_factory_server_destroy (GtkObject *object) +{ + NautilusAdapterFactoryServer *server; + + server = NAUTILUS_ADAPTER_FACTORY_SERVER (object); + + g_free (server->details); + + NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); +} + + +static Nautilus_View +impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant servant, + const Bonobo_Unknown component, + CORBA_Environment *ev) +{ + return CORBA_OBJECT_NIL; +} + +static void +impl_Nautilus_ComponentAdapterFactory__destroy (BonoboObject *object, + PortableServer_Servant servant) +{ + PortableServer_ObjectId *object_id; + CORBA_Environment ev; + + CORBA_exception_init (&ev); + + object_id = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev); + PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev); + CORBA_free (object_id); + + object->servant = NULL; + + POA_Nautilus_ComponentAdapterFactory__fini (servant, &ev); + g_free (servant); + + CORBA_exception_free (&ev); +} + +static Nautilus_ComponentAdapterFactory +impl_Nautilus_ComponentAdapterFactory__create (NautilusAdapterFactoryServer *bonobo_object, + CORBA_Environment *ev) +{ + impl_POA_Nautilus_ComponentAdapterFactory *servant; + + impl_Nautilus_ComponentAdapterFactory_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); + + servant = g_new0 (impl_POA_Nautilus_ComponentAdapterFactory, 1); + servant->servant.vepv = &impl_Nautilus_ComponentAdapterFactory_vepv; + POA_Nautilus_ComponentAdapterFactory__init ((PortableServer_Servant) servant, ev); + + gtk_signal_connect (GTK_OBJECT (bonobo_object), "destroy", + GTK_SIGNAL_FUNC (impl_Nautilus_ComponentAdapterFactory__destroy), servant); + + servant->bonobo_object = bonobo_object; + return bonobo_object_activate_servant (BONOBO_OBJECT (bonobo_object), servant); +} diff --git a/components/adapter/nautilus-adapter-factory-server.h b/components/adapter/nautilus-adapter-factory-server.h new file mode 100644 index 000000000..fa0c2f1bc --- /dev/null +++ b/components/adapter/nautilus-adapter-factory-server.h @@ -0,0 +1,57 @@ +/* -*- 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_factory_server-content-view.h - Adapter_Factory_Server view component. This + * component just displays a simple message and includes a menu item + * and a toolbar button else. It should be a good basis for writing + * Nautilus view components. + */ + +#ifndef NAUTILUS_ADAPTER_FACTORY_SERVER_H +#define NAUTILUS_ADAPTER_FACTORY_SERVER_H + +#include <gtk/gtklabel.h> +#include <libnautilus/nautilus-view.h> + +#define NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER (nautilus_adapter_factory_server_get_type ()) +#define NAUTILUS_ADAPTER_FACTORY_SERVER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServer)) +#define NAUTILUS_ADAPTER_FACTORY_SERVER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServerClass)) +#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER)) +#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER)) + +typedef struct NautilusAdapterFactoryServerDetails NautilusAdapterFactoryServerDetails; + +typedef struct { + BonoboObject parent; + NautilusAdapterFactoryServerDetails *details; +} NautilusAdapterFactoryServer; + +typedef struct { + BonoboObjectClass parent; +} NautilusAdapterFactoryServerClass; + +/* GtkObject support */ +GtkType nautilus_adapter_factory_server_get_type (void); + + +#endif /* NAUTILUS_ADAPTER_FACTORY_SERVER_H */ diff --git a/components/adapter/nautilus-adapter.oafinfo b/components/adapter/nautilus-adapter.oafinfo new file mode 100644 index 000000000..4810ac951 --- /dev/null +++ b/components/adapter/nautilus-adapter.oafinfo @@ -0,0 +1,12 @@ +<oaf_info> + +<oaf_server iid="OAFIID:nautilus_adapter:fd24ecfc-0a6e-47ab-bc53-69d7487c6ad4" type="exe" location="nautilus-adapter"> +<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> diff --git a/configure.in b/configure.in index 67254f5bb..67198e4b7 100644 --- a/configure.in +++ b/configure.in @@ -1,3 +1,4 @@ + AC_INIT(src) if test -n "$GNOME2_PATH"; then @@ -280,8 +281,8 @@ AC_MSG_ERROR([ *** Gtk+ 1.2.0 or better is required. The latest version of GTK *** is always available from ftp://ftp.gtk.org/.])) - AM_PATH_GNOME(1.0.0,,AC_MSG_ERROR([*** GNOME 1.0.0 or better is required.]), gnomecanvaspixbuf bonobo bonobox bonobox_print vfs idl) + AC_SUBST(GNOMECANVASPIXBUF_LIBS) AC_SUBST(GNOMECANVASPIXBUF_INCLUDEDIR) AC_SUBST(GNORBA_CFLAGS) @@ -523,6 +524,7 @@ libnautilus-extensions/Makefile src/Makefile src/file-manager/Makefile components/Makefile +components/adapter/Makefile components/hardware/Makefile components/hardware/icons/Makefile components/history/Makefile diff --git a/libnautilus-adapter/nautilus-adapter-factory.idl b/libnautilus-adapter/nautilus-adapter-factory.idl index f96aec8c5..9262a5f85 100644 --- a/libnautilus-adapter/nautilus-adapter-factory.idl +++ b/libnautilus-adapter/nautilus-adapter-factory.idl @@ -36,7 +36,7 @@ module Nautilus { interface ComponentAdapterFactory : Bonobo::Unknown { /* FIXME: should use exceptions to report reasons for failure. */ - Nautilus::View create_adapter (in Bonobo::Unknown object); + Nautilus::View create_adapter (in Bonobo::Unknown component); }; }; |