Skip to content
Snippets Groups Projects
Commit 129e083c authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2006] Add a conferencelist data structure in client-gnome

parent c5e7b3d5
Branches
Tags
No related merge requests found
......@@ -10,7 +10,8 @@ libcontacts_la_SOURCES = \
calltab.c \
calltree.c \
history.c \
addressbook.c
addressbook.c \
conferencelist.c
libcontacts_la_LDFLAGS = @DEPS_LDFLAGS@
......
......@@ -78,6 +78,7 @@ selected(GtkTreeSelection *sel, void* data UNUSED )
calltab_select_call(active_calltree, (callable_obj_t*) g_value_get_pointer(&val));
// store info for dragndrop
path = gtk_tree_model_get_path(model, &iter);
string_path = (char*)gtk_tree_path_to_string(path);
......
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* 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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <conferencelist.h>
gchar*
generate_conf_id (void)
{
gchar *conf_id;
conf_id = g_new0(gchar, 30);
g_sprintf(conf_id, "%d", rand());
return conf_id;
}
void
conferencelist_init()
{
conferenceQueue = g_queue_new ();
}
void
conferencelist_clean()
{
g_queue_free (conferenceQueue);
}
void
conferencelist_reset()
{
g_queue_free (conferenceQueue);
conferenceQueue = g_queue_new();
}
void
conferencelist_add(const gchar* conf_id)
{
gchar* c = (gchar*)conferencelist_get(conf_id);
if(!c)
{
g_queue_push_tail (conferenceQueue, (gpointer)conf_id);
}
}
void
conferencelist_remove (const gchar* conf_id)
{
gchar* c = (gchar*)conferencelist_get(conf_id);
if (c)
{
g_queue_remove(conferenceQueue, c);
}
}
gchar*
conferencelist_get (const gchar* conf_id)
{
GList* c = g_queue_find(conferenceQueue, conf_id);
if (c)
{
return (gchar *)c->data;
}
else
{
return NULL;
}
}
gchar*
calllist_get_nth (const gchar* conf_id, guint n )
{
GList* c = g_queue_peek_nth(conferenceQueue, n);
if (c)
{
return (gchar*)c->data;
}
else
{
return NULL;
}
}
guint
conferencelist_get_size (const gchar* conf_id)
{
return g_queue_get_length (conferenceQueue);
}
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* 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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CONFERENCELIST_H__
#define __CONFERENCELIST_H__
#include <gtk/gtk.h>
/** @file conferencelist.h
* @brief A list to store conferences.
*/
GQueue* conferenceQueue;
/** This function initialize a conference list. */
void
conferencelist_init ();
/** This function empty and free the conference list. */
void
conferencelist_clean ();
/** This function empty, free the conference list and allocate a new one. */
void
conferencelist_reset ();
/** This function append a conference to the list.
* @param conf The conference you want to add
* */
void
conferencelist_add (const gchar* conf_id);
/** This function remove a conference from list.
* @param callID The callID of the conference you want to remove
*/
void
conferencelist_remove (const gchar* conf_id);
/** Return the number of calls in the list
* @return The number of calls in the list */
guint
conferencelist_get_size (const gchar* conf_id);
/** Return the call at the nth position in the list
* @param n The position of the call you want
* @return A call or NULL */
gchar*
conferencelist_get_nth (const gchar* conf_id);
/** Return the call corresponding to the callID
* @param n The callID of the call you want
* @return A call or NULL */
gchar*
conferencelist_get (const gchar* conf_id);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment