Commit e9d61a3e authored by Margaux Clerc's avatar Margaux Clerc
Browse files

new ui improvements more contact oriented :

	-integration of the chat window in the main window
	-change of the contact tab
	-change of the appearance of the window call and conference
	-chat messages saved during the time of the execution of the software
parent 212e987d
......@@ -6,7 +6,6 @@
<property name="border_width">5</property>
<property name="title" translatable="yes">Search contacts in directory</property>
<property name="window_position">center-on-parent</property>
<property name="icon">linphone2.png</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<signal handler="gtk_widget_destroy" name="response"/>
......
......@@ -19,178 +19,237 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
#ifdef HAVE_GTK_OSX
#include <gtkosxapplication.h>
#endif
void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
GtkWidget *main_window=linphone_gtk_get_main_window ();
GtkWidget *w=linphone_gtk_get_widget(main_window,"chatroom_frame");
GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch");
int idx;
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w=g_object_get_data(G_OBJECT(friendlist),"chatview");
int idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"idx"));
g_return_if_fail(w!=NULL);
idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w);
gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
linphone_chat_room_set_user_data(cr,NULL);
linphone_gtk_update_chat_picture();
g_object_set_data(G_OBJECT(friendlist),"chatview",NULL);
gtk_widget_destroy(w);
}
GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr){
GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr,const LinphoneAddress *uri){
GtkWidget *w=gtk_hbox_new (FALSE,0);
GtkWidget *i=create_pixmap ("chat.png");
GtkWidget *l;
GtkWidget *b=gtk_button_new_with_label("x");
gtk_widget_set_size_request(b,20,20);
g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr);
gchar *text=g_strdup_printf("Chat ");
l=gtk_label_new (text);
gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0);
gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0);
gtk_widget_show_all(w);
return w;
}
void linphone_gtk_push_text(GtkTextView *v, const char *from, const char *message, gboolean me){
GtkTextBuffer *b=gtk_text_view_get_buffer(v);
GtkTextIter iter,begin;
void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, const char *message, gboolean me,LinphoneChatRoom *cr){
GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textview"));
GtkTextBuffer *buffer=gtk_text_view_get_buffer(text);
GtkTextIter iter,begin;
GList *l = g_object_get_data(G_OBJECT(w),"list");
gtk_text_buffer_get_start_iter(buffer,&begin);
int off;
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_get_end_iter(buffer,&iter);
off=gtk_text_iter_get_offset(&iter);
gtk_text_buffer_insert(b,&iter,from,-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_insert(b,&iter,":\t",-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_get_iter_at_offset(b,&begin,off);
//gtk_text_buffer_apply_tag_by_name(b,me ? "green" : "blue" ,&begin,&iter);
gtk_text_buffer_insert(b,&iter,message,-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_insert(b,&iter,"\n",-1);
gtk_text_buffer_get_end_iter(b,&iter);
GtkTextMark *mark=gtk_text_buffer_create_mark(b,NULL,&iter,FALSE);
gtk_text_view_scroll_mark_onscreen(v,mark);
//gtk_text_buffer_get_end_iter(b,&iter);
//gtk_text_iter_forward_to_line_end(&iter);
//gtk_text_view_scroll_to_iter(v,&iter,0,TRUE,1.0,1.0);
}
/*void linphone_gtk_push_text_start(GtkTextView *v, const char *from, const char *message){
GtkTextBuffer *b=gtk_text_view_get_buffer(v);
GtkTextIter iter,begin;
int off;
gtk_text_buffer_get_end_iter(b,&iter);
off=gtk_text_iter_get_offset(&iter);
gtk_text_buffer_insert(b,&iter,from,-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_insert(b,&iter,":\t",-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_get_iter_at_offset(b,&begin,off);
if(g_strcmp0((char *)g_object_get_data(G_OBJECT(w),"from_message"),linphone_address_as_string(from))!=0){
gtk_text_buffer_get_iter_at_offset(buffer,&iter,off);
const char *display=linphone_address_get_display_name(from);
if (display==NULL || display[0]=='\0') {
display=linphone_address_get_username(from);
}
gtk_text_buffer_insert(buffer,&iter,display,-1);
//gtk_text_buffer_apply_tag_by_name(b,"bold",&begin,&iter);
gtk_text_buffer_get_end_iter(buffer,&iter);
gtk_text_buffer_insert(buffer,&iter,":",-1);
gtk_text_buffer_get_end_iter(buffer,&iter);
gtk_text_buffer_insert(buffer,&iter,"\n",-1);
g_object_set_data(G_OBJECT(w),"from_message",linphone_address_as_string(from));
}
//gtk_text_buffer_apply_tag_by_name(b,me ? "green" : "blue" ,&begin,&iter);
gtk_text_buffer_insert(b,&iter,message,-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_insert(b,&iter,"\n",-1);
gtk_text_buffer_get_end_iter(b,&iter);
//GtkTextMark *mark=gtk_text_buffer_create_mark(b,NULL,&iter,FALSE);
//gtk_text_view_scroll_mark_onscreen(v,mark);
gtk_text_buffer_get_end_iter(buffer,&iter);
gtk_text_buffer_get_iter_at_offset(buffer,&begin,off);
if(me){
l=g_list_append(l,GINT_TO_POINTER(gtk_text_iter_get_offset(&iter)));
g_object_set_data(G_OBJECT(w),"list",l);
}
gtk_text_buffer_insert(buffer,&iter,"\t",-1);
gtk_text_buffer_insert(buffer,&iter,message,-1);
gtk_text_buffer_get_end_iter(buffer,&iter);
gtk_text_buffer_insert(buffer,&iter,"\n",-1);
GtkTextMark *mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE);
gtk_text_view_scroll_mark_onscreen(text,mark);
//gtk_text_buffer_get_end_iter(b,&iter);
//gtk_text_iter_forward_to_line_end(&iter);
//gtk_text_view_scroll_to_iter(v,&iter,0,TRUE,1.0,1.0);
}*/
gtk_text_buffer_get_bounds (buffer, &begin, &iter);
GHashTable *hash=(GHashTable *)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"history");
if(me){
g_hash_table_insert(hash,linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr)),
(gpointer)gtk_text_buffer_get_text(buffer,&begin,&iter,FALSE));
} else {
const char* linphone_gtk_get_used_identity(){
g_hash_table_insert(hash,linphone_address_as_string_uri_only(from),
(gpointer)gtk_text_buffer_get_text(buffer,&begin,&iter,FALSE));
}
g_object_set_data(G_OBJECT(linphone_gtk_get_main_window()),"history",hash);
}
const LinphoneAddress* linphone_gtk_get_used_identity(){
LinphoneCore *lc=linphone_gtk_get_core();
LinphoneProxyConfig *cfg;
linphone_core_get_default_proxy(lc,&cfg);
const char* display;
const LinphoneAddress* u;
if (cfg) {
u = linphone_address_new(linphone_proxy_config_get_identity(cfg));
} else {
u = linphone_core_get_primary_contact_parsed(lc);
}
display=linphone_address_get_display_name(u);
if (display==NULL || display[0]=='\0') {
display=linphone_address_as_string(u);
if (cfg) return linphone_address_new(linphone_proxy_config_get_identity(cfg));
else return linphone_core_get_primary_contact_parsed(lc);
}
/* function in dev for displaying ack*/
void update_chat_state_message(LinphoneChatMessageState state){
/*GdkPixbuf *pixbuf;
switch (state) {
case LinphoneChatMessageStateInProgress:
pixbuf=create_pixbuf("chat_message_in_progress.png");
break;
case LinphoneChatMessageStateDelivered:
pixbuf=create_pixbuf("chat_message_delivered.png");
break;
case LinphoneChatMessageStateNotDelivered:
pixbuf=create_pixbuf("chat_message_not_delivered.png");
break;
default : pixbuf=NULL;
}
return display;
GtkWidget *main_window=linphone_gtk_get_main_window();
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *page=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
if(page!=NULL){
GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(page,"textview"));
GtkTextBuffer *b=gtk_text_view_get_buffer(text);
GtkTextIter iter;
GList *l = g_object_get_data(G_OBJECT(page),"list");
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_get_iter_at_offset(b,&iter,GPOINTER_TO_INT(g_list_nth_data(l,0)));
fprintf(stdout,"offset check %i \n",GPOINTER_TO_INT(g_list_nth_data(l,0)));
l=g_list_remove(l,g_list_nth_data(l,0));
gtk_text_buffer_insert_pixbuf(b,&iter,pixbuf);
//gtk_text_buffer_get_end_iter(b,&iter);
//gtk_text_buffer_insert_pixbuf(b,&iter,pixbuf);
//gtk_text_buffer_get_end_iter(b,&iter);
//gtk_text_buffer_insert(b,&iter,"\n",-1);
g_object_set_data(G_OBJECT(page),"list",l);
} else {
fprintf(stdout,"NULLLL\n");
}*/
}
static void on_chat_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *user_pointer){
g_message("chat message state is %s",linphone_chat_message_state_to_string(state));
update_chat_state_message(state);
}
void linphone_gtk_send_text(LinphoneChatRoom *cr){
GtkWidget *chat_view=(GtkWidget*)linphone_chat_room_get_user_data(cr);
GtkWidget *entry= linphone_gtk_get_widget(chat_view,"text_entry");
GtkWidget *main_window=linphone_gtk_get_main_window();
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
GtkWidget *entry=linphone_gtk_get_widget(w,"text_entry");
const gchar *entered;
entered=gtk_entry_get_text(GTK_ENTRY(entry));
entered=gtk_entry_get_text(GTK_ENTRY(entry));
if (strlen(entered)>0) {
LinphoneChatMessage *msg;
linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview")),
linphone_gtk_push_text(w,
linphone_gtk_get_used_identity(),
entered,TRUE);
msg=linphone_chat_room_create_message(cr,entered);
entered,TRUE,g_object_get_data(G_OBJECT(w),"cr"));
msg=linphone_chat_room_create_message(cr,entered);
linphone_chat_room_send_message2(cr,msg,on_chat_state_changed,NULL);
gtk_entry_set_text(GTK_ENTRY(entry),"");
}
}
void linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const char *with){
GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *with){
GtkWidget *chat_view=linphone_gtk_create_widget("main","chatroom_frame");
GtkWidget *main_window=linphone_gtk_get_main_window ();
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
GtkTextBuffer *b;
GtkWidget *text=linphone_gtk_get_widget(chat_view,"textview");
int idx;
b=gtk_text_view_get_buffer(GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview")));
gtk_text_buffer_create_tag(b,"blue","foreground","blue",NULL);
gtk_text_buffer_create_tag(b,"green","foreground","green",NULL);
gtk_notebook_append_page (notebook,chat_view,create_tab_chat_header(cr));
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(text),GTK_WRAP_WORD);
gtk_text_view_set_editable (GTK_TEXT_VIEW(text),FALSE);
gtk_notebook_append_page (notebook,chat_view,create_tab_chat_header(cr,with));
idx = gtk_notebook_page_num(notebook, chat_view);
gtk_notebook_set_current_page(notebook, idx);
gtk_widget_show(chat_view);
GList *l = NULL;
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
linphone_chat_room_set_user_data(cr,chat_view);
//linphone_gtk_get_used_identity()
GtkWidget *text=linphone_gtk_get_widget(chat_view,"textview");
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(text),GTK_WRAP_WORD);
//linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview")),NULL,
// "Conversation avec moi",FALSE);
//linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview")),with,
// "Conversation avec ",FALSE);
//Initialisation des signaux
g_object_set_data(G_OBJECT(chat_view),"idx",GINT_TO_POINTER(idx));
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
g_object_set_data(G_OBJECT(chat_view),"from_chatroom",linphone_address_as_string_uri_only(with));
g_object_set_data(G_OBJECT(chat_view),"list",l);
GtkWidget *button = linphone_gtk_get_widget(chat_view,"send");
g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,cr);
GtkWidget *entry = linphone_gtk_get_widget(chat_view,"text_entry");
g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,cr);
}
return chat_view;
}
LinphoneChatRoom * linphone_gtk_create_chatroom(const char *with){
LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),with);
LinphoneChatRoom * linphone_gtk_create_chatroom(const LinphoneAddress *with){
LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),linphone_address_as_string(with));
if (!cr) return NULL;
linphone_gtk_init_chatroom(cr,with);
return cr;
}
void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const char* uri){
GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(cr);
if(w==NULL){
linphone_gtk_init_chatroom(cr, uri);
} else {
//TODO
void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,GtkWidget *chat_view){
GtkWidget *main_window=linphone_gtk_get_main_window ();
GHashTable *hash=g_object_get_data(G_OBJECT(main_window),"history");
if(g_strcmp0((char *)g_object_get_data(G_OBJECT(chat_view),"from_chatroom"),
linphone_address_as_string_uri_only(uri))!=0)
{
GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
GtkTextIter start;
GtkTextIter end;
gchar *buf=g_hash_table_lookup(hash,linphone_address_as_string_uri_only(uri));
GtkTextBuffer *text_buffer;
text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
text_buffer=gtk_text_view_get_buffer (text_view);
gtk_text_buffer_get_bounds (text_buffer, &start, &end);
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
gtk_text_buffer_delete (text_buffer, &start, &end);
if(buf!=NULL){
gtk_text_buffer_insert(text_buffer,&start,buf,-1);
printf("buf non nul\n");
} else {
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
GtkWidget *entry = linphone_gtk_get_widget(chat_view,"text_entry");
g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,cr);
GtkWidget *button = linphone_gtk_get_widget(chat_view,"send");
g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,cr);
}
g_object_set_data(G_OBJECT(chat_view),"from_chatroom",linphone_address_as_string_uri_only(uri));
ms_free(buf);
}
}
......@@ -206,32 +265,33 @@ void linphone_gtk_chat_close(GtkWidget *button){
void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){
GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room);
if (w==NULL){
linphone_gtk_init_chatroom(room,linphone_address_as_string_uri_only(from));
w=(GtkWidget*)linphone_chat_room_get_user_data(room);
}
GtkWidget *main_window=linphone_gtk_get_main_window();
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w;
w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
if(w!=NULL){
linphone_gtk_load_chatroom(room,from,w);
} else {
w=linphone_gtk_init_chatroom(room,from);
g_object_set_data(G_OBJECT(friendlist),"chatview",(gpointer)w);
}
#ifdef HAVE_GTK_OSX
/* Notified when a new message is sent */
linphone_gtk_status_icon_set_blinking(TRUE);
#else
if(!GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"is_notified"))){
linphone_gtk_notify(NULL,message);
g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(TRUE));
} else {
g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(FALSE));
#else
if(!gtk_window_is_active(GTK_WINDOW(main_window))){
if(!GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"is_notified"))){
linphone_gtk_notify(NULL,message);
g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(TRUE));
} else {
g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(FALSE));
}
}
#endif
const char* display = linphone_address_get_display_name(from);
if(display==NULL){
display = linphone_address_as_string(from);
}
linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textview")),
display,
message,FALSE);
linphone_gtk_push_text(w,from,message,FALSE,room);
//gtk_window_present(GTK_WINDOW(w));
/*gtk_window_set_urgency_hint(GTK_WINDOW(w),TRUE);*/
}
......
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
#define PADDING_PIXELS 4
......@@ -48,27 +48,32 @@ static void init_local_participant(GtkWidget *participant){
static GtkWidget *get_conference_tab(GtkWidget *mw){
GtkWidget *box=(GtkWidget*)g_object_get_data(G_OBJECT(mw),"conference_tab");
if (box==NULL){
box=gtk_vbox_new(FALSE,0);
GtkWidget *participant=linphone_gtk_create_widget("main","callee_frame");
gtk_box_set_homogeneous(GTK_BOX(box),TRUE);
init_local_participant(participant);
gtk_box_pack_start(GTK_BOX(box),participant,FALSE,FALSE,PADDING_PIXELS);
gtk_widget_show(box);
g_object_set_data(G_OBJECT(mw),"conference_tab",box);
gtk_notebook_append_page(GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch")),box,
create_conference_label());
GtkWidget *conf_frame=(GtkWidget*)g_object_get_data(G_OBJECT(mw),"conf_frame");
if(conf_frame!=NULL){
if (box==NULL){
GtkWidget *conf_box=linphone_gtk_get_widget(conf_frame,"conf_box");
box=gtk_vbox_new(FALSE,0);
GtkWidget *participant=linphone_gtk_create_widget("main","callee_frame");
gtk_box_set_homogeneous(GTK_BOX(box),TRUE);
init_local_participant(participant);
gtk_box_pack_start(GTK_BOX(box),participant,FALSE,FALSE,PADDING_PIXELS);
gtk_widget_show(box);
g_object_set_data(G_OBJECT(mw),"conference_tab",box);
gtk_box_pack_start(GTK_BOX(conf_box),box,FALSE,FALSE,PADDING_PIXELS);
}
}
return box;
}
static GtkWidget *find_conferencee_from_call(LinphoneCall *call){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *tab=get_conference_tab(mw);
get_conference_tab(mw);
GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(mw),"conf_frame");
GtkWidget *conf_box=linphone_gtk_get_widget(conf_frame,"conf_box");
GList *elem;
GtkWidget *ret=NULL;
if (call!=NULL){
GList *l=gtk_container_get_children(GTK_CONTAINER(tab));
GList *l=gtk_container_get_children(GTK_CONTAINER(conf_box));
for(elem=l;elem!=NULL;elem=elem->next){
GtkWidget *frame=(GtkWidget*)elem->data;
if (call==g_object_get_data(G_OBJECT(frame),"call")){
......@@ -84,14 +89,25 @@ static GtkWidget *find_conferencee_from_call(LinphoneCall *call){
void linphone_gtk_set_in_conference(LinphoneCall *call){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *participant=find_conferencee_from_call(call);
GtkWidget *viewswitch=linphone_gtk_get_widget(mw,"viewswitch");
GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(mw),"conf_frame");
g_object_set_data(G_OBJECT(mw),"is_conf",GINT_TO_POINTER(TRUE));
if(conf_frame==NULL){
conf_frame=linphone_gtk_create_widget("main","conf_frame");
GtkWidget *button_conf=linphone_gtk_get_widget(conf_frame,"terminate_conf");
GtkWidget *image=create_pixmap("stopcall-red.png");
gtk_button_set_image(GTK_BUTTON(button_conf),image);
g_signal_connect_swapped(G_OBJECT(button_conf),"clicked",(GCallback)linphone_gtk_terminate_call,NULL);
g_object_set_data(G_OBJECT(mw),"conf_frame",(gpointer)conf_frame);
gtk_notebook_append_page(GTK_NOTEBOOK(viewswitch),conf_frame,
create_conference_label());
}
GtkWidget *participant=find_conferencee_from_call(call);
GtkWidget *conf_box=linphone_gtk_get_widget(conf_frame,"conf_box");
if (participant==NULL){
GtkWidget *tab=get_conference_tab(mw);
const LinphoneAddress *addr=linphone_call_get_remote_address(call);
participant=linphone_gtk_create_widget("main","callee_frame");
GtkWidget *sound_meter;
GtkWidget *viewswitch=linphone_gtk_get_widget(mw,"viewswitch");
gchar *markup;
if (linphone_address_get_display_name(addr)!=NULL){
markup=g_strdup_printf("<b>%s</b>",linphone_address_get_display_name(addr));
......@@ -103,17 +119,14 @@ void linphone_gtk_set_in_conference(LinphoneCall *call){
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(participant,"callee_name_label")),markup);
g_free(markup);
sound_meter=linphone_gtk_get_widget(participant,"sound_indicator");
linphone_gtk_init_audio_meter(sound_meter, (get_volume_t) linphone_call_get_play_volume, call);
gtk_box_pack_start(GTK_BOX(tab),participant,FALSE,FALSE,PADDING_PIXELS);
linphone_gtk_init_audio_meter(sound_meter, (get_volume_t) linphone_call_get_play_volume, call);
gtk_box_pack_start(GTK_BOX(conf_box),participant,FALSE,FALSE,PADDING_PIXELS);
g_object_set_data_full(G_OBJECT(participant),"call",linphone_call_ref(call),(GDestroyNotify)linphone_call_unref);
gtk_widget_show(participant);
gtk_notebook_set_current_page(GTK_NOTEBOOK(viewswitch),
gtk_notebook_page_num(GTK_NOTEBOOK(viewswitch),tab));
gtk_notebook_page_num(GTK_NOTEBOOK(viewswitch),conf_frame));
}
}
void linphone_gtk_terminate_conference_participant(LinphoneCall *call){
GtkWidget *frame=find_conferencee_from_call(call);
if (frame){
......@@ -123,20 +136,23 @@ void linphone_gtk_terminate_conference_participant(LinphoneCall *call){
void linphone_gtk_unset_from_conference(LinphoneCall *call){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *box=(GtkWidget*)g_object_get_data(G_OBJECT(mw),"conference_tab");
GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(mw),"conf_frame");
GtkWidget *conf_box=linphone_gtk_get_widget(conf_frame,"conf_box");
GtkWidget *frame;
if (box==NULL) return; /*conference tab already destroyed*/
if (conf_box==NULL) return; /*conference tab already destroyed*/
frame=find_conferencee_from_call(call);
GList *children;
if (frame){
gtk_widget_destroy(frame);
}
children=gtk_container_get_children(GTK_CONTAINER(box));
children=gtk_container_get_children(GTK_CONTAINER(conf_box));
if (g_list_length(children)==2){
/*the conference is terminated */
gtk_widget_destroy(box);
g_object_set_data(G_OBJECT(mw),"conference_tab",NULL);
gtk_widget_destroy(conf_box);
g_object_set_data(G_OBJECT(mw),"conference_tab",NULL);
}
gtk_widget_destroy(conf_frame);
g_list_free(children);
g_object_set_data(G_OBJECT(mw),"is_conf",GINT_TO_POINTER(FALSE));
g_object_set_data(G_OBJECT(mw),"conf_frame",NULL);
}
......@@ -7,7 +7,6 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="window_position">center-on-parent</property>
<property name="icon">linphone2.png</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox7">
......
......@@ -32,10 +32,10 @@ enum{
FRIEND_ICON,
FRIEND_CALL,
FRIEND_CHAT,
FRIEND_CHAT_CONVERSATION,
FRIEND_LIST_NCOL
};
typedef struct _status_picture_tab_t{
LinphoneOnlineStatus status;
const char *img;
......@@ -82,6 +82,12 @@ static GdkPixbuf *create_chat_picture(){
return pixbuf;
}
static GdkPixbuf *create_active_chat_picture(){
GdkPixbuf *pixbuf;
pixbuf = create_pixbuf("active_chat.png");
return pixbuf;
}
/*
void linphone_gtk_set_friend_status(GtkWidget *friendlist , LinphoneFriend * fid, const gchar *url, const gchar *status, const gchar *img){
GtkTreeIter iter;
LinphoneFriend *tmp=0;
......@@ -101,9 +107,9 @@ void linphone_gtk_set_friend_status(GtkWidget *friendlist , LinphoneFriend * fid
}
}
}while(gtk_tree_model_iter_next(model,&iter));
}
}
}
*/
static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
GtkTreeSelection *select;
GtkTreeIter iter;
......@@ -123,7 +129,7 @@ static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
void linphone_gtk_add_contact(){
GtkWidget *w=linphone_gtk_create_window("contact");
int presence_enabled=linphone_gtk_get_ui_config_int("use_subscribe_notify",1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"show_presence")),presence_enabled);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"allow_presence")),
presence_enabled);
......@@ -144,7 +150,6 @@ void linphone_gtk_edit_contact(GtkWidget *button){
}
}
void linphone_gtk_remove_contact(GtkWidget *button){
GtkWidget *w=gtk_widget_get_toplevel(button);
GtkTreeSelection *select;
......@@ -166,6 +171,56 @@ static void linphone_gtk_call_selected(GtkTreeView *treeview){
"start_call"));
}
void linphone_gtk_update_chat_picture(){
GtkTreeIter iter;
GtkWidget *w = linphone_gtk_get_main_window();
GtkWidget *friendlist=linphone_gtk_get_widget(w,"contact_list");
GtkTreeModel *model=gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
if (gtk_tree_model_get_iter_first(