From c80c14ffd0ace81afa80c82a137494900fcc0f14 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Fri, 7 Jan 2000 00:25:56 +0000 Subject: More framework work -miguel svn path=/trunk/; revision=1539 --- shell/Makefile.am | 14 +++++--- shell/Shell.idl | 19 ++++++++++ shell/e-init.c | 34 ++++++++++++++++++ shell/e-init.h | 8 +++++ shell/e-shell.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ shell/e-shell.h | 32 +++++++++++++++++ shell/main.c | 59 ++++++++++++++++++++++++++++++ 7 files changed, 268 insertions(+), 4 deletions(-) create mode 100644 shell/Shell.idl create mode 100644 shell/e-init.c create mode 100644 shell/e-init.h create mode 100644 shell/e-shell.c create mode 100644 shell/e-shell.h create mode 100644 shell/main.c (limited to 'shell') diff --git a/shell/Makefile.am b/shell/Makefile.am index 03f4e49c1a..ad231b6352 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -7,13 +7,19 @@ INCLUDES = \ -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ -I$(srcdir)/../widgets \ - $(EXTRA_GNOME_CFLAGS) + $(BONOBO_GNOME_CFLAGS) evolution_SOURCES = \ - main.c + main.c \ + e-init.c \ + e-init.h \ + e-shell.c \ + e-shell.h + evolution_LDADD = \ - -L../widgets/shortcut-bar/libshortcut-bar.a \ - $(EXTRA_GNOME_LIBS) + ../widgets/shortcut-bar/libshortcut-bar.a \ + ../e-util/libeutil.a \ + $(BONOBO_GNOME_LIBS) diff --git a/shell/Shell.idl b/shell/Shell.idl new file mode 100644 index 0000000000..0d615b6b3b --- /dev/null +++ b/shell/Shell.idl @@ -0,0 +1,19 @@ +/* + * CORBA interface for the Evolution shell + * + * Authors: + * Miguel de Icaza (miguel@kernel.org) + * + * (C) 2000 Helix Code, Inc. + */ +#include + +module GNOME { + + module Evolution { + + interface Shell : GNOME::Unknown { + + }; + }; +}; diff --git a/shell/e-init.c b/shell/e-init.c new file mode 100644 index 0000000000..34ccdbcfc3 --- /dev/null +++ b/shell/e-init.c @@ -0,0 +1,34 @@ +/* + * e-init.c: Initializes Evolution for first time users + * + */ +#include +#include +#include "e-init.h" +#include +#include +#include +#include +#include "e-util/e-gui-utils.h" + +char *evolution_base_dir; + +static void +e_init_local (void) +{ + evolution_base_dir = g_concat_dir_and_file (g_get_home_dir (), "Evolution"); + + if (g_file_exists (evolution_base_dir)) + return; + + if (-1 == mkdir (evolution_base_dir, 0755)){ + e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Evolution can not create its local folders")); + exit (0); + } +} + +void +e_init (void) +{ + e_init_local (); +} diff --git a/shell/e-init.h b/shell/e-init.h new file mode 100644 index 0000000000..5684f87b44 --- /dev/null +++ b/shell/e-init.h @@ -0,0 +1,8 @@ +#ifndef E_INIT_H +#define E_INIT_H + +extern char *evolution_base_dir; + +void e_init (void); + +#endif /* E_INIT_H */ diff --git a/shell/e-shell.c b/shell/e-shell.c new file mode 100644 index 0000000000..ef03135102 --- /dev/null +++ b/shell/e-shell.c @@ -0,0 +1,106 @@ +/* + * E-shell.c: Shell object for Evolution + * + * Authors: + * Miguel de Icaza (miguel@helixcode.com) + * + * (C) 1999 Miguel de Icaza + * (C) 2000 Helix Code, Inc. + */ +#include +#include "Shell.h" +#include "e-util/e-util.h" +#include "e-shell.h" + +#define PARENT_TYPE (gnome_object_get_type ()) + +static GnomeObjectClass *e_shell_parent_class; +POA_GNOME_Evolution_Shell__vepv eshell_vepv; + +GtkType e_shell_get_type (void); + +static POA_GNOME_Evolution_Shell__epv * +e_shell_get_epv (void) +{ + POA_GNOME_Evolution_Shell__epv *epv; + + epv = g_new0 (POA_GNOME_Evolution_Shell__epv, 1); + + return epv; +} + +static void +init_e_shell_corba_class (void) +{ + eshell_vepv.GNOME_Unknown_epv = gnome_object_get_epv (); + eshell_vepv.GNOME_Evolution_Shell_epv = e_shell_get_epv (); +} + +static void +e_shell_destroy (GtkObject *object) +{ + EShell *eshell = E_SHELL (object); + + if (eshell->base_uri) + g_free (eshell->base_uri); + + GTK_OBJECT_CLASS (e_shell_parent_class)->destroy (object); +} + +static void +e_shell_class_init (GtkObjectClass *object_class) +{ + e_shell_parent_class = gtk_type_class (PARENT_TYPE); + init_e_shell_corba_class (); + + object_class->destroy = e_shell_destroy; +} + +static void +e_shell_init (GtkObject *object) +{ + EShell *eshell = E_SHELL (object); + + eshell->gnome_app = gnome_app_new ("Evolution", "Evolution"); +} + +void +e_shell_set_base_uri (EShell *eshell, const char *base_uri) +{ + g_return_if_fail (eshell != NULL); + g_return_if_fail (!E_IS_SHELL (eshell)); + g_return_if_fail (base_uri != NULL); + + if (eshell->base_uri) + g_free (eshell->base_uri); + + eshell->base_uri = g_strdup (base_uri); +} + +const char * +e_shell_get_base_uri (EShell *eshell) +{ + g_return_val_if_fail (eshell != NULL, NULL); + g_return_val_if_fail (!E_IS_SHELL (eshell), NULL); + + return eshell->base_uri; +} + +EShell * +e_shell_new (const char *base_uri) +{ + EShell *eshell; + + g_return_val_if_fail (base_uri != NULL, NULL); + + eshell = gtk_type_new (e_shell_get_type ()); + e_shell_set_base_uri (eshell, base_uri); + + return eshell; +} + +E_MAKE_TYPE (e_shell, "EShell", EShell, e_shell_class_init, e_shell_init, PARENT_TYPE); + + + + diff --git a/shell/e-shell.h b/shell/e-shell.h new file mode 100644 index 0000000000..6574e1a6d0 --- /dev/null +++ b/shell/e-shell.h @@ -0,0 +1,32 @@ +#ifndef E_SHELL_H +#define E_SHELL_H + +#include +#include + +#define E_SHELL_GOAD_ID "GOADID:GNOME:Evolution:Shell:1.0" +#define E_SHELL_FACTORY_GOAD_ID "GOADID:GNOME:Evolution:ShellFactory:1.0" + +#define E_SHELL_TYPE (e_shell_get_type ()) +#define E_SHELL(o) (GTK_CHECK_CAST ((o), E_SHELL_TYPE, EShell)) +#define E_SHELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHELL_TYPE, EShellClass)) +#define E_IS_SHELL(o) (GTK_CHECK_TYPE ((o), E_SHELL_TYPE)) +#define E_IS_SHELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHELL_TYPE)) + +typedef struct { + GnomeObject base_object; + + GtkWidget *gnome_app; + + char *base_uri; +} EShell; + +typedef struct { + GnomeObjectClass *parent_class; +} EShellClass; + +EShell *e_shell_new (const char *base_uri); +void e_shell_set_base_uri (EShell *eshell, const char *base_uri); +const char *e_shell_get_base_uri (EShell *eshell); + +#endif /* EVOLUTION_SHELL_H */ diff --git a/shell/main.c b/shell/main.c new file mode 100644 index 0000000000..76375375dd --- /dev/null +++ b/shell/main.c @@ -0,0 +1,59 @@ +/* + * Main evolution shell application + * + * Authors: + * Miguel de Icaza (miguel@helixcode.com) + * + */ +#include +#include +#include +#include +#include +#include +#include +#include + +int shell_debugging = 0; + +poptContext ctx; + +const struct poptOption shell_popt_options [] = { + { "debug", '\0', POPT_ARG_INT, &shell_debugging, 0, + N_("Enables some debugging functions"), N_("LEVEL") }, + { NULL, '\0', 0, NULL, 0 } +}; + +int +main (int argc, char *argv []) +{ + CORBA_Environment ev; + + bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); + textdomain (PACKAGE); + + CORBA_exception_init (&ev); + gnome_CORBA_init_with_popt_table ( + "Evolution", VERSION, &argc, argv, + shell_popt_options, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev); + CORBA_exception_free (&ev); + + if (bonobo_init (gnome_CORBA_ORB (), NULL, NULL) == FALSE){ + e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, + _("Failed to initialize the Bonobo component system")); + return 0; + } + + e_cursors_init (); + + glade_gnome_init (); + + bonobo_activate (); + + gtk_main (); + + /* shutdown */ + e_cursors_shutdown (); + + return 0; +} -- cgit v1.2.3