diff --git a/sflphone-client-gnome/src/contacts/Makefile.am b/sflphone-client-gnome/src/contacts/Makefile.am index 8afd0f4dc01a53dfd633191c6663ade77b3fcd8e..288196626b1825dc76be5d094d32f81ed8d7bfbe 100644 --- a/sflphone-client-gnome/src/contacts/Makefile.am +++ b/sflphone-client-gnome/src/contacts/Makefile.am @@ -10,7 +10,8 @@ libcontacts_la_SOURCES = \ calltab.c \ calltree.c \ history.c \ - addressbook.c + addressbook.c \ + conferencelist.c libcontacts_la_LDFLAGS = @DEPS_LDFLAGS@ diff --git a/sflphone-client-gnome/src/contacts/calllist.h b/sflphone-client-gnome/src/contacts/calllist.h index 3caccad439c4689374c411b296125ac8cff5bf18..29e83c99283488220740723af4da939fc6f24952 100644 --- a/sflphone-client-gnome/src/contacts/calllist.h +++ b/sflphone-client-gnome/src/contacts/calllist.h @@ -31,12 +31,12 @@ typedef struct { GtkListStore* store; GtkWidget* view; GtkWidget* tree; - GtkWidget* searchbar; + GtkWidget* searchbar; - // Calllist vars + // Calllist vars GQueue* callQueue; callable_obj_t* selectedCall; - gchar *_name; + gchar *_name; } calltab_t; void diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index d9fb9c0aa9a9419ec7fe449f30092474e3535b72..08b088eb7467247f1c0d4d718398c696c22a276c 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -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); diff --git a/sflphone-client-gnome/src/contacts/conferencelist.c b/sflphone-client-gnome/src/contacts/conferencelist.c new file mode 100644 index 0000000000000000000000000000000000000000..5d38920133dfcdc22664896df74d3cc3187367e7 --- /dev/null +++ b/sflphone-client-gnome/src/contacts/conferencelist.c @@ -0,0 +1,111 @@ +/* + * 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); +} diff --git a/sflphone-client-gnome/src/contacts/conferencelist.h b/sflphone-client-gnome/src/contacts/conferencelist.h new file mode 100644 index 0000000000000000000000000000000000000000..82681620854392b03cd34b48eea1490024d21cd5 --- /dev/null +++ b/sflphone-client-gnome/src/contacts/conferencelist.h @@ -0,0 +1,73 @@ +/* + * 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 diff --git a/sflphone-client-gnome/tests/check_contacts.c b/sflphone-client-gnome/tests/check_contacts.c index 55625a5fc8f8a78fc8b5266098004d9f8f7dc64d..193cab4b8fb99bd4591487ea188a729523aa9563 100644 --- a/sflphone-client-gnome/tests/check_contacts.c +++ b/sflphone-client-gnome/tests/check_contacts.c @@ -37,23 +37,23 @@ END_TEST Suite * contacts_suite (void) { - Suite *s = suite_create ("Contacts"); + Suite *s = suite_create("Contacts"); - TCase *tc_cases = tcase_create ("EDS"); - tcase_add_test (tc_cases, test_eds); - suite_add_tcase (s, tc_cases); + TCase *tc_cases = tcase_create("EDS"); + tcase_add_test (tc_cases, test_eds); + suite_add_tcase (s, tc_cases); - return s; + return s; } int main (void) { - int number_failed; - Suite *s = contacts_suite (); - SRunner *sr = srunner_create (s); - srunner_run_all (sr, CK_NORMAL); - number_failed = srunner_ntests_failed (sr); - srunner_free (sr); - return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; + int number_failed; + Suite *s = contacts_suite (); + SRunner *sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }