2
* Copyright (C) 2010 Savoir-Faire Linux Inc.
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.
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.
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.
18
* Additional permission under GNU GPL version 3 section 7:
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.
31
#ifndef __IM_WIDGET_H__
32
#define __IM_WIDGET_H__
35
#include <callable_obj.h>
36
#include <webkit/webkit.h>
37
#include <conference_obj.h>
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))
48
#define MESSAGE_LEVEL_NORMAL 0
49
#define MESSAGE_LEVEL_WARNING 1
50
#define MESSAGE_LEVEL_ERROR 2
52
typedef struct _IMWidget IMWidget;
53
typedef struct _IMWidgetClass IMWidgetClass;
56
GtkVBox parent_instance;
63
GtkWidget *info_state;
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
73
struct _IMWidgetClass {
74
GtkContainerClass parent_class;
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
86
gboolean im_widget_display (IMWidget**, const gchar*, const gchar*, const gchar*);
88
GType im_widget_get_type (void) G_GNUC_CONST;
91
@abstract Create a new widget with first_message
93
GtkWidget *im_widget_new ();
96
@abstract Create a new widget with first_message
98
GtkWidget *im_widget_new_with_first_message (const gchar *message);
102
@abstract Add a new message in the webkit view
104
@param The sender of the message
105
@param The message to be send
106
@param The level of the message: NORMAL or ERROR
108
void im_widget_add_message (IMWidget *im, const gchar *from, const gchar *message, gint level);
110
void im_widget_send_message (gchar *id, const gchar *message);
112
gchar* im_widget_add_message_time ();
115
@abstract Build the GtkInfoBar used to display call information and IM Widget status
118
void im_widget_infobar (IMWidget *im);
120
GtkWidget* call_state_image_widget (call_state_t state);
122
GtkWidget* conf_state_image_widget (conference_state_t state);
124
void im_widget_update_state (IMWidget *im, gboolean active);
128
#endif /* __IM_WIDGET_H__ */