calllist.h 4.02 KB
Newer Older
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
1
/*
2
 *  Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
3
 *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
4
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
5
6
 *  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
7
 *  the Free Software Foundation; either version 3 of the License, or
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
8
 *  (at your option) any later version.
9
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
10
11
12
13
 *  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.
14
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
15
16
17
 *  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., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19
20
21
22
23
24
25
26
27
28
 *
 *  Additional permission under GNU GPL version 3 section 7:
 *
 *  If you modify this program, or any covered work, by linking or
 *  combining it with the OpenSSL project's OpenSSL library (or a
 *  modified version of that library), containing parts covered by the
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 *  grants you additional permission to convey the resulting work.
 *  Corresponding Source for a non-source form of such a combination
 *  shall include the source code for the parts of OpenSSL used as well
 *  as that of the covered work.
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
29
 */
30

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
31
32
33
34
#ifndef __CALLLIST_H__
#define __CALLLIST_H__

#include <gtk/gtk.h>
35
36
#include "callable_obj.h"
#include "conference_obj.h"
37

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
38
39
40
/** @file calllist.h
  * @brief A list to hold calls.
  */
41

42
43
typedef enum { HIST_CONFERENCE, HIST_CALL } ElementType;

44
typedef union {
45
46
47
48
49
50
51
52
53
   callable_obj_t *call;
   conference_obj_t *conf;
} callableElement;

typedef struct {
    ElementType type;
    callableElement elem;
} QueueElement;

54
typedef struct {
Alexandre Savard's avatar
Alexandre Savard committed
55
56
57
58
59
60
61
    GtkTreeStore* store;
    GtkWidget* view;
    GtkWidget* tree;
    GtkWidget* searchbar;

    // Calllist vars
    GQueue* callQueue;
62
    GQueue* conferenceQueue;
Alexandre Savard's avatar
Alexandre Savard committed
63
64
65
66
    gint selectedType;
    callable_obj_t* selectedCall;
    conference_obj_t* selectedConf;
    gchar *_name;
67
68
} calltab_t;

Julien Bonjean's avatar
Julien Bonjean committed
69
void
Julien Bonjean's avatar
Julien Bonjean committed
70
calllist_add_contact (gchar *, gchar *, contact_type_t, GdkPixbuf *);
areversat's avatar
areversat committed
71

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
72
/** This function empty and free the call list. */
Julien Bonjean's avatar
Julien Bonjean committed
73
void
Alexandre Savard's avatar
Alexandre Savard committed
74
calllist_clean (calltab_t* tab);
Emmanuel Milou's avatar
Emmanuel Milou committed
75
76

/** This function empty, free the call list and allocate a new one. */
Julien Bonjean's avatar
Julien Bonjean committed
77
void
Julien Bonjean's avatar
Julien Bonjean committed
78
calllist_reset (calltab_t* tab);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
79

80
/** Get the maximun number of calls in the history calltab */
Julien Bonjean's avatar
Julien Bonjean committed
81
gdouble
Alexandre Savard's avatar
Alexandre Savard committed
82
call_history_get_max_calls (void);
83
84

/** Set the maximun number of calls in the history calltab */
Julien Bonjean's avatar
Julien Bonjean committed
85
void
Alexandre Savard's avatar
Alexandre Savard committed
86
call_history_set_max_calls (const gdouble number);
87

88
89
/** This function append a call to list.
  * @param c The call you want to add
90
  * */
Julien Bonjean's avatar
Julien Bonjean committed
91
void
92
calllist_add_call (calltab_t* tab, callable_obj_t * c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
93

94
/** This function remove a call from list.
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
95
96
  * @param callID The callID of the call you want to remove
  */
Julien Bonjean's avatar
Julien Bonjean committed
97
void
98
calllist_remove_call (calltab_t* tab, const gchar * callID);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
99

100
/** Return the first call that corresponds to the state.
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
101
102
103
  * This is usefull for unique states as DIALING and CURRENT.
  * @param state The state
  * @return A call or NULL */
104
callable_obj_t *
Julien Bonjean's avatar
Julien Bonjean committed
105
calllist_get_by_state (calltab_t* tab, call_state_t state);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
106

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
107
108
/** Return the number of calls in the list
  * @return The number of calls in the list */
Julien Bonjean's avatar
Julien Bonjean committed
109
guint
Julien Bonjean's avatar
Julien Bonjean committed
110
calllist_get_size (calltab_t* tab);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
111

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
112
113
114
/** Return the call at the nth position in the list
  * @param n The position of the call you want
  * @return A call or NULL */
115
QueueElement *
Alexandre Savard's avatar
Alexandre Savard committed
116
calllist_get_nth (calltab_t* tab, guint n);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
117
118
119
120

/** Return the call corresponding to the callID
  * @param n The callID of the call you want
  * @return A call or NULL */
121
callable_obj_t *
122
calllist_get_call (calltab_t* tab, const gchar * callID);
Emmanuel Milou's avatar
Emmanuel Milou committed
123

124
125
126
/**
 * Clean the history. Delete all calls
 */
Julien Bonjean's avatar
Julien Bonjean committed
127
void
Julien Bonjean's avatar
Julien Bonjean committed
128
calllist_clean_history();
129
130
131
132
133

/**
 * Remove one specified call from the history list
 * @param c The call to remove
 */
Julien Bonjean's avatar
Julien Bonjean committed
134
void
Alexandre Savard's avatar
Alexandre Savard committed
135
calllist_remove_from_history (callable_obj_t* c);
136

137
138
139
140
141
142
/**
 * Initialize a non-empty call list
 */
void
calllist_set_list (calltab_t* tab, gchar **call_list);

143
#endif