aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/e-component-view.c141
-rw-r--r--shell/e-component-view.h78
-rw-r--r--shell/e-shell-view.c109
-rw-r--r--shell/e-shell-view.h70
4 files changed, 398 insertions, 0 deletions
diff --git a/shell/e-component-view.c b/shell/e-component-view.c
new file mode 100644
index 0000000000..831b102f3e
--- /dev/null
+++ b/shell/e-component-view.c
@@ -0,0 +1,141 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-component-view.c
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Helper class for evolution components to setup a view
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include "e-component-view.h"
+
+#include "bonobo/bonobo-control.h"
+
+static BonoboObjectClass *parent_class = NULL;
+
+static void
+impl_ComponentView_getControls(PortableServer_Servant servant,
+ Bonobo_Control *side_control,
+ Bonobo_Control *view_control,
+ Bonobo_Control *statusbar_control,
+ CORBA_Environment *ev)
+{
+ EComponentView *ecv = (EComponentView *)bonobo_object_from_servant(servant);
+
+ *side_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->side_control), ev);
+ *view_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->view_control), ev);
+ *statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->statusbar_control), ev);
+}
+
+/* GObject methods. */
+
+static void
+impl_dispose (GObject *object)
+{
+ EComponentView *ecv = (EComponentView *)object;
+
+ ecv->side_control = NULL;
+ ecv->view_control = NULL;
+ ecv->statusbar_control = NULL;
+
+ ((GObjectClass *)parent_class)->dispose(object);
+}
+
+static void
+impl_finalise (GObject *object)
+{
+ EComponentView *ecv = (EComponentView *)object;
+
+ g_free(ecv->id);
+
+ ((GObjectClass *)parent_class)->finalize(object);
+}
+
+static void
+e_component_view_class_init (EComponentViewClass *klass)
+{
+ GObjectClass *object_class;
+ POA_GNOME_Evolution_ComponentView__epv *epv;
+
+ parent_class = g_type_class_ref(bonobo_object_get_type());
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = impl_dispose;
+ object_class->finalize = impl_finalise;
+
+ epv = & klass->epv;
+ epv->getControls = impl_ComponentView_getControls;
+}
+
+static void
+e_component_view_init (EComponentView *shell)
+{
+}
+
+EComponentView *e_component_view_new(GNOME_Evolution_ShellView parent, const char *id, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *statusbar)
+{
+ EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
+ CORBA_Environment ev = { 0 };
+
+ new->id = g_strdup(id);
+ new->shell_view = CORBA_Object_duplicate(parent, &ev);
+ CORBA_exception_free(&ev);
+
+ /* FIXME: hook onto destroys */
+ new->side_control = bonobo_control_new(side);
+ new->view_control = bonobo_control_new(view);
+ new->statusbar_control = bonobo_control_new(statusbar);
+
+ return new;
+}
+
+EComponentView *e_component_view_new_controls(GNOME_Evolution_ShellView parent, const char *id, BonoboControl *side, BonoboControl *view, BonoboControl *statusbar)
+{
+ EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
+ CORBA_Environment ev = { 0 };
+
+ new->id = g_strdup(id);
+ new->shell_view = CORBA_Object_duplicate(parent, &ev);
+ CORBA_exception_free(&ev);
+
+ /* FIXME: hook onto destroys */
+ new->side_control = side;
+ new->view_control = view;
+ new->statusbar_control = statusbar;
+
+ return new;
+}
+
+void
+e_component_view_set_title(EComponentView *ecv, const char *title)
+{
+ CORBA_Environment ev = { 0 };
+
+ /* save roundtrips, check title is the same */
+ GNOME_Evolution_ShellView_setTitle(ecv->shell_view, ecv->id, title, &ev);
+ CORBA_exception_free(&ev);
+}
+
+BONOBO_TYPE_FUNC_FULL (EComponentView, GNOME_Evolution_ComponentView, bonobo_object_get_type(), e_component_view)
+
diff --git a/shell/e-component-view.h b/shell/e-component-view.h
new file mode 100644
index 0000000000..5263eed4d1
--- /dev/null
+++ b/shell/e-component-view.h
@@ -0,0 +1,78 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-component-view.h
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _E_COMPONENT_VIEW_H_
+#define _E_COMPONENT_VIEW_H_
+
+#include <bonobo/bonobo-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+struct _GtkWidget;
+
+typedef struct _EComponentView EComponentView;
+typedef struct _EComponentViewPrivate EComponentViewPrivate;
+typedef struct _EComponentViewClass EComponentViewClass;
+
+#include "Evolution.h"
+
+#define E_TYPE_COMPONENT_VIEW (e_component_view_get_type ())
+#define E_COMPONENT_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_COMPONENT_VIEW, EComponentView))
+#define E_COMPONENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_COMPONENT_VIEW, EComponentViewClass))
+#define E_IS_COMPONENT_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
+#define E_IS_COMPONENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
+
+struct _EComponentView {
+ BonoboObject parent;
+
+ EComponentViewPrivate *priv;
+
+ char *id;
+ GNOME_Evolution_ShellView shell_view;
+
+ struct _BonoboControl *side_control;
+ struct _BonoboControl *view_control;
+ struct _BonoboControl *statusbar_control;
+};
+
+struct _EComponentViewClass {
+ BonoboObjectClass parent_class;
+
+ POA_GNOME_Evolution_ComponentView__epv epv;
+};
+
+GType e_component_view_get_type(void);
+EComponentView *e_component_view_new(GNOME_Evolution_ShellView shell_view, const char *id, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *status);
+EComponentView *e_component_view_new_controls(GNOME_Evolution_ShellView parent, const char *id, struct _BonoboControl *side, struct _BonoboControl *view, struct _BonoboControl *statusbar);
+
+void e_component_view_set_title(EComponentView *ecv, const char *title);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_COMPONENT_VIEW_H_ */
+
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
new file mode 100644
index 0000000000..e5a749801e
--- /dev/null
+++ b/shell/e-shell-view.c
@@ -0,0 +1,109 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-shell-view.c
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Helper class for evolution shells to setup a view
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include <gtk/gtkwindow.h>
+
+#include "e-shell-view.h"
+#include "e-shell-window.h"
+
+static BonoboObjectClass *parent_class = NULL;
+
+struct _EShellViewPrivate {
+ int dummy;
+};
+
+static void
+impl_ShellView_setTitle(PortableServer_Servant _servant, const CORBA_char *id, const CORBA_char * title, CORBA_Environment * ev)
+{
+ EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
+ char *tmp = g_strdup_printf("Evolution - %s", title);
+
+ printf("shell view:setTitle '%s'\n", title);
+
+ e_shell_window_set_title(esw->window, id, tmp);
+ g_free(tmp);
+}
+
+static void
+impl_ShellView_setComponent(PortableServer_Servant _servant, const CORBA_char *id, CORBA_Environment * ev)
+{
+ EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
+
+ e_shell_window_switch_to_component(esw->window, id);
+}
+
+static void
+impl_dispose (GObject *object)
+{
+ /*EShellView *esv = (EShellView *)object;*/
+
+ ((GObjectClass *)parent_class)->dispose(object);
+}
+
+static void
+impl_finalise (GObject *object)
+{
+ ((GObjectClass *)parent_class)->finalize(object);
+}
+
+static void
+e_shell_view_class_init (EShellViewClass *klass)
+{
+ GObjectClass *object_class;
+ POA_GNOME_Evolution_ShellView__epv *epv;
+
+ parent_class = g_type_class_ref(bonobo_object_get_type());
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = impl_dispose;
+ object_class->finalize = impl_finalise;
+
+ epv = & klass->epv;
+ epv->setTitle = impl_ShellView_setTitle;
+ epv->setComponent = impl_ShellView_setComponent;
+}
+
+static void
+e_shell_view_init (EShellView *shell)
+{
+}
+
+EShellView *e_shell_view_new(struct _EShellWindow *window)
+{
+ EShellView *new = g_object_new (e_shell_view_get_type (), NULL);
+
+ /* TODO: listen to destroy? */
+ new->window = window;
+
+ return new;
+}
+
+BONOBO_TYPE_FUNC_FULL (EShellView, GNOME_Evolution_ShellView, bonobo_object_get_type(), e_shell_view)
+
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
new file mode 100644
index 0000000000..a28ea282c5
--- /dev/null
+++ b/shell/e-shell-view.h
@@ -0,0 +1,70 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-view.h
+ *
+ * Copyright (C) 2000 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * This is only a CORBA wrapper around e_shell_window.
+ */
+
+#ifndef _E_SHELL_VIEW_H_
+#define _E_SHELL_VIEW_H_
+
+#include <bonobo-activation/bonobo-activation.h>
+#include <bonobo/bonobo-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+struct _EShell;
+
+typedef struct _EShellView EShellView;
+typedef struct _EShellViewPrivate EShellViewPrivate;
+typedef struct _EShellViewClass EShellViewClass;
+
+#include "Evolution.h"
+
+#define E_TYPE_SHELL_VIEW (e_shell_view_get_type ())
+#define E_SHELL_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_VIEW, EShellView))
+#define E_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_VIEW, EShellViewClass))
+#define E_IS_SHELL_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_VIEW))
+#define E_IS_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_VIEW))
+
+struct _EShellView {
+ BonoboObject parent;
+
+ struct _EShellWindow *window;
+
+ EShellViewPrivate *priv;
+};
+
+struct _EShellViewClass {
+ BonoboObjectClass parent_class;
+
+ POA_GNOME_Evolution_ShellView__epv epv;
+};
+
+GType e_shell_view_get_type (void);
+EShellView *e_shell_view_new(struct _EShellWindow *window);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_SHELL_VIEW_H_ */
+