aboutsummaryrefslogtreecommitdiffstats
path: root/executive-summary/evolution-services/executive-summary-client.c
blob: 145e385c1a827f57c0f114079a82cb31486d000e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-client.c
 *
 * Authors: Iain Holmes <iain@helixcode.com>
 *
 * Copyright (C) 2000  Helix Code, 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.
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <bonobo.h>
#include <gnome.h>
#include <gal/util/e-util.h>

#include "Executive-Summary.h"
#include "executive-summary-client.h"
#include "executive-summary-component.h"

#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE
static BonoboObjectClass *parent_class = NULL;

struct _ExecutiveSummaryClientPrivate {
    int dummy;
};

static void
executive_summary_client_destroy (GtkObject *object)
{
    ExecutiveSummaryClient *client;
    ExecutiveSummaryClientPrivate *priv;
    
    client = EXECUTIVE_SUMMARY_CLIENT (object);
    priv = client->private;
    
    if (priv == NULL)
        return;
    
    g_free (priv);
    client->private = NULL;
    
    (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}

static void
executive_summary_client_init (ExecutiveSummaryClient *client)
{
    ExecutiveSummaryClientPrivate *priv;
    
    priv = g_new0 (ExecutiveSummaryClientPrivate, 1);
    client->private = priv;
}

static void
executive_summary_client_class_init (ExecutiveSummaryClientClass *client)
{
    GtkObjectClass *object_class;
    
    object_class = GTK_OBJECT_CLASS (client);
    parent_class = gtk_type_class (PARENT_TYPE);
    
    object_class->destroy = executive_summary_client_destroy;
}

void
executive_summary_client_construct (ExecutiveSummaryClient *client,
                    CORBA_Object corba_object)
{
    g_return_if_fail (client != NULL);
    g_return_if_fail (IS_EXECUTIVE_SUMMARY_CLIENT (client));
    g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
    
    bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (client), corba_object);
}

E_MAKE_TYPE (executive_summary_client, "ExecutiveSummaryClient",
         ExecutiveSummaryClient, executive_summary_client_class_init,
         executive_summary_client_init, PARENT_TYPE);

void
executive_summary_client_set_title (ExecutiveSummaryClient *client,
                    int id,
                    const char *title)
{
    GNOME_Evolution_Summary_ViewFrame summary;
    CORBA_Environment ev;

    CORBA_exception_init (&ev);
    summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));

    GNOME_Evolution_Summary_ViewFrame_setTitle (summary, id, title, &ev);

    if (ev._major != CORBA_NO_EXCEPTION) {
        g_warning ("Error setting title to %s:%s", title, CORBA_exception_id (&ev));
    }

    CORBA_exception_free (&ev);
}

void
executive_summary_client_set_icon (ExecutiveSummaryClient *client,
                   int id,
                   const char *icon)
{
    GNOME_Evolution_Summary_ViewFrame summary;
    CORBA_Environment ev;

    CORBA_exception_init (&ev);
    summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));

    GNOME_Evolution_Summary_ViewFrame_setIcon (summary, id, icon, &ev);

    if (ev._major != CORBA_NO_EXCEPTION) {
        g_warning ("Error setting icon to %s:%s", icon, CORBA_exception_id (&ev));
    }

    CORBA_exception_free (&ev);
}

void
executive_summary_client_flash (ExecutiveSummaryClient *client,
                int id)
{
    GNOME_Evolution_Summary_ViewFrame summary;
    CORBA_Environment ev;

    CORBA_exception_init (&ev);
    summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));

    GNOME_Evolution_Summary_ViewFrame_flash (summary, id, &ev);

    if (ev._major != CORBA_NO_EXCEPTION) {
        g_warning ("Error flashing");
    }

    CORBA_exception_free (&ev);
}

void
executive_summary_client_update (ExecutiveSummaryClient *client,
                 int id,
                 const char *html)
{
    GNOME_Evolution_Summary_ViewFrame summary;
    CORBA_Environment ev;

    CORBA_exception_init (&ev);
    summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));

    GNOME_Evolution_Summary_ViewFrame_updateComponent (summary, id, html, &ev);
    if (ev._major != CORBA_NO_EXCEPTION) {
        g_warning ("Error updating the component");
    }

    CORBA_exception_free (&ev);
}