mirror of https://github.com/GNOME/gimp.git
Basic bonobo framework, plus clean up the gnome initialization code.
Basic bonobo framework, plus clean up the gnome initialization code.
This commit is contained in:
parent
19efd21671
commit
aabace97bb
|
@ -27,7 +27,20 @@ libgimpim_a_SOURCES = \
|
|||
gimpsignal.c \
|
||||
gimpsignal.h
|
||||
|
||||
# XXX TODO: Find a way to conditionally compile these in based on whether
|
||||
# we are having GNOME & Bonobo support or not.
|
||||
|
||||
gimp_GNOME_SOURCES=\
|
||||
gimp-corba.c \
|
||||
gimp-corba.h
|
||||
|
||||
gimp_BONOBO_SOURCES=\
|
||||
gimp-bonobo.c \
|
||||
gimp-bonobo.h
|
||||
|
||||
gimp_SOURCES = \
|
||||
$(gimp_GNOME_SOURCES) \
|
||||
$(gimp_BONOBO_SOURCES) \
|
||||
about_dialog.c \
|
||||
about_dialog.h \
|
||||
actionarea.c \
|
||||
|
@ -478,3 +491,8 @@ endif # WITH_GNU_MAKE
|
|||
endif # ENABLE_GCG_DEPS
|
||||
endif # WITH_GCG
|
||||
# end GCG stuff
|
||||
|
||||
gnorbadir = $(sysconfdir)/CORBA/servers
|
||||
gnorba_DATA = gimp.goad
|
||||
|
||||
EXTRA_DIST = $(gnorba_DATA)
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
|
||||
* Copyright (C) 1999 Elliot Lee
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Bonobo support for the GIMP.
|
||||
*
|
||||
* Author: Elliot Lee <sopwith@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gimp-bonobo.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gdisplay.h"
|
||||
|
||||
typedef struct {
|
||||
GnomeEmbeddable *bonobo_object;
|
||||
|
||||
GList *views;
|
||||
|
||||
GimpImage *gimp_image;
|
||||
} bonobo_object_data_t;
|
||||
|
||||
typedef struct {
|
||||
GDisplay *gdisplay;
|
||||
bonobo_object_data_t *parent;
|
||||
} bonobo_view_t;
|
||||
|
||||
static GnomeObject *
|
||||
gimp_object_factory (GnomeEmbeddableFactory *this, void *data);
|
||||
|
||||
static GnomeView *
|
||||
gimp_view_factory (GnomeEmbeddable *bonobo_object,
|
||||
const GNOME_ViewFrame view_frame,
|
||||
void *data);
|
||||
static void
|
||||
gimp_view_destroy (GnomeView *view, bonobo_view_t *view_data);
|
||||
|
||||
static int
|
||||
gimp_stream_load_image (GnomePersistStream *ps, GNOME_Stream stream, void *data);
|
||||
|
||||
static int
|
||||
gimp_stream_save_image (GnomePersistStream *ps, GNOME_Stream stream, void *data);
|
||||
|
||||
void
|
||||
gimp_bonobo_init(void)
|
||||
{
|
||||
gnome_embeddable_factory_new ("bonobo-object-factory:gimp-image",
|
||||
gimp_object_factory, NULL);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
gimp_object_factory (GnomeEmbeddableFactory *this, void *data)
|
||||
{
|
||||
GnomeEmbeddable *bonobo_object;
|
||||
GnomePersistStream *stream;
|
||||
bonobo_object_data_t *bonobo_object_data;
|
||||
|
||||
bonobo_object_data = g_new0 (bonobo_object_data_t, 1);
|
||||
|
||||
bonobo_object = gnome_embeddable_new (gimp_view_factory, bonobo_object_data);
|
||||
if (bonobo_object == NULL)
|
||||
goto out;
|
||||
|
||||
stream = gnome_persist_stream_new (gimp_stream_load_image,
|
||||
gimp_stream_save_image,
|
||||
bonobo_object_data);
|
||||
if (stream == NULL)
|
||||
goto out;
|
||||
|
||||
bonobo_object_data->bonobo_object = bonobo_object;
|
||||
|
||||
gnome_object_add_interface (GNOME_OBJECT (bonobo_object),
|
||||
GNOME_OBJECT (stream));
|
||||
return (GnomeObject *) bonobo_object;
|
||||
|
||||
out:
|
||||
if (bonobo_object)
|
||||
gtk_object_unref (GTK_OBJECT (bonobo_object));
|
||||
if (bonobo_object_data)
|
||||
g_free (bonobo_object_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GnomeView *
|
||||
gimp_view_factory (GnomeEmbeddable *bonobo_object,
|
||||
const GNOME_ViewFrame view_frame,
|
||||
void *data)
|
||||
{
|
||||
bonobo_object_data_t *bonobo_object_data = data;
|
||||
bonobo_view_t *view_data;
|
||||
GnomeView *view;
|
||||
|
||||
view_data = g_new0 (bonobo_view_t, 1);
|
||||
view_data->parent = bonobo_object_data;
|
||||
view_data->gdisplay = gdisplay_new (bonobo_object_data->gimp_image, 0x0101);
|
||||
|
||||
view = gnome_view_new(view_data->gdisplay->shell);
|
||||
gtk_signal_connect (GTK_OBJECT (view), "destroy",
|
||||
GTK_SIGNAL_FUNC(gimp_view_destroy), view_data);
|
||||
|
||||
bonobo_object_data->views = g_list_prepend (bonobo_object_data->views,
|
||||
view_data);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_view_destroy (GnomeView *view, bonobo_view_t *view_data)
|
||||
{
|
||||
view_data->parent->views = g_list_remove(view_data->parent->views, view_data);
|
||||
gdisplay_remove_and_delete(view_data->gdisplay);
|
||||
|
||||
g_free(view_data);
|
||||
}
|
||||
|
||||
static int
|
||||
gimp_stream_load_image (GnomePersistStream *ps, GNOME_Stream stream, void *data)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
gimp_stream_save_image (GnomePersistStream *ps, GNOME_Stream stream, void *data)
|
||||
{
|
||||
return -1;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
|
||||
* Copyright (C) 1999 Elliot Lee
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Bonobo support for the GIMP.
|
||||
*
|
||||
* Author: Elliot Lee <sopwith@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef GIMP_BONOBO_H
|
||||
#define GIMP_BONOBO_H 1
|
||||
|
||||
#include <bonobo/gnome-bonobo.h>
|
||||
|
||||
void gimp_bonobo_init(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,38 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
* Copyright (C) 1999 Elliot Lee
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* GNOME CORBA integration for the GIMP.
|
||||
*
|
||||
* Author: Elliot Lee <sopwith@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gimp-corba.h"
|
||||
|
||||
void
|
||||
gimp_corba_init(void)
|
||||
{
|
||||
const char *goad_id;
|
||||
|
||||
goad_id = goad_server_activation_id();
|
||||
|
||||
/* Check for various functionality requests in the goad_id here... */
|
||||
|
||||
gimp_bonobo_init();
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
* Copyright (C) 1999 Elliot Lee
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* GNOME CORBA integration for the GIMP.
|
||||
*
|
||||
* Author: Elliot Lee <sopwith@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef GIMP_CORBA_H
|
||||
#define GIMP_CORBA_H 1
|
||||
|
||||
#include <gnome.h>
|
||||
#include <libgnorba/gnorba.h>
|
||||
|
||||
void gimp_corba_init(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,11 @@
|
|||
[bonobo-object-factory:gimp-image]
|
||||
type=exe
|
||||
repo_id=IDL:GNOME/EmbeddableFactory:1.0 IDL:GNOME/GenericFactory:1.0
|
||||
description=GIMP bonobo object factory
|
||||
location_info=gimp
|
||||
|
||||
[bonobo-object:gimp-image]
|
||||
type=factory
|
||||
repo_id=IDL:BonoboObject/gimp-image:1.0 IDL:GNOME/Embeddable:1.0
|
||||
description=GIMP image bonobo object
|
||||
location_info=bonobo-object-factory:gimp-image
|
140
app/main.c
140
app/main.c
|
@ -48,8 +48,10 @@
|
|||
|
||||
#ifdef HAVE_GNOME
|
||||
#include <gnome.h>
|
||||
#include "gimp-corba.h"
|
||||
#ifdef HAVE_BONOBO
|
||||
#include <bonobo/gnome-bonobo.h>
|
||||
#include "gimp-bonobo.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -87,6 +89,8 @@ char **batch_cmds;
|
|||
static int gimp_argc;
|
||||
static char **gimp_argv;
|
||||
|
||||
static int do_batch_cmds = 0;
|
||||
|
||||
/*
|
||||
* argv processing:
|
||||
* Arguments are either switches, their associated
|
||||
|
@ -108,15 +112,48 @@ static char **gimp_argv;
|
|||
* commands.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
static const struct poptOption gimp_options[] = {
|
||||
{"no-interface", 'n', POPT_ARG_NONE, &no_interface, 0,
|
||||
"No user interface", NULL},
|
||||
{"batch", 'b', POPT_ARG_NONE, &do_batch_cmds, 0,
|
||||
"Run batch command", NULL},
|
||||
{"system-gimprc", '\0', POPT_ARG_STRING, &alternate_system_gimprc, 0,
|
||||
"Specify an alternate system gimprc", "FILENAME"},
|
||||
{"gimprc", 'g', POPT_ARG_STRING, &alternate_gimprc, 0,
|
||||
"Specify an alternate user gimprc", "FILENAME"},
|
||||
{"no-data", '\0', POPT_ARG_NONE, &no_data, 0,
|
||||
"No data", NULL},
|
||||
{"no-splash", '\0', POPT_ARG_NONE, &no_splash, 0,
|
||||
"No splash screen", NULL},
|
||||
{"no-splash-image", '\0', POPT_ARG_NONE, &no_splash_image, 0,
|
||||
"No image on splash screen", NULL},
|
||||
{"verbose", '\0', POPT_ARG_NONE, &be_verbose, 0,
|
||||
"Be verbose", NULL},
|
||||
{"shm", '\0', POPT_ARG_INT, &use_shm, 0,
|
||||
"Use shared memory", "0/1"},
|
||||
{"debug-handlers", '\0', POPT_ARG_NONE, &use_debug_handler, 0,
|
||||
"Use debug handler", NULL},
|
||||
{"console-messages", '\0', POPT_ARG_NONE, &console_messages, 0,
|
||||
"Show console messages", NULL},
|
||||
{"restore-session", 'r', POPT_ARG_NONE, &restore_session, 0,
|
||||
"Restore previous session", NULL},
|
||||
{NULL, '\0', POPT_ARG_NONE, NULL, 0, NULL, NULL}
|
||||
};
|
||||
#endif
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int show_version;
|
||||
int show_help;
|
||||
int i, j;
|
||||
#ifdef HAVE_PUTENV
|
||||
#if defined(HAVE_PUTENV) && !defined(HAVE_GNOME)
|
||||
gchar *display_name, *display_env;
|
||||
#endif
|
||||
#ifdef HAVE_GNOME
|
||||
poptContext poptctx;
|
||||
#else
|
||||
int i, j;
|
||||
#endif
|
||||
|
||||
g_atexit (g_mem_profile);
|
||||
|
||||
|
@ -141,37 +178,6 @@ main (int argc, char **argv)
|
|||
#endif
|
||||
textdomain("gimp");
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
/* XXX cmdline args are broken */
|
||||
#ifdef HAVE_BONOBO
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_ORB orb;
|
||||
PortableServer_POA poa;
|
||||
PortableServer_POAManager poam;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
orb = gnome_CORBA_init ("gimp", "1.1", &argc, argv, GNORBA_INIT_SERVER_FUNC, &ev);
|
||||
poa = CORBA_ORB_resolve_initial_references(orb, "RootPOA", &ev);
|
||||
poam = PortableServer_POA__get_the_POAManager(poa, &ev);
|
||||
bonobo_init(orb, poa, poam);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
#else
|
||||
gnome_init ("gimp", "1.1", argc, argv);
|
||||
#endif
|
||||
#else
|
||||
gtk_init (&argc, &argv);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PUTENV
|
||||
display_name = gdk_get_display ();
|
||||
display_env = g_new (gchar, strlen (display_name) + 9);
|
||||
*display_env = 0;
|
||||
strcat (display_env, "DISPLAY=");
|
||||
strcat (display_env, display_name);
|
||||
putenv (display_env);
|
||||
#endif
|
||||
|
||||
no_interface = FALSE;
|
||||
no_data = FALSE;
|
||||
|
@ -199,6 +205,65 @@ main (int argc, char **argv)
|
|||
show_version = FALSE;
|
||||
show_help = FALSE;
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
#ifdef HAVE_BONOBO
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
gnome_CORBA_init_with_popt_table ("gimp", GIMP_VERSION, &argc, argv,
|
||||
gimp_options, 0, &poptctx,
|
||||
GNORBA_INIT_SERVER_FUNC, &ev);
|
||||
bonobo_init(CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
|
||||
|
||||
gimp_corba_init();
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
#else
|
||||
gnome_init_with_popt_table ("gimp", GIMP_VERSION, argc, argv,
|
||||
gimp_options, 0, &poptctx);
|
||||
#endif
|
||||
|
||||
{ /* Copy the leftover arguments array from popt */
|
||||
int n;
|
||||
char **ctmp;
|
||||
|
||||
ctmp = poptGetArgs(poptctx);
|
||||
if(ctmp) {
|
||||
for(n = 0; ctmp[n]; n++) /**/ ;
|
||||
|
||||
if(do_batch_cmds) {
|
||||
for(n = 0; ctmp[n]; n++)
|
||||
batch_cmds[n] = ctmp[n];
|
||||
batch_cmds[n] = NULL;
|
||||
} else {
|
||||
gimp_argc = n;
|
||||
gimp_argv = g_new(char *, n);
|
||||
for(n = 0; ctmp[n]; n++)
|
||||
gimp_argv[n] = ctmp[n];
|
||||
}
|
||||
} else {
|
||||
static char * dummy[1];
|
||||
dummy[0] = argv[0];
|
||||
gimp_argc = 1;
|
||||
gimp_argv = dummy;
|
||||
}
|
||||
}
|
||||
poptFreeContext(poptctx);
|
||||
|
||||
#else /* start !HAVE_GNOME */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
#ifdef HAVE_PUTENV
|
||||
display_name = gdk_get_display ();
|
||||
display_env = g_new (gchar, strlen (display_name) + 9);
|
||||
*display_env = 0;
|
||||
strcat (display_env, "DISPLAY=");
|
||||
strcat (display_env, display_name);
|
||||
putenv (display_env);
|
||||
#endif
|
||||
|
||||
test_gserialize ();
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
|
@ -310,6 +375,11 @@ main (int argc, char **argv)
|
|||
show_help = TRUE;
|
||||
}
|
||||
}
|
||||
/* Keep the command line arguments--for use in gimp_init */
|
||||
gimp_argc = argc - 1;
|
||||
gimp_argv = argv + 1;
|
||||
|
||||
#endif /* end !HAVE_GNOME */
|
||||
|
||||
if (show_version)
|
||||
g_print ( "%s %s\n", _("GIMP version"), GIMP_VERSION);
|
||||
|
@ -378,10 +448,6 @@ main (int argc, char **argv)
|
|||
g_log_set_handler (NULL, G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
|
||||
on_error, NULL);
|
||||
|
||||
/* Keep the command line arguments--for use in gimp_init */
|
||||
gimp_argc = argc - 1;
|
||||
gimp_argv = argv + 1;
|
||||
|
||||
/* Check the installation */
|
||||
install_verify (init);
|
||||
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
if test -z "$*"; then
|
||||
echo "I am going to run ./configure with no arguments - if you wish "
|
||||
echo "I am going to run $srcdir/configure with no arguments - if you wish "
|
||||
echo "to pass any to it, please specify them on the $0 command line."
|
||||
fi
|
||||
|
||||
echo processing...
|
||||
|
||||
THEDIR=`pwd`
|
||||
cd $srcdir &&
|
||||
aclocal $ACLOCAL_FLAGS &&
|
||||
automake -a --foreign &&
|
||||
autoconf &&
|
||||
./configure "$@"
|
||||
cd $THEDIR &&
|
||||
$srcdir/configure "$@"
|
||||
|
||||
if [ $? -eq 0 ];then
|
||||
echo "Now run './configure', then 'make' to compile GCG."
|
||||
|
|
Loading…
Reference in New Issue