~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-client-gnome/src/widget/imwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2010 Savoir-Faire Linux Inc.
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 3 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 *  You should have received a copy of the GNU General Public License
 
15
 *  along with this program; if not, write to the Free Software
 
16
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
17
 *
 
18
 *  Additional permission under GNU GPL version 3 section 7:
 
19
 *
 
20
 *  If you modify this program, or any covered work, by linking or
 
21
 *  combining it with the OpenSSL project's OpenSSL library (or a
 
22
 *  modified version of that library), containing parts covered by the
 
23
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 
24
 *  grants you additional permission to convey the resulting work.
 
25
 *  Corresponding Source for a non-source form of such a combination
 
26
 *  shall include the source code for the parts of OpenSSL used as well
 
27
 *  as that of the covered work.
 
28
 */
 
29
 
 
30
 
 
31
#ifndef __IM_WIDGET_H__
 
32
#define __IM_WIDGET_H__
 
33
 
 
34
#include <gtk/gtk.h>
 
35
#include <callable_obj.h>
 
36
#include <webkit/webkit.h>
 
37
#include <conference_obj.h>
 
38
 
 
39
G_BEGIN_DECLS
 
40
 
 
41
#define IM_WIDGET_TYPE             (im_widget_get_type())
 
42
#define IM_WIDGET(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), IM_WIDGET_TYPE, IMWidget))
 
43
#define IM_WIDGET_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST((vtable), IM_WIDGET_TYPE, IMWidgetClass))
 
44
#define IS_IM_WIDGET(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), IM_WIDGET_TYPE))
 
45
#define IS_IM_WIDGET_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), IM_WIDGET_TYPE))
 
46
#define IM_WIDGET_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS((inst), IM_WIDGET_TYPE, IMWidgetClass))
 
47
 
 
48
#define MESSAGE_LEVEL_NORMAL            0
 
49
#define MESSAGE_LEVEL_WARNING           1
 
50
#define MESSAGE_LEVEL_ERROR                     2
 
51
 
 
52
typedef struct _IMWidget      IMWidget;
 
53
typedef struct _IMWidgetClass IMWidgetClass;
 
54
 
 
55
struct _IMWidget {
 
56
    GtkVBox parent_instance;
 
57
 
 
58
    /* Private */
 
59
    GtkWidget *tab;
 
60
    GtkWidget *textarea;
 
61
    GtkWidget *web_view;
 
62
    GtkWidget *info_bar;
 
63
    GtkWidget *info_state;
 
64
    gchar *call_id;
 
65
    gchar *first_message;           // Message displayed at widget's creation time
 
66
    gchar *first_message_from;      // Sender of the first message (usefull in case of a conference)
 
67
    WebKitWebFrame *web_frame;      // Our web frame
 
68
    JSGlobalContextRef js_context;  // The frame's global JS context
 
69
    JSObjectRef js_global;          // The frame's global context JS object
 
70
    gboolean containText;
 
71
};
 
72
 
 
73
struct _IMWidgetClass {
 
74
    GtkContainerClass parent_class;
 
75
};
 
76
 
 
77
 
 
78
/*! @function
 
79
@abstract       Display the instant messaging interface for this call. If it has not been created yet, create it and attached it to the imWindow.
 
80
@param          A reference on the call attached to the current IM widget
 
81
@param          The first message to be displayed, webkit's frames are loaded asynchronously
 
82
@param          The call id to be associated with the IMWidget
 
83
@param          The first message sender, could be different of call id for conferences
 
84
@return         TRUE if window is already created, FALSE elsewhere
 
85
 */
 
86
gboolean im_widget_display (IMWidget**, const gchar*, const gchar*, const gchar*);
 
87
 
 
88
GType im_widget_get_type (void) G_GNUC_CONST;
 
89
 
 
90
/*! @function
 
91
@abstract       Create a new widget with first_message
 
92
*/
 
93
GtkWidget *im_widget_new ();
 
94
 
 
95
/*! @function
 
96
@abstract       Create a new widget with first_message
 
97
*/
 
98
GtkWidget *im_widget_new_with_first_message (const gchar *message);
 
99
 
 
100
 
 
101
/*! @function
 
102
@abstract       Add a new message in the webkit view
 
103
@param          The IMWidget
 
104
@param          The sender of the message
 
105
@param          The message to be send
 
106
@param          The level of the message: NORMAL or ERROR
 
107
*/
 
108
void im_widget_add_message (IMWidget *im, const gchar *from, const gchar *message, gint level);
 
109
 
 
110
void im_widget_send_message (gchar *id, const gchar *message);
 
111
 
 
112
gchar* im_widget_add_message_time ();
 
113
 
 
114
/*! @function
 
115
@abstract       Build the GtkInfoBar used to display call information and IM Widget status
 
116
@param          The IM Widget
 
117
*/
 
118
void im_widget_infobar (IMWidget *im);
 
119
 
 
120
GtkWidget* call_state_image_widget (call_state_t state);
 
121
 
 
122
GtkWidget* conf_state_image_widget (conference_state_t state);
 
123
 
 
124
void im_widget_update_state (IMWidget *im, gboolean active);
 
125
 
 
126
G_END_DECLS
 
127
 
 
128
#endif  /* __IM_WIDGET_H__ */