aboutsummaryrefslogblamecommitdiffstats
path: root/executive-summary/evolution-services/executive-summary-client.c
blob: b2415810ba634fd5c822fb7fe10adacd7fbdb273 (plain) (tree)
1
2
3
4
5
6
7
8
9


                                                                           
                                         
  
                                   

                                                                
                                                                   
                                                        















                                                                    



































































                                                                                     
                                           

                                                      
                                                  



                                                                      
 
                                                                             








                                                                                            



                                                                  
                                                  




                                                                      
                                                                           








                                                                                          
                                                               
                                       
 
                                                  



                                                                      
 
                                                                   









                                                                

                                                  
 
                                                  



                                                                      
 
                                                                                   







                                                           
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-client.c
 *
 * Authors: Iain Holmes <iain@ximian.com>
 *
 * 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.
 */

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

#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);
}